From 64435fd888ec5932024292d87b0afcecbe5fb818 Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Thu, 25 Aug 2016 19:31:53 -0400 Subject: i915g: fix incorrect gl_FragCoord value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Intel Pineview M hardware, the i915 gallium driver doesn't output the correct gl_FragCoord. It seems to always have an X coord of 0.0 and a Y coord of the window's height in pixels, e.g. 600.0f or such. I believe this is a regression caused in part by this commit: afa035031ff9e0c07a2297d864e46c76f7bfff58 The old behavior used the output at index zero, while the new behavior uses actual zeroes. In the case of gl_FragCoord the output at index zero happened to be the correct one, so the behavior appeared correct although the code already had a bug. Fixed by checking for I915_SEMANTIC_POS when setting up texCoords. If the generic_mapping is I915_SEMANTIC_POS, look for the TGSI_SEMANTIC_POSITION instead of a TGSI_SEMANTIC_GENERIC output. https://bugs.freedesktop.org/show_bug.cgi?id=97477 Reviewed-by: Stéphane Marchesin Tested-by: Stéphane Marchesin --- src/gallium/drivers/i915/i915_state_derived.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/gallium/drivers/i915') diff --git a/src/gallium/drivers/i915/i915_state_derived.c b/src/gallium/drivers/i915/i915_state_derived.c index 177b8545985..dbfbc84c9eb 100644 --- a/src/gallium/drivers/i915/i915_state_derived.c +++ b/src/gallium/drivers/i915/i915_state_derived.c @@ -145,7 +145,12 @@ static void calculate_vertex_layout(struct i915_context *i915) uint hwtc; if (texCoords[i]) { hwtc = TEXCOORDFMT_4D; - src = draw_find_shader_output(i915->draw, TGSI_SEMANTIC_GENERIC, fs->generic_mapping[i]); + if (fs->generic_mapping[i] == I915_SEMANTIC_POS) { + src = draw_find_shader_output(i915->draw, TGSI_SEMANTIC_POSITION, 0); + } + else { + src = draw_find_shader_output(i915->draw, TGSI_SEMANTIC_GENERIC, fs->generic_mapping[i]); + } draw_emit_vertex_attr(&vinfo, EMIT_4F, src); } else { -- cgit v1.2.3