mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-06-05 22:23:29 +00:00
Rename SetErrorCallback to SetUncapturedErrorCallback
This is to better match the naming of the uncapturederror event in WebGPU. Bug: dawn:153 Change-Id: Ic2bc1f46bf3d1f0d14cbd5cb8ea6e54d1679f987 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10542 Commit-Queue: Austin Eng <enga@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
cb0cb658d4
commit
45ea7e66bf
@ -522,7 +522,7 @@
|
|||||||
"name": "tick"
|
"name": "tick"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "set error callback",
|
"name": "set uncaptured error callback",
|
||||||
"args": [
|
"args": [
|
||||||
{"name": "callback", "type": "error callback"},
|
{"name": "callback", "type": "error callback"},
|
||||||
{"name": "userdata", "type": "void", "annotation": "*"}
|
{"name": "userdata", "type": "void", "annotation": "*"}
|
||||||
|
@ -66,7 +66,7 @@
|
|||||||
{ "name": "request serial", "type": "uint32_t" },
|
{ "name": "request serial", "type": "uint32_t" },
|
||||||
{ "name": "status", "type": "uint32_t" }
|
{ "name": "status", "type": "uint32_t" }
|
||||||
],
|
],
|
||||||
"device error callback": [
|
"device uncaptured error callback": [
|
||||||
{ "name": "type", "type": "error type"},
|
{ "name": "type", "type": "error type"},
|
||||||
{ "name": "message", "type": "char", "annotation": "const*", "length": "strlen" }
|
{ "name": "message", "type": "char", "annotation": "const*", "length": "strlen" }
|
||||||
],
|
],
|
||||||
|
@ -161,7 +161,7 @@ dawn::Device CreateCppDawnDevice() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dawnSetProcs(&procs);
|
dawnSetProcs(&procs);
|
||||||
procs.deviceSetErrorCallback(cDevice, PrintDeviceError, nullptr);
|
procs.deviceSetUncapturedErrorCallback(cDevice, PrintDeviceError, nullptr);
|
||||||
return dawn::Device::Acquire(cDevice);
|
return dawn::Device::Acquire(cDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,14 +50,14 @@ void ProcTableAsClass::GetProcTableAndDevice(DawnProcTable* table, DawnDevice* d
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcTableAsClass::DeviceSetErrorCallback(DawnDevice self,
|
void ProcTableAsClass::DeviceSetUncapturedErrorCallback(DawnDevice self,
|
||||||
DawnErrorCallback callback,
|
DawnErrorCallback callback,
|
||||||
void* userdata) {
|
void* userdata) {
|
||||||
auto object = reinterpret_cast<ProcTableAsClass::Object*>(self);
|
auto object = reinterpret_cast<ProcTableAsClass::Object*>(self);
|
||||||
object->deviceErrorCallback = callback;
|
object->deviceErrorCallback = callback;
|
||||||
object->userdata1 = userdata;
|
object->userdata1 = userdata;
|
||||||
|
|
||||||
OnDeviceSetErrorCallback(self, callback, userdata);
|
OnDeviceSetUncapturedErrorCallback(self, callback, userdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcTableAsClass::DeviceCreateBufferMappedAsync(DawnDevice self,
|
void ProcTableAsClass::DeviceCreateBufferMappedAsync(DawnDevice self,
|
||||||
|
@ -51,7 +51,7 @@ class ProcTableAsClass {
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
// Stores callback and userdata and calls the On* methods
|
// Stores callback and userdata and calls the On* methods
|
||||||
void DeviceSetErrorCallback(DawnDevice self,
|
void DeviceSetUncapturedErrorCallback(DawnDevice self,
|
||||||
DawnErrorCallback callback,
|
DawnErrorCallback callback,
|
||||||
void* userdata);
|
void* userdata);
|
||||||
void DeviceCreateBufferMappedAsync(DawnDevice self,
|
void DeviceCreateBufferMappedAsync(DawnDevice self,
|
||||||
@ -70,7 +70,7 @@ class ProcTableAsClass {
|
|||||||
void* userdata);
|
void* userdata);
|
||||||
|
|
||||||
// Special cased mockable methods
|
// Special cased mockable methods
|
||||||
virtual void OnDeviceSetErrorCallback(DawnDevice device,
|
virtual void OnDeviceSetUncapturedErrorCallback(DawnDevice device,
|
||||||
DawnErrorCallback callback,
|
DawnErrorCallback callback,
|
||||||
void* userdata) = 0;
|
void* userdata) = 0;
|
||||||
virtual void OnDeviceCreateBufferMappedAsyncCallback(DawnDevice self,
|
virtual void OnDeviceCreateBufferMappedAsyncCallback(DawnDevice self,
|
||||||
@ -133,7 +133,7 @@ class MockProcTable : public ProcTableAsClass {
|
|||||||
MOCK_METHOD1({{as_MethodSuffix(type.name, Name("release"))}}, void({{as_cType(type.name)}} self));
|
MOCK_METHOD1({{as_MethodSuffix(type.name, Name("release"))}}, void({{as_cType(type.name)}} self));
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
MOCK_METHOD3(OnDeviceSetErrorCallback, void(DawnDevice device, DawnErrorCallback callback, void* userdata));
|
MOCK_METHOD3(OnDeviceSetUncapturedErrorCallback, void(DawnDevice device, DawnErrorCallback callback, void* userdata));
|
||||||
MOCK_METHOD4(OnDeviceCreateBufferMappedAsyncCallback, void(DawnDevice device, const DawnBufferDescriptor* descriptor, DawnBufferCreateMappedCallback callback, void* userdata));
|
MOCK_METHOD4(OnDeviceCreateBufferMappedAsyncCallback, void(DawnDevice device, const DawnBufferDescriptor* descriptor, DawnBufferCreateMappedCallback callback, void* userdata));
|
||||||
MOCK_METHOD3(OnBufferMapReadAsyncCallback, void(DawnBuffer buffer, DawnBufferMapReadCallback callback, void* userdata));
|
MOCK_METHOD3(OnBufferMapReadAsyncCallback, void(DawnBuffer buffer, DawnBufferMapReadCallback callback, void* userdata));
|
||||||
MOCK_METHOD3(OnBufferMapWriteAsyncCallback, void(DawnBuffer buffer, DawnBufferMapWriteCallback callback, void* userdata));
|
MOCK_METHOD3(OnBufferMapWriteAsyncCallback, void(DawnBuffer buffer, DawnBufferMapWriteCallback callback, void* userdata));
|
||||||
|
@ -94,7 +94,7 @@ namespace dawn_native {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceBase::SetErrorCallback(dawn::ErrorCallback callback, void* userdata) {
|
void DeviceBase::SetUncapturedErrorCallback(dawn::ErrorCallback callback, void* userdata) {
|
||||||
mErrorCallback = callback;
|
mErrorCallback = callback;
|
||||||
mErrorUserdata = userdata;
|
mErrorUserdata = userdata;
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ namespace dawn_native {
|
|||||||
|
|
||||||
void Tick();
|
void Tick();
|
||||||
|
|
||||||
void SetErrorCallback(dawn::ErrorCallback callback, void* userdata);
|
void SetUncapturedErrorCallback(dawn::ErrorCallback callback, void* userdata);
|
||||||
void Reference();
|
void Reference();
|
||||||
void Release();
|
void Release();
|
||||||
|
|
||||||
|
@ -413,11 +413,11 @@ namespace dawn_wire { namespace client {
|
|||||||
void ClientDeviceRelease(DawnDevice) {
|
void ClientDeviceRelease(DawnDevice) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientDeviceSetErrorCallback(DawnDevice cSelf,
|
void ClientDeviceSetUncapturedErrorCallback(DawnDevice cSelf,
|
||||||
DawnErrorCallback callback,
|
DawnErrorCallback callback,
|
||||||
void* userdata) {
|
void* userdata) {
|
||||||
Device* device = reinterpret_cast<Device*>(cSelf);
|
Device* device = reinterpret_cast<Device*>(cSelf);
|
||||||
device->SetErrorCallback(callback, userdata);
|
device->SetUncapturedErrorCallback(callback, userdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
}} // namespace dawn_wire::client
|
}} // namespace dawn_wire::client
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
namespace dawn_wire { namespace client {
|
namespace dawn_wire { namespace client {
|
||||||
|
|
||||||
bool Client::DoDeviceErrorCallback(DawnErrorType errorType, const char* message) {
|
bool Client::DoDeviceUncapturedErrorCallback(DawnErrorType errorType, const char* message) {
|
||||||
switch (errorType) {
|
switch (errorType) {
|
||||||
case DAWN_ERROR_TYPE_NO_ERROR:
|
case DAWN_ERROR_TYPE_NO_ERROR:
|
||||||
case DAWN_ERROR_TYPE_VALIDATION:
|
case DAWN_ERROR_TYPE_VALIDATION:
|
||||||
|
@ -31,7 +31,7 @@ namespace dawn_wire { namespace client {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Device::SetErrorCallback(DawnErrorCallback errorCallback, void* errorUserdata) {
|
void Device::SetUncapturedErrorCallback(DawnErrorCallback errorCallback, void* errorUserdata) {
|
||||||
mErrorCallback = errorCallback;
|
mErrorCallback = errorCallback;
|
||||||
mErrorUserdata = errorUserdata;
|
mErrorUserdata = errorUserdata;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ namespace dawn_wire { namespace client {
|
|||||||
|
|
||||||
Client* GetClient();
|
Client* GetClient();
|
||||||
void HandleError(DawnErrorType errorType, const char* message);
|
void HandleError(DawnErrorType errorType, const char* message);
|
||||||
void SetErrorCallback(DawnErrorCallback errorCallback, void* errorUserdata);
|
void SetUncapturedErrorCallback(DawnErrorCallback errorCallback, void* errorUserdata);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Client* mClient = nullptr;
|
Client* mClient = nullptr;
|
||||||
|
@ -31,7 +31,7 @@ namespace dawn_wire { namespace server {
|
|||||||
auto* deviceData = DeviceObjects().Allocate(1);
|
auto* deviceData = DeviceObjects().Allocate(1);
|
||||||
deviceData->handle = device;
|
deviceData->handle = device;
|
||||||
|
|
||||||
mProcs.deviceSetErrorCallback(device, ForwardDeviceError, this);
|
mProcs.deviceSetUncapturedErrorCallback(device, ForwardUncapturedError, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Server::~Server() {
|
Server::~Server() {
|
||||||
|
@ -54,7 +54,7 @@ namespace dawn_wire { namespace server {
|
|||||||
void* GetCmdSpace(size_t size);
|
void* GetCmdSpace(size_t size);
|
||||||
|
|
||||||
// Forwarding callbacks
|
// Forwarding callbacks
|
||||||
static void ForwardDeviceError(DawnErrorType type, const char* message, void* userdata);
|
static void ForwardUncapturedError(DawnErrorType type, const char* message, void* userdata);
|
||||||
static void ForwardBufferMapReadAsync(DawnBufferMapAsyncStatus status,
|
static void ForwardBufferMapReadAsync(DawnBufferMapAsyncStatus status,
|
||||||
const void* ptr,
|
const void* ptr,
|
||||||
uint64_t dataLength,
|
uint64_t dataLength,
|
||||||
@ -66,7 +66,7 @@ namespace dawn_wire { namespace server {
|
|||||||
static void ForwardFenceCompletedValue(DawnFenceCompletionStatus status, void* userdata);
|
static void ForwardFenceCompletedValue(DawnFenceCompletionStatus status, void* userdata);
|
||||||
|
|
||||||
// Error callbacks
|
// Error callbacks
|
||||||
void OnDeviceError(DawnErrorType type, const char* message);
|
void OnUncapturedError(DawnErrorType type, const char* message);
|
||||||
void OnBufferMapReadAsyncCallback(DawnBufferMapAsyncStatus status,
|
void OnBufferMapReadAsyncCallback(DawnBufferMapAsyncStatus status,
|
||||||
const void* ptr,
|
const void* ptr,
|
||||||
uint64_t dataLength,
|
uint64_t dataLength,
|
||||||
|
@ -16,13 +16,13 @@
|
|||||||
|
|
||||||
namespace dawn_wire { namespace server {
|
namespace dawn_wire { namespace server {
|
||||||
|
|
||||||
void Server::ForwardDeviceError(DawnErrorType type, const char* message, void* userdata) {
|
void Server::ForwardUncapturedError(DawnErrorType type, const char* message, void* userdata) {
|
||||||
auto server = static_cast<Server*>(userdata);
|
auto server = static_cast<Server*>(userdata);
|
||||||
server->OnDeviceError(type, message);
|
server->OnUncapturedError(type, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server::OnDeviceError(DawnErrorType type, const char* message) {
|
void Server::OnUncapturedError(DawnErrorType type, const char* message) {
|
||||||
ReturnDeviceErrorCallbackCmd cmd;
|
ReturnDeviceUncapturedErrorCallbackCmd cmd;
|
||||||
cmd.type = type;
|
cmd.type = type;
|
||||||
cmd.message = message;
|
cmd.message = message;
|
||||||
|
|
||||||
|
@ -458,7 +458,7 @@ void DawnTest::SetUp() {
|
|||||||
device = dawn::Device::Acquire(cDevice);
|
device = dawn::Device::Acquire(cDevice);
|
||||||
queue = device.CreateQueue();
|
queue = device.CreateQueue();
|
||||||
|
|
||||||
device.SetErrorCallback(OnDeviceError, this);
|
device.SetUncapturedErrorCallback(OnDeviceError, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DawnTest::TearDown() {
|
void DawnTest::TearDown() {
|
||||||
|
@ -56,7 +56,7 @@ dawn::Device ValidationTest::CreateDeviceFromAdapter(
|
|||||||
deviceToTest = dawn::Device::Acquire(adapterToTest.CreateDevice(&descriptor));
|
deviceToTest = dawn::Device::Acquire(adapterToTest.CreateDevice(&descriptor));
|
||||||
}
|
}
|
||||||
|
|
||||||
deviceToTest.SetErrorCallback(ValidationTest::OnDeviceError, this);
|
deviceToTest.SetUncapturedErrorCallback(ValidationTest::OnDeviceError, this);
|
||||||
return deviceToTest;
|
return deviceToTest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ class WireErrorCallbackTests : public WireTest {
|
|||||||
|
|
||||||
// Test the return wire for device error callbacks
|
// Test the return wire for device error callbacks
|
||||||
TEST_F(WireErrorCallbackTests, DeviceErrorCallback) {
|
TEST_F(WireErrorCallbackTests, DeviceErrorCallback) {
|
||||||
dawnDeviceSetErrorCallback(device, ToMockDeviceErrorCallback, this);
|
dawnDeviceSetUncapturedErrorCallback(device, ToMockDeviceErrorCallback, this);
|
||||||
|
|
||||||
// Setting the error callback should stay on the client side and do nothing
|
// Setting the error callback should stay on the client side and do nothing
|
||||||
FlushClient();
|
FlushClient();
|
||||||
|
@ -120,7 +120,7 @@ TEST_F(WireFenceTests, QueueSignalSuccess) {
|
|||||||
// Without any flushes, it is valid to signal a value greater than the current
|
// Without any flushes, it is valid to signal a value greater than the current
|
||||||
// signaled value
|
// signaled value
|
||||||
TEST_F(WireFenceTests, QueueSignalSynchronousValidationSuccess) {
|
TEST_F(WireFenceTests, QueueSignalSynchronousValidationSuccess) {
|
||||||
dawnDeviceSetErrorCallback(device, ToMockDeviceErrorCallback, nullptr);
|
dawnDeviceSetUncapturedErrorCallback(device, ToMockDeviceErrorCallback, nullptr);
|
||||||
EXPECT_CALL(*mockDeviceErrorCallback, Call(_, _, _)).Times(0);
|
EXPECT_CALL(*mockDeviceErrorCallback, Call(_, _, _)).Times(0);
|
||||||
|
|
||||||
dawnQueueSignal(queue, fence, 2u);
|
dawnQueueSignal(queue, fence, 2u);
|
||||||
@ -131,7 +131,7 @@ TEST_F(WireFenceTests, QueueSignalSynchronousValidationSuccess) {
|
|||||||
// Without any flushes, errors should be generated when signaling a value less
|
// Without any flushes, errors should be generated when signaling a value less
|
||||||
// than or equal to the current signaled value
|
// than or equal to the current signaled value
|
||||||
TEST_F(WireFenceTests, QueueSignalSynchronousValidationError) {
|
TEST_F(WireFenceTests, QueueSignalSynchronousValidationError) {
|
||||||
dawnDeviceSetErrorCallback(device, ToMockDeviceErrorCallback, nullptr);
|
dawnDeviceSetUncapturedErrorCallback(device, ToMockDeviceErrorCallback, nullptr);
|
||||||
|
|
||||||
EXPECT_CALL(*mockDeviceErrorCallback, Call(DAWN_ERROR_TYPE_VALIDATION, _, _)).Times(1);
|
EXPECT_CALL(*mockDeviceErrorCallback, Call(DAWN_ERROR_TYPE_VALIDATION, _, _)).Times(1);
|
||||||
dawnQueueSignal(queue, fence, 0u); // Error
|
dawnQueueSignal(queue, fence, 0u); // Error
|
||||||
@ -217,7 +217,7 @@ TEST_F(WireFenceTests, OnCompletionSynchronousValidationSuccess) {
|
|||||||
// Without any flushes, errors should be generated when waiting on a value greater
|
// Without any flushes, errors should be generated when waiting on a value greater
|
||||||
// than the last signaled value
|
// than the last signaled value
|
||||||
TEST_F(WireFenceTests, OnCompletionSynchronousValidationError) {
|
TEST_F(WireFenceTests, OnCompletionSynchronousValidationError) {
|
||||||
dawnDeviceSetErrorCallback(device, ToMockDeviceErrorCallback, this + 1);
|
dawnDeviceSetUncapturedErrorCallback(device, ToMockDeviceErrorCallback, this + 1);
|
||||||
|
|
||||||
EXPECT_CALL(*mockFenceOnCompletionCallback, Call(DAWN_FENCE_COMPLETION_STATUS_ERROR, this + 0))
|
EXPECT_CALL(*mockFenceOnCompletionCallback, Call(DAWN_FENCE_COMPLETION_STATUS_ERROR, this + 0))
|
||||||
.Times(1);
|
.Times(1);
|
||||||
@ -262,7 +262,7 @@ TEST_F(WireFenceTests, SignalWrongQueue) {
|
|||||||
EXPECT_CALL(api, DeviceCreateQueue(apiDevice)).WillOnce(Return(apiQueue2));
|
EXPECT_CALL(api, DeviceCreateQueue(apiDevice)).WillOnce(Return(apiQueue2));
|
||||||
FlushClient();
|
FlushClient();
|
||||||
|
|
||||||
dawnDeviceSetErrorCallback(device, ToMockDeviceErrorCallback, nullptr);
|
dawnDeviceSetUncapturedErrorCallback(device, ToMockDeviceErrorCallback, nullptr);
|
||||||
EXPECT_CALL(*mockDeviceErrorCallback, Call(DAWN_ERROR_TYPE_VALIDATION, _, _)).Times(1);
|
EXPECT_CALL(*mockDeviceErrorCallback, Call(DAWN_ERROR_TYPE_VALIDATION, _, _)).Times(1);
|
||||||
dawnQueueSignal(queue2, fence, 2u); // error
|
dawnQueueSignal(queue2, fence, 2u); // error
|
||||||
}
|
}
|
||||||
@ -274,7 +274,7 @@ TEST_F(WireFenceTests, SignalWrongQueueDoesNotUpdateValue) {
|
|||||||
EXPECT_CALL(api, DeviceCreateQueue(apiDevice)).WillOnce(Return(apiQueue2));
|
EXPECT_CALL(api, DeviceCreateQueue(apiDevice)).WillOnce(Return(apiQueue2));
|
||||||
FlushClient();
|
FlushClient();
|
||||||
|
|
||||||
dawnDeviceSetErrorCallback(device, ToMockDeviceErrorCallback, nullptr);
|
dawnDeviceSetUncapturedErrorCallback(device, ToMockDeviceErrorCallback, nullptr);
|
||||||
EXPECT_CALL(*mockDeviceErrorCallback, Call(DAWN_ERROR_TYPE_VALIDATION, _, _)).Times(1);
|
EXPECT_CALL(*mockDeviceErrorCallback, Call(DAWN_ERROR_TYPE_VALIDATION, _, _)).Times(1);
|
||||||
dawnQueueSignal(queue2, fence, 2u); // error
|
dawnQueueSignal(queue2, fence, 2u); // error
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ void WireTest::SetUp() {
|
|||||||
api.GetProcTableAndDevice(&mockProcs, &mockDevice);
|
api.GetProcTableAndDevice(&mockProcs, &mockDevice);
|
||||||
|
|
||||||
// This SetCallback call cannot be ignored because it is done as soon as we start the server
|
// This SetCallback call cannot be ignored because it is done as soon as we start the server
|
||||||
EXPECT_CALL(api, OnDeviceSetErrorCallback(_, _, _)).Times(Exactly(1));
|
EXPECT_CALL(api, OnDeviceSetUncapturedErrorCallback(_, _, _)).Times(Exactly(1));
|
||||||
SetupIgnoredCallExpectations();
|
SetupIgnoredCallExpectations();
|
||||||
|
|
||||||
mS2cBuf = std::make_unique<utils::TerribleCommandBuffer>();
|
mS2cBuf = std::make_unique<utils::TerribleCommandBuffer>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user