diff options
author | Gert Wollny <[email protected]> | 2018-07-01 19:32:09 +0200 |
---|---|---|
committer | Gert Wollny <[email protected]> | 2018-07-05 07:57:28 +0200 |
commit | 5278436d6742fc2065aa72ae5cd4c41eb89f9c92 (patch) | |
tree | f8f186fdebe8c922439606c6cc4f58df466a0e89 | |
parent | e7dd1a84a078ef59f1ba537db730143b3f255b20 (diff) |
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 <[email protected]>
Reviewed-by: Roland Scheidegger <[email protected]>
-rw-r--r-- | src/gallium/drivers/r600/evergreen_state.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 629385075b2..76a3e0e441a 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -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)) | |