From c29359a008d4436b10649dc62faf475d7f529ca9 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 17 Apr 2023 13:01:08 -0400 Subject: [PATCH] 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 Part-of: --- 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 f125344..a21aa1c 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -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; } -- 2.7.4