Rename "buffer map read status" to "buffer map async status"
This is in preparation of MapWriteAsync that will use the same status enum.
This commit is contained in:
parent
2da19d5d6b
commit
8565e0056a
|
@ -37,7 +37,7 @@
|
||||||
typedef uint64_t nxtCallbackUserdata;
|
typedef uint64_t nxtCallbackUserdata;
|
||||||
typedef void (*nxtDeviceErrorCallback)(const char* message, nxtCallbackUserdata userdata);
|
typedef void (*nxtDeviceErrorCallback)(const char* message, nxtCallbackUserdata userdata);
|
||||||
typedef void (*nxtBuilderErrorCallback)(nxtBuilderErrorStatus status, const char* message, nxtCallbackUserdata userdata1, nxtCallbackUserdata userdata2);
|
typedef void (*nxtBuilderErrorCallback)(nxtBuilderErrorStatus status, const char* message, nxtCallbackUserdata userdata1, nxtCallbackUserdata userdata2);
|
||||||
typedef void (*nxtBufferMapReadCallback)(nxtBufferMapReadStatus status, const void* data, nxtCallbackUserdata userdata);
|
typedef void (*nxtBufferMapReadCallback)(nxtBufferMapAsyncStatus status, const void* data, nxtCallbackUserdata userdata);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -72,7 +72,7 @@ void ProcTableAsClass::CallBuilderErrorCallback(void* builder , nxtBuilderErrorS
|
||||||
auto object = reinterpret_cast<ProcTableAsClass::Object*>(builder);
|
auto object = reinterpret_cast<ProcTableAsClass::Object*>(builder);
|
||||||
object->builderErrorCallback(status, message, object->userdata1, object->userdata2);
|
object->builderErrorCallback(status, message, object->userdata1, object->userdata2);
|
||||||
}
|
}
|
||||||
void ProcTableAsClass::CallMapReadCallback(nxtBuffer buffer, nxtBufferMapReadStatus status, const void* data) {
|
void ProcTableAsClass::CallMapReadCallback(nxtBuffer buffer, nxtBufferMapAsyncStatus status, const void* data) {
|
||||||
auto object = reinterpret_cast<ProcTableAsClass::Object*>(buffer);
|
auto object = reinterpret_cast<ProcTableAsClass::Object*>(buffer);
|
||||||
object->mapReadCallback(status, data, object->userdata1);
|
object->mapReadCallback(status, data, object->userdata1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ class ProcTableAsClass {
|
||||||
// Calls the stored callbacks
|
// Calls the stored callbacks
|
||||||
void CallDeviceErrorCallback(nxtDevice device, const char* message);
|
void CallDeviceErrorCallback(nxtDevice device, const char* message);
|
||||||
void CallBuilderErrorCallback(void* builder , nxtBuilderErrorStatus status, const char* message);
|
void CallBuilderErrorCallback(void* builder , nxtBuilderErrorStatus status, const char* message);
|
||||||
void CallMapReadCallback(nxtBuffer buffer, nxtBufferMapReadStatus status, const void* data);
|
void CallMapReadCallback(nxtBuffer buffer, nxtBufferMapAsyncStatus status, const void* data);
|
||||||
|
|
||||||
struct Object {
|
struct Object {
|
||||||
ProcTableAsClass* procs = nullptr;
|
ProcTableAsClass* procs = nullptr;
|
||||||
|
|
|
@ -82,14 +82,14 @@ namespace wire {
|
||||||
~Buffer() {
|
~Buffer() {
|
||||||
//* Callbacks need to be fired in all cases, as they can handle freeing resources
|
//* Callbacks need to be fired in all cases, as they can handle freeing resources
|
||||||
//* so we call them with "Unknown" status.
|
//* so we call them with "Unknown" status.
|
||||||
ClearMapRequests(NXT_BUFFER_MAP_READ_STATUS_UNKNOWN);
|
ClearMapRequests(NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN);
|
||||||
|
|
||||||
if (mappedData) {
|
if (mappedData) {
|
||||||
free(mappedData);
|
free(mappedData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearMapRequests(nxtBufferMapReadStatus status) {
|
void ClearMapRequests(nxtBufferMapAsyncStatus status) {
|
||||||
for (auto& it : readRequests) {
|
for (auto& it : readRequests) {
|
||||||
it.second.callback(status, nullptr, it.second.userdata);
|
it.second.callback(status, nullptr, it.second.userdata);
|
||||||
}
|
}
|
||||||
|
@ -364,7 +364,7 @@ namespace wire {
|
||||||
free(buffer->mappedData);
|
free(buffer->mappedData);
|
||||||
buffer->mappedData = nullptr;
|
buffer->mappedData = nullptr;
|
||||||
}
|
}
|
||||||
buffer->ClearMapRequests(NXT_BUFFER_MAP_READ_STATUS_UNKNOWN);
|
buffer->ClearMapRequests(NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN);
|
||||||
|
|
||||||
ClientBufferUnmap(buffer);
|
ClientBufferUnmap(buffer);
|
||||||
}
|
}
|
||||||
|
@ -536,7 +536,7 @@ namespace wire {
|
||||||
buffer->readRequests.erase(requestIt);
|
buffer->readRequests.erase(requestIt);
|
||||||
|
|
||||||
//* On success, we copy the data locally because the IPC buffer isn't valid outside of this function
|
//* On success, we copy the data locally because the IPC buffer isn't valid outside of this function
|
||||||
if (cmd->status == NXT_BUFFER_MAP_READ_STATUS_SUCCESS) {
|
if (cmd->status == NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS) {
|
||||||
|
|
||||||
//* The server didn't send the right amount of data, this is an error and could cause
|
//* The server didn't send the right amount of data, this is an error and could cause
|
||||||
//* the application to crash if we did call the callback.
|
//* the application to crash if we did call the callback.
|
||||||
|
@ -550,9 +550,9 @@ namespace wire {
|
||||||
buffer->mappedData = malloc(request.size);
|
buffer->mappedData = malloc(request.size);
|
||||||
memcpy(buffer->mappedData, cmd->GetData(), request.size);
|
memcpy(buffer->mappedData, cmd->GetData(), request.size);
|
||||||
|
|
||||||
request.callback(static_cast<nxtBufferMapReadStatus>(cmd->status), buffer->mappedData, request.userdata);
|
request.callback(static_cast<nxtBufferMapAsyncStatus>(cmd->status), buffer->mappedData, request.userdata);
|
||||||
} else {
|
} else {
|
||||||
request.callback(static_cast<nxtBufferMapReadStatus>(cmd->status), nullptr, request.userdata);
|
request.callback(static_cast<nxtBufferMapAsyncStatus>(cmd->status), nullptr, request.userdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -128,7 +128,7 @@ namespace wire {
|
||||||
void Forward{{type.name.CamelCase()}}ToClient(nxtBuilderErrorStatus status, const char* message, nxtCallbackUserdata userdata1, nxtCallbackUserdata userdata2);
|
void Forward{{type.name.CamelCase()}}ToClient(nxtBuilderErrorStatus status, const char* message, nxtCallbackUserdata userdata1, nxtCallbackUserdata userdata2);
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
void ForwardBufferMapReadAsync(nxtBufferMapReadStatus status, const void* ptr, nxtCallbackUserdata userdata);
|
void ForwardBufferMapReadAsync(nxtBufferMapAsyncStatus status, const void* ptr, nxtCallbackUserdata userdata);
|
||||||
|
|
||||||
class Server : public CommandHandler {
|
class Server : public CommandHandler {
|
||||||
public:
|
public:
|
||||||
|
@ -183,7 +183,7 @@ namespace wire {
|
||||||
}
|
}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
void OnMapReadAsyncCallback(nxtBufferMapReadStatus status, const void* ptr, MapReadUserdata* data) {
|
void OnMapReadAsyncCallback(nxtBufferMapAsyncStatus status, const void* ptr, MapReadUserdata* data) {
|
||||||
ReturnBufferMapReadAsyncCallbackCmd cmd;
|
ReturnBufferMapReadAsyncCallbackCmd cmd;
|
||||||
cmd.bufferId = data->bufferId;
|
cmd.bufferId = data->bufferId;
|
||||||
cmd.bufferSerial = data->bufferSerial;
|
cmd.bufferSerial = data->bufferSerial;
|
||||||
|
@ -191,14 +191,14 @@ namespace wire {
|
||||||
cmd.status = status;
|
cmd.status = status;
|
||||||
|
|
||||||
cmd.dataLength = 0;
|
cmd.dataLength = 0;
|
||||||
if (status == NXT_BUFFER_MAP_READ_STATUS_SUCCESS) {
|
if (status == NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS) {
|
||||||
cmd.dataLength = data->size;
|
cmd.dataLength = data->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto allocCmd = reinterpret_cast<ReturnBufferMapReadAsyncCallbackCmd*>(GetCmdSpace(cmd.GetRequiredSize()));
|
auto allocCmd = reinterpret_cast<ReturnBufferMapReadAsyncCallbackCmd*>(GetCmdSpace(cmd.GetRequiredSize()));
|
||||||
*allocCmd = cmd;
|
*allocCmd = cmd;
|
||||||
|
|
||||||
if (status == NXT_BUFFER_MAP_READ_STATUS_SUCCESS) {
|
if (status == NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS) {
|
||||||
memcpy(allocCmd->GetData(), ptr, data->size);
|
memcpy(allocCmd->GetData(), ptr, data->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -469,7 +469,7 @@ namespace wire {
|
||||||
|
|
||||||
if (!buffer->valid) {
|
if (!buffer->valid) {
|
||||||
//* Fake the buffer returning a failure, data will be freed in this call.
|
//* Fake the buffer returning a failure, data will be freed in this call.
|
||||||
ForwardBufferMapReadAsync(NXT_BUFFER_MAP_READ_STATUS_ERROR, nullptr, userdata);
|
ForwardBufferMapReadAsync(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -493,7 +493,7 @@ namespace wire {
|
||||||
}
|
}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
void ForwardBufferMapReadAsync(nxtBufferMapReadStatus status, const void* ptr, nxtCallbackUserdata userdata) {
|
void ForwardBufferMapReadAsync(nxtBufferMapAsyncStatus status, const void* ptr, nxtCallbackUserdata userdata) {
|
||||||
auto data = reinterpret_cast<MapReadUserdata*>(static_cast<uintptr_t>(userdata));
|
auto data = reinterpret_cast<MapReadUserdata*>(static_cast<uintptr_t>(userdata));
|
||||||
data->server->OnMapReadAsyncCallback(status, ptr, data);
|
data->server->OnMapReadAsyncCallback(status, ptr, data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,7 +257,7 @@
|
||||||
"buffer map read callback": {
|
"buffer map read callback": {
|
||||||
"category": "natively defined"
|
"category": "natively defined"
|
||||||
},
|
},
|
||||||
"buffer map read status": {
|
"buffer map async status": {
|
||||||
"category": "enum",
|
"category": "enum",
|
||||||
"values": [
|
"values": [
|
||||||
{"value": 0, "name": "success"},
|
{"value": 0, "name": "success"},
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace backend {
|
||||||
|
|
||||||
BufferBase::~BufferBase() {
|
BufferBase::~BufferBase() {
|
||||||
if (mIsMapped) {
|
if (mIsMapped) {
|
||||||
CallMapReadCallback(mMapReadSerial, NXT_BUFFER_MAP_READ_STATUS_UNKNOWN, nullptr);
|
CallMapReadCallback(mMapReadSerial, NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ namespace backend {
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferBase::CallMapReadCallback(uint32_t serial,
|
void BufferBase::CallMapReadCallback(uint32_t serial,
|
||||||
nxtBufferMapReadStatus status,
|
nxtBufferMapAsyncStatus status,
|
||||||
const void* pointer) {
|
const void* pointer) {
|
||||||
if (mMapReadCallback && serial == mMapReadSerial) {
|
if (mMapReadCallback && serial == mMapReadSerial) {
|
||||||
// Tag the callback as fired before firing it, otherwise it could fire a second time if
|
// Tag the callback as fired before firing it, otherwise it could fire a second time if
|
||||||
|
@ -89,19 +89,19 @@ namespace backend {
|
||||||
nxtCallbackUserdata userdata) {
|
nxtCallbackUserdata userdata) {
|
||||||
if (start + size > GetSize()) {
|
if (start + size > GetSize()) {
|
||||||
mDevice->HandleError("Buffer map read out of range");
|
mDevice->HandleError("Buffer map read out of range");
|
||||||
callback(NXT_BUFFER_MAP_READ_STATUS_ERROR, nullptr, userdata);
|
callback(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(mCurrentUsage & nxt::BufferUsageBit::MapRead)) {
|
if (!(mCurrentUsage & nxt::BufferUsageBit::MapRead)) {
|
||||||
mDevice->HandleError("Buffer needs the map read usage bit");
|
mDevice->HandleError("Buffer needs the map read usage bit");
|
||||||
callback(NXT_BUFFER_MAP_READ_STATUS_ERROR, nullptr, userdata);
|
callback(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mIsMapped) {
|
if (mIsMapped) {
|
||||||
mDevice->HandleError("Buffer already mapped");
|
mDevice->HandleError("Buffer already mapped");
|
||||||
callback(NXT_BUFFER_MAP_READ_STATUS_ERROR, nullptr, userdata);
|
callback(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ namespace backend {
|
||||||
|
|
||||||
// A map request can only be called once, so this will fire only if the request wasn't
|
// A map request can only be called once, so this will fire only if the request wasn't
|
||||||
// completed before the Unmap
|
// completed before the Unmap
|
||||||
CallMapReadCallback(mMapReadSerial, NXT_BUFFER_MAP_READ_STATUS_UNKNOWN, nullptr);
|
CallMapReadCallback(mMapReadSerial, NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr);
|
||||||
UnmapImpl();
|
UnmapImpl();
|
||||||
mIsMapped = false;
|
mIsMapped = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ namespace backend {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void CallMapReadCallback(uint32_t serial,
|
void CallMapReadCallback(uint32_t serial,
|
||||||
nxtBufferMapReadStatus status,
|
nxtBufferMapAsyncStatus status,
|
||||||
const void* pointer);
|
const void* pointer);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -145,7 +145,7 @@ namespace backend { namespace d3d12 {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Buffer::OnMapReadCommandSerialFinished(uint32_t mapSerial, const void* data) {
|
void Buffer::OnMapReadCommandSerialFinished(uint32_t mapSerial, const void* data) {
|
||||||
CallMapReadCallback(mapSerial, NXT_BUFFER_MAP_READ_STATUS_SUCCESS, data);
|
CallMapReadCallback(mapSerial, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Buffer::SetSubDataImpl(uint32_t start, uint32_t count, const uint32_t* data) {
|
void Buffer::SetSubDataImpl(uint32_t start, uint32_t count, const uint32_t* data) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace backend { namespace metal {
|
||||||
|
|
||||||
void Buffer::OnMapReadCommandSerialFinished(uint32_t mapSerial, uint32_t offset) {
|
void Buffer::OnMapReadCommandSerialFinished(uint32_t mapSerial, uint32_t offset) {
|
||||||
const char* data = reinterpret_cast<const char*>([mMtlBuffer contents]);
|
const char* data = reinterpret_cast<const char*>([mMtlBuffer contents]);
|
||||||
CallMapReadCallback(mapSerial, NXT_BUFFER_MAP_READ_STATUS_SUCCESS, data + offset);
|
CallMapReadCallback(mapSerial, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data + offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Buffer::SetSubDataImpl(uint32_t start, uint32_t count, const uint32_t* data) {
|
void Buffer::SetSubDataImpl(uint32_t start, uint32_t count, const uint32_t* data) {
|
||||||
|
|
|
@ -132,7 +132,7 @@ namespace backend { namespace null {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Buffer::MapReadOperationCompleted(uint32_t serial, const void* ptr) {
|
void Buffer::MapReadOperationCompleted(uint32_t serial, const void* ptr) {
|
||||||
CallMapReadCallback(serial, NXT_BUFFER_MAP_READ_STATUS_SUCCESS, ptr);
|
CallMapReadCallback(serial, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Buffer::SetSubDataImpl(uint32_t start, uint32_t count, const uint32_t* data) {
|
void Buffer::SetSubDataImpl(uint32_t start, uint32_t count, const uint32_t* data) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace backend { namespace opengl {
|
||||||
// instead?
|
// instead?
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, mBuffer);
|
glBindBuffer(GL_ARRAY_BUFFER, mBuffer);
|
||||||
void* data = glMapBufferRange(GL_ARRAY_BUFFER, start, count, GL_MAP_READ_BIT);
|
void* data = glMapBufferRange(GL_ARRAY_BUFFER, start, count, GL_MAP_READ_BIT);
|
||||||
CallMapReadCallback(serial, NXT_BUFFER_MAP_READ_STATUS_SUCCESS, data);
|
CallMapReadCallback(serial, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Buffer::UnmapImpl() {
|
void Buffer::UnmapImpl() {
|
||||||
|
|
|
@ -151,7 +151,7 @@ namespace backend { namespace vulkan {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Buffer::OnMapReadCommandSerialFinished(uint32_t mapSerial, const void* data) {
|
void Buffer::OnMapReadCommandSerialFinished(uint32_t mapSerial, const void* data) {
|
||||||
CallMapReadCallback(mapSerial, NXT_BUFFER_MAP_READ_STATUS_SUCCESS, data);
|
CallMapReadCallback(mapSerial, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
VkBuffer Buffer::GetHandle() const {
|
VkBuffer Buffer::GetHandle() const {
|
||||||
|
|
|
@ -276,8 +276,10 @@ void NXTTest::MapSlotsSynchronously() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void NXTTest::SlotMapReadCallback(nxtBufferMapReadStatus status, const void* data, nxtCallbackUserdata userdata_) {
|
void NXTTest::SlotMapReadCallback(nxtBufferMapAsyncStatus status,
|
||||||
NXT_ASSERT(status == NXT_BUFFER_MAP_READ_STATUS_SUCCESS);
|
const void* data,
|
||||||
|
nxtCallbackUserdata userdata_) {
|
||||||
|
NXT_ASSERT(status == NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS);
|
||||||
|
|
||||||
auto userdata = reinterpret_cast<MapReadUserdata*>(static_cast<uintptr_t>(userdata_));
|
auto userdata = reinterpret_cast<MapReadUserdata*>(static_cast<uintptr_t>(userdata_));
|
||||||
userdata->test->mReadbackSlots[userdata->slot].mappedData = data;
|
userdata->test->mReadbackSlots[userdata->slot].mappedData = data;
|
||||||
|
|
|
@ -98,7 +98,9 @@ class NXTTest : public ::testing::TestWithParam<BackendType> {
|
||||||
|
|
||||||
// Maps all the buffers and fill ReadbackSlot::mappedData
|
// Maps all the buffers and fill ReadbackSlot::mappedData
|
||||||
void MapSlotsSynchronously();
|
void MapSlotsSynchronously();
|
||||||
static void SlotMapReadCallback(nxtBufferMapReadStatus status, const void* data, nxtCallbackUserdata userdata);
|
static void SlotMapReadCallback(nxtBufferMapAsyncStatus status,
|
||||||
|
const void* data,
|
||||||
|
nxtCallbackUserdata userdata);
|
||||||
size_t mNumPendingMapOperations = 0;
|
size_t mNumPendingMapOperations = 0;
|
||||||
|
|
||||||
// Reserve space where the data for an expectation can be copied
|
// Reserve space where the data for an expectation can be copied
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
class BufferMapReadTests : public NXTTest {
|
class BufferMapReadTests : public NXTTest {
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
static void MapReadCallback(nxtBufferMapReadStatus status, const void* data, nxtCallbackUserdata userdata) {
|
static void MapReadCallback(nxtBufferMapAsyncStatus status, const void* data, nxtCallbackUserdata userdata) {
|
||||||
ASSERT_EQ(NXT_BUFFER_MAP_READ_STATUS_SUCCESS, status);
|
ASSERT_EQ(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, status);
|
||||||
ASSERT_NE(nullptr, data);
|
ASSERT_NE(nullptr, data);
|
||||||
|
|
||||||
auto test = reinterpret_cast<BufferMapReadTests*>(static_cast<uintptr_t>(userdata));
|
auto test = reinterpret_cast<BufferMapReadTests*>(static_cast<uintptr_t>(userdata));
|
||||||
|
|
|
@ -43,11 +43,11 @@ static void ToMockBuilderErrorCallback(nxtBuilderErrorStatus status, const char*
|
||||||
|
|
||||||
class MockBufferMapReadCallback {
|
class MockBufferMapReadCallback {
|
||||||
public:
|
public:
|
||||||
MOCK_METHOD3(Call, void(nxtBufferMapReadStatus status, const uint32_t* ptr, nxtCallbackUserdata userdata));
|
MOCK_METHOD3(Call, void(nxtBufferMapAsyncStatus status, const uint32_t* ptr, nxtCallbackUserdata userdata));
|
||||||
};
|
};
|
||||||
|
|
||||||
static MockBufferMapReadCallback* mockBufferMapReadCallback = nullptr;
|
static MockBufferMapReadCallback* mockBufferMapReadCallback = nullptr;
|
||||||
static void ToMockBufferMapReadCallback(nxtBufferMapReadStatus status, const void* ptr, nxtCallbackUserdata userdata) {
|
static void ToMockBufferMapReadCallback(nxtBufferMapAsyncStatus status, const void* ptr, nxtCallbackUserdata userdata) {
|
||||||
// Assume the data is uint32_t to make writing matchers easier
|
// Assume the data is uint32_t to make writing matchers easier
|
||||||
mockBufferMapReadCallback->Call(status, reinterpret_cast<const uint32_t*>(ptr), userdata);
|
mockBufferMapReadCallback->Call(status, reinterpret_cast<const uint32_t*>(ptr), userdata);
|
||||||
}
|
}
|
||||||
|
@ -604,12 +604,12 @@ TEST_F(WireBufferMappingTests, MappingSuccessBuffer) {
|
||||||
uint32_t bufferContent = 31337;
|
uint32_t bufferContent = 31337;
|
||||||
EXPECT_CALL(api, OnBufferMapReadAsyncCallback(apiBuffer, 40, sizeof(uint32_t), _, _))
|
EXPECT_CALL(api, OnBufferMapReadAsyncCallback(apiBuffer, 40, sizeof(uint32_t), _, _))
|
||||||
.WillOnce(InvokeWithoutArgs([&]() {
|
.WillOnce(InvokeWithoutArgs([&]() {
|
||||||
api.CallMapReadCallback(apiBuffer, NXT_BUFFER_MAP_READ_STATUS_SUCCESS, &bufferContent);
|
api.CallMapReadCallback(apiBuffer, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, &bufferContent);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
FlushClient();
|
FlushClient();
|
||||||
|
|
||||||
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_READ_STATUS_SUCCESS, Pointee(Eq(bufferContent)), userdata))
|
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Pointee(Eq(bufferContent)), userdata))
|
||||||
.Times(1);
|
.Times(1);
|
||||||
|
|
||||||
FlushServer();
|
FlushServer();
|
||||||
|
@ -628,12 +628,12 @@ TEST_F(WireBufferMappingTests, ErrorWhileMapping) {
|
||||||
|
|
||||||
EXPECT_CALL(api, OnBufferMapReadAsyncCallback(apiBuffer, 40, sizeof(uint32_t), _, _))
|
EXPECT_CALL(api, OnBufferMapReadAsyncCallback(apiBuffer, 40, sizeof(uint32_t), _, _))
|
||||||
.WillOnce(InvokeWithoutArgs([&]() {
|
.WillOnce(InvokeWithoutArgs([&]() {
|
||||||
api.CallMapReadCallback(apiBuffer, NXT_BUFFER_MAP_READ_STATUS_ERROR, nullptr);
|
api.CallMapReadCallback(apiBuffer, NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
FlushClient();
|
FlushClient();
|
||||||
|
|
||||||
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_READ_STATUS_ERROR, nullptr, userdata))
|
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata))
|
||||||
.Times(1);
|
.Times(1);
|
||||||
|
|
||||||
FlushServer();
|
FlushServer();
|
||||||
|
@ -646,7 +646,7 @@ TEST_F(WireBufferMappingTests, MappingErrorBuffer) {
|
||||||
|
|
||||||
FlushClient();
|
FlushClient();
|
||||||
|
|
||||||
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_READ_STATUS_ERROR, nullptr, userdata))
|
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata))
|
||||||
.Times(1);
|
.Times(1);
|
||||||
|
|
||||||
FlushServer();
|
FlushServer();
|
||||||
|
@ -661,7 +661,7 @@ TEST_F(WireBufferMappingTests, DestroyBeforeRequestEnd) {
|
||||||
nxtCallbackUserdata userdata = 8656;
|
nxtCallbackUserdata userdata = 8656;
|
||||||
nxtBufferMapReadAsync(errorBuffer, 40, sizeof(uint32_t), ToMockBufferMapReadCallback, userdata);
|
nxtBufferMapReadAsync(errorBuffer, 40, sizeof(uint32_t), ToMockBufferMapReadCallback, userdata);
|
||||||
|
|
||||||
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_READ_STATUS_UNKNOWN, nullptr, userdata))
|
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata))
|
||||||
.Times(1);
|
.Times(1);
|
||||||
|
|
||||||
nxtBufferRelease(errorBuffer);
|
nxtBufferRelease(errorBuffer);
|
||||||
|
@ -675,13 +675,13 @@ TEST_F(WireBufferMappingTests, UnmapCalledTooEarly) {
|
||||||
uint32_t bufferContent = 31337;
|
uint32_t bufferContent = 31337;
|
||||||
EXPECT_CALL(api, OnBufferMapReadAsyncCallback(apiBuffer, 40, sizeof(uint32_t), _, _))
|
EXPECT_CALL(api, OnBufferMapReadAsyncCallback(apiBuffer, 40, sizeof(uint32_t), _, _))
|
||||||
.WillOnce(InvokeWithoutArgs([&]() {
|
.WillOnce(InvokeWithoutArgs([&]() {
|
||||||
api.CallMapReadCallback(apiBuffer, NXT_BUFFER_MAP_READ_STATUS_SUCCESS, &bufferContent);
|
api.CallMapReadCallback(apiBuffer, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, &bufferContent);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
FlushClient();
|
FlushClient();
|
||||||
|
|
||||||
// Oh no! We are calling Unmap too early!
|
// Oh no! We are calling Unmap too early!
|
||||||
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_READ_STATUS_UNKNOWN, nullptr, userdata))
|
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata))
|
||||||
.Times(1);
|
.Times(1);
|
||||||
nxtBufferUnmap(buffer);
|
nxtBufferUnmap(buffer);
|
||||||
|
|
||||||
|
@ -698,13 +698,13 @@ TEST_F(WireBufferMappingTests, MappingErrorWhileAlreadyMappedGetsNullptr) {
|
||||||
uint32_t bufferContent = 31337;
|
uint32_t bufferContent = 31337;
|
||||||
EXPECT_CALL(api, OnBufferMapReadAsyncCallback(apiBuffer, 40, sizeof(uint32_t), _, _))
|
EXPECT_CALL(api, OnBufferMapReadAsyncCallback(apiBuffer, 40, sizeof(uint32_t), _, _))
|
||||||
.WillOnce(InvokeWithoutArgs([&]() {
|
.WillOnce(InvokeWithoutArgs([&]() {
|
||||||
api.CallMapReadCallback(apiBuffer, NXT_BUFFER_MAP_READ_STATUS_SUCCESS, &bufferContent);
|
api.CallMapReadCallback(apiBuffer, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, &bufferContent);
|
||||||
}))
|
}))
|
||||||
.RetiresOnSaturation();
|
.RetiresOnSaturation();
|
||||||
|
|
||||||
FlushClient();
|
FlushClient();
|
||||||
|
|
||||||
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_READ_STATUS_SUCCESS, Pointee(Eq(bufferContent)), userdata))
|
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Pointee(Eq(bufferContent)), userdata))
|
||||||
.Times(1);
|
.Times(1);
|
||||||
|
|
||||||
FlushServer();
|
FlushServer();
|
||||||
|
@ -714,12 +714,12 @@ TEST_F(WireBufferMappingTests, MappingErrorWhileAlreadyMappedGetsNullptr) {
|
||||||
nxtBufferMapReadAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapReadCallback, userdata);
|
nxtBufferMapReadAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapReadCallback, userdata);
|
||||||
EXPECT_CALL(api, OnBufferMapReadAsyncCallback(apiBuffer, 40, sizeof(uint32_t), _, _))
|
EXPECT_CALL(api, OnBufferMapReadAsyncCallback(apiBuffer, 40, sizeof(uint32_t), _, _))
|
||||||
.WillOnce(InvokeWithoutArgs([&]() {
|
.WillOnce(InvokeWithoutArgs([&]() {
|
||||||
api.CallMapReadCallback(apiBuffer, NXT_BUFFER_MAP_READ_STATUS_ERROR, nullptr);
|
api.CallMapReadCallback(apiBuffer, NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
FlushClient();
|
FlushClient();
|
||||||
|
|
||||||
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_READ_STATUS_ERROR, nullptr, userdata))
|
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata))
|
||||||
.Times(1);
|
.Times(1);
|
||||||
|
|
||||||
FlushServer();
|
FlushServer();
|
||||||
|
@ -733,12 +733,12 @@ TEST_F(WireBufferMappingTests, UnmapInsideMapReadCallback) {
|
||||||
uint32_t bufferContent = 31337;
|
uint32_t bufferContent = 31337;
|
||||||
EXPECT_CALL(api, OnBufferMapReadAsyncCallback(apiBuffer, 40, sizeof(uint32_t), _, _))
|
EXPECT_CALL(api, OnBufferMapReadAsyncCallback(apiBuffer, 40, sizeof(uint32_t), _, _))
|
||||||
.WillOnce(InvokeWithoutArgs([&]() {
|
.WillOnce(InvokeWithoutArgs([&]() {
|
||||||
api.CallMapReadCallback(apiBuffer, NXT_BUFFER_MAP_READ_STATUS_SUCCESS, &bufferContent);
|
api.CallMapReadCallback(apiBuffer, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, &bufferContent);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
FlushClient();
|
FlushClient();
|
||||||
|
|
||||||
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_READ_STATUS_SUCCESS, Pointee(Eq(bufferContent)), userdata))
|
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Pointee(Eq(bufferContent)), userdata))
|
||||||
.WillOnce(InvokeWithoutArgs([&]() {
|
.WillOnce(InvokeWithoutArgs([&]() {
|
||||||
nxtBufferUnmap(buffer);
|
nxtBufferUnmap(buffer);
|
||||||
}));
|
}));
|
||||||
|
@ -759,12 +759,12 @@ TEST_F(WireBufferMappingTests, DestroyInsideMapReadCallback) {
|
||||||
uint32_t bufferContent = 31337;
|
uint32_t bufferContent = 31337;
|
||||||
EXPECT_CALL(api, OnBufferMapReadAsyncCallback(apiBuffer, 40, sizeof(uint32_t), _, _))
|
EXPECT_CALL(api, OnBufferMapReadAsyncCallback(apiBuffer, 40, sizeof(uint32_t), _, _))
|
||||||
.WillOnce(InvokeWithoutArgs([&]() {
|
.WillOnce(InvokeWithoutArgs([&]() {
|
||||||
api.CallMapReadCallback(apiBuffer, NXT_BUFFER_MAP_READ_STATUS_SUCCESS, &bufferContent);
|
api.CallMapReadCallback(apiBuffer, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, &bufferContent);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
FlushClient();
|
FlushClient();
|
||||||
|
|
||||||
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_READ_STATUS_SUCCESS, Pointee(Eq(bufferContent)), userdata))
|
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Pointee(Eq(bufferContent)), userdata))
|
||||||
.WillOnce(InvokeWithoutArgs([&]() {
|
.WillOnce(InvokeWithoutArgs([&]() {
|
||||||
nxtBufferRelease(buffer);
|
nxtBufferRelease(buffer);
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -20,11 +20,11 @@ using namespace testing;
|
||||||
|
|
||||||
class MockBufferMapReadCallback {
|
class MockBufferMapReadCallback {
|
||||||
public:
|
public:
|
||||||
MOCK_METHOD3(Call, void(nxtBufferMapReadStatus status, const uint32_t* ptr, nxtCallbackUserdata userdata));
|
MOCK_METHOD3(Call, void(nxtBufferMapAsyncStatus status, const uint32_t* ptr, nxtCallbackUserdata userdata));
|
||||||
};
|
};
|
||||||
|
|
||||||
static MockBufferMapReadCallback* mockBufferMapReadCallback = nullptr;
|
static MockBufferMapReadCallback* mockBufferMapReadCallback = nullptr;
|
||||||
static void ToMockBufferMapReadCallback(nxtBufferMapReadStatus status, const void* ptr, nxtCallbackUserdata userdata) {
|
static void ToMockBufferMapReadCallback(nxtBufferMapAsyncStatus status, const void* ptr, nxtCallbackUserdata userdata) {
|
||||||
// Assume the data is uint32_t to make writing matchers easier
|
// Assume the data is uint32_t to make writing matchers easier
|
||||||
mockBufferMapReadCallback->Call(status, reinterpret_cast<const uint32_t*>(ptr), userdata);
|
mockBufferMapReadCallback->Call(status, reinterpret_cast<const uint32_t*>(ptr), userdata);
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ TEST_F(BufferValidationTest, MapReadSuccess) {
|
||||||
nxt::CallbackUserdata userdata = 40598;
|
nxt::CallbackUserdata userdata = 40598;
|
||||||
buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata);
|
buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata);
|
||||||
|
|
||||||
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_READ_STATUS_SUCCESS, Ne(nullptr), userdata))
|
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata))
|
||||||
.Times(1);
|
.Times(1);
|
||||||
queue.Submit(0, nullptr);
|
queue.Submit(0, nullptr);
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ TEST_F(BufferValidationTest, MapReadOutOfRange) {
|
||||||
nxt::Buffer buf = CreateMapReadBuffer(4);
|
nxt::Buffer buf = CreateMapReadBuffer(4);
|
||||||
|
|
||||||
nxt::CallbackUserdata userdata = 40599;
|
nxt::CallbackUserdata userdata = 40599;
|
||||||
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_READ_STATUS_ERROR, nullptr, userdata))
|
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata))
|
||||||
.Times(1);
|
.Times(1);
|
||||||
|
|
||||||
ASSERT_DEVICE_ERROR(buf.MapReadAsync(0, 5, ToMockBufferMapReadCallback, userdata));
|
ASSERT_DEVICE_ERROR(buf.MapReadAsync(0, 5, ToMockBufferMapReadCallback, userdata));
|
||||||
|
@ -211,7 +211,7 @@ TEST_F(BufferValidationTest, MapReadWrongUsage) {
|
||||||
.GetResult();
|
.GetResult();
|
||||||
|
|
||||||
nxt::CallbackUserdata userdata = 40600;
|
nxt::CallbackUserdata userdata = 40600;
|
||||||
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_READ_STATUS_ERROR, nullptr, userdata))
|
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata))
|
||||||
.Times(1);
|
.Times(1);
|
||||||
|
|
||||||
ASSERT_DEVICE_ERROR(buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata));
|
ASSERT_DEVICE_ERROR(buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata));
|
||||||
|
@ -223,11 +223,11 @@ TEST_F(BufferValidationTest, MapReadAlreadyMapped) {
|
||||||
|
|
||||||
nxt::CallbackUserdata userdata1 = 40601;
|
nxt::CallbackUserdata userdata1 = 40601;
|
||||||
buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata1);
|
buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata1);
|
||||||
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_READ_STATUS_SUCCESS, Ne(nullptr), userdata1))
|
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata1))
|
||||||
.Times(1);
|
.Times(1);
|
||||||
|
|
||||||
nxt::CallbackUserdata userdata2 = 40602;
|
nxt::CallbackUserdata userdata2 = 40602;
|
||||||
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_READ_STATUS_ERROR, nullptr, userdata2))
|
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata2))
|
||||||
.Times(1);
|
.Times(1);
|
||||||
ASSERT_DEVICE_ERROR(buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata2));
|
ASSERT_DEVICE_ERROR(buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata2));
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ TEST_F(BufferValidationTest, MapReadUnmapBeforeResult) {
|
||||||
nxt::CallbackUserdata userdata = 40603;
|
nxt::CallbackUserdata userdata = 40603;
|
||||||
buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata);
|
buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata);
|
||||||
|
|
||||||
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_READ_STATUS_UNKNOWN, nullptr, userdata))
|
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata))
|
||||||
.Times(1);
|
.Times(1);
|
||||||
buf.Unmap();
|
buf.Unmap();
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ TEST_F(BufferValidationTest, DISABLED_MapReadDestroyBeforeResult) {
|
||||||
nxt::CallbackUserdata userdata = 40604;
|
nxt::CallbackUserdata userdata = 40604;
|
||||||
buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata);
|
buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata);
|
||||||
|
|
||||||
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_READ_STATUS_UNKNOWN, nullptr, userdata))
|
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata))
|
||||||
.Times(1);
|
.Times(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ TEST_F(BufferValidationTest, MapReadUnmapBeforeResultThenMapAgain) {
|
||||||
nxt::CallbackUserdata userdata = 40605;
|
nxt::CallbackUserdata userdata = 40605;
|
||||||
buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata);
|
buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata);
|
||||||
|
|
||||||
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_READ_STATUS_UNKNOWN, nullptr, userdata))
|
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata))
|
||||||
.Times(1);
|
.Times(1);
|
||||||
buf.Unmap();
|
buf.Unmap();
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ TEST_F(BufferValidationTest, MapReadUnmapBeforeResultThenMapAgain) {
|
||||||
|
|
||||||
buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata);
|
buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata);
|
||||||
|
|
||||||
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_READ_STATUS_SUCCESS, Ne(nullptr), userdata))
|
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata))
|
||||||
.Times(1);
|
.Times(1);
|
||||||
queue.Submit(0, nullptr);
|
queue.Submit(0, nullptr);
|
||||||
}
|
}
|
||||||
|
@ -297,7 +297,7 @@ TEST_F(BufferValidationTest, UnmapInsideMapReadCallback) {
|
||||||
nxt::CallbackUserdata userdata = 40678;
|
nxt::CallbackUserdata userdata = 40678;
|
||||||
buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata);
|
buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata);
|
||||||
|
|
||||||
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_READ_STATUS_SUCCESS, Ne(nullptr), userdata))
|
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata))
|
||||||
.WillOnce(InvokeWithoutArgs([&]() {
|
.WillOnce(InvokeWithoutArgs([&]() {
|
||||||
buf.Unmap();
|
buf.Unmap();
|
||||||
}));
|
}));
|
||||||
|
@ -312,7 +312,7 @@ TEST_F(BufferValidationTest, DestroyInsideMapReadCallback) {
|
||||||
nxt::CallbackUserdata userdata = 40679;
|
nxt::CallbackUserdata userdata = 40679;
|
||||||
buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata);
|
buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata);
|
||||||
|
|
||||||
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_READ_STATUS_SUCCESS, Ne(nullptr), userdata))
|
EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata))
|
||||||
.WillOnce(InvokeWithoutArgs([&]() {
|
.WillOnce(InvokeWithoutArgs([&]() {
|
||||||
buf = nxt::Buffer();
|
buf = nxt::Buffer();
|
||||||
}));
|
}));
|
||||||
|
|
Loading…
Reference in New Issue