Make Dawn's feature name casing match WebGPU (- instead of _)
Bug: dawn:550 Change-Id: I1017b4a2e93a75925e8762f2d09ace9a8d5d7b49 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65802 Reviewed-by: François Beaufort <beaufort.francois@gmail.com> Reviewed-by: François Beaufort <fbeaufort@google.com> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
daf1cdbb28
commit
2d1762049b
|
@ -32,7 +32,7 @@ namespace dawn_native {
|
|||
|
||||
static constexpr FeatureEnumAndInfoList kFeatureNameAndInfoList = {
|
||||
{{Feature::TextureCompressionBC,
|
||||
{"texture_compression_bc", "Support Block Compressed (BC) texture formats",
|
||||
{"texture-compression-bc", "Support Block Compressed (BC) texture formats",
|
||||
"https://bugs.chromium.org/p/dawn/issues/detail?id=42"},
|
||||
&WGPUDeviceProperties::textureCompressionBC},
|
||||
{Feature::TextureCompressionETC2,
|
||||
|
@ -48,20 +48,20 @@ namespace dawn_native {
|
|||
"https://bugs.chromium.org/p/dawn/issues/detail?id=955"},
|
||||
&WGPUDeviceProperties::textureCompressionASTC},
|
||||
{Feature::ShaderFloat16,
|
||||
{"shader_float16",
|
||||
{"shader-float16",
|
||||
"Support 16bit float arithmetic and declarations in uniform and storage buffers",
|
||||
"https://bugs.chromium.org/p/dawn/issues/detail?id=426"},
|
||||
&WGPUDeviceProperties::shaderFloat16},
|
||||
{Feature::PipelineStatisticsQuery,
|
||||
{"pipeline_statistics_query", "Support Pipeline Statistics Query",
|
||||
{"pipeline-statistics-query", "Support Pipeline Statistics Query",
|
||||
"https://bugs.chromium.org/p/dawn/issues/detail?id=434"},
|
||||
&WGPUDeviceProperties::pipelineStatisticsQuery},
|
||||
{Feature::TimestampQuery,
|
||||
{"timestamp_query", "Support Timestamp Query",
|
||||
{"timestamp-query", "Support Timestamp Query",
|
||||
"https://bugs.chromium.org/p/dawn/issues/detail?id=434"},
|
||||
&WGPUDeviceProperties::timestampQuery},
|
||||
{Feature::DepthClamping,
|
||||
{"depth_clamping", "Clamp depth to [0, 1] in NDC space instead of clipping",
|
||||
{"depth-clamping", "Clamp depth to [0, 1] in NDC space instead of clipping",
|
||||
"https://bugs.chromium.org/p/dawn/issues/detail?id=716"},
|
||||
&WGPUDeviceProperties::depthClamping},
|
||||
{Feature::DawnInternalUsages,
|
||||
|
@ -72,7 +72,7 @@ namespace dawn_native {
|
|||
"dawn_internal_usages.md"},
|
||||
&WGPUDeviceProperties::dawnInternalUsages},
|
||||
{Feature::MultiPlanarFormats,
|
||||
{"multiplanar_formats",
|
||||
{"multiplanar-formats",
|
||||
"Import and use multi-planar texture formats with per plane views",
|
||||
"https://bugs.chromium.org/p/dawn/issues/detail?id=551"},
|
||||
&WGPUDeviceProperties::multiPlanarFormats}}};
|
||||
|
@ -145,6 +145,23 @@ namespace dawn_native {
|
|||
if (iter != mFeatureNameToEnumMap.cend()) {
|
||||
return kFeatureNameAndInfoList[static_cast<size_t>(iter->second)].feature;
|
||||
}
|
||||
|
||||
// TODO(dawn:550): Remove this fallback logic when Chromium is updated.
|
||||
constexpr std::array<std::pair<const char*, const char*>, 6>
|
||||
kReplacementsForDeprecatedNames = {{
|
||||
{"texture_compression_bc", "texture-compression-bc"},
|
||||
{"depth_clamping", "depth-clamping"},
|
||||
{"pipeline_statistics_query", "pipeline-statistics-query"},
|
||||
{"shader_float16", "shader-float16"},
|
||||
{"timestamp_query", "timestamp-query"},
|
||||
{"multiplanar_formats", "multiplanar-formats"},
|
||||
}};
|
||||
for (const auto& replacement : kReplacementsForDeprecatedNames) {
|
||||
if (strcmp(featureName, replacement.first) == 0) {
|
||||
return FeatureNameToEnum(replacement.second);
|
||||
}
|
||||
}
|
||||
|
||||
return Feature::InvalidEnum;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
// About multi-planar formats.
|
||||
//
|
||||
// Dawn supports additional multi-planar formats when the multiplanar_formats extension is enabled.
|
||||
// Dawn supports additional multi-planar formats when the multiplanar-formats extension is enabled.
|
||||
// When enabled, Dawn treats planar data as sub-resources (ie. 1 sub-resource == 1 view == 1 plane).
|
||||
// A multi-planar format name encodes the channel mapping and order of planes. For example,
|
||||
// R8BG8Biplanar420Unorm is YUV 4:2:0 where Plane 0 = R8, and Plane 1 = BG8.
|
||||
|
|
|
@ -109,16 +109,16 @@ namespace wgpu { namespace binding {
|
|||
for (auto required : descriptor.requiredFeatures) {
|
||||
switch (required) {
|
||||
case interop::GPUFeatureName::kDepthClamping:
|
||||
desc.requiredFeatures.emplace_back("depth_clamping");
|
||||
desc.requiredFeatures.emplace_back("depth-clamping");
|
||||
continue;
|
||||
case interop::GPUFeatureName::kPipelineStatisticsQuery:
|
||||
desc.requiredFeatures.emplace_back("pipeline_statistics_query");
|
||||
desc.requiredFeatures.emplace_back("pipeline-statistics-query");
|
||||
continue;
|
||||
case interop::GPUFeatureName::kTextureCompressionBc:
|
||||
desc.requiredFeatures.emplace_back("texture_compression_bc");
|
||||
desc.requiredFeatures.emplace_back("texture-compression-bc");
|
||||
continue;
|
||||
case interop::GPUFeatureName::kTimestampQuery:
|
||||
desc.requiredFeatures.emplace_back("timestamp_query");
|
||||
desc.requiredFeatures.emplace_back("timestamp-query");
|
||||
continue;
|
||||
case interop::GPUFeatureName::kDepth24UnormStencil8:
|
||||
case interop::GPUFeatureName::kDepth32FloatStencil8:
|
||||
|
|
|
@ -48,8 +48,8 @@ class BufferZeroInitTest : public DawnTest {
|
|||
protected:
|
||||
std::vector<const char*> GetRequiredFeatures() override {
|
||||
std::vector<const char*> requiredFeatures = {};
|
||||
if (SupportsFeatures({"timestamp_query"})) {
|
||||
requiredFeatures.push_back("timestamp_query");
|
||||
if (SupportsFeatures({"timestamp-query"})) {
|
||||
requiredFeatures.push_back("timestamp-query");
|
||||
}
|
||||
return requiredFeatures;
|
||||
}
|
||||
|
@ -1315,7 +1315,7 @@ TEST_P(BufferZeroInitTest, ResolveQuerySet) {
|
|||
DAWN_SUPPRESS_TEST_IF(IsMetal() && IsAMD());
|
||||
|
||||
// Skip if timestamp feature is not supported on device
|
||||
DAWN_TEST_UNSUPPORTED_IF(!SupportsFeatures({"timestamp_query"}));
|
||||
DAWN_TEST_UNSUPPORTED_IF(!SupportsFeatures({"timestamp-query"}));
|
||||
|
||||
// crbug.com/dawn/940: Does not work on Mac 11.0+. Backend validation changed.
|
||||
DAWN_TEST_UNSUPPORTED_IF(IsMacOS() && !IsMacOS(10));
|
||||
|
|
|
@ -42,9 +42,9 @@ class CompressedTextureFormatTest : public DawnTestWithParams<CompressedTextureF
|
|||
protected:
|
||||
std::vector<const char*> GetRequiredFeatures() override {
|
||||
const wgpu::TextureFormat format = GetParam().mTextureFormat;
|
||||
if (utils::IsBCTextureFormat(format) && SupportsFeatures({"texture_compression_bc"})) {
|
||||
if (utils::IsBCTextureFormat(format) && SupportsFeatures({"texture-compression-bc"})) {
|
||||
mIsFormatSupported = true;
|
||||
return {"texture_compression_bc"};
|
||||
return {"texture-compression-bc"};
|
||||
}
|
||||
if (utils::IsETC2TextureFormat(format) && SupportsFeatures({"texture-compression-etc2"})) {
|
||||
mIsFormatSupported = true;
|
||||
|
@ -1150,11 +1150,11 @@ DAWN_INSTANTIATE_TEST_P(CompressedTextureFormatTest,
|
|||
class CompressedTextureFormatSpecificTest : public DawnTest {
|
||||
protected:
|
||||
std::vector<const char*> GetRequiredFeatures() override {
|
||||
mIsBCFormatSupported = SupportsFeatures({"texture_compression_bc"});
|
||||
mIsBCFormatSupported = SupportsFeatures({"texture-compression-bc"});
|
||||
|
||||
std::vector<const char*> features;
|
||||
if (mIsBCFormatSupported) {
|
||||
features.emplace_back("texture_compression_bc");
|
||||
features.emplace_back("texture-compression-bc");
|
||||
}
|
||||
return features;
|
||||
}
|
||||
|
|
|
@ -69,12 +69,12 @@ namespace {
|
|||
}
|
||||
|
||||
std::vector<const char*> GetRequiredFeatures() override {
|
||||
mIsMultiPlanarFormatsSupported = SupportsFeatures({"multiplanar_formats"});
|
||||
mIsMultiPlanarFormatsSupported = SupportsFeatures({"multiplanar-formats"});
|
||||
if (!mIsMultiPlanarFormatsSupported) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return {"multiplanar_formats"};
|
||||
return {"multiplanar-formats"};
|
||||
}
|
||||
|
||||
bool IsMultiPlanarFormatsSupported() const {
|
||||
|
|
|
@ -77,15 +77,15 @@ namespace {
|
|||
|
||||
std::vector<const char*> GetRequiredFeatures() override {
|
||||
if (GetParam().mFormat == wgpu::TextureFormat::BC1RGBAUnorm &&
|
||||
SupportsFeatures({"texture_compression_bc"})) {
|
||||
return {"texture_compression_bc"};
|
||||
SupportsFeatures({"texture-compression-bc"})) {
|
||||
return {"texture-compression-bc"};
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
void Run() {
|
||||
DAWN_TEST_UNSUPPORTED_IF(GetParam().mFormat == wgpu::TextureFormat::BC1RGBAUnorm &&
|
||||
!SupportsFeatures({"texture_compression_bc"}));
|
||||
!SupportsFeatures({"texture-compression-bc"}));
|
||||
|
||||
// TODO(crbug.com/dawn/667): Work around the fact that some platforms do not support
|
||||
// reading from Snorm textures.
|
||||
|
|
|
@ -24,7 +24,7 @@ class DepthClampingTest : public DawnTest {
|
|||
protected:
|
||||
void SetUp() override {
|
||||
DawnTest::SetUp();
|
||||
DAWN_TEST_UNSUPPORTED_IF(!SupportsFeatures({"depth_clamping"}));
|
||||
DAWN_TEST_UNSUPPORTED_IF(!SupportsFeatures({"depth-clamping"}));
|
||||
|
||||
wgpu::TextureDescriptor renderTargetDescriptor;
|
||||
renderTargetDescriptor.size = {kRTSize, kRTSize};
|
||||
|
@ -69,8 +69,8 @@ class DepthClampingTest : public DawnTest {
|
|||
|
||||
std::vector<const char*> GetRequiredFeatures() override {
|
||||
std::vector<const char*> requiredFeatures = {};
|
||||
if (SupportsFeatures({"depth_clamping"})) {
|
||||
requiredFeatures.push_back("depth_clamping");
|
||||
if (SupportsFeatures({"depth-clamping"})) {
|
||||
requiredFeatures.push_back("depth-clamping");
|
||||
}
|
||||
return requiredFeatures;
|
||||
}
|
||||
|
|
|
@ -454,13 +454,13 @@ class PipelineStatisticsQueryTests : public QueryTests {
|
|||
DawnTest::SetUp();
|
||||
|
||||
// Skip all tests if pipeline statistics feature is not supported
|
||||
DAWN_TEST_UNSUPPORTED_IF(!SupportsFeatures({"pipeline_statistics_query"}));
|
||||
DAWN_TEST_UNSUPPORTED_IF(!SupportsFeatures({"pipeline-statistics-query"}));
|
||||
}
|
||||
|
||||
std::vector<const char*> GetRequiredFeatures() override {
|
||||
std::vector<const char*> requiredFeatures = {};
|
||||
if (SupportsFeatures({"pipeline_statistics_query"})) {
|
||||
requiredFeatures.push_back("pipeline_statistics_query");
|
||||
if (SupportsFeatures({"pipeline-statistics-query"})) {
|
||||
requiredFeatures.push_back("pipeline-statistics-query");
|
||||
}
|
||||
|
||||
return requiredFeatures;
|
||||
|
@ -523,13 +523,13 @@ class TimestampQueryTests : public QueryTests {
|
|||
DawnTest::SetUp();
|
||||
|
||||
// Skip all tests if timestamp feature is not supported
|
||||
DAWN_TEST_UNSUPPORTED_IF(!SupportsFeatures({"timestamp_query"}));
|
||||
DAWN_TEST_UNSUPPORTED_IF(!SupportsFeatures({"timestamp-query"}));
|
||||
}
|
||||
|
||||
std::vector<const char*> GetRequiredFeatures() override {
|
||||
std::vector<const char*> requiredFeatures = {};
|
||||
if (SupportsFeatures({"timestamp_query"})) {
|
||||
requiredFeatures.push_back("timestamp_query");
|
||||
if (SupportsFeatures({"timestamp-query"})) {
|
||||
requiredFeatures.push_back("timestamp-query");
|
||||
}
|
||||
return requiredFeatures;
|
||||
}
|
||||
|
|
|
@ -20,12 +20,12 @@
|
|||
class ShaderFloat16Tests : public DawnTest {
|
||||
protected:
|
||||
std::vector<const char*> GetRequiredFeatures() override {
|
||||
mIsShaderFloat16Supported = SupportsFeatures({"shader_float16"});
|
||||
mIsShaderFloat16Supported = SupportsFeatures({"shader-float16"});
|
||||
if (!mIsShaderFloat16Supported) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return {"shader_float16"};
|
||||
return {"shader-float16"};
|
||||
}
|
||||
|
||||
bool IsShaderFloat16Supported() const {
|
||||
|
|
|
@ -1720,12 +1720,12 @@ class CompressedTextureZeroInitTest : public TextureZeroInitTest {
|
|||
}
|
||||
|
||||
std::vector<const char*> GetRequiredFeatures() override {
|
||||
mIsBCFormatSupported = SupportsFeatures({"texture_compression_bc"});
|
||||
mIsBCFormatSupported = SupportsFeatures({"texture-compression-bc"});
|
||||
if (!mIsBCFormatSupported) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return {"texture_compression_bc"};
|
||||
return {"texture-compression-bc"};
|
||||
}
|
||||
|
||||
bool IsBCFormatSupported() const {
|
||||
|
|
|
@ -2047,7 +2047,7 @@ class CopyCommandTest_CompressedTextureFormats : public CopyCommandTest {
|
|||
protected:
|
||||
WGPUDevice CreateTestDevice() override {
|
||||
dawn_native::DeviceDescriptor descriptor;
|
||||
descriptor.requiredFeatures = {"texture_compression_bc", "texture-compression-etc2",
|
||||
descriptor.requiredFeatures = {"texture-compression-bc", "texture-compression-etc2",
|
||||
"texture-compression-astc"};
|
||||
return adapter.CreateDevice(&descriptor);
|
||||
}
|
||||
|
|
|
@ -226,7 +226,7 @@ class TimestampQueryValidationTest : public QuerySetValidationTest {
|
|||
protected:
|
||||
WGPUDevice CreateTestDevice() override {
|
||||
dawn_native::DeviceDescriptor descriptor;
|
||||
descriptor.requiredFeatures.push_back("timestamp_query");
|
||||
descriptor.requiredFeatures.push_back("timestamp-query");
|
||||
descriptor.forceDisabledToggles.push_back("disallow_unsafe_apis");
|
||||
return adapter.CreateDevice(&descriptor);
|
||||
}
|
||||
|
@ -430,7 +430,7 @@ class PipelineStatisticsQueryValidationTest : public QuerySetValidationTest {
|
|||
protected:
|
||||
WGPUDevice CreateTestDevice() override {
|
||||
dawn_native::DeviceDescriptor descriptor;
|
||||
descriptor.requiredFeatures.push_back("pipeline_statistics_query");
|
||||
descriptor.requiredFeatures.push_back("pipeline-statistics-query");
|
||||
// TODO(crbug.com/1177506): Pipeline statistic query is an unsafe API, disable disallowing
|
||||
// unsafe APIs to test it.
|
||||
descriptor.forceDisabledToggles.push_back("disallow_unsafe_apis");
|
||||
|
|
|
@ -558,7 +558,7 @@ namespace {
|
|||
protected:
|
||||
WGPUDevice CreateTestDevice() override {
|
||||
dawn_native::DeviceDescriptor descriptor;
|
||||
descriptor.requiredFeatures = {"texture_compression_bc", "texture-compression-etc2",
|
||||
descriptor.requiredFeatures = {"texture-compression-bc", "texture-compression-etc2",
|
||||
"texture-compression-astc"};
|
||||
return adapter.CreateDevice(&descriptor);
|
||||
}
|
||||
|
|
|
@ -1125,7 +1125,7 @@ class DepthClampingValidationTest : public RenderPipelineValidationTest {
|
|||
protected:
|
||||
WGPUDevice CreateTestDevice() override {
|
||||
dawn_native::DeviceDescriptor descriptor;
|
||||
descriptor.requiredFeatures = {"depth_clamping"};
|
||||
descriptor.requiredFeatures = {"depth-clamping"};
|
||||
return adapter.CreateDevice(&descriptor);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -569,7 +569,7 @@ namespace {
|
|||
protected:
|
||||
WGPUDevice CreateTestDevice() override {
|
||||
dawn_native::DeviceDescriptor descriptor;
|
||||
descriptor.requiredFeatures = {"texture_compression_bc", "texture-compression-etc2",
|
||||
descriptor.requiredFeatures = {"texture-compression-bc", "texture-compression-etc2",
|
||||
"texture-compression-astc"};
|
||||
return adapter.CreateDevice(&descriptor);
|
||||
}
|
||||
|
|
|
@ -110,8 +110,8 @@ class UnsafeQueryAPIValidationTest : public ValidationTest {
|
|||
protected:
|
||||
WGPUDevice CreateTestDevice() override {
|
||||
dawn_native::DeviceDescriptor descriptor;
|
||||
descriptor.requiredFeatures.push_back("pipeline_statistics_query");
|
||||
descriptor.requiredFeatures.push_back("timestamp_query");
|
||||
descriptor.requiredFeatures.push_back("pipeline-statistics-query");
|
||||
descriptor.requiredFeatures.push_back("timestamp-query");
|
||||
descriptor.forceEnabledToggles.push_back("disallow_unsafe_apis");
|
||||
return adapter.CreateDevice(&descriptor);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace {
|
|||
protected:
|
||||
WGPUDevice CreateTestDevice() override {
|
||||
dawn_native::DeviceDescriptor descriptor;
|
||||
descriptor.requiredFeatures = {"multiplanar_formats"};
|
||||
descriptor.requiredFeatures = {"multiplanar-formats"};
|
||||
return adapter.CreateDevice(&descriptor);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,12 +27,12 @@ class D3D12ResourceHeapTests : public DawnTest {
|
|||
}
|
||||
|
||||
std::vector<const char*> GetRequiredFeatures() override {
|
||||
mIsBCFormatSupported = SupportsFeatures({"texture_compression_bc"});
|
||||
mIsBCFormatSupported = SupportsFeatures({"texture-compression-bc"});
|
||||
if (!mIsBCFormatSupported) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return {"texture_compression_bc"};
|
||||
return {"texture-compression-bc"};
|
||||
}
|
||||
|
||||
bool IsBCFormatSupported() const {
|
||||
|
|
Loading…
Reference in New Issue