Change SubresourceRange to be hierarchical.

Initializing SubresourceRange with {x, y, z} type of constructor
was error prone because it was going from the smallest concept
to the larger one instead of being hierarchical.

This CL changes the order of the structure and more importantly
adds a constructor that's in hierarchical order and groups related
members together. For example:

  SubresourceRange range(Aspect::Color, {layerStart, layerCount}, {0, mipCount});

It also adds a rename of SingleMipAndLayer in hierarchical order as
SubresourceRange::Single and a helper that gives a full range as
SubresourceRange::Full (it will be used in follow-up CLs).

Bug: dawn:441

Change-Id: I8e71bae1129a96222f7779014575b24b31f5ef7a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/35000
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez
2020-12-08 12:39:03 +00:00
committed by Commit Bot service account
parent 8a73e1876d
commit 61355d416d
5 changed files with 63 additions and 17 deletions

View File

@@ -180,18 +180,18 @@ namespace dawn_native {
return deviceBase->GetDeprecationWarningCountForTesting();
}
bool IsTextureSubresourceInitialized(WGPUTexture texture,
bool IsTextureSubresourceInitialized(WGPUTexture cTexture,
uint32_t baseMipLevel,
uint32_t levelCount,
uint32_t baseArrayLayer,
uint32_t layerCount,
WGPUTextureAspect aspect) {
dawn_native::TextureBase* textureBase =
reinterpret_cast<dawn_native::TextureBase*>(texture);
SubresourceRange range = {
baseMipLevel, levelCount, baseArrayLayer, layerCount,
ConvertAspect(textureBase->GetFormat(), static_cast<wgpu::TextureAspect>(aspect))};
return textureBase->IsSubresourceContentInitialized(range);
WGPUTextureAspect cAspect) {
dawn_native::TextureBase* texture = reinterpret_cast<dawn_native::TextureBase*>(cTexture);
Aspect aspect =
ConvertAspect(texture->GetFormat(), static_cast<wgpu::TextureAspect>(cAspect));
SubresourceRange range(aspect, {baseArrayLayer, layerCount}, {baseMipLevel, levelCount});
return texture->IsSubresourceContentInitialized(range);
}
std::vector<const char*> GetProcMapNamesForTestingInternal();