mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-06 13:15:59 +00:00
Query API: Extensions
Add extensions of pipeline statistics and timestamp queries. Bug: dawn:434 Change-Id: I1a472ee4819bd36ce629034cf5175430bab1febc Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22100 Commit-Queue: Hao Li <hao.x.li@intel.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
bdc05c3d5f
commit
55c85f66d2
@ -651,7 +651,9 @@
|
|||||||
"extensible": false,
|
"extensible": false,
|
||||||
"members": [
|
"members": [
|
||||||
{"name": "texture compression BC", "type": "bool", "default": "false"},
|
{"name": "texture compression BC", "type": "bool", "default": "false"},
|
||||||
{"name": "shader float16", "type": "bool", "default": "false"}
|
{"name": "shader float16", "type": "bool", "default": "false"},
|
||||||
|
{"name": "pipeline statistics query", "type": "bool", "default": "false"},
|
||||||
|
{"name": "timestamp query", "type": "bool", "default": "false"}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"depth stencil state descriptor": {
|
"depth stencil state descriptor": {
|
||||||
|
@ -39,7 +39,15 @@ namespace dawn_native {
|
|||||||
{"shader_float16",
|
{"shader_float16",
|
||||||
"Support 16bit float arithmetic and declarations in uniform and storage buffers",
|
"Support 16bit float arithmetic and declarations in uniform and storage buffers",
|
||||||
"https://bugs.chromium.org/p/dawn/issues/detail?id=426"},
|
"https://bugs.chromium.org/p/dawn/issues/detail?id=426"},
|
||||||
&WGPUDeviceProperties::shaderFloat16}}};
|
&WGPUDeviceProperties::shaderFloat16},
|
||||||
|
{Extension::PipelineStatisticsQuery,
|
||||||
|
{"pipeline_statistics_query", "Support Pipeline Statistics Query",
|
||||||
|
"https://bugs.chromium.org/p/dawn/issues/detail?id=434"},
|
||||||
|
&WGPUDeviceProperties::pipelineStatisticsQuery},
|
||||||
|
{Extension::TimestampQuery,
|
||||||
|
{"timestamp_query", "Support Timestamp Query",
|
||||||
|
"https://bugs.chromium.org/p/dawn/issues/detail?id=434"},
|
||||||
|
&WGPUDeviceProperties::timestampQuery}}};
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
|
@ -26,6 +26,8 @@ namespace dawn_native {
|
|||||||
enum class Extension {
|
enum class Extension {
|
||||||
TextureCompressionBC,
|
TextureCompressionBC,
|
||||||
ShaderFloat16,
|
ShaderFloat16,
|
||||||
|
PipelineStatisticsQuery,
|
||||||
|
TimestampQuery,
|
||||||
|
|
||||||
EnumCount,
|
EnumCount,
|
||||||
InvalidEnum = EnumCount,
|
InvalidEnum = EnumCount,
|
||||||
|
@ -92,6 +92,8 @@ namespace dawn_native { namespace d3d12 {
|
|||||||
|
|
||||||
void Adapter::InitializeSupportedExtensions() {
|
void Adapter::InitializeSupportedExtensions() {
|
||||||
mSupportedExtensions.EnableExtension(Extension::TextureCompressionBC);
|
mSupportedExtensions.EnableExtension(Extension::TextureCompressionBC);
|
||||||
|
mSupportedExtensions.EnableExtension(Extension::PipelineStatisticsQuery);
|
||||||
|
mSupportedExtensions.EnableExtension(Extension::TimestampQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultOrError<DeviceBase*> Adapter::CreateDeviceImpl(const DeviceDescriptor* descriptor) {
|
ResultOrError<DeviceBase*> Adapter::CreateDeviceImpl(const DeviceDescriptor* descriptor) {
|
||||||
|
@ -214,6 +214,11 @@ namespace dawn_native { namespace metal {
|
|||||||
if ([mDevice supportsFeatureSet:MTLFeatureSet_macOS_GPUFamily1_v1]) {
|
if ([mDevice supportsFeatureSet:MTLFeatureSet_macOS_GPUFamily1_v1]) {
|
||||||
mSupportedExtensions.EnableExtension(Extension::TextureCompressionBC);
|
mSupportedExtensions.EnableExtension(Extension::TextureCompressionBC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (@available(macOS 10.15, *)) {
|
||||||
|
mSupportedExtensions.EnableExtension(Extension::PipelineStatisticsQuery);
|
||||||
|
mSupportedExtensions.EnableExtension(Extension::TimestampQuery);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,6 +80,14 @@ namespace dawn_native { namespace vulkan {
|
|||||||
mDeviceInfo._16BitStorageFeatures.uniformAndStorageBuffer16BitAccess == VK_TRUE) {
|
mDeviceInfo._16BitStorageFeatures.uniformAndStorageBuffer16BitAccess == VK_TRUE) {
|
||||||
mSupportedExtensions.EnableExtension(Extension::ShaderFloat16);
|
mSupportedExtensions.EnableExtension(Extension::ShaderFloat16);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mDeviceInfo.features.pipelineStatisticsQuery == VK_TRUE) {
|
||||||
|
mSupportedExtensions.EnableExtension(Extension::PipelineStatisticsQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mDeviceInfo.properties.limits.timestampComputeAndGraphics == VK_TRUE) {
|
||||||
|
mSupportedExtensions.EnableExtension(Extension::TimestampQuery);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultOrError<DeviceBase*> Adapter::CreateDeviceImpl(const DeviceDescriptor* descriptor) {
|
ResultOrError<DeviceBase*> Adapter::CreateDeviceImpl(const DeviceDescriptor* descriptor) {
|
||||||
|
@ -23,6 +23,9 @@ class WireWGPUDevicePropertiesTests : public testing::Test {};
|
|||||||
TEST_F(WireWGPUDevicePropertiesTests, SerializeWGPUDeviceProperties) {
|
TEST_F(WireWGPUDevicePropertiesTests, SerializeWGPUDeviceProperties) {
|
||||||
WGPUDeviceProperties sentWGPUDeviceProperties;
|
WGPUDeviceProperties sentWGPUDeviceProperties;
|
||||||
sentWGPUDeviceProperties.textureCompressionBC = true;
|
sentWGPUDeviceProperties.textureCompressionBC = true;
|
||||||
|
// Set false to test that the serialization can handle both true and false correctly.
|
||||||
|
sentWGPUDeviceProperties.pipelineStatisticsQuery = false;
|
||||||
|
sentWGPUDeviceProperties.timestampQuery = true;
|
||||||
|
|
||||||
size_t sentWGPUDevicePropertiesSize =
|
size_t sentWGPUDevicePropertiesSize =
|
||||||
dawn_wire::SerializedWGPUDevicePropertiesSize(&sentWGPUDeviceProperties);
|
dawn_wire::SerializedWGPUDevicePropertiesSize(&sentWGPUDeviceProperties);
|
||||||
@ -33,4 +36,6 @@ TEST_F(WireWGPUDevicePropertiesTests, SerializeWGPUDeviceProperties) {
|
|||||||
WGPUDeviceProperties receivedWGPUDeviceProperties;
|
WGPUDeviceProperties receivedWGPUDeviceProperties;
|
||||||
dawn_wire::DeserializeWGPUDeviceProperties(&receivedWGPUDeviceProperties, buffer.data());
|
dawn_wire::DeserializeWGPUDeviceProperties(&receivedWGPUDeviceProperties, buffer.data());
|
||||||
ASSERT_TRUE(receivedWGPUDeviceProperties.textureCompressionBC);
|
ASSERT_TRUE(receivedWGPUDeviceProperties.textureCompressionBC);
|
||||||
|
ASSERT_FALSE(receivedWGPUDeviceProperties.pipelineStatisticsQuery);
|
||||||
|
ASSERT_TRUE(receivedWGPUDeviceProperties.timestampQuery);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user