Skip to content

Commit

Permalink
Adapt C examples
Browse files Browse the repository at this point in the history
  • Loading branch information
eliemichel committed Oct 13, 2024
1 parent 2afb356 commit 2293063
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 24 deletions.
2 changes: 1 addition & 1 deletion examples/capture/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion examples/compute/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion examples/enumerate_adapters/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
21 changes: 2 additions & 19 deletions examples/framework/framework.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand All @@ -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."); \
Expand All @@ -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");
}

Expand Down
2 changes: 1 addition & 1 deletion examples/texture_arrays/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion examples/triangle/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2293063

Please sign in to comment.