Rename nxtProcTable and nxtSetProcs to dawn
This commit is contained in:
parent
b1669e3fa4
commit
be5ca38351
|
@ -84,8 +84,8 @@ For example, NXT can only return objects which prevents mapping buffers or even
|
||||||
|
|
||||||
Other generators include:
|
Other generators include:
|
||||||
|
|
||||||
- A C-header with the definition of nxtProcTable that is the “real” underlying NXT API exposed by the backends.
|
- A C-header with the definition of dawnProcTable that is the “real” underlying NXT API exposed by the backends.
|
||||||
- Glue code generating nxtProcTable for a backend with simple validation included (enum value checks etc.)
|
- Glue code generating dawnProcTable for a backend with simple validation included (enum value checks etc.)
|
||||||
- A mock API for testing
|
- A mock API for testing
|
||||||
|
|
||||||
## Structure of the code
|
## Structure of the code
|
||||||
|
|
|
@ -85,11 +85,11 @@ dawn::Device CreateCppDawnDevice() {
|
||||||
binding->SetWindow(window);
|
binding->SetWindow(window);
|
||||||
|
|
||||||
dawnDevice backendDevice;
|
dawnDevice backendDevice;
|
||||||
nxtProcTable backendProcs;
|
dawnProcTable backendProcs;
|
||||||
binding->GetProcAndDevice(&backendProcs, &backendDevice);
|
binding->GetProcAndDevice(&backendProcs, &backendDevice);
|
||||||
|
|
||||||
dawnDevice cDevice = nullptr;
|
dawnDevice cDevice = nullptr;
|
||||||
nxtProcTable procs;
|
dawnProcTable procs;
|
||||||
switch (cmdBufType) {
|
switch (cmdBufType) {
|
||||||
case CmdBufType::None:
|
case CmdBufType::None:
|
||||||
procs = backendProcs;
|
procs = backendProcs;
|
||||||
|
@ -105,7 +105,7 @@ dawn::Device CreateCppDawnDevice() {
|
||||||
c2sBuf->SetHandler(wireServer);
|
c2sBuf->SetHandler(wireServer);
|
||||||
|
|
||||||
dawnDevice clientDevice;
|
dawnDevice clientDevice;
|
||||||
nxtProcTable clientProcs;
|
dawnProcTable clientProcs;
|
||||||
wireClient = dawn::wire::NewClientDevice(&clientProcs, &clientDevice, c2sBuf);
|
wireClient = dawn::wire::NewClientDevice(&clientProcs, &clientDevice, c2sBuf);
|
||||||
s2cBuf->SetHandler(wireClient);
|
s2cBuf->SetHandler(wireClient);
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ dawn::Device CreateCppDawnDevice() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
nxtSetProcs(&procs);
|
dawnSetProcs(&procs);
|
||||||
procs.deviceSetErrorCallback(cDevice, PrintDeviceError, 0);
|
procs.deviceSetErrorCallback(cDevice, PrintDeviceError, 0);
|
||||||
return dawn::Device::Acquire(cDevice);
|
return dawn::Device::Acquire(cDevice);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,11 +14,11 @@
|
||||||
|
|
||||||
#include "dawn/dawn.h"
|
#include "dawn/dawn.h"
|
||||||
|
|
||||||
static nxtProcTable procs;
|
static dawnProcTable procs;
|
||||||
|
|
||||||
static nxtProcTable nullProcs;
|
static dawnProcTable nullProcs;
|
||||||
|
|
||||||
void nxtSetProcs(const nxtProcTable* procs_) {
|
void dawnSetProcs(const dawnProcTable* procs_) {
|
||||||
if (procs_) {
|
if (procs_) {
|
||||||
procs = *procs_;
|
procs = *procs_;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -68,7 +68,7 @@ extern "C" {
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
struct nxtProcTable_s {
|
struct dawnProcTable_s {
|
||||||
{% for type in by_category["object"] %}
|
{% for type in by_category["object"] %}
|
||||||
{% for method in native_methods(type) %}
|
{% for method in native_methods(type) %}
|
||||||
{{as_cProc(type.name, method.name)}} {{as_varName(type.name, method.name)}};
|
{{as_cProc(type.name, method.name)}} {{as_varName(type.name, method.name)}};
|
||||||
|
@ -76,12 +76,12 @@ struct nxtProcTable_s {
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
};
|
};
|
||||||
typedef struct nxtProcTable_s nxtProcTable;
|
typedef struct dawnProcTable_s dawnProcTable;
|
||||||
|
|
||||||
// Stuff below is for convenience and will forward calls to a static nxtProcTable.
|
// Stuff below is for convenience and will forward calls to a static dawnProcTable.
|
||||||
|
|
||||||
// Set which nxtProcTable will be used
|
// Set which dawnProcTable will be used
|
||||||
void nxtSetProcs(const nxtProcTable* procs);
|
void dawnSetProcs(const dawnProcTable* procs);
|
||||||
|
|
||||||
{% for type in by_category["object"] %}
|
{% for type in by_category["object"] %}
|
||||||
// Methods of {{type.name.CamelCase()}}
|
// Methods of {{type.name.CamelCase()}}
|
||||||
|
|
|
@ -183,8 +183,8 @@ namespace {{namespace}} {
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
}
|
}
|
||||||
|
|
||||||
nxtProcTable GetNonValidatingProcs() {
|
dawnProcTable GetNonValidatingProcs() {
|
||||||
nxtProcTable table;
|
dawnProcTable table;
|
||||||
{% for type in by_category["object"] %}
|
{% for type in by_category["object"] %}
|
||||||
{% for method in native_methods(type) %}
|
{% for method in native_methods(type) %}
|
||||||
table.{{as_varName(type.name, method.name)}} = reinterpret_cast<{{as_cProc(type.name, method.name)}}>(NonValidating{{as_MethodSuffix(type.name, method.name)}});
|
table.{{as_varName(type.name, method.name)}} = reinterpret_cast<{{as_cProc(type.name, method.name)}}>(NonValidating{{as_MethodSuffix(type.name, method.name)}});
|
||||||
|
@ -193,8 +193,8 @@ namespace {{namespace}} {
|
||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
|
|
||||||
nxtProcTable GetValidatingProcs() {
|
dawnProcTable GetValidatingProcs() {
|
||||||
nxtProcTable table;
|
dawnProcTable table;
|
||||||
{% for type in by_category["object"] %}
|
{% for type in by_category["object"] %}
|
||||||
{% for method in native_methods(type) %}
|
{% for method in native_methods(type) %}
|
||||||
table.{{as_varName(type.name, method.name)}} = reinterpret_cast<{{as_cProc(type.name, method.name)}}>(Validating{{as_MethodSuffix(type.name, method.name)}});
|
table.{{as_varName(type.name, method.name)}} = reinterpret_cast<{{as_cProc(type.name, method.name)}}>(Validating{{as_MethodSuffix(type.name, method.name)}});
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace {
|
||||||
ProcTableAsClass::~ProcTableAsClass() {
|
ProcTableAsClass::~ProcTableAsClass() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcTableAsClass::GetProcTableAndDevice(nxtProcTable* table, dawnDevice* device) {
|
void ProcTableAsClass::GetProcTableAndDevice(dawnProcTable* table, dawnDevice* device) {
|
||||||
*device = GetNewDevice();
|
*device = GetNewDevice();
|
||||||
|
|
||||||
{% for type in by_category["object"] %}
|
{% for type in by_category["object"] %}
|
||||||
|
|
|
@ -27,7 +27,7 @@ class ProcTableAsClass {
|
||||||
public:
|
public:
|
||||||
virtual ~ProcTableAsClass();
|
virtual ~ProcTableAsClass();
|
||||||
|
|
||||||
void GetProcTableAndDevice(nxtProcTable* table, dawnDevice* device);
|
void GetProcTableAndDevice(dawnProcTable* table, dawnDevice* device);
|
||||||
|
|
||||||
// Creates an object that can be returned by a mocked call as in WillOnce(Return(foo)).
|
// Creates an object that can be returned by a mocked call as in WillOnce(Return(foo)).
|
||||||
// It returns an object of the write type that isn't equal to any previously returned object.
|
// It returns an object of the write type that isn't equal to any previously returned object.
|
||||||
|
|
|
@ -416,8 +416,8 @@ namespace dawn { namespace wire {
|
||||||
// the autogenerated one, and that will have to call Client{{suffix}}
|
// the autogenerated one, and that will have to call Client{{suffix}}
|
||||||
{% set proxied_commands = ["BufferUnmap"] %}
|
{% set proxied_commands = ["BufferUnmap"] %}
|
||||||
|
|
||||||
nxtProcTable GetProcs() {
|
dawnProcTable GetProcs() {
|
||||||
nxtProcTable table;
|
dawnProcTable table;
|
||||||
{% for type in by_category["object"] %}
|
{% for type in by_category["object"] %}
|
||||||
{% for method in native_methods(type) %}
|
{% for method in native_methods(type) %}
|
||||||
{% set suffix = as_MethodSuffix(type.name, method.name) %}
|
{% set suffix = as_MethodSuffix(type.name, method.name) %}
|
||||||
|
@ -664,7 +664,7 @@ namespace dawn { namespace wire {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandHandler* NewClientDevice(nxtProcTable* procs, dawnDevice* device, CommandSerializer* serializer) {
|
CommandHandler* NewClientDevice(dawnProcTable* procs, dawnDevice* device, CommandSerializer* serializer) {
|
||||||
auto clientDevice = new client::Device(serializer);
|
auto clientDevice = new client::Device(serializer);
|
||||||
|
|
||||||
*device = reinterpret_cast<dawnDeviceImpl*>(clientDevice);
|
*device = reinterpret_cast<dawnDeviceImpl*>(clientDevice);
|
||||||
|
|
|
@ -205,7 +205,7 @@ namespace dawn { namespace wire {
|
||||||
|
|
||||||
class Server : public CommandHandler, public ObjectIdResolver {
|
class Server : public CommandHandler, public ObjectIdResolver {
|
||||||
public:
|
public:
|
||||||
Server(dawnDevice device, const nxtProcTable& procs, CommandSerializer* serializer)
|
Server(dawnDevice device, const dawnProcTable& procs, CommandSerializer* serializer)
|
||||||
: mProcs(procs), mSerializer(serializer) {
|
: mProcs(procs), mSerializer(serializer) {
|
||||||
//* The client-server knowledge is bootstrapped with device 1.
|
//* The client-server knowledge is bootstrapped with device 1.
|
||||||
auto* deviceData = mKnownDevice.Allocate(1);
|
auto* deviceData = mKnownDevice.Allocate(1);
|
||||||
|
@ -346,7 +346,7 @@ namespace dawn { namespace wire {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nxtProcTable mProcs;
|
dawnProcTable mProcs;
|
||||||
CommandSerializer* mSerializer = nullptr;
|
CommandSerializer* mSerializer = nullptr;
|
||||||
|
|
||||||
ServerAllocator mAllocator;
|
ServerAllocator mAllocator;
|
||||||
|
@ -622,7 +622,7 @@ namespace dawn { namespace wire {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandHandler* NewServerCommandHandler(dawnDevice device, const nxtProcTable& procs, CommandSerializer* serializer) {
|
CommandHandler* NewServerCommandHandler(dawnDevice device, const dawnProcTable& procs, CommandSerializer* serializer) {
|
||||||
return new server::Server(device, procs, serializer);
|
return new server::Server(device, procs, serializer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,10 +40,10 @@
|
||||||
|
|
||||||
namespace backend { namespace d3d12 {
|
namespace backend { namespace d3d12 {
|
||||||
|
|
||||||
nxtProcTable GetNonValidatingProcs();
|
dawnProcTable GetNonValidatingProcs();
|
||||||
nxtProcTable GetValidatingProcs();
|
dawnProcTable GetValidatingProcs();
|
||||||
|
|
||||||
void Init(nxtProcTable* procs, dawnDevice* device) {
|
void Init(dawnProcTable* procs, dawnDevice* device) {
|
||||||
*device = nullptr;
|
*device = nullptr;
|
||||||
*procs = GetValidatingProcs();
|
*procs = GetValidatingProcs();
|
||||||
*device = reinterpret_cast<dawnDevice>(new Device());
|
*device = reinterpret_cast<dawnDevice>(new Device());
|
||||||
|
|
|
@ -35,10 +35,10 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
namespace backend { namespace metal {
|
namespace backend { namespace metal {
|
||||||
nxtProcTable GetNonValidatingProcs();
|
dawnProcTable GetNonValidatingProcs();
|
||||||
nxtProcTable GetValidatingProcs();
|
dawnProcTable GetValidatingProcs();
|
||||||
|
|
||||||
void Init(id<MTLDevice> metalDevice, nxtProcTable* procs, dawnDevice* device) {
|
void Init(id<MTLDevice> metalDevice, dawnProcTable* procs, dawnDevice* device) {
|
||||||
*device = nullptr;
|
*device = nullptr;
|
||||||
|
|
||||||
*procs = GetValidatingProcs();
|
*procs = GetValidatingProcs();
|
||||||
|
|
|
@ -20,10 +20,10 @@
|
||||||
|
|
||||||
namespace backend { namespace null {
|
namespace backend { namespace null {
|
||||||
|
|
||||||
nxtProcTable GetNonValidatingProcs();
|
dawnProcTable GetNonValidatingProcs();
|
||||||
nxtProcTable GetValidatingProcs();
|
dawnProcTable GetValidatingProcs();
|
||||||
|
|
||||||
void Init(nxtProcTable* procs, dawnDevice* device) {
|
void Init(dawnProcTable* procs, dawnDevice* device) {
|
||||||
*procs = GetValidatingProcs();
|
*procs = GetValidatingProcs();
|
||||||
*device = reinterpret_cast<dawnDevice>(new Device);
|
*device = reinterpret_cast<dawnDevice>(new Device);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,10 +32,10 @@
|
||||||
#include "backend/opengl/TextureGL.h"
|
#include "backend/opengl/TextureGL.h"
|
||||||
|
|
||||||
namespace backend { namespace opengl {
|
namespace backend { namespace opengl {
|
||||||
nxtProcTable GetNonValidatingProcs();
|
dawnProcTable GetNonValidatingProcs();
|
||||||
nxtProcTable GetValidatingProcs();
|
dawnProcTable GetValidatingProcs();
|
||||||
|
|
||||||
void Init(void* (*getProc)(const char*), nxtProcTable* procs, dawnDevice* device) {
|
void Init(void* (*getProc)(const char*), dawnProcTable* procs, dawnDevice* device) {
|
||||||
*device = nullptr;
|
*device = nullptr;
|
||||||
|
|
||||||
gladLoadGLLoader(reinterpret_cast<GLADloadproc>(getProc));
|
gladLoadGLLoader(reinterpret_cast<GLADloadproc>(getProc));
|
||||||
|
|
|
@ -52,10 +52,10 @@ const char kVulkanLibName[] = "vulkan-1.dll";
|
||||||
|
|
||||||
namespace backend { namespace vulkan {
|
namespace backend { namespace vulkan {
|
||||||
|
|
||||||
nxtProcTable GetNonValidatingProcs();
|
dawnProcTable GetNonValidatingProcs();
|
||||||
nxtProcTable GetValidatingProcs();
|
dawnProcTable GetValidatingProcs();
|
||||||
|
|
||||||
void Init(nxtProcTable* procs,
|
void Init(dawnProcTable* procs,
|
||||||
dawnDevice* device,
|
dawnDevice* device,
|
||||||
const std::vector<const char*>& requiredInstanceExtensions) {
|
const std::vector<const char*>& requiredInstanceExtensions) {
|
||||||
*procs = GetValidatingProcs();
|
*procs = GetValidatingProcs();
|
||||||
|
|
|
@ -106,7 +106,7 @@ NXTTest::~NXTTest() {
|
||||||
delete mBinding;
|
delete mBinding;
|
||||||
mBinding = nullptr;
|
mBinding = nullptr;
|
||||||
|
|
||||||
nxtSetProcs(nullptr);
|
dawnSetProcs(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NXTTest::IsD3D12() const {
|
bool NXTTest::IsD3D12() const {
|
||||||
|
@ -137,12 +137,12 @@ void NXTTest::SetUp() {
|
||||||
mBinding->SetWindow(testWindow);
|
mBinding->SetWindow(testWindow);
|
||||||
|
|
||||||
dawnDevice backendDevice;
|
dawnDevice backendDevice;
|
||||||
nxtProcTable backendProcs;
|
dawnProcTable backendProcs;
|
||||||
mBinding->GetProcAndDevice(&backendProcs, &backendDevice);
|
mBinding->GetProcAndDevice(&backendProcs, &backendDevice);
|
||||||
|
|
||||||
// Choose whether to use the backend procs and devices directly, or set up the wire.
|
// Choose whether to use the backend procs and devices directly, or set up the wire.
|
||||||
dawnDevice cDevice = nullptr;
|
dawnDevice cDevice = nullptr;
|
||||||
nxtProcTable procs;
|
dawnProcTable procs;
|
||||||
|
|
||||||
if (gTestUsesWire) {
|
if (gTestUsesWire) {
|
||||||
mC2sBuf = new dawn::wire::TerribleCommandBuffer();
|
mC2sBuf = new dawn::wire::TerribleCommandBuffer();
|
||||||
|
@ -152,7 +152,7 @@ void NXTTest::SetUp() {
|
||||||
mC2sBuf->SetHandler(mWireServer);
|
mC2sBuf->SetHandler(mWireServer);
|
||||||
|
|
||||||
dawnDevice clientDevice;
|
dawnDevice clientDevice;
|
||||||
nxtProcTable clientProcs;
|
dawnProcTable clientProcs;
|
||||||
mWireClient = dawn::wire::NewClientDevice(&clientProcs, &clientDevice, mC2sBuf);
|
mWireClient = dawn::wire::NewClientDevice(&clientProcs, &clientDevice, mC2sBuf);
|
||||||
mS2cBuf->SetHandler(mWireClient);
|
mS2cBuf->SetHandler(mWireClient);
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ void NXTTest::SetUp() {
|
||||||
|
|
||||||
// Set up the device and queue because all tests need them, and NXTTest needs them too for the
|
// Set up the device and queue because all tests need them, and NXTTest needs them too for the
|
||||||
// deferred expectations.
|
// deferred expectations.
|
||||||
nxtSetProcs(&procs);
|
dawnSetProcs(&procs);
|
||||||
device = dawn::Device::Acquire(cDevice);
|
device = dawn::Device::Acquire(cDevice);
|
||||||
queue = device.CreateQueue();
|
queue = device.CreateQueue();
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ class WireTestsBase : public Test {
|
||||||
mockBufferMapReadCallback = new MockBufferMapReadCallback;
|
mockBufferMapReadCallback = new MockBufferMapReadCallback;
|
||||||
mockBufferMapWriteCallback = new MockBufferMapWriteCallback;
|
mockBufferMapWriteCallback = new MockBufferMapWriteCallback;
|
||||||
|
|
||||||
nxtProcTable mockProcs;
|
dawnProcTable mockProcs;
|
||||||
dawnDevice mockDevice;
|
dawnDevice mockDevice;
|
||||||
api.GetProcTableAndDevice(&mockProcs, &mockDevice);
|
api.GetProcTableAndDevice(&mockProcs, &mockDevice);
|
||||||
|
|
||||||
|
@ -144,16 +144,16 @@ class WireTestsBase : public Test {
|
||||||
mWireServer = NewServerCommandHandler(mockDevice, mockProcs, mS2cBuf);
|
mWireServer = NewServerCommandHandler(mockDevice, mockProcs, mS2cBuf);
|
||||||
mC2sBuf->SetHandler(mWireServer);
|
mC2sBuf->SetHandler(mWireServer);
|
||||||
|
|
||||||
nxtProcTable clientProcs;
|
dawnProcTable clientProcs;
|
||||||
mWireClient = NewClientDevice(&clientProcs, &device, mC2sBuf);
|
mWireClient = NewClientDevice(&clientProcs, &device, mC2sBuf);
|
||||||
nxtSetProcs(&clientProcs);
|
dawnSetProcs(&clientProcs);
|
||||||
mS2cBuf->SetHandler(mWireClient);
|
mS2cBuf->SetHandler(mWireClient);
|
||||||
|
|
||||||
apiDevice = mockDevice;
|
apiDevice = mockDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TearDown() override {
|
void TearDown() override {
|
||||||
nxtSetProcs(nullptr);
|
dawnSetProcs(nullptr);
|
||||||
delete mWireServer;
|
delete mWireServer;
|
||||||
delete mWireClient;
|
delete mWireClient;
|
||||||
delete mC2sBuf;
|
delete mC2sBuf;
|
||||||
|
|
|
@ -18,16 +18,16 @@
|
||||||
|
|
||||||
namespace backend {
|
namespace backend {
|
||||||
namespace null {
|
namespace null {
|
||||||
void Init(nxtProcTable* procs, dawnDevice* device);
|
void Init(dawnProcTable* procs, dawnDevice* device);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ValidationTest::ValidationTest() {
|
ValidationTest::ValidationTest() {
|
||||||
nxtProcTable procs;
|
dawnProcTable procs;
|
||||||
dawnDevice cDevice;
|
dawnDevice cDevice;
|
||||||
backend::null::Init(&procs, &cDevice);
|
backend::null::Init(&procs, &cDevice);
|
||||||
|
|
||||||
nxtSetProcs(&procs);
|
dawnSetProcs(&procs);
|
||||||
device = dawn::Device::Acquire(cDevice);
|
device = dawn::Device::Acquire(cDevice);
|
||||||
|
|
||||||
device.SetErrorCallback(ValidationTest::OnDeviceError, static_cast<dawnCallbackUserdata>(reinterpret_cast<uintptr_t>(this)));
|
device.SetErrorCallback(ValidationTest::OnDeviceError, static_cast<dawnCallbackUserdata>(reinterpret_cast<uintptr_t>(this)));
|
||||||
|
@ -37,7 +37,7 @@ ValidationTest::~ValidationTest() {
|
||||||
// We need to destroy NXT objects before setting the procs to null otherwise the nxt*Release
|
// We need to destroy NXT objects before setting the procs to null otherwise the nxt*Release
|
||||||
// will call a nullptr
|
// will call a nullptr
|
||||||
device = dawn::Device();
|
device = dawn::Device();
|
||||||
nxtSetProcs(nullptr);
|
dawnSetProcs(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ValidationTest::TearDown() {
|
void ValidationTest::TearDown() {
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <dawn/dawn_wsi.h>
|
#include <dawn/dawn_wsi.h>
|
||||||
|
|
||||||
struct GLFWwindow;
|
struct GLFWwindow;
|
||||||
typedef struct nxtProcTable_s nxtProcTable;
|
typedef struct dawnProcTable_s dawnProcTable;
|
||||||
typedef struct dawnDeviceImpl* dawnDevice;
|
typedef struct dawnDeviceImpl* dawnDevice;
|
||||||
|
|
||||||
namespace utils {
|
namespace utils {
|
||||||
|
@ -36,7 +36,7 @@ namespace utils {
|
||||||
virtual ~BackendBinding() = default;
|
virtual ~BackendBinding() = default;
|
||||||
|
|
||||||
virtual void SetupGLFWWindowHints() = 0;
|
virtual void SetupGLFWWindowHints() = 0;
|
||||||
virtual void GetProcAndDevice(nxtProcTable* procs, dawnDevice* device) = 0;
|
virtual void GetProcAndDevice(dawnProcTable* procs, dawnDevice* device) = 0;
|
||||||
virtual uint64_t GetSwapChainImplementation() = 0;
|
virtual uint64_t GetSwapChainImplementation() = 0;
|
||||||
virtual dawnTextureFormat GetPreferredSwapChainTextureFormat() = 0;
|
virtual dawnTextureFormat GetPreferredSwapChainTextureFormat() = 0;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "GLFW/glfw3native.h"
|
#include "GLFW/glfw3native.h"
|
||||||
|
|
||||||
namespace backend { namespace d3d12 {
|
namespace backend { namespace d3d12 {
|
||||||
void Init(nxtProcTable* procs, dawnDevice* device);
|
void Init(dawnProcTable* procs, dawnDevice* device);
|
||||||
|
|
||||||
dawnSwapChainImplementation CreateNativeSwapChainImpl(dawnDevice device, HWND window);
|
dawnSwapChainImplementation CreateNativeSwapChainImpl(dawnDevice device, HWND window);
|
||||||
dawnTextureFormat GetNativeSwapChainPreferredFormat(
|
dawnTextureFormat GetNativeSwapChainPreferredFormat(
|
||||||
|
@ -37,7 +37,7 @@ namespace utils {
|
||||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetProcAndDevice(nxtProcTable* procs, dawnDevice* device) override {
|
void GetProcAndDevice(dawnProcTable* procs, dawnDevice* device) override {
|
||||||
backend::d3d12::Init(procs, device);
|
backend::d3d12::Init(procs, device);
|
||||||
mBackendDevice = *device;
|
mBackendDevice = *device;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#import <QuartzCore/CAMetalLayer.h>
|
#import <QuartzCore/CAMetalLayer.h>
|
||||||
|
|
||||||
namespace backend { namespace metal {
|
namespace backend { namespace metal {
|
||||||
void Init(id<MTLDevice> metalDevice, nxtProcTable* procs, dawnDevice* device);
|
void Init(id<MTLDevice> metalDevice, dawnProcTable* procs, dawnDevice* device);
|
||||||
void SetNextDrawable(dawnDevice device, id<CAMetalDrawable> drawable);
|
void SetNextDrawable(dawnDevice device, id<CAMetalDrawable> drawable);
|
||||||
void Present(dawnDevice device);
|
void Present(dawnDevice device);
|
||||||
}}
|
}}
|
||||||
|
@ -114,7 +114,7 @@ namespace utils {
|
||||||
void SetupGLFWWindowHints() override {
|
void SetupGLFWWindowHints() override {
|
||||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
||||||
}
|
}
|
||||||
void GetProcAndDevice(nxtProcTable* procs, dawnDevice* device) override {
|
void GetProcAndDevice(dawnProcTable* procs, dawnDevice* device) override {
|
||||||
mMetalDevice = MTLCreateSystemDefaultDevice();
|
mMetalDevice = MTLCreateSystemDefaultDevice();
|
||||||
|
|
||||||
backend::metal::Init(mMetalDevice, procs, device);
|
backend::metal::Init(mMetalDevice, procs, device);
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include "utils/BackendBinding.h"
|
#include "utils/BackendBinding.h"
|
||||||
|
|
||||||
namespace backend { namespace null {
|
namespace backend { namespace null {
|
||||||
void Init(nxtProcTable* procs, dawnDevice* device);
|
void Init(dawnProcTable* procs, dawnDevice* device);
|
||||||
}} // namespace backend::null
|
}} // namespace backend::null
|
||||||
|
|
||||||
namespace utils {
|
namespace utils {
|
||||||
|
@ -24,7 +24,7 @@ namespace utils {
|
||||||
public:
|
public:
|
||||||
void SetupGLFWWindowHints() override {
|
void SetupGLFWWindowHints() override {
|
||||||
}
|
}
|
||||||
void GetProcAndDevice(nxtProcTable* procs, dawnDevice* device) override {
|
void GetProcAndDevice(dawnProcTable* procs, dawnDevice* device) override {
|
||||||
backend::null::Init(procs, device);
|
backend::null::Init(procs, device);
|
||||||
}
|
}
|
||||||
uint64_t GetSwapChainImplementation() override {
|
uint64_t GetSwapChainImplementation() override {
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include "GLFW/glfw3.h"
|
#include "GLFW/glfw3.h"
|
||||||
|
|
||||||
namespace backend { namespace opengl {
|
namespace backend { namespace opengl {
|
||||||
void Init(void* (*getProc)(const char*), nxtProcTable* procs, dawnDevice* device);
|
void Init(void* (*getProc)(const char*), dawnProcTable* procs, dawnDevice* device);
|
||||||
}} // namespace backend::opengl
|
}} // namespace backend::opengl
|
||||||
|
|
||||||
namespace utils {
|
namespace utils {
|
||||||
|
@ -111,7 +111,7 @@ namespace utils {
|
||||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
void GetProcAndDevice(nxtProcTable* procs, dawnDevice* device) override {
|
void GetProcAndDevice(dawnProcTable* procs, dawnDevice* device) override {
|
||||||
glfwMakeContextCurrent(mWindow);
|
glfwMakeContextCurrent(mWindow);
|
||||||
backend::opengl::Init(reinterpret_cast<void* (*)(const char*)>(glfwGetProcAddress),
|
backend::opengl::Init(reinterpret_cast<void* (*)(const char*)>(glfwGetProcAddress),
|
||||||
procs, device);
|
procs, device);
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace backend { namespace vulkan {
|
namespace backend { namespace vulkan {
|
||||||
void Init(nxtProcTable* procs,
|
void Init(dawnProcTable* procs,
|
||||||
dawnDevice* device,
|
dawnDevice* device,
|
||||||
const std::vector<const char*>& requiredInstanceExtensions);
|
const std::vector<const char*>& requiredInstanceExtensions);
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ namespace utils {
|
||||||
void SetupGLFWWindowHints() override {
|
void SetupGLFWWindowHints() override {
|
||||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
||||||
}
|
}
|
||||||
void GetProcAndDevice(nxtProcTable* procs, dawnDevice* device) override {
|
void GetProcAndDevice(dawnProcTable* procs, dawnDevice* device) override {
|
||||||
uint32_t extensionCount = 0;
|
uint32_t extensionCount = 0;
|
||||||
const char** glfwInstanceExtensions =
|
const char** glfwInstanceExtensions =
|
||||||
glfwGetRequiredInstanceExtensions(&extensionCount);
|
glfwGetRequiredInstanceExtensions(&extensionCount);
|
||||||
|
|
|
@ -34,11 +34,11 @@ namespace dawn { namespace wire {
|
||||||
virtual const char* HandleCommands(const char* commands, size_t size) = 0;
|
virtual const char* HandleCommands(const char* commands, size_t size) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
CommandHandler* NewClientDevice(nxtProcTable* procs,
|
CommandHandler* NewClientDevice(dawnProcTable* procs,
|
||||||
dawnDevice* device,
|
dawnDevice* device,
|
||||||
CommandSerializer* serializer);
|
CommandSerializer* serializer);
|
||||||
CommandHandler* NewServerCommandHandler(dawnDevice device,
|
CommandHandler* NewServerCommandHandler(dawnDevice device,
|
||||||
const nxtProcTable& procs,
|
const dawnProcTable& procs,
|
||||||
CommandSerializer* serializer);
|
CommandSerializer* serializer);
|
||||||
|
|
||||||
}} // namespace dawn::wire
|
}} // namespace dawn::wire
|
||||||
|
|
Loading…
Reference in New Issue