mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-19 01:46:35 +00:00
Support BC formats as the first extension in Dawn
This patch refactors the current implementation of BC formats to treat it as the first extension in Dawn and adds all the related tests. Note that in Dawn all the extensions are disabled unless we enable them when we create the device, which means the BC formats can only be used when we enable the related extension on the creation of the device, and the creation of the device will fail if the adapter does not support the extension BUG=dawn:42 TEST=dawn_end2end_tests TEST=dawn_unittests Change-Id: I04d818b0218ebb3b1b7a70a4fea71779f308f85f Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9520 Commit-Queue: Jiawei Shao <jiawei.shao@intel.com> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
56f3a7b90d
commit
574b951188
@@ -250,10 +250,14 @@ TEST_F(TextureValidationTest, NonRenderableAndOutputAttachment) {
|
||||
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
|
||||
}
|
||||
|
||||
// TODO(jiawei.shao@intel.com): use compressed texture formats as extensions.
|
||||
// TODO(jiawei.shao@intel.com): add tests to verify we cannot create 1D or 3D textures with
|
||||
// compressed texture formats.
|
||||
class CompressedTextureFormatsValidationTests : public TextureValidationTest {
|
||||
public:
|
||||
CompressedTextureFormatsValidationTests() : TextureValidationTest() {
|
||||
device = CreateDeviceFromAdapter(adapter, {"texture_compression_bc"});
|
||||
}
|
||||
|
||||
protected:
|
||||
dawn::TextureDescriptor CreateDefaultTextureDescriptor() {
|
||||
dawn::TextureDescriptor descriptor =
|
||||
@@ -309,6 +313,18 @@ TEST_F(CompressedTextureFormatsValidationTests, TextureSize) {
|
||||
}
|
||||
}
|
||||
|
||||
// Test the creation of a texture with BC format will fail when the extension textureCompressionBC
|
||||
// is not enabled.
|
||||
TEST_F(CompressedTextureFormatsValidationTests, UseBCFormatWithoutEnablingExtension) {
|
||||
const std::vector<const char*> kEmptyVector;
|
||||
dawn::Device deviceWithoutExtension = CreateDeviceFromAdapter(adapter, kEmptyVector);
|
||||
for (dawn::TextureFormat format : kBCFormats) {
|
||||
dawn::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
descriptor.format = format;
|
||||
ASSERT_DEVICE_ERROR(deviceWithoutExtension.CreateTexture(&descriptor));
|
||||
}
|
||||
}
|
||||
|
||||
// Test the validation of texture usages when creating textures in compressed texture formats.
|
||||
TEST_F(CompressedTextureFormatsValidationTests, TextureUsage) {
|
||||
// Test that only CopySrc, CopyDst and Sampled are accepted as the texture usage of the
|
||||
|
||||
Reference in New Issue
Block a user