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:
Hao Li 2020-05-27 05:15:18 +00:00 committed by Commit Bot service account
parent bdc05c3d5f
commit 55c85f66d2
7 changed files with 34 additions and 2 deletions

View File

@ -651,7 +651,9 @@
"extensible": false,
"members": [
{"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": {

View File

@ -39,7 +39,15 @@ namespace dawn_native {
{"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}}};
&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

View File

@ -26,6 +26,8 @@ namespace dawn_native {
enum class Extension {
TextureCompressionBC,
ShaderFloat16,
PipelineStatisticsQuery,
TimestampQuery,
EnumCount,
InvalidEnum = EnumCount,

View File

@ -92,6 +92,8 @@ namespace dawn_native { namespace d3d12 {
void Adapter::InitializeSupportedExtensions() {
mSupportedExtensions.EnableExtension(Extension::TextureCompressionBC);
mSupportedExtensions.EnableExtension(Extension::PipelineStatisticsQuery);
mSupportedExtensions.EnableExtension(Extension::TimestampQuery);
}
ResultOrError<DeviceBase*> Adapter::CreateDeviceImpl(const DeviceDescriptor* descriptor) {

View File

@ -214,6 +214,11 @@ namespace dawn_native { namespace metal {
if ([mDevice supportsFeatureSet:MTLFeatureSet_macOS_GPUFamily1_v1]) {
mSupportedExtensions.EnableExtension(Extension::TextureCompressionBC);
}
if (@available(macOS 10.15, *)) {
mSupportedExtensions.EnableExtension(Extension::PipelineStatisticsQuery);
mSupportedExtensions.EnableExtension(Extension::TimestampQuery);
}
#endif
}

View File

@ -80,6 +80,14 @@ namespace dawn_native { namespace vulkan {
mDeviceInfo._16BitStorageFeatures.uniformAndStorageBuffer16BitAccess == VK_TRUE) {
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) {

View File

@ -23,6 +23,9 @@ class WireWGPUDevicePropertiesTests : public testing::Test {};
TEST_F(WireWGPUDevicePropertiesTests, SerializeWGPUDeviceProperties) {
WGPUDeviceProperties sentWGPUDeviceProperties;
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 =
dawn_wire::SerializedWGPUDevicePropertiesSize(&sentWGPUDeviceProperties);
@ -33,4 +36,6 @@ TEST_F(WireWGPUDevicePropertiesTests, SerializeWGPUDeviceProperties) {
WGPUDeviceProperties receivedWGPUDeviceProperties;
dawn_wire::DeserializeWGPUDeviceProperties(&receivedWGPUDeviceProperties, buffer.data());
ASSERT_TRUE(receivedWGPUDeviceProperties.textureCompressionBC);
ASSERT_FALSE(receivedWGPUDeviceProperties.pipelineStatisticsQuery);
ASSERT_TRUE(receivedWGPUDeviceProperties.timestampQuery);
}