summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2019-04-18 14:36:42 +0000
committerEgor Yusov <egor.yusov@gmail.com>2019-04-18 14:36:42 +0000
commitf66cee08e82f194d3b95ab0ea77a28f9aea3222c (patch)
treed94fe054264df48b5d7aac3bbbb229f56b83dee7 /Graphics/GraphicsEngineVulkan
parentFixed copying compressed textures in Vulkan back-end (diff)
downloadDiligentCore-f66cee08e82f194d3b95ab0ea77a28f9aea3222c.tar.gz
DiligentCore-f66cee08e82f194d3b95ab0ea77a28f9aea3222c.zip
Fixed handling compressed textures in TextureUploaderGL; fixed non-compressed texture offset in Vk backend
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
index 636a2598..ee6331fb 100644
--- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
@@ -1389,9 +1389,8 @@ namespace Diligent
// For compressed-block formats, RowSize is the size of one compressed row.
// For non-compressed formats, BlockHeight is 1.
(pSrcBox->MinZ * SrcMipLevelAttribs.Height + pSrcBox->MinY) / SrcFmtAttribs.BlockHeight * SrcMipLevelAttribs.RowSize +
- // For compressed-block formats, ComponentSize is the block size and NumComponents is 1.
// For non-compressed formats, BlockWidth is 1.
- (pSrcBox->MinX / SrcFmtAttribs.BlockWidth) * SrcFmtAttribs.ComponentSize * SrcFmtAttribs.NumComponents;
+ (pSrcBox->MinX / SrcFmtAttribs.BlockWidth) * SrcFmtAttribs.GetElementSize();
Box DstBox;
DstBox.MinX = CopyAttribs.DstX;
@@ -1424,9 +1423,8 @@ namespace Diligent
// For compressed-block formats, RowSize is the size of one compressed row.
// For non-compressed formats, BlockHeight is 1.
(CopyAttribs.DstZ * DstMipLevelAttribs.Height + CopyAttribs.DstY) / DstFmtAttribs.BlockHeight * DstMipLevelAttribs.RowSize *
- // For compressed-block formats, ComponentSize is the block size and NumComponents is 1.
// For non-compressed formats, BlockWidth is 1.
- (CopyAttribs.DstX / DstFmtAttribs.BlockWidth) * DstFmtAttribs.ComponentSize * DstFmtAttribs.NumComponents;
+ (CopyAttribs.DstX / DstFmtAttribs.BlockWidth) * DstFmtAttribs.GetElementSize();
CopyTextureToBuffer(
*pSrcTexVk,
@@ -1771,9 +1769,8 @@ namespace Diligent
// For compressed-block formats, RowSize is the size of one compressed row.
// For non-compressed formats, BlockHeight is 1.
(pMapRegion->MinZ * MipLevelAttribs.Height + pMapRegion->MinY) / FmtAttribs.BlockHeight * MipLevelAttribs.RowSize +
- // For compressed-block formats, ComponentSize is the block size and NumComponents is 1.
// For non-compressed formats, BlockWidth is 1.
- pMapRegion->MinX / FmtAttribs.BlockWidth * FmtAttribs.ComponentSize * FmtAttribs.NumComponents;
+ pMapRegion->MinX / FmtAttribs.BlockWidth * FmtAttribs.GetElementSize();
MappedData.pData = TextureVk.GetStagingDataCPUAddress() + MapStartOffset;
MappedData.Stride = MipLevelAttribs.RowSize;
@@ -1787,7 +1784,7 @@ namespace Diligent
VERIFY_EXPR(pMapRegion->MaxZ >= 1 && pMapRegion->MaxY >= 1);
auto MapEndOffset = SubresourceOffset +
((pMapRegion->MaxZ-1) * MipLevelAttribs.Height + (pMapRegion->MaxY-FmtAttribs.BlockHeight)) / FmtAttribs.BlockHeight * MipLevelAttribs.RowSize +
- (pMapRegion->MaxX / FmtAttribs.BlockWidth) * FmtAttribs.ComponentSize * FmtAttribs.NumComponents;
+ (pMapRegion->MaxX / FmtAttribs.BlockWidth) * FmtAttribs.GetElementSize();
TextureVk.InvalidateStagingRange(MapStartOffset, MapEndOffset - MapStartOffset);
}
else if (MapType == MAP_WRITE)