From d0ac174fdaaf4b3f1e6f7d320585cf53379bd756 Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Thu, 17 Jun 2021 21:30:06 -0700 Subject: [PATCH] i915g: Force 1D textures to use wrap mode for the Y coordinate. There are no 1D textures in HW, so we use 2D, but at the shader level there no Y coordinate to 1D sampling, so we need that value to be ignored. WRAP mode can get us that. Part-of: --- src/gallium/drivers/i915/ci/piglit-i915-g33-fails.txt | 6 ------ src/gallium/drivers/i915/i915_state_sampler.c | 8 ++++++++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/i915/ci/piglit-i915-g33-fails.txt b/src/gallium/drivers/i915/ci/piglit-i915-g33-fails.txt index e066b512ffc..98a515a6ed0 100644 --- a/src/gallium/drivers/i915/ci/piglit-i915-g33-fails.txt +++ b/src/gallium/drivers/i915/ci/piglit-i915-g33-fails.txt @@ -140,12 +140,6 @@ spec@!opengl 1.2@texwrap 3d proj@GL_RGBA8- NPOT- projected,Fail spec@!opengl 1.2@texwrap 3d proj bordercolor,Fail spec@!opengl 1.2@texwrap 3d proj bordercolor@GL_RGBA8- projected- border color only,Fail spec@!opengl 1.4@gl-1.4-polygon-offset,Fail - -# 1D textures are treated as 2D, but we don't force -# the Y clamp to repeat or edge, so you get interpolation, and we get -# different undefined values in the y coordinate in the new shader. -spec@!opengl 1.4@gl-1.4-tex1d-2dborder,Fail - spec@!opengl 1.4@tex-miplevel-selection,Fail spec@!opengl 1.4@tex-miplevel-selection-lod,Fail spec@!opengl 1.4@tex-miplevel-selection-lod-bias,Fail diff --git a/src/gallium/drivers/i915/i915_state_sampler.c b/src/gallium/drivers/i915/i915_state_sampler.c index c04059dcc2e..f8d478ea00b 100644 --- a/src/gallium/drivers/i915/i915_state_sampler.c +++ b/src/gallium/drivers/i915/i915_state_sampler.c @@ -89,6 +89,14 @@ update_sampler(struct i915_context *i915, uint32_t unit, state[0] |= SS2_REVERSE_GAMMA_ENABLE; } + /* There is no HW support for 1D textures, so we just make them 2D textures + * with h=1, but that means we need to make the Y coordinate not contribute + * to bringing any border color in. Clearing it sets it to WRAP. + */ + if (pt->target == PIPE_TEXTURE_1D) { + state[1] &= ~SS3_TCY_ADDR_MODE_MASK; + } + /* The GLES2 spec says textures are incomplete (return 0,0,0,1) if: * * "A cube map sampler is called, any of the corresponding texture images are