Typed SRV always fetches zero

30 views Asked by At

The vertex shader always receives zero when looking up a typed resource view.

Buffer<unorm float> UnormBuffer : register(t0);

float4 main(VSInput input, uint id : SV_VertexID) : SV_POSITION
{
    float mag = 100.f * UnormBuffer[id];
    // mag always zero
}

The shader resource view bound to t0 has type DXGI_FORMAT_R8_UNORM.

The draw call is using instancing.

The debug layer doesn't emit any warnings or errors.

PIX shows the SRV to have the correct data, but when I step through the shader, zero is always returned.

Ideas?

1

There are 1 answers

0
Tom Huntington On BEST ANSWER

The SRV was wasn't actually typed DXGI_FORMAT_R8_UNORM, but was actually a structured buffer with stride 1. Correcting that fixed the problem.