From 6026a0182785251d7a96dc0eb5c7b7e1aad4b1b2 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 11 Mar 2026 12:16:40 -0400 Subject: [PATCH] mesa/st/sampler_view: use a local variable for buffer sv format Reviewed-by: Timothy Arceri (cherry picked from commit 8fce32191e9875cf63bf1803f9499bbf702c17d8) Part-of: --- .pick_status.json | 2 +- src/mesa/state_tracker/st_sampler_view.c | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 35d64a5b343..71c8900a83b 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1004,7 +1004,7 @@ "description": "mesa/st/sampler_view: use a local variable for buffer sv format", "nominated": false, "nomination_type": 0, - "resolution": 4, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/mesa/state_tracker/st_sampler_view.c b/src/mesa/state_tracker/st_sampler_view.c index 86068178b73..96b03ed5cf9 100644 --- a/src/mesa/state_tracker/st_sampler_view.c +++ b/src/mesa/state_tracker/st_sampler_view.c @@ -590,6 +590,7 @@ st_get_buffer_sampler_view_from_stobj(struct st_context *st, if (!stBuf || !stBuf->buffer) return NULL; + enum pipe_format format = st_mesa_format_to_pipe_format(st, texObj->_BufferObjectFormat); sv = st_texture_get_current_sampler_view(st, texObj); struct pipe_resource *buf = stBuf->buffer; @@ -601,9 +602,7 @@ st_get_buffer_sampler_view_from_stobj(struct st_context *st, /* Debug check: make sure that the sampler view's parameters are * what they're supposed to be. */ - assert(st_mesa_format_to_pipe_format(st, - texObj->_BufferObjectFormat) - == view->format); + assert(format == view->format); assert(view->target == PIPE_BUFFER); ASSERTED unsigned base = texObj->BufferOffset; ASSERTED unsigned size = MIN2(buf->width0 - base, @@ -630,8 +629,7 @@ st_get_buffer_sampler_view_from_stobj(struct st_context *st, struct pipe_sampler_view templ; templ.is_tex2d_from_buf = false; - templ.format = - st_mesa_format_to_pipe_format(st, texObj->_BufferObjectFormat); + templ.format = format; templ.target = PIPE_BUFFER; templ.swizzle_r = PIPE_SWIZZLE_X; templ.swizzle_g = PIPE_SWIZZLE_Y;