mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 18:29:23 +00:00
Add a DeviceBase::Initialize that must be called by backends.
Bug: dawn:373 Change-Id: I5213496f4676bedc8e2a88912e89b6e0aacbac37 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18800 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
2d10e954ce
commit
09ee5eb499
@@ -182,7 +182,7 @@ namespace dawn_native { namespace opengl {
|
||||
ResultOrError<DeviceBase*> CreateDeviceImpl(const DeviceDescriptor* descriptor) override {
|
||||
// There is no limit on the number of devices created from this adapter because they can
|
||||
// all share the same backing OpenGL context.
|
||||
return {new Device(this, descriptor, mFunctions)};
|
||||
return Device::Create(this, descriptor, mFunctions);
|
||||
}
|
||||
|
||||
void InitializeSupportedExtensions() {
|
||||
|
||||
@@ -33,18 +33,32 @@
|
||||
|
||||
namespace dawn_native { namespace opengl {
|
||||
|
||||
// static
|
||||
ResultOrError<Device*> Device::Create(AdapterBase* adapter,
|
||||
const DeviceDescriptor* descriptor,
|
||||
const OpenGLFunctions& functions) {
|
||||
Ref<Device> device = AcquireRef(new Device(adapter, descriptor, functions));
|
||||
DAWN_TRY(device->Initialize());
|
||||
return device.Detach();
|
||||
}
|
||||
|
||||
Device::Device(AdapterBase* adapter,
|
||||
const DeviceDescriptor* descriptor,
|
||||
const OpenGLFunctions& functions)
|
||||
: DeviceBase(adapter, descriptor), gl(functions) {
|
||||
InitTogglesFromDriver();
|
||||
mFormatTable = BuildGLFormatTable();
|
||||
}
|
||||
|
||||
Device::~Device() {
|
||||
BaseDestructor();
|
||||
}
|
||||
|
||||
MaybeError Device::Initialize() {
|
||||
InitTogglesFromDriver();
|
||||
mFormatTable = BuildGLFormatTable();
|
||||
|
||||
return DeviceBase::Initialize();
|
||||
}
|
||||
|
||||
void Device::InitTogglesFromDriver() {
|
||||
bool supportsBaseVertex = gl.IsAtLeastGLES(3, 2) || gl.IsAtLeastGL(3, 2);
|
||||
|
||||
|
||||
@@ -34,11 +34,13 @@ namespace dawn_native { namespace opengl {
|
||||
|
||||
class Device : public DeviceBase {
|
||||
public:
|
||||
Device(AdapterBase* adapter,
|
||||
const DeviceDescriptor* descriptor,
|
||||
const OpenGLFunctions& functions);
|
||||
static ResultOrError<Device*> Create(AdapterBase* adapter,
|
||||
const DeviceDescriptor* descriptor,
|
||||
const OpenGLFunctions& functions);
|
||||
~Device();
|
||||
|
||||
MaybeError Initialize();
|
||||
|
||||
// Contains all the OpenGL entry points, glDoFoo is called via device->gl.DoFoo.
|
||||
const OpenGLFunctions gl;
|
||||
|
||||
@@ -63,6 +65,10 @@ namespace dawn_native { namespace opengl {
|
||||
uint64_t size) override;
|
||||
|
||||
private:
|
||||
Device(AdapterBase* adapter,
|
||||
const DeviceDescriptor* descriptor,
|
||||
const OpenGLFunctions& functions);
|
||||
|
||||
ResultOrError<BindGroupBase*> CreateBindGroupImpl(
|
||||
const BindGroupDescriptor* descriptor) override;
|
||||
ResultOrError<BindGroupLayoutBase*> CreateBindGroupLayoutImpl(
|
||||
|
||||
Reference in New Issue
Block a user