From bdcde1b3f6747b4185044461d2395e84905ddac8 Mon Sep 17 00:00:00 2001 From: baldurk Date: Sun, 23 Nov 2014 18:37:50 +0000 Subject: [PATCH] Add 2D multisampled array texture storage functions. --- renderdoc/driver/gl/gl_common.h | 1 + renderdoc/driver/gl/gl_driver.cpp | 4 + renderdoc/driver/gl/gl_driver.h | 7 +- renderdoc/driver/gl/gl_hookset.h | 3 + renderdoc/driver/gl/gl_hookset_defs.h | 6 + renderdoc/driver/gl/gl_manager.cpp | 16 +- .../driver/gl/wrappers/gl_texture_funcs.cpp | 148 +++++++++++++++++- 7 files changed, 178 insertions(+), 7 deletions(-) diff --git a/renderdoc/driver/gl/gl_common.h b/renderdoc/driver/gl/gl_common.h index 4100e462e..6d852c845 100644 --- a/renderdoc/driver/gl/gl_common.h +++ b/renderdoc/driver/gl/gl_common.h @@ -106,6 +106,7 @@ enum GLChunkType TEXSTORAGE2D, TEXSTORAGE3D, TEXSTORAGE2DMS, + TEXSTORAGE3DMS, TEXIMAGE1D, TEXIMAGE2D, TEXIMAGE3D, diff --git a/renderdoc/driver/gl/gl_driver.cpp b/renderdoc/driver/gl/gl_driver.cpp index 34068914e..df0384e23 100644 --- a/renderdoc/driver/gl/gl_driver.cpp +++ b/renderdoc/driver/gl/gl_driver.cpp @@ -51,6 +51,7 @@ const char *GLChunkNames[] = "glTexStorage2D", "glTexStorage3D", "glTexStorage2DMultisample", + "glTexStorage3DMultisample", "glTexImage1D", "glTexImage2D", "glTexImage3D", @@ -1583,6 +1584,9 @@ void WrappedOpenGL::ProcessChunk(uint64_t offset, GLChunkType context) case TEXSTORAGE2DMS: Serialise_glTextureStorage2DMultisampleEXT(0, eGL_NONE, 0, eGL_NONE, 0, 0, GL_FALSE); break; + case TEXSTORAGE3DMS: + Serialise_glTextureStorage3DMultisampleEXT(0, eGL_NONE, 0, eGL_NONE, 0, 0, 0, GL_FALSE); + break; case TEXIMAGE1D: Serialise_glTextureImage1DEXT(0, eGL_NONE, 0, 0, 0, 0, eGL_NONE, eGL_NONE, NULL); break; diff --git a/renderdoc/driver/gl/gl_driver.h b/renderdoc/driver/gl/gl_driver.h index 460156175..f7e449c81 100644 --- a/renderdoc/driver/gl/gl_driver.h +++ b/renderdoc/driver/gl/gl_driver.h @@ -183,11 +183,11 @@ class WrappedOpenGL struct TextureData { - TextureData() : dimension(0), width(0), height(0), depth(0), creationFlags(0), internalFormat(eGL_NONE), renderbuffer(false) {} + TextureData() : dimension(0), width(0), height(0), depth(0), samples(0), creationFlags(0), internalFormat(eGL_NONE), renderbuffer(false) {} GLResource resource; GLenum curType; GLint dimension; - GLint width, height, depth; + GLint width, height, depth, samples; uint32_t creationFlags; GLenum internalFormat; bool renderbuffer; @@ -391,6 +391,7 @@ class WrappedOpenGL IMPLEMENT_FUNCTION_SERIALISED(void, glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels)); IMPLEMENT_FUNCTION_SERIALISED(void, glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels)); IMPLEMENT_FUNCTION_SERIALISED(void, glTexImage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)); + IMPLEMENT_FUNCTION_SERIALISED(void, glTexImage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)); IMPLEMENT_FUNCTION_SERIALISED(void, glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *pixels)); IMPLEMENT_FUNCTION_SERIALISED(void, glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * pixels)); IMPLEMENT_FUNCTION_SERIALISED(void, glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid * pixels)); @@ -467,6 +468,7 @@ class WrappedOpenGL IMPLEMENT_FUNCTION_SERIALISED(void, glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)); IMPLEMENT_FUNCTION_SERIALISED(void, glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)); IMPLEMENT_FUNCTION_SERIALISED(void, glTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)); + IMPLEMENT_FUNCTION_SERIALISED(void, glTexStorage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)); IMPLEMENT_FUNCTION_SERIALISED(void, glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels)); IMPLEMENT_FUNCTION_SERIALISED(void, glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels)); IMPLEMENT_FUNCTION_SERIALISED(void, glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels)); @@ -1013,6 +1015,7 @@ class WrappedOpenGL IMPLEMENT_FUNCTION_SERIALISED(void, glTextureStorage2DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)); IMPLEMENT_FUNCTION_SERIALISED(void, glTextureStorage3DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)); IMPLEMENT_FUNCTION_SERIALISED(void, glTextureStorage2DMultisampleEXT(GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)); + IMPLEMENT_FUNCTION_SERIALISED(void, glTextureStorage3DMultisampleEXT(GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)); IMPLEMENT_FUNCTION_SERIALISED(void, glTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels)); IMPLEMENT_FUNCTION_SERIALISED(void, glTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels)); IMPLEMENT_FUNCTION_SERIALISED(void, glTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels)); diff --git a/renderdoc/driver/gl/gl_hookset.h b/renderdoc/driver/gl/gl_hookset.h index c179845e7..39b64da2c 100644 --- a/renderdoc/driver/gl/gl_hookset.h +++ b/renderdoc/driver/gl/gl_hookset.h @@ -96,9 +96,11 @@ struct GLHookSet PFNGLTEXSTORAGE2DPROC glTexStorage2D; PFNGLTEXSTORAGE3DPROC glTexStorage3D; PFNGLTEXSTORAGE2DMULTISAMPLEPROC glTexStorage2DMultisample; + PFNGLTEXSTORAGE3DMULTISAMPLEPROC glTexStorage3DMultisample; PFNGLTEXSUBIMAGE3DPROC glTexSubImage3D; PFNGLTEXBUFFERPROC glTexBuffer; PFNGLTEXIMAGE2DMULTISAMPLEPROC glTexImage2DMultisample; + PFNGLTEXIMAGE3DMULTISAMPLEPROC glTexImage3DMultisample; PFNGLCOMPRESSEDTEXIMAGE1DPROC glCompressedTexImage1D; PFNGLCOMPRESSEDTEXIMAGE2DPROC glCompressedTexImage2D; PFNGLCOMPRESSEDTEXIMAGE3DPROC glCompressedTexImage3D; @@ -616,6 +618,7 @@ struct GLHookSet PFNGLTEXTURESTORAGE2DEXTPROC glTextureStorage2DEXT; PFNGLTEXTURESTORAGE3DEXTPROC glTextureStorage3DEXT; PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC glTextureStorage2DMultisampleEXT; + PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC glTextureStorage3DMultisampleEXT; PFNGLTEXTURESUBIMAGE1DEXTPROC glTextureSubImage1DEXT; PFNGLTEXTURESUBIMAGE2DEXTPROC glTextureSubImage2DEXT; PFNGLTEXTURESUBIMAGE3DEXTPROC glTextureSubImage3DEXT; diff --git a/renderdoc/driver/gl/gl_hookset_defs.h b/renderdoc/driver/gl/gl_hookset_defs.h index e9f710bee..2d6d15048 100644 --- a/renderdoc/driver/gl/gl_hookset_defs.h +++ b/renderdoc/driver/gl/gl_hookset_defs.h @@ -100,9 +100,11 @@ HookExtension(PFNGLTEXSTORAGE2DPROC, glTexStorage2D); \ HookExtension(PFNGLTEXSTORAGE3DPROC, glTexStorage3D); \ HookExtension(PFNGLTEXSTORAGE2DMULTISAMPLEPROC, glTexStorage2DMultisample); \ + HookExtension(PFNGLTEXSTORAGE3DMULTISAMPLEPROC, glTexStorage3DMultisample); \ HookExtension(PFNGLTEXSUBIMAGE3DPROC, glTexSubImage3D); \ HookExtension(PFNGLTEXBUFFERPROC, glTexBuffer); \ HookExtension(PFNGLTEXIMAGE2DMULTISAMPLEPROC, glTexImage2DMultisample); \ + HookExtension(PFNGLTEXIMAGE3DMULTISAMPLEPROC, glTexImage3DMultisample); \ HookExtension(PFNGLCOMPRESSEDTEXIMAGE1DPROC, glCompressedTexImage1D); \ HookExtension(PFNGLCOMPRESSEDTEXIMAGE2DPROC, glCompressedTexImage2D); \ HookExtension(PFNGLCOMPRESSEDTEXIMAGE3DPROC, glCompressedTexImage3D); \ @@ -646,6 +648,7 @@ HookExtension(PFNGLTEXTURESTORAGE2DEXTPROC, glTextureStorage2DEXT); \ HookExtension(PFNGLTEXTURESTORAGE3DEXTPROC, glTextureStorage3DEXT); \ HookExtension(PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC, glTextureStorage2DMultisampleEXT); \ + HookExtension(PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC, glTextureStorage3DMultisampleEXT); \ HookExtension(PFNGLTEXTURESUBIMAGE1DEXTPROC, glTextureSubImage1DEXT); \ HookExtension(PFNGLTEXTURESUBIMAGE2DEXTPROC, glTextureSubImage2DEXT); \ HookExtension(PFNGLTEXTURESUBIMAGE3DEXTPROC, glTextureSubImage3DEXT); \ @@ -781,9 +784,11 @@ HookWrapper5(void, glTexStorage2D, GLenum, target, GLsizei, levels, GLenum, internalformat, GLsizei, width, GLsizei, height); \ HookWrapper6(void, glTexStorage3D, GLenum, target, GLsizei, levels, GLenum, internalformat, GLsizei, width, GLsizei, height, GLsizei, depth); \ HookWrapper6(void, glTexStorage2DMultisample, GLenum, target, GLsizei, samples, GLenum, internalformat, GLsizei, width, GLsizei, height, GLboolean, fixedsamplelocations); \ + HookWrapper7(void, glTexStorage3DMultisample, GLenum, target, GLsizei, samples, GLenum, internalformat, GLsizei, width, GLsizei, height, GLsizei, depth, GLboolean, fixedsamplelocations); \ HookWrapper11(void, glTexSubImage3D, GLenum, target, GLint, level, GLint, xoffset, GLint, yoffset, GLint, zoffset, GLsizei, width, GLsizei, height, GLsizei, depth, GLenum, format, GLenum, type, const void *, pixels); \ HookWrapper3(void, glTexBuffer, GLenum, target, GLenum, internalformat, GLuint, buffer); \ HookWrapper6(void, glTexImage2DMultisample, GLenum, target, GLsizei, samples, GLenum, internalformat, GLsizei, width, GLsizei, height, GLboolean, fixedsamplelocations); \ + HookWrapper7(void, glTexImage3DMultisample, GLenum, target, GLsizei, samples, GLenum, internalformat, GLsizei, width, GLsizei, height, GLsizei, depth, GLboolean, fixedsamplelocations); \ HookWrapper7(void, glCompressedTexImage1D, GLenum, target, GLint, level, GLenum, internalformat, GLsizei, width, GLint, border, GLsizei, imageSize, const void *, data); \ HookWrapper8(void, glCompressedTexImage2D, GLenum, target, GLint, level, GLenum, internalformat, GLsizei, width, GLsizei, height, GLint, border, GLsizei, imageSize, const void *, data); \ HookWrapper9(void, glCompressedTexImage3D, GLenum, target, GLint, level, GLenum, internalformat, GLsizei, width, GLsizei, height, GLsizei, depth, GLint, border, GLsizei, imageSize, const void *, data); \ @@ -1301,6 +1306,7 @@ HookWrapper6(void, glTextureStorage2DEXT, GLuint, texture, GLenum, target, GLsizei, levels, GLenum, internalformat, GLsizei, width, GLsizei, height); \ HookWrapper7(void, glTextureStorage3DEXT, GLuint, texture, GLenum, target, GLsizei, levels, GLenum, internalformat, GLsizei, width, GLsizei, height, GLsizei, depth); \ HookWrapper7(void, glTextureStorage2DMultisampleEXT, GLuint, texture, GLenum, target, GLsizei, samples, GLenum, internalformat, GLsizei, width, GLsizei, height, GLboolean, fixedsamplelocations); \ + HookWrapper8(void, glTextureStorage3DMultisampleEXT, GLuint, texture, GLenum, target, GLsizei, samples, GLenum, internalformat, GLsizei, width, GLsizei, height, GLsizei, depth, GLboolean, fixedsamplelocations); \ HookWrapper8(void, glTextureSubImage1DEXT, GLuint, texture, GLenum, target, GLint, level, GLint, xoffset, GLsizei, width, GLenum, format, GLenum, type, const void *, pixels); \ HookWrapper10(void, glTextureSubImage2DEXT, GLuint, texture, GLenum, target, GLint, level, GLint, xoffset, GLint, yoffset, GLsizei, width, GLsizei, height, GLenum, format, GLenum, type, const void *, pixels); \ HookWrapper12(void, glTextureSubImage3DEXT, GLuint, texture, GLenum, target, GLint, level, GLint, xoffset, GLint, yoffset, GLint, zoffset, GLsizei, width, GLsizei, height, GLsizei, depth, GLenum, format, GLenum, type, const void *, pixels); \ diff --git a/renderdoc/driver/gl/gl_manager.cpp b/renderdoc/driver/gl/gl_manager.cpp index ac5fc0198..0208d1ee2 100644 --- a/renderdoc/driver/gl/gl_manager.cpp +++ b/renderdoc/driver/gl/gl_manager.cpp @@ -173,7 +173,12 @@ bool GLResourceManager::Prepare_InitialState(GLResource res) // create texture of identical format/size to store initial contents if(details.curType == eGL_TEXTURE_2D_MULTISAMPLE) { - gl.glTextureStorage2DMultisampleEXT(tex, details.curType, details.depth, details.internalFormat, details.width, details.height, GL_TRUE); + gl.glTextureStorage2DMultisampleEXT(tex, details.curType, details.samples, details.internalFormat, details.width, details.height, GL_TRUE); + mips = 1; + } + else if(details.curType == eGL_TEXTURE_2D_MULTISAMPLE_ARRAY) + { + gl.glTextureStorage3DMultisampleEXT(tex, details.curType, details.samples, details.internalFormat, details.width, details.height, details.depth, GL_TRUE); mips = 1; } else if(details.dimension == 1) @@ -391,6 +396,7 @@ bool GLResourceManager::Serialise_InitialState(GLResource res) SERIALISE_ELEMENT(uint32_t, width, details.width); SERIALISE_ELEMENT(uint32_t, height, details.height); SERIALISE_ELEMENT(uint32_t, depth, details.depth); + SERIALISE_ELEMENT(uint32_t, samples, details.samples); SERIALISE_ELEMENT(uint32_t, dim, details.dimension); SERIALISE_ELEMENT(GLenum, t, details.curType); SERIALISE_ELEMENT(GLenum, f, details.internalFormat); @@ -538,6 +544,7 @@ bool GLResourceManager::Serialise_InitialState(GLResource res) SERIALISE_ELEMENT(uint32_t, width, 0); SERIALISE_ELEMENT(uint32_t, height, 0); SERIALISE_ELEMENT(uint32_t, depth, 0); + SERIALISE_ELEMENT(uint32_t, samples, 0); SERIALISE_ELEMENT(uint32_t, dim, 0); SERIALISE_ELEMENT(GLenum, textype, eGL_NONE); SERIALISE_ELEMENT(GLenum, internalformat, eGL_NONE); @@ -552,7 +559,12 @@ bool GLResourceManager::Serialise_InitialState(GLResource res) // create texture of identical format/size to store initial contents if(textype == eGL_TEXTURE_2D_MULTISAMPLE) { - gl.glTextureStorage2DMultisampleEXT(tex, textype, depth, internalformat, width, height, GL_TRUE); + gl.glTextureStorage2DMultisampleEXT(tex, textype, samples, internalformat, width, height, GL_TRUE); + mips = 1; + } + else if(textype == eGL_TEXTURE_2D_MULTISAMPLE_ARRAY) + { + gl.glTextureStorage3DMultisampleEXT(tex, textype, samples, internalformat, width, height, depth, GL_TRUE); mips = 1; } else if(dim == 1) diff --git a/renderdoc/driver/gl/wrappers/gl_texture_funcs.cpp b/renderdoc/driver/gl/wrappers/gl_texture_funcs.cpp index 4e2a0d8ac..5daca4010 100644 --- a/renderdoc/driver/gl/wrappers/gl_texture_funcs.cpp +++ b/renderdoc/driver/gl/wrappers/gl_texture_funcs.cpp @@ -2099,6 +2099,7 @@ bool WrappedOpenGL::Serialise_glTextureStorage2DMultisampleEXT(GLuint texture, G m_Textures[liveId].width = Width; m_Textures[liveId].height = Height; m_Textures[liveId].depth = 1; + m_Textures[liveId].samples = Samples; m_Textures[liveId].curType = TextureTarget(Target); m_Textures[liveId].dimension = 2; m_Textures[liveId].internalFormat = Format; @@ -2135,7 +2136,8 @@ void WrappedOpenGL::glTextureStorage2DMultisampleEXT(GLuint texture, GLenum targ m_Textures[texId].width = width; m_Textures[texId].height = height; - m_Textures[texId].depth = samples; + m_Textures[texId].depth = 1; + m_Textures[texId].samples = samples; m_Textures[texId].curType = TextureTarget(target); m_Textures[texId].dimension = 2; m_Textures[texId].internalFormat = internalformat; @@ -2171,7 +2173,8 @@ void WrappedOpenGL::glTexStorage2DMultisample(GLenum target, GLsizei samples, GL m_Textures[texId].width = width; m_Textures[texId].height = height; - m_Textures[texId].depth = samples; + m_Textures[texId].depth = 1; + m_Textures[texId].samples = samples; m_Textures[texId].curType = TextureTarget(target); m_Textures[texId].dimension = 2; m_Textures[texId].internalFormat = internalformat; @@ -2209,7 +2212,146 @@ void WrappedOpenGL::glTexImage2DMultisample(GLenum target, GLsizei samples, GLen m_Textures[texId].width = width; m_Textures[texId].height = height; - m_Textures[texId].depth = samples; + m_Textures[texId].depth = 1; + m_Textures[texId].samples = samples; + m_Textures[texId].curType = TextureTarget(target); + m_Textures[texId].dimension = 2; + m_Textures[texId].internalFormat = internalformat; + } +} + +bool WrappedOpenGL::Serialise_glTextureStorage3DMultisampleEXT(GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations) +{ + SERIALISE_ELEMENT(GLenum, Target, target); + SERIALISE_ELEMENT(uint32_t, Samples, samples); + SERIALISE_ELEMENT(GLenum, Format, internalformat); + SERIALISE_ELEMENT(uint32_t, Width, width); + SERIALISE_ELEMENT(uint32_t, Height, height); + SERIALISE_ELEMENT(uint32_t, Depth, depth); + SERIALISE_ELEMENT(bool, Fixedlocs, fixedsamplelocations != 0); + SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetID(TextureRes(GetCtx(), texture))); + + if(m_State == READING) + { + ResourceId liveId = GetResourceManager()->GetLiveID(id); + m_Textures[liveId].width = Width; + m_Textures[liveId].height = Height; + m_Textures[liveId].depth = Depth; + m_Textures[liveId].samples = Samples; + m_Textures[liveId].curType = TextureTarget(Target); + m_Textures[liveId].dimension = 2; + m_Textures[liveId].internalFormat = Format; + + m_Real.glTextureStorage3DMultisampleEXT(GetResourceManager()->GetLiveResource(id).name, Target, Samples, Format, Width, Height, Depth, Fixedlocs ? GL_TRUE : GL_FALSE); + } + + return true; +} + +void WrappedOpenGL::glTextureStorage3DMultisampleEXT(GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations) +{ + m_Real.glTextureStorage3DMultisampleEXT(texture, target, samples, internalformat, width, height, depth, fixedsamplelocations); + + // proxy formats are used for querying texture capabilities, don't serialise these + if(IsProxyTarget(internalformat)) return; + + if(m_State >= WRITING) + { + GLResourceRecord *record = GetResourceManager()->GetResourceRecord(TextureRes(GetCtx(), texture)); + RDCASSERT(record); + + SCOPED_SERIALISE_CONTEXT(TEXSTORAGE3DMS); + Serialise_glTextureStorage3DMultisampleEXT(texture, target, samples, internalformat, width, height, depth, fixedsamplelocations); + + record->AddChunk(scope.Get()); + + // illegal to re-type textures + record->VerifyDataType(target); + } + + { + ResourceId texId = GetResourceManager()->GetID(TextureRes(GetCtx(), texture)); + + m_Textures[texId].width = width; + m_Textures[texId].height = height; + m_Textures[texId].depth = depth; + m_Textures[texId].samples = samples; + m_Textures[texId].curType = TextureTarget(target); + m_Textures[texId].dimension = 2; + m_Textures[texId].internalFormat = internalformat; + } +} + +void WrappedOpenGL::glTexStorage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations) +{ + m_Real.glTexStorage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations); + + // proxy formats are used for querying texture capabilities, don't serialise these + if(IsProxyTarget(internalformat)) return; + + if(m_State >= WRITING) + { + GLResourceRecord *record = m_TextureRecord[m_TextureUnit]; + RDCASSERT(record); + + SCOPED_SERIALISE_CONTEXT(TEXSTORAGE3DMS); + Serialise_glTextureStorage3DMultisampleEXT(GetResourceManager()->GetCurrentResource(record->GetResourceID()).name, + target, samples, internalformat, width, height, depth, fixedsamplelocations); + + record->AddChunk(scope.Get()); + + // illegal to re-type textures + record->VerifyDataType(target); + } + + { + GLuint texture = 0; + m_Real.glGetIntegerv(TextureBinding(target), (GLint *)&texture); + ResourceId texId = GetResourceManager()->GetID(TextureRes(GetCtx(), texture)); + + m_Textures[texId].width = width; + m_Textures[texId].height = height; + m_Textures[texId].depth = depth; + m_Textures[texId].samples = samples; + m_Textures[texId].curType = TextureTarget(target); + m_Textures[texId].dimension = 2; + m_Textures[texId].internalFormat = internalformat; + } +} + +void WrappedOpenGL::glTexImage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations) +{ + m_Real.glTexImage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations); + + // proxy formats are used for querying texture capabilities, don't serialise these + if(IsProxyTarget(internalformat)) return; + + if(m_State >= WRITING) + { + GLResourceRecord *record = m_TextureRecord[m_TextureUnit]; + RDCASSERT(record); + + // assuming texstorage is equivalent to teximage (this is not true in the case where someone + // tries to re-size an image by re-calling teximage). + SCOPED_SERIALISE_CONTEXT(TEXSTORAGE3DMS); + Serialise_glTextureStorage3DMultisampleEXT(GetResourceManager()->GetCurrentResource(record->GetResourceID()).name, + target, samples, internalformat, width, height, depth, fixedsamplelocations); + + record->AddChunk(scope.Get()); + + // illegal to re-type textures + record->VerifyDataType(target); + } + + { + GLuint texture = 0; + m_Real.glGetIntegerv(TextureBinding(target), (GLint *)&texture); + ResourceId texId = GetResourceManager()->GetID(TextureRes(GetCtx(), texture)); + + m_Textures[texId].width = width; + m_Textures[texId].height = height; + m_Textures[texId].depth = depth; + m_Textures[texId].samples = samples; m_Textures[texId].curType = TextureTarget(target); m_Textures[texId].dimension = 2; m_Textures[texId].internalFormat = internalformat;