I'm using Direct3D 9 to draw some primitives into a texture. The format used at texture creation is D3DFMT_A16B16G16R16F, and the primitives are drawn using additive blending. The additive blending works as expected provided the result is <= 1. If it is greater than 1 then it seems to be clamped to 1.
This question includes a comment stating that COLOR0 output semantics for a pixel shader automatically clamp the output values. I can't ask for elaboration there due to low SE rep. Is there anything else that I need to do on top of changing the texture format that I pass in to CreateTexture, in order to use the full range of 16-bit floats? Given that I can otherwise draw primitives with shading (aside from the clamping issue) fine, is there any other setup that needs to be done?
To illustrate my issue, I'm doing two passes of the following shader (ping-ponging between two textures in the aforementioned format):
texture tex;
sampler2D sam = sampler_state {
texture = <tex>;
minfilter = none;
magfilter = none;
mipfilter = none;
};
float4 main(float2 uv : TEXCOORD) : COLOR0 {
float4 cin = tex2D(sam, uv);
float4 cout = cin;
cout.g = 10;
if (cin.g > 1)
cout.b = 1;
return cout;
}
The output (starting from black) is a green screen. If I change:
cin.g > 1
To:
cin.g >= 1
Then I get a cyan screen.
I'm working from a modified version of SDL2's Direct3D 9 driver if that helps.