Differences between D3DXCompileShaderFromFile and D3DXAssembleShader

Started by
2 comments, last by zandarina 16 years, 8 months ago
Hi, I was doing my school project and I compiled the shader and I wrote the assembler code in my app and I used D3DXAssembleShader to get the code to create the vertex shader, and the render was ok. But now I prefer to do it from a txt file, and I use D3DXCompileShaderFromFile with the same file I compiled and I get strange results, the render is like a shadow moving, I don't understand why it happens because I have compiled the txt file and I get the same assembler code as the input parameter of the D3DXAssembleShader function. I don't uderstand what's wrong. D3DXCompileShaderFromFile( "./Data/Shader/shader.txt", // shader filename 0, 0, "main", // entry point function name "vs_1_1", // shader version to compile to D3DXSHADER_DEBUG, // debug compile &pCode, &pError, 0); and the one is ok for me D3DXAssembleShader(vertexShaderStr,sizeof(vertexShaderStr),NULL, NULL, 0, &pCode, &pError) Thank you very much Ah !!! I use to compile fxc /Tvs_1_1 shader.fx.txt /Fc dx9_vs1_1.vsa /Zpr
Advertisement
I have tried to read every line of the assembled code, and It is the same, it is so strange. Anyone has any idea ???. It can be that some parameters are no correct ???.

Thanks
The "Compile" function does take HLSL shader code (plus apparently ASM shader code), while the "Assemble" function does accept ASM shaders only.
----------
Gonna try that "Indie" stuff I keep hearing about. Let's start with Splatter.
I know, my problem is that the assembled code from the same file I use to read it from a file is different when I compile from my application

I mean:

1. I write my shader in txt format : shader.txt
2. I compile it with fxc /Tvs_1_1 shader.fx.txt /Fc dx9_vs1_1.vsa /Zpr
and I get the assembled code
3. I put the code in one string: vertexShaderStr
4. I call this funcion D3DXAssembleShader(vertexShaderStr,....
5. I get my bots rendered OK with vertex shader

But my problem is when instead of writing the code in my app I use D3DXCompileShaderFromFile, and I read the normal code from the file.

1. I write the shader, without using assembler, normal code,
(the same I compiled whith the other method)
2. I just use D3DXCompileShaderFromFile("./Data/Shader/shader.txt"....
to compile my code

It should be the same, but it is not, and I don't know why, I would prefer to read it from the file because It would be easier to change the code.

Thanks !!!!

This topic is closed to new replies.

Advertisement