How do you create a cbuffer or global variable that is gpu modifiable?
- by bobobobo
I'm implementing tonemapping in a pixel shader, for hdr lighting.
The vertex shader outputs vertices with colors. I need to find the max color and save it in a global.
However when I try and write the global in my hlsl code,
//clamp the max color below by this color
clamp( maxColor, output.color, float4( 1e6,1e6,1e6,1e6 ) ) ;
I see:
error X3025: global variables are implicitly constant, enable compatibility mode to allow modification
What is the correct way to declare a shader global in d3d11 that the vertex shader can write to, and the pixel shader can read?
I realize this is a bit tough since the vertex shaders are supposed to run in parallel, and introducing a shader global that they all write to means a lock..