Change texture state validation in CopyTextureForBrowser() to report meaningful errors
CopyTextureForBrowser() will support all uploading paths for WebGPU CopyExternalImageToTexture(). The validation checks for texture states should report accurate errors to meet CopyExternalImageToTexture() validate rules. Bug: dawn:1306 Change-Id: Ie3b25ec82246d53e6c82968b5dc2f8a253c560c1 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/81240 Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
This commit is contained in:
parent
d5d12e3429
commit
6084407b21
|
@ -257,12 +257,6 @@ namespace dawn::native {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
MaybeError ValidateTextureState(const TextureBase* texture) {
|
|
||||||
DAWN_INVALID_IF(texture->GetTextureState() == TextureBase::TextureState::Destroyed,
|
|
||||||
"Destroyed texture %s used in CopyTextureForBrowser().", texture);
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
RenderPipelineBase* GetCachedPipeline(InternalPipelineStore* store,
|
RenderPipelineBase* GetCachedPipeline(InternalPipelineStore* store,
|
||||||
wgpu::TextureFormat dstFormat) {
|
wgpu::TextureFormat dstFormat) {
|
||||||
auto pipeline = store->copyTextureForBrowserPipelines.find(dstFormat);
|
auto pipeline = store->copyTextureForBrowserPipelines.find(dstFormat);
|
||||||
|
@ -332,8 +326,11 @@ namespace dawn::native {
|
||||||
DAWN_TRY(device->ValidateObject(source->texture));
|
DAWN_TRY(device->ValidateObject(source->texture));
|
||||||
DAWN_TRY(device->ValidateObject(destination->texture));
|
DAWN_TRY(device->ValidateObject(destination->texture));
|
||||||
|
|
||||||
DAWN_TRY(ValidateTextureState(source->texture));
|
DAWN_INVALID_IF(source->texture->GetTextureState() == TextureBase::TextureState::Destroyed,
|
||||||
DAWN_TRY(ValidateTextureState(destination->texture));
|
"Source texture %s is destroyed.", source->texture);
|
||||||
|
|
||||||
|
DAWN_INVALID_IF(source->texture->GetTextureState() == TextureBase::TextureState::Destroyed,
|
||||||
|
"Destination texture %s is destroyed.", destination->texture);
|
||||||
|
|
||||||
DAWN_TRY_CONTEXT(ValidateImageCopyTexture(device, *source, *copySize),
|
DAWN_TRY_CONTEXT(ValidateImageCopyTexture(device, *source, *copySize),
|
||||||
"validating the ImageCopyTexture for the source");
|
"validating the ImageCopyTexture for the source");
|
||||||
|
|
Loading…
Reference in New Issue