Jump to content
  • Advertisement
Sign in to follow this  
ingramb

OpenGL Beginning D3D11, missing pixel shader

This topic is 2080 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

I'm just starting out with D3D11, trying to port an existing OpenGL game to D3D11.  Using the graphics debugger built into vs2013, I can see that I'm passing correct geometry into the input assembler, and it appears that I'm getting valid output from the vertex shader.  After that, it skips right to the output merger.  The pixel shader isn't being run, despite being set.

 

I'm not getting any errors or warning from the debug runtime.  I've disabled backface culling.  I have a valid viewport set.  I'm feeling pretty stumped at this point.  Anybody have any idea of what else I should look at?

 

This is my vertex shader:

 

cbuffer uniform_TransformState

{
    float4x4 param_Transform : packoffset ( c0 ) ;
    float4 param_Texture0Transform : packoffset ( c4 ) ;
    float4 param_CameraPosition : packoffset ( c5 ) ;
}
uniform SamplerState uniform_ColorTexture_State ;
uniform Texture2D uniform_ColorTexture ;
struct SagaAttributes
{
    float4 attr_Position : POSITION ;
    float2 attr_TexCoord0 : TEXCOORD0 ;
    float4 attr_Color : COLOR0 ;
}
;
struct SagaVarrying
{
    float2 var_TexCoord0 : TEXCOORD0 ;
    float4 var_Color : COLOR0 ;
}
;
float2 TextureTransform ( float2 attr , float4 transform )
{
    return attr . x * transform . xy + attr . y * transform . zw ;
}
void main_vert2 ( in SagaAttributes __attribute , out SagaVarrying __varrying , out float4 __position : SV_Position )
{
    __varrying . var_TexCoord0 = TextureTransform ( __attribute . attr_TexCoord0 , param_Texture0Transform ) ;
    __varrying . var_Color = __attribute . attr_Color ;
    __position = mul ( param_Transform , __attribute . attr_Position ) ;
}

 

This is my vertex shader output:

Vertex_Shader_PID_4712.png

Share this post


Link to post
Share on other sites
Advertisement

I've had previous experience with the graphics debugger where it didn't show the pixel shader even though being set, do you pass the debug flag when creating your shaders?

 

And are you getting any output from the pixel shader, despite not being able to see the stage.

 

-MIGI0027

Edited by Migi0027

Share this post


Link to post
Share on other sites

How do you know the PS isn't being run?

The 'Graphics Pipeline Stages' tab doesn't have pixel shader stage. It only shows 'Input Assembler->Vertex Shader->Output Merger'.

 

To make sure your PS is set correctly, in the 'Graphics Event List' go to your draw call and click on the ID3D11DeviceContext. It will open a new window with the entire state, you can check that your PS is set.

 

If you want to debug a specific pixel, right click anywhere on the image, select 'Pixel History', then click on a pixel. This will open a new window where you can see the graphics history and debug the vertex and pixel shaders.

Share this post


Link to post
Share on other sites

 

 

do you pass the debug flag when creating your shaders?

Yes.

 

 

And are you getting any output from the pixel shader, despite not being able to see the stage.

Not as far as I can tell.  When I check the pixel history, I only see the ClearRenderTarget.

 

 

The 'Graphics Pipeline Stages' tab doesn't have pixel shader stage. It only shows 'Input Assembler->Vertex Shader->Output Merger'.

When I run D3D sample apps through the graphics debugger, I do see pixel shader stage.

 

 

To make sure your PS is set correctly, in the 'Graphics Event List' go to your draw call and click on the ID3D11DeviceContext. It will open a new window with the entire state, you can check that your PS is set.

The pixel shader is set in the device context.  All the states in the device context look correct, as far as I can tell.

 

 

If you want to debug a specific pixel, right click anywhere on the image, select 'Pixel History', then click on a pixel. This will open a new window where you can see the graphics history and debug the vertex and pixel shaders.

When I check pixel history, I don't see my pixel shader anywhere.  Only the framebuffer clear.

 

Anyway, thanks for the suggestions so far.

Share this post


Link to post
Share on other sites

I usually use the Effects framework, so this may not be directly applicable.  But I have seen similar symptoms often when I try to use a shader compiled for SM 5.0 on a graphics card that only supports 4.0.  There will be no errors, but nothing will render, and when I examine the graphics pipeline stages in the debugger, the pixel shader stage is missing.

 

I've also seen this on some cards where using fxc to compile the shader with the oprimization flag /Od (for no optimizations, debug) causes a similar problem.

Share this post


Link to post
Share on other sites

Problem was setting 0 as the sample mask for OMSetBlendState.  It's always the little things.  Thanks for suggestions everyone.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!