mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-16 15:00:47 +00:00
Check fast path for compressed pixel unpack requiring block dims
* The unpack parameters are ignored for compressed images unless the compressed width, height, depth and size parameters are set (whichever are required for the given unpack param). So we roll this into our calculation of the fast path, which means that we only use them in UnpackCompressed if they are valid.
This commit is contained in:
@@ -83,7 +83,43 @@ bool PixelUnpackState::FastPath(GLsizei width, GLsizei height, GLsizei depth, GL
|
||||
if(height > 0 && imageheight > 0 && height < imageheight)
|
||||
return false;
|
||||
|
||||
if(dataformat != eGL_NONE && alignment > (int32_t)GetByteSize(1, 1, 1, dataformat, basetype))
|
||||
if(alignment > (int32_t)GetByteSize(1, 1, 1, dataformat, basetype))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PixelUnpackState::FastPathCompressed(GLsizei width, GLsizei height, GLsizei depth)
|
||||
{
|
||||
// compressedBlockSize and compressedBlockWidth must be set for any of the unpack params to be used
|
||||
// if they are 0, all of the unpack params are ignored, so we go through the fast path (no unpacking)
|
||||
if(compressedBlockSize == 0 || compressedBlockWidth == 0)
|
||||
return true;
|
||||
|
||||
if(skipPixels)
|
||||
return false;
|
||||
|
||||
if(width > 0 && rowlength > 0 && width < rowlength)
|
||||
return false;
|
||||
|
||||
// the below two unpack params require compressedBlockHeight to be set so if we haven't "failed" to
|
||||
// hit the fast path, none of the other params make a difference as they're ignored and we go through
|
||||
// the fast path (no unpacking)
|
||||
if(compressedBlockHeight == 0)
|
||||
return true;
|
||||
|
||||
if(height > 0 && skipRows)
|
||||
return false;
|
||||
|
||||
if(height > 0 && imageheight > 0 && height < imageheight)
|
||||
return false;
|
||||
|
||||
// the final unpack param requires compressedBlockDepth to be set, as above if it's 0 then we can
|
||||
// just go straight through the fast path (no unpacking)
|
||||
if(compressedBlockDepth == 0)
|
||||
return true;
|
||||
|
||||
if(depth > 0 && skipImages)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -44,7 +44,9 @@ struct PixelUnpackState
|
||||
void Fetch(const GLHookSet *funcs, bool compressed);
|
||||
void Apply(const GLHookSet *funcs, bool compressed);
|
||||
|
||||
bool FastPath(GLsizei width, GLsizei height, GLsizei depth, GLenum dataformat=eGL_NONE, GLenum basetype=eGL_NONE);
|
||||
bool FastPath(GLsizei width, GLsizei height, GLsizei depth, GLenum dataformat, GLenum basetype);
|
||||
bool FastPathCompressed(GLsizei width, GLsizei height, GLsizei depth);
|
||||
|
||||
byte *Unpack(byte *pixels, GLsizei width, GLsizei height, GLsizei depth, GLenum dataformat, GLenum basetype);
|
||||
byte *UnpackCompressed(byte *pixels, GLsizei width, GLsizei height, GLsizei depth, GLsizei &imageSize);
|
||||
};
|
||||
|
||||
@@ -2039,7 +2039,7 @@ bool WrappedOpenGL::Serialise_glCompressedTextureImage1DEXT(GLuint texture, GLen
|
||||
{
|
||||
PixelUnpackState unpack; unpack.Fetch(&m_Real, true);
|
||||
|
||||
if(unpack.FastPath(Width, 0, 0))
|
||||
if(unpack.FastPathCompressed(Width, 0, 0))
|
||||
srcPixels = (byte *)pixels;
|
||||
else
|
||||
srcPixels = unpackedPixels = unpack.UnpackCompressed((byte *)pixels, Width, 0, 0, imageSize);
|
||||
@@ -2199,7 +2199,7 @@ bool WrappedOpenGL::Serialise_glCompressedTextureImage2DEXT(GLuint texture, GLen
|
||||
{
|
||||
PixelUnpackState unpack; unpack.Fetch(&m_Real, true);
|
||||
|
||||
if(unpack.FastPath(Width, Height, 0))
|
||||
if(unpack.FastPathCompressed(Width, Height, 0))
|
||||
srcPixels = (byte *)pixels;
|
||||
else
|
||||
srcPixels = unpackedPixels = unpack.UnpackCompressed((byte *)pixels, Width, Height, 0, imageSize);
|
||||
@@ -2383,7 +2383,7 @@ bool WrappedOpenGL::Serialise_glCompressedTextureImage3DEXT(GLuint texture, GLen
|
||||
{
|
||||
PixelUnpackState unpack; unpack.Fetch(&m_Real, true);
|
||||
|
||||
if(unpack.FastPath(Width, Height, Depth))
|
||||
if(unpack.FastPathCompressed(Width, Height, Depth))
|
||||
srcPixels = (byte *)pixels;
|
||||
else
|
||||
srcPixels = unpackedPixels = unpack.UnpackCompressed((byte *)pixels, Width, Height, Depth, imageSize);
|
||||
@@ -3689,7 +3689,7 @@ bool WrappedOpenGL::Serialise_glCompressedTextureSubImage1DEXT(GLuint texture, G
|
||||
{
|
||||
PixelUnpackState unpack; unpack.Fetch(&m_Real, true);
|
||||
|
||||
if(unpack.FastPath(Width, 0, 0))
|
||||
if(unpack.FastPathCompressed(Width, 0, 0))
|
||||
srcPixels = (byte *)pixels;
|
||||
else
|
||||
srcPixels = unpackedPixels = unpack.UnpackCompressed((byte *)pixels, Width, 0, 0, imageSize);
|
||||
@@ -3817,7 +3817,7 @@ bool WrappedOpenGL::Serialise_glCompressedTextureSubImage2DEXT(GLuint texture, G
|
||||
{
|
||||
PixelUnpackState unpack; unpack.Fetch(&m_Real, true);
|
||||
|
||||
if(unpack.FastPath(Width, Height, 0))
|
||||
if(unpack.FastPathCompressed(Width, Height, 0))
|
||||
srcPixels = (byte *)pixels;
|
||||
else
|
||||
srcPixels = unpackedPixels = unpack.UnpackCompressed((byte *)pixels, Width, Height, 0, imageSize);
|
||||
@@ -3947,7 +3947,7 @@ bool WrappedOpenGL::Serialise_glCompressedTextureSubImage3DEXT(GLuint texture, G
|
||||
{
|
||||
PixelUnpackState unpack; unpack.Fetch(&m_Real, true);
|
||||
|
||||
if(unpack.FastPath(Width, Height, Depth))
|
||||
if(unpack.FastPathCompressed(Width, Height, Depth))
|
||||
srcPixels = (byte *)pixels;
|
||||
else
|
||||
srcPixels = unpackedPixels = unpack.UnpackCompressed((byte *)pixels, Width, Height, Depth, imageSize);
|
||||
|
||||
Reference in New Issue
Block a user