Merge pull request #652 from NotCamelCase/master

Fix uninitialized variable used in vkCmdCopyBufferToImage().
This commit is contained in:
Sascha Willems 2020-01-18 09:45:09 +01:00 committed by GitHub
commit 6bc9f95e5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 57 additions and 54 deletions

View file

@ -219,7 +219,8 @@ public:
for (uint32_t i = 0; i < texture.mipLevels; i++) {
// Calculate offset into staging buffer for the current mip level
ktx_size_t offset;
assert(ktxTexture_GetImageOffset(ktxTexture, i, 0, 0, &offset) == KTX_SUCCESS);
KTX_error_code ret = ktxTexture_GetImageOffset(ktxTexture, i, 0, 0, &offset);
assert(ret == KTX_SUCCESS);
// Setup a buffer image copy structure for the current mip level
VkBufferImageCopy bufferCopyRegion = {};
bufferCopyRegion.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
@ -279,8 +280,8 @@ public:
imageMemoryBarrier.newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
// Insert a memory dependency at the proper pipeline stages that will execute the image layout transition
// Source pipeline stage is host write/read exection (VK_PIPELINE_STAGE_HOST_BIT)
// Destination pipeline stage is copy command exection (VK_PIPELINE_STAGE_TRANSFER_BIT)
// Source pipeline stage is host write/read execution (VK_PIPELINE_STAGE_HOST_BIT)
// Destination pipeline stage is copy command execution (VK_PIPELINE_STAGE_TRANSFER_BIT)
vkCmdPipelineBarrier(
copyCmd,
VK_PIPELINE_STAGE_HOST_BIT,

View file

@ -178,7 +178,8 @@ public:
{
// Calculate offset into staging buffer for the current array layer
ktx_size_t offset;
assert(ktxTexture_GetImageOffset(ktxTexture, 0, layer, 0, &offset) == KTX_SUCCESS);
KTX_error_code ret = ktxTexture_GetImageOffset(ktxTexture, 0, layer, 0, &offset);
assert(ret == KTX_SUCCESS);
// Setup a buffer image copy structure for the current array layer
VkBufferImageCopy bufferCopyRegion = {};
bufferCopyRegion.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;

View file

@ -227,7 +227,8 @@ public:
{
// Calculate offset into staging buffer for the current mip level and face
ktx_size_t offset;
assert(ktxTexture_GetImageOffset(ktxTexture, level, 0, face, &offset) == KTX_SUCCESS);
KTX_error_code ret = ktxTexture_GetImageOffset(ktxTexture, level, 0, face, &offset);
assert(ret == KTX_SUCCESS);
VkBufferImageCopy bufferCopyRegion = {};
bufferCopyRegion.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
bufferCopyRegion.imageSubresource.mipLevel = level;