Rename STRIDE_UNDEFINED to COPY_STRIDE_UNDEFINED
Per https://github.com/webgpu-native/webgpu-headers/pull/71
Keeps but deprecates WGPU_STRIDE_UNDEFINED/wgpu::kStrideUndefined.
Bug: dawn:520
Change-Id: Ied162ec39454fac3d16a3782c9ed6d2f68c1d41d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/34926
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Kai Ninomiya <kainino@chromium.org>
diff --git a/dawn.json b/dawn.json
index 3ec8b76..a485484 100644
--- a/dawn.json
+++ b/dawn.json
@@ -1731,8 +1731,8 @@
"extensible": true,
"members": [
{"name": "offset", "type": "uint64_t", "default": 0},
- {"name": "bytes per row", "type": "uint32_t", "default": "WGPU_STRIDE_UNDEFINED"},
- {"name": "rows per image", "type": "uint32_t", "default": "WGPU_STRIDE_UNDEFINED"}
+ {"name": "bytes per row", "type": "uint32_t", "default": "WGPU_COPY_STRIDE_UNDEFINED"},
+ {"name": "rows per image", "type": "uint32_t", "default": "WGPU_COPY_STRIDE_UNDEFINED"}
]
},
"texture descriptor": {
diff --git a/generator/templates/webgpu.h b/generator/templates/webgpu.h
index e6ee673..7704707 100644
--- a/generator/templates/webgpu.h
+++ b/generator/templates/webgpu.h
@@ -74,7 +74,9 @@
#include <stdbool.h>
#define WGPU_WHOLE_SIZE (0xffffffffffffffffULL)
+// TODO(crbug.com/520): Remove WGPU_STRIDE_UNDEFINED in favor of WGPU_COPY_STRIDE_UNDEFINED.
#define WGPU_STRIDE_UNDEFINED (0xffffffffUL)
+#define WGPU_COPY_STRIDE_UNDEFINED (0xffffffffUL)
typedef uint32_t WGPUFlags;
diff --git a/generator/templates/webgpu_cpp.h b/generator/templates/webgpu_cpp.h
index 2fd3ab7..3e6b80c 100644
--- a/generator/templates/webgpu_cpp.h
+++ b/generator/templates/webgpu_cpp.h
@@ -20,7 +20,9 @@
namespace wgpu {
static constexpr uint64_t kWholeSize = WGPU_WHOLE_SIZE;
+ // TODO(crbug.com/520): Remove kStrideUndefined in favor of kCopyStrideUndefined.
static constexpr uint32_t kStrideUndefined = WGPU_STRIDE_UNDEFINED;
+ static constexpr uint32_t kCopyStrideUndefined = WGPU_COPY_STRIDE_UNDEFINED;
{% for type in by_category["enum"] %}
enum class {{as_cppType(type.name)}} : uint32_t {
diff --git a/src/dawn_native/CommandValidation.cpp b/src/dawn_native/CommandValidation.cpp
index cbf9c75..bf7da68 100644
--- a/src/dawn_native/CommandValidation.cpp
+++ b/src/dawn_native/CommandValidation.cpp
@@ -416,8 +416,8 @@
//
// This means that if the computation of depth * bytesPerImage doesn't overflow, none of the
// computations for requiredBytesInCopy will. (and it's not a very pessimizing check)
- ASSERT(copySize.depth <= 1 ||
- (bytesPerRow != wgpu::kStrideUndefined && rowsPerImage != wgpu::kStrideUndefined));
+ ASSERT(copySize.depth <= 1 || (bytesPerRow != wgpu::kCopyStrideUndefined &&
+ rowsPerImage != wgpu::kCopyStrideUndefined));
uint64_t bytesPerImage = Safe32x32(bytesPerRow, rowsPerImage);
if (bytesPerImage > std::numeric_limits<uint64_t>::max() / copySize.depth) {
return DAWN_VALIDATION_ERROR("requiredBytesInCopy is too large.");
@@ -425,7 +425,7 @@
uint64_t requiredBytesInCopy = bytesPerImage * (copySize.depth - 1);
if (heightInBlocks > 0) {
- ASSERT(heightInBlocks <= 1 || bytesPerRow != wgpu::kStrideUndefined);
+ ASSERT(heightInBlocks <= 1 || bytesPerRow != wgpu::kCopyStrideUndefined);
uint64_t bytesInLastImage = Safe32x32(bytesPerRow, heightInBlocks - 1) + bytesInLastRow;
requiredBytesInCopy += bytesInLastImage;
}
@@ -464,7 +464,7 @@
device->EmitDeprecationWarning(
"rowsPerImage soon must be non-zero or unspecified if copy depth == 1 (it will "
"no longer default to the copy height).");
- layout.rowsPerImage = wgpu::kStrideUndefined;
+ layout.rowsPerImage = wgpu::kCopyStrideUndefined;
}
}
@@ -478,12 +478,13 @@
device->EmitDeprecationWarning(
"Soon, even if copy height == 1, bytesPerRow must be >= the byte size of each row "
"or left unspecified.");
- layout.bytesPerRow = wgpu::kStrideUndefined;
+ layout.bytesPerRow = wgpu::kCopyStrideUndefined;
}
return layout;
}
- // Replace wgpu::kStrideUndefined with real values, so backends don't have to think about it.
+ // Replace wgpu::kCopyStrideUndefined with real values, so backends don't have to think about
+ // it.
void ApplyDefaultTextureDataLayoutOptions(TextureDataLayout* layout,
const TexelBlockInfo& blockInfo,
const Extent3D& copyExtent) {
@@ -491,7 +492,7 @@
ASSERT(copyExtent.height % blockInfo.height == 0);
uint32_t heightInBlocks = copyExtent.height / blockInfo.height;
- if (layout->bytesPerRow == wgpu::kStrideUndefined) {
+ if (layout->bytesPerRow == wgpu::kCopyStrideUndefined) {
ASSERT(copyExtent.width % blockInfo.width == 0);
uint32_t widthInBlocks = copyExtent.width / blockInfo.width;
uint32_t bytesInLastRow = widthInBlocks * blockInfo.byteSize;
@@ -499,7 +500,7 @@
ASSERT(heightInBlocks <= 1 && copyExtent.depth <= 1);
layout->bytesPerRow = Align(bytesInLastRow, kTextureBytesPerRowAlignment);
}
- if (layout->rowsPerImage == wgpu::kStrideUndefined) {
+ if (layout->rowsPerImage == wgpu::kCopyStrideUndefined) {
ASSERT(copyExtent.depth <= 1);
layout->rowsPerImage = heightInBlocks;
}
@@ -512,12 +513,12 @@
ASSERT(copyExtent.height % blockInfo.height == 0);
uint32_t heightInBlocks = copyExtent.height / blockInfo.height;
- if (copyExtent.depth > 1 && (layout.bytesPerRow == wgpu::kStrideUndefined ||
- layout.rowsPerImage == wgpu::kStrideUndefined)) {
+ if (copyExtent.depth > 1 && (layout.bytesPerRow == wgpu::kCopyStrideUndefined ||
+ layout.rowsPerImage == wgpu::kCopyStrideUndefined)) {
return DAWN_VALIDATION_ERROR(
"If copy depth > 1, bytesPerRow and rowsPerImage must be specified.");
}
- if (heightInBlocks > 1 && layout.bytesPerRow == wgpu::kStrideUndefined) {
+ if (heightInBlocks > 1 && layout.bytesPerRow == wgpu::kCopyStrideUndefined) {
return DAWN_VALIDATION_ERROR("If heightInBlocks > 1, bytesPerRow must be specified.");
}
@@ -528,12 +529,14 @@
std::numeric_limits<uint32_t>::max());
uint32_t bytesInLastRow = widthInBlocks * blockInfo.byteSize;
- // These != wgpu::kStrideUndefined checks are technically redundant with the > checks, but
- // they should get optimized out.
- if (layout.bytesPerRow != wgpu::kStrideUndefined && bytesInLastRow > layout.bytesPerRow) {
+ // These != wgpu::kCopyStrideUndefined checks are technically redundant with the > checks,
+ // but they should get optimized out.
+ if (layout.bytesPerRow != wgpu::kCopyStrideUndefined &&
+ bytesInLastRow > layout.bytesPerRow) {
return DAWN_VALIDATION_ERROR("The byte size of each row must be <= bytesPerRow.");
}
- if (layout.rowsPerImage != wgpu::kStrideUndefined && heightInBlocks > layout.rowsPerImage) {
+ if (layout.rowsPerImage != wgpu::kCopyStrideUndefined &&
+ heightInBlocks > layout.rowsPerImage) {
return DAWN_VALIDATION_ERROR(
"The height of each image, in blocks, must be <= rowsPerImage.");
}
@@ -559,7 +562,7 @@
MaybeError ValidateBufferCopyView(DeviceBase const* device,
const BufferCopyView& bufferCopyView) {
DAWN_TRY(device->ValidateObject(bufferCopyView.buffer));
- if (bufferCopyView.layout.bytesPerRow != wgpu::kStrideUndefined) {
+ if (bufferCopyView.layout.bytesPerRow != wgpu::kCopyStrideUndefined) {
if (bufferCopyView.layout.bytesPerRow % kTextureBytesPerRowAlignment != 0) {
return DAWN_VALIDATION_ERROR("bytesPerRow must be a multiple of 256");
}
diff --git a/src/dawn_native/InternalPipelineStore.h b/src/dawn_native/InternalPipelineStore.h
index 83277c1..e99d5d2 100644
--- a/src/dawn_native/InternalPipelineStore.h
+++ b/src/dawn_native/InternalPipelineStore.h
@@ -31,4 +31,4 @@
};
} // namespace dawn_native
-#endif // DAWNNATIVE_INTERNALPIPELINESTORE_H_
\ No newline at end of file
+#endif // DAWNNATIVE_INTERNALPIPELINESTORE_H_
diff --git a/src/dawn_native/ObjectContentHasher.h b/src/dawn_native/ObjectContentHasher.h
index 88d8a54..16509bc 100644
--- a/src/dawn_native/ObjectContentHasher.h
+++ b/src/dawn_native/ObjectContentHasher.h
@@ -79,4 +79,4 @@
} // namespace dawn_native
-#endif // DAWNNATIVE_OBJECT_CONTENT_HASHER_H_
\ No newline at end of file
+#endif // DAWNNATIVE_OBJECT_CONTENT_HASHER_H_
diff --git a/src/dawn_native/PersistentCache.cpp b/src/dawn_native/PersistentCache.cpp
index fbb1ece..43fc846 100644
--- a/src/dawn_native/PersistentCache.cpp
+++ b/src/dawn_native/PersistentCache.cpp
@@ -62,4 +62,4 @@
}
return nullptr;
}
-} // namespace dawn_native
\ No newline at end of file
+} // namespace dawn_native
diff --git a/src/dawn_native/PersistentCache.h b/src/dawn_native/PersistentCache.h
index 5e9dbc0..6cc5f91 100644
--- a/src/dawn_native/PersistentCache.h
+++ b/src/dawn_native/PersistentCache.h
@@ -83,4 +83,4 @@
};
} // namespace dawn_native
-#endif // DAWNNATIVE_PERSISTENTCACHE_H_
\ No newline at end of file
+#endif // DAWNNATIVE_PERSISTENTCACHE_H_
diff --git a/src/dawn_native/PooledResourceMemoryAllocator.cpp b/src/dawn_native/PooledResourceMemoryAllocator.cpp
index 5ba502e..2b6d44a 100644
--- a/src/dawn_native/PooledResourceMemoryAllocator.cpp
+++ b/src/dawn_native/PooledResourceMemoryAllocator.cpp
@@ -57,4 +57,4 @@
uint64_t PooledResourceMemoryAllocator::GetPoolSizeForTesting() const {
return mPool.size();
}
-} // namespace dawn_native
\ No newline at end of file
+} // namespace dawn_native
diff --git a/src/dawn_platform/DawnPlatform.cpp b/src/dawn_platform/DawnPlatform.cpp
index 6b71708..b772bac 100644
--- a/src/dawn_platform/DawnPlatform.cpp
+++ b/src/dawn_platform/DawnPlatform.cpp
@@ -55,4 +55,4 @@
return nullptr;
}
-} // namespace dawn_platform
\ No newline at end of file
+} // namespace dawn_platform
diff --git a/src/tests/end2end/CompressedTextureFormatTests.cpp b/src/tests/end2end/CompressedTextureFormatTests.cpp
index d0b0c30..bbbe2ee 100644
--- a/src/tests/end2end/CompressedTextureFormatTests.cpp
+++ b/src/tests/end2end/CompressedTextureFormatTests.cpp
@@ -30,7 +30,7 @@
uint32_t viewMipmapLevel = 0;
uint32_t bufferOffset = 0;
uint32_t bytesPerRowAlignment = kTextureBytesPerRowAlignment;
- uint32_t rowsPerImage = wgpu::kStrideUndefined;
+ uint32_t rowsPerImage = wgpu::kCopyStrideUndefined;
};
class CompressedTextureBCFormatTest : public DawnTest {
@@ -60,7 +60,7 @@
utils::GetTexelBlockSizeInBytes(copyConfig.textureDescriptor.format);
}
uint32_t copyRowsPerImage = copyConfig.rowsPerImage;
- if (copyRowsPerImage == wgpu::kStrideUndefined) {
+ if (copyRowsPerImage == wgpu::kCopyStrideUndefined) {
copyRowsPerImage = copyHeightInBlock;
}
uint32_t copyBytesPerImage = copyBytesPerRow * copyRowsPerImage;
diff --git a/src/tests/end2end/CopyTests.cpp b/src/tests/end2end/CopyTests.cpp
index 4902ee6..15e34c1 100644
--- a/src/tests/end2end/CopyTests.cpp
+++ b/src/tests/end2end/CopyTests.cpp
@@ -61,7 +61,7 @@
static BufferSpec MinimumBufferSpec(uint32_t width, uint32_t height, uint32_t depth = 1) {
return MinimumBufferSpec({width, height, depth}, kStrideComputeDefault,
- depth == 1 ? wgpu::kStrideUndefined : kStrideComputeDefault);
+ depth == 1 ? wgpu::kCopyStrideUndefined : kStrideComputeDefault);
}
static BufferSpec MinimumBufferSpec(wgpu::Extent3D copyExtent,
@@ -722,7 +722,7 @@
EXPECT_DEPRECATION_WARNING(DoTest(textureSpec, bufferSpec, {5, 1, 1}));
// bytesPerRow undefined
- bufferSpec.bytesPerRow = wgpu::kStrideUndefined;
+ bufferSpec.bytesPerRow = wgpu::kCopyStrideUndefined;
DoTest(textureSpec, bufferSpec, {5, 1, 1});
}
@@ -750,7 +750,8 @@
// bytesPerRow undefined
for (const wgpu::Extent3D copyExtent :
{wgpu::Extent3D{2, 1, 1}, {2, 0, 1}, {2, 1, 0}, {2, 0, 0}}) {
- DoTest(textureSpec, MinimumBufferSpec(copyExtent, wgpu::kStrideUndefined, 2), copyExtent);
+ DoTest(textureSpec, MinimumBufferSpec(copyExtent, wgpu::kCopyStrideUndefined, 2),
+ copyExtent);
}
// rowsPerImage 0
@@ -761,7 +762,8 @@
// rowsPerImage undefined
for (const wgpu::Extent3D copyExtent : {wgpu::Extent3D{2, 2, 1}, {2, 2, 0}}) {
- DoTest(textureSpec, MinimumBufferSpec(copyExtent, 256, wgpu::kStrideUndefined), copyExtent);
+ DoTest(textureSpec, MinimumBufferSpec(copyExtent, 256, wgpu::kCopyStrideUndefined),
+ copyExtent);
}
}
@@ -1209,7 +1211,7 @@
EXPECT_DEPRECATION_WARNING(DoTest(textureSpec, bufferSpec, {5, 1, 1}));
// bytesPerRow undefined
- bufferSpec.bytesPerRow = wgpu::kStrideUndefined;
+ bufferSpec.bytesPerRow = wgpu::kCopyStrideUndefined;
DoTest(textureSpec, bufferSpec, {5, 1, 1});
}
@@ -1237,7 +1239,8 @@
// bytesPerRow undefined
for (const wgpu::Extent3D copyExtent :
{wgpu::Extent3D{2, 1, 1}, {2, 0, 1}, {2, 1, 0}, {2, 0, 0}}) {
- DoTest(textureSpec, MinimumBufferSpec(copyExtent, wgpu::kStrideUndefined, 2), copyExtent);
+ DoTest(textureSpec, MinimumBufferSpec(copyExtent, wgpu::kCopyStrideUndefined, 2),
+ copyExtent);
}
// rowsPerImage 0
@@ -1248,7 +1251,8 @@
// rowsPerImage undefined
for (const wgpu::Extent3D copyExtent : {wgpu::Extent3D{2, 2, 1}, {2, 2, 0}}) {
- DoTest(textureSpec, MinimumBufferSpec(copyExtent, 256, wgpu::kStrideUndefined), copyExtent);
+ DoTest(textureSpec, MinimumBufferSpec(copyExtent, 256, wgpu::kCopyStrideUndefined),
+ copyExtent);
}
}
diff --git a/src/tests/end2end/IndexFormatTests.cpp b/src/tests/end2end/IndexFormatTests.cpp
index 4bcc5e3..43d9d92 100644
--- a/src/tests/end2end/IndexFormatTests.cpp
+++ b/src/tests/end2end/IndexFormatTests.cpp
@@ -486,4 +486,4 @@
D3D12Backend(),
MetalBackend(),
OpenGLBackend(),
- VulkanBackend());
\ No newline at end of file
+ VulkanBackend());
diff --git a/src/tests/end2end/QueueTests.cpp b/src/tests/end2end/QueueTests.cpp
index 79b9f5a..5ebb86b 100644
--- a/src/tests/end2end/QueueTests.cpp
+++ b/src/tests/end2end/QueueTests.cpp
@@ -292,7 +292,7 @@
textureSpec.textureSize.height >> textureSpec.level,
textureSpec.textureSize.depth};
uint32_t bytesPerRow = dataSpec.bytesPerRow;
- if (bytesPerRow == wgpu::kStrideUndefined) {
+ if (bytesPerRow == wgpu::kCopyStrideUndefined) {
bytesPerRow = mipSize.width * bytesPerTexel;
}
uint32_t alignedBytesPerRow = Align(bytesPerRow, bytesPerTexel);
@@ -526,7 +526,7 @@
EXPECT_DEPRECATION_WARNING(DoTest(textureSpec, dataSpec, copyExtent));
// bytesPerRow undefined
- dataSpec.bytesPerRow = wgpu::kStrideUndefined;
+ dataSpec.bytesPerRow = wgpu::kCopyStrideUndefined;
DoTest(textureSpec, dataSpec, copyExtent);
}
@@ -586,7 +586,7 @@
// bytesPerRow undefined
for (const wgpu::Extent3D copyExtent :
{wgpu::Extent3D{2, 1, 1}, {2, 0, 1}, {2, 1, 0}, {2, 0, 0}}) {
- DoTest(textureSpec, MinimumDataSpec(copyExtent, wgpu::kStrideUndefined, 2), copyExtent);
+ DoTest(textureSpec, MinimumDataSpec(copyExtent, wgpu::kCopyStrideUndefined, 2), copyExtent);
}
// rowsPerImage 0
@@ -597,7 +597,8 @@
// rowsPerImage undefined
for (const wgpu::Extent3D copyExtent : {wgpu::Extent3D{2, 2, 1}, {2, 2, 0}}) {
- DoTest(textureSpec, MinimumDataSpec(copyExtent, 256, wgpu::kStrideUndefined), copyExtent);
+ DoTest(textureSpec, MinimumDataSpec(copyExtent, 256, wgpu::kCopyStrideUndefined),
+ copyExtent);
}
}
diff --git a/src/tests/unittests/BuddyMemoryAllocatorTests.cpp b/src/tests/unittests/BuddyMemoryAllocatorTests.cpp
index 74b092a..3876ad8 100644
--- a/src/tests/unittests/BuddyMemoryAllocatorTests.cpp
+++ b/src/tests/unittests/BuddyMemoryAllocatorTests.cpp
@@ -457,4 +457,4 @@
// Make sure we can destroy the remaining heaps.
poolAllocator.DestroyPool();
ASSERT_EQ(poolAllocator.GetPoolSizeForTesting(), 0u);
-}
\ No newline at end of file
+}
diff --git a/src/tests/unittests/validation/CopyCommandsValidationTests.cpp b/src/tests/unittests/validation/CopyCommandsValidationTests.cpp
index 2804078..4cdeb8c 100644
--- a/src/tests/unittests/validation/CopyCommandsValidationTests.cpp
+++ b/src/tests/unittests/validation/CopyCommandsValidationTests.cpp
@@ -379,7 +379,7 @@
TestB2TCopy(utils::Expectation::Success, source, bufferSize - 4, 256, 1, destination, 0,
{0, 0, 0}, {1, 1, 1});
TestB2TCopy(utils::Expectation::Success, source, bufferSize - 4, 256,
- wgpu::kStrideUndefined, destination, 0, {0, 0, 0}, {1, 1, 1});
+ wgpu::kCopyStrideUndefined, destination, 0, {0, 0, 0}, {1, 1, 1});
}
// Copies with a 256-byte aligned bytes per row but unaligned texture region
@@ -397,15 +397,15 @@
// bytesPerRow is undefined
{
- TestB2TCopy(utils::Expectation::Success, source, 0, wgpu::kStrideUndefined, 2, destination,
- 0, {0, 0, 0}, {1, 1, 1});
- TestB2TCopy(utils::Expectation::Success, source, 0, wgpu::kStrideUndefined, 2, destination,
- 0, {0, 0, 0}, {3, 1, 1});
+ TestB2TCopy(utils::Expectation::Success, source, 0, wgpu::kCopyStrideUndefined, 2,
+ destination, 0, {0, 0, 0}, {1, 1, 1});
+ TestB2TCopy(utils::Expectation::Success, source, 0, wgpu::kCopyStrideUndefined, 2,
+ destination, 0, {0, 0, 0}, {3, 1, 1});
// Fail because height or depth is greater than 1:
- TestB2TCopy(utils::Expectation::Failure, source, 0, wgpu::kStrideUndefined, 2, destination,
- 0, {0, 0, 0}, {1, 2, 1});
- TestB2TCopy(utils::Expectation::Failure, source, 0, wgpu::kStrideUndefined, 2, destination,
- 0, {0, 0, 0}, {1, 1, 2});
+ TestB2TCopy(utils::Expectation::Failure, source, 0, wgpu::kCopyStrideUndefined, 2,
+ destination, 0, {0, 0, 0}, {1, 2, 1});
+ TestB2TCopy(utils::Expectation::Failure, source, 0, wgpu::kCopyStrideUndefined, 2,
+ destination, 0, {0, 0, 0}, {1, 1, 2});
}
// Empty copies are valid
@@ -413,23 +413,23 @@
// An empty copy
TestB2TCopy(utils::Expectation::Success, source, 0, 0, 0, destination, 0, {0, 0, 0},
{0, 0, 1});
- TestB2TCopy(utils::Expectation::Success, source, 0, wgpu::kStrideUndefined, 0, destination,
- 0, {0, 0, 0}, {0, 0, 1});
+ TestB2TCopy(utils::Expectation::Success, source, 0, wgpu::kCopyStrideUndefined, 0,
+ destination, 0, {0, 0, 0}, {0, 0, 1});
// An empty copy with depth = 0
TestB2TCopy(utils::Expectation::Success, source, 0, 0, 0, destination, 0, {0, 0, 0},
{0, 0, 0});
- TestB2TCopy(utils::Expectation::Success, source, 0, wgpu::kStrideUndefined, 0, destination,
- 0, {0, 0, 0}, {0, 0, 0});
+ TestB2TCopy(utils::Expectation::Success, source, 0, wgpu::kCopyStrideUndefined, 0,
+ destination, 0, {0, 0, 0}, {0, 0, 0});
// An empty copy touching the end of the buffer
TestB2TCopy(utils::Expectation::Success, source, bufferSize, 0, 0, destination, 0,
{0, 0, 0}, {0, 0, 1});
- TestB2TCopy(utils::Expectation::Success, source, bufferSize, wgpu::kStrideUndefined, 0,
+ TestB2TCopy(utils::Expectation::Success, source, bufferSize, wgpu::kCopyStrideUndefined, 0,
destination, 0, {0, 0, 0}, {0, 0, 1});
// An empty copy touching the side of the texture
TestB2TCopy(utils::Expectation::Success, source, 0, 0, 0, destination, 0, {16, 16, 0},
{0, 0, 1});
- TestB2TCopy(utils::Expectation::Success, source, 0, wgpu::kStrideUndefined, 0, destination,
- 0, {16, 16, 0}, {0, 0, 1});
+ TestB2TCopy(utils::Expectation::Success, source, 0, wgpu::kCopyStrideUndefined, 0,
+ destination, 0, {16, 16, 0}, {0, 0, 1});
// An empty copy with depth = 1 and bytesPerRow > 0
TestB2TCopy(utils::Expectation::Success, source, 0, kTextureBytesPerRowAlignment, 0,
@@ -599,11 +599,11 @@
destination, 0, {0, 0, 0}, {4, 4, 1}));
// rowsPerImage is undefined
- TestB2TCopy(utils::Expectation::Success, source, 0, 256, wgpu::kStrideUndefined, destination, 0,
- {0, 0, 0}, {4, 4, 1});
+ TestB2TCopy(utils::Expectation::Success, source, 0, 256, wgpu::kCopyStrideUndefined,
+ destination, 0, {0, 0, 0}, {4, 4, 1});
// Fail because depth > 1:
- TestB2TCopy(utils::Expectation::Failure, source, 0, 256, wgpu::kStrideUndefined, destination, 0,
- {0, 0, 0}, {4, 4, 2});
+ TestB2TCopy(utils::Expectation::Failure, source, 0, 256, wgpu::kCopyStrideUndefined,
+ destination, 0, {0, 0, 0}, {4, 4, 2});
// rowsPerImage is equal to copy height (Valid)
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 4, destination, 0, {0, 0, 0},
@@ -942,7 +942,7 @@
TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, bufferSize - 4,
256, 1, {1, 1, 1});
TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, bufferSize - 4,
- 256, wgpu::kStrideUndefined, {1, 1, 1});
+ 256, wgpu::kCopyStrideUndefined, {1, 1, 1});
}
// Copies with a 256-byte aligned bytes per row but unaligned texture region
@@ -961,14 +961,14 @@
// bytesPerRow is undefined
{
TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, 0,
- wgpu::kStrideUndefined, 2, {1, 1, 1});
+ wgpu::kCopyStrideUndefined, 2, {1, 1, 1});
TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, 0,
- wgpu::kStrideUndefined, 2, {3, 1, 1});
+ wgpu::kCopyStrideUndefined, 2, {3, 1, 1});
// Fail because height or depth is greater than 1:
TestT2BCopy(utils::Expectation::Failure, source, 0, {0, 0, 0}, destination, 0,
- wgpu::kStrideUndefined, 2, {1, 2, 1});
+ wgpu::kCopyStrideUndefined, 2, {1, 2, 1});
TestT2BCopy(utils::Expectation::Failure, source, 0, {0, 0, 0}, destination, 0,
- wgpu::kStrideUndefined, 2, {1, 1, 2});
+ wgpu::kCopyStrideUndefined, 2, {1, 1, 2});
}
// Empty copies are valid
@@ -977,22 +977,22 @@
TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, 0, 0, 0,
{0, 0, 1});
TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, 0,
- wgpu::kStrideUndefined, 0, {0, 0, 1});
+ wgpu::kCopyStrideUndefined, 0, {0, 0, 1});
// An empty copy with depth = 0
TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, 0, 0, 0,
{0, 0, 0});
TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, 0,
- wgpu::kStrideUndefined, 0, {0, 0, 0});
+ wgpu::kCopyStrideUndefined, 0, {0, 0, 0});
// An empty copy touching the end of the buffer
TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, bufferSize, 0,
0, {0, 0, 1});
TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, bufferSize,
- wgpu::kStrideUndefined, 0, {0, 0, 1});
+ wgpu::kCopyStrideUndefined, 0, {0, 0, 1});
// An empty copy touching the side of the texture
TestT2BCopy(utils::Expectation::Success, source, 0, {16, 16, 0}, destination, 0, 0, 0,
{0, 0, 1});
TestT2BCopy(utils::Expectation::Success, source, 0, {16, 16, 0}, destination, 0,
- wgpu::kStrideUndefined, 0, {0, 0, 1});
+ wgpu::kCopyStrideUndefined, 0, {0, 0, 1});
// An empty copy with depth = 1 and bytesPerRow > 0
TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, 0,
@@ -1191,10 +1191,10 @@
// rowsPerImage is undefined
TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, 0, 256,
- wgpu::kStrideUndefined, {4, 4, 1});
+ wgpu::kCopyStrideUndefined, {4, 4, 1});
// Fail because depth > 1:
TestT2BCopy(utils::Expectation::Failure, source, 0, {0, 0, 0}, destination, 0, 256,
- wgpu::kStrideUndefined, {4, 4, 2});
+ wgpu::kCopyStrideUndefined, {4, 4, 2});
// rowsPerImage is equal to copy height (Valid)
TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, 0, 256, 4,
diff --git a/src/tests/unittests/validation/QueueWriteTextureValidationTests.cpp b/src/tests/unittests/validation/QueueWriteTextureValidationTests.cpp
index b3c339d..a4f1bf7 100644
--- a/src/tests/unittests/validation/QueueWriteTextureValidationTests.cpp
+++ b/src/tests/unittests/validation/QueueWriteTextureValidationTests.cpp
@@ -106,8 +106,8 @@
TestWriteTexture(dataSize, 0, 256, 4, destination, 2, {0, 0, 0}, {4, 4, 1});
// Copy with a data offset
TestWriteTexture(dataSize, dataSize - 4, 256, 1, destination, 0, {0, 0, 0}, {1, 1, 1});
- TestWriteTexture(dataSize, dataSize - 4, 256, wgpu::kStrideUndefined, destination, 0,
- {0, 0, 0}, {1, 1, 1});
+ TestWriteTexture(dataSize, dataSize - 4, 256, wgpu::kCopyStrideUndefined, destination,
+ 0, {0, 0, 0}, {1, 1, 1});
}
// Copies with a 256-byte aligned bytes per row but unaligned texture region
@@ -124,27 +124,27 @@
{
// An empty copy
TestWriteTexture(dataSize, 0, 0, 0, destination, 0, {0, 0, 0}, {0, 0, 1});
- TestWriteTexture(dataSize, 0, 0, wgpu::kStrideUndefined, destination, 0, {0, 0, 0},
+ TestWriteTexture(dataSize, 0, 0, wgpu::kCopyStrideUndefined, destination, 0, {0, 0, 0},
{0, 0, 1});
// An empty copy with depth = 0
TestWriteTexture(dataSize, 0, 0, 0, destination, 0, {0, 0, 0}, {0, 0, 0});
- TestWriteTexture(dataSize, 0, 0, wgpu::kStrideUndefined, destination, 0, {0, 0, 0},
+ TestWriteTexture(dataSize, 0, 0, wgpu::kCopyStrideUndefined, destination, 0, {0, 0, 0},
{0, 0, 0});
// An empty copy touching the end of the data
TestWriteTexture(dataSize, dataSize, 0, 0, destination, 0, {0, 0, 0}, {0, 0, 1});
- TestWriteTexture(dataSize, dataSize, 0, wgpu::kStrideUndefined, destination, 0,
+ TestWriteTexture(dataSize, dataSize, 0, wgpu::kCopyStrideUndefined, destination, 0,
{0, 0, 0}, {0, 0, 1});
// An empty copy touching the side of the texture
TestWriteTexture(dataSize, 0, 0, 0, destination, 0, {16, 16, 0}, {0, 0, 1});
- TestWriteTexture(dataSize, 0, 0, wgpu::kStrideUndefined, destination, 0, {16, 16, 0},
- {0, 0, 1});
+ TestWriteTexture(dataSize, 0, 0, wgpu::kCopyStrideUndefined, destination, 0,
+ {16, 16, 0}, {0, 0, 1});
// An empty copy with depth = 1 and bytesPerRow > 0
TestWriteTexture(dataSize, 0, 256, 0, destination, 0, {0, 0, 0}, {0, 0, 1});
- TestWriteTexture(dataSize, 0, 256, wgpu::kStrideUndefined, destination, 0, {0, 0, 0},
- {0, 0, 1});
+ TestWriteTexture(dataSize, 0, 256, wgpu::kCopyStrideUndefined, destination, 0,
+ {0, 0, 0}, {0, 0, 1});
// An empty copy with height > 0, depth = 0, bytesPerRow > 0 and rowsPerImage > 0
- TestWriteTexture(dataSize, 0, 256, wgpu::kStrideUndefined, destination, 0, {0, 0, 0},
- {0, 1, 0});
+ TestWriteTexture(dataSize, 0, 256, wgpu::kCopyStrideUndefined, destination, 0,
+ {0, 0, 0}, {0, 1, 0});
TestWriteTexture(dataSize, 0, 256, 1, destination, 0, {0, 0, 0}, {0, 1, 0});
TestWriteTexture(dataSize, 0, 256, 16, destination, 0, {0, 0, 0}, {0, 1, 0});
}
@@ -237,27 +237,27 @@
wgpu::Texture destination = Create2DTexture({3, 7, 2}, 1, wgpu::TextureFormat::RGBA8Unorm,
wgpu::TextureUsage::CopyDst);
- // bytesPerRow = 0 or wgpu::kStrideUndefined
+ // bytesPerRow = 0 or wgpu::kCopyStrideUndefined
{
// copyHeight > 1
ASSERT_DEVICE_ERROR(
TestWriteTexture(128, 0, 0, 7, destination, 0, {0, 0, 0}, {3, 7, 1}));
TestWriteTexture(128, 0, 0, 7, destination, 0, {0, 0, 0}, {0, 7, 1});
- ASSERT_DEVICE_ERROR(TestWriteTexture(128, 0, wgpu::kStrideUndefined, 7, destination, 0,
- {0, 0, 0}, {0, 7, 1}));
+ ASSERT_DEVICE_ERROR(TestWriteTexture(128, 0, wgpu::kCopyStrideUndefined, 7, destination,
+ 0, {0, 0, 0}, {0, 7, 1}));
// copyDepth > 1
ASSERT_DEVICE_ERROR(
TestWriteTexture(128, 0, 0, 1, destination, 0, {0, 0, 0}, {3, 1, 2}));
TestWriteTexture(128, 0, 0, 1, destination, 0, {0, 0, 0}, {0, 1, 2});
- ASSERT_DEVICE_ERROR(TestWriteTexture(128, 0, wgpu::kStrideUndefined, 1, destination, 0,
- {0, 0, 0}, {0, 1, 2}));
+ ASSERT_DEVICE_ERROR(TestWriteTexture(128, 0, wgpu::kCopyStrideUndefined, 1, destination,
+ 0, {0, 0, 0}, {0, 1, 2}));
// copyHeight = 1 and copyDepth = 1
// TODO(crbug.com/dawn/520): Change to ASSERT_DEVICE_ERROR.
EXPECT_DEPRECATION_WARNING(
TestWriteTexture(128, 0, 0, 1, destination, 0, {0, 0, 0}, {3, 1, 1}));
- TestWriteTexture(128, 0, wgpu::kStrideUndefined, 1, destination, 0, {0, 0, 0},
+ TestWriteTexture(128, 0, wgpu::kCopyStrideUndefined, 1, destination, 0, {0, 0, 0},
{3, 1, 1});
}
@@ -298,8 +298,8 @@
wgpu::Texture destination = Create2DTexture({16, 16, 2}, 1, wgpu::TextureFormat::RGBA8Unorm,
wgpu::TextureUsage::CopyDst);
- // rowsPerImage is wgpu::kStrideUndefined
- TestWriteTexture(dataSize, 0, 256, wgpu::kStrideUndefined, destination, 0, {0, 0, 0},
+ // rowsPerImage is wgpu::kCopyStrideUndefined
+ TestWriteTexture(dataSize, 0, 256, wgpu::kCopyStrideUndefined, destination, 0, {0, 0, 0},
{4, 4, 1});
// rowsPerImage is equal to copy height (Valid)
@@ -532,7 +532,7 @@
{4, 4, 1}, 1, wgpu::TextureFormat::Depth24PlusStencil8,
wgpu::TextureUsage::CopyDst);
- TestWriteTexture(dataSize, 0, bytesPerRow, wgpu::kStrideUndefined, destination, 0,
+ TestWriteTexture(dataSize, 0, bytesPerRow, wgpu::kCopyStrideUndefined, destination, 0,
{0, 0, 0}, {4, 4, 1}, wgpu::TextureAspect::StencilOnly);
// And that it fails if the buffer is one byte too small
diff --git a/src/utils/TestUtils.cpp b/src/utils/TestUtils.cpp
index e5487d3..73a86b5 100644
--- a/src/utils/TestUtils.cpp
+++ b/src/utils/TestUtils.cpp
@@ -44,7 +44,7 @@
layout.bytesPerRow = GetMinimumBytesPerRow(format, layout.mipSize.width);
- if (rowsPerImage == wgpu::kStrideUndefined) {
+ if (rowsPerImage == wgpu::kCopyStrideUndefined) {
rowsPerImage = layout.mipSize.height;
}
layout.rowsPerImage = rowsPerImage;
@@ -125,7 +125,7 @@
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0});
wgpu::TextureDataLayout textureDataLayout =
- utils::CreateTextureDataLayout(0, wgpu::kStrideUndefined);
+ utils::CreateTextureDataLayout(0, wgpu::kCopyStrideUndefined);
wgpu::Extent3D copyExtent = {1, 1, 1};
// WriteTexture with exactly 1 byte of data.
diff --git a/src/utils/TestUtils.h b/src/utils/TestUtils.h
index d4ecb57..013de67 100644
--- a/src/utils/TestUtils.h
+++ b/src/utils/TestUtils.h
@@ -35,7 +35,7 @@
wgpu::TextureFormat format,
wgpu::Extent3D textureSizeAtLevel0,
uint32_t mipmapLevel,
- uint32_t rowsPerImage = wgpu::kStrideUndefined);
+ uint32_t rowsPerImage = wgpu::kCopyStrideUndefined);
uint64_t RequiredBytesInCopy(uint64_t bytesPerRow,
uint64_t rowsPerImage,
diff --git a/src/utils/WGPUHelpers.h b/src/utils/WGPUHelpers.h
index 58e5771..db3a3b3 100644
--- a/src/utils/WGPUHelpers.h
+++ b/src/utils/WGPUHelpers.h
@@ -53,15 +53,16 @@
wgpu::BufferCopyView CreateBufferCopyView(wgpu::Buffer buffer,
uint64_t offset,
uint32_t bytesPerRow,
- uint32_t rowsPerImage = wgpu::kStrideUndefined);
+ uint32_t rowsPerImage = wgpu::kCopyStrideUndefined);
wgpu::TextureCopyView CreateTextureCopyView(
wgpu::Texture texture,
uint32_t level,
wgpu::Origin3D origin,
wgpu::TextureAspect aspect = wgpu::TextureAspect::All);
- wgpu::TextureDataLayout CreateTextureDataLayout(uint64_t offset,
- uint32_t bytesPerRow,
- uint32_t rowsPerImage = wgpu::kStrideUndefined);
+ wgpu::TextureDataLayout CreateTextureDataLayout(
+ uint64_t offset,
+ uint32_t bytesPerRow,
+ uint32_t rowsPerImage = wgpu::kCopyStrideUndefined);
struct ComboRenderPassDescriptor : public wgpu::RenderPassDescriptor {
public: