Jump to content

  • Log In with Google      Sign In   
  • Create Account


Pixel Shader not loading - DirectX 11


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Muzzy A   Members   -  Reputation: 622

Like
0Likes
Like

Posted 22 September 2012 - 03:27 PM

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, 22 September 2012 - 03:28 PM.


Sponsor:

#2 Nik02   Crossbones+   -  Reputation: 2647

Like
0Likes
Like

Posted 23 September 2012 - 02:46 AM

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.

Niko Suni


#3 MJP   Moderators   -  Reputation: 10243

Like
0Likes
Like

Posted 23 September 2012 - 04:10 PM

You're trying to compile a pixel shader with a vertex shader profile. Use ps_5_0 instead.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS