From 2293063d7a765381cd63b9cd4966190f12bacd38 Mon Sep 17 00:00:00 2001 From: Elie Michel Date: Mon, 14 Oct 2024 00:29:29 +0200 Subject: [PATCH] Adapt C examples --- examples/capture/CMakeLists.txt | 2 +- examples/compute/CMakeLists.txt | 2 +- examples/enumerate_adapters/CMakeLists.txt | 2 +- examples/framework/framework.c | 21 ++------------------- examples/texture_arrays/CMakeLists.txt | 2 +- examples/triangle/CMakeLists.txt | 2 +- 6 files changed, 7 insertions(+), 24 deletions(-) diff --git a/examples/capture/CMakeLists.txt b/examples/capture/CMakeLists.txt index db148c9a..606a33ca 100644 --- a/examples/capture/CMakeLists.txt +++ b/examples/capture/CMakeLists.txt @@ -16,7 +16,7 @@ include_directories(${CMAKE_SOURCE_DIR}/../ffi/webgpu-headers) include_directories(${CMAKE_SOURCE_DIR}/framework) if (WIN32) - set(OS_LIBRARIES d3dcompiler ws2_32 userenv bcrypt ntdll opengl32) + set(OS_LIBRARIES d3dcompiler ws2_32 userenv bcrypt ntdll opengl32 Propsys RuntimeObject) elseif(UNIX AND NOT APPLE) set(OS_LIBRARIES "-lm -ldl") elseif(APPLE) diff --git a/examples/compute/CMakeLists.txt b/examples/compute/CMakeLists.txt index e6efecfe..5f039e71 100644 --- a/examples/compute/CMakeLists.txt +++ b/examples/compute/CMakeLists.txt @@ -14,7 +14,7 @@ include_directories(${CMAKE_SOURCE_DIR}/../ffi/webgpu-headers) include_directories(${CMAKE_SOURCE_DIR}/framework) if (WIN32) - set(OS_LIBRARIES d3dcompiler ws2_32 userenv bcrypt ntdll opengl32) + set(OS_LIBRARIES d3dcompiler ws2_32 userenv bcrypt ntdll opengl32 Propsys RuntimeObject) elseif(UNIX AND NOT APPLE) set(OS_LIBRARIES "-lm -ldl") elseif(APPLE) diff --git a/examples/enumerate_adapters/CMakeLists.txt b/examples/enumerate_adapters/CMakeLists.txt index a939822d..65bb1262 100644 --- a/examples/enumerate_adapters/CMakeLists.txt +++ b/examples/enumerate_adapters/CMakeLists.txt @@ -14,7 +14,7 @@ include_directories(${CMAKE_SOURCE_DIR}/../ffi/webgpu-headers) include_directories(${CMAKE_SOURCE_DIR}/framework) if (WIN32) - set(OS_LIBRARIES d3dcompiler ws2_32 userenv bcrypt ntdll opengl32) + set(OS_LIBRARIES d3dcompiler ws2_32 userenv bcrypt ntdll opengl32 Propsys RuntimeObject) elseif(UNIX AND NOT APPLE) set(OS_LIBRARIES "-lm -ldl") elseif(APPLE) diff --git a/examples/framework/framework.c b/examples/framework/framework.c index f0729e51..5f61baed 100644 --- a/examples/framework/framework.c +++ b/examples/framework/framework.c @@ -121,7 +121,6 @@ WGPUBuffer frmwrk_device_create_buffer_init( printf("%snumAllocated=%zu\n", prefix, report.numAllocated); \ printf("%snumKeptFromUser=%zu\n", prefix, report.numKeptFromUser); \ printf("%snumReleasedFromUser=%zu\n", prefix, report.numReleasedFromUser); \ - printf("%snumError=%zu\n", prefix, report.numError); \ printf("%selementSize=%zu\n", prefix, report.elementSize) #define print_hub_report(report, prefix) \ @@ -136,6 +135,7 @@ WGPUBuffer frmwrk_device_create_buffer_init( print_registry_report(report.renderBundles, prefix "renderBundles."); \ print_registry_report(report.renderPipelines, prefix "renderPipelines."); \ print_registry_report(report.computePipelines, prefix "computePipelines."); \ + print_registry_report(report.pipelineCaches, prefix "pipelineCaches."); \ print_registry_report(report.querySets, prefix "querySets."); \ print_registry_report(report.textures, prefix "textures."); \ print_registry_report(report.textureViews, prefix "textureViews."); \ @@ -144,24 +144,7 @@ WGPUBuffer frmwrk_device_create_buffer_init( void frmwrk_print_global_report(WGPUGlobalReport report) { printf("struct WGPUGlobalReport {\n"); print_registry_report(report.surfaces, "\tsurfaces."); - - switch (report.backendType) { - case WGPUBackendType_D3D12: - print_hub_report(report.dx12, "\tdx12."); - break; - case WGPUBackendType_Metal: - print_hub_report(report.metal, "\tmetal."); - break; - case WGPUBackendType_Vulkan: - print_hub_report(report.vulkan, "\tvulkan."); - break; - case WGPUBackendType_OpenGL: - print_hub_report(report.gl, "\tgl."); - break; - default: - printf("[framework] frmwrk_print_global_report: invalid backend type: %d", - report.backendType); - } + print_hub_report(report.hub, "\thub."); printf("}\n"); } diff --git a/examples/texture_arrays/CMakeLists.txt b/examples/texture_arrays/CMakeLists.txt index 8f83ce64..2dc9d637 100644 --- a/examples/texture_arrays/CMakeLists.txt +++ b/examples/texture_arrays/CMakeLists.txt @@ -15,7 +15,7 @@ include_directories(${CMAKE_SOURCE_DIR}/framework) if (WIN32) add_definitions(-DGLFW_EXPOSE_NATIVE_WIN32) - set(OS_LIBRARIES d3dcompiler ws2_32 userenv bcrypt ntdll opengl32) + set(OS_LIBRARIES d3dcompiler ws2_32 userenv bcrypt ntdll opengl32 Propsys RuntimeObject) elseif(UNIX AND NOT APPLE) add_definitions(-DGLFW_EXPOSE_NATIVE_X11) add_definitions(-DGLFW_EXPOSE_NATIVE_WAYLAND) diff --git a/examples/triangle/CMakeLists.txt b/examples/triangle/CMakeLists.txt index 247c2617..b186e8e1 100644 --- a/examples/triangle/CMakeLists.txt +++ b/examples/triangle/CMakeLists.txt @@ -15,7 +15,7 @@ include_directories(${CMAKE_SOURCE_DIR}/framework) if (WIN32) add_definitions(-DGLFW_EXPOSE_NATIVE_WIN32) - set(OS_LIBRARIES d3dcompiler ws2_32 userenv bcrypt ntdll opengl32) + set(OS_LIBRARIES d3dcompiler ws2_32 userenv bcrypt ntdll opengl32 Propsys RuntimeObject) elseif(UNIX AND NOT APPLE) add_definitions(-DGLFW_EXPOSE_NATIVE_X11) add_definitions(-DGLFW_EXPOSE_NATIVE_WAYLAND)