Skip to content

Commit 7bd6718

Browse files
committed
port wgpu backend
1 parent 60f0601 commit 7bd6718

10 files changed

+108
-77
lines changed

src/wgpu/wgpu-buffer.cpp

+12-9
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Result DeviceImpl::createBuffer(const BufferDesc& desc, const void* initData, IB
5959
bufferDesc.usage |= WGPUBufferUsage_CopyDst;
6060
}
6161

62-
bufferDesc.label = desc.label;
62+
bufferDesc.label = translateString(desc.label);
6363
buffer->m_buffer = m_ctx.api.wgpuDeviceCreateBuffer(m_ctx.device, &bufferDesc);
6464
if (!buffer->m_buffer)
6565
{
@@ -74,13 +74,13 @@ Result DeviceImpl::createBuffer(const BufferDesc& desc, const void* initData, IB
7474

7575
// Wait for the command buffer to finish executing
7676
{
77-
WGPUQueueWorkDoneStatus status = WGPUQueueWorkDoneStatus_Unknown;
78-
WGPUQueueWorkDoneCallbackInfo2 callbackInfo = {};
77+
WGPUQueueWorkDoneStatus status = WGPUQueueWorkDoneStatus(0);
78+
WGPUQueueWorkDoneCallbackInfo callbackInfo = {};
7979
callbackInfo.mode = WGPUCallbackMode_WaitAnyOnly;
8080
callbackInfo.callback = [](WGPUQueueWorkDoneStatus status_, void* userdata1, void* userdata2)
8181
{ *(WGPUQueueWorkDoneStatus*)userdata1 = status_; };
8282
callbackInfo.userdata1 = &status;
83-
WGPUFuture future = m_ctx.api.wgpuQueueOnSubmittedWorkDone2(queue, callbackInfo);
83+
WGPUFuture future = m_ctx.api.wgpuQueueOnSubmittedWorkDone(queue, callbackInfo);
8484
constexpr size_t futureCount = 1;
8585
WGPUFutureWaitInfo futures[futureCount] = {{future}};
8686
uint64_t timeoutNS = UINT64_MAX;
@@ -119,17 +119,20 @@ Result DeviceImpl::mapBuffer(IBuffer* buffer, CpuAccessMode mode, void** outData
119119
size_t offset = 0;
120120
size_t size = bufferImpl->m_desc.size;
121121

122-
WGPUMapAsyncStatus status = WGPUMapAsyncStatus_Unknown;
123-
WGPUBufferMapCallbackInfo2 callbackInfo = {};
122+
WGPUMapAsyncStatus status = WGPUMapAsyncStatus(0);
123+
WGPUBufferMapCallbackInfo callbackInfo = {};
124124
callbackInfo.mode = WGPUCallbackMode_WaitAnyOnly;
125-
callbackInfo.callback = [](WGPUMapAsyncStatus status_, const char* message, void* userdata1, void* userdata2)
125+
callbackInfo.callback = [](WGPUMapAsyncStatus status_, WGPUStringView message, void* userdata1, void* userdata2)
126126
{
127127
*(WGPUMapAsyncStatus*)userdata1 = status_;
128128
if (status_ != WGPUMapAsyncStatus_Success)
129-
fprintf(stderr, "MapAsync wait failed with message: %s\n", message);
129+
{
130+
static_cast<DeviceImpl*>(userdata2)->reportError("wgpuBufferMapAsync", message);
131+
}
130132
};
131133
callbackInfo.userdata1 = &status;
132-
WGPUFuture future = m_ctx.api.wgpuBufferMapAsync2(bufferImpl->m_buffer, mapMode, offset, size, callbackInfo);
134+
callbackInfo.userdata2 = this;
135+
WGPUFuture future = m_ctx.api.wgpuBufferMapAsync(bufferImpl->m_buffer, mapMode, offset, size, callbackInfo);
133136
WGPUFutureWaitInfo futures[1] = {{future}};
134137
uint64_t timeoutNS = UINT64_MAX;
135138
WGPUWaitStatus waitStatus =

src/wgpu/wgpu-command.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -653,11 +653,11 @@ void CommandRecorder::cmdSetTextureState(const commands::SetTextureState& cmd)
653653
void CommandRecorder::cmdPushDebugGroup(const commands::PushDebugGroup& cmd)
654654
{
655655
if (m_renderPassEncoder)
656-
m_ctx.api.wgpuRenderPassEncoderPushDebugGroup(m_renderPassEncoder, cmd.name);
656+
m_ctx.api.wgpuRenderPassEncoderPushDebugGroup(m_renderPassEncoder, translateString(cmd.name));
657657
else if (m_computePassEncoder)
658-
m_ctx.api.wgpuComputePassEncoderPushDebugGroup(m_computePassEncoder, cmd.name);
658+
m_ctx.api.wgpuComputePassEncoderPushDebugGroup(m_computePassEncoder, translateString(cmd.name));
659659
else
660-
m_ctx.api.wgpuCommandEncoderPushDebugGroup(m_commandEncoder, cmd.name);
660+
m_ctx.api.wgpuCommandEncoderPushDebugGroup(m_commandEncoder, translateString(cmd.name));
661661
}
662662

663663
void CommandRecorder::cmdPopDebugGroup(const commands::PopDebugGroup& cmd)
@@ -673,11 +673,11 @@ void CommandRecorder::cmdPopDebugGroup(const commands::PopDebugGroup& cmd)
673673
void CommandRecorder::cmdInsertDebugMarker(const commands::InsertDebugMarker& cmd)
674674
{
675675
if (m_renderPassEncoder)
676-
m_ctx.api.wgpuRenderPassEncoderInsertDebugMarker(m_renderPassEncoder, cmd.name);
676+
m_ctx.api.wgpuRenderPassEncoderInsertDebugMarker(m_renderPassEncoder, translateString(cmd.name));
677677
else if (m_computePassEncoder)
678-
m_ctx.api.wgpuComputePassEncoderInsertDebugMarker(m_computePassEncoder, cmd.name);
678+
m_ctx.api.wgpuComputePassEncoderInsertDebugMarker(m_computePassEncoder, translateString(cmd.name));
679679
else
680-
m_ctx.api.wgpuCommandEncoderInsertDebugMarker(m_commandEncoder, cmd.name);
680+
m_ctx.api.wgpuCommandEncoderInsertDebugMarker(m_commandEncoder, translateString(cmd.name));
681681
}
682682

683683
void CommandRecorder::cmdWriteTimestamp(const commands::WriteTimestamp& cmd)
@@ -780,13 +780,13 @@ Result CommandQueueImpl::waitOnHost()
780780

781781
// Wait for the command buffer to finish executing
782782
{
783-
WGPUQueueWorkDoneStatus status = WGPUQueueWorkDoneStatus_Unknown;
784-
WGPUQueueWorkDoneCallbackInfo2 callbackInfo = {};
783+
WGPUQueueWorkDoneStatus status = WGPUQueueWorkDoneStatus(0);
784+
WGPUQueueWorkDoneCallbackInfo callbackInfo = {};
785785
callbackInfo.mode = WGPUCallbackMode_WaitAnyOnly;
786786
callbackInfo.callback = [](WGPUQueueWorkDoneStatus status_, void* userdata1, void* userdata2)
787787
{ *(WGPUQueueWorkDoneStatus*)userdata1 = status_; };
788788
callbackInfo.userdata1 = &status;
789-
WGPUFuture future = device->m_ctx.api.wgpuQueueOnSubmittedWorkDone2(m_queue, callbackInfo);
789+
WGPUFuture future = device->m_ctx.api.wgpuQueueOnSubmittedWorkDone(m_queue, callbackInfo);
790790
constexpr size_t futureCount = 1;
791791
WGPUFutureWaitInfo futures[futureCount] = {{future}};
792792
uint64_t timeoutNS = UINT64_MAX;

src/wgpu/wgpu-device.cpp

+65-46
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@
1414

1515
namespace rhi::wgpu {
1616

17-
static void errorCallback(WGPUErrorType type, const char* message, void* userdata)
18-
{
19-
DeviceImpl* device = static_cast<DeviceImpl*>(userdata);
20-
device->handleError(type, message);
21-
}
22-
2317
Context::~Context()
2418
{
2519
if (device)
@@ -52,17 +46,30 @@ Result DeviceImpl::getNativeDeviceHandles(DeviceNativeHandles* outHandles)
5246
return SLANG_E_NOT_IMPLEMENTED;
5347
}
5448

55-
void DeviceImpl::handleError(WGPUErrorType type, const char* message)
49+
void DeviceImpl::reportError(const char* func, WGPUStringView message)
50+
{
51+
std::string msg = "WGPU error in " + std::string(func) + ": " + std::string(message.data, message.length);
52+
m_debugCallback->handleMessage(DebugMessageType::Error, DebugMessageSource::Driver, msg.c_str());
53+
}
54+
55+
void DeviceImpl::reportDeviceLost(WGPUDeviceLostReason reason, WGPUStringView message)
56+
{
57+
std::string msg = "WGPU device lost: " + std::string(message.data, message.length);
58+
m_debugCallback->handleMessage(DebugMessageType::Error, DebugMessageSource::Driver, msg.c_str());
59+
}
60+
61+
void DeviceImpl::reportUncapturedError(WGPUErrorType type, WGPUStringView message)
5662
{
57-
fprintf(stderr, "WGPU error: %s\n", message);
58-
this->m_lastError = type;
63+
std::string msg = "WGPU uncaptured error: " + std::string(message.data, message.length);
64+
m_debugCallback->handleMessage(DebugMessageType::Error, DebugMessageSource::Driver, msg.c_str());
65+
this->m_lastUncapturedError = type;
5966
}
6067

61-
WGPUErrorType DeviceImpl::getAndClearLastError()
68+
WGPUErrorType DeviceImpl::getAndClearLastUncapturedError()
6269
{
63-
WGPUErrorType lastError = this->m_lastError;
64-
this->m_lastError = WGPUErrorType_NoError;
65-
return lastError;
70+
WGPUErrorType error = this->m_lastUncapturedError;
71+
this->m_lastUncapturedError = WGPUErrorType_NoError;
72+
return error;
6673
}
6774

6875
Result DeviceImpl::initialize(const DeviceDesc& desc)
@@ -109,12 +116,12 @@ Result DeviceImpl::initialize(const DeviceDesc& desc)
109116
options.nextInChain = &togglesDesc.chain;
110117

111118
{
112-
WGPURequestAdapterStatus status = WGPURequestAdapterStatus_Unknown;
113-
WGPURequestAdapterCallbackInfo2 callbackInfo = {};
119+
WGPURequestAdapterStatus status = WGPURequestAdapterStatus(0);
120+
WGPURequestAdapterCallbackInfo callbackInfo = {};
114121
callbackInfo.mode = WGPUCallbackMode_WaitAnyOnly;
115122
callbackInfo.callback = [](WGPURequestAdapterStatus status_,
116123
WGPUAdapter adapter,
117-
const char* message,
124+
WGPUStringView message,
118125
void* userdata1,
119126
void* userdata2)
120127
{
@@ -123,7 +130,7 @@ Result DeviceImpl::initialize(const DeviceDesc& desc)
123130
};
124131
callbackInfo.userdata1 = &status;
125132
callbackInfo.userdata2 = &m_ctx.adapter;
126-
WGPUFuture future = m_ctx.api.wgpuInstanceRequestAdapter2(m_ctx.instance, &options, callbackInfo);
133+
WGPUFuture future = m_ctx.api.wgpuInstanceRequestAdapter(m_ctx.instance, &options, callbackInfo);
127134
WGPUFutureWaitInfo futures[1] = {{future}};
128135
uint64_t timeoutNS = UINT64_MAX;
129136
WGPUWaitStatus waitStatus =
@@ -139,53 +146,59 @@ Result DeviceImpl::initialize(const DeviceDesc& desc)
139146
api.wgpuAdapterGetLimits(m_ctx.adapter, &adapterLimits);
140147

141148
// Query adapter features.
142-
size_t adapterFeatureCount = api.wgpuAdapterEnumerateFeatures(m_ctx.adapter, nullptr);
143-
std::vector<WGPUFeatureName> adapterFeatures(adapterFeatureCount);
144-
api.wgpuAdapterEnumerateFeatures(m_ctx.adapter, adapterFeatures.data());
149+
WGPUSupportedFeatures adapterFeatures = {};
150+
api.wgpuAdapterGetFeatures(m_ctx.adapter, &adapterFeatures);
145151

146152
// We request a device with the maximum available limits and feature set.
147153
WGPURequiredLimits requiredLimits = {};
148154
requiredLimits.limits = adapterLimits.limits;
149155
WGPUDeviceDescriptor deviceDesc = {};
150-
deviceDesc.requiredFeatures = adapterFeatures.data();
151-
deviceDesc.requiredFeatureCount = adapterFeatures.size();
156+
deviceDesc.requiredFeatures = adapterFeatures.features;
157+
deviceDesc.requiredFeatureCount = adapterFeatures.featureCount;
152158
deviceDesc.requiredLimits = &requiredLimits;
153-
deviceDesc.uncapturedErrorCallbackInfo.callback = errorCallback;
154-
deviceDesc.uncapturedErrorCallbackInfo.userdata = this;
159+
deviceDesc.uncapturedErrorCallbackInfo.callback =
160+
[](const WGPUDevice* device, WGPUErrorType type, WGPUStringView message, void* userdata1, void* userdata2)
161+
{
162+
DeviceImpl* deviceImpl = static_cast<DeviceImpl*>(userdata1);
163+
deviceImpl->reportUncapturedError(type, message);
164+
};
165+
deviceDesc.uncapturedErrorCallbackInfo.userdata1 = this;
155166
deviceDesc.nextInChain = &togglesDesc.chain;
156167

157168
{
158-
WGPURequestDeviceStatus status = WGPURequestDeviceStatus_Unknown;
159-
WGPURequestDeviceCallbackInfo2 callbackInfo = {};
169+
WGPURequestDeviceStatus status = WGPURequestDeviceStatus(0);
170+
WGPURequestDeviceCallbackInfo callbackInfo = {};
160171
callbackInfo.mode = WGPUCallbackMode_WaitAnyOnly;
161-
callbackInfo.callback =
162-
[](WGPURequestDeviceStatus status_, WGPUDevice device, const char* message, void* userdata1, void* userdata2
163-
)
172+
callbackInfo.callback = [](WGPURequestDeviceStatus status_,
173+
WGPUDevice device,
174+
WGPUStringView message,
175+
void* userdata1,
176+
void* userdata2)
164177
{
165178
*(WGPURequestDeviceStatus*)userdata1 = status_;
166179
*(WGPUDevice*)userdata2 = device;
167180
};
168181
callbackInfo.userdata1 = &status;
169182
callbackInfo.userdata2 = &m_ctx.device;
170183

171-
WGPUDeviceLostCallbackInfo2 deviceLostCallbackInfo = {};
184+
WGPUDeviceLostCallbackInfo deviceLostCallbackInfo = {};
172185
deviceLostCallbackInfo.callback = [](const WGPUDevice* device,
173186
WGPUDeviceLostReason reason,
174-
const char* message,
187+
WGPUStringView message,
175188
void* userdata1,
176189
void* userdata2)
177190
{
178191
if (reason != WGPUDeviceLostReason_Destroyed)
179192
{
180193
DeviceImpl* deviceimpl = static_cast<DeviceImpl*>(userdata1);
181-
deviceimpl->handleError(WGPUErrorType_DeviceLost, message);
194+
deviceimpl->reportDeviceLost(reason, message);
182195
}
183196
};
184197
deviceLostCallbackInfo.userdata1 = this;
185198
deviceLostCallbackInfo.mode = WGPUCallbackMode_AllowSpontaneous;
186-
deviceDesc.deviceLostCallbackInfo2 = deviceLostCallbackInfo;
199+
deviceDesc.deviceLostCallbackInfo = deviceLostCallbackInfo;
187200

188-
WGPUFuture future = m_ctx.api.wgpuAdapterRequestDevice2(m_ctx.adapter, &deviceDesc, callbackInfo);
201+
WGPUFuture future = m_ctx.api.wgpuAdapterRequestDevice(m_ctx.adapter, &deviceDesc, callbackInfo);
189202
WGPUFutureWaitInfo futures[1] = {{future}};
190203
uint64_t timeoutNS = UINT64_MAX;
191204
WGPUWaitStatus waitStatus =
@@ -204,10 +217,9 @@ Result DeviceImpl::initialize(const DeviceDesc& desc)
204217
m_info.limits.maxComputeDispatchThreadGroups[0] = m_ctx.limits.maxComputeWorkgroupSizeX;
205218

206219
// Query device features.
207-
size_t deviceFeatureCount = api.wgpuDeviceEnumerateFeatures(m_ctx.device, nullptr);
208-
std::vector<WGPUFeatureName> deviceFeatures(deviceFeatureCount);
209-
api.wgpuDeviceEnumerateFeatures(m_ctx.device, deviceFeatures.data());
210-
m_ctx.features.insert(deviceFeatures.begin(), deviceFeatures.end());
220+
WGPUSupportedFeatures supportedFeatures = {};
221+
api.wgpuDeviceGetFeatures(m_ctx.device, &supportedFeatures);
222+
m_ctx.features.insert(supportedFeatures.features, supportedFeatures.features + supportedFeatures.featureCount);
211223

212224
// Supports ParameterBlock
213225
m_features.push_back("parameter-block");
@@ -264,13 +276,13 @@ Result DeviceImpl::readBuffer(IBuffer* buffer, Offset offset, Size size, ISlangB
264276

265277
// Wait for the command buffer to finish executing
266278
{
267-
WGPUQueueWorkDoneStatus status = WGPUQueueWorkDoneStatus_Unknown;
268-
WGPUQueueWorkDoneCallbackInfo2 callbackInfo = {};
279+
WGPUQueueWorkDoneStatus status = WGPUQueueWorkDoneStatus(0);
280+
WGPUQueueWorkDoneCallbackInfo callbackInfo = {};
269281
callbackInfo.mode = WGPUCallbackMode_WaitAnyOnly;
270282
callbackInfo.callback = [](WGPUQueueWorkDoneStatus status_, void* userdata1, void* userdata2)
271283
{ *(WGPUQueueWorkDoneStatus*)userdata1 = status_; };
272284
callbackInfo.userdata1 = &status;
273-
WGPUFuture future = m_ctx.api.wgpuQueueOnSubmittedWorkDone2(queue, callbackInfo);
285+
WGPUFuture future = m_ctx.api.wgpuQueueOnSubmittedWorkDone(queue, callbackInfo);
274286
WGPUFutureWaitInfo futures[1] = {{future}};
275287
uint64_t timeoutNS = UINT64_MAX;
276288
WGPUWaitStatus waitStatus =
@@ -283,13 +295,20 @@ Result DeviceImpl::readBuffer(IBuffer* buffer, Offset offset, Size size, ISlangB
283295

284296
// Map the staging buffer
285297
{
286-
WGPUMapAsyncStatus status = WGPUMapAsyncStatus_Unknown;
287-
WGPUBufferMapCallbackInfo2 callbackInfo = {};
298+
WGPUMapAsyncStatus status = WGPUMapAsyncStatus(0);
299+
WGPUBufferMapCallbackInfo callbackInfo = {};
288300
callbackInfo.mode = WGPUCallbackMode_WaitAnyOnly;
289-
callbackInfo.callback = [](WGPUMapAsyncStatus status_, const char* message, void* userdata1, void* userdata2)
290-
{ *(WGPUMapAsyncStatus*)userdata1 = status_; };
301+
callbackInfo.callback = [](WGPUMapAsyncStatus status_, WGPUStringView message, void* userdata1, void* userdata2)
302+
{
303+
*(WGPUMapAsyncStatus*)userdata1 = status_;
304+
if (status_ != WGPUMapAsyncStatus_Success)
305+
{
306+
static_cast<DeviceImpl*>(userdata2)->reportError("wgpuBufferMapAsync", message);
307+
}
308+
};
291309
callbackInfo.userdata1 = &status;
292-
WGPUFuture future = m_ctx.api.wgpuBufferMapAsync2(stagingBuffer, WGPUMapMode_Read, 0, size, callbackInfo);
310+
callbackInfo.userdata2 = this;
311+
WGPUFuture future = m_ctx.api.wgpuBufferMapAsync(stagingBuffer, WGPUMapMode_Read, 0, size, callbackInfo);
293312
WGPUFutureWaitInfo futures[1] = {{future}};
294313
uint64_t timeoutNS = UINT64_MAX;
295314
WGPUWaitStatus waitStatus =

src/wgpu/wgpu-device.h

+5-3
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ class DeviceImpl : public Device
3232
~DeviceImpl();
3333
virtual SLANG_NO_THROW Result SLANG_MCALL initialize(const DeviceDesc& desc) override;
3434

35-
void handleError(WGPUErrorType type, const char* message);
36-
WGPUErrorType getAndClearLastError();
35+
void reportError(const char* func, WGPUStringView message);
36+
void reportDeviceLost(WGPUDeviceLostReason reason, WGPUStringView message);
37+
void reportUncapturedError(WGPUErrorType type, WGPUStringView message);
38+
WGPUErrorType getAndClearLastUncapturedError();
3739

3840
// IDevice implementation
3941
virtual SLANG_NO_THROW Result SLANG_MCALL getFormatSupport(Format format, FormatSupport* outFormatSupport) override;
@@ -102,7 +104,7 @@ class DeviceImpl : public Device
102104
virtual SLANG_NO_THROW Result SLANG_MCALL getNativeDeviceHandles(DeviceNativeHandles* outHandles) override;
103105

104106
private:
105-
WGPUErrorType m_lastError = WGPUErrorType_NoError;
107+
WGPUErrorType m_lastUncapturedError = WGPUErrorType_NoError;
106108
};
107109

108110
} // namespace rhi::wgpu

src/wgpu/wgpu-pipeline.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Result DeviceImpl::createRenderPipeline2(const RenderPipelineDesc& desc, IRender
4646
pipelineDesc.layout = program->m_rootObjectLayout->m_pipelineLayout;
4747

4848
pipelineDesc.vertex.module = vertexModule->module;
49-
pipelineDesc.vertex.entryPoint = vertexModule->entryPointName.c_str();
49+
pipelineDesc.vertex.entryPoint = translateString(vertexModule->entryPointName.c_str());
5050
pipelineDesc.vertex.buffers = inputLayout->m_vertexBufferLayouts.data();
5151
pipelineDesc.vertex.bufferCount = (uint32_t)inputLayout->m_vertexBufferLayouts.size();
5252

@@ -109,7 +109,7 @@ Result DeviceImpl::createRenderPipeline2(const RenderPipelineDesc& desc, IRender
109109

110110
WGPUFragmentState fragment = {};
111111
fragment.module = fragmentModule->module;
112-
fragment.entryPoint = fragmentModule->entryPointName.c_str();
112+
fragment.entryPoint = translateString(fragmentModule->entryPointName.c_str());
113113
fragment.targetCount = targets.size();
114114
fragment.targets = targets.data();
115115
pipelineDesc.fragment = &fragment;
@@ -161,7 +161,7 @@ Result DeviceImpl::createComputePipeline2(const ComputePipelineDesc& desc, IComp
161161
WGPUComputePipelineDescriptor pipelineDesc = {};
162162
pipelineDesc.layout = program->m_rootObjectLayout->m_pipelineLayout;
163163
pipelineDesc.compute.module = computeModule->module;
164-
pipelineDesc.compute.entryPoint = computeModule->entryPointName.c_str();
164+
pipelineDesc.compute.entryPoint = translateString(computeModule->entryPointName.c_str());
165165

166166
RefPtr<ComputePipelineImpl> pipeline = new ComputePipelineImpl(this);
167167
pipeline->m_program = program;

src/wgpu/wgpu-sampler.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Result DeviceImpl::createSampler(const SamplerDesc& desc, ISampler** outSampler)
4141
samplerDesc.compare = translateCompareFunction(desc.comparisonFunc);
4242
}
4343
samplerDesc.maxAnisotropy = desc.maxAnisotropy;
44-
samplerDesc.label = desc.label;
44+
samplerDesc.label = translateString(desc.label);
4545
sampler->m_sampler = m_ctx.api.wgpuDeviceCreateSampler(m_ctx.device, &samplerDesc);
4646
if (!sampler->m_sampler)
4747
{

src/wgpu/wgpu-shader-program.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Result ShaderProgramImpl::createShaderModule(slang::EntryPointReflection* entryP
4242
return SLANG_FAIL;
4343
}
4444

45-
if (m_device->getAndClearLastError() != WGPUErrorType_NoError)
45+
if (m_device->getAndClearLastUncapturedError() != WGPUErrorType_NoError)
4646
{
4747
return SLANG_FAIL;
4848
}

0 commit comments

Comments
 (0)