DirectX using C++_error X3539:ps1_x is no longer supported...解決方案

問題來源

在研究HLSL時編譯一個demo出現了error X3539的問題git

 

解決方案

將代碼中的ps_1_1 改成ps_2_0github

PixelShader = compile ps_1_1 PS();

  

或者是在D3DXCompileShaderFromFile函數中將對應的ps_1_1改成ps_2_0函數

//create pixel shader
ID3DXBuffer* codeBuffer        = 0;
ID3DXBuffer* errorBuffer       = 0;
HRESULT hr = D3DXCompileShaderFromFile("ps.txt",
                                       0,
                                       0,
                                       "PS_Main", // entry point function name
                                       "ps_2_0",  //ps_1_1 is error X3539
                                       D3DXSHADER_DEBUG,
                                       &codeBuffer,
                                       &errorBuffer,
                                       &pixelConstTable);

 

最後渲染出來的結果spa

demo源碼地址3d

 

參考資料

DX C++ error X3539_Stackoverflowcode

相關文章
相關標籤/搜索