Hello there, I have a call to DrawInstanced()
that does not show up on screen. However if I open PIX or renderdoc, if I go look at the render target texture, I can see it show up. What could cause this?
Some additional details:
- This same PSO that I am using to draw works fine for other similar draw calls.
- The debug layer is not returning any error.
- The rasterizer state of the PSO has
CULL_MODE_NONE
set for the culling options.
I'm not sure what else to say because everything look correct when looking at the draw call in pix, it even shows up in the RTV. I hesitate to post the code since it's so much code, but the gist of what's happening is this:
- A compute shader uses an
AppendStructuredBuffer
to append some vertices to a resource. - I create a vertex buffer view that points to the resource of the
AppendStructuredBuffer
. - Draw using that VBV.
The compute shader:
struct bounding_box
{
float3 position[8];
};
AppendStructuredBuffer<bounding_box> bounds : register(u3);
groupshared float3 v_min;
groupshared float3 v_max;
#define threads_count 1024
[numthreads(threads_count, 1, 1)]
void CS(uint3 thread_id : SV_DispatchThreadID)
{
int index = thread_id.x;
// Other stuff...
// Calculate min/max vertices for the bounding box
GroupMemoryBarrier();
v_min = min(v_min, p.position);
v_max = max(v_max, p.position);
if (index == threads_count - 1)
{
// Generate positions from min/max
bounding_box new_bounds;
new_bounds.position[0] = v_min;
new_bounds.position[1] = float3(v_min.x, v_max.y, v_min.z);
new_bounds.position[2] = float3(v_min.x, v_min.y, v_max.z);
new_bounds.position[3] = float3(v_min.x, v_max.y, v_max.z);
new_bounds.position[4] = float3(v_max.x, v_min.y, v_min.z);
new_bounds.position[5] = float3(v_max.x, v_max.y, v_min.z);
new_bounds.position[6] = float3(v_max.x, v_min.y, v_max.z);
new_bounds.position[7] = v_max;
bounds.Append(new_bounds);
}
}
The draw code:
// Dispatch the compute shader to fill particle_system_bounds_default with vertex data...
// Draw the vertices
main_cmdlist->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_LINELIST);
main_cmdlist->SetPipelineState(bounds_pso);
D3D12_VERTEX_BUFFER_VIEW vbv = {};
vbv.BufferLocation = particle_system_bounds_default->GetGPUVirtualAddress();
vbv.SizeInBytes = sizeof(XMFLOAT3) * 8;
vbv.StrideInBytes = sizeof(XMFLOAT3);
main_cmdlist->IASetVertexBuffers(0, 1, &vbv);
main_cmdlist->DrawInstanced(8, 1, 0, 0);
PIX capture (look at the RTV for the 2nd draw call): https://1drv.ms/u/s!AiGFMy6hVmtNgZlqleTWa98CGMnKrQ?e=QHvSbe