Delete WGPUDeviceProperties
This struct is no longer needed now that the adapter exposes a way to query its features that works both in native and the wire. Change-Id: Ib0d865330f65473bb0363858a9284e630da52eb1 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93340 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Shrek Shao <shrekshao@google.com> Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
cda3d7bfa8
commit
1faf5921c6
26
dawn.json
26
dawn.json
|
@ -1203,32 +1203,6 @@
|
|||
{"value": 1, "name": "destroyed"}
|
||||
]
|
||||
},
|
||||
"device properties": {
|
||||
"category": "structure",
|
||||
"extensible": false,
|
||||
"tags": ["dawn"],
|
||||
"members": [
|
||||
{"name": "device ID", "type": "uint32_t"},
|
||||
{"name": "vendor ID", "type": "uint32_t"},
|
||||
{"name": "adapter type", "type": "adapter type"},
|
||||
{"name": "texture compression BC", "type": "bool", "default": "false"},
|
||||
{"name": "texture compression ETC2", "type": "bool", "default": "false"},
|
||||
{"name": "texture compression ASTC", "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"},
|
||||
{"name": "multi planar formats", "type": "bool", "default": "false"},
|
||||
{"name": "depth clamping", "type": "bool", "default": "false"},
|
||||
{"name": "depth24 unorm stencil8", "type": "bool", "default": "false"},
|
||||
{"name": "depth32 float stencil8", "type": "bool", "default": "false"},
|
||||
{"name": "chromium experimental dp4a", "type": "bool", "default": "false"},
|
||||
{"name": "indirect first instance", "type": "bool", "default": "false"},
|
||||
{"name": "invalid feature", "type": "bool", "default": "false"},
|
||||
{"name": "dawn internal usages", "type": "bool", "default": "false"},
|
||||
{"name": "dawn native", "type": "bool", "default": "false"},
|
||||
{"name": "limits", "type": "supported limits"}
|
||||
]
|
||||
},
|
||||
"double": {
|
||||
"category": "native"
|
||||
},
|
||||
|
|
|
@ -86,7 +86,6 @@ class DAWN_NATIVE_EXPORT Adapter {
|
|||
|
||||
std::vector<const char*> GetSupportedExtensions() const;
|
||||
std::vector<const char*> GetSupportedFeatures() const;
|
||||
WGPUDeviceProperties GetAdapterProperties() const;
|
||||
bool GetLimits(WGPUSupportedLimits* limits) const;
|
||||
|
||||
void SetUseTieredLimits(bool useTieredLimits);
|
||||
|
|
|
@ -174,22 +174,6 @@ bool AdapterBase::SupportsAllRequiredFeatures(
|
|||
return true;
|
||||
}
|
||||
|
||||
WGPUDeviceProperties AdapterBase::GetAdapterProperties() const {
|
||||
WGPUDeviceProperties adapterProperties = {};
|
||||
adapterProperties.deviceID = mDeviceId;
|
||||
adapterProperties.vendorID = mVendorId;
|
||||
adapterProperties.adapterType = static_cast<WGPUAdapterType>(mAdapterType);
|
||||
|
||||
mSupportedFeatures.InitializeDeviceProperties(&adapterProperties);
|
||||
// This is OK for now because there are no limit feature structs.
|
||||
// If we add additional structs, the caller will need to provide memory
|
||||
// to store them (ex. by calling GetLimits directly instead). Currently,
|
||||
// we keep this function as it's only used internally in Chromium to
|
||||
// send the adapter properties across the wire.
|
||||
GetLimits(FromAPI(&adapterProperties.limits));
|
||||
return adapterProperties;
|
||||
}
|
||||
|
||||
bool AdapterBase::GetLimits(SupportedLimits* limits) const {
|
||||
ASSERT(limits != nullptr);
|
||||
if (limits->nextInChain != nullptr) {
|
||||
|
|
|
@ -57,7 +57,6 @@ class AdapterBase : public RefCounted {
|
|||
FeaturesSet GetSupportedFeatures() const;
|
||||
bool SupportsAllRequiredFeatures(
|
||||
const ityp::span<size_t, const wgpu::FeatureName>& features) const;
|
||||
WGPUDeviceProperties GetAdapterProperties() const;
|
||||
|
||||
bool GetLimits(SupportedLimits* limits) const;
|
||||
|
||||
|
|
|
@ -125,10 +125,6 @@ std::vector<const char*> Adapter::GetSupportedFeatures() const {
|
|||
return supportedFeaturesSet.GetEnabledFeatureNames();
|
||||
}
|
||||
|
||||
WGPUDeviceProperties Adapter::GetAdapterProperties() const {
|
||||
return mImpl->GetAdapterProperties();
|
||||
}
|
||||
|
||||
bool Adapter::GetLimits(WGPUSupportedLimits* limits) const {
|
||||
return mImpl->GetLimits(FromAPI(limits));
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ namespace {
|
|||
struct FeatureEnumAndInfo {
|
||||
Feature feature;
|
||||
FeatureInfo info;
|
||||
bool WGPUDeviceProperties::*memberInWGPUDeviceProperties;
|
||||
};
|
||||
|
||||
using FeatureEnumAndInfoList =
|
||||
|
@ -35,69 +34,55 @@ using FeatureEnumAndInfoList =
|
|||
static constexpr FeatureEnumAndInfoList kFeatureNameAndInfoList = {{
|
||||
{Feature::TextureCompressionBC,
|
||||
{"texture-compression-bc", "Support Block Compressed (BC) texture formats",
|
||||
"https://bugs.chromium.org/p/dawn/issues/detail?id=42"},
|
||||
&WGPUDeviceProperties::textureCompressionBC},
|
||||
"https://bugs.chromium.org/p/dawn/issues/detail?id=42"}},
|
||||
{Feature::TextureCompressionETC2,
|
||||
{"texture-compression-etc2",
|
||||
"Support Ericsson Texture Compressed (ETC2/EAC) texture "
|
||||
"formats",
|
||||
"https://bugs.chromium.org/p/dawn/issues/detail?id=955"},
|
||||
&WGPUDeviceProperties::textureCompressionETC2},
|
||||
"https://bugs.chromium.org/p/dawn/issues/detail?id=955"}},
|
||||
{Feature::TextureCompressionASTC,
|
||||
{"texture-compression-astc",
|
||||
"Support Adaptable Scalable Texture Compressed (ASTC) "
|
||||
"texture formats",
|
||||
"https://bugs.chromium.org/p/dawn/issues/detail?id=955"},
|
||||
&WGPUDeviceProperties::textureCompressionASTC},
|
||||
"https://bugs.chromium.org/p/dawn/issues/detail?id=955"}},
|
||||
{Feature::ShaderFloat16,
|
||||
{"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},
|
||||
"https://bugs.chromium.org/p/dawn/issues/detail?id=426"}},
|
||||
{Feature::PipelineStatisticsQuery,
|
||||
{"pipeline-statistics-query", "Support Pipeline Statistics Query",
|
||||
"https://bugs.chromium.org/p/dawn/issues/detail?id=434"},
|
||||
&WGPUDeviceProperties::pipelineStatisticsQuery},
|
||||
"https://bugs.chromium.org/p/dawn/issues/detail?id=434"}},
|
||||
{Feature::TimestampQuery,
|
||||
{"timestamp-query", "Support Timestamp Query",
|
||||
"https://bugs.chromium.org/p/dawn/issues/detail?id=434"},
|
||||
&WGPUDeviceProperties::timestampQuery},
|
||||
"https://bugs.chromium.org/p/dawn/issues/detail?id=434"}},
|
||||
{Feature::DepthClamping,
|
||||
{"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},
|
||||
"https://bugs.chromium.org/p/dawn/issues/detail?id=716"}},
|
||||
{Feature::Depth24UnormStencil8,
|
||||
{"depth24unorm-stencil8", "Support depth24unorm-stencil8 texture format",
|
||||
"https://bugs.chromium.org/p/dawn/issues/detail?id=690"},
|
||||
&WGPUDeviceProperties::depth24UnormStencil8},
|
||||
"https://bugs.chromium.org/p/dawn/issues/detail?id=690"}},
|
||||
{Feature::Depth32FloatStencil8,
|
||||
{"depth32float-stencil8", "Support depth32float-stencil8 texture format",
|
||||
"https://bugs.chromium.org/p/dawn/issues/detail?id=690"},
|
||||
&WGPUDeviceProperties::depth32FloatStencil8},
|
||||
"https://bugs.chromium.org/p/dawn/issues/detail?id=690"}},
|
||||
{Feature::ChromiumExperimentalDp4a,
|
||||
{"chromium-experimental-dp4a", "Support experimental DP4a instructions in WGSL",
|
||||
"https://bugs.chromium.org/p/tint/issues/detail?id=1497"},
|
||||
&WGPUDeviceProperties::chromiumExperimentalDp4a},
|
||||
"https://bugs.chromium.org/p/tint/issues/detail?id=1497"}},
|
||||
{Feature::IndirectFirstInstance,
|
||||
{"indirect-first-instance", "Support non-zero first instance values on indirect draw calls",
|
||||
"https://bugs.chromium.org/p/dawn/issues/detail?id=1197"},
|
||||
&WGPUDeviceProperties::indirectFirstInstance},
|
||||
"https://bugs.chromium.org/p/dawn/issues/detail?id=1197"}},
|
||||
{Feature::DawnInternalUsages,
|
||||
{"dawn-internal-usages",
|
||||
"Add internal usages to resources to affect how the texture is allocated, but not "
|
||||
"frontend validation. Other internal commands may access this usage.",
|
||||
"https://dawn.googlesource.com/dawn/+/refs/heads/main/docs/dawn/features/"
|
||||
"dawn_internal_usages.md"},
|
||||
&WGPUDeviceProperties::dawnInternalUsages},
|
||||
"dawn_internal_usages.md"}},
|
||||
{Feature::MultiPlanarFormats,
|
||||
{"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},
|
||||
"https://bugs.chromium.org/p/dawn/issues/detail?id=551"}},
|
||||
{Feature::DawnNative,
|
||||
{"dawn-native", "WebGPU is running on top of dawn_native.",
|
||||
"https://dawn.googlesource.com/dawn/+/refs/heads/main/docs/dawn/features/"
|
||||
"dawn_native.md"},
|
||||
&WGPUDeviceProperties::dawnNative},
|
||||
"dawn_native.md"}},
|
||||
}};
|
||||
|
||||
Feature FromAPIFeature(wgpu::FeatureName feature) {
|
||||
|
@ -225,14 +210,6 @@ std::vector<const char*> FeaturesSet::GetEnabledFeatureNames() const {
|
|||
return enabledFeatureNames;
|
||||
}
|
||||
|
||||
void FeaturesSet::InitializeDeviceProperties(WGPUDeviceProperties* properties) const {
|
||||
ASSERT(properties != nullptr);
|
||||
|
||||
for (uint32_t i : IterateBitSet(featuresBitSet)) {
|
||||
properties->*(kFeatureNameAndInfoList[i].memberInWGPUDeviceProperties) = true;
|
||||
}
|
||||
}
|
||||
|
||||
wgpu::FeatureName FeatureEnumToAPIFeature(Feature feature) {
|
||||
ASSERT(feature != Feature::InvalidEnum);
|
||||
return ToAPIFeature(feature);
|
||||
|
|
|
@ -62,7 +62,6 @@ struct FeaturesSet {
|
|||
// non-null.
|
||||
size_t EnumerateFeatures(wgpu::FeatureName* features) const;
|
||||
std::vector<const char*> GetEnabledFeatureNames() const;
|
||||
void InitializeDeviceProperties(WGPUDeviceProperties* properties) const;
|
||||
};
|
||||
|
||||
wgpu::FeatureName FeatureEnumToAPIFeature(Feature feature);
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "src/dawn/node/binding/GPUAdapter.h"
|
||||
|
||||
#include <unordered_set>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "src/dawn/node/binding/Errors.h"
|
||||
|
@ -91,29 +92,33 @@ namespace {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
class Features : public interop::GPUSupportedFeatures {
|
||||
public:
|
||||
explicit Features(WGPUDeviceProperties properties) {
|
||||
if (properties.depth32FloatStencil8) {
|
||||
enabled_.emplace(interop::GPUFeatureName::kDepth32FloatStencil8);
|
||||
explicit Features(std::vector<wgpu::FeatureName> features) {
|
||||
for (wgpu::FeatureName feature : features) {
|
||||
switch (feature) {
|
||||
case wgpu::FeatureName::Depth32FloatStencil8:
|
||||
enabled_.emplace(interop::GPUFeatureName::kDepth32FloatStencil8);
|
||||
break;
|
||||
case wgpu::FeatureName::TimestampQuery:
|
||||
enabled_.emplace(interop::GPUFeatureName::kTimestampQuery);
|
||||
break;
|
||||
case wgpu::FeatureName::TextureCompressionBC:
|
||||
enabled_.emplace(interop::GPUFeatureName::kTextureCompressionBc);
|
||||
break;
|
||||
case wgpu::FeatureName::TextureCompressionETC2:
|
||||
enabled_.emplace(interop::GPUFeatureName::kTextureCompressionEtc2);
|
||||
break;
|
||||
case wgpu::FeatureName::TextureCompressionASTC:
|
||||
enabled_.emplace(interop::GPUFeatureName::kTextureCompressionAstc);
|
||||
break;
|
||||
case wgpu::FeatureName::IndirectFirstInstance:
|
||||
enabled_.emplace(interop::GPUFeatureName::kIndirectFirstInstance);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (properties.timestampQuery) {
|
||||
enabled_.emplace(interop::GPUFeatureName::kTimestampQuery);
|
||||
}
|
||||
if (properties.textureCompressionBC) {
|
||||
enabled_.emplace(interop::GPUFeatureName::kTextureCompressionBc);
|
||||
}
|
||||
if (properties.textureCompressionETC2) {
|
||||
enabled_.emplace(interop::GPUFeatureName::kTextureCompressionEtc2);
|
||||
}
|
||||
if (properties.textureCompressionASTC) {
|
||||
enabled_.emplace(interop::GPUFeatureName::kTextureCompressionAstc);
|
||||
}
|
||||
if (properties.timestampQuery) {
|
||||
enabled_.emplace(interop::GPUFeatureName::kTimestampQuery);
|
||||
}
|
||||
|
||||
// TODO(dawn:1123) add support for these extensions when possible.
|
||||
// wgpu::interop::GPUFeatureName::kDepthClipControl
|
||||
// wgpu::interop::GPUFeatureName::kIndirectFirstInstance
|
||||
// wgpu::interop::GPUFeatureName::kShaderF16
|
||||
// wgpu::interop::GPUFeatureName::kBgra8UnormStorage
|
||||
}
|
||||
|
@ -152,7 +157,11 @@ GPUAdapter::GPUAdapter(dawn::native::Adapter a, const Flags& flags) : adapter_(a
|
|||
// TODO(dawn:1133): Avoid the extra copy by making the generator make a virtual method with const
|
||||
// std::string&
|
||||
interop::Interface<interop::GPUSupportedFeatures> GPUAdapter::getFeatures(Napi::Env env) {
|
||||
return interop::GPUSupportedFeatures::Create<Features>(env, adapter_.GetAdapterProperties());
|
||||
wgpu::Adapter adapter(adapter_.Get());
|
||||
size_t count = adapter.EnumerateFeatures(nullptr);
|
||||
std::vector<wgpu::FeatureName> features(count);
|
||||
adapter.EnumerateFeatures(&features[0]);
|
||||
return interop::GPUSupportedFeatures::Create<Features>(env, std::move(features));
|
||||
}
|
||||
|
||||
interop::Interface<interop::GPUSupportedLimits> GPUAdapter::getLimits(Napi::Env env) {
|
||||
|
|
Loading…
Reference in New Issue