aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2016-09-22 16:03:40 -0600
committerBrian Paul <[email protected]>2016-09-23 19:54:42 -0600
commit1cdc232e1ae683a7c45f81b44818cf8656480df8 (patch)
tree41e56390b67fa2386a7a8afd602b3ba4b2f9cbc5 /src
parentc0d7b6073d308101b4ffb59b588445e07dad7690 (diff)
st/mesa: fix swizzle issue in st_create_sampler_view_from_stobj()
Some demos, like Heaven, were creating and destroying a large number of sampler views because of a swizzle issue. Basically, we compute the sampler view's swizzle by examining the texture format, user swizzle, depth mode, etc. Later, during validation we recompute that swizzle (in case something like depth mode changes) and see if it matches the view's swizzle. In the case of PIPE_FORMAT_RGTC2_UNORM, get_texture_format_swizzle returned SWIZZLE_XYZW but the u_sampler_view_default_template() function was setting the sampler view's swizzle to SWIZZLE_XY01. This mismatch caused the validation step to always "fail" so we'd destroy the old sampler view and create a new one. By removing the conditional, the sampler view's swizzle and the computed texture swizzle match and validation "passes". When creating a new sampler view, we always want to use the texture swizzle which we just computed. Fixes VMware issue 1733389. Cc: [email protected] Reviewed-by: Charmaine Lee <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/state_tracker/st_atom_texture.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index b6471178ce4..a6135333b3e 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -299,12 +299,10 @@ st_create_texture_sampler_view_from_stobj(struct st_context *st,
templ.target = gl_target_to_pipe(stObj->base.Target);
}
- if (swizzle != SWIZZLE_NOOP) {
- templ.swizzle_r = GET_SWZ(swizzle, 0);
- templ.swizzle_g = GET_SWZ(swizzle, 1);
- templ.swizzle_b = GET_SWZ(swizzle, 2);
- templ.swizzle_a = GET_SWZ(swizzle, 3);
- }
+ templ.swizzle_r = GET_SWZ(swizzle, 0);
+ templ.swizzle_g = GET_SWZ(swizzle, 1);
+ templ.swizzle_b = GET_SWZ(swizzle, 2);
+ templ.swizzle_a = GET_SWZ(swizzle, 3);
return st->pipe->create_sampler_view(st->pipe, stObj->pt, &templ);
}