summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiklós Máté <[email protected]>2016-03-24 01:13:00 +0100
committerMarek Olšák <[email protected]>2016-03-27 19:58:33 +0200
commitbaab345b192d207236253ce67b320fb32fa67625 (patch)
tree94c833790bbe212a49c2dceac38952b44ffaf41e
parent920fbecf57bc8e81db029a52f6ef1c9344d8ddab (diff)
st/mesa: fix handling the fallback texture
This fixes crash when post-processing is enabled in SW:KotOR. v2: fix const-ness v3: move assignment into the if() block Signed-off-by: Miklós Máté <[email protected]> Signed-off-by: Marek Olšák <[email protected]>
-rw-r--r--src/mesa/state_tracker/st_atom_sampler.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index 82dcf5ee0ca..a1cfa1c34c5 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -133,18 +133,19 @@ convert_sampler(struct st_context *st,
{
const struct gl_texture_object *texobj;
struct gl_context *ctx = st->ctx;
- struct gl_sampler_object *msamp;
+ const struct gl_sampler_object *msamp;
GLenum texBaseFormat;
texobj = ctx->Texture.Unit[texUnit]._Current;
if (!texobj) {
texobj = _mesa_get_fallback_texture(ctx, TEXTURE_2D_INDEX);
+ msamp = &texobj->Sampler;
+ } else {
+ msamp = _mesa_get_samplerobj(ctx, texUnit);
}
texBaseFormat = _mesa_texture_base_format(texobj);
- msamp = _mesa_get_samplerobj(ctx, texUnit);
-
memset(sampler, 0, sizeof(*sampler));
sampler->wrap_s = gl_wrap_xlate(msamp->WrapS);
sampler->wrap_t = gl_wrap_xlate(msamp->WrapT);