Fix use of uninitialized value in ValidateTextureViewDescriptor

ValidateTextureViewDescriptor was running into use of uninitialized
value. Fixing this by moving the texture state check below the texture
object check. This should validate the texture object before trying to
validate it's texture state.

Bug: chromium:947150
Change-Id: I9b41791bfb960fbe4873ba5fcadf046bd32e5853
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/6180
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Natasha Lee <natlee@microsoft.com>
This commit is contained in:
Natasha Lee 2019-03-28 22:49:53 +00:00 committed by Commit Bot service account
parent 19179e180b
commit 10c24684ab
1 changed files with 2 additions and 1 deletions

View File

@ -182,11 +182,12 @@ namespace dawn_native {
if (descriptor->nextInChain != nullptr) { if (descriptor->nextInChain != nullptr) {
return DAWN_VALIDATION_ERROR("nextInChain must be nullptr"); return DAWN_VALIDATION_ERROR("nextInChain must be nullptr");
} }
DAWN_TRY(device->ValidateObject(texture));
if (texture->GetTextureState() == TextureBase::TextureState::Destroyed) { if (texture->GetTextureState() == TextureBase::TextureState::Destroyed) {
return DAWN_VALIDATION_ERROR("Destroyed texture used to create texture view"); return DAWN_VALIDATION_ERROR("Destroyed texture used to create texture view");
} }
DAWN_TRY(device->ValidateObject(texture));
DAWN_TRY(ValidateTextureViewDimension(descriptor->dimension)); DAWN_TRY(ValidateTextureViewDimension(descriptor->dimension));
DAWN_TRY(ValidateTextureFormat(descriptor->format)); DAWN_TRY(ValidateTextureFormat(descriptor->format));