mesa/st: choose S/D format depending on gl_format passed for readpixels
This makes sure we create correct type of a sampler view for reading. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3775 Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7707>
This commit is contained in:
@@ -97,6 +97,7 @@ static bool
|
|||||||
try_pbo_readpixels(struct st_context *st, struct st_renderbuffer *strb,
|
try_pbo_readpixels(struct st_context *st, struct st_renderbuffer *strb,
|
||||||
bool invert_y,
|
bool invert_y,
|
||||||
GLint x, GLint y, GLsizei width, GLsizei height,
|
GLint x, GLint y, GLsizei width, GLsizei height,
|
||||||
|
GLenum gl_format,
|
||||||
enum pipe_format src_format, enum pipe_format dst_format,
|
enum pipe_format src_format, enum pipe_format dst_format,
|
||||||
const struct gl_pixelstore_attrib *pack, void *pixels)
|
const struct gl_pixelstore_attrib *pack, void *pixels)
|
||||||
{
|
{
|
||||||
@@ -111,6 +112,12 @@ try_pbo_readpixels(struct st_context *st, struct st_renderbuffer *strb,
|
|||||||
enum pipe_texture_target view_target;
|
enum pipe_texture_target view_target;
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
|
/* Make sure we have stencil format in case of GL_STENCIL_INDEX to
|
||||||
|
* create correct type of a sampler view.
|
||||||
|
*/
|
||||||
|
if (gl_format == GL_STENCIL_INDEX)
|
||||||
|
src_format = util_format_stencil_only(src_format);
|
||||||
|
|
||||||
if (texture->nr_samples > 1)
|
if (texture->nr_samples > 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -474,7 +481,7 @@ st_ReadPixels(struct gl_context *ctx, GLint x, GLint y,
|
|||||||
if (try_pbo_readpixels(st, strb,
|
if (try_pbo_readpixels(st, strb,
|
||||||
st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP,
|
st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP,
|
||||||
x, y, width, height,
|
x, y, width, height,
|
||||||
src_format, dst_format,
|
format, src_format, dst_format,
|
||||||
pack, pixels))
|
pack, pixels))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user