diff options
author | Ilia Mirkin <[email protected]> | 2016-11-12 18:58:46 -0500 |
---|---|---|
committer | Ilia Mirkin <[email protected]> | 2016-11-15 20:26:11 -0500 |
commit | 6364491a0ba4d97270ddfee223b4c2f79cc691f1 (patch) | |
tree | 76a5aa1aedc29f3412397b2be8cc3edcb76b7bb2 /src/gallium/drivers/swr/swr_shader.cpp | |
parent | a2c1d58ddbd77692a1c07a3e7606f6472722a93c (diff) |
swr: add support for upper-left fragcoord position
Fixes glsl-arb-fragment-coord-conventions.
Signed-off-by: Ilia Mirkin <[email protected]>
Reviewed-by: Tim Rowley <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr/swr_shader.cpp')
-rw-r--r-- | src/gallium/drivers/swr/swr_shader.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gallium/drivers/swr/swr_shader.cpp b/src/gallium/drivers/swr/swr_shader.cpp index 38a916e272c..04637e506f8 100644 --- a/src/gallium/drivers/swr/swr_shader.cpp +++ b/src/gallium/drivers/swr/swr_shader.cpp @@ -480,8 +480,14 @@ BuilderSWR::CompileFS(struct swr_context *ctx, swr_jit_fs_key &key) inputs[attrib][3] = wrap(VIMMED1(1.0f)); continue; } else if (semantic_name == TGSI_SEMANTIC_POSITION) { // gl_FragCoord - inputs[attrib][0] = wrap(LOAD(pPS, {0, SWR_PS_CONTEXT_vX, PixelPositions_center}, "vX")); - inputs[attrib][1] = wrap(LOAD(pPS, {0, SWR_PS_CONTEXT_vY, PixelPositions_center}, "vY")); + if (swr_fs->info.base.properties[TGSI_PROPERTY_FS_COORD_PIXEL_CENTER] == + TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER) { + inputs[attrib][0] = wrap(LOAD(pPS, {0, SWR_PS_CONTEXT_vX, PixelPositions_center}, "vX")); + inputs[attrib][1] = wrap(LOAD(pPS, {0, SWR_PS_CONTEXT_vY, PixelPositions_center}, "vY")); + } else { + inputs[attrib][0] = wrap(LOAD(pPS, {0, SWR_PS_CONTEXT_vX, PixelPositions_UL}, "vX")); + inputs[attrib][1] = wrap(LOAD(pPS, {0, SWR_PS_CONTEXT_vY, PixelPositions_UL}, "vY")); + } inputs[attrib][2] = wrap(LOAD(pPS, {0, SWR_PS_CONTEXT_vZ}, "vZ")); inputs[attrib][3] = wrap(LOAD(pPS, {0, SWR_PS_CONTEXT_vOneOverW, PixelPositions_center}, "vOneOverW")); |