summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2016-02-03 17:58:40 +0100
committerNicolai Hähnle <[email protected]>2016-02-05 09:21:44 -0500
commitb27c79bd815c77a16e63d37631bd02d7df6f4f3c (patch)
treecbbb67aa7c87b0bf5b50a8e37a8645ac2eb18612 /src
parent13e21e3ec58903a9974093423f9cef5e6edb668e (diff)
st/mesa: reduce the scope of sampler_view in try_pbo_upload_common
We can get rid of our reference immediately, since the driver will hold onto it for us. Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 0f2a4e943e8..7429711df21 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -1296,7 +1296,6 @@ try_pbo_upload_common(struct gl_context *ctx,
{
struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe;
- struct pipe_sampler_view *sampler_view = NULL;
unsigned depth = surface->u.tex.last_layer - surface->u.tex.first_layer + 1;
unsigned skip_pixels = 0;
@@ -1337,6 +1336,7 @@ try_pbo_upload_common(struct gl_context *ctx,
unsigned last_element = buf_offset + skip_pixels + upload_width - 1
+ (upload_height - 1 + (depth - 1) * image_height) * stride;
struct pipe_sampler_view templ;
+ struct pipe_sampler_view *sampler_view;
/* This should be ensured by Mesa before calling our callbacks */
assert((last_element + 1) * bytes_per_pixel <= buffer->width0);
@@ -1360,6 +1360,8 @@ try_pbo_upload_common(struct gl_context *ctx,
cso_save_fragment_sampler_views(st->cso_context);
cso_set_sampler_views(st->cso_context, PIPE_SHADER_FRAGMENT, 1,
&sampler_view);
+
+ pipe_sampler_view_reference(&sampler_view, NULL);
}
/* Upload vertices */
@@ -1519,8 +1521,6 @@ try_pbo_upload_common(struct gl_context *ctx,
cso_restore_aux_vertex_buffer_slot(st->cso_context);
cso_restore_fragment_sampler_views(st->cso_context);
- pipe_sampler_view_reference(&sampler_view, NULL);
-
return true;
}