summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorStuart Abercrombie <[email protected]>2013-04-11 10:57:43 -0700
committerStéphane Marchesin <[email protected]>2013-04-17 18:15:12 -0700
commit1a59cc777fb6c0383ed0c745000ca7409b1027d9 (patch)
treeff3421ce1eb741d77ab619cc153855b0dda0e6df /src/gallium
parent417d8917d4924652f1cd0c64dbf3677d4eddbf8c (diff)
i915g: Release old fragment shader sampler views with current pipe
We were trying to use a destroy method from a deleted context. This fix is based on what's in the svga driver. Reviewed-by: Stéphane Marchesin <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/i915/i915_state.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c
index 37ad1ed61c8..4a4faa5298c 100644
--- a/src/gallium/drivers/i915/i915_state.c
+++ b/src/gallium/drivers/i915/i915_state.c
@@ -711,13 +711,18 @@ static void i915_set_fragment_sampler_views(struct pipe_context *pipe,
!memcmp(i915->fragment_sampler_views, views, num * sizeof(struct pipe_sampler_view *)))
return;
- for (i = 0; i < num; i++)
+ for (i = 0; i < num; i++) {
+ /* Note: we're using pipe_sampler_view_release() here to work around
+ * a possible crash when the old view belongs to another context that
+ * was already destroyed.
+ */
+ pipe_sampler_view_release(pipe, &i915->fragment_sampler_views[i]);
pipe_sampler_view_reference(&i915->fragment_sampler_views[i],
views[i]);
+ }
for (i = num; i < i915->num_fragment_sampler_views; i++)
- pipe_sampler_view_reference(&i915->fragment_sampler_views[i],
- NULL);
+ pipe_sampler_view_release(pipe, &i915->fragment_sampler_views[i]);
i915->num_fragment_sampler_views = num;