Remove deprecated array layer descriptor members
- wgpu::TextureDescriptor::arrayLayerCount - wgpu::TextureCopyView::arrayLayer Bug: dawn:22 Change-Id: I41a8b50c667f28c2496e0ad2e1d4ca655bf6c154 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26700 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
2b1c0b0e92
commit
e236f7df27
|
@ -1591,7 +1591,6 @@
|
||||||
"members": [
|
"members": [
|
||||||
{"name": "texture", "type": "texture"},
|
{"name": "texture", "type": "texture"},
|
||||||
{"name": "mip level", "type": "uint32_t", "default": "0"},
|
{"name": "mip level", "type": "uint32_t", "default": "0"},
|
||||||
{"name": "array layer", "type": "uint32_t", "default": "0"},
|
|
||||||
{"name": "origin", "type": "origin 3D"},
|
{"name": "origin", "type": "origin 3D"},
|
||||||
{"name": "aspect", "type": "texture aspect", "default": "all"}
|
{"name": "aspect", "type": "texture aspect", "default": "all"}
|
||||||
]
|
]
|
||||||
|
@ -1613,7 +1612,6 @@
|
||||||
{"name": "usage", "type": "texture usage"},
|
{"name": "usage", "type": "texture usage"},
|
||||||
{"name": "dimension", "type": "texture dimension", "default": "2D"},
|
{"name": "dimension", "type": "texture dimension", "default": "2D"},
|
||||||
{"name": "size", "type": "extent 3D"},
|
{"name": "size", "type": "extent 3D"},
|
||||||
{"name": "array layer count", "type": "uint32_t", "default": "1"},
|
|
||||||
{"name": "format", "type": "texture format"},
|
{"name": "format", "type": "texture format"},
|
||||||
{"name": "mip level count", "type": "uint32_t", "default": 1},
|
{"name": "mip level count", "type": "uint32_t", "default": 1},
|
||||||
{"name": "sample count", "type": "uint32_t", "default": 1}
|
{"name": "sample count", "type": "uint32_t", "default": 1}
|
||||||
|
|
|
@ -668,12 +668,6 @@ namespace dawn_native {
|
||||||
const TextureCopyView* destination,
|
const TextureCopyView* destination,
|
||||||
const Extent3D* copySize) {
|
const Extent3D* copySize) {
|
||||||
mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||||
// TODO(crbug.com/dawn/22): Remove once migration from GPUTextureCopyView.arrayLayer to
|
|
||||||
// GPUTextureCopyView.origin.z is done.
|
|
||||||
TextureCopyView fixedDest;
|
|
||||||
DAWN_TRY_ASSIGN(fixedDest, FixTextureCopyView(GetDevice(), destination));
|
|
||||||
destination = &fixedDest;
|
|
||||||
|
|
||||||
// TODO(crbug.com/dawn/22): Remove once migration to .layout is done.
|
// TODO(crbug.com/dawn/22): Remove once migration to .layout is done.
|
||||||
BufferCopyView fixedSource;
|
BufferCopyView fixedSource;
|
||||||
DAWN_TRY_ASSIGN(fixedSource, FixBufferCopyView(GetDevice(), source));
|
DAWN_TRY_ASSIGN(fixedSource, FixBufferCopyView(GetDevice(), source));
|
||||||
|
@ -738,12 +732,6 @@ namespace dawn_native {
|
||||||
const BufferCopyView* destination,
|
const BufferCopyView* destination,
|
||||||
const Extent3D* copySize) {
|
const Extent3D* copySize) {
|
||||||
mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||||
// TODO(crbug.com/dawn/22): Remove once migration from GPUTextureCopyView.arrayLayer to
|
|
||||||
// GPUTextureCopyView.origin.z is done.
|
|
||||||
TextureCopyView fixedSrc;
|
|
||||||
DAWN_TRY_ASSIGN(fixedSrc, FixTextureCopyView(GetDevice(), source));
|
|
||||||
source = &fixedSrc;
|
|
||||||
|
|
||||||
// TODO(crbug.com/dawn/22): Remove once migration to .layout is done.
|
// TODO(crbug.com/dawn/22): Remove once migration to .layout is done.
|
||||||
BufferCopyView fixedDst;
|
BufferCopyView fixedDst;
|
||||||
DAWN_TRY_ASSIGN(fixedDst, FixBufferCopyView(GetDevice(), destination));
|
DAWN_TRY_ASSIGN(fixedDst, FixBufferCopyView(GetDevice(), destination));
|
||||||
|
@ -805,15 +793,6 @@ namespace dawn_native {
|
||||||
const TextureCopyView* destination,
|
const TextureCopyView* destination,
|
||||||
const Extent3D* copySize) {
|
const Extent3D* copySize) {
|
||||||
mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||||
// TODO(crbug.com/dawn/22): Remove once migration from GPUTextureCopyView.arrayLayer to
|
|
||||||
// GPUTextureCopyView.origin.z is done.
|
|
||||||
TextureCopyView fixedSrc;
|
|
||||||
DAWN_TRY_ASSIGN(fixedSrc, FixTextureCopyView(GetDevice(), source));
|
|
||||||
source = &fixedSrc;
|
|
||||||
TextureCopyView fixedDest;
|
|
||||||
DAWN_TRY_ASSIGN(fixedDest, FixTextureCopyView(GetDevice(), destination));
|
|
||||||
destination = &fixedDest;
|
|
||||||
|
|
||||||
if (GetDevice()->IsValidationEnabled()) {
|
if (GetDevice()->IsValidationEnabled()) {
|
||||||
DAWN_TRY(GetDevice()->ValidateObject(source->texture));
|
DAWN_TRY(GetDevice()->ValidateObject(source->texture));
|
||||||
DAWN_TRY(GetDevice()->ValidateObject(destination->texture));
|
DAWN_TRY(GetDevice()->ValidateObject(destination->texture));
|
||||||
|
|
|
@ -1030,13 +1030,6 @@ namespace dawn_native {
|
||||||
ResultOrError<Ref<TextureBase>> DeviceBase::CreateTextureInternal(
|
ResultOrError<Ref<TextureBase>> DeviceBase::CreateTextureInternal(
|
||||||
const TextureDescriptor* descriptor) {
|
const TextureDescriptor* descriptor) {
|
||||||
DAWN_TRY(ValidateIsAlive());
|
DAWN_TRY(ValidateIsAlive());
|
||||||
|
|
||||||
// TODO(dawn:22): Remove once migration from GPUTextureDescriptor.arrayLayerCount to
|
|
||||||
// GPUTextureDescriptor.size.depth is done.
|
|
||||||
TextureDescriptor fixedDescriptor;
|
|
||||||
DAWN_TRY_ASSIGN(fixedDescriptor, FixTextureDescriptor(this, descriptor));
|
|
||||||
descriptor = &fixedDescriptor;
|
|
||||||
|
|
||||||
if (IsValidationEnabled()) {
|
if (IsValidationEnabled()) {
|
||||||
DAWN_TRY(ValidateTextureDescriptor(this, descriptor));
|
DAWN_TRY(ValidateTextureDescriptor(this, descriptor));
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,12 +146,6 @@ namespace dawn_native {
|
||||||
size_t dataSize,
|
size_t dataSize,
|
||||||
const TextureDataLayout* dataLayout,
|
const TextureDataLayout* dataLayout,
|
||||||
const Extent3D* writeSize) {
|
const Extent3D* writeSize) {
|
||||||
// TODO(crbug.com/dawn/22): Remove once migration from GPUTextureCopyView.arrayLayer to
|
|
||||||
// GPUTextureCopyView.origin.z is done.
|
|
||||||
TextureCopyView fixedDest;
|
|
||||||
DAWN_TRY_ASSIGN(fixedDest, FixTextureCopyView(GetDevice(), destination));
|
|
||||||
destination = &fixedDest;
|
|
||||||
|
|
||||||
DAWN_TRY(ValidateWriteTexture(destination, dataSize, dataLayout, writeSize));
|
DAWN_TRY(ValidateWriteTexture(destination, dataSize, dataLayout, writeSize));
|
||||||
|
|
||||||
if (writeSize->width == 0 || writeSize->height == 0 || writeSize->depth == 0) {
|
if (writeSize->width == 0 || writeSize->height == 0 || writeSize->depth == 0) {
|
||||||
|
|
|
@ -333,25 +333,6 @@ namespace dawn_native {
|
||||||
return desc;
|
return desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultOrError<TextureDescriptor> FixTextureDescriptor(DeviceBase* device,
|
|
||||||
const TextureDescriptor* desc) {
|
|
||||||
TextureDescriptor fixedDesc = *desc;
|
|
||||||
|
|
||||||
if (desc->arrayLayerCount >= 2) {
|
|
||||||
if (desc->size.depth != 1) {
|
|
||||||
return DAWN_VALIDATION_ERROR("arrayLayerCount and size.depth cannot both be set.");
|
|
||||||
} else {
|
|
||||||
fixedDesc.size.depth = fixedDesc.arrayLayerCount;
|
|
||||||
fixedDesc.arrayLayerCount = 1;
|
|
||||||
device->EmitDeprecationWarning(
|
|
||||||
"wgpu::TextureDescriptor::arrayLayerCount is deprecated in favor of "
|
|
||||||
"::size::depth");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {std::move(fixedDesc)};
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsValidSampleCount(uint32_t sampleCount) {
|
bool IsValidSampleCount(uint32_t sampleCount) {
|
||||||
switch (sampleCount) {
|
switch (sampleCount) {
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -696,23 +677,4 @@ namespace dawn_native {
|
||||||
return mRange;
|
return mRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultOrError<TextureCopyView> FixTextureCopyView(DeviceBase* device,
|
|
||||||
const TextureCopyView* view) {
|
|
||||||
TextureCopyView fixedView = *view;
|
|
||||||
|
|
||||||
if (view->arrayLayer != 0) {
|
|
||||||
if (view->origin.z != 0) {
|
|
||||||
return DAWN_VALIDATION_ERROR("arrayLayer and origin.z cannot both be != 0");
|
|
||||||
} else {
|
|
||||||
fixedView.origin.z = fixedView.arrayLayer;
|
|
||||||
fixedView.arrayLayer = 1;
|
|
||||||
device->EmitDeprecationWarning(
|
|
||||||
"wgpu::TextureCopyView::arrayLayer is deprecated in favor of "
|
|
||||||
"::origin::z");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return fixedView;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace dawn_native
|
} // namespace dawn_native
|
||||||
|
|
|
@ -64,11 +64,6 @@ namespace dawn_native {
|
||||||
const TextureBase* texture,
|
const TextureBase* texture,
|
||||||
const TextureViewDescriptor* descriptor);
|
const TextureViewDescriptor* descriptor);
|
||||||
|
|
||||||
// TODO(dawn:22): Remove once migration from GPUTextureDescriptor.arrayLayerCount to
|
|
||||||
// GPUTextureDescriptor.size.depth is done.
|
|
||||||
ResultOrError<TextureDescriptor> FixTextureDescriptor(DeviceBase* device,
|
|
||||||
const TextureDescriptor* desc);
|
|
||||||
|
|
||||||
bool IsValidSampleCount(uint32_t sampleCount);
|
bool IsValidSampleCount(uint32_t sampleCount);
|
||||||
|
|
||||||
static constexpr wgpu::TextureUsage kReadOnlyTextureUsages =
|
static constexpr wgpu::TextureUsage kReadOnlyTextureUsages =
|
||||||
|
@ -189,9 +184,6 @@ namespace dawn_native {
|
||||||
SubresourceRange mRange;
|
SubresourceRange mRange;
|
||||||
};
|
};
|
||||||
|
|
||||||
ResultOrError<TextureCopyView> FixTextureCopyView(DeviceBase* device,
|
|
||||||
const TextureCopyView* view);
|
|
||||||
|
|
||||||
} // namespace dawn_native
|
} // namespace dawn_native
|
||||||
|
|
||||||
#endif // DAWNNATIVE_TEXTURE_H_
|
#endif // DAWNNATIVE_TEXTURE_H_
|
||||||
|
|
|
@ -394,12 +394,6 @@ namespace dawn_native { namespace d3d12 {
|
||||||
const TextureDescriptor* textureDescriptor =
|
const TextureDescriptor* textureDescriptor =
|
||||||
reinterpret_cast<const TextureDescriptor*>(descriptor->cTextureDescriptor);
|
reinterpret_cast<const TextureDescriptor*>(descriptor->cTextureDescriptor);
|
||||||
|
|
||||||
// TODO(dawn:22): Remove once migration from GPUTextureDescriptor.arrayLayerCount to
|
|
||||||
// GPUTextureDescriptor.size.depth is done.
|
|
||||||
TextureDescriptor fixedDescriptor;
|
|
||||||
DAWN_TRY_ASSIGN(fixedDescriptor, FixTextureDescriptor(device, textureDescriptor));
|
|
||||||
textureDescriptor = &fixedDescriptor;
|
|
||||||
|
|
||||||
Ref<Texture> dawnTexture =
|
Ref<Texture> dawnTexture =
|
||||||
AcquireRef(new Texture(device, textureDescriptor, TextureState::OwnedExternal));
|
AcquireRef(new Texture(device, textureDescriptor, TextureState::OwnedExternal));
|
||||||
DAWN_TRY(dawnTexture->InitializeAsExternalTexture(textureDescriptor, sharedHandle,
|
DAWN_TRY(dawnTexture->InitializeAsExternalTexture(textureDescriptor, sharedHandle,
|
||||||
|
|
|
@ -325,14 +325,6 @@ namespace dawn_native { namespace metal {
|
||||||
const TextureDescriptor* textureDescriptor =
|
const TextureDescriptor* textureDescriptor =
|
||||||
reinterpret_cast<const TextureDescriptor*>(descriptor->cTextureDescriptor);
|
reinterpret_cast<const TextureDescriptor*>(descriptor->cTextureDescriptor);
|
||||||
|
|
||||||
// TODO(dawn:22): Remove once migration from GPUTextureDescriptor.arrayLayerCount to
|
|
||||||
// GPUTextureDescriptor.size.depth is done.
|
|
||||||
TextureDescriptor fixedDescriptor;
|
|
||||||
if (ConsumedError(FixTextureDescriptor(this, textureDescriptor), &fixedDescriptor)) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
textureDescriptor = &fixedDescriptor;
|
|
||||||
|
|
||||||
if (ConsumedError(ValidateTextureDescriptor(this, textureDescriptor))) {
|
if (ConsumedError(ValidateTextureDescriptor(this, textureDescriptor))) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -661,12 +661,6 @@ namespace dawn_native { namespace vulkan {
|
||||||
const TextureDescriptor* textureDescriptor =
|
const TextureDescriptor* textureDescriptor =
|
||||||
reinterpret_cast<const TextureDescriptor*>(descriptor->cTextureDescriptor);
|
reinterpret_cast<const TextureDescriptor*>(descriptor->cTextureDescriptor);
|
||||||
|
|
||||||
// TODO(dawn:22): Remove once migration from GPUTextureDescriptor.arrayLayerCount to
|
|
||||||
// GPUTextureDescriptor.size.depth is done.
|
|
||||||
TextureDescriptor fixedDescriptor;
|
|
||||||
DAWN_TRY_ASSIGN(fixedDescriptor, FixTextureDescriptor(this, textureDescriptor));
|
|
||||||
textureDescriptor = &fixedDescriptor;
|
|
||||||
|
|
||||||
// Check services support this combination of handle type / image info
|
// Check services support this combination of handle type / image info
|
||||||
if (!mExternalSemaphoreService->Supported()) {
|
if (!mExternalSemaphoreService->Supported()) {
|
||||||
return DAWN_VALIDATION_ERROR("External semaphore usage not supported");
|
return DAWN_VALIDATION_ERROR("External semaphore usage not supported");
|
||||||
|
|
|
@ -82,70 +82,6 @@ TEST_P(DeprecationTests, SetSubDataStillWorks) {
|
||||||
EXPECT_BUFFER_U32_EQ(data, buffer, 0);
|
EXPECT_BUFFER_U32_EQ(data, buffer, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that using TextureDescriptor::arrayLayerCount emits a warning.
|
|
||||||
TEST_P(DeprecationTests, TextureDescriptorArrayLayerCountDeprecated) {
|
|
||||||
wgpu::TextureDescriptor desc;
|
|
||||||
desc.usage = wgpu::TextureUsage::Sampled;
|
|
||||||
desc.dimension = wgpu::TextureDimension::e2D;
|
|
||||||
desc.size = {1, 1, 1};
|
|
||||||
desc.arrayLayerCount = 2;
|
|
||||||
desc.format = wgpu::TextureFormat::RGBA8Unorm;
|
|
||||||
desc.mipLevelCount = 1;
|
|
||||||
desc.sampleCount = 1;
|
|
||||||
|
|
||||||
EXPECT_DEPRECATION_WARNING(device.CreateTexture(&desc));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Test that using both TextureDescriptor::arrayLayerCount and size.depth triggers an error.
|
|
||||||
TEST_P(DeprecationTests, TextureDescriptorArrayLayerCountAndDepthSizeIsError) {
|
|
||||||
wgpu::TextureDescriptor desc;
|
|
||||||
desc.usage = wgpu::TextureUsage::Sampled;
|
|
||||||
desc.dimension = wgpu::TextureDimension::e2D;
|
|
||||||
desc.size = {1, 1, 2};
|
|
||||||
desc.arrayLayerCount = 2;
|
|
||||||
desc.format = wgpu::TextureFormat::RGBA8Unorm;
|
|
||||||
desc.mipLevelCount = 1;
|
|
||||||
desc.sampleCount = 1;
|
|
||||||
|
|
||||||
ASSERT_DEVICE_ERROR(device.CreateTexture(&desc));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Test that TextureDescriptor::arrayLayerCount does correct state tracking.
|
|
||||||
TEST_P(DeprecationTests, TextureDescriptorArrayLayerCountStateTracking) {
|
|
||||||
wgpu::TextureDescriptor desc;
|
|
||||||
desc.usage = wgpu::TextureUsage::Sampled;
|
|
||||||
desc.dimension = wgpu::TextureDimension::e2D;
|
|
||||||
desc.size = {1, 1, 1};
|
|
||||||
desc.arrayLayerCount = 2;
|
|
||||||
desc.format = wgpu::TextureFormat::RGBA8Unorm;
|
|
||||||
desc.mipLevelCount = 1;
|
|
||||||
desc.sampleCount = 1;
|
|
||||||
|
|
||||||
wgpu::Texture texture;
|
|
||||||
EXPECT_DEPRECATION_WARNING(texture = device.CreateTexture(&desc));
|
|
||||||
|
|
||||||
wgpu::TextureViewDescriptor viewDesc;
|
|
||||||
viewDesc.dimension = wgpu::TextureViewDimension::e2DArray;
|
|
||||||
viewDesc.arrayLayerCount = 2;
|
|
||||||
texture.CreateView(&viewDesc);
|
|
||||||
viewDesc.arrayLayerCount = 3;
|
|
||||||
ASSERT_DEVICE_ERROR(texture.CreateView(&viewDesc));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Test that using TextureDescriptor::arrayLayerCount = 0 is allowed
|
|
||||||
TEST_P(DeprecationTests, TextureDescriptorArrayLayerCountZero) {
|
|
||||||
wgpu::TextureDescriptor desc;
|
|
||||||
desc.usage = wgpu::TextureUsage::Sampled;
|
|
||||||
desc.dimension = wgpu::TextureDimension::e2D;
|
|
||||||
desc.size = {1, 1, 1};
|
|
||||||
desc.arrayLayerCount = 0;
|
|
||||||
desc.format = wgpu::TextureFormat::RGBA8Unorm;
|
|
||||||
desc.mipLevelCount = 1;
|
|
||||||
desc.sampleCount = 1;
|
|
||||||
|
|
||||||
device.CreateTexture(&desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
DAWN_INSTANTIATE_TEST(DeprecationTests,
|
DAWN_INSTANTIATE_TEST(DeprecationTests,
|
||||||
D3D12Backend(),
|
D3D12Backend(),
|
||||||
MetalBackend(),
|
MetalBackend(),
|
||||||
|
@ -153,141 +89,6 @@ DAWN_INSTANTIATE_TEST(DeprecationTests,
|
||||||
OpenGLBackend(),
|
OpenGLBackend(),
|
||||||
VulkanBackend());
|
VulkanBackend());
|
||||||
|
|
||||||
class TextureCopyViewArrayLayerDeprecationTests : public DeprecationTests {
|
|
||||||
protected:
|
|
||||||
wgpu::TextureCopyView MakeOldTextureCopyView() {
|
|
||||||
wgpu::TextureDescriptor desc;
|
|
||||||
desc.usage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst;
|
|
||||||
desc.dimension = wgpu::TextureDimension::e2D;
|
|
||||||
desc.size = {1, 1, 2};
|
|
||||||
desc.format = wgpu::TextureFormat::RGBA8Unorm;
|
|
||||||
|
|
||||||
wgpu::TextureCopyView copy;
|
|
||||||
copy.texture = device.CreateTexture(&desc);
|
|
||||||
copy.arrayLayer = 1;
|
|
||||||
copy.origin = {0, 0, 0};
|
|
||||||
return copy;
|
|
||||||
}
|
|
||||||
|
|
||||||
wgpu::TextureCopyView MakeNewTextureCopyView() {
|
|
||||||
wgpu::TextureCopyView copy = MakeOldTextureCopyView();
|
|
||||||
copy.arrayLayer = 0;
|
|
||||||
copy.origin.z = 1;
|
|
||||||
return copy;
|
|
||||||
}
|
|
||||||
|
|
||||||
wgpu::TextureCopyView MakeErrorTextureCopyView() {
|
|
||||||
wgpu::TextureCopyView copy = MakeOldTextureCopyView();
|
|
||||||
copy.origin.z = 1;
|
|
||||||
return copy;
|
|
||||||
}
|
|
||||||
|
|
||||||
wgpu::BufferCopyView MakeBufferCopyView() const {
|
|
||||||
wgpu::BufferDescriptor desc;
|
|
||||||
desc.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst;
|
|
||||||
desc.size = 4;
|
|
||||||
|
|
||||||
wgpu::BufferCopyView copy = {};
|
|
||||||
copy.buffer = device.CreateBuffer(&desc);
|
|
||||||
copy.layout.bytesPerRow = kTextureBytesPerRowAlignment;
|
|
||||||
return copy;
|
|
||||||
}
|
|
||||||
|
|
||||||
wgpu::Extent3D copySize = {1, 1, 1};
|
|
||||||
};
|
|
||||||
|
|
||||||
// Test that using TextureCopyView::arrayLayer emits a warning.
|
|
||||||
TEST_P(TextureCopyViewArrayLayerDeprecationTests, DeprecationWarning) {
|
|
||||||
wgpu::TextureCopyView texOldCopy = MakeOldTextureCopyView();
|
|
||||||
wgpu::TextureCopyView texNewCopy = MakeNewTextureCopyView();
|
|
||||||
wgpu::BufferCopyView bufCopy = MakeBufferCopyView();
|
|
||||||
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
|
||||||
EXPECT_DEPRECATION_WARNING(encoder.CopyBufferToTexture(&bufCopy, &texOldCopy, ©Size));
|
|
||||||
EXPECT_DEPRECATION_WARNING(encoder.CopyTextureToTexture(&texNewCopy, &texOldCopy, ©Size));
|
|
||||||
EXPECT_DEPRECATION_WARNING(encoder.CopyTextureToBuffer(&texOldCopy, &bufCopy, ©Size));
|
|
||||||
EXPECT_DEPRECATION_WARNING(encoder.CopyTextureToTexture(&texOldCopy, &texNewCopy, ©Size));
|
|
||||||
|
|
||||||
wgpu::CommandBuffer command = encoder.Finish();
|
|
||||||
|
|
||||||
queue.Submit(1, &command);
|
|
||||||
|
|
||||||
// TODO(dawn:483): Add other backends after implementing WriteTexture in them.
|
|
||||||
if (IsMetal() || IsVulkan()) {
|
|
||||||
std::vector<uint32_t> data = {1};
|
|
||||||
EXPECT_DEPRECATION_WARNING(
|
|
||||||
queue.WriteTexture(&texOldCopy, data.data(), 4, &bufCopy.layout, ©Size));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Test that using both TextureCopyView::arrayLayer and origin.z is an error.
|
|
||||||
TEST_P(TextureCopyViewArrayLayerDeprecationTests, BothArrayLayerAndOriginZIsError) {
|
|
||||||
wgpu::TextureCopyView texErrorCopy = MakeErrorTextureCopyView();
|
|
||||||
wgpu::TextureCopyView texNewCopy = MakeNewTextureCopyView();
|
|
||||||
wgpu::BufferCopyView bufCopy = MakeBufferCopyView();
|
|
||||||
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
|
||||||
encoder.CopyBufferToTexture(&bufCopy, &texErrorCopy, ©Size);
|
|
||||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
|
||||||
|
|
||||||
encoder = device.CreateCommandEncoder();
|
|
||||||
encoder.CopyTextureToTexture(&texNewCopy, &texErrorCopy, ©Size);
|
|
||||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
|
||||||
|
|
||||||
encoder = device.CreateCommandEncoder();
|
|
||||||
encoder.CopyTextureToBuffer(&texErrorCopy, &bufCopy, ©Size);
|
|
||||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
|
||||||
|
|
||||||
encoder = device.CreateCommandEncoder();
|
|
||||||
encoder.CopyTextureToTexture(&texErrorCopy, &texNewCopy, ©Size);
|
|
||||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
|
||||||
|
|
||||||
// TODO(dawn:483): Add other backends after implementing WriteTexture in them.
|
|
||||||
if (IsMetal() || IsVulkan()) {
|
|
||||||
std::vector<uint32_t> data = {1};
|
|
||||||
ASSERT_DEVICE_ERROR(
|
|
||||||
queue.WriteTexture(&texErrorCopy, data.data(), 4, &bufCopy.layout, ©Size));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Test that using TextureCopyView::arrayLayer is correctly taken into account
|
|
||||||
TEST_P(TextureCopyViewArrayLayerDeprecationTests, StateTracking) {
|
|
||||||
wgpu::TextureCopyView texOOBCopy = MakeOldTextureCopyView();
|
|
||||||
texOOBCopy.arrayLayer = 2; // Oh no, it is OOB!
|
|
||||||
wgpu::TextureCopyView texNewCopy = MakeNewTextureCopyView();
|
|
||||||
wgpu::BufferCopyView bufCopy = MakeBufferCopyView();
|
|
||||||
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
|
||||||
EXPECT_DEPRECATION_WARNING(encoder.CopyBufferToTexture(&bufCopy, &texOOBCopy, ©Size));
|
|
||||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
|
||||||
|
|
||||||
encoder = device.CreateCommandEncoder();
|
|
||||||
EXPECT_DEPRECATION_WARNING(encoder.CopyTextureToTexture(&texNewCopy, &texOOBCopy, ©Size));
|
|
||||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
|
||||||
|
|
||||||
encoder = device.CreateCommandEncoder();
|
|
||||||
EXPECT_DEPRECATION_WARNING(encoder.CopyTextureToBuffer(&texOOBCopy, &bufCopy, ©Size));
|
|
||||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
|
||||||
|
|
||||||
encoder = device.CreateCommandEncoder();
|
|
||||||
EXPECT_DEPRECATION_WARNING(encoder.CopyTextureToTexture(&texOOBCopy, &texNewCopy, ©Size));
|
|
||||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
|
||||||
|
|
||||||
// TODO(dawn:483): Add other backends after implementing WriteTexture in them.
|
|
||||||
if (IsMetal() || IsVulkan()) {
|
|
||||||
std::vector<uint32_t> data = {1};
|
|
||||||
EXPECT_DEPRECATION_WARNING(ASSERT_DEVICE_ERROR(
|
|
||||||
queue.WriteTexture(&texOOBCopy, data.data(), 4, &bufCopy.layout, ©Size)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DAWN_INSTANTIATE_TEST(TextureCopyViewArrayLayerDeprecationTests,
|
|
||||||
D3D12Backend(),
|
|
||||||
MetalBackend(),
|
|
||||||
NullBackend(),
|
|
||||||
OpenGLBackend(),
|
|
||||||
VulkanBackend());
|
|
||||||
|
|
||||||
class BufferCopyViewDeprecationTests : public DeprecationTests {
|
class BufferCopyViewDeprecationTests : public DeprecationTests {
|
||||||
protected:
|
protected:
|
||||||
wgpu::TextureCopyView MakeTextureCopyView() {
|
wgpu::TextureCopyView MakeTextureCopyView() {
|
||||||
|
@ -299,7 +100,6 @@ class BufferCopyViewDeprecationTests : public DeprecationTests {
|
||||||
|
|
||||||
wgpu::TextureCopyView copy;
|
wgpu::TextureCopyView copy;
|
||||||
copy.texture = device.CreateTexture(&desc);
|
copy.texture = device.CreateTexture(&desc);
|
||||||
copy.arrayLayer = 0;
|
|
||||||
copy.origin = {0, 0, 1};
|
copy.origin = {0, 0, 1};
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,6 @@ class D3D12DescriptorHeapTests : public DawnTest {
|
||||||
descriptor.size.width = width;
|
descriptor.size.width = width;
|
||||||
descriptor.size.height = height;
|
descriptor.size.height = height;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = format;
|
descriptor.format = format;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
|
@ -732,7 +731,6 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBOAndSamplers) {
|
||||||
descriptor.size.width = kRTSize;
|
descriptor.size.width = kRTSize;
|
||||||
descriptor.size.height = kRTSize;
|
descriptor.size.height = kRTSize;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
|
|
|
@ -50,7 +50,6 @@ TEST_P(D3D12SmallTextureTests, AlignSmallCompressedTexture) {
|
||||||
descriptor.size.width = 8;
|
descriptor.size.width = 8;
|
||||||
descriptor.size.height = 8;
|
descriptor.size.height = 8;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = wgpu::TextureFormat::BC1RGBAUnorm;
|
descriptor.format = wgpu::TextureFormat::BC1RGBAUnorm;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
|
|
|
@ -373,7 +373,6 @@ namespace dawn_native { namespace vulkan {
|
||||||
defaultDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
defaultDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
defaultDescriptor.size = {1, 1, 1};
|
defaultDescriptor.size = {1, 1, 1};
|
||||||
defaultDescriptor.sampleCount = 1;
|
defaultDescriptor.sampleCount = 1;
|
||||||
defaultDescriptor.arrayLayerCount = 1;
|
|
||||||
defaultDescriptor.mipLevelCount = 1;
|
defaultDescriptor.mipLevelCount = 1;
|
||||||
defaultDescriptor.usage = wgpu::TextureUsage::OutputAttachment |
|
defaultDescriptor.usage = wgpu::TextureUsage::OutputAttachment |
|
||||||
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst;
|
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst;
|
||||||
|
@ -432,13 +431,11 @@ namespace dawn_native { namespace vulkan {
|
||||||
wgpu::TextureCopyView copySrc;
|
wgpu::TextureCopyView copySrc;
|
||||||
copySrc.texture = source;
|
copySrc.texture = source;
|
||||||
copySrc.mipLevel = 0;
|
copySrc.mipLevel = 0;
|
||||||
copySrc.arrayLayer = 0;
|
|
||||||
copySrc.origin = {0, 0, 0};
|
copySrc.origin = {0, 0, 0};
|
||||||
|
|
||||||
wgpu::TextureCopyView copyDst;
|
wgpu::TextureCopyView copyDst;
|
||||||
copyDst.texture = destination;
|
copyDst.texture = destination;
|
||||||
copyDst.mipLevel = 0;
|
copyDst.mipLevel = 0;
|
||||||
copyDst.arrayLayer = 0;
|
|
||||||
copyDst.origin = {0, 0, 0};
|
copyDst.origin = {0, 0, 0};
|
||||||
|
|
||||||
wgpu::Extent3D copySize = {1, 1, 1};
|
wgpu::Extent3D copySize = {1, 1, 1};
|
||||||
|
@ -918,7 +915,6 @@ namespace dawn_native { namespace vulkan {
|
||||||
descriptor.size.width = 640;
|
descriptor.size.width = 640;
|
||||||
descriptor.size.height = 480;
|
descriptor.size.height = 480;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = wgpu::TextureFormat::BGRA8Unorm;
|
descriptor.format = wgpu::TextureFormat::BGRA8Unorm;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
|
|
Loading…
Reference in New Issue