Adjust HLSL vertex shader positions
Pixel positions (because of D3D9 half-pixel positions) and depth (adjust to -1/1). Optionally using D3D11 pixel positions and no depth adjustment still to do.
This commit is contained in:
parent
a896868215
commit
95a716f7de
@ -209,6 +209,12 @@ void CompilerHLSL::emit_resources()
|
||||
|
||||
bool emitted = false;
|
||||
|
||||
if (execution.model == ExecutionModelVertex)
|
||||
{
|
||||
statement("uniform float4 gl_HalfPixel;");
|
||||
emitted = true;
|
||||
}
|
||||
|
||||
// Output Uniform Constants (values, samplers, images, etc).
|
||||
for (auto &id : ids)
|
||||
{
|
||||
@ -442,6 +448,13 @@ void CompilerHLSL::emit_hlsl_entry_point()
|
||||
}
|
||||
}
|
||||
|
||||
if (execution.model == ExecutionModelVertex)
|
||||
{
|
||||
statement("output.gl_Position.x = output.gl_Position.x - gl_HalfPixel.x * output.gl_Position.w;");
|
||||
statement("output.gl_Position.y = output.gl_Position.y + gl_HalfPixel.y * output.gl_Position.w;");
|
||||
statement("output.gl_Position.z = (output.gl_Position.z + output.gl_Position.w) * 0.5;");
|
||||
}
|
||||
|
||||
statement("return output;");
|
||||
|
||||
end_scope();
|
||||
|
Loading…
Reference in New Issue
Block a user