mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 10:00:40 +00:00
Check for ARB_texture_storage in CopyTex2DMSToArray and used it
* ARB_texture_view only works on textures allocated with ARB_texture_storage so we have to check for both extensions and then use texture storage to allocate space for the destination array texture.
This commit is contained in:
@@ -1627,20 +1627,54 @@ void GLReplay::PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_t sl
|
||||
}
|
||||
}
|
||||
|
||||
void GLReplay::CopyTex2DMSToArray(GLuint destArray, GLuint srcMS, GLint width, GLint height,
|
||||
void GLReplay::CopyTex2DMSToArray(GLuint &destArray, GLuint srcMS, GLint width, GLint height,
|
||||
GLint arraySize, GLint samples, GLenum intFormat)
|
||||
{
|
||||
WrappedOpenGL &gl = *m_pDriver;
|
||||
|
||||
if(!HasExt[ARB_compute_shader])
|
||||
return;
|
||||
// create temporary texture array, which we'll initialise to be the width/height in same format,
|
||||
// with the same number of array slices as multi samples.
|
||||
gl.glGenTextures(1, &destArray);
|
||||
gl.glBindTexture(eGL_TEXTURE_2D_ARRAY, destArray);
|
||||
|
||||
if(!HasExt[ARB_texture_view])
|
||||
bool failed = false;
|
||||
|
||||
if(!failed && !HasExt[ARB_compute_shader])
|
||||
{
|
||||
RDCWARN(
|
||||
"Can't copy multisampled texture to array for serialisation without ARB_compute_shader.");
|
||||
failed = true;
|
||||
}
|
||||
|
||||
if(!failed && !HasExt[ARB_texture_view])
|
||||
{
|
||||
RDCWARN("Can't copy multisampled texture to array for serialisation without ARB_texture_view.");
|
||||
failed = true;
|
||||
}
|
||||
|
||||
if(!failed && !HasExt[ARB_texture_storage])
|
||||
{
|
||||
RDCWARN(
|
||||
"Can't copy multisampled texture to array for serialisation without ARB_texture_view, and "
|
||||
"ARB_texture_view requires ARB_texture_storage.");
|
||||
failed = true;
|
||||
}
|
||||
|
||||
if(failed)
|
||||
{
|
||||
// create using the non-storage API which is always available, so the texture is at least valid
|
||||
// (but with undefined/empty contents).
|
||||
gl.glTextureImage3DEXT(destArray, eGL_TEXTURE_2D_ARRAY, 0, intFormat, width, height,
|
||||
arraySize * samples, 0, GetBaseFormat(intFormat), GetDataType(intFormat),
|
||||
NULL);
|
||||
gl.glTexParameteri(eGL_TEXTURE_2D_ARRAY, eGL_TEXTURE_MAX_LEVEL, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
// initialise the texture using texture storage, as required for texture views.
|
||||
gl.glTextureStorage3DEXT(destArray, eGL_TEXTURE_2D_ARRAY, 1, intFormat, width, height,
|
||||
arraySize * samples);
|
||||
|
||||
GLRenderState rs(&gl.GetHookset(), NULL, READING);
|
||||
rs.FetchState(m_pDriver->GetCtx(), m_pDriver);
|
||||
|
||||
|
||||
@@ -2485,16 +2485,8 @@ byte *GLReplay::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip,
|
||||
{
|
||||
MakeCurrentReplayContext(m_DebugCtx);
|
||||
|
||||
// create temporary texture array of width/height in same format to render to,
|
||||
// with the same number of array slices as multi samples.
|
||||
gl.glGenTextures(1, &tempTex);
|
||||
gl.glBindTexture(eGL_TEXTURE_2D_ARRAY, tempTex);
|
||||
gl.glTextureImage3DEXT(tempTex, eGL_TEXTURE_2D_ARRAY, 0, intFormat, width, height,
|
||||
arraysize * samples, 0, GetBaseFormat(intFormat), GetDataType(intFormat),
|
||||
NULL);
|
||||
gl.glTexParameteri(eGL_TEXTURE_2D_ARRAY, eGL_TEXTURE_MAX_LEVEL, 0);
|
||||
|
||||
// copy multisampled texture to an array
|
||||
// copy multisampled texture to an array. This creates tempTex and returns it in that variable,
|
||||
// for us to own
|
||||
CopyTex2DMSToArray(tempTex, texname, width, height, arraysize, samples, intFormat);
|
||||
|
||||
// rewrite the variables to temporary texture
|
||||
|
||||
@@ -247,7 +247,7 @@ private:
|
||||
|
||||
void CopyArrayToTex2DMS(GLuint destMS, GLuint srcArray, GLint width, GLint height,
|
||||
GLint arraySize, GLint samples, GLenum intFormat);
|
||||
void CopyTex2DMSToArray(GLuint destArray, GLuint srcMS, GLint width, GLint height,
|
||||
void CopyTex2DMSToArray(GLuint &destArray, GLuint srcMS, GLint width, GLint height,
|
||||
GLint arraySize, GLint samples, GLenum intFormat);
|
||||
|
||||
struct OutputWindow : public GLWindowingData
|
||||
|
||||
Reference in New Issue
Block a user