Jump to content

View more

Image of the Day

#ld38 #screenshotsaturday Mimosa Fizz action gif #2 https://t.co/TUzdppvfUL
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Pixel Shader not loading - DirectX 11

4: Adsense

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   

737
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.


#2 Nik02   Members   

4299
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   

19483
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.