mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-17 17:05:31 +00:00
Validate RenderBundle texture formats
Adds validation and unittests that render bundle color attachments are color renderable texture formats and depth/stencil attachments are depth/stencil texture formats. Bug: dawn:154 Change-Id: I4d062a82b32fb38820fb3ebeb4c265306aa7af24 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10261 Reviewed-by: Kai Ninomiya <kainino@chromium.org> Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
d8cdcea0ee
commit
0beb43809a
@@ -988,3 +988,33 @@ TEST_F(RenderBundleValidationTest, RenderPassSampleCountMismatch) {
|
||||
ASSERT_DEVICE_ERROR(commandEncoder.Finish());
|
||||
}
|
||||
}
|
||||
|
||||
// Test that color attachment texture formats must be color renderable and
|
||||
// depth stencil texture formats must be depth/stencil.
|
||||
TEST_F(RenderBundleValidationTest, TextureFormats) {
|
||||
// Test that color formats are validated as color.
|
||||
{
|
||||
utils::ComboRenderBundleEncoderDescriptor desc = {};
|
||||
desc.colorFormatsCount = 1;
|
||||
desc.cColorFormats[0] = dawn::TextureFormat::Depth24PlusStencil8;
|
||||
ASSERT_DEVICE_ERROR(device.CreateRenderBundleEncoder(&desc));
|
||||
}
|
||||
|
||||
// Test that color formats are validated as renderable.
|
||||
{
|
||||
utils::ComboRenderBundleEncoderDescriptor desc = {};
|
||||
desc.colorFormatsCount = 1;
|
||||
desc.cColorFormats[0] = dawn::TextureFormat::RGBA8Snorm;
|
||||
ASSERT_DEVICE_ERROR(device.CreateRenderBundleEncoder(&desc));
|
||||
}
|
||||
|
||||
// Test that depth/stencil formats are validated as depth/stencil.
|
||||
{
|
||||
utils::ComboRenderBundleEncoderDescriptor desc = {};
|
||||
desc.cDepthStencilFormat = dawn::TextureFormat::RGBA8Unorm;
|
||||
desc.depthStencilFormat = &desc.cDepthStencilFormat;
|
||||
ASSERT_DEVICE_ERROR(device.CreateRenderBundleEncoder(&desc));
|
||||
}
|
||||
|
||||
// Don't test non-renerable depth/stencil formats because we don't have any.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user