Public Group

This topic is 2444 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey there,

I am trying to learn DirectX (10 atm) but I have some difficulties with the documentation.
In many Tutorials (including the SDK) there are some lines that puzzle me. Here is a sample from a .fx file that is copied many times.
technique10 ColorTech { pass P0 { SetVertexShader( CompileShader( vs_4_0, VS() ) ); SetGeometryShader( NULL ); SetPixelShader( CompileShader( ps_4_0, PS() ) ); } }
My Problem is not that I don't understand what's going on, but where to find information about these functions: SetVertexShader, CompileShader etc.
Where the heck do they come from. I don't find any mentioning of these in the MSDN or in the SDK. The only place I've seen them is in the examples of the SDK and of course in many places where it's copy-pasted.
In the DX11 examples these lines are gone. Instead the C++ Code uses a function called CompileShaderFromFile. This is a good thing since I can find it in the docs too. The functions SetVertexShader and SetPixelShade are replaced by VSSetShader and PSSetShader.

Now my questions about the HLSL functions above: Am I blind? Are they really not mentioned in the docs? Are they deprecated? Since when?

##### Share on other sites
That is not HLSL code, that is part of the Effect framework in DirectX which helps to simplify the process of building and accessing shaders in your code. These are hints to the Effect framework on how to compile and link the different portions of the shader and are included as part of the .fx file. Then you can use the Effect framework from within your application to easily load the shader.

However, you do not have to use the Effect framework. In this case, you need to manually compile the shader programs individually and link them into a "shader program" using VSSetShader and PSSetShader (among others).

As a beginner, my suggestion is to stick with the Effect framework, and follow the examples that use it until you are more comfortable with what constitutes a shader program.

##### Share on other sites
So everything in the docs entitled with the word effect refers to this Effect Framework, right?

##### Share on other sites

So everything in the docs entitled with the word effect refers to this Effect Framework, right?

If my memory of the DirectX SDK serves me right, the Tutorial samples for DirectX 10 use the Effect Framework and the samples for DirectX 11 do not. However, you can use the Effect Framework in 11, and forgo using it in DirectX 10 as you please.

##### Share on other sites
IIRC, the effect framework for DirectX 11 is provided as source code, and must be compiled if you want to use it in your program. I haven't tried it, but I remember reading that you should be able to add the source files to your project. But hat's why the D3D11 samples don't use the effect framework—it's not provided in a ready-to-use form.

##### Share on other sites
Ok thanks. Now I need to delve further into DX. Sometimes things like these make it hard though.

• 9
• 16
• 9
• 13
• 41