diff --git a/CMakeLists.txt b/CMakeLists.txt index 90157ec..d08277c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,12 @@ endif() target_compile_definitions(graphite PUBLIC PLATFORM_EXT=${PLATFORM_EXT}) target_compile_definitions(graphite PUBLIC PLATFORM=${PLATFORM}) +# Samples directory +if(GRAPHITE_SAMPLES) + add_subdirectory("sample") + set(GRAPHITE_IMGUI_DIR "${CMAKE_SOURCE_DIR}/sample/extern/imgui/") +endif() + # ImGUI support if(GRAPHITE_IMGUI_DIR) # Sources @@ -87,10 +93,5 @@ if(GRAPHITE_PLATFORM STREQUAL "Vulkan") ) endif() -# Samples directory -if(GRAPHITE_SAMPLES) - add_subdirectory("samples") -endif() - # External dependencies add_subdirectory("extern") diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt index ba9504b..c1cf263 100644 --- a/extern/CMakeLists.txt +++ b/extern/CMakeLists.txt @@ -5,5 +5,6 @@ if(GRAPHITE_PLATFORM STREQUAL "Vulkan") target_compile_definitions(graphite PUBLIC IMGUI_IMPL_VULKAN_USE_VOLK) # VMA + target_compile_definitions(graphite PRIVATE NOMINMAX) target_include_directories(graphite PUBLIC "./vma") endif() diff --git a/extern/volk/CMakeLists.txt b/extern/volk/CMakeLists.txt index 6bd2010..b46bc63 100644 --- a/extern/volk/CMakeLists.txt +++ b/extern/volk/CMakeLists.txt @@ -142,5 +142,4 @@ if(VOLK_INSTALL) ${CMAKE_CURRENT_BINARY_DIR}/volkConfigVersion.cmake DESTINATION ${INSTALL_CONFIGDIR} ) - endif() diff --git a/sample/CMakeLists.txt b/sample/CMakeLists.txt new file mode 100644 index 0000000..5cf8fd8 --- /dev/null +++ b/sample/CMakeLists.txt @@ -0,0 +1,20 @@ +set(SAMPLE_DIR .) +set(EXE_NAME sample) + +# Executable target +project(${EXE_NAME}) +add_executable(${EXE_NAME} "${SAMPLE_DIR}/src/main.cc") +set_target_properties(${EXE_NAME} PROPERTIES OUTPUT_NAME ${EXE_NAME}) + +# Add compiler definitions +target_compile_definitions(${EXE_NAME} PRIVATE $<$:DEBUG=1>) +target_compile_definitions(${EXE_NAME} PRIVATE $<$:NDEBUG=1>) + +# Include directories +target_include_directories(${EXE_NAME} PRIVATE "${SAMPLE_DIR}/src/") + +# Link to the Graphite library +target_link_libraries(${EXE_NAME} PRIVATE graphite) + +# External dependencies +add_subdirectory("extern") diff --git a/samples/testing/assets/test.png b/sample/assets/test.png similarity index 100% rename from samples/testing/assets/test.png rename to sample/assets/test.png diff --git a/samples/testing/extern/CMakeLists.txt b/sample/extern/CMakeLists.txt similarity index 74% rename from samples/testing/extern/CMakeLists.txt rename to sample/extern/CMakeLists.txt index a1b41f2..c0f52c0 100644 --- a/samples/testing/extern/CMakeLists.txt +++ b/sample/extern/CMakeLists.txt @@ -1,9 +1,9 @@ # GLFW add_subdirectory("glfw") -target_link_libraries(sample-testing PRIVATE glfw) +target_link_libraries(sample PRIVATE glfw) # ImGUI -target_sources(sample-testing +target_sources(sample PRIVATE "./imgui/imgui_demo.cpp" PRIVATE "./imgui/imgui_draw.cpp" PRIVATE "./imgui/imgui_tables.cpp" @@ -13,12 +13,12 @@ target_sources(sample-testing PRIVATE "./imgui/backends/imgui_impl_vulkan.cpp" PRIVATE "./imgui/backends/imgui_impl_win32.cpp" ) -target_include_directories(sample-testing +target_include_directories(sample PRIVATE "./imgui" PRIVATE "./imgui/backends" ) # STB Image -target_include_directories(sample-testing +target_include_directories(sample PRIVATE "./stb_image" ) \ No newline at end of file diff --git a/samples/testing/extern/glfw/.editorconfig b/sample/extern/glfw/.editorconfig similarity index 100% rename from samples/testing/extern/glfw/.editorconfig rename to sample/extern/glfw/.editorconfig diff --git a/samples/testing/extern/glfw/.mailmap b/sample/extern/glfw/.mailmap similarity index 100% rename from samples/testing/extern/glfw/.mailmap rename to sample/extern/glfw/.mailmap diff --git a/samples/testing/extern/glfw/CMake/GenerateMappings.cmake b/sample/extern/glfw/CMake/GenerateMappings.cmake similarity index 100% rename from samples/testing/extern/glfw/CMake/GenerateMappings.cmake rename to sample/extern/glfw/CMake/GenerateMappings.cmake diff --git a/samples/testing/extern/glfw/CMake/Info.plist.in b/sample/extern/glfw/CMake/Info.plist.in similarity index 100% rename from samples/testing/extern/glfw/CMake/Info.plist.in rename to sample/extern/glfw/CMake/Info.plist.in diff --git a/samples/testing/extern/glfw/CMake/cmake_uninstall.cmake.in b/sample/extern/glfw/CMake/cmake_uninstall.cmake.in similarity index 100% rename from samples/testing/extern/glfw/CMake/cmake_uninstall.cmake.in rename to sample/extern/glfw/CMake/cmake_uninstall.cmake.in diff --git a/samples/testing/extern/glfw/CMake/glfw3.pc.in b/sample/extern/glfw/CMake/glfw3.pc.in similarity index 100% rename from samples/testing/extern/glfw/CMake/glfw3.pc.in rename to sample/extern/glfw/CMake/glfw3.pc.in diff --git a/samples/testing/extern/glfw/CMake/glfw3Config.cmake.in b/sample/extern/glfw/CMake/glfw3Config.cmake.in similarity index 100% rename from samples/testing/extern/glfw/CMake/glfw3Config.cmake.in rename to sample/extern/glfw/CMake/glfw3Config.cmake.in diff --git a/samples/testing/extern/glfw/CMake/i686-w64-mingw32-clang.cmake b/sample/extern/glfw/CMake/i686-w64-mingw32-clang.cmake similarity index 100% rename from samples/testing/extern/glfw/CMake/i686-w64-mingw32-clang.cmake rename to sample/extern/glfw/CMake/i686-w64-mingw32-clang.cmake diff --git a/samples/testing/extern/glfw/CMake/i686-w64-mingw32.cmake b/sample/extern/glfw/CMake/i686-w64-mingw32.cmake similarity index 100% rename from samples/testing/extern/glfw/CMake/i686-w64-mingw32.cmake rename to sample/extern/glfw/CMake/i686-w64-mingw32.cmake diff --git a/samples/testing/extern/glfw/CMake/modules/FindEpollShim.cmake b/sample/extern/glfw/CMake/modules/FindEpollShim.cmake similarity index 100% rename from samples/testing/extern/glfw/CMake/modules/FindEpollShim.cmake rename to sample/extern/glfw/CMake/modules/FindEpollShim.cmake diff --git a/samples/testing/extern/glfw/CMake/x86_64-w64-mingw32-clang.cmake b/sample/extern/glfw/CMake/x86_64-w64-mingw32-clang.cmake similarity index 100% rename from samples/testing/extern/glfw/CMake/x86_64-w64-mingw32-clang.cmake rename to sample/extern/glfw/CMake/x86_64-w64-mingw32-clang.cmake diff --git a/samples/testing/extern/glfw/CMake/x86_64-w64-mingw32.cmake b/sample/extern/glfw/CMake/x86_64-w64-mingw32.cmake similarity index 100% rename from samples/testing/extern/glfw/CMake/x86_64-w64-mingw32.cmake rename to sample/extern/glfw/CMake/x86_64-w64-mingw32.cmake diff --git a/samples/testing/extern/glfw/CMakeLists.txt b/sample/extern/glfw/CMakeLists.txt similarity index 100% rename from samples/testing/extern/glfw/CMakeLists.txt rename to sample/extern/glfw/CMakeLists.txt diff --git a/samples/testing/extern/glfw/CONTRIBUTORS.md b/sample/extern/glfw/CONTRIBUTORS.md similarity index 100% rename from samples/testing/extern/glfw/CONTRIBUTORS.md rename to sample/extern/glfw/CONTRIBUTORS.md diff --git a/samples/testing/extern/glfw/LICENSE.md b/sample/extern/glfw/LICENSE.md similarity index 100% rename from samples/testing/extern/glfw/LICENSE.md rename to sample/extern/glfw/LICENSE.md diff --git a/samples/testing/extern/glfw/README.md b/sample/extern/glfw/README.md similarity index 100% rename from samples/testing/extern/glfw/README.md rename to sample/extern/glfw/README.md diff --git a/samples/testing/extern/glfw/deps/getopt.c b/sample/extern/glfw/deps/getopt.c similarity index 100% rename from samples/testing/extern/glfw/deps/getopt.c rename to sample/extern/glfw/deps/getopt.c diff --git a/samples/testing/extern/glfw/deps/getopt.h b/sample/extern/glfw/deps/getopt.h similarity index 100% rename from samples/testing/extern/glfw/deps/getopt.h rename to sample/extern/glfw/deps/getopt.h diff --git a/samples/testing/extern/glfw/deps/glad/gl.h b/sample/extern/glfw/deps/glad/gl.h similarity index 100% rename from samples/testing/extern/glfw/deps/glad/gl.h rename to sample/extern/glfw/deps/glad/gl.h diff --git a/samples/testing/extern/glfw/deps/glad/gles2.h b/sample/extern/glfw/deps/glad/gles2.h similarity index 100% rename from samples/testing/extern/glfw/deps/glad/gles2.h rename to sample/extern/glfw/deps/glad/gles2.h diff --git a/samples/testing/extern/glfw/deps/glad/vulkan.h b/sample/extern/glfw/deps/glad/vulkan.h similarity index 100% rename from samples/testing/extern/glfw/deps/glad/vulkan.h rename to sample/extern/glfw/deps/glad/vulkan.h diff --git a/samples/testing/extern/glfw/deps/linmath.h b/sample/extern/glfw/deps/linmath.h similarity index 100% rename from samples/testing/extern/glfw/deps/linmath.h rename to sample/extern/glfw/deps/linmath.h diff --git a/samples/testing/extern/glfw/deps/mingw/_mingw_dxhelper.h b/sample/extern/glfw/deps/mingw/_mingw_dxhelper.h similarity index 100% rename from samples/testing/extern/glfw/deps/mingw/_mingw_dxhelper.h rename to sample/extern/glfw/deps/mingw/_mingw_dxhelper.h diff --git a/samples/testing/extern/glfw/deps/mingw/dinput.h b/sample/extern/glfw/deps/mingw/dinput.h similarity index 100% rename from samples/testing/extern/glfw/deps/mingw/dinput.h rename to sample/extern/glfw/deps/mingw/dinput.h diff --git a/samples/testing/extern/glfw/deps/mingw/xinput.h b/sample/extern/glfw/deps/mingw/xinput.h similarity index 100% rename from samples/testing/extern/glfw/deps/mingw/xinput.h rename to sample/extern/glfw/deps/mingw/xinput.h diff --git a/samples/testing/extern/glfw/deps/nuklear.h b/sample/extern/glfw/deps/nuklear.h similarity index 100% rename from samples/testing/extern/glfw/deps/nuklear.h rename to sample/extern/glfw/deps/nuklear.h diff --git a/samples/testing/extern/glfw/deps/nuklear_glfw_gl2.h b/sample/extern/glfw/deps/nuklear_glfw_gl2.h similarity index 100% rename from samples/testing/extern/glfw/deps/nuklear_glfw_gl2.h rename to sample/extern/glfw/deps/nuklear_glfw_gl2.h diff --git a/samples/testing/extern/glfw/deps/stb_image_write.h b/sample/extern/glfw/deps/stb_image_write.h similarity index 100% rename from samples/testing/extern/glfw/deps/stb_image_write.h rename to sample/extern/glfw/deps/stb_image_write.h diff --git a/samples/testing/extern/glfw/deps/tinycthread.c b/sample/extern/glfw/deps/tinycthread.c similarity index 100% rename from samples/testing/extern/glfw/deps/tinycthread.c rename to sample/extern/glfw/deps/tinycthread.c diff --git a/samples/testing/extern/glfw/deps/tinycthread.h b/sample/extern/glfw/deps/tinycthread.h similarity index 100% rename from samples/testing/extern/glfw/deps/tinycthread.h rename to sample/extern/glfw/deps/tinycthread.h diff --git a/samples/testing/extern/glfw/deps/wayland/fractional-scale-v1.xml b/sample/extern/glfw/deps/wayland/fractional-scale-v1.xml similarity index 100% rename from samples/testing/extern/glfw/deps/wayland/fractional-scale-v1.xml rename to sample/extern/glfw/deps/wayland/fractional-scale-v1.xml diff --git a/samples/testing/extern/glfw/deps/wayland/idle-inhibit-unstable-v1.xml b/sample/extern/glfw/deps/wayland/idle-inhibit-unstable-v1.xml similarity index 100% rename from samples/testing/extern/glfw/deps/wayland/idle-inhibit-unstable-v1.xml rename to sample/extern/glfw/deps/wayland/idle-inhibit-unstable-v1.xml diff --git a/samples/testing/extern/glfw/deps/wayland/pointer-constraints-unstable-v1.xml b/sample/extern/glfw/deps/wayland/pointer-constraints-unstable-v1.xml similarity index 100% rename from samples/testing/extern/glfw/deps/wayland/pointer-constraints-unstable-v1.xml rename to sample/extern/glfw/deps/wayland/pointer-constraints-unstable-v1.xml diff --git a/samples/testing/extern/glfw/deps/wayland/relative-pointer-unstable-v1.xml b/sample/extern/glfw/deps/wayland/relative-pointer-unstable-v1.xml similarity index 100% rename from samples/testing/extern/glfw/deps/wayland/relative-pointer-unstable-v1.xml rename to sample/extern/glfw/deps/wayland/relative-pointer-unstable-v1.xml diff --git a/samples/testing/extern/glfw/deps/wayland/viewporter.xml b/sample/extern/glfw/deps/wayland/viewporter.xml similarity index 100% rename from samples/testing/extern/glfw/deps/wayland/viewporter.xml rename to sample/extern/glfw/deps/wayland/viewporter.xml diff --git a/samples/testing/extern/glfw/deps/wayland/wayland.xml b/sample/extern/glfw/deps/wayland/wayland.xml similarity index 100% rename from samples/testing/extern/glfw/deps/wayland/wayland.xml rename to sample/extern/glfw/deps/wayland/wayland.xml diff --git a/samples/testing/extern/glfw/deps/wayland/xdg-activation-v1.xml b/sample/extern/glfw/deps/wayland/xdg-activation-v1.xml similarity index 100% rename from samples/testing/extern/glfw/deps/wayland/xdg-activation-v1.xml rename to sample/extern/glfw/deps/wayland/xdg-activation-v1.xml diff --git a/samples/testing/extern/glfw/deps/wayland/xdg-decoration-unstable-v1.xml b/sample/extern/glfw/deps/wayland/xdg-decoration-unstable-v1.xml similarity index 100% rename from samples/testing/extern/glfw/deps/wayland/xdg-decoration-unstable-v1.xml rename to sample/extern/glfw/deps/wayland/xdg-decoration-unstable-v1.xml diff --git a/samples/testing/extern/glfw/deps/wayland/xdg-shell.xml b/sample/extern/glfw/deps/wayland/xdg-shell.xml similarity index 100% rename from samples/testing/extern/glfw/deps/wayland/xdg-shell.xml rename to sample/extern/glfw/deps/wayland/xdg-shell.xml diff --git a/samples/testing/extern/glfw/include/GLFW/glfw3.h b/sample/extern/glfw/include/GLFW/glfw3.h similarity index 100% rename from samples/testing/extern/glfw/include/GLFW/glfw3.h rename to sample/extern/glfw/include/GLFW/glfw3.h diff --git a/samples/testing/extern/glfw/include/GLFW/glfw3native.h b/sample/extern/glfw/include/GLFW/glfw3native.h similarity index 100% rename from samples/testing/extern/glfw/include/GLFW/glfw3native.h rename to sample/extern/glfw/include/GLFW/glfw3native.h diff --git a/samples/testing/extern/glfw/src/CMakeLists.txt b/sample/extern/glfw/src/CMakeLists.txt similarity index 100% rename from samples/testing/extern/glfw/src/CMakeLists.txt rename to sample/extern/glfw/src/CMakeLists.txt diff --git a/samples/testing/extern/glfw/src/cocoa_init.m b/sample/extern/glfw/src/cocoa_init.m similarity index 100% rename from samples/testing/extern/glfw/src/cocoa_init.m rename to sample/extern/glfw/src/cocoa_init.m diff --git a/samples/testing/extern/glfw/src/cocoa_joystick.h b/sample/extern/glfw/src/cocoa_joystick.h similarity index 100% rename from samples/testing/extern/glfw/src/cocoa_joystick.h rename to sample/extern/glfw/src/cocoa_joystick.h diff --git a/samples/testing/extern/glfw/src/cocoa_joystick.m b/sample/extern/glfw/src/cocoa_joystick.m similarity index 100% rename from samples/testing/extern/glfw/src/cocoa_joystick.m rename to sample/extern/glfw/src/cocoa_joystick.m diff --git a/samples/testing/extern/glfw/src/cocoa_monitor.m b/sample/extern/glfw/src/cocoa_monitor.m similarity index 100% rename from samples/testing/extern/glfw/src/cocoa_monitor.m rename to sample/extern/glfw/src/cocoa_monitor.m diff --git a/samples/testing/extern/glfw/src/cocoa_platform.h b/sample/extern/glfw/src/cocoa_platform.h similarity index 100% rename from samples/testing/extern/glfw/src/cocoa_platform.h rename to sample/extern/glfw/src/cocoa_platform.h diff --git a/samples/testing/extern/glfw/src/cocoa_time.c b/sample/extern/glfw/src/cocoa_time.c similarity index 100% rename from samples/testing/extern/glfw/src/cocoa_time.c rename to sample/extern/glfw/src/cocoa_time.c diff --git a/samples/testing/extern/glfw/src/cocoa_time.h b/sample/extern/glfw/src/cocoa_time.h similarity index 100% rename from samples/testing/extern/glfw/src/cocoa_time.h rename to sample/extern/glfw/src/cocoa_time.h diff --git a/samples/testing/extern/glfw/src/cocoa_window.m b/sample/extern/glfw/src/cocoa_window.m similarity index 100% rename from samples/testing/extern/glfw/src/cocoa_window.m rename to sample/extern/glfw/src/cocoa_window.m diff --git a/samples/testing/extern/glfw/src/context.c b/sample/extern/glfw/src/context.c similarity index 100% rename from samples/testing/extern/glfw/src/context.c rename to sample/extern/glfw/src/context.c diff --git a/samples/testing/extern/glfw/src/egl_context.c b/sample/extern/glfw/src/egl_context.c similarity index 100% rename from samples/testing/extern/glfw/src/egl_context.c rename to sample/extern/glfw/src/egl_context.c diff --git a/samples/testing/extern/glfw/src/glfw.rc.in b/sample/extern/glfw/src/glfw.rc.in similarity index 100% rename from samples/testing/extern/glfw/src/glfw.rc.in rename to sample/extern/glfw/src/glfw.rc.in diff --git a/samples/testing/extern/glfw/src/glx_context.c b/sample/extern/glfw/src/glx_context.c similarity index 100% rename from samples/testing/extern/glfw/src/glx_context.c rename to sample/extern/glfw/src/glx_context.c diff --git a/samples/testing/extern/glfw/src/init.c b/sample/extern/glfw/src/init.c similarity index 100% rename from samples/testing/extern/glfw/src/init.c rename to sample/extern/glfw/src/init.c diff --git a/samples/testing/extern/glfw/src/input.c b/sample/extern/glfw/src/input.c similarity index 100% rename from samples/testing/extern/glfw/src/input.c rename to sample/extern/glfw/src/input.c diff --git a/samples/testing/extern/glfw/src/internal.h b/sample/extern/glfw/src/internal.h similarity index 100% rename from samples/testing/extern/glfw/src/internal.h rename to sample/extern/glfw/src/internal.h diff --git a/samples/testing/extern/glfw/src/linux_joystick.c b/sample/extern/glfw/src/linux_joystick.c similarity index 100% rename from samples/testing/extern/glfw/src/linux_joystick.c rename to sample/extern/glfw/src/linux_joystick.c diff --git a/samples/testing/extern/glfw/src/linux_joystick.h b/sample/extern/glfw/src/linux_joystick.h similarity index 100% rename from samples/testing/extern/glfw/src/linux_joystick.h rename to sample/extern/glfw/src/linux_joystick.h diff --git a/samples/testing/extern/glfw/src/mappings.h b/sample/extern/glfw/src/mappings.h similarity index 100% rename from samples/testing/extern/glfw/src/mappings.h rename to sample/extern/glfw/src/mappings.h diff --git a/samples/testing/extern/glfw/src/mappings.h.in b/sample/extern/glfw/src/mappings.h.in similarity index 100% rename from samples/testing/extern/glfw/src/mappings.h.in rename to sample/extern/glfw/src/mappings.h.in diff --git a/samples/testing/extern/glfw/src/monitor.c b/sample/extern/glfw/src/monitor.c similarity index 100% rename from samples/testing/extern/glfw/src/monitor.c rename to sample/extern/glfw/src/monitor.c diff --git a/samples/testing/extern/glfw/src/nsgl_context.m b/sample/extern/glfw/src/nsgl_context.m similarity index 100% rename from samples/testing/extern/glfw/src/nsgl_context.m rename to sample/extern/glfw/src/nsgl_context.m diff --git a/samples/testing/extern/glfw/src/null_init.c b/sample/extern/glfw/src/null_init.c similarity index 100% rename from samples/testing/extern/glfw/src/null_init.c rename to sample/extern/glfw/src/null_init.c diff --git a/samples/testing/extern/glfw/src/null_joystick.c b/sample/extern/glfw/src/null_joystick.c similarity index 100% rename from samples/testing/extern/glfw/src/null_joystick.c rename to sample/extern/glfw/src/null_joystick.c diff --git a/samples/testing/extern/glfw/src/null_joystick.h b/sample/extern/glfw/src/null_joystick.h similarity index 100% rename from samples/testing/extern/glfw/src/null_joystick.h rename to sample/extern/glfw/src/null_joystick.h diff --git a/samples/testing/extern/glfw/src/null_monitor.c b/sample/extern/glfw/src/null_monitor.c similarity index 100% rename from samples/testing/extern/glfw/src/null_monitor.c rename to sample/extern/glfw/src/null_monitor.c diff --git a/samples/testing/extern/glfw/src/null_platform.h b/sample/extern/glfw/src/null_platform.h similarity index 100% rename from samples/testing/extern/glfw/src/null_platform.h rename to sample/extern/glfw/src/null_platform.h diff --git a/samples/testing/extern/glfw/src/null_window.c b/sample/extern/glfw/src/null_window.c similarity index 100% rename from samples/testing/extern/glfw/src/null_window.c rename to sample/extern/glfw/src/null_window.c diff --git a/samples/testing/extern/glfw/src/osmesa_context.c b/sample/extern/glfw/src/osmesa_context.c similarity index 100% rename from samples/testing/extern/glfw/src/osmesa_context.c rename to sample/extern/glfw/src/osmesa_context.c diff --git a/samples/testing/extern/glfw/src/platform.c b/sample/extern/glfw/src/platform.c similarity index 100% rename from samples/testing/extern/glfw/src/platform.c rename to sample/extern/glfw/src/platform.c diff --git a/samples/testing/extern/glfw/src/platform.h b/sample/extern/glfw/src/platform.h similarity index 100% rename from samples/testing/extern/glfw/src/platform.h rename to sample/extern/glfw/src/platform.h diff --git a/samples/testing/extern/glfw/src/posix_module.c b/sample/extern/glfw/src/posix_module.c similarity index 100% rename from samples/testing/extern/glfw/src/posix_module.c rename to sample/extern/glfw/src/posix_module.c diff --git a/samples/testing/extern/glfw/src/posix_poll.c b/sample/extern/glfw/src/posix_poll.c similarity index 100% rename from samples/testing/extern/glfw/src/posix_poll.c rename to sample/extern/glfw/src/posix_poll.c diff --git a/samples/testing/extern/glfw/src/posix_poll.h b/sample/extern/glfw/src/posix_poll.h similarity index 100% rename from samples/testing/extern/glfw/src/posix_poll.h rename to sample/extern/glfw/src/posix_poll.h diff --git a/samples/testing/extern/glfw/src/posix_thread.c b/sample/extern/glfw/src/posix_thread.c similarity index 100% rename from samples/testing/extern/glfw/src/posix_thread.c rename to sample/extern/glfw/src/posix_thread.c diff --git a/samples/testing/extern/glfw/src/posix_thread.h b/sample/extern/glfw/src/posix_thread.h similarity index 100% rename from samples/testing/extern/glfw/src/posix_thread.h rename to sample/extern/glfw/src/posix_thread.h diff --git a/samples/testing/extern/glfw/src/posix_time.c b/sample/extern/glfw/src/posix_time.c similarity index 100% rename from samples/testing/extern/glfw/src/posix_time.c rename to sample/extern/glfw/src/posix_time.c diff --git a/samples/testing/extern/glfw/src/posix_time.h b/sample/extern/glfw/src/posix_time.h similarity index 100% rename from samples/testing/extern/glfw/src/posix_time.h rename to sample/extern/glfw/src/posix_time.h diff --git a/samples/testing/extern/glfw/src/vulkan.c b/sample/extern/glfw/src/vulkan.c similarity index 100% rename from samples/testing/extern/glfw/src/vulkan.c rename to sample/extern/glfw/src/vulkan.c diff --git a/samples/testing/extern/glfw/src/wgl_context.c b/sample/extern/glfw/src/wgl_context.c similarity index 100% rename from samples/testing/extern/glfw/src/wgl_context.c rename to sample/extern/glfw/src/wgl_context.c diff --git a/samples/testing/extern/glfw/src/win32_init.c b/sample/extern/glfw/src/win32_init.c similarity index 100% rename from samples/testing/extern/glfw/src/win32_init.c rename to sample/extern/glfw/src/win32_init.c diff --git a/samples/testing/extern/glfw/src/win32_joystick.c b/sample/extern/glfw/src/win32_joystick.c similarity index 100% rename from samples/testing/extern/glfw/src/win32_joystick.c rename to sample/extern/glfw/src/win32_joystick.c diff --git a/samples/testing/extern/glfw/src/win32_joystick.h b/sample/extern/glfw/src/win32_joystick.h similarity index 100% rename from samples/testing/extern/glfw/src/win32_joystick.h rename to sample/extern/glfw/src/win32_joystick.h diff --git a/samples/testing/extern/glfw/src/win32_module.c b/sample/extern/glfw/src/win32_module.c similarity index 100% rename from samples/testing/extern/glfw/src/win32_module.c rename to sample/extern/glfw/src/win32_module.c diff --git a/samples/testing/extern/glfw/src/win32_monitor.c b/sample/extern/glfw/src/win32_monitor.c similarity index 100% rename from samples/testing/extern/glfw/src/win32_monitor.c rename to sample/extern/glfw/src/win32_monitor.c diff --git a/samples/testing/extern/glfw/src/win32_platform.h b/sample/extern/glfw/src/win32_platform.h similarity index 100% rename from samples/testing/extern/glfw/src/win32_platform.h rename to sample/extern/glfw/src/win32_platform.h diff --git a/samples/testing/extern/glfw/src/win32_thread.c b/sample/extern/glfw/src/win32_thread.c similarity index 100% rename from samples/testing/extern/glfw/src/win32_thread.c rename to sample/extern/glfw/src/win32_thread.c diff --git a/samples/testing/extern/glfw/src/win32_thread.h b/sample/extern/glfw/src/win32_thread.h similarity index 100% rename from samples/testing/extern/glfw/src/win32_thread.h rename to sample/extern/glfw/src/win32_thread.h diff --git a/samples/testing/extern/glfw/src/win32_time.c b/sample/extern/glfw/src/win32_time.c similarity index 100% rename from samples/testing/extern/glfw/src/win32_time.c rename to sample/extern/glfw/src/win32_time.c diff --git a/samples/testing/extern/glfw/src/win32_time.h b/sample/extern/glfw/src/win32_time.h similarity index 100% rename from samples/testing/extern/glfw/src/win32_time.h rename to sample/extern/glfw/src/win32_time.h diff --git a/samples/testing/extern/glfw/src/win32_window.c b/sample/extern/glfw/src/win32_window.c similarity index 100% rename from samples/testing/extern/glfw/src/win32_window.c rename to sample/extern/glfw/src/win32_window.c diff --git a/samples/testing/extern/glfw/src/window.c b/sample/extern/glfw/src/window.c similarity index 100% rename from samples/testing/extern/glfw/src/window.c rename to sample/extern/glfw/src/window.c diff --git a/samples/testing/extern/glfw/src/wl_init.c b/sample/extern/glfw/src/wl_init.c similarity index 100% rename from samples/testing/extern/glfw/src/wl_init.c rename to sample/extern/glfw/src/wl_init.c diff --git a/samples/testing/extern/glfw/src/wl_monitor.c b/sample/extern/glfw/src/wl_monitor.c similarity index 100% rename from samples/testing/extern/glfw/src/wl_monitor.c rename to sample/extern/glfw/src/wl_monitor.c diff --git a/samples/testing/extern/glfw/src/wl_platform.h b/sample/extern/glfw/src/wl_platform.h similarity index 100% rename from samples/testing/extern/glfw/src/wl_platform.h rename to sample/extern/glfw/src/wl_platform.h diff --git a/samples/testing/extern/glfw/src/wl_window.c b/sample/extern/glfw/src/wl_window.c similarity index 100% rename from samples/testing/extern/glfw/src/wl_window.c rename to sample/extern/glfw/src/wl_window.c diff --git a/samples/testing/extern/glfw/src/x11_init.c b/sample/extern/glfw/src/x11_init.c similarity index 100% rename from samples/testing/extern/glfw/src/x11_init.c rename to sample/extern/glfw/src/x11_init.c diff --git a/samples/testing/extern/glfw/src/x11_monitor.c b/sample/extern/glfw/src/x11_monitor.c similarity index 100% rename from samples/testing/extern/glfw/src/x11_monitor.c rename to sample/extern/glfw/src/x11_monitor.c diff --git a/samples/testing/extern/glfw/src/x11_platform.h b/sample/extern/glfw/src/x11_platform.h similarity index 100% rename from samples/testing/extern/glfw/src/x11_platform.h rename to sample/extern/glfw/src/x11_platform.h diff --git a/samples/testing/extern/glfw/src/x11_window.c b/sample/extern/glfw/src/x11_window.c similarity index 100% rename from samples/testing/extern/glfw/src/x11_window.c rename to sample/extern/glfw/src/x11_window.c diff --git a/samples/testing/extern/glfw/src/xkb_unicode.c b/sample/extern/glfw/src/xkb_unicode.c similarity index 100% rename from samples/testing/extern/glfw/src/xkb_unicode.c rename to sample/extern/glfw/src/xkb_unicode.c diff --git a/samples/testing/extern/glfw/src/xkb_unicode.h b/sample/extern/glfw/src/xkb_unicode.h similarity index 100% rename from samples/testing/extern/glfw/src/xkb_unicode.h rename to sample/extern/glfw/src/xkb_unicode.h diff --git a/samples/testing/extern/imgui/.editorconfig b/sample/extern/imgui/.editorconfig similarity index 100% rename from samples/testing/extern/imgui/.editorconfig rename to sample/extern/imgui/.editorconfig diff --git a/samples/testing/extern/imgui/.gitattributes b/sample/extern/imgui/.gitattributes similarity index 100% rename from samples/testing/extern/imgui/.gitattributes rename to sample/extern/imgui/.gitattributes diff --git a/samples/testing/extern/imgui/.gitignore b/sample/extern/imgui/.gitignore similarity index 100% rename from samples/testing/extern/imgui/.gitignore rename to sample/extern/imgui/.gitignore diff --git a/samples/testing/extern/imgui/LICENSE.txt b/sample/extern/imgui/LICENSE.txt similarity index 100% rename from samples/testing/extern/imgui/LICENSE.txt rename to sample/extern/imgui/LICENSE.txt diff --git a/samples/testing/extern/imgui/backends/imgui_impl_allegro5.cpp b/sample/extern/imgui/backends/imgui_impl_allegro5.cpp similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_allegro5.cpp rename to sample/extern/imgui/backends/imgui_impl_allegro5.cpp diff --git a/samples/testing/extern/imgui/backends/imgui_impl_allegro5.h b/sample/extern/imgui/backends/imgui_impl_allegro5.h similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_allegro5.h rename to sample/extern/imgui/backends/imgui_impl_allegro5.h diff --git a/samples/testing/extern/imgui/backends/imgui_impl_android.cpp b/sample/extern/imgui/backends/imgui_impl_android.cpp similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_android.cpp rename to sample/extern/imgui/backends/imgui_impl_android.cpp diff --git a/samples/testing/extern/imgui/backends/imgui_impl_android.h b/sample/extern/imgui/backends/imgui_impl_android.h similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_android.h rename to sample/extern/imgui/backends/imgui_impl_android.h diff --git a/samples/testing/extern/imgui/backends/imgui_impl_dx10.cpp b/sample/extern/imgui/backends/imgui_impl_dx10.cpp similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_dx10.cpp rename to sample/extern/imgui/backends/imgui_impl_dx10.cpp diff --git a/samples/testing/extern/imgui/backends/imgui_impl_dx10.h b/sample/extern/imgui/backends/imgui_impl_dx10.h similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_dx10.h rename to sample/extern/imgui/backends/imgui_impl_dx10.h diff --git a/samples/testing/extern/imgui/backends/imgui_impl_dx11.cpp b/sample/extern/imgui/backends/imgui_impl_dx11.cpp similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_dx11.cpp rename to sample/extern/imgui/backends/imgui_impl_dx11.cpp diff --git a/samples/testing/extern/imgui/backends/imgui_impl_dx11.h b/sample/extern/imgui/backends/imgui_impl_dx11.h similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_dx11.h rename to sample/extern/imgui/backends/imgui_impl_dx11.h diff --git a/samples/testing/extern/imgui/backends/imgui_impl_dx12.cpp b/sample/extern/imgui/backends/imgui_impl_dx12.cpp similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_dx12.cpp rename to sample/extern/imgui/backends/imgui_impl_dx12.cpp diff --git a/samples/testing/extern/imgui/backends/imgui_impl_dx12.h b/sample/extern/imgui/backends/imgui_impl_dx12.h similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_dx12.h rename to sample/extern/imgui/backends/imgui_impl_dx12.h diff --git a/samples/testing/extern/imgui/backends/imgui_impl_dx9.cpp b/sample/extern/imgui/backends/imgui_impl_dx9.cpp similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_dx9.cpp rename to sample/extern/imgui/backends/imgui_impl_dx9.cpp diff --git a/samples/testing/extern/imgui/backends/imgui_impl_dx9.h b/sample/extern/imgui/backends/imgui_impl_dx9.h similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_dx9.h rename to sample/extern/imgui/backends/imgui_impl_dx9.h diff --git a/samples/testing/extern/imgui/backends/imgui_impl_glfw.cpp b/sample/extern/imgui/backends/imgui_impl_glfw.cpp similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_glfw.cpp rename to sample/extern/imgui/backends/imgui_impl_glfw.cpp diff --git a/samples/testing/extern/imgui/backends/imgui_impl_glfw.h b/sample/extern/imgui/backends/imgui_impl_glfw.h similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_glfw.h rename to sample/extern/imgui/backends/imgui_impl_glfw.h diff --git a/samples/testing/extern/imgui/backends/imgui_impl_glut.cpp b/sample/extern/imgui/backends/imgui_impl_glut.cpp similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_glut.cpp rename to sample/extern/imgui/backends/imgui_impl_glut.cpp diff --git a/samples/testing/extern/imgui/backends/imgui_impl_glut.h b/sample/extern/imgui/backends/imgui_impl_glut.h similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_glut.h rename to sample/extern/imgui/backends/imgui_impl_glut.h diff --git a/samples/testing/extern/imgui/backends/imgui_impl_metal.h b/sample/extern/imgui/backends/imgui_impl_metal.h similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_metal.h rename to sample/extern/imgui/backends/imgui_impl_metal.h diff --git a/samples/testing/extern/imgui/backends/imgui_impl_metal.mm b/sample/extern/imgui/backends/imgui_impl_metal.mm similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_metal.mm rename to sample/extern/imgui/backends/imgui_impl_metal.mm diff --git a/samples/testing/extern/imgui/backends/imgui_impl_opengl2.cpp b/sample/extern/imgui/backends/imgui_impl_opengl2.cpp similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_opengl2.cpp rename to sample/extern/imgui/backends/imgui_impl_opengl2.cpp diff --git a/samples/testing/extern/imgui/backends/imgui_impl_opengl2.h b/sample/extern/imgui/backends/imgui_impl_opengl2.h similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_opengl2.h rename to sample/extern/imgui/backends/imgui_impl_opengl2.h diff --git a/samples/testing/extern/imgui/backends/imgui_impl_opengl3.cpp b/sample/extern/imgui/backends/imgui_impl_opengl3.cpp similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_opengl3.cpp rename to sample/extern/imgui/backends/imgui_impl_opengl3.cpp diff --git a/samples/testing/extern/imgui/backends/imgui_impl_opengl3.h b/sample/extern/imgui/backends/imgui_impl_opengl3.h similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_opengl3.h rename to sample/extern/imgui/backends/imgui_impl_opengl3.h diff --git a/samples/testing/extern/imgui/backends/imgui_impl_opengl3_loader.h b/sample/extern/imgui/backends/imgui_impl_opengl3_loader.h similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_opengl3_loader.h rename to sample/extern/imgui/backends/imgui_impl_opengl3_loader.h diff --git a/samples/testing/extern/imgui/backends/imgui_impl_osx.h b/sample/extern/imgui/backends/imgui_impl_osx.h similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_osx.h rename to sample/extern/imgui/backends/imgui_impl_osx.h diff --git a/samples/testing/extern/imgui/backends/imgui_impl_osx.mm b/sample/extern/imgui/backends/imgui_impl_osx.mm similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_osx.mm rename to sample/extern/imgui/backends/imgui_impl_osx.mm diff --git a/samples/testing/extern/imgui/backends/imgui_impl_sdl2.cpp b/sample/extern/imgui/backends/imgui_impl_sdl2.cpp similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_sdl2.cpp rename to sample/extern/imgui/backends/imgui_impl_sdl2.cpp diff --git a/samples/testing/extern/imgui/backends/imgui_impl_sdl2.h b/sample/extern/imgui/backends/imgui_impl_sdl2.h similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_sdl2.h rename to sample/extern/imgui/backends/imgui_impl_sdl2.h diff --git a/samples/testing/extern/imgui/backends/imgui_impl_sdl3.cpp b/sample/extern/imgui/backends/imgui_impl_sdl3.cpp similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_sdl3.cpp rename to sample/extern/imgui/backends/imgui_impl_sdl3.cpp diff --git a/samples/testing/extern/imgui/backends/imgui_impl_sdl3.h b/sample/extern/imgui/backends/imgui_impl_sdl3.h similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_sdl3.h rename to sample/extern/imgui/backends/imgui_impl_sdl3.h diff --git a/samples/testing/extern/imgui/backends/imgui_impl_sdlgpu3.cpp b/sample/extern/imgui/backends/imgui_impl_sdlgpu3.cpp similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_sdlgpu3.cpp rename to sample/extern/imgui/backends/imgui_impl_sdlgpu3.cpp diff --git a/samples/testing/extern/imgui/backends/imgui_impl_sdlgpu3.h b/sample/extern/imgui/backends/imgui_impl_sdlgpu3.h similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_sdlgpu3.h rename to sample/extern/imgui/backends/imgui_impl_sdlgpu3.h diff --git a/samples/testing/extern/imgui/backends/imgui_impl_sdlgpu3_shaders.h b/sample/extern/imgui/backends/imgui_impl_sdlgpu3_shaders.h similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_sdlgpu3_shaders.h rename to sample/extern/imgui/backends/imgui_impl_sdlgpu3_shaders.h diff --git a/samples/testing/extern/imgui/backends/imgui_impl_sdlrenderer2.cpp b/sample/extern/imgui/backends/imgui_impl_sdlrenderer2.cpp similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_sdlrenderer2.cpp rename to sample/extern/imgui/backends/imgui_impl_sdlrenderer2.cpp diff --git a/samples/testing/extern/imgui/backends/imgui_impl_sdlrenderer2.h b/sample/extern/imgui/backends/imgui_impl_sdlrenderer2.h similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_sdlrenderer2.h rename to sample/extern/imgui/backends/imgui_impl_sdlrenderer2.h diff --git a/samples/testing/extern/imgui/backends/imgui_impl_sdlrenderer3.cpp b/sample/extern/imgui/backends/imgui_impl_sdlrenderer3.cpp similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_sdlrenderer3.cpp rename to sample/extern/imgui/backends/imgui_impl_sdlrenderer3.cpp diff --git a/samples/testing/extern/imgui/backends/imgui_impl_sdlrenderer3.h b/sample/extern/imgui/backends/imgui_impl_sdlrenderer3.h similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_sdlrenderer3.h rename to sample/extern/imgui/backends/imgui_impl_sdlrenderer3.h diff --git a/samples/testing/extern/imgui/backends/imgui_impl_vulkan.cpp b/sample/extern/imgui/backends/imgui_impl_vulkan.cpp similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_vulkan.cpp rename to sample/extern/imgui/backends/imgui_impl_vulkan.cpp diff --git a/samples/testing/extern/imgui/backends/imgui_impl_vulkan.h b/sample/extern/imgui/backends/imgui_impl_vulkan.h similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_vulkan.h rename to sample/extern/imgui/backends/imgui_impl_vulkan.h diff --git a/samples/testing/extern/imgui/backends/imgui_impl_wgpu.cpp b/sample/extern/imgui/backends/imgui_impl_wgpu.cpp similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_wgpu.cpp rename to sample/extern/imgui/backends/imgui_impl_wgpu.cpp diff --git a/samples/testing/extern/imgui/backends/imgui_impl_wgpu.h b/sample/extern/imgui/backends/imgui_impl_wgpu.h similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_wgpu.h rename to sample/extern/imgui/backends/imgui_impl_wgpu.h diff --git a/samples/testing/extern/imgui/backends/imgui_impl_win32.cpp b/sample/extern/imgui/backends/imgui_impl_win32.cpp similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_win32.cpp rename to sample/extern/imgui/backends/imgui_impl_win32.cpp diff --git a/samples/testing/extern/imgui/backends/imgui_impl_win32.h b/sample/extern/imgui/backends/imgui_impl_win32.h similarity index 100% rename from samples/testing/extern/imgui/backends/imgui_impl_win32.h rename to sample/extern/imgui/backends/imgui_impl_win32.h diff --git a/samples/testing/extern/imgui/backends/sdlgpu3/build_instructions.txt b/sample/extern/imgui/backends/sdlgpu3/build_instructions.txt similarity index 100% rename from samples/testing/extern/imgui/backends/sdlgpu3/build_instructions.txt rename to sample/extern/imgui/backends/sdlgpu3/build_instructions.txt diff --git a/samples/testing/extern/imgui/backends/sdlgpu3/shader.frag b/sample/extern/imgui/backends/sdlgpu3/shader.frag similarity index 100% rename from samples/testing/extern/imgui/backends/sdlgpu3/shader.frag rename to sample/extern/imgui/backends/sdlgpu3/shader.frag diff --git a/samples/testing/extern/imgui/backends/sdlgpu3/shader.vert b/sample/extern/imgui/backends/sdlgpu3/shader.vert similarity index 100% rename from samples/testing/extern/imgui/backends/sdlgpu3/shader.vert rename to sample/extern/imgui/backends/sdlgpu3/shader.vert diff --git a/samples/testing/extern/imgui/backends/vulkan/build_instructions.txt b/sample/extern/imgui/backends/vulkan/build_instructions.txt similarity index 100% rename from samples/testing/extern/imgui/backends/vulkan/build_instructions.txt rename to sample/extern/imgui/backends/vulkan/build_instructions.txt diff --git a/samples/testing/extern/imgui/backends/vulkan/generate_spv.sh b/sample/extern/imgui/backends/vulkan/generate_spv.sh similarity index 100% rename from samples/testing/extern/imgui/backends/vulkan/generate_spv.sh rename to sample/extern/imgui/backends/vulkan/generate_spv.sh diff --git a/samples/testing/extern/imgui/backends/vulkan/glsl_shader.frag b/sample/extern/imgui/backends/vulkan/glsl_shader.frag similarity index 100% rename from samples/testing/extern/imgui/backends/vulkan/glsl_shader.frag rename to sample/extern/imgui/backends/vulkan/glsl_shader.frag diff --git a/samples/testing/extern/imgui/backends/vulkan/glsl_shader.vert b/sample/extern/imgui/backends/vulkan/glsl_shader.vert similarity index 100% rename from samples/testing/extern/imgui/backends/vulkan/glsl_shader.vert rename to sample/extern/imgui/backends/vulkan/glsl_shader.vert diff --git a/samples/testing/extern/imgui/imconfig.h b/sample/extern/imgui/imconfig.h similarity index 99% rename from samples/testing/extern/imgui/imconfig.h rename to sample/extern/imgui/imconfig.h index 82adec1..4c237a2 100644 --- a/samples/testing/extern/imgui/imconfig.h +++ b/sample/extern/imgui/imconfig.h @@ -139,7 +139,7 @@ //#define IMGUI_DEBUG_PARANOID //---- Indicate we're using VOLK for the render graph -#define IMGUI_IMPL_VULKAN_USE_VOLK +//#define IMGUI_IMPL_VULKAN_USE_VOLK //---- Tip: You can add extra functions within the ImGui:: namespace from anywhere (e.g. your own sources/header files) /* diff --git a/samples/testing/extern/imgui/imgui.cpp b/sample/extern/imgui/imgui.cpp similarity index 100% rename from samples/testing/extern/imgui/imgui.cpp rename to sample/extern/imgui/imgui.cpp diff --git a/samples/testing/extern/imgui/imgui.h b/sample/extern/imgui/imgui.h similarity index 100% rename from samples/testing/extern/imgui/imgui.h rename to sample/extern/imgui/imgui.h diff --git a/samples/testing/extern/imgui/imgui_demo.cpp b/sample/extern/imgui/imgui_demo.cpp similarity index 100% rename from samples/testing/extern/imgui/imgui_demo.cpp rename to sample/extern/imgui/imgui_demo.cpp diff --git a/samples/testing/extern/imgui/imgui_draw.cpp b/sample/extern/imgui/imgui_draw.cpp similarity index 100% rename from samples/testing/extern/imgui/imgui_draw.cpp rename to sample/extern/imgui/imgui_draw.cpp diff --git a/samples/testing/extern/imgui/imgui_internal.h b/sample/extern/imgui/imgui_internal.h similarity index 100% rename from samples/testing/extern/imgui/imgui_internal.h rename to sample/extern/imgui/imgui_internal.h diff --git a/samples/testing/extern/imgui/imgui_tables.cpp b/sample/extern/imgui/imgui_tables.cpp similarity index 100% rename from samples/testing/extern/imgui/imgui_tables.cpp rename to sample/extern/imgui/imgui_tables.cpp diff --git a/samples/testing/extern/imgui/imgui_widgets.cpp b/sample/extern/imgui/imgui_widgets.cpp similarity index 100% rename from samples/testing/extern/imgui/imgui_widgets.cpp rename to sample/extern/imgui/imgui_widgets.cpp diff --git a/samples/testing/extern/imgui/imstb_rectpack.h b/sample/extern/imgui/imstb_rectpack.h similarity index 100% rename from samples/testing/extern/imgui/imstb_rectpack.h rename to sample/extern/imgui/imstb_rectpack.h diff --git a/samples/testing/extern/imgui/imstb_textedit.h b/sample/extern/imgui/imstb_textedit.h similarity index 100% rename from samples/testing/extern/imgui/imstb_textedit.h rename to sample/extern/imgui/imstb_textedit.h diff --git a/samples/testing/extern/imgui/imstb_truetype.h b/sample/extern/imgui/imstb_truetype.h similarity index 100% rename from samples/testing/extern/imgui/imstb_truetype.h rename to sample/extern/imgui/imstb_truetype.h diff --git a/samples/testing/extern/imgui/misc/README.txt b/sample/extern/imgui/misc/README.txt similarity index 100% rename from samples/testing/extern/imgui/misc/README.txt rename to sample/extern/imgui/misc/README.txt diff --git a/samples/testing/extern/imgui/misc/cpp/README.txt b/sample/extern/imgui/misc/cpp/README.txt similarity index 100% rename from samples/testing/extern/imgui/misc/cpp/README.txt rename to sample/extern/imgui/misc/cpp/README.txt diff --git a/samples/testing/extern/imgui/misc/cpp/imgui_stdlib.cpp b/sample/extern/imgui/misc/cpp/imgui_stdlib.cpp similarity index 100% rename from samples/testing/extern/imgui/misc/cpp/imgui_stdlib.cpp rename to sample/extern/imgui/misc/cpp/imgui_stdlib.cpp diff --git a/samples/testing/extern/imgui/misc/cpp/imgui_stdlib.h b/sample/extern/imgui/misc/cpp/imgui_stdlib.h similarity index 100% rename from samples/testing/extern/imgui/misc/cpp/imgui_stdlib.h rename to sample/extern/imgui/misc/cpp/imgui_stdlib.h diff --git a/samples/testing/extern/imgui/misc/debuggers/README.txt b/sample/extern/imgui/misc/debuggers/README.txt similarity index 100% rename from samples/testing/extern/imgui/misc/debuggers/README.txt rename to sample/extern/imgui/misc/debuggers/README.txt diff --git a/samples/testing/extern/imgui/misc/debuggers/imgui.gdb b/sample/extern/imgui/misc/debuggers/imgui.gdb similarity index 100% rename from samples/testing/extern/imgui/misc/debuggers/imgui.gdb rename to sample/extern/imgui/misc/debuggers/imgui.gdb diff --git a/samples/testing/extern/imgui/misc/debuggers/imgui.natstepfilter b/sample/extern/imgui/misc/debuggers/imgui.natstepfilter similarity index 100% rename from samples/testing/extern/imgui/misc/debuggers/imgui.natstepfilter rename to sample/extern/imgui/misc/debuggers/imgui.natstepfilter diff --git a/samples/testing/extern/imgui/misc/debuggers/imgui.natvis b/sample/extern/imgui/misc/debuggers/imgui.natvis similarity index 100% rename from samples/testing/extern/imgui/misc/debuggers/imgui.natvis rename to sample/extern/imgui/misc/debuggers/imgui.natvis diff --git a/samples/testing/extern/imgui/misc/debuggers/imgui_lldb.py b/sample/extern/imgui/misc/debuggers/imgui_lldb.py similarity index 100% rename from samples/testing/extern/imgui/misc/debuggers/imgui_lldb.py rename to sample/extern/imgui/misc/debuggers/imgui_lldb.py diff --git a/samples/testing/extern/imgui/misc/fonts/Cousine-Regular.ttf b/sample/extern/imgui/misc/fonts/Cousine-Regular.ttf similarity index 100% rename from samples/testing/extern/imgui/misc/fonts/Cousine-Regular.ttf rename to sample/extern/imgui/misc/fonts/Cousine-Regular.ttf diff --git a/samples/testing/extern/imgui/misc/fonts/DroidSans.ttf b/sample/extern/imgui/misc/fonts/DroidSans.ttf similarity index 100% rename from samples/testing/extern/imgui/misc/fonts/DroidSans.ttf rename to sample/extern/imgui/misc/fonts/DroidSans.ttf diff --git a/samples/testing/extern/imgui/misc/fonts/Karla-Regular.ttf b/sample/extern/imgui/misc/fonts/Karla-Regular.ttf similarity index 100% rename from samples/testing/extern/imgui/misc/fonts/Karla-Regular.ttf rename to sample/extern/imgui/misc/fonts/Karla-Regular.ttf diff --git a/samples/testing/extern/imgui/misc/fonts/ProggyClean.ttf b/sample/extern/imgui/misc/fonts/ProggyClean.ttf similarity index 100% rename from samples/testing/extern/imgui/misc/fonts/ProggyClean.ttf rename to sample/extern/imgui/misc/fonts/ProggyClean.ttf diff --git a/samples/testing/extern/imgui/misc/fonts/ProggyTiny.ttf b/sample/extern/imgui/misc/fonts/ProggyTiny.ttf similarity index 100% rename from samples/testing/extern/imgui/misc/fonts/ProggyTiny.ttf rename to sample/extern/imgui/misc/fonts/ProggyTiny.ttf diff --git a/samples/testing/extern/imgui/misc/fonts/Roboto-Medium.ttf b/sample/extern/imgui/misc/fonts/Roboto-Medium.ttf similarity index 100% rename from samples/testing/extern/imgui/misc/fonts/Roboto-Medium.ttf rename to sample/extern/imgui/misc/fonts/Roboto-Medium.ttf diff --git a/samples/testing/extern/imgui/misc/fonts/binary_to_compressed_c.cpp b/sample/extern/imgui/misc/fonts/binary_to_compressed_c.cpp similarity index 100% rename from samples/testing/extern/imgui/misc/fonts/binary_to_compressed_c.cpp rename to sample/extern/imgui/misc/fonts/binary_to_compressed_c.cpp diff --git a/samples/testing/extern/imgui/misc/freetype/README.md b/sample/extern/imgui/misc/freetype/README.md similarity index 100% rename from samples/testing/extern/imgui/misc/freetype/README.md rename to sample/extern/imgui/misc/freetype/README.md diff --git a/samples/testing/extern/imgui/misc/freetype/imgui_freetype.cpp b/sample/extern/imgui/misc/freetype/imgui_freetype.cpp similarity index 100% rename from samples/testing/extern/imgui/misc/freetype/imgui_freetype.cpp rename to sample/extern/imgui/misc/freetype/imgui_freetype.cpp diff --git a/samples/testing/extern/imgui/misc/freetype/imgui_freetype.h b/sample/extern/imgui/misc/freetype/imgui_freetype.h similarity index 100% rename from samples/testing/extern/imgui/misc/freetype/imgui_freetype.h rename to sample/extern/imgui/misc/freetype/imgui_freetype.h diff --git a/samples/testing/extern/imgui/misc/single_file/imgui_single_file.h b/sample/extern/imgui/misc/single_file/imgui_single_file.h similarity index 100% rename from samples/testing/extern/imgui/misc/single_file/imgui_single_file.h rename to sample/extern/imgui/misc/single_file/imgui_single_file.h diff --git a/samples/testing/extern/stb_image/stb_image.h b/sample/extern/stb_image/stb_image.h similarity index 100% rename from samples/testing/extern/stb_image/stb_image.h rename to sample/extern/stb_image/stb_image.h diff --git a/samples/testing/kernels/buffer-fill.slang b/sample/kernels/buffer-fill.slang similarity index 100% rename from samples/testing/kernels/buffer-fill.slang rename to sample/kernels/buffer-fill.slang diff --git a/samples/testing/kernels/common.slang b/sample/kernels/common.slang similarity index 100% rename from samples/testing/kernels/common.slang rename to sample/kernels/common.slang diff --git a/samples/testing/kernels/compile.cmd b/sample/kernels/compile.cmd similarity index 100% rename from samples/testing/kernels/compile.cmd rename to sample/kernels/compile.cmd diff --git a/samples/testing/kernels/graphics-test.slang b/sample/kernels/graphics-test.slang similarity index 100% rename from samples/testing/kernels/graphics-test.slang rename to sample/kernels/graphics-test.slang diff --git a/samples/testing/kernels/image.slang b/sample/kernels/image.slang similarity index 100% rename from samples/testing/kernels/image.slang rename to sample/kernels/image.slang diff --git a/samples/testing/kernels/test.slang b/sample/kernels/test.slang similarity index 100% rename from samples/testing/kernels/test.slang rename to sample/kernels/test.slang diff --git a/samples/testing/src/main.cc b/sample/src/main.cc similarity index 98% rename from samples/testing/src/main.cc rename to sample/src/main.cc index 7a02ac1..fbab74e 100644 --- a/samples/testing/src/main.cc +++ b/sample/src/main.cc @@ -63,7 +63,7 @@ int main() { /* Initialize the Render Graph */ RenderGraph rg = RenderGraph(); - rg.set_shader_path("samples/testing/kernels"); + rg.set_shader_path("sample/kernels"); rg.set_max_graphs_in_flight(2u); /* Double buffering */ if (const Result r = rg.init(gpu); r.is_err()) { printf("failed to initialize render graph.\nreason: %s\n", r.unwrap_err().c_str()); @@ -191,7 +191,7 @@ int main() { ImGui::CreateContext(); ImGui_ImplGlfw_InitForVulkan(win, true); ImGUI imgui = ImGUI(); - if (const Result r = imgui.init(gpu, rt, IMGUI_FUNCTIONS); r.is_err()) { + if (const Result r = imgui.init(gpu, rt); r.is_err()) { printf("failed to initialize imgui.\nreason: %s\n", r.unwrap_err().c_str()); return EXIT_SUCCESS; } diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt deleted file mode 100644 index e4f05bb..0000000 --- a/samples/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -# Function for adding a new sample -function(add_sample SAMPLE_NAME) - set(SAMPLE_DIR ./${SAMPLE_NAME}) - set(EXE_NAME sample-${SAMPLE_NAME}) - - # Executable target - project(${EXE_NAME}) - add_executable(${EXE_NAME} "${SAMPLE_DIR}/src/main.cc") - set_target_properties(${EXE_NAME} PROPERTIES OUTPUT_NAME ${EXE_NAME}) - - # Add compiler definitions - target_compile_definitions(${EXE_NAME} PRIVATE $<$:DEBUG=1>) - target_compile_definitions(${EXE_NAME} PRIVATE $<$:NDEBUG=1>) - - # Include directories - target_include_directories(${EXE_NAME} PRIVATE "${SAMPLE_DIR}/src/") - - # Link to the Graphite library - target_link_libraries(${EXE_NAME} PRIVATE graphite) - - add_subdirectory(${SAMPLE_NAME}) -endfunction() - -add_sample(testing) diff --git a/samples/testing/CMakeLists.txt b/samples/testing/CMakeLists.txt deleted file mode 100644 index c8e67df..0000000 --- a/samples/testing/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory("extern") \ No newline at end of file diff --git a/src/core/graphite/gpu_adapter.cc b/src/core/graphite/gpu_adapter.cc index d9c0ec2..0c2ad55 100644 --- a/src/core/graphite/gpu_adapter.cc +++ b/src/core/graphite/gpu_adapter.cc @@ -40,3 +40,15 @@ void AgnGPUAdapter::deinit_vram_bank() { delete vram_bank; } VRAMBank& AgnGPUAdapter::get_vram_bank() { return *vram_bank; } + +void AgnGPUAdapter::set_max_render_targets(const u32 count) { max_render_targets = count; } +void AgnGPUAdapter::set_max_buffers(const u32 count) { max_buffers = count; } +void AgnGPUAdapter::set_max_textures(const u32 count) { max_textures = count; } +void AgnGPUAdapter::set_max_images(const u32 count) { max_images = count; } +void AgnGPUAdapter::set_max_samplers(const u32 count) { max_samplers = count; } + +u32 AgnGPUAdapter::get_max_render_targets() const { return max_render_targets; } +u32 AgnGPUAdapter::get_max_buffers() const { return max_buffers; } +u32 AgnGPUAdapter::get_max_textures() const { return max_textures; } +u32 AgnGPUAdapter::get_max_images() const { return max_images; } +u32 AgnGPUAdapter::get_max_samplers() const { return max_samplers; } diff --git a/src/core/graphite/gpu_adapter.hh b/src/core/graphite/gpu_adapter.hh index 4e4997a..7edd5fd 100644 --- a/src/core/graphite/gpu_adapter.hh +++ b/src/core/graphite/gpu_adapter.hh @@ -5,6 +5,8 @@ #include "utils/result.hh" #include "utils/debug.hh" +#include "utils/types.hh" + class VRAMBank; /* Debug logger data. */ @@ -25,6 +27,13 @@ protected: /* VRAM bank for this GPU adapter. */ VRAMBank* vram_bank = nullptr; + + /* Maximum amount of resources. */ + u32 max_render_targets = 8u; + u32 max_buffers = 8u; + u32 max_textures = 8u; + u32 max_images = 8u; + u32 max_samplers = 8u; /* Log a message using the active debug logger. */ void log(DebugSeverity severity, const char* msg); @@ -47,6 +56,20 @@ public: /* De-initialize the GPU adapter, free all its resources. */ PLATFORM_SPECIFIC Result deinit() = 0; + + /* Set maximum resource count. */ + void set_max_render_targets(const u32 count); + void set_max_buffers(const u32 count); + void set_max_textures(const u32 count); + void set_max_images(const u32 count); + void set_max_samplers(const u32 count); + + /* Get maximum resource count. */ + u32 get_max_render_targets() const; + u32 get_max_buffers() const; + u32 get_max_textures() const; + u32 get_max_images() const; + u32 get_max_samplers() const; }; #include PLATFORM_INCLUDE(gpu_adapter) diff --git a/src/core/graphite/nodes/compute_node.hh b/src/core/graphite/nodes/compute_node.hh index 3e83d9e..5f27ce0 100644 --- a/src/core/graphite/nodes/compute_node.hh +++ b/src/core/graphite/nodes/compute_node.hh @@ -19,6 +19,10 @@ public: u32 group_x = 1u, group_y = 1u, group_z = 1u; /* Thread group size */ u32 work_x = 1u, work_y = 1u, work_z = 1u; /* Work size */ + + /* Indirect Dispatch. */ + Buffer indirect_buffer {}; + uint32_t indirect_offset = 0u; /* No copies allowed */ ComputeNode(const ComputeNode&) = delete; @@ -36,6 +40,9 @@ public: /* Set the work size for this node. (this will be divided by the `group_size` to get the dispatch size) */ inline ComputeNode& work_size(u32 x, u32 y = 1u, u32 z = 1u) { work_x = x; work_y = y; work_z = z; return *this; } + /* Set the indirect_buffer which will be used to get the dispatch args buffer for the vkCmdDispatchIndirect call. */ + inline ComputeNode& indirect_size(Buffer buffer) { indirect_buffer = buffer; return *this; } + /* To access constructors */ friend class AgnRenderGraph; }; diff --git a/src/core/graphite/nodes/raster_node.cc b/src/core/graphite/nodes/raster_node.cc index 834a1f6..b6c3a1f 100644 --- a/src/core/graphite/nodes/raster_node.cc +++ b/src/core/graphite/nodes/raster_node.cc @@ -35,6 +35,10 @@ DrawCall& RasterNode::draw( return draws.emplace_back(*this, vertex_buffer, vertex_count, vertex_offset, instance_count, instance_offset); } +DrawCall& RasterNode::draw_indirect(const Buffer vertex_buffer, const Buffer indirect_buffer) { + return draws.emplace_back(*this, vertex_buffer, indirect_buffer); +} + RasterNode& RasterNode::attribute(const AttrFormat format) { attributes.emplace_back(format); return *this; @@ -64,3 +68,10 @@ DrawCall::DrawCall( vertex_buffer, DependencyFlags::Readonly | DependencyFlags::Unbound, DependencyStages::Vertex ); } + +DrawCall::DrawCall(RasterNode& parent_pass, const Buffer vertex_buffer, const Buffer indirect_buffer) + : parent_pass(parent_pass), vertex_buffer(vertex_buffer), indirect_buffer(indirect_buffer) { + parent_pass.dependencies.emplace_back( + vertex_buffer, DependencyFlags::Readonly | DependencyFlags::Unbound, DependencyStages::Vertex + ); +} \ No newline at end of file diff --git a/src/core/graphite/nodes/raster_node.hh b/src/core/graphite/nodes/raster_node.hh index 3d34466..ef7256e 100644 --- a/src/core/graphite/nodes/raster_node.hh +++ b/src/core/graphite/nodes/raster_node.hh @@ -85,6 +85,8 @@ class RasterNode : public Node { const Buffer vertex_buffer, const u32 vertex_count, const u32 vertex_offset = 0u, const u32 instance_count = 1u, const u32 instance_offset = 0u ); + /* Create an indirect draw call for this raster pass. */ + DrawCall& draw_indirect(const Buffer vertex_buffer, const Buffer indirect_buffer); /* To access constructors */ friend class AgnRenderGraph; @@ -95,6 +97,7 @@ struct DrawCall { RasterNode& parent_pass; Buffer vertex_buffer {}; + Buffer indirect_buffer {}; u32 vertex_count = 0u, vertex_offset = 0u; u32 instance_count = 0u, instance_offset = 0u; @@ -103,4 +106,6 @@ struct DrawCall { RasterNode& parent_pass, const Buffer vertex_buffer, const u32 vertex_count, const u32 vertex_offset, const u32 instance_count, const u32 instance_offset ); + /* Vertex buffer and indirect draw call constructor. */ + DrawCall(RasterNode& parent_pass, const Buffer vertex_buffer, const Buffer indirect_buffer); }; \ No newline at end of file diff --git a/src/core/graphite/resources/buffer.hh b/src/core/graphite/resources/buffer.hh index 9c5b11f..380e7ac 100644 --- a/src/core/graphite/resources/buffer.hh +++ b/src/core/graphite/resources/buffer.hh @@ -5,11 +5,12 @@ /* Buffer usage flags. */ enum class BufferUsage : u32 { - Invalid = 0u, /* Invalid buffer usage. */ - TransferDst = 1u << 1u, /* This buffer can be a GPU transfer destination. */ - TransferSrc = 1u << 2u, /* This buffer can be a GPU transfer source. */ - Constant = 1u << 3u, /* Read-only buffer, aka. `UniformBuffer` */ - Storage = 1u << 4u, /* Read/Write buffer, aka. `StructuredBuffer` */ - Vertex = 1u << 5u, /* Vertex buffer */ + Invalid = 0u, /* Invalid buffer usage. */ + TransferDst = 1u << 1u, /* This buffer can be a GPU transfer destination. */ + TransferSrc = 1u << 2u, /* This buffer can be a GPU transfer source. */ + Constant = 1u << 3u, /* Read-only buffer, aka. `UniformBuffer` */ + Storage = 1u << 4u, /* Read/Write buffer, aka. `StructuredBuffer` */ + Vertex = 1u << 5u, /* Vertex buffer */ + Indirect = 1u << 6u, /* Draw/Dispatch Indirect Commands */ }; ENUM_CLASS_FLAGS(BufferUsage); diff --git a/src/core/graphite/resources/texture.hh b/src/core/graphite/resources/texture.hh index 89f8e91..a19a071 100644 --- a/src/core/graphite/resources/texture.hh +++ b/src/core/graphite/resources/texture.hh @@ -16,9 +16,11 @@ ENUM_CLASS_FLAGS(TextureUsage); /* Texture formats. */ enum class TextureFormat : u32 { - Invalid = 0u, /* Invalid texture format. */ - RGBA8Unorm, /* RGBA 8 bits per channel, unsigned normalized. */ - EnumLimit /* Anything above or equal is invalid. */ + Invalid = 0u, /* Invalid texture format. */ + RGBA8Unorm, /* RGBA 8 bits per channel, unsigned normalized. */ + RG32Uint, /* RG 32 bits per channel, unsigned integer. */ + RG11B10Ufloat, /* RG 11 bits per channel, B 10 bits per channel, unsigned float. */ + EnumLimit /* Anything above or equal is invalid. */ }; /* Texture meta data. */ diff --git a/src/core/graphite/vram_bank.hh b/src/core/graphite/vram_bank.hh index d9d0f62..db6ae5d 100644 --- a/src/core/graphite/vram_bank.hh +++ b/src/core/graphite/vram_bank.hh @@ -79,6 +79,8 @@ public: PLATFORM_SPECIFIC Result resize_render_target(RenderTarget& render_target, u32 width, u32 height) = 0; /* Resize a texture resource. */ PLATFORM_SPECIFIC Result resize_texture(Texture& texture, Size3D size) = 0; + /* Resize a buffer resource. */ + PLATFORM_SPECIFIC Result resize_buffer(Buffer& buffer, u64 count, u64 stride = 0) = 0; /* Upload data to a GPU buffer resource. */ PLATFORM_SPECIFIC Result upload_buffer(Buffer& buffer, const void* data, u64 dst_offset, u64 size) = 0; diff --git a/src/platform/vulkan/gpu_adapter_vk.cc b/src/platform/vulkan/gpu_adapter_vk.cc index 9b66ab4..e070e42 100644 --- a/src/platform/vulkan/gpu_adapter_vk.cc +++ b/src/platform/vulkan/gpu_adapter_vk.cc @@ -109,16 +109,8 @@ Result GPUAdapter::init(bool debug_mode) { device_queues_ci[2].queueCount = 1u; device_queues_ci[2].pQueuePriorities = &priority; - /* Enable descriptor indexing features */ - VkPhysicalDeviceDescriptorIndexingFeaturesEXT desc_features { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES }; - desc_features.descriptorBindingSampledImageUpdateAfterBind = true; - desc_features.descriptorBindingStorageBufferUpdateAfterBind = true; - desc_features.descriptorBindingPartiallyBound = true; - desc_features.runtimeDescriptorArray = true; - /* Enable synchronization 2.0 features */ VkPhysicalDeviceSynchronization2Features sync_features { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES }; - sync_features.pNext = &desc_features; sync_features.synchronization2 = true; /* Enable dynamic rendering features */ @@ -126,15 +118,29 @@ Result GPUAdapter::init(bool debug_mode) { render_features.pNext = (void*)&sync_features; render_features.dynamicRendering = true; + /* Vulkan 1.2 features */ + VkPhysicalDeviceVulkan12Features vulkan_features { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES }; + vulkan_features.pNext = &render_features; + vulkan_features.shaderBufferInt64Atomics = true; + vulkan_features.descriptorBindingSampledImageUpdateAfterBind = true; + vulkan_features.descriptorBindingStorageBufferUpdateAfterBind = true; + vulkan_features.descriptorBindingPartiallyBound = true; + vulkan_features.runtimeDescriptorArray = true; + + /* Enable modern device features */ + VkPhysicalDeviceFeatures device_features {}; + device_features.shaderInt64 = true; /* 64-bit integer support */ + /* Vulkan device creation info */ VkDeviceCreateInfo device_ci { VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO }; - device_ci.pNext = &render_features; + device_ci.pNext = &vulkan_features; device_ci.queueCreateInfoCount = 3u; device_ci.pQueueCreateInfos = device_queues_ci; device_ci.enabledLayerCount = instance_layers_count; device_ci.ppEnabledLayerNames = instance_layers; device_ci.enabledExtensionCount = device_ext_count; device_ci.ppEnabledExtensionNames = device_ext; + device_ci.pEnabledFeatures = &device_features; /* Create a Vulkan logical device */ if (const VkResult r = vkCreateDevice(physical_device, &device_ci, nullptr, &logical_device); r != VK_SUCCESS) { diff --git a/src/platform/vulkan/render_graph_vk.cc b/src/platform/vulkan/render_graph_vk.cc index b525672..720d3c2 100644 --- a/src/platform/vulkan/render_graph_vk.cc +++ b/src/platform/vulkan/render_graph_vk.cc @@ -1,5 +1,7 @@ #include "render_graph_vk.hh" +#include + #include "graphite/imgui.hh" #include "graphite/vram_bank.hh" #include "graphite/nodes/node.hh" @@ -284,6 +286,14 @@ Result RenderGraph::queue_compute_node(const GraphExecution& graph, const if (push_result.is_err()) return push_result; vkCmdBindDescriptorSets(graph.cmd, VK_PIPELINE_BIND_POINT_COMPUTE, pipeline.layout, 1u, 1u, &gpu->get_vram_bank().bindless_set, 0u, nullptr); + /* Indirect Dispatch */ + if (!node.indirect_buffer.is_null()) + { + VRAMBank& bank = gpu->get_vram_bank(); + vkCmdDispatchIndirect(graph.cmd, bank.buffers.get(node.indirect_buffer).buffer, node.indirect_offset); + return Ok(); + } + /* Calculate the dispatch size */ const u32 dispatch_x = div_up(node.work_x, node.group_x); const u32 dispatch_y = div_up(node.work_y, node.group_y); @@ -324,15 +334,15 @@ Result RenderGraph::queue_raster_node(const GraphExecution& graph, const R if (dep.resource.get_type() == ResourceType::RenderTarget) { RenderTargetSlot& rt = bank.render_targets.get(target); attachment_view = rt.view(); - min_raster_w = min(min_raster_w, rt.extent.width); - min_raster_h = min(min_raster_h, rt.extent.height); + min_raster_w = std::min(min_raster_w, (i32)rt.extent.width); + min_raster_h = std::min(min_raster_h, (i32)rt.extent.height); } else { const ImageSlot& image = bank.images.get(dep.resource); const TextureSlot& texture = bank.textures.get(image.texture); if (has_flag(texture.usage, TextureUsage::ColorAttachment) == false) continue; attachment_view = image.view; - min_raster_w = min(min_raster_w, texture.size.x); - min_raster_h = min(min_raster_h, texture.size.y); + min_raster_w = std::min(min_raster_w, (i32)texture.size.x); + min_raster_h = std::min(min_raster_h, (i32)texture.size.y); } /* Fill in the attachment info */ @@ -383,10 +393,17 @@ Result RenderGraph::queue_raster_node(const GraphExecution& graph, const R const VkDeviceSize offset = 0u; vkCmdBindVertexBuffers(graph.cmd, 0u, 1u, &vertex_buffer.buffer, &offset); - /* Execute the draw */ - vkCmdDraw( - graph.cmd, draw_call.vertex_count, draw_call.instance_count, draw_call.vertex_offset, draw_call.instance_offset - ); + /* Check for indirect draw */ + if (!draw_call.indirect_buffer.is_null()) { + vkCmdDrawIndirect( + graph.cmd, bank.buffers.get(draw_call.indirect_buffer).buffer, 0, 1, sizeof(VkDrawIndirectCommand) + ); + } else { + /* Execute direct draw */ + vkCmdDraw( + graph.cmd, draw_call.vertex_count, draw_call.instance_count, draw_call.vertex_offset, draw_call.instance_offset + ); + } } /* End rendering */ diff --git a/src/platform/vulkan/vram_bank_vk.cc b/src/platform/vulkan/vram_bank_vk.cc index 8a54cde..bf8d23e 100644 --- a/src/platform/vulkan/vram_bank_vk.cc +++ b/src/platform/vulkan/vram_bank_vk.cc @@ -1,9 +1,8 @@ #include "vram_bank_vk.hh" -#include "wrapper/translate_vk.hh" +#include -#define MAX(A, B) ((A > B) ? A : B) -#define MIN(A, B) ((A < B) ? A : B) +#include "wrapper/translate_vk.hh" Result VRAMBank::init(GPUAdapter& gpu) { this->gpu = &gpu; @@ -19,20 +18,20 @@ Result VRAMBank::init(GPUAdapter& gpu) { vma_info.instance = gpu.instance; if (vmaImportVulkanFunctionsFromVolk(&vma_info, &vulkan_functions) != VK_SUCCESS) - return Err("Failed to import vulakn functions from volk (required for VMA init)."); + return Err("failed to import vulkan functions from volk (required for vma init)."); vma_info.pVulkanFunctions = &vulkan_functions; if (vmaCreateAllocator(&vma_info, &vma_allocator) != VK_SUCCESS) - return Err("Failed to initialise VMA."); + return Err("failed to initialise vma."); } /* Initialize the Stack Pools */ - render_targets.init(8u); - buffers.init(8u); - textures.init(8u); - images.init(8u); - samplers.init(8u); + render_targets.init(gpu.get_max_render_targets()); + buffers.init(gpu.get_max_buffers()); + textures.init(gpu.get_max_textures()); + images.init(gpu.get_max_images()); + samplers.init(gpu.get_max_samplers()); { /* Init Bindless */ /* Initialize the bindless resources */ @@ -180,11 +179,11 @@ Result VRAMBank::create_render_target(const TargetDesc& target, bo } /* Use up to 4 images that are available, this allows for triple buffering */ - resource.data.image_count = MIN(4, MAX(1, surface_features.maxImageCount)); + resource.data.image_count = std::min(4u, std::max(1u, surface_features.maxImageCount)); /* Set the width and height, with respect to the surface limits */ - resource.data.extent.width = MIN(MAX(width, surface_features.minImageExtent.width), surface_features.maxImageExtent.width); - resource.data.extent.height = MIN(MAX(width, surface_features.minImageExtent.height), surface_features.maxImageExtent.height); + resource.data.extent.width = std::min(std::max(width, surface_features.minImageExtent.width), surface_features.maxImageExtent.width); + resource.data.extent.height = std::min(std::max(width, surface_features.minImageExtent.height), surface_features.maxImageExtent.height); /* Get the available surface formats */ u32 format_count = 0u; @@ -214,20 +213,20 @@ Result VRAMBank::create_render_target(const TargetDesc& target, bo vkGetPhysicalDeviceSurfacePresentModesKHR(gpu->physical_device, resource.data.surface, &present_mode_count, present_modes); /* Find the presentation mode we want */ - VkPresentModeKHR present_mode = VK_PRESENT_MODE_IMMEDIATE_KHR; + resource.data.present_mode = VK_PRESENT_MODE_IMMEDIATE_KHR; for (u32 i = 0u; i < present_mode_count; ++i) { /* Mailbox is the preferred vsync present mode */ if (vsync == true && present_modes[i] == VK_PRESENT_MODE_MAILBOX_KHR) { - present_mode = present_modes[i]; + resource.data.present_mode = present_modes[i]; break; } /* FIFO is the back-up vsync present mode */ if (vsync == true && present_modes[i] == VK_PRESENT_MODE_FIFO_KHR) { - present_mode = present_modes[i]; + resource.data.present_mode = present_modes[i]; } /* Immediate is the preferred non-vsync present mode */ if (vsync == false && present_modes[i] == VK_PRESENT_MODE_IMMEDIATE_KHR) { - present_mode = present_modes[i]; + resource.data.present_mode = present_modes[i]; break; } } @@ -245,7 +244,7 @@ Result VRAMBank::create_render_target(const TargetDesc& target, bo swapchain_ci.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE; swapchain_ci.preTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR; swapchain_ci.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR; - swapchain_ci.presentMode = present_mode; + swapchain_ci.presentMode = resource.data.present_mode; swapchain_ci.clipped = true; /* Create the swapchain */ @@ -357,9 +356,9 @@ Result VRAMBank::create_texture(TextureUsage usage, TextureFormat fmt, VkImageCreateInfo texture_ci { VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO }; texture_ci.imageType = size.is_2d() ? VK_IMAGE_TYPE_2D : VK_IMAGE_TYPE_3D; texture_ci.format = format; - texture_ci.extent = { MAX(size.x, 1u), MAX(size.y, 1u), MAX(size.z, 1u) }; - texture_ci.mipLevels = MAX(1u, meta.mips); - texture_ci.arrayLayers = MAX(1u, meta.arrays); + texture_ci.extent = { std::max(size.x, 1u), std::max(size.y, 1u), std::max(size.z, 1u) }; + texture_ci.mipLevels = std::max(1u, meta.mips); + texture_ci.arrayLayers = std::max(1u, meta.arrays); texture_ci.samples = VK_SAMPLE_COUNT_1_BIT; /* No MSAA */ texture_ci.tiling = VK_IMAGE_TILING_OPTIMAL; texture_ci.usage = translate::texture_usage(usage); @@ -392,9 +391,9 @@ Result VRAMBank::create_image(Texture texture, u32 mip, u32 layer) { VkImageSubresourceRange sub_range {}; sub_range.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; /* Color hardcoded! (might want depth too) */ sub_range.baseMipLevel = mip; - sub_range.levelCount = MAX(1u, texture_slot.meta.mips - mip); + sub_range.levelCount = std::max(1u, texture_slot.meta.mips - mip); sub_range.baseArrayLayer = layer; - sub_range.layerCount = MAX(1u, texture_slot.meta.arrays - layer); + sub_range.layerCount = std::max(1u, texture_slot.meta.arrays - layer); resource.data.sub_range = sub_range; /* Image view creation info */ @@ -469,8 +468,8 @@ Result VRAMBank::resize_render_target(RenderTarget &render_target, u32 wid } /* Set the width and height, with respect to the surface limits */ - data.extent.width = MIN(MAX(width, surface_features.minImageExtent.width), surface_features.maxImageExtent.width); - data.extent.height = MIN(MAX(width, surface_features.minImageExtent.height), surface_features.maxImageExtent.height); + data.extent.width = std::min(std::max(width, surface_features.minImageExtent.width), surface_features.maxImageExtent.width); + data.extent.height = std::min(std::max(width, surface_features.minImageExtent.height), surface_features.maxImageExtent.height); /* Swapchain re-creation info */ VkSwapchainCreateInfoKHR swapchain_ci { VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR }; @@ -484,7 +483,7 @@ Result VRAMBank::resize_render_target(RenderTarget &render_target, u32 wid swapchain_ci.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE; swapchain_ci.preTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR; swapchain_ci.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR; - swapchain_ci.presentMode = VK_PRESENT_MODE_MAILBOX_KHR; /* TODO: Vsync parameter. */ + swapchain_ci.presentMode = data.present_mode; swapchain_ci.clipped = true; swapchain_ci.oldSwapchain = data.swapchain; @@ -493,9 +492,6 @@ Result VRAMBank::resize_render_target(RenderTarget &render_target, u32 wid return Err("failed to re-create swapchain for render target."); } - /* Destroy the old swapchain */ - vkDestroySwapchainKHR(gpu->logical_device, swapchain_ci.oldSwapchain, nullptr); - /* Get images from the swapchain */ if (vkGetSwapchainImagesKHR(gpu->logical_device, data.swapchain, &data.image_count, data.images) != VK_SUCCESS) { return Err("failed to get swapchain images for render target."); @@ -520,6 +516,9 @@ Result VRAMBank::resize_render_target(RenderTarget &render_target, u32 wid } } + /* Destroy the old swapchain */ + vkDestroySwapchainKHR(gpu->logical_device, swapchain_ci.oldSwapchain, nullptr); + return Ok(); } @@ -527,8 +526,8 @@ Result VRAMBank::resize_texture(Texture& texture, Size3D size) { /* Wait for the device to idle */ vkQueueWaitIdle(gpu->queues.queue_combined); - size.x = MAX(1, size.x); - size.y = MAX(1, size.y); + size.x = std::max(1u, size.x); + size.y = std::max(1u, size.y); if (size.x > 8192 || size.y > 8192) { return Err("texture size was larger 8192."); @@ -553,9 +552,9 @@ Result VRAMBank::resize_texture(Texture& texture, Size3D size) { VkImageCreateInfo texture_ci {VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO}; texture_ci.imageType = size.is_2d() ? VK_IMAGE_TYPE_2D : VK_IMAGE_TYPE_3D; texture_ci.format = format; - texture_ci.extent = {MAX(size.x, 1u), MAX(size.y, 1u), MAX(size.z, 1u)}; - texture_ci.mipLevels = MAX(1u, data.meta.mips); - texture_ci.arrayLayers = MAX(1u, data.meta.arrays); + texture_ci.extent = {std::max(size.x, 1u), std::max(size.y, 1u), std::max(size.z, 1u)}; + texture_ci.mipLevels = std::max(1u, data.meta.mips); + texture_ci.arrayLayers = std::max(1u, data.meta.arrays); texture_ci.samples = VK_SAMPLE_COUNT_1_BIT; /* No MSAA */ texture_ci.tiling = VK_IMAGE_TILING_OPTIMAL; texture_ci.usage = translate::texture_usage(data.usage); @@ -612,6 +611,60 @@ Result VRAMBank::resize_texture(Texture& texture, Size3D size) { return Ok(); } +Result VRAMBank::resize_buffer(Buffer& buffer, u64 count, u64 stride) { + /* Wait for the device to idle */ + vkQueueWaitIdle(gpu->queues.queue_combined); + + /* Get the buffer resource slot */ + BufferSlot& data = buffers.get(buffer); + + /* Size of the buffer in bytes */ + const u64 size = stride == 0 ? count : count * stride; + data.size = size; + + /* Destroy the existing buffer */ + vmaDestroyBuffer(vma_allocator, data.buffer, data.alloc); + + /* Buffer creation info */ + VkBufferCreateInfo buffer_ci { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO }; + buffer_ci.size = size; + buffer_ci.usage = translate::buffer_usage(data.usage); + buffer_ci.sharingMode = VK_SHARING_MODE_EXCLUSIVE; + buffer_ci.queueFamilyIndexCount = 1u; + buffer_ci.pQueueFamilyIndices = &gpu->queue_families.queue_combined; + + /* Memory allocation info */ + VmaAllocationCreateInfo alloc_ci {}; + alloc_ci.flags = 0x00u; + alloc_ci.usage = VMA_MEMORY_USAGE_AUTO; + + /* Create the buffer & allocate it using VMA */ + if (vmaCreateBuffer(vma_allocator, &buffer_ci, &alloc_ci, &data.buffer, &data.alloc, nullptr) != VK_SUCCESS) { + return Err("failed to create buffer."); + } + + /* Insert only Storage Buffers in the bindless descriptor set */ + if (has_flag(data.usage, BufferUsage::Storage)) { + /* Create the bindless descriptor write template */ + VkDescriptorBufferInfo buffer_info {}; + buffer_info.buffer = data.buffer; + buffer_info.offset = 0u; + buffer_info.range = size; + + VkWriteDescriptorSet bindless_write { VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET }; + bindless_write.dstSet = bindless_set; + bindless_write.dstArrayElement = buffer.get_index() - 1u; + bindless_write.descriptorCount = 1u; + bindless_write.pBufferInfo = &buffer_info; + bindless_write.dstBinding = BINDLESS_BUFFER_SLOT; + bindless_write.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER; + + vkUpdateDescriptorSets(gpu->logical_device, 1u, &bindless_write, 0u, nullptr); + } + + return Ok(); +} + Result VRAMBank::upload_buffer(Buffer& buffer, const void* data, u64 dst_offset, u64 size) { if (size == 0u) return Err("size is 0."); @@ -666,11 +719,11 @@ Result VRAMBank::upload_texture(Texture& texture, const void* data, const /* Staging buffer creation info */ VkBufferCreateInfo staging_buffer_ci { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO }; - staging_buffer_ci.size= size; - staging_buffer_ci.usage= VK_BUFFER_USAGE_TRANSFER_SRC_BIT; - staging_buffer_ci.sharingMode= VK_SHARING_MODE_EXCLUSIVE; - staging_buffer_ci.queueFamilyIndexCount= 1u; - staging_buffer_ci.pQueueFamilyIndices= &gpu->queue_families.queue_combined; + staging_buffer_ci.size = size; + staging_buffer_ci.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT; + staging_buffer_ci.sharingMode = VK_SHARING_MODE_EXCLUSIVE; + staging_buffer_ci.queueFamilyIndexCount = 1u; + staging_buffer_ci.pQueueFamilyIndices = &gpu->queue_families.queue_combined; /* Staging memory allocation info */ VmaAllocationCreateInfo alloc_ci {}; @@ -689,8 +742,8 @@ Result VRAMBank::upload_texture(Texture& texture, const void* data, const vmaUnmapMemory(vma_allocator, alloc); VkBufferImageCopy copy {}; - copy.imageSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0u, 0u, 1u}; - copy.imageExtent = VkExtent3D{MAX(texture_slot.size.x, 1u), MAX(texture_slot.size.y, 1u), MAX(texture_slot.size.z, 1u)}; + copy.imageSubresource = { VK_IMAGE_ASPECT_COLOR_BIT, 0u, 0u, 1u }; + copy.imageExtent = VkExtent3D { std::max(texture_slot.size.x, 1u), std::max(texture_slot.size.y, 1u), std::max(texture_slot.size.z, 1u) }; /* Create an image layout transition barrier */ VkImageMemoryBarrier2 image_barrier { VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER_2 }; @@ -701,7 +754,7 @@ Result VRAMBank::upload_texture(Texture& texture, const void* data, const image_barrier.oldLayout = texture_slot.layout; image_barrier.newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; image_barrier.image = texture_slot.image; - image_barrier.subresourceRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u}; + image_barrier.subresourceRange = { VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u }; texture_slot.layout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; /* Render target dependency info */ diff --git a/src/platform/vulkan/vram_bank_vk.hh b/src/platform/vulkan/vram_bank_vk.hh index 2cea12d..c1da1ee 100644 --- a/src/platform/vulkan/vram_bank_vk.hh +++ b/src/platform/vulkan/vram_bank_vk.hh @@ -64,7 +64,7 @@ public: PLATFORM_SPECIFIC Result create_render_target(const TargetDesc& target, bool vsync = true, u32 width = 1440u, u32 height = 810u); /** * @brief Create a new buffer resource. - * @param count If "stride" is 0 this represents the number of bytes in the buffer (for Constant buffers), + * @param count If "stride" is 0 this represents the number of bytes in the buffer, * otherwise it is the number of elements in the buffer. * @param stride The size in bytes of an element in the buffer, leave 0 for Constant buffers. */ @@ -80,6 +80,8 @@ public: PLATFORM_SPECIFIC Result resize_render_target(RenderTarget& render_target, u32 width, u32 height); /* Resize a texture resource. */ PLATFORM_SPECIFIC Result resize_texture(Texture& texture, Size3D size); + /* Resize a buffer resource. */ + PLATFORM_SPECIFIC Result resize_buffer(Buffer& buffer, u64 count, u64 stride = 0); /* Upload data to a GPU buffer resource. */ PLATFORM_SPECIFIC Result upload_buffer(Buffer& buffer, const void* data, u64 dst_offset, u64 size); @@ -109,6 +111,7 @@ struct RenderTargetSlot { u32 image_count = 0u; VkFormat format {}; VkColorSpaceKHR color_space {}; + VkPresentModeKHR present_mode {}; /* Swapchain resources */ VkSwapchainKHR swapchain {}; diff --git a/src/platform/vulkan/wrapper/extensions_vk.hh b/src/platform/vulkan/wrapper/extensions_vk.hh index 8a382ab..703e53d 100644 --- a/src/platform/vulkan/wrapper/extensions_vk.hh +++ b/src/platform/vulkan/wrapper/extensions_vk.hh @@ -18,6 +18,8 @@ const char* const device_ext[] = { VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME, /* Merging of copy commands */ VK_KHR_COPY_COMMANDS_2_EXTENSION_NAME, + /* Draw/Instance IDs in the shader (ex: SV_InstanceID) */ + VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME, }; const u32 device_ext_count = sizeof(device_ext) / sizeof(char*); diff --git a/src/platform/vulkan/wrapper/translate_vk.cc b/src/platform/vulkan/wrapper/translate_vk.cc index 5581539..5d79c6e 100644 --- a/src/platform/vulkan/wrapper/translate_vk.cc +++ b/src/platform/vulkan/wrapper/translate_vk.cc @@ -64,8 +64,7 @@ VkBufferUsageFlags buffer_usage(BufferUsage usage) { if (has_flag(usage, BufferUsage::Constant)) flags |= VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT; if (has_flag(usage, BufferUsage::Storage)) flags |= VK_BUFFER_USAGE_STORAGE_BUFFER_BIT; if (has_flag(usage, BufferUsage::Vertex)) flags |= VK_BUFFER_USAGE_VERTEX_BUFFER_BIT; - // if (has_flag(usage, BufferUsage::eIndex)) flags |= VK_BUFFER_USAGE_INDEX_BUFFER_BIT; - // if (has_flag(usage, BufferUsage::eIndirect)) flags |= VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT; + if (has_flag(usage, BufferUsage::Indirect)) flags |= VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT; return flags; } @@ -81,6 +80,10 @@ VkFormat texture_format(TextureFormat format) { switch (format) { case TextureFormat::RGBA8Unorm: return VK_FORMAT_R8G8B8A8_UNORM; + case TextureFormat::RG32Uint: + return VK_FORMAT_R32G32_UINT; + case TextureFormat::RG11B10Ufloat: + return VK_FORMAT_B10G11R11_UFLOAT_PACK32; default: return VK_FORMAT_UNDEFINED; }