Reputation: 155
Is it possible to create shaders without the use of D3DX functions?
Upvotes: 1
Views: 545
Reputation: 46607
The HLSL compiler is, as of D3D9, part of the D3DX library. To write your shaders in HLSL, you have to use D3DX.
However, there's IDirect3DDevice9::CreatePixelShader
and IDirect3DDevice9::CreateVertexShader
, which create a shader handle from shader byte code, that is, from what is generated by the HLSL compiler.
You can run the HLSL compiler offline (see D3DXCompileShader
), save the machine code to a file and load it at runtime using the aforementioned functions. Sadly this means that you cannot rely on the work that is otherwise done by the D3DX framework. Uploading your constants and optimizing changes is totally up to you in this case.
Upvotes: 2