From 21db7b5f8a856f63a8af4e6f32f591c97c40b649 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 28 Oct 2024 13:59:18 +0000 Subject: [PATCH] Minor-hack around applications that resize MS textures with non-storage * We can safely use the non-DSA function since this always happens in the texture chunk, not during capture (we do not support mid-capture texture resizes for obvious reasons). --- .../driver/gl/wrappers/gl_texture_funcs.cpp | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/renderdoc/driver/gl/wrappers/gl_texture_funcs.cpp b/renderdoc/driver/gl/wrappers/gl_texture_funcs.cpp index 6f9e50a25..7b72fd584 100644 --- a/renderdoc/driver/gl/wrappers/gl_texture_funcs.cpp +++ b/renderdoc/driver/gl/wrappers/gl_texture_funcs.cpp @@ -5166,12 +5166,23 @@ bool WrappedOpenGL::Serialise_glTextureStorage2DMultisampleEXT(SerialiserType &s m_Textures[liveId].emulated = emulated; m_Textures[liveId].mipsValid = 1; - if(target != eGL_NONE) - GL.glTextureStorage2DMultisampleEXT(texture.name, target, samples, internalformat, width, - height, fixedsamplelocations); + // some applications may resize MSAA textures using old-style functions, so we can't promote to + // storage DSA (and a non-storage DSA does not exist so can't be emulated)... + if(gl_CurChunk == GLChunk::glTexImage2DMultisample) + { + GL.glBindTexture(eGL_TEXTURE_2D_MULTISAMPLE, texture.name); + GL.glTexImage2DMultisample(eGL_TEXTURE_2D_MULTISAMPLE, samples, internalformat, width, height, + fixedsamplelocations); + } else - GL.glTextureStorage2DMultisample(texture.name, samples, internalformat, width, height, - fixedsamplelocations); + { + if(target != eGL_NONE) + GL.glTextureStorage2DMultisampleEXT(texture.name, target, samples, internalformat, width, + height, fixedsamplelocations); + else + GL.glTextureStorage2DMultisample(texture.name, samples, internalformat, width, height, + fixedsamplelocations); + } AddResourceInitChunk(texture); }