From: Marek Olšák <marek.ol...@amd.com> --- src/mesa/state_tracker/st_atom_sampler.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index ea231f3..e7968bb 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -112,23 +112,20 @@ gl_filter_to_img_filter(GLenum filter) /** * Convert a gl_sampler_object to a pipe_sampler_state object. */ void st_convert_sampler(const struct st_context *st, const struct gl_texture_object *texobj, const struct gl_sampler_object *msamp, struct pipe_sampler_state *sampler) { struct gl_context *ctx = st->ctx; - GLenum texBaseFormat; - - texBaseFormat = _mesa_texture_base_format(texobj); memset(sampler, 0, sizeof(*sampler)); sampler->wrap_s = gl_wrap_xlate(msamp->WrapS); sampler->wrap_t = gl_wrap_xlate(msamp->WrapT); sampler->wrap_r = gl_wrap_xlate(msamp->WrapR); sampler->min_img_filter = gl_filter_to_img_filter(msamp->MinFilter); sampler->min_mip_filter = gl_filter_to_mip_filter(msamp->MinFilter); sampler->mag_img_filter = gl_filter_to_img_filter(msamp->MagFilter); @@ -154,20 +151,21 @@ st_convert_sampler(const struct st_context *st, sampler->min_lod = tmp; assert(sampler->min_lod <= sampler->max_lod); } /* For non-black borders... */ if (msamp->BorderColor.ui[0] || msamp->BorderColor.ui[1] || msamp->BorderColor.ui[2] || msamp->BorderColor.ui[3]) { const GLboolean is_integer = texobj->_IsIntegerFormat; + GLenum texBaseFormat = _mesa_base_tex_image(texobj)->_BaseFormat; if (st->apply_texture_swizzle_to_border_color) { const struct st_texture_object *stobj = st_texture_object_const(texobj); const struct pipe_sampler_view *sv = NULL; /* Just search for the first used view. We can do this because the swizzle is per-texture, not per context. */ /* XXX: clean that up to not use the sampler view at all */ for (unsigned i = 0; i < stobj->num_sampler_views; ++i) { if (stobj->sampler_views[i]) { @@ -200,25 +198,28 @@ st_convert_sampler(const struct st_context *st, st_translate_color(&msamp->BorderColor, &sampler->border_color, texBaseFormat, is_integer); } } sampler->max_anisotropy = (msamp->MaxAnisotropy == 1.0 ? 0 : (GLuint) msamp->MaxAnisotropy); /* If sampling a depth texture and using shadow comparison */ - if ((texBaseFormat == GL_DEPTH_COMPONENT || - (texBaseFormat == GL_DEPTH_STENCIL && !texobj->StencilSampling)) && - msamp->CompareMode == GL_COMPARE_R_TO_TEXTURE) { - sampler->compare_mode = PIPE_TEX_COMPARE_R_TO_TEXTURE; - sampler->compare_func = st_compare_func_to_pipe(msamp->CompareFunc); + if (msamp->CompareMode == GL_COMPARE_R_TO_TEXTURE) { + GLenum texBaseFormat = _mesa_base_tex_image(texobj)->_BaseFormat; + + if (texBaseFormat == GL_DEPTH_COMPONENT || + (texBaseFormat == GL_DEPTH_STENCIL && !texobj->StencilSampling)) { + sampler->compare_mode = PIPE_TEX_COMPARE_R_TO_TEXTURE; + sampler->compare_func = st_compare_func_to_pipe(msamp->CompareFunc); + } } sampler->seamless_cube_map = ctx->Texture.CubeMapSeamless || msamp->CubeMapSeamless; } static void convert_sampler_from_unit(const struct st_context *st, struct pipe_sampler_state *sampler, -- 2.7.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev