I started to learn while coding some basic Direct3D 11 functionality.
My current code compiles and runs fine, but I still obtain:
X4717 Effects deprecated for D3DCompiler_47
I use only one .fx file named effect.fx:
//-------------------------------------------------------------------------------------- // ModelTransform Variables //-------------------------------------------------------------------------------------- cbuffer ModelTransform : register(b0) { matrix model_to_world; matrix world_to_view; matrix view_to_projection; } //----------------------------------------------------------------------------- // Vertex Shader //----------------------------------------------------------------------------- struct VS_OUTPUT { float4 p : SV_POSITION; float4 diffuse : COLOR0; }; VS_OUTPUT VS(float4 p : POSITION, float4 diffuse : COLOR) { VS_OUTPUT output = (VS_OUTPUT)0; output.p = mul(p, model_to_world); output.p = mul(output.p, world_to_view); output.p = mul(output.p, view_to_projection); output.diffuse = diffuse; return output; } //----------------------------------------------------------------------------- // Pixel Shader //----------------------------------------------------------------------------- float4 PS(VS_OUTPUT input) : SV_Target { return input.diffuse; }
which I compile at runtime
const HRESULT result_vertex_shader_blob = CompileShaderFromFile(L"Project 4/shaders/effect.fx", "VS", "vs_4_0", &vertex_shader_blob); const HRESULT result_pixel_shader_blob = CompileShaderFromFile(L"Project 4/shaders/effect.fx", "PS", "ps_4_0", &pixel_shader_blob);
These methods eventually call
D3DCompileFromFile
Should I break the code in one .vs and .ps file?
There is some discussion about Effects 11. But it doesn't really help.