mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-19 01:46:35 +00:00
Implement 3D texture copy splitter on D3D12: preparation
This change mainly is a preparation for 3D texture copy splitter, which will be based on 2D texture copy splitter and then revise or recompute incorrect copy regions if needed. The change itself mainly rename some variables and comments and distiguish 3D texture copies from 2D (array) texture copies. For example, term slice is changed to layer if it only refers to layer slices in 2D textures and it is not shared by depth slices in 3D textures. Bug: dawn:547 Change-Id: I6f84134a4fbcb90708901a1059b60e78e1a25ca5 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/51900 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Yunchao He <yunchao.he@intel.com>
This commit is contained in:
@@ -56,8 +56,11 @@ namespace {
|
||||
|
||||
// Check that the offset is aligned
|
||||
void ValidateOffset(const TextureCopySubresource& copySplit) {
|
||||
ASSERT_TRUE(Align(copySplit.offset, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT) ==
|
||||
copySplit.offset);
|
||||
for (uint32_t i = 0; i < copySplit.count; ++i) {
|
||||
ASSERT_TRUE(
|
||||
Align(copySplit.copies[i].alignedOffset, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT) ==
|
||||
copySplit.copies[i].alignedOffset);
|
||||
}
|
||||
}
|
||||
|
||||
bool RangesOverlap(uint32_t minA, uint32_t maxA, uint32_t minB, uint32_t maxB) {
|
||||
@@ -142,7 +145,7 @@ namespace {
|
||||
uint32_t slicePitchInTexels =
|
||||
bytesPerRowInTexels * (bufferSpec.rowsPerImage / textureSpec.blockHeight);
|
||||
uint32_t absoluteTexelOffset =
|
||||
copySplit.offset / textureSpec.texelBlockSizeInBytes * texelsPerBlock +
|
||||
copy.alignedOffset / textureSpec.texelBlockSizeInBytes * texelsPerBlock +
|
||||
copy.bufferOffset.x / textureSpec.blockWidth * texelsPerBlock +
|
||||
copy.bufferOffset.y / textureSpec.blockHeight * bytesPerRowInTexels;
|
||||
|
||||
@@ -302,7 +305,7 @@ class CopySplitTest : public testing::Test {
|
||||
blockInfo.width = textureSpec.blockWidth;
|
||||
blockInfo.height = textureSpec.blockHeight;
|
||||
blockInfo.byteSize = textureSpec.texelBlockSizeInBytes;
|
||||
TextureCopySubresource copySplit = ComputeTextureCopySubresource(
|
||||
TextureCopySubresource copySplit = Compute2DTextureCopySubresource(
|
||||
{textureSpec.x, textureSpec.y, textureSpec.z},
|
||||
{textureSpec.width, textureSpec.height, textureSpec.depth}, blockInfo,
|
||||
bufferSpec.offset, bufferSpec.bytesPerRow, bufferSpec.rowsPerImage);
|
||||
|
||||
Reference in New Issue
Block a user