Dawn: Make Adapter initialize supported feature never error
This CL make vulkan adapter checks essential Vulkan extensions and features in InitializeImpl rather than InitializeSupportedFeaturesImpl. This change makes InitializeSupportedFeaturesImpl never result in Error for all backend, and this CL change the return type of InitializeSupportedFeaturesImpl from MaybeError to void. Bug: dawn:1495 Change-Id: If59c5aa5281776226c157451ee5119052d33ac24 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118031 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
76d4892f36
commit
6315289ee8
|
@ -39,11 +39,8 @@ MaybeError AdapterBase::Initialize() {
|
|||
DAWN_TRY_CONTEXT(InitializeImpl(), "initializing adapter (backend=%s)", mBackend);
|
||||
InitializeVendorArchitectureImpl();
|
||||
|
||||
DAWN_TRY_CONTEXT(
|
||||
InitializeSupportedFeaturesImpl(),
|
||||
"gathering supported features for \"%s\" - \"%s\" (vendorId=%#06x deviceId=%#06x "
|
||||
"backend=%s type=%s)",
|
||||
mName, mDriverDescription, mVendorId, mDeviceId, mBackend, mAdapterType);
|
||||
InitializeSupportedFeaturesImpl();
|
||||
|
||||
DAWN_TRY_CONTEXT(
|
||||
InitializeSupportedLimitsImpl(&mLimits),
|
||||
"gathering supported limits for \"%s\" - \"%s\" (vendorId=%#06x deviceId=%#06x "
|
||||
|
|
|
@ -94,7 +94,7 @@ class AdapterBase : public RefCounted {
|
|||
virtual MaybeError InitializeImpl() = 0;
|
||||
|
||||
// Check base WebGPU features and discover supported features.
|
||||
virtual MaybeError InitializeSupportedFeaturesImpl() = 0;
|
||||
virtual void InitializeSupportedFeaturesImpl() = 0;
|
||||
|
||||
// Check base WebGPU limits and populate supported limits.
|
||||
virtual MaybeError InitializeSupportedLimitsImpl(CombinedLimits* limits) = 0;
|
||||
|
|
|
@ -122,7 +122,7 @@ bool Adapter::AreTimestampQueriesSupported() const {
|
|||
return true;
|
||||
}
|
||||
|
||||
MaybeError Adapter::InitializeSupportedFeaturesImpl() {
|
||||
void Adapter::InitializeSupportedFeaturesImpl() {
|
||||
if (AreTimestampQueriesSupported()) {
|
||||
mSupportedFeatures.EnableFeature(Feature::TimestampQuery);
|
||||
mSupportedFeatures.EnableFeature(Feature::TimestampQueryInsidePasses);
|
||||
|
@ -144,8 +144,6 @@ MaybeError Adapter::InitializeSupportedFeaturesImpl() {
|
|||
mSupportedFeatures.EnableFeature(Feature::ShaderF16);
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
MaybeError Adapter::InitializeSupportedLimitsImpl(CombinedLimits* limits) {
|
||||
|
|
|
@ -46,7 +46,7 @@ class Adapter : public AdapterBase {
|
|||
bool AreTimestampQueriesSupported() const;
|
||||
|
||||
MaybeError InitializeImpl() override;
|
||||
MaybeError InitializeSupportedFeaturesImpl() override;
|
||||
void InitializeSupportedFeaturesImpl() override;
|
||||
MaybeError InitializeSupportedLimitsImpl(CombinedLimits* limits) override;
|
||||
|
||||
MaybeError ValidateFeatureSupportedWithTogglesImpl(
|
||||
|
|
|
@ -298,7 +298,7 @@ class Adapter : public AdapterBase {
|
|||
|
||||
MaybeError InitializeImpl() override { return {}; }
|
||||
|
||||
MaybeError InitializeSupportedFeaturesImpl() override {
|
||||
void InitializeSupportedFeaturesImpl() override {
|
||||
// Check compressed texture format with deprecated MTLFeatureSet way.
|
||||
#if DAWN_PLATFORM_IS(MACOS)
|
||||
if ([*mDevice supportsFeatureSet:MTLFeatureSet_macOS_GPUFamily1_v1]) {
|
||||
|
@ -383,8 +383,6 @@ class Adapter : public AdapterBase {
|
|||
mSupportedFeatures.EnableFeature(Feature::IndirectFirstInstance);
|
||||
mSupportedFeatures.EnableFeature(Feature::ShaderF16);
|
||||
mSupportedFeatures.EnableFeature(Feature::RG11B10UfloatRenderable);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void InitializeVendorArchitectureImpl() override {
|
||||
|
|
|
@ -57,10 +57,9 @@ MaybeError Adapter::InitializeImpl() {
|
|||
return {};
|
||||
}
|
||||
|
||||
MaybeError Adapter::InitializeSupportedFeaturesImpl() {
|
||||
void Adapter::InitializeSupportedFeaturesImpl() {
|
||||
// Enable all features by default for the convenience of tests.
|
||||
mSupportedFeatures.featuresBitSet.set();
|
||||
return {};
|
||||
}
|
||||
|
||||
MaybeError Adapter::InitializeSupportedLimitsImpl(CombinedLimits* limits) {
|
||||
|
|
|
@ -182,7 +182,7 @@ class Adapter : public AdapterBase {
|
|||
|
||||
private:
|
||||
MaybeError InitializeImpl() override;
|
||||
MaybeError InitializeSupportedFeaturesImpl() override;
|
||||
void InitializeSupportedFeaturesImpl() override;
|
||||
MaybeError InitializeSupportedLimitsImpl(CombinedLimits* limits) override;
|
||||
|
||||
ResultOrError<Ref<DeviceBase>> CreateDeviceImpl(
|
||||
|
|
|
@ -90,7 +90,7 @@ MaybeError Adapter::InitializeImpl() {
|
|||
return {};
|
||||
}
|
||||
|
||||
MaybeError Adapter::InitializeSupportedFeaturesImpl() {
|
||||
void Adapter::InitializeSupportedFeaturesImpl() {
|
||||
// TextureCompressionBC
|
||||
{
|
||||
// BC1, BC2 and BC3 are not supported in OpenGL or OpenGL ES core features.
|
||||
|
@ -145,8 +145,6 @@ MaybeError Adapter::InitializeSupportedFeaturesImpl() {
|
|||
if (mFunctions.IsGLExtensionSupported("GL_AMD_gpu_shader_half_float")) {
|
||||
mSupportedFeatures.EnableFeature(Feature::ShaderF16);
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
MaybeError Adapter::InitializeSupportedLimitsImpl(CombinedLimits* limits) {
|
||||
|
|
|
@ -34,7 +34,7 @@ class Adapter : public AdapterBase {
|
|||
|
||||
private:
|
||||
MaybeError InitializeImpl() override;
|
||||
MaybeError InitializeSupportedFeaturesImpl() override;
|
||||
void InitializeSupportedFeaturesImpl() override;
|
||||
MaybeError InitializeSupportedLimitsImpl(CombinedLimits* limits) override;
|
||||
ResultOrError<Ref<DeviceBase>> CreateDeviceImpl(
|
||||
const DeviceDescriptor* descriptor,
|
||||
|
|
|
@ -140,10 +140,7 @@ MaybeError Adapter::InitializeImpl() {
|
|||
break;
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
MaybeError Adapter::InitializeSupportedFeaturesImpl() {
|
||||
// Check for essential Vulkan extensions and features
|
||||
// Needed for viewport Y-flip.
|
||||
if (!mDeviceInfo.HasExt(DeviceExt::Maintenance1)) {
|
||||
return DAWN_INTERNAL_ERROR("Vulkan 1.1 or Vulkan 1.0 with KHR_Maintenance1 required.");
|
||||
|
@ -182,6 +179,10 @@ MaybeError Adapter::InitializeSupportedFeaturesImpl() {
|
|||
return DAWN_INTERNAL_ERROR("Vulkan sampleRateShading feature required.");
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void Adapter::InitializeSupportedFeaturesImpl() {
|
||||
// Initialize supported extensions
|
||||
if (mDeviceInfo.features.textureCompressionBC == VK_TRUE) {
|
||||
mSupportedFeatures.EnableFeature(Feature::TextureCompressionBC);
|
||||
|
@ -254,8 +255,6 @@ MaybeError Adapter::InitializeSupportedFeaturesImpl() {
|
|||
// features.
|
||||
mSupportedFeatures.EnableFeature(Feature::MultiPlanarFormats);
|
||||
#endif
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
MaybeError Adapter::InitializeSupportedLimitsImpl(CombinedLimits* limits) {
|
||||
|
|
|
@ -45,7 +45,7 @@ class Adapter : public AdapterBase {
|
|||
|
||||
private:
|
||||
MaybeError InitializeImpl() override;
|
||||
MaybeError InitializeSupportedFeaturesImpl() override;
|
||||
void InitializeSupportedFeaturesImpl() override;
|
||||
MaybeError InitializeSupportedLimitsImpl(CombinedLimits* limits) override;
|
||||
|
||||
ResultOrError<Ref<DeviceBase>> CreateDeviceImpl(
|
||||
|
|
Loading…
Reference in New Issue