Jump to content
  • Advertisement
Sign in to follow this  
Muzzy A

DX11 Pixel Shader not loading - DirectX 11

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I'm starting to learn how to use DirectX 11. Everything is going fine so far i think. But, I cannot get it to compile my pixel shader for some reason. I'm following the tutorial on DirectXTutorials.com


// I'm just trying to return the color orange, and that's it
/* shader.fx */
float4 VShader(float4 position : POSITION) : SV_POSITION
{
return position;
}

float4 PShader(float4 position : SV_POSITION) : SV_TARGET
{
return float4(1,.5f,0,1);
}

// In C++
ID3D10Blob *pVShader = nullptr;
ID3D10Blob *pPShader = nullptr;
D3DX11CompileFromFileA("shader.fx",0,0,"VShader","vs_5_0",0,0,0,&pVShader,0,0);
D3DX11CompileFromFileA("shader.fx",0,0,"PShader","vs_5_0",0,0,0,&pPShader,0,0);

// pPShader returns NULL here and I have no clue why


any ideas? Edited by Muzzy A

Share this post


Link to post
Share on other sites
Advertisement
You can get an "error blob" from the compile functions. If the shader compilation fails, it tells you why.

Also, you can use the command-line effect compiler (fxc.exe) to perform a quick test.

The actual error here, though, is that you try to compile the pixel shader with the vertex shader 5.0 profile.

Share this post


Link to post
Share on other sites
You're trying to compile a pixel shader with a vertex shader profile. Use ps_5_0 instead.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!