mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-13 15:16:16 +00:00
Implement the device error callback.
This adds support for "natively defined" API types like callbacks that will have to be implemented manually for each target language. Also this splits the concept of "native method" into a set of native methods per language. Removes the "Synchronous error" concept that was used to make builders work in the maybe Monad, this will have to be reinroduced with builder callbacks.
This commit is contained in:
committed by
Corentin Wallez
parent
682a8250b3
commit
4b410a33ca
@@ -30,11 +30,6 @@
|
||||
|
||||
namespace backend {
|
||||
|
||||
void RegisterSynchronousErrorCallback(nxtDevice device, ErrorCallback callback, void* userData) {
|
||||
auto deviceBase = reinterpret_cast<DeviceBase*>(device);
|
||||
deviceBase->RegisterErrorCallback(callback, userData);
|
||||
}
|
||||
|
||||
// DeviceBase::Caches
|
||||
|
||||
// The caches are unordered_sets of pointers with special hash and compare functions
|
||||
@@ -57,13 +52,13 @@ namespace backend {
|
||||
|
||||
void DeviceBase::HandleError(const char* message) {
|
||||
if (errorCallback) {
|
||||
errorCallback(message, errorUserData);
|
||||
errorCallback(message, errorUserdata);
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceBase::RegisterErrorCallback(ErrorCallback callback, void* userData) {
|
||||
void DeviceBase::SetErrorCallback(nxt::DeviceErrorCallback callback, nxt::CallbackUserdata userdata) {
|
||||
this->errorCallback = callback;
|
||||
this->errorUserData = userData;
|
||||
this->errorUserdata = userdata;
|
||||
}
|
||||
|
||||
BindGroupLayoutBase* DeviceBase::GetOrCreateBindGroupLayout(const BindGroupLayoutBase* blueprint, BindGroupLayoutBuilder* builder) {
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace backend {
|
||||
~DeviceBase();
|
||||
|
||||
void HandleError(const char* message);
|
||||
void RegisterErrorCallback(ErrorCallback callback, void* userData);
|
||||
void SetErrorCallback(nxt::DeviceErrorCallback, nxt::CallbackUserdata userdata);
|
||||
|
||||
virtual BindGroupBase* CreateBindGroup(BindGroupBuilder* builder) = 0;
|
||||
virtual BindGroupLayoutBase* CreateBindGroupLayout(BindGroupLayoutBuilder* builder) = 0;
|
||||
@@ -85,8 +85,8 @@ namespace backend {
|
||||
struct Caches;
|
||||
Caches* caches = nullptr;
|
||||
|
||||
ErrorCallback errorCallback = nullptr;
|
||||
void* errorUserData = nullptr;
|
||||
nxt::DeviceErrorCallback errorCallback = nullptr;
|
||||
nxt::CallbackUserdata errorUserdata;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user