Skip to content

Commit

Permalink
Merge pull request #14 from Ljiong201108/main
Browse files Browse the repository at this point in the history
Fix the X11 error when trying to run the template on Linux
  • Loading branch information
wi-re authored Nov 6, 2024
2 parents 89fc440 + c4de0ec commit 245163b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ add_subdirectory(thirdparty/webgpu)
add_subdirectory(thirdparty/glfw3webgpu)
add_subdirectory(thirdparty/imgui)

option(USE_HIGH_PERFORMANCE_GPU "Use high performance GPU, most likely a discrete GPU, should be left ON except for trouble shooting purposes." ON)
if (USE_HIGH_PERFORMANCE_GPU)
add_compile_definitions(WGPU_GPU_HIGH_PERFORMANCE="ON")
endif()

add_executable(Template
src/implementations.cpp
src/main.cpp
Expand Down
3 changes: 3 additions & 0 deletions src/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ void Renderer::initWindowAndDevice()

RequestAdapterOptions adapterOpts{};
adapterOpts.compatibleSurface = surface;
#ifdef WGPU_GPU_HIGH_PERFORMANCE
adapterOpts.powerPreference = WGPUPowerPreference_HighPerformance;
#endif
Adapter adapter = instance.requestAdapter(adapterOpts);

SupportedLimits supportedLimits;
Expand Down

0 comments on commit 245163b

Please sign in to comment.