[Mesa-dev] [PATCH] st: Allow accelerated CopyTexImage from RGBA to RGB.
Eric Anholt
eric at anholt.net
Wed Mar 21 20:54:47 UTC 2018
There's nothing to worry about here -- the A channel just gets dropped by
the blit. This avoids a segfault in the fallback path when copying from a
RGBA16_SINT renderbuffer to a RGB16_SINT destination represented by an
RGBA16_SINT texture (the fallback path tries to get/fetch to float
buffers, but the float pack/unpack functions are NULL for SINT/UINT).
Fixes KHR-GLES3.packed_pixels.pbo_rectangle.rgba16i on VC5.
---
src/mesa/state_tracker/st_cb_texture.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 6345ead6396b..469a82a75390 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -2327,8 +2327,10 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
/* The base internal format must match the mesa format, so make sure
* e.g. an RGB internal format is really allocated as RGB and not as RGBA.
*/
- if (texImage->_BaseFormat !=
- _mesa_get_format_base_format(texImage->TexFormat) ||
+ if ((texImage->_BaseFormat !=
+ _mesa_get_format_base_format(texImage->TexFormat) &&
+ (texImage->_BaseFormat != GL_RGB ||
+ _mesa_get_format_base_format(texImage->TexFormat) != GL_RGBA)) ||
rb->_BaseFormat != _mesa_get_format_base_format(rb->Format)) {
goto fallback;
}
--
2.16.2
More information about the mesa-dev
mailing list