st/pbo_compute: special case stencil extraction from Z24S8

this otherwise tries to use the depth component and a UNORM format,
which returns all zeroes

cc: mesa-stable

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29841>
(cherry picked from commit ef0a156670)
This commit is contained in:
Mike Blumenkrantz 2024-07-03 08:14:36 -04:00 committed by Eric Engestrom
parent a58b50b5df
commit 1387060c6a
2 changed files with 6 additions and 1 deletions

View file

@ -724,7 +724,7 @@
"description": "st/pbo_compute: special case stencil extraction from Z24S8",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -95,6 +95,7 @@ get_convert_format(struct gl_context *ctx,
struct st_context *st = st_context(ctx);
GLint bpp = _mesa_bytes_per_pixel(format, type);
if (_mesa_is_depth_format(format) ||
format == GL_STENCIL_INDEX ||
format == GL_GREEN_INTEGER ||
format == GL_BLUE_INTEGER) {
switch (bpp) {
@ -1264,6 +1265,10 @@ st_GetTexSubImage_shader(struct gl_context * ctx,
if (src_format == PIPE_FORMAT_NONE)
return false;
/* special case for stencil extraction */
if (format == GL_STENCIL_INDEX && util_format_is_depth_and_stencil(src_format))
src_format = PIPE_FORMAT_X24S8_UINT;
if (texImage->_BaseFormat != _mesa_get_format_base_format(texImage->TexFormat)) {
/* special handling for drivers that don't support these formats natively */
if (texImage->_BaseFormat == GL_LUMINANCE)