Remove deprecated API surface, Pt. 1
- Remove Device.getDefaultQueue() - Remove Extent3D.depth - Remove setIndexBufferWithFormat - Remove TextureUsage::OutputAttachment Change-Id: If1c39b5630c88c3b87b37e317aafe7442419f7d0 Bug: dawn:22 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/50700 Reviewed-by: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Brandon Jones <bajones@chromium.org>
This commit is contained in:
parent
82ba34a941
commit
76e5a9f6dd
26
dawn.json
26
dawn.json
|
@ -814,10 +814,6 @@
|
||||||
"name": "get queue",
|
"name": "get queue",
|
||||||
"returns": "queue"
|
"returns": "queue"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "get default queue",
|
|
||||||
"returns": "queue"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "create external texture",
|
"name": "create external texture",
|
||||||
"returns": "external texture",
|
"returns": "external texture",
|
||||||
|
@ -935,8 +931,7 @@
|
||||||
"members": [
|
"members": [
|
||||||
{"name": "width", "type": "uint32_t"},
|
{"name": "width", "type": "uint32_t"},
|
||||||
{"name": "height", "type": "uint32_t", "default": 1},
|
{"name": "height", "type": "uint32_t", "default": 1},
|
||||||
{"name": "depth or array layers", "type": "uint32_t", "default": 1},
|
{"name": "depth or array layers", "type": "uint32_t", "default": 1}
|
||||||
{"name": "depth", "type": "uint32_t", "default": 1}
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"external texture": {
|
"external texture": {
|
||||||
|
@ -1386,15 +1381,6 @@
|
||||||
{"name": "size", "type": "uint64_t", "default": "0"}
|
{"name": "size", "type": "uint64_t", "default": "0"}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "set index buffer with format",
|
|
||||||
"args": [
|
|
||||||
{"name": "buffer", "type": "buffer"},
|
|
||||||
{"name": "format", "type": "index format"},
|
|
||||||
{"name": "offset", "type": "uint64_t", "default": "0"},
|
|
||||||
{"name": "size", "type": "uint64_t", "default": "0"}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "finish",
|
"name": "finish",
|
||||||
"returns": "render bundle",
|
"returns": "render bundle",
|
||||||
|
@ -1604,15 +1590,6 @@
|
||||||
{"name": "size", "type": "uint64_t", "default": "0"}
|
{"name": "size", "type": "uint64_t", "default": "0"}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "set index buffer with format",
|
|
||||||
"args": [
|
|
||||||
{"name": "buffer", "type": "buffer"},
|
|
||||||
{"name": "format", "type": "index format"},
|
|
||||||
{"name": "offset", "type": "uint64_t", "default": "0"},
|
|
||||||
{"name": "size", "type": "uint64_t", "default": "0"}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "begin occlusion query",
|
"name": "begin occlusion query",
|
||||||
"args": [
|
"args": [
|
||||||
|
@ -2094,7 +2071,6 @@
|
||||||
{"value": 2, "name": "copy dst"},
|
{"value": 2, "name": "copy dst"},
|
||||||
{"value": 4, "name": "sampled"},
|
{"value": 4, "name": "sampled"},
|
||||||
{"value": 8, "name": "storage"},
|
{"value": 8, "name": "storage"},
|
||||||
{"value": 16, "name": "output attachment"},
|
|
||||||
{"value": 16, "name": "render attachment"},
|
{"value": 16, "name": "render attachment"},
|
||||||
{"value": 32, "name": "present"}
|
{"value": 32, "name": "present"}
|
||||||
]
|
]
|
||||||
|
|
|
@ -653,14 +653,11 @@ namespace dawn_native {
|
||||||
const ImageCopyTexture* destination,
|
const ImageCopyTexture* destination,
|
||||||
const Extent3D* copySize) {
|
const Extent3D* copySize) {
|
||||||
mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||||
Extent3D fixedCopySize = *copySize;
|
|
||||||
DAWN_TRY(FixUpDeprecatedGPUExtent3DDepth(GetDevice(), &fixedCopySize));
|
|
||||||
|
|
||||||
if (GetDevice()->IsValidationEnabled()) {
|
if (GetDevice()->IsValidationEnabled()) {
|
||||||
DAWN_TRY(ValidateImageCopyBuffer(GetDevice(), *source));
|
DAWN_TRY(ValidateImageCopyBuffer(GetDevice(), *source));
|
||||||
DAWN_TRY(ValidateCanUseAs(source->buffer, wgpu::BufferUsage::CopySrc));
|
DAWN_TRY(ValidateCanUseAs(source->buffer, wgpu::BufferUsage::CopySrc));
|
||||||
|
|
||||||
DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *destination, fixedCopySize));
|
DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *destination, *copySize));
|
||||||
DAWN_TRY(ValidateCanUseAs(destination->texture, wgpu::TextureUsage::CopyDst));
|
DAWN_TRY(ValidateCanUseAs(destination->texture, wgpu::TextureUsage::CopyDst));
|
||||||
DAWN_TRY(ValidateTextureSampleCountInBufferCopyCommands(destination->texture));
|
DAWN_TRY(ValidateTextureSampleCountInBufferCopyCommands(destination->texture));
|
||||||
|
|
||||||
|
@ -669,26 +666,26 @@ namespace dawn_native {
|
||||||
// because in the latter we divide copyExtent.width by blockWidth and
|
// because in the latter we divide copyExtent.width by blockWidth and
|
||||||
// copyExtent.height by blockHeight while the divisibility conditions are
|
// copyExtent.height by blockHeight while the divisibility conditions are
|
||||||
// checked in validating texture copy range.
|
// checked in validating texture copy range.
|
||||||
DAWN_TRY(ValidateTextureCopyRange(GetDevice(), *destination, fixedCopySize));
|
DAWN_TRY(ValidateTextureCopyRange(GetDevice(), *destination, *copySize));
|
||||||
}
|
}
|
||||||
const TexelBlockInfo& blockInfo =
|
const TexelBlockInfo& blockInfo =
|
||||||
destination->texture->GetFormat().GetAspectInfo(destination->aspect).block;
|
destination->texture->GetFormat().GetAspectInfo(destination->aspect).block;
|
||||||
TextureDataLayout srcLayout = FixUpDeprecatedTextureDataLayoutOptions(
|
TextureDataLayout srcLayout = FixUpDeprecatedTextureDataLayoutOptions(
|
||||||
GetDevice(), source->layout, blockInfo, fixedCopySize);
|
GetDevice(), source->layout, blockInfo, *copySize);
|
||||||
if (GetDevice()->IsValidationEnabled()) {
|
if (GetDevice()->IsValidationEnabled()) {
|
||||||
DAWN_TRY(ValidateLinearTextureCopyOffset(srcLayout, blockInfo));
|
DAWN_TRY(ValidateLinearTextureCopyOffset(srcLayout, blockInfo));
|
||||||
DAWN_TRY(ValidateLinearTextureData(srcLayout, source->buffer->GetSize(), blockInfo,
|
DAWN_TRY(ValidateLinearTextureData(srcLayout, source->buffer->GetSize(), blockInfo,
|
||||||
fixedCopySize));
|
*copySize));
|
||||||
|
|
||||||
mTopLevelBuffers.insert(source->buffer);
|
mTopLevelBuffers.insert(source->buffer);
|
||||||
mTopLevelTextures.insert(destination->texture);
|
mTopLevelTextures.insert(destination->texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplyDefaultTextureDataLayoutOptions(&srcLayout, blockInfo, fixedCopySize);
|
ApplyDefaultTextureDataLayoutOptions(&srcLayout, blockInfo, *copySize);
|
||||||
|
|
||||||
// Skip noop copies.
|
// Skip noop copies.
|
||||||
if (fixedCopySize.width != 0 && fixedCopySize.height != 0 &&
|
if (copySize->width != 0 && copySize->height != 0 &&
|
||||||
fixedCopySize.depthOrArrayLayers != 0) {
|
copySize->depthOrArrayLayers != 0) {
|
||||||
// Record the copy command.
|
// Record the copy command.
|
||||||
CopyBufferToTextureCmd* copy =
|
CopyBufferToTextureCmd* copy =
|
||||||
allocator->Allocate<CopyBufferToTextureCmd>(Command::CopyBufferToTexture);
|
allocator->Allocate<CopyBufferToTextureCmd>(Command::CopyBufferToTexture);
|
||||||
|
@ -701,7 +698,7 @@ namespace dawn_native {
|
||||||
copy->destination.mipLevel = destination->mipLevel;
|
copy->destination.mipLevel = destination->mipLevel;
|
||||||
copy->destination.aspect =
|
copy->destination.aspect =
|
||||||
ConvertAspect(destination->texture->GetFormat(), destination->aspect);
|
ConvertAspect(destination->texture->GetFormat(), destination->aspect);
|
||||||
copy->copySize = fixedCopySize;
|
copy->copySize = *copySize;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
|
@ -712,11 +709,8 @@ namespace dawn_native {
|
||||||
const ImageCopyBuffer* destination,
|
const ImageCopyBuffer* destination,
|
||||||
const Extent3D* copySize) {
|
const Extent3D* copySize) {
|
||||||
mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||||
Extent3D fixedCopySize = *copySize;
|
|
||||||
DAWN_TRY(FixUpDeprecatedGPUExtent3DDepth(GetDevice(), &fixedCopySize));
|
|
||||||
|
|
||||||
if (GetDevice()->IsValidationEnabled()) {
|
if (GetDevice()->IsValidationEnabled()) {
|
||||||
DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *source, fixedCopySize));
|
DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *source, *copySize));
|
||||||
DAWN_TRY(ValidateCanUseAs(source->texture, wgpu::TextureUsage::CopySrc));
|
DAWN_TRY(ValidateCanUseAs(source->texture, wgpu::TextureUsage::CopySrc));
|
||||||
DAWN_TRY(ValidateTextureSampleCountInBufferCopyCommands(source->texture));
|
DAWN_TRY(ValidateTextureSampleCountInBufferCopyCommands(source->texture));
|
||||||
DAWN_TRY(ValidateTextureDepthStencilToBufferCopyRestrictions(*source));
|
DAWN_TRY(ValidateTextureDepthStencilToBufferCopyRestrictions(*source));
|
||||||
|
@ -728,26 +722,26 @@ namespace dawn_native {
|
||||||
// because in the latter we divide copyExtent.width by blockWidth and
|
// because in the latter we divide copyExtent.width by blockWidth and
|
||||||
// copyExtent.height by blockHeight while the divisibility conditions are
|
// copyExtent.height by blockHeight while the divisibility conditions are
|
||||||
// checked in validating texture copy range.
|
// checked in validating texture copy range.
|
||||||
DAWN_TRY(ValidateTextureCopyRange(GetDevice(), *source, fixedCopySize));
|
DAWN_TRY(ValidateTextureCopyRange(GetDevice(), *source, *copySize));
|
||||||
}
|
}
|
||||||
const TexelBlockInfo& blockInfo =
|
const TexelBlockInfo& blockInfo =
|
||||||
source->texture->GetFormat().GetAspectInfo(source->aspect).block;
|
source->texture->GetFormat().GetAspectInfo(source->aspect).block;
|
||||||
TextureDataLayout dstLayout = FixUpDeprecatedTextureDataLayoutOptions(
|
TextureDataLayout dstLayout = FixUpDeprecatedTextureDataLayoutOptions(
|
||||||
GetDevice(), destination->layout, blockInfo, fixedCopySize);
|
GetDevice(), destination->layout, blockInfo, *copySize);
|
||||||
if (GetDevice()->IsValidationEnabled()) {
|
if (GetDevice()->IsValidationEnabled()) {
|
||||||
DAWN_TRY(ValidateLinearTextureCopyOffset(dstLayout, blockInfo));
|
DAWN_TRY(ValidateLinearTextureCopyOffset(dstLayout, blockInfo));
|
||||||
DAWN_TRY(ValidateLinearTextureData(dstLayout, destination->buffer->GetSize(),
|
DAWN_TRY(ValidateLinearTextureData(dstLayout, destination->buffer->GetSize(),
|
||||||
blockInfo, fixedCopySize));
|
blockInfo, *copySize));
|
||||||
|
|
||||||
mTopLevelTextures.insert(source->texture);
|
mTopLevelTextures.insert(source->texture);
|
||||||
mTopLevelBuffers.insert(destination->buffer);
|
mTopLevelBuffers.insert(destination->buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplyDefaultTextureDataLayoutOptions(&dstLayout, blockInfo, fixedCopySize);
|
ApplyDefaultTextureDataLayoutOptions(&dstLayout, blockInfo, *copySize);
|
||||||
|
|
||||||
// Skip noop copies.
|
// Skip noop copies.
|
||||||
if (fixedCopySize.width != 0 && fixedCopySize.height != 0 &&
|
if (copySize->width != 0 && copySize->height != 0 &&
|
||||||
fixedCopySize.depthOrArrayLayers != 0) {
|
copySize->depthOrArrayLayers != 0) {
|
||||||
// Record the copy command.
|
// Record the copy command.
|
||||||
CopyTextureToBufferCmd* copy =
|
CopyTextureToBufferCmd* copy =
|
||||||
allocator->Allocate<CopyTextureToBufferCmd>(Command::CopyTextureToBuffer);
|
allocator->Allocate<CopyTextureToBufferCmd>(Command::CopyTextureToBuffer);
|
||||||
|
@ -759,7 +753,7 @@ namespace dawn_native {
|
||||||
copy->destination.offset = dstLayout.offset;
|
copy->destination.offset = dstLayout.offset;
|
||||||
copy->destination.bytesPerRow = dstLayout.bytesPerRow;
|
copy->destination.bytesPerRow = dstLayout.bytesPerRow;
|
||||||
copy->destination.rowsPerImage = dstLayout.rowsPerImage;
|
copy->destination.rowsPerImage = dstLayout.rowsPerImage;
|
||||||
copy->copySize = fixedCopySize;
|
copy->copySize = *copySize;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
|
@ -770,20 +764,18 @@ namespace dawn_native {
|
||||||
const ImageCopyTexture* destination,
|
const ImageCopyTexture* destination,
|
||||||
const Extent3D* copySize) {
|
const Extent3D* copySize) {
|
||||||
mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||||
Extent3D fixedCopySize = *copySize;
|
|
||||||
DAWN_TRY(FixUpDeprecatedGPUExtent3DDepth(GetDevice(), &fixedCopySize));
|
|
||||||
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));
|
||||||
|
|
||||||
DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *source, fixedCopySize));
|
DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *source, *copySize));
|
||||||
DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *destination, fixedCopySize));
|
DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *destination, *copySize));
|
||||||
|
|
||||||
DAWN_TRY(
|
DAWN_TRY(
|
||||||
ValidateTextureToTextureCopyRestrictions(*source, *destination, fixedCopySize));
|
ValidateTextureToTextureCopyRestrictions(*source, *destination, *copySize));
|
||||||
|
|
||||||
DAWN_TRY(ValidateTextureCopyRange(GetDevice(), *source, fixedCopySize));
|
DAWN_TRY(ValidateTextureCopyRange(GetDevice(), *source, *copySize));
|
||||||
DAWN_TRY(ValidateTextureCopyRange(GetDevice(), *destination, fixedCopySize));
|
DAWN_TRY(ValidateTextureCopyRange(GetDevice(), *destination, *copySize));
|
||||||
|
|
||||||
DAWN_TRY(ValidateCanUseAs(source->texture, wgpu::TextureUsage::CopySrc));
|
DAWN_TRY(ValidateCanUseAs(source->texture, wgpu::TextureUsage::CopySrc));
|
||||||
DAWN_TRY(ValidateCanUseAs(destination->texture, wgpu::TextureUsage::CopyDst));
|
DAWN_TRY(ValidateCanUseAs(destination->texture, wgpu::TextureUsage::CopyDst));
|
||||||
|
@ -793,8 +785,8 @@ namespace dawn_native {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip noop copies.
|
// Skip noop copies.
|
||||||
if (fixedCopySize.width != 0 && fixedCopySize.height != 0 &&
|
if (copySize->width != 0 && copySize->height != 0 &&
|
||||||
fixedCopySize.depthOrArrayLayers != 0) {
|
copySize->depthOrArrayLayers != 0) {
|
||||||
CopyTextureToTextureCmd* copy =
|
CopyTextureToTextureCmd* copy =
|
||||||
allocator->Allocate<CopyTextureToTextureCmd>(Command::CopyTextureToTexture);
|
allocator->Allocate<CopyTextureToTextureCmd>(Command::CopyTextureToTexture);
|
||||||
copy->source.texture = source->texture;
|
copy->source.texture = source->texture;
|
||||||
|
@ -806,7 +798,7 @@ namespace dawn_native {
|
||||||
copy->destination.mipLevel = destination->mipLevel;
|
copy->destination.mipLevel = destination->mipLevel;
|
||||||
copy->destination.aspect =
|
copy->destination.aspect =
|
||||||
ConvertAspect(destination->texture->GetFormat(), destination->aspect);
|
ConvertAspect(destination->texture->GetFormat(), destination->aspect);
|
||||||
copy->copySize = fixedCopySize;
|
copy->copySize = *copySize;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
|
|
|
@ -455,8 +455,8 @@ namespace dawn_native {
|
||||||
return DAWN_VALIDATION_ERROR("Source texture must have sampled usage");
|
return DAWN_VALIDATION_ERROR("Source texture must have sampled usage");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(dst.texture->GetUsage() & wgpu::TextureUsage::OutputAttachment)) {
|
if (!(dst.texture->GetUsage() & wgpu::TextureUsage::RenderAttachment)) {
|
||||||
return DAWN_VALIDATION_ERROR("Dest texture must have outputAttachment usage");
|
return DAWN_VALIDATION_ERROR("Dest texture must have RenderAttachment usage");
|
||||||
}
|
}
|
||||||
|
|
||||||
return ValidateTextureToTextureCopyCommonRestrictions(src, dst, copySize);
|
return ValidateTextureToTextureCopyCommonRestrictions(src, dst, copySize);
|
||||||
|
|
|
@ -985,12 +985,6 @@ namespace dawn_native {
|
||||||
return mQueue.Get();
|
return mQueue.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
QueueBase* DeviceBase::APIGetDefaultQueue() {
|
|
||||||
EmitDeprecationWarning(
|
|
||||||
"Device::GetDefaultQueue is deprecated, use Device::GetQueue() instead");
|
|
||||||
return APIGetQueue();
|
|
||||||
}
|
|
||||||
|
|
||||||
ExternalTextureBase* DeviceBase::APICreateExternalTexture(
|
ExternalTextureBase* DeviceBase::APICreateExternalTexture(
|
||||||
const ExternalTextureDescriptor* descriptor) {
|
const ExternalTextureDescriptor* descriptor) {
|
||||||
Ref<ExternalTextureBase> result = nullptr;
|
Ref<ExternalTextureBase> result = nullptr;
|
||||||
|
@ -1305,12 +1299,10 @@ namespace dawn_native {
|
||||||
|
|
||||||
ResultOrError<Ref<TextureBase>> DeviceBase::CreateTexture(const TextureDescriptor* descriptor) {
|
ResultOrError<Ref<TextureBase>> DeviceBase::CreateTexture(const TextureDescriptor* descriptor) {
|
||||||
DAWN_TRY(ValidateIsAlive());
|
DAWN_TRY(ValidateIsAlive());
|
||||||
TextureDescriptor fixedDescriptor = *descriptor;
|
|
||||||
DAWN_TRY(FixUpDeprecatedGPUExtent3DDepth(this, &(fixedDescriptor.size)));
|
|
||||||
if (IsValidationEnabled()) {
|
if (IsValidationEnabled()) {
|
||||||
DAWN_TRY(ValidateTextureDescriptor(this, &fixedDescriptor));
|
DAWN_TRY(ValidateTextureDescriptor(this, descriptor));
|
||||||
}
|
}
|
||||||
return CreateTextureImpl(&fixedDescriptor);
|
return CreateTextureImpl(descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultOrError<Ref<TextureViewBase>> DeviceBase::CreateTextureView(
|
ResultOrError<Ref<TextureViewBase>> DeviceBase::CreateTextureView(
|
||||||
|
|
|
@ -200,8 +200,6 @@ namespace dawn_native {
|
||||||
// For Dawn Wire
|
// For Dawn Wire
|
||||||
BufferBase* APICreateErrorBuffer();
|
BufferBase* APICreateErrorBuffer();
|
||||||
|
|
||||||
// TODO(dawn:22): Remove once the deprecation period is finished.
|
|
||||||
QueueBase* APIGetDefaultQueue();
|
|
||||||
QueueBase* APIGetQueue();
|
QueueBase* APIGetQueue();
|
||||||
|
|
||||||
void APIInjectError(wgpu::ErrorType type, const char* message);
|
void APIInjectError(wgpu::ErrorType type, const char* message);
|
||||||
|
|
|
@ -315,21 +315,17 @@ namespace dawn_native {
|
||||||
size_t dataSize,
|
size_t dataSize,
|
||||||
const TextureDataLayout* dataLayout,
|
const TextureDataLayout* dataLayout,
|
||||||
const Extent3D* writeSize) {
|
const Extent3D* writeSize) {
|
||||||
Extent3D fixedWriteSize = *writeSize;
|
DAWN_TRY(ValidateWriteTexture(destination, dataSize, dataLayout, writeSize));
|
||||||
DAWN_TRY(FixUpDeprecatedGPUExtent3DDepth(GetDevice(), &fixedWriteSize));
|
|
||||||
|
|
||||||
DAWN_TRY(ValidateWriteTexture(destination, dataSize, dataLayout, &fixedWriteSize));
|
if (writeSize->width == 0 || writeSize->height == 0 || writeSize->depthOrArrayLayers == 0) {
|
||||||
|
|
||||||
if (fixedWriteSize.width == 0 || fixedWriteSize.height == 0 ||
|
|
||||||
fixedWriteSize.depthOrArrayLayers == 0) {
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
const TexelBlockInfo& blockInfo =
|
const TexelBlockInfo& blockInfo =
|
||||||
destination->texture->GetFormat().GetAspectInfo(destination->aspect).block;
|
destination->texture->GetFormat().GetAspectInfo(destination->aspect).block;
|
||||||
TextureDataLayout layout = *dataLayout;
|
TextureDataLayout layout = *dataLayout;
|
||||||
ApplyDefaultTextureDataLayoutOptions(&layout, blockInfo, fixedWriteSize);
|
ApplyDefaultTextureDataLayoutOptions(&layout, blockInfo, *writeSize);
|
||||||
return WriteTextureImpl(*destination, data, layout, fixedWriteSize);
|
return WriteTextureImpl(*destination, data, layout, *writeSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
MaybeError QueueBase::WriteTextureImpl(const ImageCopyTexture& destination,
|
MaybeError QueueBase::WriteTextureImpl(const ImageCopyTexture& destination,
|
||||||
|
@ -389,14 +385,12 @@ namespace dawn_native {
|
||||||
const ImageCopyTexture* destination,
|
const ImageCopyTexture* destination,
|
||||||
const Extent3D* copySize,
|
const Extent3D* copySize,
|
||||||
const CopyTextureForBrowserOptions* options) {
|
const CopyTextureForBrowserOptions* options) {
|
||||||
Extent3D fixedCopySize = *copySize;
|
|
||||||
DAWN_TRY(FixUpDeprecatedGPUExtent3DDepth(GetDevice(), &fixedCopySize));
|
|
||||||
if (GetDevice()->IsValidationEnabled()) {
|
if (GetDevice()->IsValidationEnabled()) {
|
||||||
DAWN_TRY(ValidateCopyTextureForBrowser(GetDevice(), source, destination, &fixedCopySize,
|
DAWN_TRY(
|
||||||
options));
|
ValidateCopyTextureForBrowser(GetDevice(), source, destination, copySize, options));
|
||||||
}
|
}
|
||||||
|
|
||||||
return DoCopyTextureForBrowser(GetDevice(), source, destination, &fixedCopySize, options);
|
return DoCopyTextureForBrowser(GetDevice(), source, destination, copySize, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
MaybeError QueueBase::ValidateSubmit(uint32_t commandCount,
|
MaybeError QueueBase::ValidateSubmit(uint32_t commandCount,
|
||||||
|
|
|
@ -203,16 +203,6 @@ namespace dawn_native {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderEncoderBase::APISetIndexBufferWithFormat(BufferBase* buffer,
|
|
||||||
wgpu::IndexFormat format,
|
|
||||||
uint64_t offset,
|
|
||||||
uint64_t size) {
|
|
||||||
GetDevice()->EmitDeprecationWarning(
|
|
||||||
"RenderEncoderBase::SetIndexBufferWithFormat is deprecated. Use "
|
|
||||||
"RenderEncoderBase::SetIndexBuffer instead.");
|
|
||||||
APISetIndexBuffer(buffer, format, offset, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RenderEncoderBase::APISetIndexBuffer(BufferBase* buffer,
|
void RenderEncoderBase::APISetIndexBuffer(BufferBase* buffer,
|
||||||
wgpu::IndexFormat format,
|
wgpu::IndexFormat format,
|
||||||
uint64_t offset,
|
uint64_t offset,
|
||||||
|
|
|
@ -49,10 +49,6 @@ namespace dawn_native {
|
||||||
wgpu::IndexFormat format,
|
wgpu::IndexFormat format,
|
||||||
uint64_t offset,
|
uint64_t offset,
|
||||||
uint64_t size);
|
uint64_t size);
|
||||||
void APISetIndexBufferWithFormat(BufferBase* buffer,
|
|
||||||
wgpu::IndexFormat format,
|
|
||||||
uint64_t offset,
|
|
||||||
uint64_t size);
|
|
||||||
|
|
||||||
void APISetBindGroup(uint32_t groupIndex,
|
void APISetBindGroup(uint32_t groupIndex,
|
||||||
BindGroupBase* group,
|
BindGroupBase* group,
|
||||||
|
|
|
@ -248,26 +248,6 @@ namespace dawn_native {
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
MaybeError FixUpDeprecatedGPUExtent3DDepth(DeviceBase* device, Extent3D* extent) {
|
|
||||||
if (extent->depth != 1) {
|
|
||||||
// deprecated depth is assigned
|
|
||||||
if (extent->depthOrArrayLayers != 1) {
|
|
||||||
// both deprecated and updated API is used
|
|
||||||
return DAWN_VALIDATION_ERROR(
|
|
||||||
"Deprecated GPUExtent3D.depth and updated GPUExtent3D.depthOrArrayLengths are "
|
|
||||||
"both assigned.");
|
|
||||||
}
|
|
||||||
|
|
||||||
extent->depthOrArrayLayers = extent->depth;
|
|
||||||
|
|
||||||
device->EmitDeprecationWarning(
|
|
||||||
"GPUExtent3D.depth is deprecated. Please use GPUExtent3D.depthOrArrayLayers "
|
|
||||||
"instead.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
MaybeError ValidateTextureDescriptor(const DeviceBase* device,
|
MaybeError ValidateTextureDescriptor(const DeviceBase* device,
|
||||||
const TextureDescriptor* descriptor) {
|
const TextureDescriptor* descriptor) {
|
||||||
if (descriptor->nextInChain != nullptr) {
|
if (descriptor->nextInChain != nullptr) {
|
||||||
|
|
|
@ -39,8 +39,6 @@ namespace dawn_native {
|
||||||
|
|
||||||
bool IsValidSampleCount(uint32_t sampleCount);
|
bool IsValidSampleCount(uint32_t sampleCount);
|
||||||
|
|
||||||
MaybeError FixUpDeprecatedGPUExtent3DDepth(DeviceBase* device, Extent3D* extent);
|
|
||||||
|
|
||||||
static constexpr wgpu::TextureUsage kReadOnlyTextureUsages =
|
static constexpr wgpu::TextureUsage kReadOnlyTextureUsages =
|
||||||
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::Sampled | kReadOnlyStorageTexture;
|
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::Sampled | kReadOnlyStorageTexture;
|
||||||
|
|
||||||
|
|
|
@ -1699,7 +1699,7 @@ TEST_P(CopyTests_T2B, CopyOneRowWithDepth32Float) {
|
||||||
wgpu::TextureDescriptor textureDescriptor;
|
wgpu::TextureDescriptor textureDescriptor;
|
||||||
textureDescriptor.format = kFormat;
|
textureDescriptor.format = kFormat;
|
||||||
textureDescriptor.size = {kPixelsPerRow, 1, 1};
|
textureDescriptor.size = {kPixelsPerRow, 1, 1};
|
||||||
textureDescriptor.usage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::OutputAttachment;
|
textureDescriptor.usage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment;
|
||||||
wgpu::Texture texture = device.CreateTexture(&textureDescriptor);
|
wgpu::Texture texture = device.CreateTexture(&textureDescriptor);
|
||||||
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
|
|
|
@ -287,7 +287,7 @@ class CopyTextureForBrowserTests : public DawnTest {
|
||||||
dstDescriptor.format = dstSpec.format;
|
dstDescriptor.format = dstSpec.format;
|
||||||
dstDescriptor.mipLevelCount = dstSpec.level + 1;
|
dstDescriptor.mipLevelCount = dstSpec.level + 1;
|
||||||
dstDescriptor.usage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled |
|
dstDescriptor.usage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled |
|
||||||
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
|
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
|
||||||
dstTexture = device.CreateTexture(&dstDescriptor);
|
dstTexture = device.CreateTexture(&dstDescriptor);
|
||||||
|
|
||||||
if (testSubRectCopy) {
|
if (testSubRectCopy) {
|
||||||
|
|
|
@ -35,22 +35,6 @@ class DeprecationTests : public DawnTest {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Test that SetIndexBufferWithFormat is deprecated.
|
|
||||||
TEST_P(DeprecationTests, SetIndexBufferWithFormat) {
|
|
||||||
wgpu::BufferDescriptor bufferDesc;
|
|
||||||
bufferDesc.size = 4;
|
|
||||||
bufferDesc.usage = wgpu::BufferUsage::Index;
|
|
||||||
wgpu::Buffer indexBuffer = device.CreateBuffer(&bufferDesc);
|
|
||||||
|
|
||||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 1, 1);
|
|
||||||
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
|
||||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
|
||||||
EXPECT_DEPRECATION_WARNING(
|
|
||||||
pass.SetIndexBufferWithFormat(indexBuffer, wgpu::IndexFormat::Uint32));
|
|
||||||
pass.EndPass();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Test that SetBlendColor is deprecated.
|
// Test that SetBlendColor is deprecated.
|
||||||
TEST_P(DeprecationTests, SetSetBlendColor) {
|
TEST_P(DeprecationTests, SetSetBlendColor) {
|
||||||
wgpu::Color blendColor{1.0, 0.0, 0.0, 1.0};
|
wgpu::Color blendColor{1.0, 0.0, 0.0, 1.0};
|
||||||
|
@ -204,309 +188,11 @@ TEST_P(DeprecationTests, BindGroupLayoutEntryViewDimensionDefaulting) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test Device::GetDefaultQueue deprecation.
|
|
||||||
TEST_P(DeprecationTests, GetDefaultQueueDeprecation) {
|
|
||||||
// Using GetDefaultQueue emits a warning.
|
|
||||||
wgpu::Queue deprecatedQueue;
|
|
||||||
EXPECT_DEPRECATION_WARNING(deprecatedQueue = device.GetDefaultQueue());
|
|
||||||
|
|
||||||
// Using GetQueue doesn't emit a warning.
|
|
||||||
wgpu::Queue queue = device.GetQueue();
|
|
||||||
|
|
||||||
// Both objects are the same, even with dawn_wire.
|
|
||||||
EXPECT_EQ(deprecatedQueue.Get(), queue.Get());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Test that fences are deprecated.
|
// Test that fences are deprecated.
|
||||||
TEST_P(DeprecationTests, CreateFence) {
|
TEST_P(DeprecationTests, CreateFence) {
|
||||||
EXPECT_DEPRECATION_WARNING(queue.CreateFence());
|
EXPECT_DEPRECATION_WARNING(queue.CreateFence());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test GPUExtent3D.depth deprecation in TextureDescriptor.size
|
|
||||||
TEST_P(DeprecationTests, GPUExtent3DDepthDeprecationTextureDescriptor) {
|
|
||||||
wgpu::TextureDescriptor kBaseDesc;
|
|
||||||
kBaseDesc.usage = wgpu::TextureUsage::Sampled;
|
|
||||||
kBaseDesc.size.width = 1;
|
|
||||||
kBaseDesc.size.height = 1;
|
|
||||||
kBaseDesc.format = wgpu::TextureFormat::RGBA8Unorm;
|
|
||||||
kBaseDesc.dimension = wgpu::TextureDimension::e2D;
|
|
||||||
|
|
||||||
{
|
|
||||||
// Valid: default
|
|
||||||
wgpu::TextureDescriptor desc = kBaseDesc;
|
|
||||||
wgpu::Texture texture;
|
|
||||||
texture = device.CreateTexture(&desc);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
// Warning: use deprecated depth but still valid
|
|
||||||
wgpu::TextureDescriptor desc = kBaseDesc;
|
|
||||||
desc.mipLevelCount = 2;
|
|
||||||
desc.size.width = 2;
|
|
||||||
desc.size.height = 2;
|
|
||||||
desc.size.depth = 2;
|
|
||||||
wgpu::Texture texture;
|
|
||||||
EXPECT_DEPRECATION_WARNING(texture = device.CreateTexture(&desc));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
// Warning: use deprecated depth
|
|
||||||
// Error: use deprecated depth and the descriptor is invalid
|
|
||||||
// because 2D texture with depth == 0 is not allowed
|
|
||||||
// This is to verify the deprecated depth is picked up by the implementation.
|
|
||||||
wgpu::TextureDescriptor desc = kBaseDesc;
|
|
||||||
desc.size.depth = 0;
|
|
||||||
wgpu::Texture texture;
|
|
||||||
ASSERT_DEVICE_ERROR(EXPECT_DEPRECATION_WARNING(texture = device.CreateTexture(&desc)));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
// Error: use both deprecated depth and depthOrArrayLayers
|
|
||||||
wgpu::TextureDescriptor desc = kBaseDesc;
|
|
||||||
desc.size.depth = 2;
|
|
||||||
desc.size.depthOrArrayLayers = 2;
|
|
||||||
wgpu::Texture texture;
|
|
||||||
ASSERT_DEVICE_ERROR(texture = device.CreateTexture(&desc));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
// Valid: use updated depthOrArrayLayers
|
|
||||||
wgpu::TextureDescriptor desc = kBaseDesc;
|
|
||||||
desc.mipLevelCount = 2;
|
|
||||||
desc.size.width = 2;
|
|
||||||
desc.size.height = 2;
|
|
||||||
desc.size.depthOrArrayLayers = 2;
|
|
||||||
wgpu::Texture texture;
|
|
||||||
texture = device.CreateTexture(&desc);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
// Error: use updated depthOrArrayLayers and the descriptor is invalid
|
|
||||||
// because 2D texture with depthOrArrayLayers == 0 is not allowed
|
|
||||||
wgpu::TextureDescriptor desc = kBaseDesc;
|
|
||||||
desc.size.depthOrArrayLayers = 0;
|
|
||||||
wgpu::Texture texture;
|
|
||||||
ASSERT_DEVICE_ERROR(texture = device.CreateTexture(&desc));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Test GPUExtent3D.depth deprecation in CopyBufferToTexture, CopyTextureToBuffer, and
|
|
||||||
// CopyTextureToTexture
|
|
||||||
TEST_P(DeprecationTests, GPUExtent3DDepthDeprecationCopy) {
|
|
||||||
wgpu::BufferDescriptor bufferDesc;
|
|
||||||
bufferDesc.size = 4 * 256;
|
|
||||||
bufferDesc.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst;
|
|
||||||
wgpu::Buffer srcBuffer = device.CreateBuffer(&bufferDesc);
|
|
||||||
|
|
||||||
wgpu::TextureDescriptor dstTextureDesc;
|
|
||||||
dstTextureDesc.usage = wgpu::TextureUsage::CopyDst;
|
|
||||||
dstTextureDesc.size.width = 4;
|
|
||||||
dstTextureDesc.size.height = 4;
|
|
||||||
dstTextureDesc.size.depthOrArrayLayers = 1;
|
|
||||||
dstTextureDesc.format = wgpu::TextureFormat::RGBA8Unorm;
|
|
||||||
dstTextureDesc.dimension = wgpu::TextureDimension::e2D;
|
|
||||||
wgpu::Texture dstTexture = device.CreateTexture(&dstTextureDesc);
|
|
||||||
|
|
||||||
wgpu::TextureDescriptor srcTextureDesc = dstTextureDesc;
|
|
||||||
srcTextureDesc.usage = wgpu::TextureUsage::CopySrc;
|
|
||||||
wgpu::Texture srcTexture = device.CreateTexture(&srcTextureDesc);
|
|
||||||
|
|
||||||
wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(srcBuffer, 0, 256, 4);
|
|
||||||
wgpu::ImageCopyTexture imageCopyDstTexture =
|
|
||||||
utils::CreateImageCopyTexture(dstTexture, 0, {0, 0, 0}, wgpu::TextureAspect::All);
|
|
||||||
wgpu::ImageCopyTexture imageCopySrcTexture =
|
|
||||||
utils::CreateImageCopyTexture(srcTexture, 0, {0, 0, 0}, wgpu::TextureAspect::All);
|
|
||||||
|
|
||||||
wgpu::Extent3D kBaseExtent3D;
|
|
||||||
kBaseExtent3D.width = 4;
|
|
||||||
kBaseExtent3D.height = 4;
|
|
||||||
|
|
||||||
{
|
|
||||||
// Valid: default
|
|
||||||
wgpu::Extent3D extent3D = kBaseExtent3D;
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
|
||||||
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyDstTexture, &extent3D);
|
|
||||||
encoder.CopyTextureToBuffer(&imageCopySrcTexture, &imageCopyBuffer, &extent3D);
|
|
||||||
encoder.CopyTextureToTexture(&imageCopySrcTexture, &imageCopyDstTexture, &extent3D);
|
|
||||||
encoder.Finish();
|
|
||||||
}
|
|
||||||
{
|
|
||||||
// Warning: empty copy use deprecated depth == 0 but still valid
|
|
||||||
wgpu::Extent3D extent3D = kBaseExtent3D;
|
|
||||||
extent3D.width = 0;
|
|
||||||
extent3D.height = 0;
|
|
||||||
extent3D.depth = 0;
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
|
||||||
EXPECT_DEPRECATION_WARNING(
|
|
||||||
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyDstTexture, &extent3D));
|
|
||||||
EXPECT_DEPRECATION_WARNING(
|
|
||||||
encoder.CopyTextureToBuffer(&imageCopySrcTexture, &imageCopyBuffer, &extent3D));
|
|
||||||
EXPECT_DEPRECATION_WARNING(
|
|
||||||
encoder.CopyTextureToTexture(&imageCopySrcTexture, &imageCopyDstTexture, &extent3D));
|
|
||||||
encoder.Finish();
|
|
||||||
}
|
|
||||||
{
|
|
||||||
// Warning: use deprecated depth
|
|
||||||
// Error: depth > 1
|
|
||||||
// This is to verify the deprecated depth is picked up by the implementation.
|
|
||||||
wgpu::Extent3D extent3D = kBaseExtent3D;
|
|
||||||
extent3D.depth = 2;
|
|
||||||
{
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
|
||||||
EXPECT_DEPRECATION_WARNING(
|
|
||||||
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyDstTexture, &extent3D));
|
|
||||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
|
||||||
}
|
|
||||||
{
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
|
||||||
EXPECT_DEPRECATION_WARNING(
|
|
||||||
encoder.CopyTextureToBuffer(&imageCopySrcTexture, &imageCopyBuffer, &extent3D));
|
|
||||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
|
||||||
}
|
|
||||||
{
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
|
||||||
EXPECT_DEPRECATION_WARNING(encoder.CopyTextureToTexture(
|
|
||||||
&imageCopySrcTexture, &imageCopyDstTexture, &extent3D));
|
|
||||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
// Error: use both deprecated depth and depthOrArrayLayers
|
|
||||||
wgpu::Extent3D extent3D = kBaseExtent3D;
|
|
||||||
extent3D.width = 0;
|
|
||||||
extent3D.height = 0;
|
|
||||||
extent3D.depth = 0;
|
|
||||||
extent3D.depthOrArrayLayers = 0;
|
|
||||||
{
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
|
||||||
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyDstTexture, &extent3D);
|
|
||||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
|
||||||
}
|
|
||||||
{
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
|
||||||
encoder.CopyTextureToBuffer(&imageCopySrcTexture, &imageCopyBuffer, &extent3D);
|
|
||||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
|
||||||
}
|
|
||||||
{
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
|
||||||
encoder.CopyTextureToTexture(&imageCopySrcTexture, &imageCopyDstTexture, &extent3D);
|
|
||||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
// Valid: use updated depthOrArrayLayers
|
|
||||||
wgpu::Extent3D extent3D = kBaseExtent3D;
|
|
||||||
extent3D.width = 0;
|
|
||||||
extent3D.height = 0;
|
|
||||||
extent3D.depthOrArrayLayers = 0;
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
|
||||||
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyDstTexture, &extent3D);
|
|
||||||
encoder.CopyTextureToBuffer(&imageCopySrcTexture, &imageCopyBuffer, &extent3D);
|
|
||||||
encoder.CopyTextureToTexture(&imageCopySrcTexture, &imageCopyDstTexture, &extent3D);
|
|
||||||
encoder.Finish();
|
|
||||||
}
|
|
||||||
{
|
|
||||||
// Error: use updated depthOrArrayLayers and is invalid
|
|
||||||
wgpu::Extent3D extent3D = kBaseExtent3D;
|
|
||||||
extent3D.depthOrArrayLayers = 2;
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
|
||||||
{
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
|
||||||
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyDstTexture, &extent3D);
|
|
||||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
|
||||||
}
|
|
||||||
{
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
|
||||||
encoder.CopyTextureToBuffer(&imageCopySrcTexture, &imageCopyBuffer, &extent3D);
|
|
||||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
|
||||||
}
|
|
||||||
{
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
|
||||||
encoder.CopyTextureToTexture(&imageCopySrcTexture, &imageCopyDstTexture, &extent3D);
|
|
||||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Test GPUExtent3D.depth deprecation in WriteTexture
|
|
||||||
TEST_P(DeprecationTests, GPUExtent3DDepthDeprecationWriteTexture) {
|
|
||||||
wgpu::TextureDescriptor dstTextureDesc;
|
|
||||||
dstTextureDesc.usage = wgpu::TextureUsage::CopyDst;
|
|
||||||
dstTextureDesc.size.width = 4;
|
|
||||||
dstTextureDesc.size.height = 4;
|
|
||||||
dstTextureDesc.size.depthOrArrayLayers = 1;
|
|
||||||
dstTextureDesc.format = wgpu::TextureFormat::RGBA8Unorm;
|
|
||||||
dstTextureDesc.dimension = wgpu::TextureDimension::e2D;
|
|
||||||
wgpu::Texture dstTexture = device.CreateTexture(&dstTextureDesc);
|
|
||||||
|
|
||||||
size_t dataSize = 4 * 256;
|
|
||||||
std::vector<uint8_t> data(dataSize);
|
|
||||||
|
|
||||||
wgpu::TextureDataLayout textureDataLayout;
|
|
||||||
textureDataLayout.offset = 0;
|
|
||||||
textureDataLayout.bytesPerRow = 256;
|
|
||||||
textureDataLayout.rowsPerImage = 4;
|
|
||||||
|
|
||||||
wgpu::ImageCopyTexture imageCopyDstTexture =
|
|
||||||
utils::CreateImageCopyTexture(dstTexture, 0, {0, 0, 0}, wgpu::TextureAspect::All);
|
|
||||||
|
|
||||||
wgpu::Extent3D kBaseExtent3D;
|
|
||||||
kBaseExtent3D.width = 4;
|
|
||||||
kBaseExtent3D.height = 4;
|
|
||||||
|
|
||||||
{
|
|
||||||
// Valid: default
|
|
||||||
wgpu::Extent3D extent3D = kBaseExtent3D;
|
|
||||||
wgpu::Queue queue = device.GetQueue();
|
|
||||||
queue.WriteTexture(&imageCopyDstTexture, data.data(), dataSize, &textureDataLayout,
|
|
||||||
&extent3D);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
// Warning: use deprecated depth == 0 but still valid
|
|
||||||
wgpu::Extent3D extent3D = kBaseExtent3D;
|
|
||||||
extent3D.width = 0;
|
|
||||||
extent3D.height = 0;
|
|
||||||
extent3D.depth = 0;
|
|
||||||
wgpu::Queue queue = device.GetQueue();
|
|
||||||
EXPECT_DEPRECATION_WARNING(queue.WriteTexture(&imageCopyDstTexture, data.data(), dataSize,
|
|
||||||
&textureDataLayout, &extent3D));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
// Warning: use deprecated depth
|
|
||||||
// Error: depth > 1 for 2D textures
|
|
||||||
// This is to verify the deprecated depth is picked up by the implementation.
|
|
||||||
wgpu::Extent3D extent3D = kBaseExtent3D;
|
|
||||||
extent3D.depth = 2;
|
|
||||||
wgpu::Queue queue = device.GetQueue();
|
|
||||||
ASSERT_DEVICE_ERROR(EXPECT_DEPRECATION_WARNING(queue.WriteTexture(
|
|
||||||
&imageCopyDstTexture, data.data(), dataSize, &textureDataLayout, &extent3D)));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
// Error: use both deprecated depth and depthOrArrayLayers
|
|
||||||
wgpu::Extent3D extent3D = kBaseExtent3D;
|
|
||||||
extent3D.width = 0;
|
|
||||||
extent3D.height = 0;
|
|
||||||
extent3D.depth = 0;
|
|
||||||
extent3D.depthOrArrayLayers = 0;
|
|
||||||
wgpu::Queue queue = device.GetQueue();
|
|
||||||
ASSERT_DEVICE_ERROR(queue.WriteTexture(&imageCopyDstTexture, data.data(), dataSize,
|
|
||||||
&textureDataLayout, &extent3D));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
// Valid: use updated depthOrArrayLayers
|
|
||||||
wgpu::Extent3D extent3D = kBaseExtent3D;
|
|
||||||
extent3D.width = 0;
|
|
||||||
extent3D.height = 0;
|
|
||||||
extent3D.depthOrArrayLayers = 0;
|
|
||||||
wgpu::Queue queue = device.GetQueue();
|
|
||||||
queue.WriteTexture(&imageCopyDstTexture, data.data(), dataSize, &textureDataLayout,
|
|
||||||
&extent3D);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
// Error: use updated depthOrArrayLayers and depthOrArrayLayers > 1 for 2D textures
|
|
||||||
wgpu::Extent3D extent3D = kBaseExtent3D;
|
|
||||||
extent3D.depthOrArrayLayers = 2;
|
|
||||||
wgpu::Queue queue = device.GetQueue();
|
|
||||||
ASSERT_DEVICE_ERROR(queue.WriteTexture(&imageCopyDstTexture, data.data(), dataSize,
|
|
||||||
&textureDataLayout, &extent3D));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DAWN_INSTANTIATE_TEST(DeprecationTests,
|
DAWN_INSTANTIATE_TEST(DeprecationTests,
|
||||||
D3D12Backend(),
|
D3D12Backend(),
|
||||||
MetalBackend(),
|
MetalBackend(),
|
||||||
|
|
|
@ -244,7 +244,7 @@ class DepthStencilSamplingTest : public DawnTest {
|
||||||
|
|
||||||
wgpu::Texture CreateInputTexture(wgpu::TextureFormat format) {
|
wgpu::Texture CreateInputTexture(wgpu::TextureFormat format) {
|
||||||
wgpu::TextureDescriptor inputTextureDesc;
|
wgpu::TextureDescriptor inputTextureDesc;
|
||||||
inputTextureDesc.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::OutputAttachment;
|
inputTextureDesc.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment;
|
||||||
inputTextureDesc.size = {1, 1, 1};
|
inputTextureDesc.size = {1, 1, 1};
|
||||||
inputTextureDesc.format = format;
|
inputTextureDesc.format = format;
|
||||||
return device.CreateTexture(&inputTextureDesc);
|
return device.CreateTexture(&inputTextureDesc);
|
||||||
|
@ -253,7 +253,7 @@ class DepthStencilSamplingTest : public DawnTest {
|
||||||
wgpu::Texture CreateOutputTexture(wgpu::TextureFormat format) {
|
wgpu::Texture CreateOutputTexture(wgpu::TextureFormat format) {
|
||||||
wgpu::TextureDescriptor outputTextureDesc;
|
wgpu::TextureDescriptor outputTextureDesc;
|
||||||
outputTextureDesc.usage =
|
outputTextureDesc.usage =
|
||||||
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
|
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
|
||||||
outputTextureDesc.size = {1, 1, 1};
|
outputTextureDesc.size = {1, 1, 1};
|
||||||
outputTextureDesc.format = format;
|
outputTextureDesc.format = format;
|
||||||
return device.CreateTexture(&outputTextureDesc);
|
return device.CreateTexture(&outputTextureDesc);
|
||||||
|
|
|
@ -69,17 +69,17 @@ class SwapChainValidationTests : public DawnTest {
|
||||||
wgpu::SwapChainDescriptor goodDescriptor;
|
wgpu::SwapChainDescriptor goodDescriptor;
|
||||||
wgpu::SwapChainDescriptor badDescriptor;
|
wgpu::SwapChainDescriptor badDescriptor;
|
||||||
|
|
||||||
// Checks that an RenderAttachment view is an error by trying to create a render pass on it.
|
// Checks that a RenderAttachment view is an error by trying to create a render pass on it.
|
||||||
void CheckTextureViewIsError(wgpu::TextureView view) {
|
void CheckTextureViewIsError(wgpu::TextureView view) {
|
||||||
CheckTextureView(view, true, false);
|
CheckTextureView(view, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks that an RenderAttachment view is an error by trying to submit a render pass on it.
|
// Checks that a RenderAttachment view is an error by trying to submit a render pass on it.
|
||||||
void CheckTextureViewIsDestroyed(wgpu::TextureView view) {
|
void CheckTextureViewIsDestroyed(wgpu::TextureView view) {
|
||||||
CheckTextureView(view, false, true);
|
CheckTextureView(view, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks that an OutputAttachment view is valid by submitting a render pass on it.
|
// Checks that a RenderAttachment view is valid by submitting a render pass on it.
|
||||||
void CheckTextureViewIsValid(wgpu::TextureView view) {
|
void CheckTextureViewIsValid(wgpu::TextureView view) {
|
||||||
CheckTextureView(view, false, false);
|
CheckTextureView(view, false, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace {
|
||||||
wgpu::TextureDescriptor descriptor;
|
wgpu::TextureDescriptor descriptor;
|
||||||
descriptor.size.width = kWidth;
|
descriptor.size.width = kWidth;
|
||||||
descriptor.size.height = kHeight;
|
descriptor.size.height = kHeight;
|
||||||
descriptor.size.depth = kDefaultDepth;
|
descriptor.size.depthOrArrayLayers = kDefaultDepth;
|
||||||
descriptor.mipLevelCount = kDefaultMipLevels;
|
descriptor.mipLevelCount = kDefaultMipLevels;
|
||||||
descriptor.sampleCount = kDefaultSampleCount;
|
descriptor.sampleCount = kDefaultSampleCount;
|
||||||
descriptor.dimension = wgpu::TextureDimension::e2D;
|
descriptor.dimension = wgpu::TextureDimension::e2D;
|
||||||
|
|
Loading…
Reference in New Issue