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>
This commit is contained in:
Kai Ninomiya 2020-12-16 07:53:30 +00:00 committed by Commit Bot service account
parent fea4c14580
commit cf820d79ef
20 changed files with 110 additions and 97 deletions

View File

@ -1731,8 +1731,8 @@
"extensible": true, "extensible": true,
"members": [ "members": [
{"name": "offset", "type": "uint64_t", "default": 0}, {"name": "offset", "type": "uint64_t", "default": 0},
{"name": "bytes per row", "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_STRIDE_UNDEFINED"} {"name": "rows per image", "type": "uint32_t", "default": "WGPU_COPY_STRIDE_UNDEFINED"}
] ]
}, },
"texture descriptor": { "texture descriptor": {

View File

@ -74,7 +74,9 @@
#include <stdbool.h> #include <stdbool.h>
#define WGPU_WHOLE_SIZE (0xffffffffffffffffULL) #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_STRIDE_UNDEFINED (0xffffffffUL)
#define WGPU_COPY_STRIDE_UNDEFINED (0xffffffffUL)
typedef uint32_t WGPUFlags; typedef uint32_t WGPUFlags;

View File

@ -20,7 +20,9 @@
namespace wgpu { namespace wgpu {
static constexpr uint64_t kWholeSize = WGPU_WHOLE_SIZE; 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 kStrideUndefined = WGPU_STRIDE_UNDEFINED;
static constexpr uint32_t kCopyStrideUndefined = WGPU_COPY_STRIDE_UNDEFINED;
{% for type in by_category["enum"] %} {% for type in by_category["enum"] %}
enum class {{as_cppType(type.name)}} : uint32_t { enum class {{as_cppType(type.name)}} : uint32_t {

View File

@ -416,8 +416,8 @@ namespace dawn_native {
// //
// This means that if the computation of depth * bytesPerImage doesn't overflow, none of the // 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) // computations for requiredBytesInCopy will. (and it's not a very pessimizing check)
ASSERT(copySize.depth <= 1 || ASSERT(copySize.depth <= 1 || (bytesPerRow != wgpu::kCopyStrideUndefined &&
(bytesPerRow != wgpu::kStrideUndefined && rowsPerImage != wgpu::kStrideUndefined)); rowsPerImage != wgpu::kCopyStrideUndefined));
uint64_t bytesPerImage = Safe32x32(bytesPerRow, rowsPerImage); uint64_t bytesPerImage = Safe32x32(bytesPerRow, rowsPerImage);
if (bytesPerImage > std::numeric_limits<uint64_t>::max() / copySize.depth) { if (bytesPerImage > std::numeric_limits<uint64_t>::max() / copySize.depth) {
return DAWN_VALIDATION_ERROR("requiredBytesInCopy is too large."); return DAWN_VALIDATION_ERROR("requiredBytesInCopy is too large.");
@ -425,7 +425,7 @@ namespace dawn_native {
uint64_t requiredBytesInCopy = bytesPerImage * (copySize.depth - 1); uint64_t requiredBytesInCopy = bytesPerImage * (copySize.depth - 1);
if (heightInBlocks > 0) { if (heightInBlocks > 0) {
ASSERT(heightInBlocks <= 1 || bytesPerRow != wgpu::kStrideUndefined); ASSERT(heightInBlocks <= 1 || bytesPerRow != wgpu::kCopyStrideUndefined);
uint64_t bytesInLastImage = Safe32x32(bytesPerRow, heightInBlocks - 1) + bytesInLastRow; uint64_t bytesInLastImage = Safe32x32(bytesPerRow, heightInBlocks - 1) + bytesInLastRow;
requiredBytesInCopy += bytesInLastImage; requiredBytesInCopy += bytesInLastImage;
} }
@ -464,7 +464,7 @@ namespace dawn_native {
device->EmitDeprecationWarning( device->EmitDeprecationWarning(
"rowsPerImage soon must be non-zero or unspecified if copy depth == 1 (it will " "rowsPerImage soon must be non-zero or unspecified if copy depth == 1 (it will "
"no longer default to the copy height)."); "no longer default to the copy height).");
layout.rowsPerImage = wgpu::kStrideUndefined; layout.rowsPerImage = wgpu::kCopyStrideUndefined;
} }
} }
@ -478,12 +478,13 @@ namespace dawn_native {
device->EmitDeprecationWarning( device->EmitDeprecationWarning(
"Soon, even if copy height == 1, bytesPerRow must be >= the byte size of each row " "Soon, even if copy height == 1, bytesPerRow must be >= the byte size of each row "
"or left unspecified."); "or left unspecified.");
layout.bytesPerRow = wgpu::kStrideUndefined; layout.bytesPerRow = wgpu::kCopyStrideUndefined;
} }
return layout; 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, void ApplyDefaultTextureDataLayoutOptions(TextureDataLayout* layout,
const TexelBlockInfo& blockInfo, const TexelBlockInfo& blockInfo,
const Extent3D& copyExtent) { const Extent3D& copyExtent) {
@ -491,7 +492,7 @@ namespace dawn_native {
ASSERT(copyExtent.height % blockInfo.height == 0); ASSERT(copyExtent.height % blockInfo.height == 0);
uint32_t heightInBlocks = copyExtent.height / blockInfo.height; uint32_t heightInBlocks = copyExtent.height / blockInfo.height;
if (layout->bytesPerRow == wgpu::kStrideUndefined) { if (layout->bytesPerRow == wgpu::kCopyStrideUndefined) {
ASSERT(copyExtent.width % blockInfo.width == 0); ASSERT(copyExtent.width % blockInfo.width == 0);
uint32_t widthInBlocks = copyExtent.width / blockInfo.width; uint32_t widthInBlocks = copyExtent.width / blockInfo.width;
uint32_t bytesInLastRow = widthInBlocks * blockInfo.byteSize; uint32_t bytesInLastRow = widthInBlocks * blockInfo.byteSize;
@ -499,7 +500,7 @@ namespace dawn_native {
ASSERT(heightInBlocks <= 1 && copyExtent.depth <= 1); ASSERT(heightInBlocks <= 1 && copyExtent.depth <= 1);
layout->bytesPerRow = Align(bytesInLastRow, kTextureBytesPerRowAlignment); layout->bytesPerRow = Align(bytesInLastRow, kTextureBytesPerRowAlignment);
} }
if (layout->rowsPerImage == wgpu::kStrideUndefined) { if (layout->rowsPerImage == wgpu::kCopyStrideUndefined) {
ASSERT(copyExtent.depth <= 1); ASSERT(copyExtent.depth <= 1);
layout->rowsPerImage = heightInBlocks; layout->rowsPerImage = heightInBlocks;
} }
@ -512,12 +513,12 @@ namespace dawn_native {
ASSERT(copyExtent.height % blockInfo.height == 0); ASSERT(copyExtent.height % blockInfo.height == 0);
uint32_t heightInBlocks = copyExtent.height / blockInfo.height; uint32_t heightInBlocks = copyExtent.height / blockInfo.height;
if (copyExtent.depth > 1 && (layout.bytesPerRow == wgpu::kStrideUndefined || if (copyExtent.depth > 1 && (layout.bytesPerRow == wgpu::kCopyStrideUndefined ||
layout.rowsPerImage == wgpu::kStrideUndefined)) { layout.rowsPerImage == wgpu::kCopyStrideUndefined)) {
return DAWN_VALIDATION_ERROR( return DAWN_VALIDATION_ERROR(
"If copy depth > 1, bytesPerRow and rowsPerImage must be specified."); "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."); return DAWN_VALIDATION_ERROR("If heightInBlocks > 1, bytesPerRow must be specified.");
} }
@ -528,12 +529,14 @@ namespace dawn_native {
std::numeric_limits<uint32_t>::max()); std::numeric_limits<uint32_t>::max());
uint32_t bytesInLastRow = widthInBlocks * blockInfo.byteSize; uint32_t bytesInLastRow = widthInBlocks * blockInfo.byteSize;
// These != wgpu::kStrideUndefined checks are technically redundant with the > checks, but // These != wgpu::kCopyStrideUndefined checks are technically redundant with the > checks,
// they should get optimized out. // but they should get optimized out.
if (layout.bytesPerRow != wgpu::kStrideUndefined && bytesInLastRow > layout.bytesPerRow) { if (layout.bytesPerRow != wgpu::kCopyStrideUndefined &&
bytesInLastRow > layout.bytesPerRow) {
return DAWN_VALIDATION_ERROR("The byte size of each row must be <= 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( return DAWN_VALIDATION_ERROR(
"The height of each image, in blocks, must be <= rowsPerImage."); "The height of each image, in blocks, must be <= rowsPerImage.");
} }
@ -559,7 +562,7 @@ namespace dawn_native {
MaybeError ValidateBufferCopyView(DeviceBase const* device, MaybeError ValidateBufferCopyView(DeviceBase const* device,
const BufferCopyView& bufferCopyView) { const BufferCopyView& bufferCopyView) {
DAWN_TRY(device->ValidateObject(bufferCopyView.buffer)); DAWN_TRY(device->ValidateObject(bufferCopyView.buffer));
if (bufferCopyView.layout.bytesPerRow != wgpu::kStrideUndefined) { if (bufferCopyView.layout.bytesPerRow != wgpu::kCopyStrideUndefined) {
if (bufferCopyView.layout.bytesPerRow % kTextureBytesPerRowAlignment != 0) { if (bufferCopyView.layout.bytesPerRow % kTextureBytesPerRowAlignment != 0) {
return DAWN_VALIDATION_ERROR("bytesPerRow must be a multiple of 256"); return DAWN_VALIDATION_ERROR("bytesPerRow must be a multiple of 256");
} }

View File

@ -31,4 +31,4 @@ namespace dawn_native {
}; };
} // namespace dawn_native } // namespace dawn_native
#endif // DAWNNATIVE_INTERNALPIPELINESTORE_H_ #endif // DAWNNATIVE_INTERNALPIPELINESTORE_H_

View File

@ -79,4 +79,4 @@ namespace dawn_native {
} // namespace dawn_native } // namespace dawn_native
#endif // DAWNNATIVE_OBJECT_CONTENT_HASHER_H_ #endif // DAWNNATIVE_OBJECT_CONTENT_HASHER_H_

View File

@ -62,4 +62,4 @@ namespace dawn_native {
} }
return nullptr; return nullptr;
} }
} // namespace dawn_native } // namespace dawn_native

View File

@ -83,4 +83,4 @@ namespace dawn_native {
}; };
} // namespace dawn_native } // namespace dawn_native
#endif // DAWNNATIVE_PERSISTENTCACHE_H_ #endif // DAWNNATIVE_PERSISTENTCACHE_H_

View File

@ -57,4 +57,4 @@ namespace dawn_native {
uint64_t PooledResourceMemoryAllocator::GetPoolSizeForTesting() const { uint64_t PooledResourceMemoryAllocator::GetPoolSizeForTesting() const {
return mPool.size(); return mPool.size();
} }
} // namespace dawn_native } // namespace dawn_native

View File

@ -55,4 +55,4 @@ namespace dawn_platform {
return nullptr; return nullptr;
} }
} // namespace dawn_platform } // namespace dawn_platform

View File

@ -30,7 +30,7 @@ struct CopyConfig {
uint32_t viewMipmapLevel = 0; uint32_t viewMipmapLevel = 0;
uint32_t bufferOffset = 0; uint32_t bufferOffset = 0;
uint32_t bytesPerRowAlignment = kTextureBytesPerRowAlignment; uint32_t bytesPerRowAlignment = kTextureBytesPerRowAlignment;
uint32_t rowsPerImage = wgpu::kStrideUndefined; uint32_t rowsPerImage = wgpu::kCopyStrideUndefined;
}; };
class CompressedTextureBCFormatTest : public DawnTest { class CompressedTextureBCFormatTest : public DawnTest {
@ -60,7 +60,7 @@ class CompressedTextureBCFormatTest : public DawnTest {
utils::GetTexelBlockSizeInBytes(copyConfig.textureDescriptor.format); utils::GetTexelBlockSizeInBytes(copyConfig.textureDescriptor.format);
} }
uint32_t copyRowsPerImage = copyConfig.rowsPerImage; uint32_t copyRowsPerImage = copyConfig.rowsPerImage;
if (copyRowsPerImage == wgpu::kStrideUndefined) { if (copyRowsPerImage == wgpu::kCopyStrideUndefined) {
copyRowsPerImage = copyHeightInBlock; copyRowsPerImage = copyHeightInBlock;
} }
uint32_t copyBytesPerImage = copyBytesPerRow * copyRowsPerImage; uint32_t copyBytesPerImage = copyBytesPerRow * copyRowsPerImage;

View File

@ -61,7 +61,7 @@ class CopyTests : public DawnTest {
static BufferSpec MinimumBufferSpec(uint32_t width, uint32_t height, uint32_t depth = 1) { static BufferSpec MinimumBufferSpec(uint32_t width, uint32_t height, uint32_t depth = 1) {
return MinimumBufferSpec({width, height, depth}, kStrideComputeDefault, return MinimumBufferSpec({width, height, depth}, kStrideComputeDefault,
depth == 1 ? wgpu::kStrideUndefined : kStrideComputeDefault); depth == 1 ? wgpu::kCopyStrideUndefined : kStrideComputeDefault);
} }
static BufferSpec MinimumBufferSpec(wgpu::Extent3D copyExtent, static BufferSpec MinimumBufferSpec(wgpu::Extent3D copyExtent,
@ -722,7 +722,7 @@ TEST_P(CopyTests_T2B, BytesPerRowWithOneRowCopy) {
EXPECT_DEPRECATION_WARNING(DoTest(textureSpec, bufferSpec, {5, 1, 1})); EXPECT_DEPRECATION_WARNING(DoTest(textureSpec, bufferSpec, {5, 1, 1}));
// bytesPerRow undefined // bytesPerRow undefined
bufferSpec.bytesPerRow = wgpu::kStrideUndefined; bufferSpec.bytesPerRow = wgpu::kCopyStrideUndefined;
DoTest(textureSpec, bufferSpec, {5, 1, 1}); DoTest(textureSpec, bufferSpec, {5, 1, 1});
} }
@ -750,7 +750,8 @@ TEST_P(CopyTests_T2B, StrideSpecialCases) {
// bytesPerRow undefined // bytesPerRow undefined
for (const wgpu::Extent3D copyExtent : for (const wgpu::Extent3D copyExtent :
{wgpu::Extent3D{2, 1, 1}, {2, 0, 1}, {2, 1, 0}, {2, 0, 0}}) { {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 // rowsPerImage 0
@ -761,7 +762,8 @@ TEST_P(CopyTests_T2B, StrideSpecialCases) {
// rowsPerImage undefined // rowsPerImage undefined
for (const wgpu::Extent3D copyExtent : {wgpu::Extent3D{2, 2, 1}, {2, 2, 0}}) { 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 @@ TEST_P(CopyTests_B2T, BytesPerRowWithOneRowCopy) {
EXPECT_DEPRECATION_WARNING(DoTest(textureSpec, bufferSpec, {5, 1, 1})); EXPECT_DEPRECATION_WARNING(DoTest(textureSpec, bufferSpec, {5, 1, 1}));
// bytesPerRow undefined // bytesPerRow undefined
bufferSpec.bytesPerRow = wgpu::kStrideUndefined; bufferSpec.bytesPerRow = wgpu::kCopyStrideUndefined;
DoTest(textureSpec, bufferSpec, {5, 1, 1}); DoTest(textureSpec, bufferSpec, {5, 1, 1});
} }
@ -1237,7 +1239,8 @@ TEST_P(CopyTests_B2T, StrideSpecialCases) {
// bytesPerRow undefined // bytesPerRow undefined
for (const wgpu::Extent3D copyExtent : for (const wgpu::Extent3D copyExtent :
{wgpu::Extent3D{2, 1, 1}, {2, 0, 1}, {2, 1, 0}, {2, 0, 0}}) { {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 // rowsPerImage 0
@ -1248,7 +1251,8 @@ TEST_P(CopyTests_B2T, StrideSpecialCases) {
// rowsPerImage undefined // rowsPerImage undefined
for (const wgpu::Extent3D copyExtent : {wgpu::Extent3D{2, 2, 1}, {2, 2, 0}}) { 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);
} }
} }

View File

@ -486,4 +486,4 @@ DAWN_INSTANTIATE_TEST(LineStripPrimitiveRestartTests,
D3D12Backend(), D3D12Backend(),
MetalBackend(), MetalBackend(),
OpenGLBackend(), OpenGLBackend(),
VulkanBackend()); VulkanBackend());

View File

@ -292,7 +292,7 @@ class QueueWriteTextureTests : public DawnTest {
textureSpec.textureSize.height >> textureSpec.level, textureSpec.textureSize.height >> textureSpec.level,
textureSpec.textureSize.depth}; textureSpec.textureSize.depth};
uint32_t bytesPerRow = dataSpec.bytesPerRow; uint32_t bytesPerRow = dataSpec.bytesPerRow;
if (bytesPerRow == wgpu::kStrideUndefined) { if (bytesPerRow == wgpu::kCopyStrideUndefined) {
bytesPerRow = mipSize.width * bytesPerTexel; bytesPerRow = mipSize.width * bytesPerTexel;
} }
uint32_t alignedBytesPerRow = Align(bytesPerRow, bytesPerTexel); uint32_t alignedBytesPerRow = Align(bytesPerRow, bytesPerTexel);
@ -526,7 +526,7 @@ TEST_P(QueueWriteTextureTests, BytesPerRowWithOneRowCopy) {
EXPECT_DEPRECATION_WARNING(DoTest(textureSpec, dataSpec, copyExtent)); EXPECT_DEPRECATION_WARNING(DoTest(textureSpec, dataSpec, copyExtent));
// bytesPerRow undefined // bytesPerRow undefined
dataSpec.bytesPerRow = wgpu::kStrideUndefined; dataSpec.bytesPerRow = wgpu::kCopyStrideUndefined;
DoTest(textureSpec, dataSpec, copyExtent); DoTest(textureSpec, dataSpec, copyExtent);
} }
@ -586,7 +586,7 @@ TEST_P(QueueWriteTextureTests, StrideSpecialCases) {
// bytesPerRow undefined // bytesPerRow undefined
for (const wgpu::Extent3D copyExtent : for (const wgpu::Extent3D copyExtent :
{wgpu::Extent3D{2, 1, 1}, {2, 0, 1}, {2, 1, 0}, {2, 0, 0}}) { {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 // rowsPerImage 0
@ -597,7 +597,8 @@ TEST_P(QueueWriteTextureTests, StrideSpecialCases) {
// rowsPerImage undefined // rowsPerImage undefined
for (const wgpu::Extent3D copyExtent : {wgpu::Extent3D{2, 2, 1}, {2, 2, 0}}) { 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);
} }
} }

View File

@ -457,4 +457,4 @@ TEST(BuddyMemoryAllocatorTests, DestroyHeaps) {
// Make sure we can destroy the remaining heaps. // Make sure we can destroy the remaining heaps.
poolAllocator.DestroyPool(); poolAllocator.DestroyPool();
ASSERT_EQ(poolAllocator.GetPoolSizeForTesting(), 0u); ASSERT_EQ(poolAllocator.GetPoolSizeForTesting(), 0u);
} }

View File

@ -379,7 +379,7 @@ TEST_F(CopyCommandTest_B2T, Success) {
TestB2TCopy(utils::Expectation::Success, source, bufferSize - 4, 256, 1, destination, 0, TestB2TCopy(utils::Expectation::Success, source, bufferSize - 4, 256, 1, destination, 0,
{0, 0, 0}, {1, 1, 1}); {0, 0, 0}, {1, 1, 1});
TestB2TCopy(utils::Expectation::Success, source, bufferSize - 4, 256, 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 // Copies with a 256-byte aligned bytes per row but unaligned texture region
@ -397,15 +397,15 @@ TEST_F(CopyCommandTest_B2T, Success) {
// bytesPerRow is undefined // bytesPerRow is undefined
{ {
TestB2TCopy(utils::Expectation::Success, source, 0, wgpu::kStrideUndefined, 2, destination, TestB2TCopy(utils::Expectation::Success, source, 0, wgpu::kCopyStrideUndefined, 2,
0, {0, 0, 0}, {1, 1, 1}); destination, 0, {0, 0, 0}, {1, 1, 1});
TestB2TCopy(utils::Expectation::Success, source, 0, wgpu::kStrideUndefined, 2, destination, TestB2TCopy(utils::Expectation::Success, source, 0, wgpu::kCopyStrideUndefined, 2,
0, {0, 0, 0}, {3, 1, 1}); destination, 0, {0, 0, 0}, {3, 1, 1});
// Fail because height or depth is greater than 1: // Fail because height or depth is greater than 1:
TestB2TCopy(utils::Expectation::Failure, source, 0, wgpu::kStrideUndefined, 2, destination, TestB2TCopy(utils::Expectation::Failure, source, 0, wgpu::kCopyStrideUndefined, 2,
0, {0, 0, 0}, {1, 2, 1}); destination, 0, {0, 0, 0}, {1, 2, 1});
TestB2TCopy(utils::Expectation::Failure, source, 0, wgpu::kStrideUndefined, 2, destination, TestB2TCopy(utils::Expectation::Failure, source, 0, wgpu::kCopyStrideUndefined, 2,
0, {0, 0, 0}, {1, 1, 2}); destination, 0, {0, 0, 0}, {1, 1, 2});
} }
// Empty copies are valid // Empty copies are valid
@ -413,23 +413,23 @@ TEST_F(CopyCommandTest_B2T, Success) {
// An empty copy // An empty copy
TestB2TCopy(utils::Expectation::Success, source, 0, 0, 0, destination, 0, {0, 0, 0}, TestB2TCopy(utils::Expectation::Success, source, 0, 0, 0, destination, 0, {0, 0, 0},
{0, 0, 1}); {0, 0, 1});
TestB2TCopy(utils::Expectation::Success, source, 0, wgpu::kStrideUndefined, 0, destination, TestB2TCopy(utils::Expectation::Success, source, 0, wgpu::kCopyStrideUndefined, 0,
0, {0, 0, 0}, {0, 0, 1}); destination, 0, {0, 0, 0}, {0, 0, 1});
// An empty copy with depth = 0 // An empty copy with depth = 0
TestB2TCopy(utils::Expectation::Success, source, 0, 0, 0, destination, 0, {0, 0, 0}, TestB2TCopy(utils::Expectation::Success, source, 0, 0, 0, destination, 0, {0, 0, 0},
{0, 0, 0}); {0, 0, 0});
TestB2TCopy(utils::Expectation::Success, source, 0, wgpu::kStrideUndefined, 0, destination, TestB2TCopy(utils::Expectation::Success, source, 0, wgpu::kCopyStrideUndefined, 0,
0, {0, 0, 0}, {0, 0, 0}); destination, 0, {0, 0, 0}, {0, 0, 0});
// An empty copy touching the end of the buffer // An empty copy touching the end of the buffer
TestB2TCopy(utils::Expectation::Success, source, bufferSize, 0, 0, destination, 0, TestB2TCopy(utils::Expectation::Success, source, bufferSize, 0, 0, destination, 0,
{0, 0, 0}, {0, 0, 1}); {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}); destination, 0, {0, 0, 0}, {0, 0, 1});
// An empty copy touching the side of the texture // An empty copy touching the side of the texture
TestB2TCopy(utils::Expectation::Success, source, 0, 0, 0, destination, 0, {16, 16, 0}, TestB2TCopy(utils::Expectation::Success, source, 0, 0, 0, destination, 0, {16, 16, 0},
{0, 0, 1}); {0, 0, 1});
TestB2TCopy(utils::Expectation::Success, source, 0, wgpu::kStrideUndefined, 0, destination, TestB2TCopy(utils::Expectation::Success, source, 0, wgpu::kCopyStrideUndefined, 0,
0, {16, 16, 0}, {0, 0, 1}); destination, 0, {16, 16, 0}, {0, 0, 1});
// An empty copy with depth = 1 and bytesPerRow > 0 // An empty copy with depth = 1 and bytesPerRow > 0
TestB2TCopy(utils::Expectation::Success, source, 0, kTextureBytesPerRowAlignment, 0, TestB2TCopy(utils::Expectation::Success, source, 0, kTextureBytesPerRowAlignment, 0,
@ -599,11 +599,11 @@ TEST_F(CopyCommandTest_B2T, RowsPerImageConstraints) {
destination, 0, {0, 0, 0}, {4, 4, 1})); destination, 0, {0, 0, 0}, {4, 4, 1}));
// rowsPerImage is undefined // rowsPerImage is undefined
TestB2TCopy(utils::Expectation::Success, source, 0, 256, wgpu::kStrideUndefined, destination, 0, TestB2TCopy(utils::Expectation::Success, source, 0, 256, wgpu::kCopyStrideUndefined,
{0, 0, 0}, {4, 4, 1}); destination, 0, {0, 0, 0}, {4, 4, 1});
// Fail because depth > 1: // Fail because depth > 1:
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, wgpu::kStrideUndefined, destination, 0, TestB2TCopy(utils::Expectation::Failure, source, 0, 256, wgpu::kCopyStrideUndefined,
{0, 0, 0}, {4, 4, 2}); destination, 0, {0, 0, 0}, {4, 4, 2});
// rowsPerImage is equal to copy height (Valid) // rowsPerImage is equal to copy height (Valid)
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 4, destination, 0, {0, 0, 0}, TestB2TCopy(utils::Expectation::Success, source, 0, 256, 4, destination, 0, {0, 0, 0},
@ -942,7 +942,7 @@ TEST_F(CopyCommandTest_T2B, Success) {
TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, bufferSize - 4, TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, bufferSize - 4,
256, 1, {1, 1, 1}); 256, 1, {1, 1, 1});
TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, bufferSize - 4, 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 // Copies with a 256-byte aligned bytes per row but unaligned texture region
@ -961,14 +961,14 @@ TEST_F(CopyCommandTest_T2B, Success) {
// bytesPerRow is undefined // bytesPerRow is undefined
{ {
TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, 0, 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, 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: // Fail because height or depth is greater than 1:
TestT2BCopy(utils::Expectation::Failure, source, 0, {0, 0, 0}, destination, 0, 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, 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 // Empty copies are valid
@ -977,22 +977,22 @@ TEST_F(CopyCommandTest_T2B, Success) {
TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, 0, 0, 0, TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, 0, 0, 0,
{0, 0, 1}); {0, 0, 1});
TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, 0, 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 // An empty copy with depth = 0
TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, 0, 0, 0, TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, 0, 0, 0,
{0, 0, 0}); {0, 0, 0});
TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, 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 // An empty copy touching the end of the buffer
TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, bufferSize, 0, TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, bufferSize, 0,
0, {0, 0, 1}); 0, {0, 0, 1});
TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, bufferSize, 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 // An empty copy touching the side of the texture
TestT2BCopy(utils::Expectation::Success, source, 0, {16, 16, 0}, destination, 0, 0, 0, TestT2BCopy(utils::Expectation::Success, source, 0, {16, 16, 0}, destination, 0, 0, 0,
{0, 0, 1}); {0, 0, 1});
TestT2BCopy(utils::Expectation::Success, source, 0, {16, 16, 0}, destination, 0, 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 // An empty copy with depth = 1 and bytesPerRow > 0
TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, 0, TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, 0,
@ -1191,10 +1191,10 @@ TEST_F(CopyCommandTest_T2B, RowsPerImageConstraints) {
// rowsPerImage is undefined // rowsPerImage is undefined
TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, 0, 256, 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: // Fail because depth > 1:
TestT2BCopy(utils::Expectation::Failure, source, 0, {0, 0, 0}, destination, 0, 256, 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) // rowsPerImage is equal to copy height (Valid)
TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, 0, 256, 4, TestT2BCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, 0, 256, 4,

View File

@ -106,8 +106,8 @@ namespace {
TestWriteTexture(dataSize, 0, 256, 4, destination, 2, {0, 0, 0}, {4, 4, 1}); TestWriteTexture(dataSize, 0, 256, 4, destination, 2, {0, 0, 0}, {4, 4, 1});
// Copy with a data offset // Copy with a data offset
TestWriteTexture(dataSize, dataSize - 4, 256, 1, destination, 0, {0, 0, 0}, {1, 1, 1}); TestWriteTexture(dataSize, dataSize - 4, 256, 1, destination, 0, {0, 0, 0}, {1, 1, 1});
TestWriteTexture(dataSize, dataSize - 4, 256, wgpu::kStrideUndefined, destination, 0, TestWriteTexture(dataSize, dataSize - 4, 256, wgpu::kCopyStrideUndefined, destination,
{0, 0, 0}, {1, 1, 1}); 0, {0, 0, 0}, {1, 1, 1});
} }
// Copies with a 256-byte aligned bytes per row but unaligned texture region // Copies with a 256-byte aligned bytes per row but unaligned texture region
@ -124,27 +124,27 @@ namespace {
{ {
// An empty copy // An empty copy
TestWriteTexture(dataSize, 0, 0, 0, destination, 0, {0, 0, 0}, {0, 0, 1}); 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}); {0, 0, 1});
// An empty copy with depth = 0 // An empty copy with depth = 0
TestWriteTexture(dataSize, 0, 0, 0, destination, 0, {0, 0, 0}, {0, 0, 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}); {0, 0, 0});
// An empty copy touching the end of the data // 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, 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}); {0, 0, 0}, {0, 0, 1});
// An empty copy touching the side of the texture // 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, 0, destination, 0, {16, 16, 0}, {0, 0, 1});
TestWriteTexture(dataSize, 0, 0, wgpu::kStrideUndefined, destination, 0, {16, 16, 0}, TestWriteTexture(dataSize, 0, 0, wgpu::kCopyStrideUndefined, destination, 0,
{0, 0, 1}); {16, 16, 0}, {0, 0, 1});
// An empty copy with depth = 1 and bytesPerRow > 0 // 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, 0, destination, 0, {0, 0, 0}, {0, 0, 1});
TestWriteTexture(dataSize, 0, 256, wgpu::kStrideUndefined, destination, 0, {0, 0, 0}, TestWriteTexture(dataSize, 0, 256, wgpu::kCopyStrideUndefined, destination, 0,
{0, 0, 1}); {0, 0, 0}, {0, 0, 1});
// An empty copy with height > 0, depth = 0, bytesPerRow > 0 and rowsPerImage > 0 // An empty copy with height > 0, depth = 0, bytesPerRow > 0 and rowsPerImage > 0
TestWriteTexture(dataSize, 0, 256, wgpu::kStrideUndefined, destination, 0, {0, 0, 0}, TestWriteTexture(dataSize, 0, 256, wgpu::kCopyStrideUndefined, destination, 0,
{0, 1, 0}); {0, 0, 0}, {0, 1, 0});
TestWriteTexture(dataSize, 0, 256, 1, 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}); TestWriteTexture(dataSize, 0, 256, 16, destination, 0, {0, 0, 0}, {0, 1, 0});
} }
@ -237,27 +237,27 @@ namespace {
wgpu::Texture destination = Create2DTexture({3, 7, 2}, 1, wgpu::TextureFormat::RGBA8Unorm, wgpu::Texture destination = Create2DTexture({3, 7, 2}, 1, wgpu::TextureFormat::RGBA8Unorm,
wgpu::TextureUsage::CopyDst); wgpu::TextureUsage::CopyDst);
// bytesPerRow = 0 or wgpu::kStrideUndefined // bytesPerRow = 0 or wgpu::kCopyStrideUndefined
{ {
// copyHeight > 1 // copyHeight > 1
ASSERT_DEVICE_ERROR( 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}, {3, 7, 1}));
TestWriteTexture(128, 0, 0, 7, destination, 0, {0, 0, 0}, {0, 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, ASSERT_DEVICE_ERROR(TestWriteTexture(128, 0, wgpu::kCopyStrideUndefined, 7, destination,
{0, 0, 0}, {0, 7, 1})); 0, {0, 0, 0}, {0, 7, 1}));
// copyDepth > 1 // copyDepth > 1
ASSERT_DEVICE_ERROR( 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}, {3, 1, 2}));
TestWriteTexture(128, 0, 0, 1, destination, 0, {0, 0, 0}, {0, 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, ASSERT_DEVICE_ERROR(TestWriteTexture(128, 0, wgpu::kCopyStrideUndefined, 1, destination,
{0, 0, 0}, {0, 1, 2})); 0, {0, 0, 0}, {0, 1, 2}));
// copyHeight = 1 and copyDepth = 1 // copyHeight = 1 and copyDepth = 1
// TODO(crbug.com/dawn/520): Change to ASSERT_DEVICE_ERROR. // TODO(crbug.com/dawn/520): Change to ASSERT_DEVICE_ERROR.
EXPECT_DEPRECATION_WARNING( EXPECT_DEPRECATION_WARNING(
TestWriteTexture(128, 0, 0, 1, destination, 0, {0, 0, 0}, {3, 1, 1})); 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}); {3, 1, 1});
} }
@ -298,8 +298,8 @@ namespace {
wgpu::Texture destination = Create2DTexture({16, 16, 2}, 1, wgpu::TextureFormat::RGBA8Unorm, wgpu::Texture destination = Create2DTexture({16, 16, 2}, 1, wgpu::TextureFormat::RGBA8Unorm,
wgpu::TextureUsage::CopyDst); wgpu::TextureUsage::CopyDst);
// rowsPerImage is wgpu::kStrideUndefined // rowsPerImage is wgpu::kCopyStrideUndefined
TestWriteTexture(dataSize, 0, 256, wgpu::kStrideUndefined, destination, 0, {0, 0, 0}, TestWriteTexture(dataSize, 0, 256, wgpu::kCopyStrideUndefined, destination, 0, {0, 0, 0},
{4, 4, 1}); {4, 4, 1});
// rowsPerImage is equal to copy height (Valid) // rowsPerImage is equal to copy height (Valid)
@ -532,7 +532,7 @@ namespace {
{4, 4, 1}, 1, wgpu::TextureFormat::Depth24PlusStencil8, {4, 4, 1}, 1, wgpu::TextureFormat::Depth24PlusStencil8,
wgpu::TextureUsage::CopyDst); 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); {0, 0, 0}, {4, 4, 1}, wgpu::TextureAspect::StencilOnly);
// And that it fails if the buffer is one byte too small // And that it fails if the buffer is one byte too small

