summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2014-03-22 21:30:07 +0100
committerCarl Worth <cworth@cworth.org>2014-04-14 15:05:35 -0700
commit0c37a0b94da66943e55b51f192405119c06471a0 (patch)
tree77dbd2abdc545d34618c5e596f316c6476c51bd6
parent1184293f40569d1f3fa25c61d62d02c73260072f (diff)
st/mesa: recreate sampler view on context change v3
With shared glx contexts it is possible that a texture is create and used in one context and then used in another one resulting in incorrect sampler view usage. v2: avoid template copy v3: add XXX comment Signed-off-by: Christian König <christian.koenig@amd.com> Cc: "10.0 10.1" <mesa-stable@lists.freedesktop.org> Reviewed-by: Brian Paul <brianp@vmware.com> (cherry picked from commit 92e543c45da4581b1940178a94e6f2d66c749367)
-rw-r--r--src/mesa/state_tracker/st_atom_texture.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index bd0a22dde42..fcf27e6f3b9 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -198,6 +198,16 @@ st_get_texture_sampler_view_from_stobj(struct st_texture_object *stObj,
if (!stObj->sampler_view) {
stObj->sampler_view =
st_create_texture_sampler_view_from_stobj(pipe, stObj, samp, format);
+
+ } else if (stObj->sampler_view->context != pipe) {
+ /* Recreate view in correct context, use existing view as template */
+ /* XXX: This isn't optimal, we should try to use more than one view.
+ Otherwise we create/destroy the view all the time
+ */
+ struct pipe_sampler_view *sv =
+ pipe->create_sampler_view(pipe, stObj->pt, stObj->sampler_view);
+ pipe_sampler_view_reference(&stObj->sampler_view, NULL);
+ stObj->sampler_view = sv;
}
return stObj->sampler_view;