I have a pixel shader that is writing to both color & depth (SV_TARGET & SV_DEPTH).
If use any value derived from a structured buffer it’s fine with the color, but not with the depth. Any clues? Simplified patch & shader attached.
// load a vaule from SB
float myValue = valueDefault;
uint vCount, dummy;
valueBuffer.GetDimensions(vCount, dummy);
if (vCount > 0) myValue = valueBuffer[0](0);
Out.Color = float4(In.TexCd.xy,0,1);
Out.Depth = In.PosWVP.z/In.PosWVP.w;
//error here, writing to color is fine, but depth is not happy
Out.Color += myValue; //ok
//Out.Depth += myValue; // not ok
return Out;
I guess this is related? Still don’t understand though tbh. If it’s not possible can use an extra render target for the depth instead of the SV (boo!).
No joy changing the naming, also tried driver updates. Not sure about latest DX build- I’m on Windows 8.1 and thought it was already included (correct me here, that’s just from googling).