Add wgpu::Device::ValidateTextureDescriptor
Bug: chromium:1266549 Change-Id: Iaef63ca6f4e447450953dfb0633b43931d8c2552 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116294 Reviewed-by: Brandon Jones <bajones@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
42fed14a21
commit
0963142273
|
@ -1229,6 +1229,13 @@
|
|||
"args": [
|
||||
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "validate texture descriptor",
|
||||
"tags": ["dawn"],
|
||||
"args": [
|
||||
{"name": "descriptor", "type": "texture descriptor", "annotation": "const*"}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -1386,6 +1386,10 @@ void DeviceBase::APIInjectError(wgpu::ErrorType type, const char* message) {
|
|||
HandleError(FromWGPUErrorType(type), message);
|
||||
}
|
||||
|
||||
void DeviceBase::APIValidateTextureDescriptor(const TextureDescriptor* desc) {
|
||||
ConsumedError(ValidateTextureDescriptor(this, desc));
|
||||
}
|
||||
|
||||
QueueBase* DeviceBase::GetQueue() const {
|
||||
ASSERT(mQueue != nullptr);
|
||||
return mQueue.Get();
|
||||
|
|
|
@ -284,6 +284,7 @@ class DeviceBase : public RefCountedWithExternalCount {
|
|||
size_t APIEnumerateFeatures(wgpu::FeatureName* features) const;
|
||||
void APIInjectError(wgpu::ErrorType type, const char* message);
|
||||
bool APITick();
|
||||
void APIValidateTextureDescriptor(const TextureDescriptor* desc);
|
||||
|
||||
void APISetDeviceLostCallback(wgpu::DeviceLostCallback callback, void* userdata);
|
||||
void APISetUncapturedErrorCallback(wgpu::ErrorCallback callback, void* userdata);
|
||||
|
|
|
@ -997,4 +997,19 @@ TEST_F(TextureValidationTest, CreationParameterReflectionForCreateErrorTexture)
|
|||
CheckTextureMatchesDescriptor(tex, desc);
|
||||
}
|
||||
|
||||
// A tiny test that Device::ValidateTextureDescriptor works, under the assumption that all the
|
||||
// texture validation logic is implemented through it (so there is no need to re-test every possible
|
||||
// failure case).
|
||||
TEST_F(TextureValidationTest, APIValidateTextureDescriptor) {
|
||||
wgpu::TextureDescriptor desc;
|
||||
desc.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
desc.size = {1, 1, 1};
|
||||
desc.usage = wgpu::TextureUsage::RenderAttachment;
|
||||
|
||||
device.ValidateTextureDescriptor(&desc);
|
||||
|
||||
desc.size.width = 0;
|
||||
ASSERT_DEVICE_ERROR(device.ValidateTextureDescriptor(&desc));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
Loading…
Reference in New Issue