mirror of
https://github.com/ocornut/imgui.git
synced 2026-09-10 07:55:55 +00:00
Backends, Examples: WebGPU: fixed warnings, renamed .sln, fixed SDL2+WGPU cmakefile.
This commit is contained in:
@@ -330,29 +330,25 @@ static WGPUDevice RequestDevice(wgpu::Instance& instance, wgpu::Adapter& adapter
|
||||
static void handle_request_adapter(WGPURequestAdapterStatus status, WGPUAdapter adapter, WGPUStringView message, void* userdata1, void* userdata2)
|
||||
{
|
||||
IM_UNUSED(userdata2);
|
||||
if (status == WGPURequestAdapterStatus_Success)
|
||||
{
|
||||
WGPUAdapter* extAdapter = (WGPUAdapter*)userdata1;
|
||||
*extAdapter = adapter;
|
||||
}
|
||||
else
|
||||
if (status != WGPURequestAdapterStatus_Success)
|
||||
{
|
||||
printf("Request_adapter status=%#.8x message=%.*s\n", status, (int)message.length, message.data);
|
||||
return;
|
||||
}
|
||||
WGPUAdapter* extAdapter = (WGPUAdapter*)userdata1;
|
||||
*extAdapter = adapter;
|
||||
}
|
||||
|
||||
static void handle_request_device(WGPURequestDeviceStatus status, WGPUDevice device, WGPUStringView message, void* userdata1, void* userdata2)
|
||||
{
|
||||
IM_UNUSED(userdata2);
|
||||
if (status == WGPURequestDeviceStatus_Success)
|
||||
{
|
||||
WGPUDevice* extDevice = (WGPUDevice*)userdata1;
|
||||
*extDevice = device;
|
||||
}
|
||||
else
|
||||
if (status != WGPURequestDeviceStatus_Success)
|
||||
{
|
||||
printf("Request_device status=%#.8x message=%.*s\n", status, (int)message.length, message.data);
|
||||
return;
|
||||
}
|
||||
WGPUDevice* extDevice = (WGPUDevice*)userdata1;
|
||||
*extDevice = device;
|
||||
}
|
||||
|
||||
static WGPUAdapter RequestAdapter(WGPUInstance& instance)
|
||||
@@ -379,6 +375,7 @@ static WGPUDevice RequestDevice(WGPUInstance& instance, WGPUAdapter& adapter)
|
||||
deviceCallbackInfo.mode = WGPUCallbackMode_WaitAnyOnly;
|
||||
deviceCallbackInfo.callback = handle_request_device;
|
||||
deviceCallbackInfo.userdata1 = &local_device;
|
||||
|
||||
WGPUFuture future = wgpuAdapterRequestDevice(adapter, nullptr, deviceCallbackInfo);
|
||||
WGPUFutureWaitInfo waitInfo = { future, false };
|
||||
wgpuInstanceWaitAny(instance, 1, &waitInfo, ~0ull);
|
||||
@@ -437,7 +434,7 @@ static bool InitWGPU(SDL_Window* window)
|
||||
|
||||
#if defined(IMGUI_IMPL_WEBGPU_BACKEND_WGPU)
|
||||
wgpuSetLogCallback(
|
||||
[](WGPULogLevel level, WGPUStringView msg, void* userdata) { fprintf(stderr, "%s: %.*s\n", ImGui_ImplWGPU_GetLogLevelName(level), (int)msg.length, msg.data); }, nullptr
|
||||
[](WGPULogLevel level, WGPUStringView msg, void*) { fprintf(stderr, "%s: %.*s\n", ImGui_ImplWGPU_GetLogLevelName(level), (int)msg.length, msg.data); }, nullptr
|
||||
);
|
||||
wgpuSetLogLevel(WGPULogLevel_Warn);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user