Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix overflow when texture size is smaller than block size #3501

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion renderdoc/driver/gl/wrappers/gl_texture_funcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3813,7 +3813,9 @@ void WrappedOpenGL::StoreCompressedTexData(ResourceId texId, GLenum target, GLin
// GetCompressedByteSize() will factor in the 'partial' blocks at image edges when the
// image size is not an integer multiple of the block size, so we need to take into
// account that in the loop
size_t roundedUpHeight = AlignUp((uint32_t)height, blockSize[1]);
size_t roundedUpHeight = (uint32_t)height < blockSize[1]
? (uint32_t)height
: AlignUp((uint32_t)height, blockSize[1]);
for(size_t y = 0; y < roundedUpHeight; y += blockSize[1])
{
memcpy(cdData.data() + dstOffset, srcPixels + srcOffset, srcRowSize);
Expand Down