2010-04-30 3 views
1

Mon code est:un problème compilant un effet HLSL

FileStream fs = new FileStream("ImageProcessing.fx", FileMode.Open,FileAccess.Read); 
     CompiledEffect compiledEffect = Effect.CompileEffectFromFile(fs, null, null, CompilerOptions.None, TargetPlatform.Windows); 
     fs.Close(); 
     effect = new Effect(graphics.GraphicsDevice, compiledEffect.GetEffectCode(), CompilerOptions.None, null); 

et mon fichier FX:

float4x4 xViewProjection; 

struct VertexToPixel 
{ 
float4 Position  : POSITION; 
float4 Color  : COLOR0; 
}; 

struct PixelToFrame 
{ 
    float4 Color  : COLOR0; 
}; 

    VertexToPixel SimplestVertexShader(float4 inPos : POSITION, float4 inColor : COLOR0) 
{ 
    VertexToPixel Output = (VertexToPixel)0; 

    Output.Position =mul(inPos, xViewProjection); 

    Output.Color = inColor; 

    return Output; 
} 

PixelToFrame OurFirstPixelShader(VertexToPixel PSIn) 
{ 
    PixelToFrame Output = (PixelToFrame)0;  

    Output.Color = PSIn.Color;  

    return Output; 
} 

technique Simplest 
{ 
    pass Pass 
    { 
     VertexShader = compile vs_2_0 SimplestVertexShader(); 
     PixelShader = compile ps_2_0 OurFirstPixelShader(); 
    } 
} 

si simple il ne devrait pas causer encore un problème il y a une telle erreur:

ID3DXEffectCompiler: There were no techniques 
ID3DXEffectCompiler: Compilation failed 

Où est l'erreur? Il semble y avoir un problème avec quelque chose d'autre mais je ne sais pas où parce que d'autres exemples ne compilent pas aussi. Peut-être un caractère invalide? Mais où? Ou entrez devrait être au format unix?

Répondre