• Advertisement
Sign in to follow this  

Feels like PS is never called

This topic is 741 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 have been trying to hunt down a strange issue with pixel shader for the whole day with no success and I would like to ask about your assistance.
Specifically, I am generating voxel grid using rasterization based on the article from GPU Pro 4 by Hawar Doghramachi.
To accomplish this, I am using D3D12 coservative rasterization and rasterizer ordered views (ROV).
The voxel scene data supposed to be written to the ROV from the pixel shader. But it feels like the pixel shader is never called.
I make the frame capture by VS 2015 built-in graphics debugger and check the content of the buffer after the render pass.
The content always have the same values after I clear it.
My first thought was that the triangles get clipped because they are outside of the view frustum.
I have simplified the shader code to verify that pixel shader is called.
I explicitly generate triangle in the vertex shader to ensure it is within the clip space.
struct VSInput
	uint vertexId			: SV_VertexID;

struct VSOutput
	float4 clipSpacePos		: SV_Position;
	float4 worldSpacePos		: POSITION;
	float3 worldSpaceNormal		: NORMAL;
	float4 color			: COLOR;

VSOutput Main(VSInput input)
	VSOutput output;

	output.worldSpacePos = float4(0.0f, 0.0f, 0.0f, 0.0f);
	output.worldSpaceNormal = float3(0.0f, 0.0f, 0.0f);
	output.color = float4(1.0f, 1.0f, 1.0f, 1.0f);

	if (input.vertexId == 0)
		output.clipSpacePos = float4(-1.0f, -1.0f, 0.5f, 1.0f);
	else if (input.vertexId == 1)
		output.clipSpacePos = float4( 0.0f,  1.0f, 0.5f, 1.0f);
	else if (input.vertexId == 2)
		output.clipSpacePos = float4( 1.0f,  0.0f, 0.5f, 1.0f);

	return output;

Here comes the pixel shader. Basically, it always writes some unique data for the first three elements so that I could check the buffer in the frame capture after the render pass.

//RasterizerOrderedStructuredBuffer<Voxel> GridBuffer : register(u0);

// Switched to using unordered access buffer as an experiment as well
RWStructuredBuffer<Voxel> GridBuffer : register(u0);

void Main(PSInput input)
	GridBuffer[0].colorAndNumOccluders = float4(1.0f, 1.0f, 1.0f, 1.0f);
	GridBuffer[1].colorAndNumOccluders = float4(2.0f, 2.0f, 2.0f, 2.0f);
	GridBuffer[2].colorAndNumOccluders = float4(3.0f, 3.0f, 3.0f, 3.0f);

I am not outputting anything to the render target. Still, I specify a viewport big enough to ensure the pixel shader is called.

In general case, do we specify viewport for the rasterizer stage if the pixel shader does not write to the render target but to the buffer?
The rasterizer stage is configured the following way.
FillMode SOLID 
CullMode NONE 
FrontCounterClockwise FALSE 
DepthBias 0 
DepthBiasClamp 0.000f 
SlopeScaledDepthBias 0.000f 
DepthClipEnable TRUE 
MultisampleEnable FALSE 
AntialiasedLineEnable FALSE 
ForcedSampleCount 0 
ConservativeRaster ON
I am running the app on Gefore 720M with D3D warp device (to support conservative raster and ROV).
The debug layer is enabled and there are no any warnings. I have run out of ideas what I could check further.
Any input or suggestions are really appreciative.
Many thanks indeed!
Edited by _void_

Share this post

Link to post
Share on other sites

I have spent one more day looking into the issue rolleyes.gif


I switched to outputting data from pixel shader to render target directly instead of Raster Ordered View.

Also, I disabled Conservative Raster.


This allowed me to switch to hardware D3D12 device (feature level 11.0) instead of WARP device (with feature level 12.0).

And I got the pixel shader called with the vertex shader I posted before.


Interestingly, if you generate vertex data we normally use for the full screen triangle in WARP device mode

vertexId = 0, float4(-1.0f,  1.0f, 0.0f, 1.0f);
vertexId = 1, float4( 3.0f,  1.0f, 0.0f, 1.0f);
vertexId = 2, float4(-1.0f, -3.0f, 0.0f, 1.0f);

the pixel shader will be invoked for each pixel in the screen.


However, if you generate something different in size (bigger or smaller) than the full screen triangle the pixel shader will not be invoked.

vertexId = 0, float4(-1.0f,  1.0f, 0.0f, 1.0f);
vertexId = 1, float4( 4.0f,  1.0f, 0.0f, 1.0f);
vertexId = 2, float4(-1.0f, -4.0f, 0.0f, 1.0f);

Looks like Microsoft WARP device bug.

Edited by _void_

Share this post

Link to post
Share on other sites

To be precise, it is like this


Hardware D3D12 Device mode (feature level 11.0) - OK

WARP D3D12 Device mode (feature level 11.0) - OK

WARP D3D12 Device mode (feature level 11.0) + Coservative Raster - NO


Yes, looks like a bug on Microsoft or driver side

Share this post

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

  • Advertisement