1

私のコードは次のとおりです。

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);

と私の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();
     }
 }

それはとても単純なので問題を引き起こさないはずですが、そのようなエラーがあります:

ID3DXEffectCompiler: There were no techniques
ID3DXEffectCompiler: Compilation failed

エラーはどこにありますか?他の何かに問題があるようですが、他の例もコンパイルされないため、どこにあるのかわかりません。多分いくつかの無効な文字?しかしここで?または、EnterはUNIX形式である必要がありますか?

4

1 に答える 1

3

コンパイルしようとしているファイルのエンコーディングが正しくない場合、および正しい改行文字を使用していない場合、HLSLコンパイラには問題があります。元:

于 2010-04-30T17:57:06.937 に答える