mesa/st: try to block multisampled texsubimage from doing cpu writes

this is only hit when populating multisampled fallback textures, so
don't assert if it fails since some drivers are able to handle it

d3d12 can't, however, and this should be enough to work around that issue

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22492>
This commit is contained in:
Mike Blumenkrantz 2023-04-17 13:01:08 -04:00 committed by Marge Bot
parent 56840e4c89
commit c29359a008

View file

@ -2074,6 +2074,7 @@ st_TexSubImage(struct gl_context *ctx, GLuint dims,
GLubyte *map;
unsigned dstz = texImage->Face + texImage->TexObject->Attrib.MinLayer;
unsigned dst_level = 0;
bool is_ms = dst->nr_samples > 1;
bool throttled = false;
st_flush_bitmap_cache(st);
@ -2092,6 +2093,7 @@ st_TexSubImage(struct gl_context *ctx, GLuint dims,
/* Try texture_subdata, which should be the fastest memcpy path. */
if (pixels &&
!unpack->BufferObj &&
!is_ms &&
_mesa_texstore_can_use_memcpy(ctx, texImage->_BaseFormat,
texImage->TexFormat, format, type,
unpack)) {
@ -2171,7 +2173,7 @@ st_TexSubImage(struct gl_context *ctx, GLuint dims,
* in which case the memcpy-based fast path will likely be used and
* we don't have to blit. */
if (_mesa_format_matches_format_and_type(texImage->TexFormat, format,
type, unpack->SwapBytes, NULL)) {
type, unpack->SwapBytes, NULL) && !is_ms) {
goto fallback;
}
@ -2189,7 +2191,7 @@ st_TexSubImage(struct gl_context *ctx, GLuint dims,
* etc. */
if (!_mesa_texstore_can_use_memcpy(ctx,
_mesa_get_format_base_format(mesa_src_format),
mesa_src_format, format, type, unpack)) {
mesa_src_format, format, type, unpack) && !is_ms) {
goto fallback;
}