Mesa (staging/20.3): st/mesa: set drawpixels swizzle before creating sampler view
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Dec 16 19:11:00 UTC 2020
Module: Mesa
Branch: staging/20.3
Commit: 5636ec0acec3e2b824144305462deacbb303c031
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5636ec0acec3e2b824144305462deacbb303c031
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Mon Dec 14 23:35:55 2020 -0500
st/mesa: set drawpixels swizzle before creating sampler view
(some) drivers need to have the swizzle set prior to create_sampler_view
being called in order to actually apply it
Fixes: d11fefa9616 ("st/mesa: optimize 4-component ubyte glDrawPixels")
Acked-by: Adam Jackson <ajax at redhat.com>
Reviewed-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8107>
(cherry picked from commit a709d99bfd7982bcb15d2c98bea5bc8de91ea0a7)
---
.pick_status.json | 2 +-
src/mesa/state_tracker/st_cb_drawpixels.c | 17 +++++++++++------
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index 8361ecc5fe2..9a8dab7528d 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -166,7 +166,7 @@
"description": "st/mesa: set drawpixels swizzle before creating sampler view",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "d11fefa96165836ffeed531a74319a64aa98a696"
},
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 4b8242c770e..c16ea1dc60b 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -1237,7 +1237,7 @@ setup_sampler_swizzle(struct pipe_sampler_view *sv, GLenum format, GLenum type)
{
if ((format == GL_RGBA || format == GL_BGRA) && type == GL_UNSIGNED_BYTE) {
const struct util_format_description *desc =
- util_format_description(sv->texture->format);
+ util_format_description(sv->format);
unsigned c0, c1, c2, c3;
/* Every gallium driver supports at least one 32-bit packed RGBA format.
@@ -1384,17 +1384,22 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
st_upload_constants(st, &st->fp->Base);
}
- /* create sampler view for the image */
- sv[0] = st_create_texture_sampler_view(st->pipe, pt);
+ {
+ /* create sampler view for the image */
+ struct pipe_sampler_view templ;
+
+ u_sampler_view_default_template(&templ, pt, pt->format);
+ /* Set up the sampler view's swizzle */
+ setup_sampler_swizzle(&templ, format, type);
+
+ sv[0] = st->pipe->create_sampler_view(st->pipe, pt, &templ);
+ }
if (!sv[0]) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels");
pipe_resource_reference(&pt, NULL);
return;
}
- /* Set up the sampler view's swizzle */
- setup_sampler_swizzle(sv[0], format, type);
-
/* Create a second sampler view to read stencil. The stencil is
* written using the shader stencil export functionality.
*/
More information about the mesa-commit
mailing list