Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/125.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ DX9中的HLSL着色器无法编译_C++_Directx_Hlsl_Directx 9 - Fatal编程技术网

C++ DX9中的HLSL着色器无法编译

C++ DX9中的HLSL着色器无法编译,c++,directx,hlsl,directx-9,C++,Directx,Hlsl,Directx 9,我有一个DirectX着色器(.fx和.fxo),并试图将其实现到我自己的DirectX9.0项目中,但使用 HRESULT hr = (D3DXCreateEffectFromFile(mD3DDevice, "Terrain.fx", 0, 0, D3DXSHADER_DEBUG, 0, &mFX, &errors)); 其中mD3DDevice是指向我的LPDirect3DDevice9的指针 我得到了错误 ID3DXEffectCompiler: There w

我有一个DirectX着色器(.fx和.fxo),并试图将其实现到我自己的DirectX9.0项目中,但使用

HRESULT hr = (D3DXCreateEffectFromFile(mD3DDevice, "Terrain.fx",
    0, 0, D3DXSHADER_DEBUG, 0, &mFX, &errors));
其中mD3DDevice是指向我的LPDirect3DDevice9的指针

我得到了错误

ID3DXEffectCompiler: There was an error initializing the compiler
我曾经尝试过使用不同的着色器进行编译,而该着色器可以进行编译,因此它与着色器的兼容性肯定存在问题。我知道着色器可以工作,因为我在另一个引擎(DirectX9.0c)中使用过它

这是我需要在着色器中更改的内容吗?还是别的什么

为DirectX 9.0c引擎编写的着色器的开始是使用常量缓冲区。这就是问题所在吗?DirectX9不能处理缓冲区吗?如果是这样,我将如何更改着色器或引擎以使其工作

非常感谢你的帮助

cbuffer cbPerFrame
{
    DirectionalLight gDirLights[3];
    float3 gEyePosW;

    float  gFogStart;
    float  gFogRange;
    float4 gFogColor;

    float gMinDist;
    float gMaxDist;

    float gMinTess;
    float gMaxTess;

    float gTexelCellSpaceU;
    float gTexelCellSpaceV;
    float gWorldCellSpace;
    float2 gTexScale = 50.0f;

    float4 gWorldFrustumPlanes[6];
};

常量缓冲区是DX10+,因此:DirectX9确实无法处理缓冲区。@Paul Jan但着色器来自在DirectX9上运行的另一个引擎。。。。(它在该引擎上工作)我认为@Paul Jan是正确的,
cbuffer
是一个ShaderModel 4.0构造,D3D9(c)只支持ShaderModel 3.0。但是,显然,
D3DXCreateEffectFromFile
():“Direct3D 10 HLSL编译器现在是默认编译器。有关详细信息,请参阅效果编译器工具。”。因此,虽然文件可以编译,但实际上可能无法工作。一个关键问题是您使用的是旧版DirectX SDK的哪个版本,特别是您使用的D3DX9的哪个不推荐版本?另外,显示着色器中声明效果/过程的部分。@ChuckWalbourn我使用的是2010年6月的SDK,如何知道我使用的是哪个版本的D3DX9?而且,当mFX effect对象返回NULL并产生错误时,它永远不会得到传递的效果