directx - HLSL 错误 X3086 : DX9-style 'compile' syntax is deprecated in strict mode

标签 directx shader hlsl directx-11

嘿, 我收到此错误:
错误 X3086:严格模式下不推荐使用 DX9 样式的“编译”语法
使用此代码编译 directx 效果时:

hr=D3DX11CompileFromFile( TEXT("shaders\\basic.fx"), NULL, NULL, NULL,"fx_5_0", D3DCOMPILE_ENABLE_STRICTNESS, 0, NULL, &pBlob, &pErrorBlob, NULL );

我很确定它正在提示这一点:

technique11 basic
{
 pass p0
 {
  VertexShader = compile vs_5_0 vsMain();
  PixelShader = compile ps_5_0 psMain();
 }
}

那么我应该使用什么来代替编译呢?

最佳答案

尝试:

technique11 basic
{
    pass p0
    {
        SetVertexShader( CompileShader( vs_5_0, vsMain() ) );
        SetPixelShader( CompileShader( ps_5_0, psMain() ) );
    }
}

关于directx - HLSL 错误 X3086 : DX9-style 'compile' syntax is deprecated in strict mode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4200777/

相关文章:

opengl-es - 使用具有多个颜色纹理附件的 FrameBufferObject

c++ - 硬编码 HLSL 着色器

c# - 操纵杆 + c# : Analog button

c++ - 相同的 Direct2D 应用程序在 "slower"机器上表现更好

c# - 防止屏幕捕获软件捕获应用程序屏幕

opengl - glsl 折射被颠倒映射

c++ - DirectX 窗口媒体键无响应

c# - OpenGL 可编程管道运行速度较慢?

xna - HLSL 像素着色器照明性能 (XNA)

c++ - hlsl 点光源问题