Zhaoming Jiang 981d5a6f08 Dawn: Refactor adapter features, part 1
This CL make adapter base holds it supported features set as private
instead of protected and provide a method to set features enabled. This
CL also rename SetSupportedFeatures in null adapter to
SetSupportedFeaturesForTesting.
This is a pre-CL for implementing UseDXC as instance toggle, which may
require further refactor and adapter features logic to handle the toggles.

Bug: dawn:1495
Change-Id: I0a07e5653b43f18278cb4a2fe90985cc90b66068
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124421
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-03-16 19:06:33 +00:00

56 lines
2.0 KiB
C++

// Copyright 2022 The Dawn Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SRC_DAWN_NATIVE_OPENGL_ADAPTERGL_H_
#define SRC_DAWN_NATIVE_OPENGL_ADAPTERGL_H_
#include "dawn/native/Adapter.h"
#include "dawn/native/opengl/EGLFunctions.h"
#include "dawn/native/opengl/OpenGLFunctions.h"
namespace dawn::native::opengl {
class Adapter : public AdapterBase {
public:
Adapter(InstanceBase* instance,
wgpu::BackendType backendType,
const TogglesState& adapterToggle);
MaybeError InitializeGLFunctions(void* (*getProc)(const char*));
~Adapter() override = default;
// AdapterBase Implementation
bool SupportsExternalImages() const override;
private:
MaybeError InitializeImpl() override;
void InitializeSupportedFeaturesImpl() override;
MaybeError InitializeSupportedLimitsImpl(CombinedLimits* limits) override;
MaybeError ValidateFeatureSupportedWithTogglesImpl(wgpu::FeatureName feature,
const TogglesState& toggles) const override;
void SetupBackendDeviceToggles(TogglesState* deviceToggles) const override;
ResultOrError<Ref<DeviceBase>> CreateDeviceImpl(const DeviceDescriptor* descriptor,
const TogglesState& deviceToggles) override;
OpenGLFunctions mFunctions;
EGLFunctions mEGLFunctions;
};
} // namespace dawn::native::opengl
#endif // SRC_DAWN_NATIVE_OPENGL_ADAPTERGL_H_