From 2093157afe7644f13ed2166f6e6ad99c3003daba Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Tue, 8 Dec 2020 15:56:44 +0000 Subject: [PATCH] Rename TryConvertAspect to better reflect what it does. Bug: dawn:441 Change-Id: I51d28102926fb00a7c6225bc3b84324fe8f1f6fe Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/34902 Reviewed-by: Austin Eng Reviewed-by: Stephen White Reviewed-by: Corentin Wallez Commit-Queue: Austin Eng --- src/dawn_native/CommandValidation.cpp | 2 +- src/dawn_native/Subresource.cpp | 4 ++-- src/dawn_native/Subresource.h | 7 ++++--- src/dawn_native/Texture.cpp | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/dawn_native/CommandValidation.cpp b/src/dawn_native/CommandValidation.cpp index 1a3a241265..cbf9c75757 100644 --- a/src/dawn_native/CommandValidation.cpp +++ b/src/dawn_native/CommandValidation.cpp @@ -577,7 +577,7 @@ namespace dawn_native { return DAWN_VALIDATION_ERROR("mipLevel out of range"); } - if (TryConvertAspect(texture->GetFormat(), textureCopy.aspect) == Aspect::None) { + if (SelectFormatAspects(texture->GetFormat(), textureCopy.aspect) == Aspect::None) { return DAWN_VALIDATION_ERROR("Texture does not have selected aspect for texture copy."); } diff --git a/src/dawn_native/Subresource.cpp b/src/dawn_native/Subresource.cpp index 766cb1d7ce..4e613a64c7 100644 --- a/src/dawn_native/Subresource.cpp +++ b/src/dawn_native/Subresource.cpp @@ -26,12 +26,12 @@ namespace dawn_native { } Aspect ConvertAspect(const Format& format, wgpu::TextureAspect aspect) { - Aspect aspectMask = TryConvertAspect(format, aspect); + Aspect aspectMask = SelectFormatAspects(format, aspect); ASSERT(aspectMask != Aspect::None); return aspectMask; } - Aspect TryConvertAspect(const Format& format, wgpu::TextureAspect aspect) { + Aspect SelectFormatAspects(const Format& format, wgpu::TextureAspect aspect) { switch (aspect) { case wgpu::TextureAspect::All: return format.aspects; diff --git a/src/dawn_native/Subresource.h b/src/dawn_native/Subresource.h index 927f66569b..3090e7b3c7 100644 --- a/src/dawn_native/Subresource.h +++ b/src/dawn_native/Subresource.h @@ -44,9 +44,10 @@ namespace dawn_native { // does not exist in the format. Aspect ConvertAspect(const Format& format, wgpu::TextureAspect aspect); - // Try to convert the TextureAspect to an Aspect mask for the format. May return - // Aspect::None. - Aspect TryConvertAspect(const Format& format, wgpu::TextureAspect aspect); + // Returns the Aspects of the Format that are selected by the wgpu::TextureAspect. + // Note that this can return Aspect::None if the Format doesn't have any of the + // selected aspects. + Aspect SelectFormatAspects(const Format& format, wgpu::TextureAspect aspect); // Helper struct to make it clear that what the parameters of a range mean. template diff --git a/src/dawn_native/Texture.cpp b/src/dawn_native/Texture.cpp index cc345e3047..171f02b04c 100644 --- a/src/dawn_native/Texture.cpp +++ b/src/dawn_native/Texture.cpp @@ -266,7 +266,7 @@ namespace dawn_native { DAWN_TRY(ValidateTextureFormat(descriptor->format)); DAWN_TRY(ValidateTextureAspect(descriptor->aspect)); - if (TryConvertAspect(texture->GetFormat(), descriptor->aspect) == Aspect::None) { + if (SelectFormatAspects(texture->GetFormat(), descriptor->aspect) == Aspect::None) { return DAWN_VALIDATION_ERROR("Texture does not have selected aspect for texture view."); }