r600: force LOD range to be only one value when mip.min filter is NONE

For a texture that has only one LOD defined, but for which
GL_TEXTURE_MAX_LEVEL is the default (1000) and
GL_TEXTURE_MIN_LOD != GL_TEXTURE_MAX_LOD the reading from the texture does
not properly resolve the LOD level and texture lookup might fail. Hence,
when no mipmap filter is given (indicating that no mip-mapping takes place),
force the LOD range to contain only value.

Fixes:
  dEQP-GLES3.functional.shaders.texture_functions.texture*.(i|u)sampler2d*
  dEQP-GLES3.functional.texture.format.sized.cube.rgb*
  out of VK_GL_CTS/android/cts/master/gles3-master.txt
Signed-off-by: Gert Wollny <gw.fossdev@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
This commit is contained in:
Gert Wollny
2018-07-01 19:32:09 +02:00
parent e7dd1a84a0
commit 5278436d67

View File

@@ -572,11 +572,19 @@ static void *evergreen_create_sampler_state(struct pipe_context *ctx,
unsigned max_aniso = rscreen->force_aniso >= 0 ? rscreen->force_aniso
: state->max_anisotropy;
unsigned max_aniso_ratio = r600_tex_aniso_filter(max_aniso);
float max_lod = state->max_lod;
if (!ss) {
return NULL;
}
/* If the min_mip_filter is NONE, then the texture has no mipmapping and
* MIP_FILTER will also be set to NONE. However, if more then one LOD is
* configured, then the texture lookup seems to fail for some specific texture
* formats. Forcing the number of LODs to one in this case fixes it. */
if (state->min_mip_filter == PIPE_TEX_MIPFILTER_NONE)
max_lod = state->min_lod;
ss->border_color_use = sampler_state_needs_border_color(state);
/* R_03C000_SQ_TEX_SAMPLER_WORD0_0 */
@@ -593,7 +601,7 @@ static void *evergreen_create_sampler_state(struct pipe_context *ctx,
/* R_03C004_SQ_TEX_SAMPLER_WORD1_0 */
ss->tex_sampler_words[1] =
S_03C004_MIN_LOD(S_FIXED(CLAMP(state->min_lod, 0, 15), 8)) |
S_03C004_MAX_LOD(S_FIXED(CLAMP(state->max_lod, 0, 15), 8));
S_03C004_MAX_LOD(S_FIXED(CLAMP(max_lod, 0, 15), 8));
/* R_03C008_SQ_TEX_SAMPLER_WORD2_0 */
ss->tex_sampler_words[2] =
S_03C008_LOD_BIAS(S_FIXED(CLAMP(state->lod_bias, -16, 16), 8)) |