View File

@ -44,7 +44,7 @@ namespace utils {
layout.bytesPerRow = GetMinimumBytesPerRow(format, layout.mipSize.width); layout.bytesPerRow = GetMinimumBytesPerRow(format, layout.mipSize.width);
if (rowsPerImage == wgpu::kStrideUndefined) { if (rowsPerImage == wgpu::kCopyStrideUndefined) {
rowsPerImage = layout.mipSize.height; rowsPerImage = layout.mipSize.height;
} }
layout.rowsPerImage = rowsPerImage; layout.rowsPerImage = rowsPerImage;
@ -125,7 +125,7 @@ namespace utils {
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0}); wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0});
wgpu::TextureDataLayout textureDataLayout = wgpu::TextureDataLayout textureDataLayout =
utils::CreateTextureDataLayout(0, wgpu::kStrideUndefined); utils::CreateTextureDataLayout(0, wgpu::kCopyStrideUndefined);
wgpu::Extent3D copyExtent = {1, 1, 1}; wgpu::Extent3D copyExtent = {1, 1, 1};
// WriteTexture with exactly 1 byte of data. // WriteTexture with exactly 1 byte of data.

View File

@ -35,7 +35,7 @@ namespace utils {
wgpu::TextureFormat format, wgpu::TextureFormat format,
wgpu::Extent3D textureSizeAtLevel0, wgpu::Extent3D textureSizeAtLevel0,
uint32_t mipmapLevel, uint32_t mipmapLevel,
uint32_t rowsPerImage = wgpu::kStrideUndefined); uint32_t rowsPerImage = wgpu::kCopyStrideUndefined);
uint64_t RequiredBytesInCopy(uint64_t bytesPerRow, uint64_t RequiredBytesInCopy(uint64_t bytesPerRow,
uint64_t rowsPerImage, uint64_t rowsPerImage,

View File

@ -53,15 +53,16 @@ namespace utils {
wgpu::BufferCopyView CreateBufferCopyView(wgpu::Buffer buffer, wgpu::BufferCopyView CreateBufferCopyView(wgpu::Buffer buffer,
uint64_t offset, uint64_t offset,
uint32_t bytesPerRow, uint32_t bytesPerRow,
uint32_t rowsPerImage = wgpu::kStrideUndefined); uint32_t rowsPerImage = wgpu::kCopyStrideUndefined);
wgpu::TextureCopyView CreateTextureCopyView( wgpu::TextureCopyView CreateTextureCopyView(
wgpu::Texture texture, wgpu::Texture texture,
uint32_t level, uint32_t level,
wgpu::Origin3D origin, wgpu::Origin3D origin,
wgpu::TextureAspect aspect = wgpu::TextureAspect::All); wgpu::TextureAspect aspect = wgpu::TextureAspect::All);
wgpu::TextureDataLayout CreateTextureDataLayout(uint64_t offset, wgpu::TextureDataLayout CreateTextureDataLayout(
uint32_t bytesPerRow, uint64_t offset,
uint32_t rowsPerImage = wgpu::kStrideUndefined); uint32_t bytesPerRow,
uint32_t rowsPerImage = wgpu::kCopyStrideUndefined);
struct ComboRenderPassDescriptor : public wgpu::RenderPassDescriptor { struct ComboRenderPassDescriptor : public wgpu::RenderPassDescriptor {
public: public: