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 <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Corentin Wallez 2020-12-08 15:56:44 +00:00 committed by Commit Bot service account
parent 0664a30565
commit 2093157afe
4 changed files with 8 additions and 7 deletions

View File

@ -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.");
}

View File

@ -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;

View File

@ -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 <typename T>

View File

@ -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.");
}