├── .github └── workflows │ └── main.yml ├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── LICENSE ├── include └── InGameOverlay │ ├── RendererDetector.h │ ├── RendererHook.h │ └── RendererResource.h ├── src ├── BaseHook.cpp ├── BaseHook.h ├── Internal.cpp ├── InternalIncludes.h ├── Linux │ ├── OpenGLXHook.cpp │ ├── OpenGLXHook.h │ ├── RendererDetector.cpp │ ├── VulkanHook.cpp │ ├── VulkanHook.h │ ├── X11Hook.cpp │ └── X11Hook.h ├── MacOSX │ ├── MetalHook.h │ ├── MetalHook.mm │ ├── NSViewHook.h │ ├── NSViewHook.mm │ ├── OpenGLHook.h │ ├── OpenGLHook.mm │ └── RendererDetector.mm ├── RendererHookInternal.cpp ├── RendererHookInternal.h ├── RendererResourceInternal.cpp ├── RendererResourceInternal.h ├── VulkanHelpers.h ├── VulkanSDK │ └── include │ │ ├── vk_video │ │ ├── vulkan_video_codec_h264std.h │ │ ├── vulkan_video_codec_h264std_decode.h │ │ ├── vulkan_video_codec_h264std_encode.h │ │ ├── vulkan_video_codec_h265std.h │ │ ├── vulkan_video_codec_h265std_decode.h │ │ ├── vulkan_video_codec_h265std_encode.h │ │ └── vulkan_video_codecs_common.h │ │ └── vulkan │ │ ├── utility │ │ └── vk_format_utils.h │ │ ├── vk_enum_string_helper.h │ │ ├── vk_icd.h │ │ ├── vk_layer.h │ │ ├── vk_platform.h │ │ ├── vulkan.cppm │ │ ├── vulkan.h │ │ ├── vulkan.hpp │ │ ├── vulkan_android.h │ │ ├── vulkan_beta.h │ │ ├── vulkan_core.h │ │ ├── vulkan_directfb.h │ │ ├── vulkan_enums.hpp │ │ ├── vulkan_extension_inspection.hpp │ │ ├── vulkan_format_traits.hpp │ │ ├── vulkan_fuchsia.h │ │ ├── vulkan_funcs.hpp │ │ ├── vulkan_ggp.h │ │ ├── vulkan_handles.hpp │ │ ├── vulkan_hash.hpp │ │ ├── vulkan_hpp_macros.hpp │ │ ├── vulkan_ios.h │ │ ├── vulkan_macos.h │ │ ├── vulkan_metal.h │ │ ├── vulkan_profiles.hpp │ │ ├── vulkan_raii.hpp │ │ ├── vulkan_screen.h │ │ ├── vulkan_shared.hpp │ │ ├── vulkan_static_assertions.hpp │ │ ├── vulkan_structs.hpp │ │ ├── vulkan_to_string.hpp │ │ ├── vulkan_vi.h │ │ ├── vulkan_video.hpp │ │ ├── vulkan_wayland.h │ │ ├── vulkan_win32.h │ │ ├── vulkan_xcb.h │ │ ├── vulkan_xlib.h │ │ └── vulkan_xlib_xrandr.h ├── Windows │ ├── DX10Hook.cpp │ ├── DX10Hook.h │ ├── DX11Hook.cpp │ ├── DX11Hook.h │ ├── DX12Hook.cpp │ ├── DX12Hook.h │ ├── DX9Hook.cpp │ ├── DX9Hook.h │ ├── DXVKDetector.h │ ├── DirectXVTables.h │ ├── OpenGLHook.cpp │ ├── OpenGLHook.h │ ├── RendererDetector.cpp │ ├── SimpleWindowsGamingInput.cpp │ ├── SimpleWindowsGamingInput.h │ ├── VulkanHook.cpp │ ├── VulkanHook.h │ ├── WindowsGamingInputVTables.h │ ├── WindowsHook.cpp │ └── WindowsHook.h ├── glad2 │ └── include │ │ └── glad │ │ └── gl.h └── mpmc_bounded_queue.h └── tests ├── common ├── glfw │ ├── CMake │ │ ├── GenerateMappings.cmake │ │ ├── Info.plist.in │ │ ├── cmake_uninstall.cmake.in │ │ ├── glfw3.pc.in │ │ ├── glfw3Config.cmake.in │ │ ├── i686-w64-mingw32-clang.cmake │ │ ├── i686-w64-mingw32.cmake │ │ ├── modules │ │ │ ├── FindEpollShim.cmake │ │ │ └── FindOSMesa.cmake │ │ ├── x86_64-w64-mingw32-clang.cmake │ │ └── x86_64-w64-mingw32.cmake │ ├── CMakeLists.txt │ ├── deps │ │ ├── getopt.c │ │ ├── getopt.h │ │ ├── glad │ │ │ ├── gl.h │ │ │ ├── gles2.h │ │ │ └── vulkan.h │ │ ├── linmath.h │ │ ├── mingw │ │ │ ├── _mingw_dxhelper.h │ │ │ ├── dinput.h │ │ │ └── xinput.h │ │ ├── nuklear.h │ │ ├── nuklear_glfw_gl2.h │ │ ├── stb_image_write.h │ │ ├── tinycthread.c │ │ ├── tinycthread.h │ │ └── wayland │ │ │ ├── fractional-scale-v1.xml │ │ │ ├── idle-inhibit-unstable-v1.xml │ │ │ ├── pointer-constraints-unstable-v1.xml │ │ │ ├── relative-pointer-unstable-v1.xml │ │ │ ├── viewporter.xml │ │ │ ├── wayland.xml │ │ │ ├── xdg-activation-v1.xml │ │ │ ├── xdg-decoration-unstable-v1.xml │ │ │ └── xdg-shell.xml │ ├── include │ │ └── GLFW │ │ │ ├── glfw3.h │ │ │ └── glfw3native.h │ └── src │ │ ├── CMakeLists.txt │ │ ├── cocoa_init.m │ │ ├── cocoa_joystick.h │ │ ├── cocoa_joystick.m │ │ ├── cocoa_monitor.m │ │ ├── cocoa_platform.h │ │ ├── cocoa_time.c │ │ ├── cocoa_time.h │ │ ├── cocoa_window.m │ │ ├── context.c │ │ ├── egl_context.c │ │ ├── glfw.rc.in │ │ ├── glx_context.c │ │ ├── init.c │ │ ├── input.c │ │ ├── internal.h │ │ ├── linux_joystick.c │ │ ├── linux_joystick.h │ │ ├── mappings.h │ │ ├── mappings.h.in │ │ ├── monitor.c │ │ ├── nsgl_context.m │ │ ├── null_init.c │ │ ├── null_joystick.c │ │ ├── null_joystick.h │ │ ├── null_monitor.c │ │ ├── null_platform.h │ │ ├── null_window.c │ │ ├── osmesa_context.c │ │ ├── platform.c │ │ ├── platform.h │ │ ├── posix_module.c │ │ ├── posix_poll.c │ │ ├── posix_poll.h │ │ ├── posix_thread.c │ │ ├── posix_thread.h │ │ ├── posix_time.c │ │ ├── posix_time.h │ │ ├── vulkan.c │ │ ├── wgl_context.c │ │ ├── win32_init.c │ │ ├── win32_joystick.c │ │ ├── win32_joystick.h │ │ ├── win32_module.c │ │ ├── win32_monitor.c │ │ ├── win32_platform.h │ │ ├── win32_thread.c │ │ ├── win32_thread.h │ │ ├── win32_time.c │ │ ├── win32_time.h │ │ ├── win32_window.c │ │ ├── window.c │ │ ├── wl_init.c │ │ ├── wl_monitor.c │ │ ├── wl_platform.h │ │ ├── wl_window.c │ │ ├── x11_init.c │ │ ├── x11_monitor.c │ │ ├── x11_platform.h │ │ ├── x11_window.c │ │ ├── xkb_unicode.c │ │ └── xkb_unicode.h ├── imgui_impl_dx12.cpp ├── imgui_impl_dx12.h ├── imgui_impl_osx.h ├── imgui_impl_osx.mm ├── imgui_impl_vulkan.cpp ├── imgui_impl_vulkan.h ├── ingameoverlay_imconfig.h ├── right_facing_fist.h ├── stb_image.h ├── thumbs_down.h ├── thumbs_down_small.h ├── thumbs_up.h └── vulkansdk │ ├── include │ ├── dxc │ │ ├── WinAdapter.h │ │ └── dxcapi.h │ ├── glslang │ │ ├── Include │ │ │ ├── ResourceLimits.h │ │ │ ├── glslang_c_interface.h │ │ │ └── glslang_c_shader_types.h │ │ ├── MachineIndependent │ │ │ └── Versions.h │ │ ├── Public │ │ │ ├── ResourceLimits.h │ │ │ ├── ShaderLang.h │ │ │ └── resource_limits_c.h │ │ └── SPIRV │ │ │ ├── GlslangToSpv.h │ │ │ ├── Logger.h │ │ │ ├── SPVRemapper.h │ │ │ └── spirv.hpp │ ├── shaderc │ │ ├── env.h │ │ ├── shaderc.h │ │ ├── shaderc.hpp │ │ ├── status.h │ │ └── visibility.h │ ├── spirv-headers │ │ ├── GLSL.std.450.h │ │ ├── spirv.h │ │ ├── spirv.hpp │ │ ├── spirv.hpp11 │ │ ├── spirv.json │ │ ├── spirv.lua │ │ └── spirv.py │ ├── spirv-tools │ │ ├── libspirv.h │ │ ├── libspirv.hpp │ │ ├── linker.hpp │ │ └── optimizer.hpp │ ├── spirv_cross │ │ ├── GLSL.std.450.h │ │ ├── spirv.h │ │ ├── spirv.hpp │ │ ├── spirv_cfg.hpp │ │ ├── spirv_common.hpp │ │ ├── spirv_cross.hpp │ │ ├── spirv_cross_c.h │ │ ├── spirv_cross_containers.hpp │ │ ├── spirv_cross_error_handling.hpp │ │ ├── spirv_cross_parsed_ir.hpp │ │ ├── spirv_glsl.hpp │ │ ├── spirv_hlsl.hpp │ │ ├── spirv_msl.hpp │ │ ├── spirv_parser.hpp │ │ └── spirv_reflect.hpp │ ├── vk_video │ │ ├── vulkan_video_codec_h264std.h │ │ ├── vulkan_video_codec_h264std_decode.h │ │ ├── vulkan_video_codec_h264std_encode.h │ │ ├── vulkan_video_codec_h265std.h │ │ ├── vulkan_video_codec_h265std_decode.h │ │ ├── vulkan_video_codec_h265std_encode.h │ │ └── vulkan_video_codecs_common.h │ └── vulkan │ │ ├── utility │ │ └── vk_format_utils.h │ │ ├── vk_enum_string_helper.h │ │ ├── vk_icd.h │ │ ├── vk_layer.h │ │ ├── vk_platform.h │ │ ├── vulkan.cppm │ │ ├── vulkan.h │ │ ├── vulkan.hpp │ │ ├── vulkan_android.h │ │ ├── vulkan_beta.h │ │ ├── vulkan_core.h │ │ ├── vulkan_directfb.h │ │ ├── vulkan_enums.hpp │ │ ├── vulkan_extension_inspection.hpp │ │ ├── vulkan_format_traits.hpp │ │ ├── vulkan_fuchsia.h │ │ ├── vulkan_funcs.hpp │ │ ├── vulkan_ggp.h │ │ ├── vulkan_handles.hpp │ │ ├── vulkan_hash.hpp │ │ ├── vulkan_hpp_macros.hpp │ │ ├── vulkan_ios.h │ │ ├── vulkan_macos.h │ │ ├── vulkan_metal.h │ │ ├── vulkan_profiles.hpp │ │ ├── vulkan_raii.hpp │ │ ├── vulkan_screen.h │ │ ├── vulkan_shared.hpp │ │ ├── vulkan_static_assertions.hpp │ │ ├── vulkan_structs.hpp │ │ ├── vulkan_to_string.hpp │ │ ├── vulkan_vi.h │ │ ├── vulkan_video.hpp │ │ ├── vulkan_wayland.h │ │ ├── vulkan_win32.h │ │ ├── vulkan_xcb.h │ │ ├── vulkan_xlib.h │ │ └── vulkan_xlib_xrandr.h │ └── lib │ ├── libvulkan.so.1.3.290 │ └── vulkan-1.lib ├── dx10 └── main.cpp ├── dx11 └── main.cpp ├── dx12 └── main.cpp ├── dx9 └── main.cpp ├── linux_opengl ├── build.sh └── main.cpp ├── linux_vulkan ├── build.sh └── main.cpp ├── macos_metal ├── build.sh ├── macOS │ └── Info-macOS.plist └── main.mm ├── macos_opengl2 ├── build.sh └── main.mm ├── macos_opengl3 ├── build.sh └── main.mm ├── overlay_example └── library_main.cpp ├── test_overlay └── library_main.cpp ├── windows_opengl3 └── main.cpp ├── windows_shaders_precompile ├── dx10_shaders.cpp ├── dx11_shaders.cpp ├── dx12_shaders.cpp ├── dx9_shaders.cpp ├── main.cpp ├── sha256.cpp ├── sha256.h └── shaders.h └── windows_vulkan └── main.cpp /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | # on any push 6 | pull_request: 7 | # on pull request 8 | workflow_dispatch: 9 | # allows manual trigger 10 | 11 | jobs: 12 | job: 13 | name: ${{ matrix.os }}-${{ matrix.platform }}-cmake-build 14 | runs-on: ${{ matrix.os }} 15 | strategy: 16 | fail-fast: false 17 | matrix: 18 | os: [ubuntu-latest, windows-latest, macos-latest] 19 | platform: [x32, x64] 20 | exclude: 21 | - os: macos-latest 22 | platform: x32 23 | 24 | steps: 25 | - uses: actions/checkout@v4 26 | with: 27 | submodules: recursive 28 | fetch-depth: 0 29 | 30 | - uses: lukka/get-cmake@latest 31 | 32 | - name: Linux tests (x64) 33 | if: ${{ matrix.os == 'ubuntu-latest' && matrix.platform == 'x64' }} 34 | shell: bash 35 | run: | 36 | sudo apt-get update 37 | sudo apt-get install libgl1-mesa-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev 38 | cmake ${{ github.workspace }}/CMakeLists.txt -DINGAMEOVERLAY_BUILD_TESTS=ON -DIMGUI_USER_CONFIG=${{github.workspace}}/tests/common/ingameoverlay_imconfig.h -S . -B build 39 | cmake --build build -v 40 | #find build 41 | 42 | - name: Linux tests (x32) 43 | if: ${{ matrix.os == 'ubuntu-latest' && matrix.platform == 'x32' }} 44 | shell: bash 45 | run: | 46 | sudo dpkg --add-architecture i386 47 | sudo apt-get update 48 | sudo apt install -y gcc-multilib g++-multilib # needed for 32-bit builds 49 | 50 | sudo apt-get install libgl1-mesa-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libgl1-mesa-dev:i386 libxrandr-dev:i386 libxinerama-dev:i386 libxcursor-dev:i386 libxi-dev:i386 51 | 52 | # write a cmake toolchain file to force 32-bit compilation 53 | cat >cmake_32_build.toolchain <. 18 | */ 19 | 20 | #pragma once 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | #include "RendererHook.h" 27 | 28 | namespace InGameOverlay { 29 | 30 | /// 31 | /// Starts a detector to automatically find the renderer used by the application. 32 | /// 33 | /// The time before the future will timeout if no renderer has been found. 34 | /// Set this to any combined RendererHookType_t value to filter the renderers you want to detect. 35 | /// Prefer hooking the system libraries instead of the first one found. 36 | /// A future nullptr or the renderer. 37 | std::future DetectRenderer(std::chrono::milliseconds timeout = std::chrono::milliseconds{ -1 }, RendererHookType_t rendererToDetect = RendererHookType_t::Any, bool preferSystemLibraries = true); 38 | 39 | /// 40 | /// Stops the detector, the future will return as soon as possible. 41 | /// 42 | void StopRendererDetection(); 43 | 44 | /// 45 | /// Free the detector allocated by DetectRenderer to you to restart detection, else, the same result will always return. 46 | /// 47 | void FreeDetector(); 48 | 49 | } -------------------------------------------------------------------------------- /src/BaseHook.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Nemirtingas 3 | * This file is part of the ingame overlay project 4 | * 5 | * The ingame overlay project is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * The ingame overlay project is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with the ingame overlay project; if not, see 17 | * . 18 | */ 19 | 20 | #include "BaseHook.h" 21 | 22 | #include 23 | #include 24 | 25 | BaseHook_t::BaseHook_t() 26 | {} 27 | 28 | BaseHook_t::~BaseHook_t() 29 | { 30 | UnhookAll(); 31 | } 32 | 33 | void BaseHook_t::BeginHook() 34 | { 35 | //mini_detour::transaction_begin(); 36 | } 37 | 38 | void BaseHook_t::EndHook() 39 | { 40 | //mini_detour::transaction_commit(); 41 | } 42 | 43 | bool BaseHook_t::HookFunc(std::pair hook) 44 | { 45 | mini_detour::hook md_hook; 46 | void* res = md_hook.hook_func(*hook.first, hook.second); 47 | if (res == nullptr) 48 | return false; 49 | 50 | _HookedFunctions.emplace_back(std::move(md_hook)); 51 | *hook.first = res; 52 | return true; 53 | } 54 | 55 | void BaseHook_t::UnhookAll() 56 | { 57 | _HookedFunctions.clear(); 58 | } 59 | -------------------------------------------------------------------------------- /src/BaseHook.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Nemirtingas 3 | * This file is part of the ingame overlay project 4 | * 5 | * The ingame overlay project is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * The ingame overlay project is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with the ingame overlay project; if not, see 17 | * . 18 | */ 19 | 20 | #pragma once 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | class BaseHook_t 28 | { 29 | protected: 30 | std::vector _HookedFunctions; 31 | 32 | BaseHook_t(const BaseHook_t&) = delete; 33 | BaseHook_t(BaseHook_t&&) = delete; 34 | BaseHook_t& operator =(const BaseHook_t&) = delete; 35 | BaseHook_t& operator =(BaseHook_t&&) = delete; 36 | 37 | public: 38 | BaseHook_t(); 39 | virtual ~BaseHook_t(); 40 | 41 | void BeginHook(); 42 | void EndHook(); 43 | void UnhookAll(); 44 | 45 | bool HookFunc(std::pair hook); 46 | 47 | template 48 | void HookFuncs(std::pair funcs) 49 | { 50 | HookFunc(funcs); 51 | } 52 | 53 | template 54 | void HookFuncs(std::pair funcs, Args... args) 55 | { 56 | HookFunc(funcs); 57 | HookFuncs(args...); 58 | } 59 | }; 60 | -------------------------------------------------------------------------------- /src/Internal.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Nemirtingas 3 | * This file is part of the ingame overlay project 4 | * 5 | * The ingame overlay project is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * The ingame overlay project is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with the ingame overlay project; if not, see 17 | * . 18 | */ 19 | 20 | #include "InternalIncludes.h" 21 | 22 | #ifdef INGAMEOVERLAY_USE_SPDLOG 23 | static std::shared_ptr _InGameOverlayLogger; 24 | 25 | std::shared_ptr GetLogger() 26 | { 27 | return _InGameOverlayLogger; 28 | } 29 | 30 | void SetLogger(std::shared_ptr logger) 31 | { 32 | _InGameOverlayLogger = logger; 33 | } 34 | 35 | #endif -------------------------------------------------------------------------------- /src/InternalIncludes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Nemirtingas 3 | * This file is part of the ingame overlay project 4 | * 5 | * The ingame overlay project is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * The ingame overlay project is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with the ingame overlay project; if not, see 17 | * . 18 | */ 19 | 20 | #pragma once 21 | 22 | #include "BaseHook.h" 23 | 24 | #if defined(_WIN32) || defined(WIN32) || defined(_WIN64) || defined(WIN64) 25 | 26 | #include 27 | #ifdef GetModuleHandle 28 | #undef GetModuleHandle 29 | #endif 30 | 31 | #endif 32 | 33 | #ifdef INGAMEOVERLAY_USE_SPDLOG 34 | #define SPDLOG_ACTIVE_LEVEL 0 35 | #include 36 | 37 | std::shared_ptr GetLogger(); 38 | void SetLogger(std::shared_ptr logger); 39 | 40 | #define INGAMEOVERLAY_SPDLOG_LOGGER_NAME "RendererDetectorDebugLogger" 41 | #define INGAMEOVERLAY_SPDLOG_LOG_FORMAT "[%H:%M:%S.%e](%t)[%l] - %!{%#} - %v" 42 | 43 | #define INGAMEOVERLAY_TRACE(...) SPDLOG_LOGGER_TRACE(GetLogger(), __VA_ARGS__) 44 | #define INGAMEOVERLAY_DEBUG(...) SPDLOG_LOGGER_DEBUG(GetLogger(), __VA_ARGS__) 45 | #define INGAMEOVERLAY_INFO(...) SPDLOG_LOGGER_INFO(GetLogger(), __VA_ARGS__) 46 | #define INGAMEOVERLAY_WARN(...) SPDLOG_LOGGER_WARN(GetLogger(), __VA_ARGS__) 47 | #define INGAMEOVERLAY_ERROR(...) SPDLOG_LOGGER_ERROR(GetLogger(), __VA_ARGS__) 48 | 49 | #else 50 | 51 | #define INGAMEOVERLAY_TRACE(...) 52 | #define INGAMEOVERLAY_DEBUG(...) 53 | #define INGAMEOVERLAY_INFO(...) 54 | #define INGAMEOVERLAY_WARN(...) 55 | #define INGAMEOVERLAY_ERROR(...) 56 | 57 | #endif -------------------------------------------------------------------------------- /src/Linux/OpenGLXHook.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019-2020 Nemirtingas 3 | * This file is part of the ingame overlay project 4 | * 5 | * The ingame overlay project is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * The ingame overlay project is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with the ingame overlay project; if not, see 17 | * . 18 | */ 19 | 20 | #pragma once 21 | 22 | #include "../RendererHookInternal.h" 23 | 24 | #include 25 | 26 | namespace InGameOverlay { 27 | 28 | class OpenGLXHook_t : 29 | public InGameOverlay::RendererHookInternal_t, 30 | public BaseHook_t 31 | { 32 | private: 33 | static OpenGLXHook_t* _Instance; 34 | 35 | // Variables 36 | bool _Hooked; 37 | bool _X11Hooked; 38 | bool _Initialized; 39 | OverlayHookState _HookState; 40 | Display *_Display; 41 | //GLXContext _Context; 42 | std::set> _ImageResources; 43 | void* _ImGuiFontAtlas; 44 | 45 | // Functions 46 | OpenGLXHook_t(); 47 | 48 | void _ResetRenderState(OverlayHookState state); 49 | void _PrepareForOverlay(Display* display, GLXDrawable drawable); 50 | void _HandleScreenshot(); 51 | 52 | // Hook to render functions 53 | decltype(::glXSwapBuffers)* _GLXSwapBuffers; 54 | 55 | static void _MyGLXSwapBuffers(Display* display, GLXDrawable drawable); 56 | 57 | public: 58 | std::string LibraryName; 59 | 60 | virtual ~OpenGLXHook_t(); 61 | 62 | virtual bool StartHook(std::function key_combination_callback, ToggleKey toggleKeys[], int toggleKeysCount, /*ImFontAtlas* */ void* imgui_font_atlas = nullptr); 63 | virtual void HideAppInputs(bool hide); 64 | virtual void HideOverlayInputs(bool hide); 65 | virtual bool IsStarted(); 66 | static OpenGLXHook_t* Inst(); 67 | virtual const char* GetLibraryName() const; 68 | virtual RendererHookType_t GetRendererHookType() const; 69 | void LoadFunctions(decltype(::glXSwapBuffers)* pfnglXSwapBuffers); 70 | 71 | virtual std::weak_ptr CreateImageResource(const void* image_data, uint32_t width, uint32_t height); 72 | virtual void ReleaseImageResource(std::weak_ptr resource); 73 | }; 74 | 75 | }// namespace InGameOverlay -------------------------------------------------------------------------------- /src/Linux/X11Hook.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Nemirtingas 3 | * This file is part of the ingame overlay project 4 | * 5 | * The ingame overlay project is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * The ingame overlay project is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with the ingame overlay project; if not, see 17 | * . 18 | */ 19 | 20 | #pragma once 21 | 22 | #include "../RendererHookInternal.h" 23 | 24 | #include // XEvent types 25 | #include // XEvent structure 26 | #include // XEvent keysym 27 | 28 | namespace InGameOverlay { 29 | 30 | class X11Hook_t : 31 | public BaseHook_t 32 | { 33 | private: 34 | static X11Hook_t* _inst; 35 | 36 | // Variables 37 | bool _Hooked; 38 | bool _Initialized; 39 | Display* _Display; 40 | Window _GameWnd; 41 | 42 | // In (bool): Is toggle wanted 43 | // Out(bool): Is the overlay visible, if true, inputs will be disabled 44 | std::function _KeyCombinationCallback; 45 | std::vector _NativeKeyCombination; 46 | Window _SavedRoot; 47 | Window _SavedChild; 48 | int _SavedCursorRX; 49 | int _SavedCursorRY; 50 | int _SavedCursorX; 51 | int _SavedCursorY; 52 | unsigned int _SavedMask; 53 | bool _KeyCombinationPushed; 54 | bool _ApplicationInputsHidden; 55 | bool _OverlayInputsHidden; 56 | 57 | // Functions 58 | X11Hook_t(); 59 | int _CheckForOverlay(Display *d, int num_events); 60 | 61 | // Hook to X11 window messages 62 | decltype(::XQueryPointer)* _XQueryPointer; 63 | decltype(::XEventsQueued)* _XEventsQueued; 64 | decltype(::XPending)* _XPending; 65 | 66 | static Bool MyXQueryPointer(Display* display, Window w, Window* root_return, Window* child_return, int* root_x_return, int* root_y_return, int* win_x_return, int* win_y_return, unsigned int* mask_return); 67 | static int MyXEventsQueued(Display * display, int mode); 68 | static int MyXPending(Display* display); 69 | 70 | public: 71 | std::string LibraryName; 72 | 73 | virtual ~X11Hook_t(); 74 | 75 | void ResetRenderState(OverlayHookState state); 76 | bool SetInitialWindowSize(Window wnd); 77 | bool PrepareForOverlay(Window wnd); 78 | std::vector FindApplicationX11Window(int32_t processId); 79 | 80 | Window GetGameWnd() const{ return _GameWnd; } 81 | 82 | bool StartHook(std::function& keyCombinationCallback, ToggleKey toggleKeys[], int toggleKeysCount); 83 | void HideAppInputs(bool hide); 84 | void HideOverlayInputs(bool hide); 85 | static X11Hook_t* Inst(); 86 | virtual const char* GetLibraryName() const; 87 | }; 88 | 89 | }// namespace InGameOverlay -------------------------------------------------------------------------------- /src/MacOSX/MetalHook.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Nemirtingas 3 | * This file is part of the ingame overlay project 4 | * 5 | * The ingame overlay project is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * The ingame overlay project is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with the ingame overlay project; if not, see 17 | * . 18 | */ 19 | 20 | #pragma once 21 | 22 | #include "../RendererHookInternal.h" 23 | 24 | #include "../InternalIncludes.h" 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | namespace InGameOverlay { 32 | 33 | class MetalHook_t : 34 | public InGameOverlay::RendererHookInternal_t, 35 | public BaseHook_t 36 | { 37 | private: 38 | static MetalHook_t* _Instance; 39 | 40 | struct RenderPass_t 41 | { 42 | MTLRenderPassDescriptor* Descriptor; 43 | id CommandBuffer; 44 | id Encoder; 45 | }; 46 | 47 | // Variables 48 | bool _Hooked; 49 | bool _NSViewHooked; 50 | bool _Initialized; 51 | std::set> _ImageResources; 52 | id _MetalDevice; 53 | std::vector _RenderPass; 54 | 55 | void* _ImGuiFontAtlas; 56 | 57 | // Functions 58 | MetalHook_t(); 59 | 60 | void _ResetRenderState(); 61 | void _PrepareForOverlay(RenderPass_t& renderPass); 62 | void _HandleScreenshot(); 63 | 64 | // Hook to render functions 65 | Method _MTLCommandBufferRenderCommandEncoderWithDescriptorMethod; 66 | Method _MTLRenderCommandEncoderEndEncodingMethod; 67 | 68 | id (*_MTLCommandBufferRenderCommandEncoderWithDescriptor)(id self, SEL sel, MTLRenderPassDescriptor* descriptor); 69 | void (*_MTLRenderCommandEncoderEndEncoding)(id self, SEL sel); 70 | 71 | public: 72 | std::string LibraryName; 73 | 74 | static id MyMTLCommandBufferRenderCommandEncoderWithDescriptor(id self, SEL sel, MTLRenderPassDescriptor* descriptor); 75 | static void MyMTLCommandEncoderEndEncoding(id self, SEL sel); 76 | 77 | virtual ~MetalHook_t(); 78 | 79 | virtual bool StartHook(std::function keyCombinationCcallback, ToggleKey toggleKeys[], int toggleKeysCount, /*ImFontAtlas* */ void* imguiFontAtlas = nullptr); 80 | virtual void HideAppInputs(bool hide); 81 | virtual void HideOverlayInputs(bool hide); 82 | virtual bool IsStarted(); 83 | static MetalHook_t* Inst(); 84 | virtual const char* GetLibraryName() const; 85 | virtual RendererHookType_t GetRendererHookType() const; 86 | void LoadFunctions(Method MTLCommandBufferRenderCommandEncoderWithDescriptor, Method RenderCommandEncoderEndEncoding); 87 | 88 | virtual std::weak_ptr CreateImageResource(const void* image_data, uint32_t width, uint32_t height); 89 | virtual void ReleaseImageResource(std::weak_ptr resource); 90 | }; 91 | 92 | }// namespace InGameOverlay -------------------------------------------------------------------------------- /src/MacOSX/NSViewHook.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Nemirtingas 3 | * This file is part of the ingame overlay project 4 | * 5 | * The ingame overlay project is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * The ingame overlay project is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with the ingame overlay project; if not, see 17 | * . 18 | */ 19 | 20 | #pragma once 21 | 22 | #include "../RendererHookInternal.h" 23 | 24 | #import 25 | #import 26 | #import 27 | #include 28 | 29 | namespace InGameOverlay { 30 | 31 | class NSViewHook_t : 32 | public BaseHook_t 33 | { 34 | public: 35 | static constexpr const char* DLL_NAME = "AppKit"; 36 | 37 | private: 38 | static NSViewHook_t* _Instance; 39 | 40 | // Variables 41 | bool _Hooked; 42 | bool _Initialized; 43 | id _EventMonitor; 44 | NSWindow* _Window; 45 | NSPoint _SavedLocation; 46 | 47 | NSInteger(*pressedMouseButtons)(id self, SEL sel); 48 | NSPoint (*mouseLocation)(id self, SEL sel); 49 | 50 | // Hooked functions 51 | static NSInteger MypressedMouseButtons(id self, SEL sel); 52 | static NSPoint MymouseLocation(id self, SEL sel); 53 | 54 | // Functions 55 | NSViewHook_t(); 56 | 57 | public: 58 | std::function KeyCombinationCallback; 59 | std::vector NativeKeyCombination; 60 | bool KeyCombinationPushed; 61 | bool ApplicationInputsHidden; 62 | bool OverlayInputsHidden; 63 | 64 | std::string LibraryName; 65 | 66 | virtual ~NSViewHook_t(); 67 | 68 | void ResetRenderState(); 69 | bool PrepareForOverlay(); 70 | 71 | bool StartHook(std::function& keyCombinationCallback, ToggleKey toggleKeys[], int toggleKeysCount); 72 | void HideAppInputs(bool hide); 73 | void HideOverlayInputs(bool hide); 74 | static NSViewHook_t* Inst(); 75 | virtual const char* GetLibraryName() const; 76 | 77 | }; 78 | 79 | }// namespace InGameOverlay -------------------------------------------------------------------------------- /src/MacOSX/OpenGLHook.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Nemirtingas 3 | * This file is part of the ingame overlay project 4 | * 5 | * The ingame overlay project is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * The ingame overlay project is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with the ingame overlay project; if not, see 17 | * . 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifndef GL_SILENCE_DEPRECATION 23 | #define GL_SILENCE_DEPRECATION 24 | #endif 25 | 26 | #include "../RendererHookInternal.h" 27 | 28 | #include "../InternalIncludes.h" 29 | 30 | #include 31 | 32 | #include 33 | 34 | //struct CGLDrawable_t; 35 | //extern "C" CGLError CGLFlushDrawable(CGLDrawable_t*); 36 | 37 | struct ImDrawData; 38 | 39 | namespace InGameOverlay { 40 | 41 | class OpenGLHook_t : 42 | public InGameOverlay::RendererHookInternal_t, 43 | public BaseHook_t 44 | { 45 | private: 46 | struct OpenGLDriver_t 47 | { 48 | bool (*ImGuiInit)(); 49 | bool (*ImGuiNewFrame)(); 50 | void (*ImGuiRenderDrawData)(ImDrawData*); 51 | void (*ImGuiShutdown)(); 52 | }; 53 | 54 | static OpenGLHook_t* _Instance; 55 | 56 | // Variables 57 | bool _Hooked; 58 | bool _NSViewHooked; 59 | bool _Initialized; 60 | OpenGLDriver_t _OpenGLDriver; 61 | std::set> _ImageResources; 62 | void* _ImGuiFontAtlas; 63 | 64 | // Functions 65 | OpenGLHook_t(); 66 | 67 | void _ResetRenderState(); 68 | void _PrepareForOverlay(); 69 | void _HandleScreenshot(); 70 | 71 | // Hook to render functions 72 | Method _NSOpenGLContextFlushBufferMethod; 73 | CGLError (*_NSOpenGLContextflushBuffer)(id self); 74 | decltype(::CGLFlushDrawable)* _CGLFlushDrawable; 75 | 76 | static CGLError _MyNSOpenGLContextFlushBuffer(id self); 77 | static CGLError _MyCGLFlushDrawable(CGLContextObj glDrawable); 78 | 79 | public: 80 | std::string LibraryName; 81 | 82 | virtual ~OpenGLHook_t(); 83 | 84 | virtual bool StartHook(std::function keyCombinationCallback, ToggleKey toggleKeys[], int toggleKeysCount, /*ImFontAtlas* */ void* imguiFontAtlas = nullptr); 85 | virtual void HideAppInputs(bool hide); 86 | virtual void HideOverlayInputs(bool hide); 87 | virtual bool IsStarted(); 88 | static OpenGLHook_t* Inst(); 89 | virtual const char* GetLibraryName() const; 90 | virtual RendererHookType_t GetRendererHookType() const; 91 | void LoadFunctions(Method openGLFlushBufferMethod, decltype(::CGLFlushDrawable)* pfnCGLFlushDrawable); 92 | 93 | virtual std::weak_ptr CreateImageResource(const void* image_data, uint32_t width, uint32_t height); 94 | virtual void ReleaseImageResource(std::weak_ptr resource); 95 | }; 96 | 97 | }// namespace InGameOverlay -------------------------------------------------------------------------------- /src/RendererHookInternal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Nemirtingas 3 | * This file is part of the ingame overlay project 4 | * 5 | * The ingame overlay project is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * The ingame overlay project is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with the ingame overlay project; if not, see 17 | * . 18 | */ 19 | 20 | #pragma once 21 | 22 | #include 23 | #include "InternalIncludes.h" 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | namespace InGameOverlay { 30 | 31 | class RendererResourceInternal_t; 32 | 33 | class RendererHookInternal_t : public RendererHook_t 34 | { 35 | ScreenshotCallback_t _ScreenshotCallback; 36 | void* _ScreenshotCallbackUserParameter; 37 | ScreenshotType_t _TakeScreenshotType; 38 | ResourceAutoLoad_t _AutoLoad; 39 | uint32_t _BatchSize; 40 | std::vector _ResourcesToLoad; 41 | 42 | protected: 43 | RendererHookInternal_t(); 44 | virtual ~RendererHookInternal_t(); 45 | 46 | void _LoadResources(); 47 | 48 | ScreenshotType_t _ScreenshotType(); 49 | 50 | void _SendScreenshot(ScreenshotCallbackParameter_t* screenshot); 51 | 52 | public: 53 | void AppendResourceToLoadBatch(RendererResourceInternal_t* pResource); 54 | 55 | virtual void SetScreenshotCallback(ScreenshotCallback_t callback, void* userParam); 56 | 57 | virtual uint32_t GetAutoLoadBatchSize(); 58 | 59 | virtual void SetAutoLoadBatchSize(uint32_t batchSize); 60 | 61 | virtual ResourceAutoLoad_t GetResourceAutoLoad() const; 62 | 63 | virtual void SetResourceAutoLoad(ResourceAutoLoad_t autoLoad = ResourceAutoLoad_t::Batch); 64 | 65 | virtual RendererResource_t* CreateResource(); 66 | 67 | virtual RendererResource_t* CreateAndLoadResource(const void* image_data, uint32_t width, uint32_t height, bool attach); 68 | 69 | virtual void TakeScreenshot(ScreenshotType_t type); 70 | 71 | virtual std::weak_ptr CreateImageResource(const void* image_data, uint32_t width, uint32_t height) = 0; 72 | 73 | virtual void ReleaseImageResource(std::weak_ptr resource) = 0; 74 | }; 75 | 76 | } -------------------------------------------------------------------------------- /src/RendererResourceInternal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Nemirtingas 3 | * This file is part of the ingame overlay project 4 | * 5 | * The ingame overlay project is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * The ingame overlay project is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with the ingame overlay project; if not, see 17 | * . 18 | */ 19 | 20 | #pragma once 21 | 22 | #include 23 | 24 | #include "InternalIncludes.h" 25 | 26 | namespace InGameOverlay { 27 | 28 | class RendererHookInternal_t; 29 | 30 | class RendererResourceInternal_t : public RendererResource_t 31 | { 32 | struct ResourceState_t 33 | { 34 | std::weak_ptr RendererResource; 35 | uint32_t Width = 0; 36 | uint32_t Height = 0; 37 | 38 | inline void Reset() 39 | { 40 | RendererResource.reset(); 41 | Width = 0; 42 | Height = 0; 43 | } 44 | }; 45 | 46 | protected: 47 | RendererHookInternal_t* _RendererHook; 48 | 49 | bool _DoBatchLoad(); 50 | bool _DoAutoLoad(); 51 | 52 | public: 53 | ResourceState_t _OldRendererResource; 54 | ResourceState_t _RendererResource; 55 | ResourceAutoLoad_t _AutoLoad; 56 | const void* _Data; 57 | 58 | RendererResourceInternal_t(RendererHookInternal_t* rendererHook, ResourceAutoLoad_t autoLoad) noexcept; 59 | 60 | RendererResourceInternal_t(RendererResourceInternal_t &&) noexcept = default; 61 | RendererResourceInternal_t& operator=(RendererResourceInternal_t &&) noexcept = default; 62 | 63 | RendererResourceInternal_t(RendererResourceInternal_t const&) = delete; 64 | RendererResourceInternal_t& operator=(RendererResourceInternal_t const&) = delete; 65 | 66 | virtual ~RendererResourceInternal_t(); 67 | 68 | virtual void Delete(); 69 | 70 | virtual bool IsLoaded() const; 71 | 72 | virtual ResourceAutoLoad_t AutoLoad() const; 73 | 74 | virtual void SetAutoLoad(ResourceAutoLoad_t autoLoad); 75 | 76 | virtual bool CanBeLoaded() const; 77 | 78 | virtual bool LoadAttachedResource(); 79 | 80 | virtual bool Load(const void* data, uint32_t width, uint32_t height); 81 | 82 | virtual uint64_t GetResourceId(); 83 | 84 | virtual uint32_t Width() const; 85 | 86 | virtual uint32_t Height() const; 87 | 88 | virtual void AttachResource(const void* data, uint32_t width, uint32_t height); 89 | 90 | virtual void ClearAttachedResource(); 91 | 92 | virtual void Unload(bool clearAttachedResource = true); 93 | 94 | bool AttachementChanged(); 95 | 96 | void UnloadOldResource(); 97 | }; 98 | 99 | } -------------------------------------------------------------------------------- /src/VulkanHelpers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Nemirtingas 3 | * This file is part of the ingame overlay project 4 | * 5 | * The ingame overlay project is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * The ingame overlay project is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with the ingame overlay project; if not, see 17 | * . 18 | */ 19 | 20 | #pragma once 21 | 22 | #include 23 | 24 | #include 25 | 26 | #include 27 | 28 | constexpr int SelectDeviceTypeStart = 5; // countof(deviceTypePriorities) 29 | 30 | static bool IsVulkanExtensionAvailable(const std::vector& properties, const char* extension) 31 | { 32 | for (const VkExtensionProperties& p : properties) 33 | if (strcmp(p.extensionName, extension) == 0) 34 | return true; 35 | 36 | return false; 37 | } 38 | 39 | static int32_t GetVulkanFirstGraphicsQueue(std::vector const& queues) 40 | { 41 | for (uint32_t i = 0; i < queues.size(); i++) 42 | { 43 | if (queues[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) 44 | return i; 45 | } 46 | 47 | return -1; 48 | } 49 | 50 | static bool SelectVulkanPhysicalDeviceType(VkPhysicalDeviceType deviceType, int& deviceTypeSelected) 51 | { 52 | constexpr VkPhysicalDeviceType deviceTypePriorities[] = { 53 | VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, 54 | VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU, 55 | VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU, 56 | VK_PHYSICAL_DEVICE_TYPE_CPU, 57 | VK_PHYSICAL_DEVICE_TYPE_OTHER, 58 | }; 59 | 60 | for (int i = 0; i < deviceTypeSelected; ++i) 61 | { 62 | if (deviceTypePriorities[i] == deviceType) 63 | { 64 | deviceTypeSelected = i; 65 | return true; 66 | } 67 | } 68 | 69 | return false; 70 | } 71 | 72 | static int32_t GetVulkanPhysicalDeviceFirstGraphicsQueue(decltype(::vkGetPhysicalDeviceQueueFamilyProperties)* _vkGetPhysicalDeviceQueueFamilyProperties, VkPhysicalDevice physicalDevice) 73 | { 74 | uint32_t count; 75 | std::vector queues; 76 | _vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, &count, nullptr); 77 | queues.resize(count); 78 | _vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, &count, queues.data()); 79 | 80 | return GetVulkanFirstGraphicsQueue(queues); 81 | } 82 | 83 | static bool VulkanPhysicalDeviceHasExtension(decltype(::vkEnumerateDeviceExtensionProperties)* _vkEnumerateDeviceExtensionProperties, VkPhysicalDevice vkPhysicalDevice, const char* extensionName) 84 | { 85 | uint32_t count; 86 | std::vector extensionProperties; 87 | 88 | _vkEnumerateDeviceExtensionProperties(vkPhysicalDevice, nullptr, &count, nullptr); 89 | extensionProperties.resize(count); 90 | _vkEnumerateDeviceExtensionProperties(vkPhysicalDevice, nullptr, &count, extensionProperties.data()); 91 | 92 | return IsVulkanExtensionAvailable(extensionProperties, extensionName); 93 | } -------------------------------------------------------------------------------- /src/VulkanSDK/include/vk_video/vulkan_video_codec_h264std_decode.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_VIDEO_CODEC_H264STD_DECODE_H_ 2 | #define VULKAN_VIDEO_CODEC_H264STD_DECODE_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // vulkan_video_codec_h264std_decode is a preprocessor guard. Do not pass it to API calls. 23 | #define vulkan_video_codec_h264std_decode 1 24 | #include "vulkan_video_codec_h264std.h" 25 | 26 | #define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_API_VERSION_1_0_0 VK_MAKE_VIDEO_STD_VERSION(1, 0, 0) 27 | 28 | #define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_API_VERSION_1_0_0 29 | #define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h264_decode" 30 | #define STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE 2 31 | 32 | typedef enum StdVideoDecodeH264FieldOrderCount { 33 | STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_TOP = 0, 34 | STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_BOTTOM = 1, 35 | STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_INVALID = 0x7FFFFFFF, 36 | STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_MAX_ENUM = 0x7FFFFFFF 37 | } StdVideoDecodeH264FieldOrderCount; 38 | typedef struct StdVideoDecodeH264PictureInfoFlags { 39 | uint32_t field_pic_flag : 1; 40 | uint32_t is_intra : 1; 41 | uint32_t IdrPicFlag : 1; 42 | uint32_t bottom_field_flag : 1; 43 | uint32_t is_reference : 1; 44 | uint32_t complementary_field_pair : 1; 45 | } StdVideoDecodeH264PictureInfoFlags; 46 | 47 | typedef struct StdVideoDecodeH264PictureInfo { 48 | StdVideoDecodeH264PictureInfoFlags flags; 49 | uint8_t seq_parameter_set_id; 50 | uint8_t pic_parameter_set_id; 51 | uint8_t reserved1; 52 | uint8_t reserved2; 53 | uint16_t frame_num; 54 | uint16_t idr_pic_id; 55 | int32_t PicOrderCnt[STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE]; 56 | } StdVideoDecodeH264PictureInfo; 57 | 58 | typedef struct StdVideoDecodeH264ReferenceInfoFlags { 59 | uint32_t top_field_flag : 1; 60 | uint32_t bottom_field_flag : 1; 61 | uint32_t used_for_long_term_reference : 1; 62 | uint32_t is_non_existing : 1; 63 | } StdVideoDecodeH264ReferenceInfoFlags; 64 | 65 | typedef struct StdVideoDecodeH264ReferenceInfo { 66 | StdVideoDecodeH264ReferenceInfoFlags flags; 67 | uint16_t FrameNum; 68 | uint16_t reserved; 69 | int32_t PicOrderCnt[STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE]; 70 | } StdVideoDecodeH264ReferenceInfo; 71 | 72 | 73 | #ifdef __cplusplus 74 | } 75 | #endif 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /src/VulkanSDK/include/vk_video/vulkan_video_codec_h265std_decode.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_VIDEO_CODEC_H265STD_DECODE_H_ 2 | #define VULKAN_VIDEO_CODEC_H265STD_DECODE_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // vulkan_video_codec_h265std_decode is a preprocessor guard. Do not pass it to API calls. 23 | #define vulkan_video_codec_h265std_decode 1 24 | #include "vulkan_video_codec_h265std.h" 25 | 26 | #define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_API_VERSION_1_0_0 VK_MAKE_VIDEO_STD_VERSION(1, 0, 0) 27 | 28 | #define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_API_VERSION_1_0_0 29 | #define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h265_decode" 30 | #define STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE 8 31 | typedef struct StdVideoDecodeH265PictureInfoFlags { 32 | uint32_t IrapPicFlag : 1; 33 | uint32_t IdrPicFlag : 1; 34 | uint32_t IsReference : 1; 35 | uint32_t short_term_ref_pic_set_sps_flag : 1; 36 | } StdVideoDecodeH265PictureInfoFlags; 37 | 38 | typedef struct StdVideoDecodeH265PictureInfo { 39 | StdVideoDecodeH265PictureInfoFlags flags; 40 | uint8_t sps_video_parameter_set_id; 41 | uint8_t pps_seq_parameter_set_id; 42 | uint8_t pps_pic_parameter_set_id; 43 | uint8_t NumDeltaPocsOfRefRpsIdx; 44 | int32_t PicOrderCntVal; 45 | uint16_t NumBitsForSTRefPicSetInSlice; 46 | uint16_t reserved; 47 | uint8_t RefPicSetStCurrBefore[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE]; 48 | uint8_t RefPicSetStCurrAfter[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE]; 49 | uint8_t RefPicSetLtCurr[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE]; 50 | } StdVideoDecodeH265PictureInfo; 51 | 52 | typedef struct StdVideoDecodeH265ReferenceInfoFlags { 53 | uint32_t used_for_long_term_reference : 1; 54 | uint32_t unused_for_reference : 1; 55 | } StdVideoDecodeH265ReferenceInfoFlags; 56 | 57 | typedef struct StdVideoDecodeH265ReferenceInfo { 58 | StdVideoDecodeH265ReferenceInfoFlags flags; 59 | int32_t PicOrderCntVal; 60 | } StdVideoDecodeH265ReferenceInfo; 61 | 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /src/VulkanSDK/include/vk_video/vulkan_video_codecs_common.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_VIDEO_CODECS_COMMON_H_ 2 | #define VULKAN_VIDEO_CODECS_COMMON_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // vulkan_video_codecs_common is a preprocessor guard. Do not pass it to API calls. 23 | #define vulkan_video_codecs_common 1 24 | #if !defined(VK_NO_STDINT_H) 25 | #include 26 | #endif 27 | 28 | #define VK_MAKE_VIDEO_STD_VERSION(major, minor, patch) \ 29 | ((((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch))) 30 | 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/VulkanSDK/include/vulkan/vk_platform.h: -------------------------------------------------------------------------------- 1 | // 2 | // File: vk_platform.h 3 | // 4 | /* 5 | ** Copyright 2014-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | 11 | #ifndef VK_PLATFORM_H_ 12 | #define VK_PLATFORM_H_ 13 | 14 | #ifdef __cplusplus 15 | extern "C" 16 | { 17 | #endif // __cplusplus 18 | 19 | /* 20 | *************************************************************************************************** 21 | * Platform-specific directives and type declarations 22 | *************************************************************************************************** 23 | */ 24 | 25 | /* Platform-specific calling convention macros. 26 | * 27 | * Platforms should define these so that Vulkan clients call Vulkan commands 28 | * with the same calling conventions that the Vulkan implementation expects. 29 | * 30 | * VKAPI_ATTR - Placed before the return type in function declarations. 31 | * Useful for C++11 and GCC/Clang-style function attribute syntax. 32 | * VKAPI_CALL - Placed after the return type in function declarations. 33 | * Useful for MSVC-style calling convention syntax. 34 | * VKAPI_PTR - Placed between the '(' and '*' in function pointer types. 35 | * 36 | * Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void); 37 | * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void); 38 | */ 39 | #if defined(_WIN32) 40 | // On Windows, Vulkan commands use the stdcall convention 41 | #define VKAPI_ATTR 42 | #define VKAPI_CALL __stdcall 43 | #define VKAPI_PTR VKAPI_CALL 44 | #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7 45 | #error "Vulkan is not supported for the 'armeabi' NDK ABI" 46 | #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE) 47 | // On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" 48 | // calling convention, i.e. float parameters are passed in registers. This 49 | // is true even if the rest of the application passes floats on the stack, 50 | // as it does by default when compiling for the armeabi-v7a NDK ABI. 51 | #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp"))) 52 | #define VKAPI_CALL 53 | #define VKAPI_PTR VKAPI_ATTR 54 | #else 55 | // On other platforms, use the default calling convention 56 | #define VKAPI_ATTR 57 | #define VKAPI_CALL 58 | #define VKAPI_PTR 59 | #endif 60 | 61 | #if !defined(VK_NO_STDDEF_H) 62 | #include 63 | #endif // !defined(VK_NO_STDDEF_H) 64 | 65 | #if !defined(VK_NO_STDINT_H) 66 | #if defined(_MSC_VER) && (_MSC_VER < 1600) 67 | typedef signed __int8 int8_t; 68 | typedef unsigned __int8 uint8_t; 69 | typedef signed __int16 int16_t; 70 | typedef unsigned __int16 uint16_t; 71 | typedef signed __int32 int32_t; 72 | typedef unsigned __int32 uint32_t; 73 | typedef signed __int64 int64_t; 74 | typedef unsigned __int64 uint64_t; 75 | #else 76 | #include 77 | #endif 78 | #endif // !defined(VK_NO_STDINT_H) 79 | 80 | #ifdef __cplusplus 81 | } // extern "C" 82 | #endif // __cplusplus 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /src/VulkanSDK/include/vulkan/vulkan.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_H_ 2 | #define VULKAN_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | #include "vk_platform.h" 11 | #include "vulkan_core.h" 12 | 13 | #ifdef VK_USE_PLATFORM_ANDROID_KHR 14 | #include "vulkan_android.h" 15 | #endif 16 | 17 | #ifdef VK_USE_PLATFORM_FUCHSIA 18 | #include 19 | #include "vulkan_fuchsia.h" 20 | #endif 21 | 22 | #ifdef VK_USE_PLATFORM_IOS_MVK 23 | #include "vulkan_ios.h" 24 | #endif 25 | 26 | 27 | #ifdef VK_USE_PLATFORM_MACOS_MVK 28 | #include "vulkan_macos.h" 29 | #endif 30 | 31 | #ifdef VK_USE_PLATFORM_METAL_EXT 32 | #include "vulkan_metal.h" 33 | #endif 34 | 35 | #ifdef VK_USE_PLATFORM_VI_NN 36 | #include "vulkan_vi.h" 37 | #endif 38 | 39 | 40 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR 41 | #include "vulkan_wayland.h" 42 | #endif 43 | 44 | 45 | #ifdef VK_USE_PLATFORM_WIN32_KHR 46 | #include 47 | #include "vulkan_win32.h" 48 | #endif 49 | 50 | 51 | #ifdef VK_USE_PLATFORM_XCB_KHR 52 | #include 53 | #include "vulkan_xcb.h" 54 | #endif 55 | 56 | 57 | #ifdef VK_USE_PLATFORM_XLIB_KHR 58 | #include 59 | #include "vulkan_xlib.h" 60 | #endif 61 | 62 | 63 | #ifdef VK_USE_PLATFORM_DIRECTFB_EXT 64 | #include 65 | #include "vulkan_directfb.h" 66 | #endif 67 | 68 | 69 | #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT 70 | #include 71 | #include 72 | #include "vulkan_xlib_xrandr.h" 73 | #endif 74 | 75 | 76 | #ifdef VK_USE_PLATFORM_GGP 77 | #include 78 | #include "vulkan_ggp.h" 79 | #endif 80 | 81 | 82 | #ifdef VK_USE_PLATFORM_SCREEN_QNX 83 | #include 84 | #include "vulkan_screen.h" 85 | #endif 86 | 87 | 88 | #ifdef VK_USE_PLATFORM_SCI 89 | #include 90 | #include 91 | #include "vulkan_sci.h" 92 | #endif 93 | 94 | 95 | #ifdef VK_ENABLE_BETA_EXTENSIONS 96 | #include "vulkan_beta.h" 97 | #endif 98 | 99 | #endif // VULKAN_H_ 100 | -------------------------------------------------------------------------------- /src/VulkanSDK/include/vulkan/vulkan_directfb.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_DIRECTFB_H_ 2 | #define VULKAN_DIRECTFB_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // VK_EXT_directfb_surface is a preprocessor guard. Do not pass it to API calls. 23 | #define VK_EXT_directfb_surface 1 24 | #define VK_EXT_DIRECTFB_SURFACE_SPEC_VERSION 1 25 | #define VK_EXT_DIRECTFB_SURFACE_EXTENSION_NAME "VK_EXT_directfb_surface" 26 | typedef VkFlags VkDirectFBSurfaceCreateFlagsEXT; 27 | typedef struct VkDirectFBSurfaceCreateInfoEXT { 28 | VkStructureType sType; 29 | const void* pNext; 30 | VkDirectFBSurfaceCreateFlagsEXT flags; 31 | IDirectFB* dfb; 32 | IDirectFBSurface* surface; 33 | } VkDirectFBSurfaceCreateInfoEXT; 34 | 35 | typedef VkResult (VKAPI_PTR *PFN_vkCreateDirectFBSurfaceEXT)(VkInstance instance, const VkDirectFBSurfaceCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 36 | typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceDirectFBPresentationSupportEXT)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, IDirectFB* dfb); 37 | 38 | #ifndef VK_NO_PROTOTYPES 39 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateDirectFBSurfaceEXT( 40 | VkInstance instance, 41 | const VkDirectFBSurfaceCreateInfoEXT* pCreateInfo, 42 | const VkAllocationCallbacks* pAllocator, 43 | VkSurfaceKHR* pSurface); 44 | 45 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceDirectFBPresentationSupportEXT( 46 | VkPhysicalDevice physicalDevice, 47 | uint32_t queueFamilyIndex, 48 | IDirectFB* dfb); 49 | #endif 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/VulkanSDK/include/vulkan/vulkan_ggp.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_GGP_H_ 2 | #define VULKAN_GGP_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // VK_GGP_stream_descriptor_surface is a preprocessor guard. Do not pass it to API calls. 23 | #define VK_GGP_stream_descriptor_surface 1 24 | #define VK_GGP_STREAM_DESCRIPTOR_SURFACE_SPEC_VERSION 1 25 | #define VK_GGP_STREAM_DESCRIPTOR_SURFACE_EXTENSION_NAME "VK_GGP_stream_descriptor_surface" 26 | typedef VkFlags VkStreamDescriptorSurfaceCreateFlagsGGP; 27 | typedef struct VkStreamDescriptorSurfaceCreateInfoGGP { 28 | VkStructureType sType; 29 | const void* pNext; 30 | VkStreamDescriptorSurfaceCreateFlagsGGP flags; 31 | GgpStreamDescriptor streamDescriptor; 32 | } VkStreamDescriptorSurfaceCreateInfoGGP; 33 | 34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateStreamDescriptorSurfaceGGP)(VkInstance instance, const VkStreamDescriptorSurfaceCreateInfoGGP* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 35 | 36 | #ifndef VK_NO_PROTOTYPES 37 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateStreamDescriptorSurfaceGGP( 38 | VkInstance instance, 39 | const VkStreamDescriptorSurfaceCreateInfoGGP* pCreateInfo, 40 | const VkAllocationCallbacks* pAllocator, 41 | VkSurfaceKHR* pSurface); 42 | #endif 43 | 44 | 45 | // VK_GGP_frame_token is a preprocessor guard. Do not pass it to API calls. 46 | #define VK_GGP_frame_token 1 47 | #define VK_GGP_FRAME_TOKEN_SPEC_VERSION 1 48 | #define VK_GGP_FRAME_TOKEN_EXTENSION_NAME "VK_GGP_frame_token" 49 | typedef struct VkPresentFrameTokenGGP { 50 | VkStructureType sType; 51 | const void* pNext; 52 | GgpFrameToken frameToken; 53 | } VkPresentFrameTokenGGP; 54 | 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /src/VulkanSDK/include/vulkan/vulkan_ios.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_IOS_H_ 2 | #define VULKAN_IOS_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // VK_MVK_ios_surface is a preprocessor guard. Do not pass it to API calls. 23 | #define VK_MVK_ios_surface 1 24 | #define VK_MVK_IOS_SURFACE_SPEC_VERSION 3 25 | #define VK_MVK_IOS_SURFACE_EXTENSION_NAME "VK_MVK_ios_surface" 26 | typedef VkFlags VkIOSSurfaceCreateFlagsMVK; 27 | typedef struct VkIOSSurfaceCreateInfoMVK { 28 | VkStructureType sType; 29 | const void* pNext; 30 | VkIOSSurfaceCreateFlagsMVK flags; 31 | const void* pView; 32 | } VkIOSSurfaceCreateInfoMVK; 33 | 34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateIOSSurfaceMVK)(VkInstance instance, const VkIOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 35 | 36 | #ifndef VK_NO_PROTOTYPES 37 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateIOSSurfaceMVK( 38 | VkInstance instance, 39 | const VkIOSSurfaceCreateInfoMVK* pCreateInfo, 40 | const VkAllocationCallbacks* pAllocator, 41 | VkSurfaceKHR* pSurface); 42 | #endif 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/VulkanSDK/include/vulkan/vulkan_macos.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_MACOS_H_ 2 | #define VULKAN_MACOS_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // VK_MVK_macos_surface is a preprocessor guard. Do not pass it to API calls. 23 | #define VK_MVK_macos_surface 1 24 | #define VK_MVK_MACOS_SURFACE_SPEC_VERSION 3 25 | #define VK_MVK_MACOS_SURFACE_EXTENSION_NAME "VK_MVK_macos_surface" 26 | typedef VkFlags VkMacOSSurfaceCreateFlagsMVK; 27 | typedef struct VkMacOSSurfaceCreateInfoMVK { 28 | VkStructureType sType; 29 | const void* pNext; 30 | VkMacOSSurfaceCreateFlagsMVK flags; 31 | const void* pView; 32 | } VkMacOSSurfaceCreateInfoMVK; 33 | 34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateMacOSSurfaceMVK)(VkInstance instance, const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 35 | 36 | #ifndef VK_NO_PROTOTYPES 37 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateMacOSSurfaceMVK( 38 | VkInstance instance, 39 | const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, 40 | const VkAllocationCallbacks* pAllocator, 41 | VkSurfaceKHR* pSurface); 42 | #endif 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/VulkanSDK/include/vulkan/vulkan_vi.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_VI_H_ 2 | #define VULKAN_VI_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // VK_NN_vi_surface is a preprocessor guard. Do not pass it to API calls. 23 | #define VK_NN_vi_surface 1 24 | #define VK_NN_VI_SURFACE_SPEC_VERSION 1 25 | #define VK_NN_VI_SURFACE_EXTENSION_NAME "VK_NN_vi_surface" 26 | typedef VkFlags VkViSurfaceCreateFlagsNN; 27 | typedef struct VkViSurfaceCreateInfoNN { 28 | VkStructureType sType; 29 | const void* pNext; 30 | VkViSurfaceCreateFlagsNN flags; 31 | void* window; 32 | } VkViSurfaceCreateInfoNN; 33 | 34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateViSurfaceNN)(VkInstance instance, const VkViSurfaceCreateInfoNN* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 35 | 36 | #ifndef VK_NO_PROTOTYPES 37 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateViSurfaceNN( 38 | VkInstance instance, 39 | const VkViSurfaceCreateInfoNN* pCreateInfo, 40 | const VkAllocationCallbacks* pAllocator, 41 | VkSurfaceKHR* pSurface); 42 | #endif 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/VulkanSDK/include/vulkan/vulkan_wayland.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_WAYLAND_H_ 2 | #define VULKAN_WAYLAND_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // VK_KHR_wayland_surface is a preprocessor guard. Do not pass it to API calls. 23 | #define VK_KHR_wayland_surface 1 24 | #define VK_KHR_WAYLAND_SURFACE_SPEC_VERSION 6 25 | #define VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME "VK_KHR_wayland_surface" 26 | typedef VkFlags VkWaylandSurfaceCreateFlagsKHR; 27 | typedef struct VkWaylandSurfaceCreateInfoKHR { 28 | VkStructureType sType; 29 | const void* pNext; 30 | VkWaylandSurfaceCreateFlagsKHR flags; 31 | struct wl_display* display; 32 | struct wl_surface* surface; 33 | } VkWaylandSurfaceCreateInfoKHR; 34 | 35 | typedef VkResult (VKAPI_PTR *PFN_vkCreateWaylandSurfaceKHR)(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 36 | typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, struct wl_display* display); 37 | 38 | #ifndef VK_NO_PROTOTYPES 39 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateWaylandSurfaceKHR( 40 | VkInstance instance, 41 | const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, 42 | const VkAllocationCallbacks* pAllocator, 43 | VkSurfaceKHR* pSurface); 44 | 45 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWaylandPresentationSupportKHR( 46 | VkPhysicalDevice physicalDevice, 47 | uint32_t queueFamilyIndex, 48 | struct wl_display* display); 49 | #endif 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/VulkanSDK/include/vulkan/vulkan_xcb.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_XCB_H_ 2 | #define VULKAN_XCB_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // VK_KHR_xcb_surface is a preprocessor guard. Do not pass it to API calls. 23 | #define VK_KHR_xcb_surface 1 24 | #define VK_KHR_XCB_SURFACE_SPEC_VERSION 6 25 | #define VK_KHR_XCB_SURFACE_EXTENSION_NAME "VK_KHR_xcb_surface" 26 | typedef VkFlags VkXcbSurfaceCreateFlagsKHR; 27 | typedef struct VkXcbSurfaceCreateInfoKHR { 28 | VkStructureType sType; 29 | const void* pNext; 30 | VkXcbSurfaceCreateFlagsKHR flags; 31 | xcb_connection_t* connection; 32 | xcb_window_t window; 33 | } VkXcbSurfaceCreateInfoKHR; 34 | 35 | typedef VkResult (VKAPI_PTR *PFN_vkCreateXcbSurfaceKHR)(VkInstance instance, const VkXcbSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 36 | typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, xcb_connection_t* connection, xcb_visualid_t visual_id); 37 | 38 | #ifndef VK_NO_PROTOTYPES 39 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateXcbSurfaceKHR( 40 | VkInstance instance, 41 | const VkXcbSurfaceCreateInfoKHR* pCreateInfo, 42 | const VkAllocationCallbacks* pAllocator, 43 | VkSurfaceKHR* pSurface); 44 | 45 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXcbPresentationSupportKHR( 46 | VkPhysicalDevice physicalDevice, 47 | uint32_t queueFamilyIndex, 48 | xcb_connection_t* connection, 49 | xcb_visualid_t visual_id); 50 | #endif 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/VulkanSDK/include/vulkan/vulkan_xlib.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_XLIB_H_ 2 | #define VULKAN_XLIB_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // VK_KHR_xlib_surface is a preprocessor guard. Do not pass it to API calls. 23 | #define VK_KHR_xlib_surface 1 24 | #define VK_KHR_XLIB_SURFACE_SPEC_VERSION 6 25 | #define VK_KHR_XLIB_SURFACE_EXTENSION_NAME "VK_KHR_xlib_surface" 26 | typedef VkFlags VkXlibSurfaceCreateFlagsKHR; 27 | typedef struct VkXlibSurfaceCreateInfoKHR { 28 | VkStructureType sType; 29 | const void* pNext; 30 | VkXlibSurfaceCreateFlagsKHR flags; 31 | Display* dpy; 32 | Window window; 33 | } VkXlibSurfaceCreateInfoKHR; 34 | 35 | typedef VkResult (VKAPI_PTR *PFN_vkCreateXlibSurfaceKHR)(VkInstance instance, const VkXlibSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 36 | typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display* dpy, VisualID visualID); 37 | 38 | #ifndef VK_NO_PROTOTYPES 39 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR( 40 | VkInstance instance, 41 | const VkXlibSurfaceCreateInfoKHR* pCreateInfo, 42 | const VkAllocationCallbacks* pAllocator, 43 | VkSurfaceKHR* pSurface); 44 | 45 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXlibPresentationSupportKHR( 46 | VkPhysicalDevice physicalDevice, 47 | uint32_t queueFamilyIndex, 48 | Display* dpy, 49 | VisualID visualID); 50 | #endif 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/VulkanSDK/include/vulkan/vulkan_xlib_xrandr.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_XLIB_XRANDR_H_ 2 | #define VULKAN_XLIB_XRANDR_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // VK_EXT_acquire_xlib_display is a preprocessor guard. Do not pass it to API calls. 23 | #define VK_EXT_acquire_xlib_display 1 24 | #define VK_EXT_ACQUIRE_XLIB_DISPLAY_SPEC_VERSION 1 25 | #define VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME "VK_EXT_acquire_xlib_display" 26 | typedef VkResult (VKAPI_PTR *PFN_vkAcquireXlibDisplayEXT)(VkPhysicalDevice physicalDevice, Display* dpy, VkDisplayKHR display); 27 | typedef VkResult (VKAPI_PTR *PFN_vkGetRandROutputDisplayEXT)(VkPhysicalDevice physicalDevice, Display* dpy, RROutput rrOutput, VkDisplayKHR* pDisplay); 28 | 29 | #ifndef VK_NO_PROTOTYPES 30 | VKAPI_ATTR VkResult VKAPI_CALL vkAcquireXlibDisplayEXT( 31 | VkPhysicalDevice physicalDevice, 32 | Display* dpy, 33 | VkDisplayKHR display); 34 | 35 | VKAPI_ATTR VkResult VKAPI_CALL vkGetRandROutputDisplayEXT( 36 | VkPhysicalDevice physicalDevice, 37 | Display* dpy, 38 | RROutput rrOutput, 39 | VkDisplayKHR* pDisplay); 40 | #endif 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/Windows/DX10Hook.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Nemirtingas 3 | * This file is part of the ingame overlay project 4 | * 5 | * The ingame overlay project is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * The ingame overlay project is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with the ingame overlay project; if not, see 17 | * . 18 | */ 19 | 20 | #pragma once 21 | 22 | #include "../RendererHookInternal.h" 23 | 24 | #include 25 | #include 26 | 27 | namespace InGameOverlay { 28 | 29 | class DX10Hook_t : 30 | public InGameOverlay::RendererHookInternal_t, 31 | public BaseHook_t 32 | { 33 | private: 34 | static DX10Hook_t* _Instance; 35 | 36 | // Variables 37 | bool _Hooked; 38 | bool _WindowsHooked; 39 | bool _UsesDXVK; 40 | uint32_t _DeviceReleasing; 41 | ID3D10Device* _Device; 42 | ULONG _HookDeviceRefCount; 43 | OverlayHookState _HookState; 44 | ID3D10RenderTargetView* _RenderTargetView; 45 | std::set> _ImageResources; 46 | void* _ImGuiFontAtlas; 47 | 48 | // Functions 49 | DX10Hook_t(); 50 | 51 | void _UpdateHookDeviceRefCount(); 52 | bool _CreateRenderTargets(IDXGISwapChain *pSwapChain); 53 | void _DestroyRenderTargets(); 54 | void _ResetRenderState(OverlayHookState state); 55 | void _PrepareForOverlay(IDXGISwapChain *pSwapChain, UINT flags); 56 | void _HandleScreenshot(IDXGISwapChain* pSwapChain); 57 | 58 | // Hook to render functions 59 | decltype(&ID3D10Device::Release) _ID3D10DeviceRelease; 60 | decltype(&IDXGISwapChain::Present) _IDXGISwapChainPresent; 61 | decltype(&IDXGISwapChain::ResizeBuffers) _IDXGISwapChainResizeBuffers; 62 | decltype(&IDXGISwapChain::ResizeTarget) _IDXGISwapChainResizeTarget; 63 | decltype(&IDXGISwapChain1::Present1) _IDXGISwapChain1Present1; 64 | 65 | static ULONG STDMETHODCALLTYPE _MyID3D10DeviceRelease(ID3D10Device* _this); 66 | static HRESULT STDMETHODCALLTYPE _MyIDXGISwapChainPresent(IDXGISwapChain* _this, UINT SyncInterval, UINT Flags); 67 | static HRESULT STDMETHODCALLTYPE _MyIDXGISwapChainResizeBuffers(IDXGISwapChain* _this, UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags); 68 | static HRESULT STDMETHODCALLTYPE _MyIDXGISwapChainResizeTarget(IDXGISwapChain* _this, const DXGI_MODE_DESC* pNewTargetParameters); 69 | static HRESULT STDMETHODCALLTYPE _MyIDXGISwapChain1Present1(IDXGISwapChain1* _this, UINT SyncInterval, UINT Flags, const DXGI_PRESENT_PARAMETERS* pPresentParameters); 70 | 71 | public: 72 | std::string LibraryName; 73 | 74 | virtual ~DX10Hook_t(); 75 | 76 | virtual bool StartHook(std::function keyCombinationCallback, ToggleKey toggleKeys[], int toggleKeysCount, /*ImFontAtlas* */ void* imguiFontAtlas = nullptr); 77 | virtual void HideAppInputs(bool hide); 78 | virtual void HideOverlayInputs(bool hide); 79 | virtual bool IsStarted(); 80 | static DX10Hook_t* Inst(); 81 | virtual const char* GetLibraryName() const; 82 | virtual RendererHookType_t GetRendererHookType() const; 83 | 84 | void SetDXVK(); 85 | void LoadFunctions( 86 | decltype(_ID3D10DeviceRelease) releaseFcn, 87 | decltype(_IDXGISwapChainPresent) presentFcn, 88 | decltype(_IDXGISwapChainResizeBuffers) resizeBuffersFcn, 89 | decltype(_IDXGISwapChainResizeTarget) resizeTargetFcn, 90 | decltype(_IDXGISwapChain1Present1) present1Fcn); 91 | 92 | virtual std::weak_ptr CreateImageResource(const void* image_data, uint32_t width, uint32_t height); 93 | virtual void ReleaseImageResource(std::weak_ptr resource); 94 | }; 95 | 96 | }// namespace InGameOverlay -------------------------------------------------------------------------------- /src/Windows/OpenGLHook.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Nemirtingas 3 | * This file is part of the ingame overlay project 4 | * 5 | * The ingame overlay project is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * The ingame overlay project is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with the ingame overlay project; if not, see 17 | * . 18 | */ 19 | 20 | #pragma once 21 | 22 | #include "../RendererHookInternal.h" 23 | 24 | #include "../InternalIncludes.h" 25 | 26 | namespace InGameOverlay { 27 | 28 | class OpenGLHook_t : 29 | public InGameOverlay::RendererHookInternal_t, 30 | public BaseHook_t 31 | { 32 | public: 33 | using WGLSwapBuffers_t = BOOL(WINAPI*)(HDC); 34 | 35 | private: 36 | static OpenGLHook_t* _Instance; 37 | 38 | // Variables 39 | bool _Hooked; 40 | bool _WindowsHooked; 41 | bool _Initialized; 42 | OverlayHookState _HookState; 43 | HWND _LastWindow; 44 | std::set> _ImageResources; 45 | void* _ImGuiFontAtlas; 46 | 47 | // Functions 48 | OpenGLHook_t(); 49 | 50 | void _ResetRenderState(OverlayHookState state); 51 | void _PrepareForOverlay(HDC hDC); 52 | void _HandleScreenshot(); 53 | 54 | // Hook to render functions 55 | WGLSwapBuffers_t _WGLSwapBuffers; 56 | 57 | static BOOL WINAPI _MyWGLSwapBuffers(HDC hDC); 58 | 59 | public: 60 | std::string LibraryName; 61 | 62 | virtual ~OpenGLHook_t(); 63 | 64 | virtual bool StartHook(std::function keyCombinationCallback, ToggleKey toggleKeys[], int toggleKeysCount, /*ImFontAtlas* */ void* imguiFontAtlas = nullptr); 65 | virtual void HideAppInputs(bool hide); 66 | virtual void HideOverlayInputs(bool hide); 67 | virtual bool IsStarted(); 68 | static OpenGLHook_t* Inst(); 69 | virtual const char* GetLibraryName() const; 70 | virtual RendererHookType_t GetRendererHookType() const; 71 | void LoadFunctions(WGLSwapBuffers_t pfnwglSwapBuffers); 72 | 73 | virtual std::weak_ptr CreateImageResource(const void* image_data, uint32_t width, uint32_t height); 74 | virtual void ReleaseImageResource(std::weak_ptr resource); 75 | }; 76 | 77 | }// namespace InGameOverlay -------------------------------------------------------------------------------- /src/Windows/WindowsGamingInputVTables.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Nemirtingas 3 | * This file is part of the ingame overlay project 4 | * 5 | * The ingame overlay project is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 3 of the License, or (at your option) any later version. 9 | * 10 | * The ingame overlay project is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with the ingame overlay project; if not, see 17 | * . 18 | */ 19 | 20 | #pragma once 21 | 22 | enum class IRawGameControllerVTable 23 | { 24 | // IUnknown 25 | QueryInterface, 26 | AddRef, 27 | Release, 28 | 29 | // IInspectable 30 | GetIids, 31 | GetRuntimeClassName, 32 | GetTrustLevel, 33 | 34 | // IRawGameController 35 | get_AxisCount, 36 | get_ButtonCount, 37 | get_ForceFeedbackMotors, 38 | get_HardwareProductId, 39 | get_SwitchCount, 40 | GetButtonLabel, 41 | GetCurrentReading, 42 | GetSwitchKind, 43 | }; 44 | 45 | enum class IGamepadVTable 46 | { 47 | // IUnknown 48 | QueryInterface, 49 | AddRef, 50 | Release, 51 | 52 | // IInspectable 53 | GetIids, 54 | GetRuntimeClassName, 55 | GetTrustLevel, 56 | 57 | // IGamepad 58 | get_Vibration, 59 | put_Vibration, 60 | GetCurrentReading, 61 | }; -------------------------------------------------------------------------------- /tests/common/glfw/CMake/GenerateMappings.cmake: -------------------------------------------------------------------------------- 1 | # Usage: 2 | # cmake -P GenerateMappings.cmake 3 | 4 | set(source_url "https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt") 5 | set(source_path "${CMAKE_CURRENT_BINARY_DIR}/gamecontrollerdb.txt") 6 | set(template_path "${CMAKE_ARGV3}") 7 | set(target_path "${CMAKE_ARGV4}") 8 | 9 | if (NOT EXISTS "${template_path}") 10 | message(FATAL_ERROR "Failed to find template file ${template_path}") 11 | endif() 12 | 13 | file(DOWNLOAD "${source_url}" "${source_path}" 14 | STATUS download_status 15 | TLS_VERIFY on) 16 | 17 | list(GET download_status 0 status_code) 18 | list(GET download_status 1 status_message) 19 | 20 | if (status_code) 21 | message(FATAL_ERROR "Failed to download ${source_url}: ${status_message}") 22 | endif() 23 | 24 | file(STRINGS "${source_path}" lines) 25 | foreach(line ${lines}) 26 | if (line MATCHES "^[0-9a-fA-F]") 27 | if (line MATCHES "platform:Windows") 28 | if (GLFW_WIN32_MAPPINGS) 29 | string(APPEND GLFW_WIN32_MAPPINGS "\n") 30 | endif() 31 | string(APPEND GLFW_WIN32_MAPPINGS "\"${line}\",") 32 | elseif (line MATCHES "platform:Mac OS X") 33 | if (GLFW_COCOA_MAPPINGS) 34 | string(APPEND GLFW_COCOA_MAPPINGS "\n") 35 | endif() 36 | string(APPEND GLFW_COCOA_MAPPINGS "\"${line}\",") 37 | elseif (line MATCHES "platform:Linux") 38 | if (GLFW_LINUX_MAPPINGS) 39 | string(APPEND GLFW_LINUX_MAPPINGS "\n") 40 | endif() 41 | string(APPEND GLFW_LINUX_MAPPINGS "\"${line}\",") 42 | endif() 43 | endif() 44 | endforeach() 45 | 46 | configure_file("${template_path}" "${target_path}" @ONLY NEWLINE_STYLE UNIX) 47 | file(REMOVE "${source_path}") 48 | 49 | -------------------------------------------------------------------------------- /tests/common/glfw/CMake/Info.plist.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${MACOSX_BUNDLE_EXECUTABLE_NAME} 9 | CFBundleGetInfoString 10 | ${MACOSX_BUNDLE_INFO_STRING} 11 | CFBundleIconFile 12 | ${MACOSX_BUNDLE_ICON_FILE} 13 | CFBundleIdentifier 14 | ${MACOSX_BUNDLE_GUI_IDENTIFIER} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleLongVersionString 18 | ${MACOSX_BUNDLE_LONG_VERSION_STRING} 19 | CFBundleName 20 | ${MACOSX_BUNDLE_BUNDLE_NAME} 21 | CFBundlePackageType 22 | APPL 23 | CFBundleShortVersionString 24 | ${MACOSX_BUNDLE_SHORT_VERSION_STRING} 25 | CFBundleSignature 26 | ???? 27 | CFBundleVersion 28 | ${MACOSX_BUNDLE_BUNDLE_VERSION} 29 | CSResourcesFileMapped 30 | 31 | LSRequiresCarbon 32 | 33 | NSHumanReadableCopyright 34 | ${MACOSX_BUNDLE_COPYRIGHT} 35 | NSHighResolutionCapable 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /tests/common/glfw/CMake/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | 2 | if (NOT EXISTS "@GLFW_BINARY_DIR@/install_manifest.txt") 3 | message(FATAL_ERROR "Cannot find install manifest: \"@GLFW_BINARY_DIR@/install_manifest.txt\"") 4 | endif() 5 | 6 | file(READ "@GLFW_BINARY_DIR@/install_manifest.txt" files) 7 | string(REGEX REPLACE "\n" ";" files "${files}") 8 | 9 | foreach (file ${files}) 10 | message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") 11 | if (EXISTS "$ENV{DESTDIR}${file}") 12 | exec_program("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 13 | OUTPUT_VARIABLE rm_out 14 | RETURN_VALUE rm_retval) 15 | if (NOT "${rm_retval}" STREQUAL 0) 16 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 17 | endif() 18 | elseif (IS_SYMLINK "$ENV{DESTDIR}${file}") 19 | EXEC_PROGRAM("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 20 | OUTPUT_VARIABLE rm_out 21 | RETURN_VALUE rm_retval) 22 | if (NOT "${rm_retval}" STREQUAL 0) 23 | message(FATAL_ERROR "Problem when removing symlink \"$ENV{DESTDIR}${file}\"") 24 | endif() 25 | else() 26 | message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") 27 | endif() 28 | endforeach() 29 | 30 | -------------------------------------------------------------------------------- /tests/common/glfw/CMake/glfw3.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=${prefix} 3 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ 4 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@ 5 | 6 | Name: GLFW 7 | Description: A multi-platform library for OpenGL, window and input 8 | Version: @GLFW_VERSION@ 9 | URL: https://www.glfw.org/ 10 | Requires.private: @GLFW_PKG_CONFIG_REQUIRES_PRIVATE@ 11 | Libs: -L${libdir} -l@GLFW_LIB_NAME@@GLFW_LIB_NAME_SUFFIX@ 12 | Libs.private: @GLFW_PKG_CONFIG_LIBS_PRIVATE@ 13 | Cflags: -I${includedir} 14 | -------------------------------------------------------------------------------- /tests/common/glfw/CMake/glfw3Config.cmake.in: -------------------------------------------------------------------------------- 1 | include(CMakeFindDependencyMacro) 2 | find_dependency(Threads) 3 | include("${CMAKE_CURRENT_LIST_DIR}/glfw3Targets.cmake") 4 | -------------------------------------------------------------------------------- /tests/common/glfw/CMake/i686-w64-mingw32-clang.cmake: -------------------------------------------------------------------------------- 1 | # Define the environment for cross-compiling with 32-bit MinGW-w64 Clang 2 | SET(CMAKE_SYSTEM_NAME Windows) # Target system name 3 | SET(CMAKE_SYSTEM_VERSION 1) 4 | SET(CMAKE_C_COMPILER "i686-w64-mingw32-clang") 5 | SET(CMAKE_CXX_COMPILER "i686-w64-mingw32-clang++") 6 | SET(CMAKE_RC_COMPILER "i686-w64-mingw32-windres") 7 | SET(CMAKE_RANLIB "i686-w64-mingw32-ranlib") 8 | 9 | # Configure the behaviour of the find commands 10 | SET(CMAKE_FIND_ROOT_PATH "/usr/i686-w64-mingw32") 11 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | -------------------------------------------------------------------------------- /tests/common/glfw/CMake/i686-w64-mingw32.cmake: -------------------------------------------------------------------------------- 1 | # Define the environment for cross-compiling with 32-bit MinGW-w64 GCC 2 | SET(CMAKE_SYSTEM_NAME Windows) # Target system name 3 | SET(CMAKE_SYSTEM_VERSION 1) 4 | SET(CMAKE_C_COMPILER "i686-w64-mingw32-gcc") 5 | SET(CMAKE_CXX_COMPILER "i686-w64-mingw32-g++") 6 | SET(CMAKE_RC_COMPILER "i686-w64-mingw32-windres") 7 | SET(CMAKE_RANLIB "i686-w64-mingw32-ranlib") 8 | 9 | # Configure the behaviour of the find commands 10 | SET(CMAKE_FIND_ROOT_PATH "/usr/i686-w64-mingw32") 11 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | -------------------------------------------------------------------------------- /tests/common/glfw/CMake/modules/FindEpollShim.cmake: -------------------------------------------------------------------------------- 1 | # Find EpollShim 2 | # Once done, this will define 3 | # 4 | # EPOLLSHIM_FOUND - System has EpollShim 5 | # EPOLLSHIM_INCLUDE_DIRS - The EpollShim include directories 6 | # EPOLLSHIM_LIBRARIES - The libraries needed to use EpollShim 7 | 8 | find_path(EPOLLSHIM_INCLUDE_DIRS NAMES sys/epoll.h sys/timerfd.h HINTS /usr/local/include/libepoll-shim) 9 | find_library(EPOLLSHIM_LIBRARIES NAMES epoll-shim libepoll-shim HINTS /usr/local/lib) 10 | 11 | if (EPOLLSHIM_INCLUDE_DIRS AND EPOLLSHIM_LIBRARIES) 12 | set(EPOLLSHIM_FOUND TRUE) 13 | endif (EPOLLSHIM_INCLUDE_DIRS AND EPOLLSHIM_LIBRARIES) 14 | 15 | include(FindPackageHandleStandardArgs) 16 | find_package_handle_standard_args(EpollShim DEFAULT_MSG EPOLLSHIM_LIBRARIES EPOLLSHIM_INCLUDE_DIRS) 17 | mark_as_advanced(EPOLLSHIM_INCLUDE_DIRS EPOLLSHIM_LIBRARIES) 18 | -------------------------------------------------------------------------------- /tests/common/glfw/CMake/modules/FindOSMesa.cmake: -------------------------------------------------------------------------------- 1 | # Try to find OSMesa on a Unix system 2 | # 3 | # This will define: 4 | # 5 | # OSMESA_LIBRARIES - Link these to use OSMesa 6 | # OSMESA_INCLUDE_DIR - Include directory for OSMesa 7 | # 8 | # Copyright (c) 2014 Brandon Schaefer 9 | 10 | if (NOT WIN32) 11 | 12 | find_package (PkgConfig) 13 | pkg_check_modules (PKG_OSMESA QUIET osmesa) 14 | 15 | set (OSMESA_INCLUDE_DIR ${PKG_OSMESA_INCLUDE_DIRS}) 16 | set (OSMESA_LIBRARIES ${PKG_OSMESA_LIBRARIES}) 17 | 18 | endif () 19 | -------------------------------------------------------------------------------- /tests/common/glfw/CMake/x86_64-w64-mingw32-clang.cmake: -------------------------------------------------------------------------------- 1 | # Define the environment for cross-compiling with 64-bit MinGW-w64 Clang 2 | SET(CMAKE_SYSTEM_NAME Windows) # Target system name 3 | SET(CMAKE_SYSTEM_VERSION 1) 4 | SET(CMAKE_C_COMPILER "x86_64-w64-mingw32-clang") 5 | SET(CMAKE_CXX_COMPILER "x86_64-w64-mingw32-clang++") 6 | SET(CMAKE_RC_COMPILER "x86_64-w64-mingw32-windres") 7 | SET(CMAKE_RANLIB "x86_64-w64-mingw32-ranlib") 8 | 9 | # Configure the behaviour of the find commands 10 | SET(CMAKE_FIND_ROOT_PATH "/usr/x86_64-w64-mingw32") 11 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | -------------------------------------------------------------------------------- /tests/common/glfw/CMake/x86_64-w64-mingw32.cmake: -------------------------------------------------------------------------------- 1 | # Define the environment for cross-compiling with 64-bit MinGW-w64 GCC 2 | SET(CMAKE_SYSTEM_NAME Windows) # Target system name 3 | SET(CMAKE_SYSTEM_VERSION 1) 4 | SET(CMAKE_C_COMPILER "x86_64-w64-mingw32-gcc") 5 | SET(CMAKE_CXX_COMPILER "x86_64-w64-mingw32-g++") 6 | SET(CMAKE_RC_COMPILER "x86_64-w64-mingw32-windres") 7 | SET(CMAKE_RANLIB "x86_64-w64-mingw32-ranlib") 8 | 9 | # Configure the behaviour of the find commands 10 | SET(CMAKE_FIND_ROOT_PATH "/usr/x86_64-w64-mingw32") 11 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | -------------------------------------------------------------------------------- /tests/common/glfw/deps/getopt.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012, Kim Gräsman 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * * Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * * Neither the name of Kim Gräsman nor the names of contributors may be used 12 | * to endorse or promote products derived from this software without specific 13 | * prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL KIM GRÄSMAN BE LIABLE FOR ANY DIRECT, 19 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef INCLUDED_GETOPT_PORT_H 28 | #define INCLUDED_GETOPT_PORT_H 29 | 30 | #if defined(__cplusplus) 31 | extern "C" { 32 | #endif 33 | 34 | extern const int no_argument; 35 | extern const int required_argument; 36 | extern const int optional_argument; 37 | 38 | extern char* optarg; 39 | extern int optind, opterr, optopt; 40 | 41 | struct option { 42 | const char* name; 43 | int has_arg; 44 | int* flag; 45 | int val; 46 | }; 47 | 48 | int getopt(int argc, char* const argv[], const char* optstring); 49 | 50 | int getopt_long(int argc, char* const argv[], 51 | const char* optstring, const struct option* longopts, int* longindex); 52 | 53 | #if defined(__cplusplus) 54 | } 55 | #endif 56 | 57 | #endif // INCLUDED_GETOPT_PORT_H 58 | -------------------------------------------------------------------------------- /tests/common/glfw/deps/mingw/_mingw_dxhelper.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the mingw-w64 runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | 7 | #if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS) 8 | #define NONAMELESSUNION 1 9 | #endif 10 | #if defined(NONAMELESSSTRUCT) && \ 11 | !defined(NONAMELESSUNION) 12 | #define NONAMELESSUNION 1 13 | #endif 14 | #if defined(NONAMELESSUNION) && \ 15 | !defined(NONAMELESSSTRUCT) 16 | #define NONAMELESSSTRUCT 1 17 | #endif 18 | #if !defined(__GNU_EXTENSION) 19 | #if defined(__GNUC__) || defined(__GNUG__) 20 | #define __GNU_EXTENSION __extension__ 21 | #else 22 | #define __GNU_EXTENSION 23 | #endif 24 | #endif /* __extension__ */ 25 | 26 | #ifndef __ANONYMOUS_DEFINED 27 | #define __ANONYMOUS_DEFINED 28 | #if defined(__GNUC__) || defined(__GNUG__) 29 | #define _ANONYMOUS_UNION __extension__ 30 | #define _ANONYMOUS_STRUCT __extension__ 31 | #else 32 | #define _ANONYMOUS_UNION 33 | #define _ANONYMOUS_STRUCT 34 | #endif 35 | #ifndef NONAMELESSUNION 36 | #define _UNION_NAME(x) 37 | #define _STRUCT_NAME(x) 38 | #else /* NONAMELESSUNION */ 39 | #define _UNION_NAME(x) x 40 | #define _STRUCT_NAME(x) x 41 | #endif 42 | #endif /* __ANONYMOUS_DEFINED */ 43 | 44 | #ifndef DUMMYUNIONNAME 45 | # ifdef NONAMELESSUNION 46 | # define DUMMYUNIONNAME u 47 | # define DUMMYUNIONNAME1 u1 /* Wine uses this variant */ 48 | # define DUMMYUNIONNAME2 u2 49 | # define DUMMYUNIONNAME3 u3 50 | # define DUMMYUNIONNAME4 u4 51 | # define DUMMYUNIONNAME5 u5 52 | # define DUMMYUNIONNAME6 u6 53 | # define DUMMYUNIONNAME7 u7 54 | # define DUMMYUNIONNAME8 u8 55 | # define DUMMYUNIONNAME9 u9 56 | # else /* NONAMELESSUNION */ 57 | # define DUMMYUNIONNAME 58 | # define DUMMYUNIONNAME1 /* Wine uses this variant */ 59 | # define DUMMYUNIONNAME2 60 | # define DUMMYUNIONNAME3 61 | # define DUMMYUNIONNAME4 62 | # define DUMMYUNIONNAME5 63 | # define DUMMYUNIONNAME6 64 | # define DUMMYUNIONNAME7 65 | # define DUMMYUNIONNAME8 66 | # define DUMMYUNIONNAME9 67 | # endif 68 | #endif /* DUMMYUNIONNAME */ 69 | 70 | #if !defined(DUMMYUNIONNAME1) /* MinGW does not define this one */ 71 | # ifdef NONAMELESSUNION 72 | # define DUMMYUNIONNAME1 u1 /* Wine uses this variant */ 73 | # else 74 | # define DUMMYUNIONNAME1 /* Wine uses this variant */ 75 | # endif 76 | #endif /* DUMMYUNIONNAME1 */ 77 | 78 | #ifndef DUMMYSTRUCTNAME 79 | # ifdef NONAMELESSUNION 80 | # define DUMMYSTRUCTNAME s 81 | # define DUMMYSTRUCTNAME1 s1 /* Wine uses this variant */ 82 | # define DUMMYSTRUCTNAME2 s2 83 | # define DUMMYSTRUCTNAME3 s3 84 | # define DUMMYSTRUCTNAME4 s4 85 | # define DUMMYSTRUCTNAME5 s5 86 | # else 87 | # define DUMMYSTRUCTNAME 88 | # define DUMMYSTRUCTNAME1 /* Wine uses this variant */ 89 | # define DUMMYSTRUCTNAME2 90 | # define DUMMYSTRUCTNAME3 91 | # define DUMMYSTRUCTNAME4 92 | # define DUMMYSTRUCTNAME5 93 | # endif 94 | #endif /* DUMMYSTRUCTNAME */ 95 | 96 | /* These are for compatibility with the Wine source tree */ 97 | 98 | #ifndef WINELIB_NAME_AW 99 | # ifdef __MINGW_NAME_AW 100 | # define WINELIB_NAME_AW __MINGW_NAME_AW 101 | # else 102 | # ifdef UNICODE 103 | # define WINELIB_NAME_AW(func) func##W 104 | # else 105 | # define WINELIB_NAME_AW(func) func##A 106 | # endif 107 | # endif 108 | #endif /* WINELIB_NAME_AW */ 109 | 110 | #ifndef DECL_WINELIB_TYPE_AW 111 | # ifdef __MINGW_TYPEDEF_AW 112 | # define DECL_WINELIB_TYPE_AW __MINGW_TYPEDEF_AW 113 | # else 114 | # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type; 115 | # endif 116 | #endif /* DECL_WINELIB_TYPE_AW */ 117 | 118 | -------------------------------------------------------------------------------- /tests/common/glfw/src/cocoa_joystick.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 Cocoa - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2006-2017 Camilla Löwy 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #define GLFW_COCOA_JOYSTICK_STATE _GLFWjoystickNS ns; 32 | #define GLFW_COCOA_LIBRARY_JOYSTICK_STATE 33 | 34 | // Cocoa-specific per-joystick data 35 | // 36 | typedef struct _GLFWjoystickNS 37 | { 38 | IOHIDDeviceRef device; 39 | CFMutableArrayRef axes; 40 | CFMutableArrayRef buttons; 41 | CFMutableArrayRef hats; 42 | } _GLFWjoystickNS; 43 | 44 | GLFWbool _glfwInitJoysticksCocoa(void); 45 | void _glfwTerminateJoysticksCocoa(void); 46 | GLFWbool _glfwPollJoystickCocoa(_GLFWjoystick* js, int mode); 47 | const char* _glfwGetMappingNameCocoa(void); 48 | void _glfwUpdateGamepadGUIDCocoa(char* guid); 49 | 50 | -------------------------------------------------------------------------------- /tests/common/glfw/src/cocoa_time.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 macOS - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2009-2016 Camilla Löwy 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #include "internal.h" 28 | 29 | #if defined(GLFW_BUILD_COCOA_TIMER) 30 | 31 | #include 32 | 33 | 34 | ////////////////////////////////////////////////////////////////////////// 35 | ////// GLFW platform API ////// 36 | ////////////////////////////////////////////////////////////////////////// 37 | 38 | void _glfwPlatformInitTimer(void) 39 | { 40 | mach_timebase_info_data_t info; 41 | mach_timebase_info(&info); 42 | 43 | _glfw.timer.ns.frequency = (info.denom * 1e9) / info.numer; 44 | } 45 | 46 | uint64_t _glfwPlatformGetTimerValue(void) 47 | { 48 | return mach_absolute_time(); 49 | } 50 | 51 | uint64_t _glfwPlatformGetTimerFrequency(void) 52 | { 53 | return _glfw.timer.ns.frequency; 54 | } 55 | 56 | #endif // GLFW_BUILD_COCOA_TIMER 57 | 58 | -------------------------------------------------------------------------------- /tests/common/glfw/src/cocoa_time.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 macOS - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2009-2021 Camilla Löwy 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #define GLFW_COCOA_LIBRARY_TIMER_STATE _GLFWtimerNS ns; 28 | 29 | // Cocoa-specific global timer data 30 | // 31 | typedef struct _GLFWtimerNS 32 | { 33 | uint64_t frequency; 34 | } _GLFWtimerNS; 35 | 36 | -------------------------------------------------------------------------------- /tests/common/glfw/src/glfw.rc.in: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | VS_VERSION_INFO VERSIONINFO 5 | FILEVERSION @GLFW_VERSION_MAJOR@,@GLFW_VERSION_MINOR@,@GLFW_VERSION_PATCH@,0 6 | PRODUCTVERSION @GLFW_VERSION_MAJOR@,@GLFW_VERSION_MINOR@,@GLFW_VERSION_PATCH@,0 7 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 8 | FILEFLAGS 0 9 | FILEOS VOS_NT_WINDOWS32 10 | FILETYPE VFT_DLL 11 | FILESUBTYPE 0 12 | { 13 | BLOCK "StringFileInfo" 14 | { 15 | BLOCK "040904B0" 16 | { 17 | VALUE "CompanyName", "GLFW" 18 | VALUE "FileDescription", "GLFW @GLFW_VERSION@ DLL" 19 | VALUE "FileVersion", "@GLFW_VERSION@" 20 | VALUE "OriginalFilename", "glfw3.dll" 21 | VALUE "ProductName", "GLFW" 22 | VALUE "ProductVersion", "@GLFW_VERSION@" 23 | } 24 | } 25 | BLOCK "VarFileInfo" 26 | { 27 | VALUE "Translation", 0x409, 1200 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /tests/common/glfw/src/linux_joystick.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 Linux - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2014 Jonas Ådahl 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #define GLFW_LINUX_JOYSTICK_STATE _GLFWjoystickLinux linjs; 32 | #define GLFW_LINUX_LIBRARY_JOYSTICK_STATE _GLFWlibraryLinux linjs; 33 | 34 | // Linux-specific joystick data 35 | // 36 | typedef struct _GLFWjoystickLinux 37 | { 38 | int fd; 39 | char path[PATH_MAX]; 40 | int keyMap[KEY_CNT - BTN_MISC]; 41 | int absMap[ABS_CNT]; 42 | struct input_absinfo absInfo[ABS_CNT]; 43 | int hats[4][2]; 44 | } _GLFWjoystickLinux; 45 | 46 | // Linux-specific joystick API data 47 | // 48 | typedef struct _GLFWlibraryLinux 49 | { 50 | int inotify; 51 | int watch; 52 | regex_t regex; 53 | GLFWbool regexCompiled; 54 | GLFWbool dropped; 55 | } _GLFWlibraryLinux; 56 | 57 | void _glfwDetectJoystickConnectionLinux(void); 58 | 59 | GLFWbool _glfwInitJoysticksLinux(void); 60 | void _glfwTerminateJoysticksLinux(void); 61 | GLFWbool _glfwPollJoystickLinux(_GLFWjoystick* js, int mode); 62 | const char* _glfwGetMappingNameLinux(void); 63 | void _glfwUpdateGamepadGUIDLinux(char* guid); 64 | 65 | -------------------------------------------------------------------------------- /tests/common/glfw/src/null_joystick.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2016-2017 Camilla Löwy 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #include "internal.h" 28 | 29 | 30 | ////////////////////////////////////////////////////////////////////////// 31 | ////// GLFW platform API ////// 32 | ////////////////////////////////////////////////////////////////////////// 33 | 34 | GLFWbool _glfwInitJoysticksNull(void) 35 | { 36 | return GLFW_TRUE; 37 | } 38 | 39 | void _glfwTerminateJoysticksNull(void) 40 | { 41 | } 42 | 43 | GLFWbool _glfwPollJoystickNull(_GLFWjoystick* js, int mode) 44 | { 45 | return GLFW_FALSE; 46 | } 47 | 48 | const char* _glfwGetMappingNameNull(void) 49 | { 50 | return ""; 51 | } 52 | 53 | void _glfwUpdateGamepadGUIDNull(char* guid) 54 | { 55 | } 56 | 57 | -------------------------------------------------------------------------------- /tests/common/glfw/src/null_joystick.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2006-2017 Camilla Löwy 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | GLFWbool _glfwInitJoysticksNull(void); 28 | void _glfwTerminateJoysticksNull(void); 29 | GLFWbool _glfwPollJoystickNull(_GLFWjoystick* js, int mode); 30 | const char* _glfwGetMappingNameNull(void); 31 | void _glfwUpdateGamepadGUIDNull(char* guid); 32 | 33 | -------------------------------------------------------------------------------- /tests/common/glfw/src/posix_module.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 POSIX - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2021 Camilla Löwy 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #include "internal.h" 28 | 29 | #if defined(GLFW_BUILD_POSIX_MODULE) 30 | 31 | #include 32 | 33 | ////////////////////////////////////////////////////////////////////////// 34 | ////// GLFW platform API ////// 35 | ////////////////////////////////////////////////////////////////////////// 36 | 37 | void* _glfwPlatformLoadModule(const char* path) 38 | { 39 | return dlopen(path, RTLD_LAZY | RTLD_LOCAL); 40 | } 41 | 42 | void _glfwPlatformFreeModule(void* module) 43 | { 44 | dlclose(module); 45 | } 46 | 47 | GLFWproc _glfwPlatformGetModuleSymbol(void* module, const char* name) 48 | { 49 | return dlsym(module, name); 50 | } 51 | 52 | #endif // GLFW_BUILD_POSIX_MODULE 53 | 54 | -------------------------------------------------------------------------------- /tests/common/glfw/src/posix_poll.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 POSIX - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2022 Camilla Löwy 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #define _GNU_SOURCE 28 | 29 | #include "internal.h" 30 | 31 | #if defined(GLFW_BUILD_POSIX_POLL) 32 | 33 | #include 34 | #include 35 | #include 36 | 37 | GLFWbool _glfwPollPOSIX(struct pollfd* fds, nfds_t count, double* timeout) 38 | { 39 | for (;;) 40 | { 41 | if (timeout) 42 | { 43 | const uint64_t base = _glfwPlatformGetTimerValue(); 44 | 45 | #if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) 46 | const time_t seconds = (time_t) *timeout; 47 | const long nanoseconds = (long) ((*timeout - seconds) * 1e9); 48 | const struct timespec ts = { seconds, nanoseconds }; 49 | const int result = ppoll(fds, count, &ts, NULL); 50 | #elif defined(__NetBSD__) 51 | const time_t seconds = (time_t) *timeout; 52 | const long nanoseconds = (long) ((*timeout - seconds) * 1e9); 53 | const struct timespec ts = { seconds, nanoseconds }; 54 | const int result = pollts(fds, count, &ts, NULL); 55 | #else 56 | const int milliseconds = (int) (*timeout * 1e3); 57 | const int result = poll(fds, count, milliseconds); 58 | #endif 59 | const int error = errno; // clock_gettime may overwrite our error 60 | 61 | *timeout -= (_glfwPlatformGetTimerValue() - base) / 62 | (double) _glfwPlatformGetTimerFrequency(); 63 | 64 | if (result > 0) 65 | return GLFW_TRUE; 66 | else if (result == -1 && error != EINTR && error != EAGAIN) 67 | return GLFW_FALSE; 68 | else if (*timeout <= 0.0) 69 | return GLFW_FALSE; 70 | } 71 | else 72 | { 73 | const int result = poll(fds, count, -1); 74 | if (result > 0) 75 | return GLFW_TRUE; 76 | else if (result == -1 && errno != EINTR && errno != EAGAIN) 77 | return GLFW_FALSE; 78 | } 79 | } 80 | } 81 | 82 | #endif // GLFW_BUILD_POSIX_POLL 83 | 84 | -------------------------------------------------------------------------------- /tests/common/glfw/src/posix_poll.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 POSIX - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2022 Camilla Löwy 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #include 28 | 29 | GLFWbool _glfwPollPOSIX(struct pollfd* fds, nfds_t count, double* timeout); 30 | 31 | -------------------------------------------------------------------------------- /tests/common/glfw/src/posix_thread.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 POSIX - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2017 Camilla Löwy 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #include "internal.h" 29 | 30 | #if defined(GLFW_BUILD_POSIX_THREAD) 31 | 32 | #include 33 | #include 34 | 35 | 36 | ////////////////////////////////////////////////////////////////////////// 37 | ////// GLFW platform API ////// 38 | ////////////////////////////////////////////////////////////////////////// 39 | 40 | GLFWbool _glfwPlatformCreateTls(_GLFWtls* tls) 41 | { 42 | assert(tls->posix.allocated == GLFW_FALSE); 43 | 44 | if (pthread_key_create(&tls->posix.key, NULL) != 0) 45 | { 46 | _glfwInputError(GLFW_PLATFORM_ERROR, 47 | "POSIX: Failed to create context TLS"); 48 | return GLFW_FALSE; 49 | } 50 | 51 | tls->posix.allocated = GLFW_TRUE; 52 | return GLFW_TRUE; 53 | } 54 | 55 | void _glfwPlatformDestroyTls(_GLFWtls* tls) 56 | { 57 | if (tls->posix.allocated) 58 | pthread_key_delete(tls->posix.key); 59 | memset(tls, 0, sizeof(_GLFWtls)); 60 | } 61 | 62 | void* _glfwPlatformGetTls(_GLFWtls* tls) 63 | { 64 | assert(tls->posix.allocated == GLFW_TRUE); 65 | return pthread_getspecific(tls->posix.key); 66 | } 67 | 68 | void _glfwPlatformSetTls(_GLFWtls* tls, void* value) 69 | { 70 | assert(tls->posix.allocated == GLFW_TRUE); 71 | pthread_setspecific(tls->posix.key, value); 72 | } 73 | 74 | GLFWbool _glfwPlatformCreateMutex(_GLFWmutex* mutex) 75 | { 76 | assert(mutex->posix.allocated == GLFW_FALSE); 77 | 78 | if (pthread_mutex_init(&mutex->posix.handle, NULL) != 0) 79 | { 80 | _glfwInputError(GLFW_PLATFORM_ERROR, "POSIX: Failed to create mutex"); 81 | return GLFW_FALSE; 82 | } 83 | 84 | return mutex->posix.allocated = GLFW_TRUE; 85 | } 86 | 87 | void _glfwPlatformDestroyMutex(_GLFWmutex* mutex) 88 | { 89 | if (mutex->posix.allocated) 90 | pthread_mutex_destroy(&mutex->posix.handle); 91 | memset(mutex, 0, sizeof(_GLFWmutex)); 92 | } 93 | 94 | void _glfwPlatformLockMutex(_GLFWmutex* mutex) 95 | { 96 | assert(mutex->posix.allocated == GLFW_TRUE); 97 | pthread_mutex_lock(&mutex->posix.handle); 98 | } 99 | 100 | void _glfwPlatformUnlockMutex(_GLFWmutex* mutex) 101 | { 102 | assert(mutex->posix.allocated == GLFW_TRUE); 103 | pthread_mutex_unlock(&mutex->posix.handle); 104 | } 105 | 106 | #endif // GLFW_BUILD_POSIX_THREAD 107 | 108 | -------------------------------------------------------------------------------- /tests/common/glfw/src/posix_thread.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 POSIX - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2017 Camilla Löwy 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #include 29 | 30 | #define GLFW_POSIX_TLS_STATE _GLFWtlsPOSIX posix; 31 | #define GLFW_POSIX_MUTEX_STATE _GLFWmutexPOSIX posix; 32 | 33 | 34 | // POSIX-specific thread local storage data 35 | // 36 | typedef struct _GLFWtlsPOSIX 37 | { 38 | GLFWbool allocated; 39 | pthread_key_t key; 40 | } _GLFWtlsPOSIX; 41 | 42 | // POSIX-specific mutex data 43 | // 44 | typedef struct _GLFWmutexPOSIX 45 | { 46 | GLFWbool allocated; 47 | pthread_mutex_t handle; 48 | } _GLFWmutexPOSIX; 49 | 50 | -------------------------------------------------------------------------------- /tests/common/glfw/src/posix_time.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 POSIX - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2017 Camilla Löwy 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #include "internal.h" 29 | 30 | #if defined(GLFW_BUILD_POSIX_TIMER) 31 | 32 | #include 33 | #include 34 | 35 | 36 | ////////////////////////////////////////////////////////////////////////// 37 | ////// GLFW platform API ////// 38 | ////////////////////////////////////////////////////////////////////////// 39 | 40 | void _glfwPlatformInitTimer(void) 41 | { 42 | _glfw.timer.posix.clock = CLOCK_REALTIME; 43 | _glfw.timer.posix.frequency = 1000000000; 44 | 45 | #if defined(_POSIX_MONOTONIC_CLOCK) 46 | struct timespec ts; 47 | if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) 48 | _glfw.timer.posix.clock = CLOCK_MONOTONIC; 49 | #endif 50 | } 51 | 52 | uint64_t _glfwPlatformGetTimerValue(void) 53 | { 54 | struct timespec ts; 55 | clock_gettime(_glfw.timer.posix.clock, &ts); 56 | return (uint64_t) ts.tv_sec * _glfw.timer.posix.frequency + (uint64_t) ts.tv_nsec; 57 | } 58 | 59 | uint64_t _glfwPlatformGetTimerFrequency(void) 60 | { 61 | return _glfw.timer.posix.frequency; 62 | } 63 | 64 | #endif // GLFW_BUILD_POSIX_TIMER 65 | 66 | -------------------------------------------------------------------------------- /tests/common/glfw/src/posix_time.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 POSIX - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2017 Camilla Löwy 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #define GLFW_POSIX_LIBRARY_TIMER_STATE _GLFWtimerPOSIX posix; 29 | 30 | #include 31 | #include 32 | 33 | 34 | // POSIX-specific global timer data 35 | // 36 | typedef struct _GLFWtimerPOSIX 37 | { 38 | clockid_t clock; 39 | uint64_t frequency; 40 | } _GLFWtimerPOSIX; 41 | 42 | -------------------------------------------------------------------------------- /tests/common/glfw/src/win32_joystick.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 Win32 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2006-2017 Camilla Löwy 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #define GLFW_WIN32_JOYSTICK_STATE _GLFWjoystickWin32 win32; 28 | #define GLFW_WIN32_LIBRARY_JOYSTICK_STATE 29 | 30 | // Joystick element (axis, button or slider) 31 | // 32 | typedef struct _GLFWjoyobjectWin32 33 | { 34 | int offset; 35 | int type; 36 | } _GLFWjoyobjectWin32; 37 | 38 | // Win32-specific per-joystick data 39 | // 40 | typedef struct _GLFWjoystickWin32 41 | { 42 | _GLFWjoyobjectWin32* objects; 43 | int objectCount; 44 | IDirectInputDevice8W* device; 45 | DWORD index; 46 | GUID guid; 47 | } _GLFWjoystickWin32; 48 | 49 | void _glfwDetectJoystickConnectionWin32(void); 50 | void _glfwDetectJoystickDisconnectionWin32(void); 51 | 52 | -------------------------------------------------------------------------------- /tests/common/glfw/src/win32_module.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 Win32 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2021 Camilla Löwy 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #include "internal.h" 28 | 29 | #if defined(GLFW_BUILD_WIN32_MODULE) 30 | 31 | ////////////////////////////////////////////////////////////////////////// 32 | ////// GLFW platform API ////// 33 | ////////////////////////////////////////////////////////////////////////// 34 | 35 | void* _glfwPlatformLoadModule(const char* path) 36 | { 37 | return LoadLibraryA(path); 38 | } 39 | 40 | void _glfwPlatformFreeModule(void* module) 41 | { 42 | FreeLibrary((HMODULE) module); 43 | } 44 | 45 | GLFWproc _glfwPlatformGetModuleSymbol(void* module, const char* name) 46 | { 47 | return (GLFWproc) GetProcAddress((HMODULE) module, name); 48 | } 49 | 50 | #endif // GLFW_BUILD_WIN32_MODULE 51 | 52 | -------------------------------------------------------------------------------- /tests/common/glfw/src/win32_thread.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 Win32 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2017 Camilla Löwy 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #include "internal.h" 29 | 30 | #if defined(GLFW_BUILD_WIN32_THREAD) 31 | 32 | #include 33 | 34 | 35 | ////////////////////////////////////////////////////////////////////////// 36 | ////// GLFW platform API ////// 37 | ////////////////////////////////////////////////////////////////////////// 38 | 39 | GLFWbool _glfwPlatformCreateTls(_GLFWtls* tls) 40 | { 41 | assert(tls->win32.allocated == GLFW_FALSE); 42 | 43 | tls->win32.index = TlsAlloc(); 44 | if (tls->win32.index == TLS_OUT_OF_INDEXES) 45 | { 46 | _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to allocate TLS index"); 47 | return GLFW_FALSE; 48 | } 49 | 50 | tls->win32.allocated = GLFW_TRUE; 51 | return GLFW_TRUE; 52 | } 53 | 54 | void _glfwPlatformDestroyTls(_GLFWtls* tls) 55 | { 56 | if (tls->win32.allocated) 57 | TlsFree(tls->win32.index); 58 | memset(tls, 0, sizeof(_GLFWtls)); 59 | } 60 | 61 | void* _glfwPlatformGetTls(_GLFWtls* tls) 62 | { 63 | assert(tls->win32.allocated == GLFW_TRUE); 64 | return TlsGetValue(tls->win32.index); 65 | } 66 | 67 | void _glfwPlatformSetTls(_GLFWtls* tls, void* value) 68 | { 69 | assert(tls->win32.allocated == GLFW_TRUE); 70 | TlsSetValue(tls->win32.index, value); 71 | } 72 | 73 | GLFWbool _glfwPlatformCreateMutex(_GLFWmutex* mutex) 74 | { 75 | assert(mutex->win32.allocated == GLFW_FALSE); 76 | InitializeCriticalSection(&mutex->win32.section); 77 | return mutex->win32.allocated = GLFW_TRUE; 78 | } 79 | 80 | void _glfwPlatformDestroyMutex(_GLFWmutex* mutex) 81 | { 82 | if (mutex->win32.allocated) 83 | DeleteCriticalSection(&mutex->win32.section); 84 | memset(mutex, 0, sizeof(_GLFWmutex)); 85 | } 86 | 87 | void _glfwPlatformLockMutex(_GLFWmutex* mutex) 88 | { 89 | assert(mutex->win32.allocated == GLFW_TRUE); 90 | EnterCriticalSection(&mutex->win32.section); 91 | } 92 | 93 | void _glfwPlatformUnlockMutex(_GLFWmutex* mutex) 94 | { 95 | assert(mutex->win32.allocated == GLFW_TRUE); 96 | LeaveCriticalSection(&mutex->win32.section); 97 | } 98 | 99 | #endif // GLFW_BUILD_WIN32_THREAD 100 | 101 | -------------------------------------------------------------------------------- /tests/common/glfw/src/win32_thread.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 Win32 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2017 Camilla Löwy 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | // This is a workaround for the fact that glfw3.h needs to export APIENTRY (for 29 | // example to allow applications to correctly declare a GL_KHR_debug callback) 30 | // but windows.h assumes no one will define APIENTRY before it does 31 | #undef APIENTRY 32 | 33 | #include 34 | 35 | #define GLFW_WIN32_TLS_STATE _GLFWtlsWin32 win32; 36 | #define GLFW_WIN32_MUTEX_STATE _GLFWmutexWin32 win32; 37 | 38 | // Win32-specific thread local storage data 39 | // 40 | typedef struct _GLFWtlsWin32 41 | { 42 | GLFWbool allocated; 43 | DWORD index; 44 | } _GLFWtlsWin32; 45 | 46 | // Win32-specific mutex data 47 | // 48 | typedef struct _GLFWmutexWin32 49 | { 50 | GLFWbool allocated; 51 | CRITICAL_SECTION section; 52 | } _GLFWmutexWin32; 53 | 54 | -------------------------------------------------------------------------------- /tests/common/glfw/src/win32_time.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 Win32 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2017 Camilla Löwy 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #include "internal.h" 29 | 30 | #if defined(GLFW_BUILD_WIN32_TIMER) 31 | 32 | ////////////////////////////////////////////////////////////////////////// 33 | ////// GLFW platform API ////// 34 | ////////////////////////////////////////////////////////////////////////// 35 | 36 | void _glfwPlatformInitTimer(void) 37 | { 38 | QueryPerformanceFrequency((LARGE_INTEGER*) &_glfw.timer.win32.frequency); 39 | } 40 | 41 | uint64_t _glfwPlatformGetTimerValue(void) 42 | { 43 | uint64_t value; 44 | QueryPerformanceCounter((LARGE_INTEGER*) &value); 45 | return value; 46 | } 47 | 48 | uint64_t _glfwPlatformGetTimerFrequency(void) 49 | { 50 | return _glfw.timer.win32.frequency; 51 | } 52 | 53 | #endif // GLFW_BUILD_WIN32_TIMER 54 | 55 | -------------------------------------------------------------------------------- /tests/common/glfw/src/win32_time.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 Win32 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2017 Camilla Löwy 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | // This is a workaround for the fact that glfw3.h needs to export APIENTRY (for 29 | // example to allow applications to correctly declare a GL_KHR_debug callback) 30 | // but windows.h assumes no one will define APIENTRY before it does 31 | #undef APIENTRY 32 | 33 | #include 34 | 35 | #define GLFW_WIN32_LIBRARY_TIMER_STATE _GLFWtimerWin32 win32; 36 | 37 | // Win32-specific global timer data 38 | // 39 | typedef struct _GLFWtimerWin32 40 | { 41 | uint64_t frequency; 42 | } _GLFWtimerWin32; 43 | 44 | -------------------------------------------------------------------------------- /tests/common/glfw/src/xkb_unicode.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 Linux - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2014 Jonas Ådahl 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #define GLFW_INVALID_CODEPOINT 0xffffffffu 28 | 29 | uint32_t _glfwKeySym2Unicode(unsigned int keysym); 30 | 31 | -------------------------------------------------------------------------------- /tests/common/imgui_impl_dx12.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer Backend for DirectX12 2 | // This needs to be used along with a Platform Backend (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID! 6 | // [X] Renderer: Large meshes support (64k+ vertices) with 16-bit indices. 7 | 8 | // Important: to compile on 32-bit systems, this backend requires code to be compiled with '#define ImTextureID ImU64'. 9 | // See imgui_impl_dx12.cpp file for details. 10 | 11 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 12 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need. 13 | // Learn about Dear ImGui: 14 | // - FAQ https://dearimgui.com/faq 15 | // - Getting Started https://dearimgui.com/getting-started 16 | // - Documentation https://dearimgui.com/docs (same as your local docs/ folder). 17 | // - Introduction, links and more at the top of imgui.cpp 18 | 19 | #pragma once 20 | #include "imgui.h" // IMGUI_IMPL_API 21 | #ifndef IMGUI_DISABLE 22 | #include // DXGI_FORMAT 23 | 24 | struct ID3D12Device; 25 | struct ID3D12DescriptorHeap; 26 | struct ID3D12GraphicsCommandList; 27 | struct D3D12_CPU_DESCRIPTOR_HANDLE; 28 | struct D3D12_GPU_DESCRIPTOR_HANDLE; 29 | 30 | // cmd_list is the command list that the implementation will use to render imgui draw lists. 31 | // Before calling the render function, caller must prepare cmd_list by resetting it and setting the appropriate 32 | // render target and descriptor heap that contains font_srv_cpu_desc_handle/font_srv_gpu_desc_handle. 33 | // font_srv_cpu_desc_handle and font_srv_gpu_desc_handle are handles to a single SRV descriptor to use for the internal font texture. 34 | IMGUI_IMPL_API bool ImGui_ImplDX12_Init(ID3D12Device* device, int num_frames_in_flight, DXGI_FORMAT rtv_format, 35 | D3D12_CPU_DESCRIPTOR_HANDLE font_srv_cpu_desc_handle, D3D12_GPU_DESCRIPTOR_HANDLE font_srv_gpu_desc_handle); 36 | IMGUI_IMPL_API void ImGui_ImplDX12_Shutdown(); 37 | IMGUI_IMPL_API void ImGui_ImplDX12_NewFrame(); 38 | IMGUI_IMPL_API void ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3D12GraphicsCommandList* graphics_command_list); 39 | 40 | // Use if you want to reset your rendering device without losing Dear ImGui state. 41 | IMGUI_IMPL_API void ImGui_ImplDX12_InvalidateDeviceObjects(); 42 | IMGUI_IMPL_API bool ImGui_ImplDX12_CreateDeviceObjects(); 43 | 44 | #endif // #ifndef IMGUI_DISABLE -------------------------------------------------------------------------------- /tests/common/imgui_impl_osx.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Backend for OSX / Cocoa 2 | // This needs to be used along with a Renderer (e.g. OpenGL2, OpenGL3, Vulkan, Metal..) 3 | // - Not well tested. If you want a portable application, prefer using the GLFW or SDL platform Backends on Mac. 4 | // - Requires linking with the GameController framework ("-framework GameController"). 5 | 6 | // Implemented features: 7 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 8 | // [X] Platform: Mouse support. Can discriminate Mouse/Pen. 9 | // [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy kVK_* values will also be supported unless IMGUI_DISABLE_OBSOLETE_KEYIO is set] 10 | // [X] Platform: OSX clipboard is supported within core Dear ImGui (no specific code in this backend). 11 | // [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. 12 | // [X] Platform: IME support. 13 | 14 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 15 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need. 16 | // Learn about Dear ImGui: 17 | // - FAQ https://dearimgui.com/faq 18 | // - Getting Started https://dearimgui.com/getting-started 19 | // - Documentation https://dearimgui.com/docs (same as your local docs/ folder). 20 | // - Introduction, links and more at the top of imgui.cpp 21 | 22 | #include "imgui.h" // IMGUI_IMPL_API 23 | #ifndef IMGUI_DISABLE 24 | 25 | #ifdef __OBJC__ 26 | 27 | @class NSEvent; 28 | @class NSView; 29 | 30 | // Follow "Getting Started" link and check examples/ folder to learn about using backends! 31 | IMGUI_IMPL_API bool ImGui_ImplOSX_Init(NSView* _Nonnull view); 32 | IMGUI_IMPL_API void ImGui_ImplOSX_Shutdown(); 33 | IMGUI_IMPL_API void ImGui_ImplOSX_NewFrame(NSView* _Nullable view); 34 | 35 | #endif 36 | 37 | //----------------------------------------------------------------------------- 38 | // C++ API 39 | //----------------------------------------------------------------------------- 40 | 41 | #ifdef IMGUI_IMPL_METAL_CPP_EXTENSIONS 42 | // #include 43 | #ifndef __OBJC__ 44 | 45 | // Follow "Getting Started" link and check examples/ folder to learn about using backends! 46 | IMGUI_IMPL_API bool ImGui_ImplOSX_Init(void* _Nonnull view); 47 | IMGUI_IMPL_API void ImGui_ImplOSX_Shutdown(); 48 | IMGUI_IMPL_API void ImGui_ImplOSX_NewFrame(void* _Nullable view); 49 | 50 | #endif 51 | #endif 52 | 53 | #endif // #ifndef IMGUI_DISABLE -------------------------------------------------------------------------------- /tests/common/ingameoverlay_imconfig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | // ImTextureID [configurable type: override in imconfig.h with '#define ImTextureID xxx'] 5 | #define ImTextureID uint64_t -------------------------------------------------------------------------------- /tests/common/vulkansdk/include/glslang/Public/ResourceLimits.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2016 Google, Inc. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions 8 | // are met: 9 | // 10 | // Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // 13 | // Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following 15 | // disclaimer in the documentation and/or other materials provided 16 | // with the distribution. 17 | // 18 | // Neither the name of Google Inc. nor the names of its 19 | // contributors may be used to endorse or promote products derived 20 | // from this software without specific prior written permission. 21 | // 22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 25 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 26 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 28 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 30 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 32 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | #ifndef _STAND_ALONE_RESOURCE_LIMITS_INCLUDED_ 36 | #define _STAND_ALONE_RESOURCE_LIMITS_INCLUDED_ 37 | 38 | #include 39 | 40 | #include "../Include/ResourceLimits.h" 41 | 42 | // Return pointer to user-writable Resource to pass through API in 43 | // future-proof way. 44 | extern TBuiltInResource* GetResources(); 45 | 46 | // These are the default resources for TBuiltInResources, used for both 47 | // - parsing this string for the case where the user didn't supply one, 48 | // - dumping out a template for user construction of a config file. 49 | extern const TBuiltInResource* GetDefaultResources(); 50 | 51 | // Returns the DefaultTBuiltInResource as a human-readable string. 52 | std::string GetDefaultTBuiltInResourceString(); 53 | 54 | // Decodes the resource limits from |config| to |resources|. 55 | void DecodeResourceLimits(TBuiltInResource* resources, char* config); 56 | 57 | #endif // _STAND_ALONE_RESOURCE_LIMITS_INCLUDED_ 58 | -------------------------------------------------------------------------------- /tests/common/vulkansdk/include/glslang/Public/resource_limits_c.h: -------------------------------------------------------------------------------- 1 | /** 2 | BSD 2-Clause License 3 | 4 | Copyright (c) 2020, Travis Fort 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 13 | 2. Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 21 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 24 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **/ 28 | 29 | #ifndef _STAND_ALONE_RESOURCE_LIMITS_C_INCLUDED_ 30 | #define _STAND_ALONE_RESOURCE_LIMITS_C_INCLUDED_ 31 | 32 | #include "../Include/glslang_c_interface.h" 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | // Returns a struct that can be use to create custom resource values. 39 | glslang_resource_t* glslang_resource(void); 40 | 41 | // These are the default resources for TBuiltInResources, used for both 42 | // - parsing this string for the case where the user didn't supply one, 43 | // - dumping out a template for user construction of a config file. 44 | const glslang_resource_t* glslang_default_resource(void); 45 | 46 | // Returns the DefaultTBuiltInResource as a human-readable string. 47 | // NOTE: User is responsible for freeing this string. 48 | const char* glslang_default_resource_string(); 49 | 50 | // Decodes the resource limits from |config| to |resources|. 51 | void glslang_decode_resource_limits(glslang_resource_t* resources, char* config); 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif // _STAND_ALONE_RESOURCE_LIMITS_C_INCLUDED_ 58 | -------------------------------------------------------------------------------- /tests/common/vulkansdk/include/glslang/SPIRV/GlslangToSpv.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2014 LunarG, Inc. 3 | // Copyright (C) 2015-2018 Google, Inc. 4 | // 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions 9 | // are met: 10 | // 11 | // Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // 14 | // Redistributions in binary form must reproduce the above 15 | // copyright notice, this list of conditions and the following 16 | // disclaimer in the documentation and/or other materials provided 17 | // with the distribution. 18 | // 19 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its 20 | // contributors may be used to endorse or promote products derived 21 | // from this software without specific prior written permission. 22 | // 23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 27 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 28 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 33 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 | // POSSIBILITY OF SUCH DAMAGE. 35 | 36 | #pragma once 37 | 38 | #include 39 | #include 40 | 41 | #include "Logger.h" 42 | 43 | namespace glslang { 44 | class TIntermediate; 45 | 46 | struct SpvOptions { 47 | bool generateDebugInfo {false}; 48 | bool stripDebugInfo {false}; 49 | bool disableOptimizer {true}; 50 | bool optimizeSize {false}; 51 | bool disassemble {false}; 52 | bool validate {false}; 53 | bool emitNonSemanticShaderDebugInfo {false}; 54 | bool emitNonSemanticShaderDebugSource{ false }; 55 | bool compileOnly{false}; 56 | }; 57 | 58 | void GetSpirvVersion(std::string&); 59 | int GetSpirvGeneratorVersion(); 60 | void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector& spirv, 61 | SpvOptions* options = nullptr); 62 | void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector& spirv, 63 | spv::SpvBuildLogger* logger, SpvOptions* options = nullptr); 64 | bool OutputSpvBin(const std::vector& spirv, const char* baseName); 65 | bool OutputSpvHex(const std::vector& spirv, const char* baseName, const char* varName); 66 | 67 | } 68 | -------------------------------------------------------------------------------- /tests/common/vulkansdk/include/glslang/SPIRV/Logger.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2016 Google, Inc. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions 8 | // are met: 9 | // 10 | // Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // 13 | // Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following 15 | // disclaimer in the documentation and/or other materials provided 16 | // with the distribution. 17 | // 18 | // Neither the name of Google Inc. nor the names of its 19 | // contributors may be used to endorse or promote products derived 20 | // from this software without specific prior written permission. 21 | // 22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 25 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 26 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 28 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 30 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 32 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | #ifndef GLSLANG_SPIRV_LOGGER_H 36 | #define GLSLANG_SPIRV_LOGGER_H 37 | 38 | #include 39 | #include 40 | 41 | namespace spv { 42 | 43 | // A class for holding all SPIR-V build status messages, including 44 | // missing/TBD functionalities, warnings, and errors. 45 | class SpvBuildLogger { 46 | public: 47 | SpvBuildLogger() {} 48 | 49 | // Registers a TBD functionality. 50 | void tbdFunctionality(const std::string& f); 51 | // Registers a missing functionality. 52 | void missingFunctionality(const std::string& f); 53 | 54 | // Logs a warning. 55 | void warning(const std::string& w) { warnings.push_back(w); } 56 | // Logs an error. 57 | void error(const std::string& e) { errors.push_back(e); } 58 | 59 | // Returns all messages accumulated in the order of: 60 | // TBD functionalities, missing functionalities, warnings, errors. 61 | std::string getAllMessages() const; 62 | 63 | private: 64 | SpvBuildLogger(const SpvBuildLogger&); 65 | 66 | std::vector tbdFeatures; 67 | std::vector missingFeatures; 68 | std::vector warnings; 69 | std::vector errors; 70 | }; 71 | 72 | } // end spv namespace 73 | 74 | #endif // GLSLANG_SPIRV_LOGGER_H 75 | -------------------------------------------------------------------------------- /tests/common/vulkansdk/include/shaderc/env.h: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Shaderc Authors. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef SHADERC_ENV_H_ 16 | #define SHADERC_ENV_H_ 17 | 18 | #include 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | typedef enum { 25 | shaderc_target_env_vulkan, // SPIR-V under Vulkan semantics 26 | shaderc_target_env_opengl, // SPIR-V under OpenGL semantics 27 | // NOTE: SPIR-V code generation is not supported for shaders under OpenGL 28 | // compatibility profile. 29 | shaderc_target_env_opengl_compat, // SPIR-V under OpenGL semantics, 30 | // including compatibility profile 31 | // functions 32 | shaderc_target_env_webgpu, // Deprecated, SPIR-V under WebGPU 33 | // semantics 34 | shaderc_target_env_default = shaderc_target_env_vulkan 35 | } shaderc_target_env; 36 | 37 | typedef enum { 38 | // For Vulkan, use Vulkan's mapping of version numbers to integers. 39 | // See vulkan.h 40 | shaderc_env_version_vulkan_1_0 = ((1u << 22)), 41 | shaderc_env_version_vulkan_1_1 = ((1u << 22) | (1 << 12)), 42 | shaderc_env_version_vulkan_1_2 = ((1u << 22) | (2 << 12)), 43 | shaderc_env_version_vulkan_1_3 = ((1u << 22) | (3 << 12)), 44 | // For OpenGL, use the number from #version in shaders. 45 | // TODO(dneto): Currently no difference between OpenGL 4.5 and 4.6. 46 | // See glslang/Standalone/Standalone.cpp 47 | // TODO(dneto): Glslang doesn't accept a OpenGL client version of 460. 48 | shaderc_env_version_opengl_4_5 = 450, 49 | shaderc_env_version_webgpu, // Deprecated, WebGPU env never defined versions 50 | } shaderc_env_version; 51 | 52 | // The known versions of SPIR-V. 53 | typedef enum { 54 | // Use the values used for word 1 of a SPIR-V binary: 55 | // - bits 24 to 31: zero 56 | // - bits 16 to 23: major version number 57 | // - bits 8 to 15: minor version number 58 | // - bits 0 to 7: zero 59 | shaderc_spirv_version_1_0 = 0x010000u, 60 | shaderc_spirv_version_1_1 = 0x010100u, 61 | shaderc_spirv_version_1_2 = 0x010200u, 62 | shaderc_spirv_version_1_3 = 0x010300u, 63 | shaderc_spirv_version_1_4 = 0x010400u, 64 | shaderc_spirv_version_1_5 = 0x010500u, 65 | shaderc_spirv_version_1_6 = 0x010600u 66 | } shaderc_spirv_version; 67 | 68 | #ifdef __cplusplus 69 | } 70 | #endif // __cplusplus 71 | 72 | #endif // SHADERC_ENV_H_ 73 | -------------------------------------------------------------------------------- /tests/common/vulkansdk/include/shaderc/status.h: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Shaderc Authors. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef SHADERC_STATUS_H_ 16 | #define SHADERC_STATUS_H_ 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | // Indicate the status of a compilation. 23 | typedef enum { 24 | shaderc_compilation_status_success = 0, 25 | shaderc_compilation_status_invalid_stage = 1, // error stage deduction 26 | shaderc_compilation_status_compilation_error = 2, 27 | shaderc_compilation_status_internal_error = 3, // unexpected failure 28 | shaderc_compilation_status_null_result_object = 4, 29 | shaderc_compilation_status_invalid_assembly = 5, 30 | shaderc_compilation_status_validation_error = 6, 31 | shaderc_compilation_status_transformation_error = 7, 32 | shaderc_compilation_status_configuration_error = 8, 33 | } shaderc_compilation_status; 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif // __cplusplus 38 | 39 | #endif // SHADERC_STATUS_H_ 40 | -------------------------------------------------------------------------------- /tests/common/vulkansdk/include/shaderc/visibility.h: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Shaderc Authors. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef SHADERC_VISIBILITY_H_ 16 | #define SHADERC_VISIBILITY_H_ 17 | 18 | // SHADERC_EXPORT tags symbol that will be exposed by the shared libraries. 19 | #if defined(SHADERC_SHAREDLIB) 20 | #if defined(_WIN32) 21 | #if defined(SHADERC_IMPLEMENTATION) 22 | #define SHADERC_EXPORT __declspec(dllexport) 23 | #else 24 | #define SHADERC_EXPORT __declspec(dllimport) 25 | #endif 26 | #else 27 | #if defined(SHADERC_IMPLEMENTATION) 28 | #define SHADERC_EXPORT __attribute__((visibility("default"))) 29 | #else 30 | #define SHADERC_EXPORT 31 | #endif 32 | #endif 33 | #else 34 | #define SHADERC_EXPORT 35 | #endif 36 | 37 | #endif // SHADERC_VISIBILITY_H_ 38 | -------------------------------------------------------------------------------- /tests/common/vulkansdk/include/spirv-tools/linker.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 Pierre Moreau 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef INCLUDE_SPIRV_TOOLS_LINKER_HPP_ 16 | #define INCLUDE_SPIRV_TOOLS_LINKER_HPP_ 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | 23 | #include "libspirv.hpp" 24 | 25 | namespace spvtools { 26 | 27 | class LinkerOptions { 28 | public: 29 | // Returns whether a library or an executable should be produced by the 30 | // linking phase. 31 | // 32 | // All exported symbols are kept when creating a library, whereas they will 33 | // be removed when creating an executable. 34 | // The returned value will be true if creating a library, and false if 35 | // creating an executable. 36 | bool GetCreateLibrary() const { return create_library_; } 37 | 38 | // Sets whether a library or an executable should be produced. 39 | void SetCreateLibrary(bool create_library) { 40 | create_library_ = create_library; 41 | } 42 | 43 | // Returns whether to verify the uniqueness of the unique ids in the merged 44 | // context. 45 | bool GetVerifyIds() const { return verify_ids_; } 46 | 47 | // Sets whether to verify the uniqueness of the unique ids in the merged 48 | // context. 49 | void SetVerifyIds(bool verify_ids) { verify_ids_ = verify_ids; } 50 | 51 | // Returns whether to allow for imported symbols to have no corresponding 52 | // exported symbols 53 | bool GetAllowPartialLinkage() const { return allow_partial_linkage_; } 54 | 55 | // Sets whether to allow for imported symbols to have no corresponding 56 | // exported symbols 57 | void SetAllowPartialLinkage(bool allow_partial_linkage) { 58 | allow_partial_linkage_ = allow_partial_linkage; 59 | } 60 | 61 | bool GetUseHighestVersion() const { return use_highest_version_; } 62 | void SetUseHighestVersion(bool use_highest_vers) { 63 | use_highest_version_ = use_highest_vers; 64 | } 65 | 66 | private: 67 | bool create_library_{false}; 68 | bool verify_ids_{false}; 69 | bool allow_partial_linkage_{false}; 70 | bool use_highest_version_{false}; 71 | }; 72 | 73 | // Links one or more SPIR-V modules into a new SPIR-V module. That is, combine 74 | // several SPIR-V modules into one, resolving link dependencies between them. 75 | // 76 | // At least one binary has to be provided in |binaries|. Those binaries do not 77 | // have to be valid, but they should be at least parseable. 78 | // The functions can fail due to the following: 79 | // * The given context was not initialised using `spvContextCreate()`; 80 | // * No input modules were given; 81 | // * One or more of those modules were not parseable; 82 | // * The input modules used different addressing or memory models; 83 | // * The ID or global variable number limit were exceeded; 84 | // * Some entry points were defined multiple times; 85 | // * Some imported symbols did not have an exported counterpart; 86 | // * Possibly other reasons. 87 | spv_result_t Link(const Context& context, 88 | const std::vector>& binaries, 89 | std::vector* linked_binary, 90 | const LinkerOptions& options = LinkerOptions()); 91 | spv_result_t Link(const Context& context, const uint32_t* const* binaries, 92 | const size_t* binary_sizes, size_t num_binaries, 93 | std::vector* linked_binary, 94 | const LinkerOptions& options = LinkerOptions()); 95 | 96 | } // namespace spvtools 97 | 98 | #endif // INCLUDE_SPIRV_TOOLS_LINKER_HPP_ 99 | -------------------------------------------------------------------------------- /tests/common/vulkansdk/include/spirv_cross/GLSL.std.450.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016,2021 The Khronos Group, Inc. 3 | * SPDX-License-Identifier: MIT 4 | * 5 | * MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS 6 | * STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND 7 | * HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ 8 | */ 9 | 10 | #ifndef GLSLstd450_H 11 | #define GLSLstd450_H 12 | 13 | static const int GLSLstd450Version = 100; 14 | static const int GLSLstd450Revision = 3; 15 | 16 | enum GLSLstd450 { 17 | GLSLstd450Bad = 0, // Don't use 18 | 19 | GLSLstd450Round = 1, 20 | GLSLstd450RoundEven = 2, 21 | GLSLstd450Trunc = 3, 22 | GLSLstd450FAbs = 4, 23 | GLSLstd450SAbs = 5, 24 | GLSLstd450FSign = 6, 25 | GLSLstd450SSign = 7, 26 | GLSLstd450Floor = 8, 27 | GLSLstd450Ceil = 9, 28 | GLSLstd450Fract = 10, 29 | 30 | GLSLstd450Radians = 11, 31 | GLSLstd450Degrees = 12, 32 | GLSLstd450Sin = 13, 33 | GLSLstd450Cos = 14, 34 | GLSLstd450Tan = 15, 35 | GLSLstd450Asin = 16, 36 | GLSLstd450Acos = 17, 37 | GLSLstd450Atan = 18, 38 | GLSLstd450Sinh = 19, 39 | GLSLstd450Cosh = 20, 40 | GLSLstd450Tanh = 21, 41 | GLSLstd450Asinh = 22, 42 | GLSLstd450Acosh = 23, 43 | GLSLstd450Atanh = 24, 44 | GLSLstd450Atan2 = 25, 45 | 46 | GLSLstd450Pow = 26, 47 | GLSLstd450Exp = 27, 48 | GLSLstd450Log = 28, 49 | GLSLstd450Exp2 = 29, 50 | GLSLstd450Log2 = 30, 51 | GLSLstd450Sqrt = 31, 52 | GLSLstd450InverseSqrt = 32, 53 | 54 | GLSLstd450Determinant = 33, 55 | GLSLstd450MatrixInverse = 34, 56 | 57 | GLSLstd450Modf = 35, // second operand needs an OpVariable to write to 58 | GLSLstd450ModfStruct = 36, // no OpVariable operand 59 | GLSLstd450FMin = 37, 60 | GLSLstd450UMin = 38, 61 | GLSLstd450SMin = 39, 62 | GLSLstd450FMax = 40, 63 | GLSLstd450UMax = 41, 64 | GLSLstd450SMax = 42, 65 | GLSLstd450FClamp = 43, 66 | GLSLstd450UClamp = 44, 67 | GLSLstd450SClamp = 45, 68 | GLSLstd450FMix = 46, 69 | GLSLstd450IMix = 47, // Reserved 70 | GLSLstd450Step = 48, 71 | GLSLstd450SmoothStep = 49, 72 | 73 | GLSLstd450Fma = 50, 74 | GLSLstd450Frexp = 51, // second operand needs an OpVariable to write to 75 | GLSLstd450FrexpStruct = 52, // no OpVariable operand 76 | GLSLstd450Ldexp = 53, 77 | 78 | GLSLstd450PackSnorm4x8 = 54, 79 | GLSLstd450PackUnorm4x8 = 55, 80 | GLSLstd450PackSnorm2x16 = 56, 81 | GLSLstd450PackUnorm2x16 = 57, 82 | GLSLstd450PackHalf2x16 = 58, 83 | GLSLstd450PackDouble2x32 = 59, 84 | GLSLstd450UnpackSnorm2x16 = 60, 85 | GLSLstd450UnpackUnorm2x16 = 61, 86 | GLSLstd450UnpackHalf2x16 = 62, 87 | GLSLstd450UnpackSnorm4x8 = 63, 88 | GLSLstd450UnpackUnorm4x8 = 64, 89 | GLSLstd450UnpackDouble2x32 = 65, 90 | 91 | GLSLstd450Length = 66, 92 | GLSLstd450Distance = 67, 93 | GLSLstd450Cross = 68, 94 | GLSLstd450Normalize = 69, 95 | GLSLstd450FaceForward = 70, 96 | GLSLstd450Reflect = 71, 97 | GLSLstd450Refract = 72, 98 | 99 | GLSLstd450FindILsb = 73, 100 | GLSLstd450FindSMsb = 74, 101 | GLSLstd450FindUMsb = 75, 102 | 103 | GLSLstd450InterpolateAtCentroid = 76, 104 | GLSLstd450InterpolateAtSample = 77, 105 | GLSLstd450InterpolateAtOffset = 78, 106 | 107 | GLSLstd450NMin = 79, 108 | GLSLstd450NMax = 80, 109 | GLSLstd450NClamp = 81, 110 | 111 | GLSLstd450Count 112 | }; 113 | 114 | #endif // #ifndef GLSLstd450_H 115 | -------------------------------------------------------------------------------- /tests/common/vulkansdk/include/spirv_cross/spirv_cross_error_handling.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015-2021 Arm Limited 3 | * SPDX-License-Identifier: Apache-2.0 OR MIT 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | /* 19 | * At your option, you may choose to accept this material under either: 20 | * 1. The Apache License, Version 2.0, found at , or 21 | * 2. The MIT License, found at . 22 | */ 23 | 24 | #ifndef SPIRV_CROSS_ERROR_HANDLING 25 | #define SPIRV_CROSS_ERROR_HANDLING 26 | 27 | #include 28 | #include 29 | #include 30 | #ifndef SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS 31 | #include 32 | #endif 33 | 34 | #ifdef SPIRV_CROSS_NAMESPACE_OVERRIDE 35 | #define SPIRV_CROSS_NAMESPACE SPIRV_CROSS_NAMESPACE_OVERRIDE 36 | #else 37 | #define SPIRV_CROSS_NAMESPACE spirv_cross 38 | #endif 39 | 40 | namespace SPIRV_CROSS_NAMESPACE 41 | { 42 | #ifdef SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS 43 | #if !defined(_MSC_VER) || defined(__clang__) 44 | [[noreturn]] 45 | #elif defined(_MSC_VER) 46 | __declspec(noreturn) 47 | #endif 48 | inline void 49 | report_and_abort(const std::string &msg) 50 | { 51 | #ifdef NDEBUG 52 | (void)msg; 53 | #else 54 | fprintf(stderr, "There was a compiler error: %s\n", msg.c_str()); 55 | #endif 56 | fflush(stderr); 57 | abort(); 58 | } 59 | 60 | #define SPIRV_CROSS_THROW(x) report_and_abort(x) 61 | #else 62 | class CompilerError : public std::runtime_error 63 | { 64 | public: 65 | explicit CompilerError(const std::string &str) 66 | : std::runtime_error(str) 67 | { 68 | } 69 | }; 70 | 71 | #define SPIRV_CROSS_THROW(x) throw CompilerError(x) 72 | #endif 73 | 74 | // MSVC 2013 does not have noexcept. We need this for Variant to get move constructor to work correctly 75 | // instead of copy constructor. 76 | // MSVC 2013 ignores that move constructors cannot throw in std::vector, so just don't define it. 77 | #if defined(_MSC_VER) && _MSC_VER < 1900 78 | #define SPIRV_CROSS_NOEXCEPT 79 | #else 80 | #define SPIRV_CROSS_NOEXCEPT noexcept 81 | #endif 82 | 83 | #if __cplusplus >= 201402l 84 | #define SPIRV_CROSS_DEPRECATED(reason) [[deprecated(reason)]] 85 | #elif defined(__GNUC__) 86 | #define SPIRV_CROSS_DEPRECATED(reason) __attribute__((deprecated)) 87 | #elif defined(_MSC_VER) 88 | #define SPIRV_CROSS_DEPRECATED(reason) __declspec(deprecated(reason)) 89 | #else 90 | #define SPIRV_CROSS_DEPRECATED(reason) 91 | #endif 92 | } // namespace SPIRV_CROSS_NAMESPACE 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /tests/common/vulkansdk/include/spirv_cross/spirv_parser.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2021 Arm Limited 3 | * SPDX-License-Identifier: Apache-2.0 OR MIT 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | /* 19 | * At your option, you may choose to accept this material under either: 20 | * 1. The Apache License, Version 2.0, found at , or 21 | * 2. The MIT License, found at . 22 | */ 23 | 24 | #ifndef SPIRV_CROSS_PARSER_HPP 25 | #define SPIRV_CROSS_PARSER_HPP 26 | 27 | #include "spirv_cross_parsed_ir.hpp" 28 | #include 29 | 30 | namespace SPIRV_CROSS_NAMESPACE 31 | { 32 | class Parser 33 | { 34 | public: 35 | Parser(const uint32_t *spirv_data, size_t word_count); 36 | Parser(std::vector spirv); 37 | 38 | void parse(); 39 | 40 | ParsedIR &get_parsed_ir() 41 | { 42 | return ir; 43 | } 44 | 45 | private: 46 | ParsedIR ir; 47 | SPIRFunction *current_function = nullptr; 48 | SPIRBlock *current_block = nullptr; 49 | // For workarounds. 50 | bool ignore_trailing_block_opcodes = false; 51 | 52 | void parse(const Instruction &instr); 53 | const uint32_t *stream(const Instruction &instr) const; 54 | 55 | template 56 | T &set(uint32_t id, P &&... args) 57 | { 58 | ir.add_typed_id(static_cast(T::type), id); 59 | auto &var = variant_set(ir.ids[id], std::forward

(args)...); 60 | var.self = id; 61 | return var; 62 | } 63 | 64 | template 65 | T &get(uint32_t id) 66 | { 67 | return variant_get(ir.ids[id]); 68 | } 69 | 70 | template 71 | T *maybe_get(uint32_t id) 72 | { 73 | if (ir.ids[id].get_type() == static_cast(T::type)) 74 | return &get(id); 75 | else 76 | return nullptr; 77 | } 78 | 79 | template 80 | const T &get(uint32_t id) const 81 | { 82 | return variant_get(ir.ids[id]); 83 | } 84 | 85 | template 86 | const T *maybe_get(uint32_t id) const 87 | { 88 | if (ir.ids[id].get_type() == T::type) 89 | return &get(id); 90 | else 91 | return nullptr; 92 | } 93 | 94 | // This must be an ordered data structure so we always pick the same type aliases. 95 | SmallVector global_struct_cache; 96 | SmallVector> forward_pointer_fixups; 97 | 98 | bool types_are_logically_equivalent(const SPIRType &a, const SPIRType &b) const; 99 | bool variable_storage_is_aliased(const SPIRVariable &v) const; 100 | }; 101 | } // namespace SPIRV_CROSS_NAMESPACE 102 | 103 | #endif 104 | -------------------------------------------------------------------------------- /tests/common/vulkansdk/include/spirv_cross/spirv_reflect.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2021 Bradley Austin Davis 3 | * SPDX-License-Identifier: Apache-2.0 OR MIT 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | /* 19 | * At your option, you may choose to accept this material under either: 20 | * 1. The Apache License, Version 2.0, found at , or 21 | * 2. The MIT License, found at . 22 | */ 23 | 24 | #ifndef SPIRV_CROSS_REFLECT_HPP 25 | #define SPIRV_CROSS_REFLECT_HPP 26 | 27 | #include "spirv_glsl.hpp" 28 | #include 29 | 30 | namespace simple_json 31 | { 32 | class Stream; 33 | } 34 | 35 | namespace SPIRV_CROSS_NAMESPACE 36 | { 37 | class CompilerReflection : public CompilerGLSL 38 | { 39 | using Parent = CompilerGLSL; 40 | 41 | public: 42 | explicit CompilerReflection(std::vector spirv_) 43 | : Parent(std::move(spirv_)) 44 | { 45 | options.vulkan_semantics = true; 46 | } 47 | 48 | CompilerReflection(const uint32_t *ir_, size_t word_count) 49 | : Parent(ir_, word_count) 50 | { 51 | options.vulkan_semantics = true; 52 | } 53 | 54 | explicit CompilerReflection(const ParsedIR &ir_) 55 | : CompilerGLSL(ir_) 56 | { 57 | options.vulkan_semantics = true; 58 | } 59 | 60 | explicit CompilerReflection(ParsedIR &&ir_) 61 | : CompilerGLSL(std::move(ir_)) 62 | { 63 | options.vulkan_semantics = true; 64 | } 65 | 66 | void set_format(const std::string &format); 67 | std::string compile() override; 68 | 69 | private: 70 | static std::string execution_model_to_str(spv::ExecutionModel model); 71 | 72 | void emit_entry_points(); 73 | void emit_types(); 74 | void emit_resources(); 75 | void emit_specialization_constants(); 76 | 77 | void emit_type(uint32_t type_id, bool &emitted_open_tag); 78 | void emit_type_member(const SPIRType &type, uint32_t index); 79 | void emit_type_member_qualifiers(const SPIRType &type, uint32_t index); 80 | void emit_type_array(const SPIRType &type); 81 | void emit_resources(const char *tag, const SmallVector &resources); 82 | bool type_is_reference(const SPIRType &type) const; 83 | 84 | std::string to_member_name(const SPIRType &type, uint32_t index) const; 85 | 86 | std::shared_ptr json_stream; 87 | }; 88 | 89 | } // namespace SPIRV_CROSS_NAMESPACE 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /tests/common/vulkansdk/include/vk_video/vulkan_video_codec_h264std_decode.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_VIDEO_CODEC_H264STD_DECODE_H_ 2 | #define VULKAN_VIDEO_CODEC_H264STD_DECODE_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // vulkan_video_codec_h264std_decode is a preprocessor guard. Do not pass it to API calls. 23 | #define vulkan_video_codec_h264std_decode 1 24 | #include "vulkan_video_codec_h264std.h" 25 | 26 | #define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_API_VERSION_1_0_0 VK_MAKE_VIDEO_STD_VERSION(1, 0, 0) 27 | 28 | #define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_API_VERSION_1_0_0 29 | #define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h264_decode" 30 | #define STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE 2 31 | 32 | typedef enum StdVideoDecodeH264FieldOrderCount { 33 | STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_TOP = 0, 34 | STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_BOTTOM = 1, 35 | STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_INVALID = 0x7FFFFFFF, 36 | STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_MAX_ENUM = 0x7FFFFFFF 37 | } StdVideoDecodeH264FieldOrderCount; 38 | typedef struct StdVideoDecodeH264PictureInfoFlags { 39 | uint32_t field_pic_flag : 1; 40 | uint32_t is_intra : 1; 41 | uint32_t IdrPicFlag : 1; 42 | uint32_t bottom_field_flag : 1; 43 | uint32_t is_reference : 1; 44 | uint32_t complementary_field_pair : 1; 45 | } StdVideoDecodeH264PictureInfoFlags; 46 | 47 | typedef struct StdVideoDecodeH264PictureInfo { 48 | StdVideoDecodeH264PictureInfoFlags flags; 49 | uint8_t seq_parameter_set_id; 50 | uint8_t pic_parameter_set_id; 51 | uint8_t reserved1; 52 | uint8_t reserved2; 53 | uint16_t frame_num; 54 | uint16_t idr_pic_id; 55 | int32_t PicOrderCnt[STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE]; 56 | } StdVideoDecodeH264PictureInfo; 57 | 58 | typedef struct StdVideoDecodeH264ReferenceInfoFlags { 59 | uint32_t top_field_flag : 1; 60 | uint32_t bottom_field_flag : 1; 61 | uint32_t used_for_long_term_reference : 1; 62 | uint32_t is_non_existing : 1; 63 | } StdVideoDecodeH264ReferenceInfoFlags; 64 | 65 | typedef struct StdVideoDecodeH264ReferenceInfo { 66 | StdVideoDecodeH264ReferenceInfoFlags flags; 67 | uint16_t FrameNum; 68 | uint16_t reserved; 69 | int32_t PicOrderCnt[STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE]; 70 | } StdVideoDecodeH264ReferenceInfo; 71 | 72 | 73 | #ifdef __cplusplus 74 | } 75 | #endif 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /tests/common/vulkansdk/include/vk_video/vulkan_video_codec_h265std_decode.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_VIDEO_CODEC_H265STD_DECODE_H_ 2 | #define VULKAN_VIDEO_CODEC_H265STD_DECODE_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // vulkan_video_codec_h265std_decode is a preprocessor guard. Do not pass it to API calls. 23 | #define vulkan_video_codec_h265std_decode 1 24 | #include "vulkan_video_codec_h265std.h" 25 | 26 | #define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_API_VERSION_1_0_0 VK_MAKE_VIDEO_STD_VERSION(1, 0, 0) 27 | 28 | #define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_API_VERSION_1_0_0 29 | #define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h265_decode" 30 | #define STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE 8 31 | typedef struct StdVideoDecodeH265PictureInfoFlags { 32 | uint32_t IrapPicFlag : 1; 33 | uint32_t IdrPicFlag : 1; 34 | uint32_t IsReference : 1; 35 | uint32_t short_term_ref_pic_set_sps_flag : 1; 36 | } StdVideoDecodeH265PictureInfoFlags; 37 | 38 | typedef struct StdVideoDecodeH265PictureInfo { 39 | StdVideoDecodeH265PictureInfoFlags flags; 40 | uint8_t sps_video_parameter_set_id; 41 | uint8_t pps_seq_parameter_set_id; 42 | uint8_t pps_pic_parameter_set_id; 43 | uint8_t NumDeltaPocsOfRefRpsIdx; 44 | int32_t PicOrderCntVal; 45 | uint16_t NumBitsForSTRefPicSetInSlice; 46 | uint16_t reserved; 47 | uint8_t RefPicSetStCurrBefore[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE]; 48 | uint8_t RefPicSetStCurrAfter[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE]; 49 | uint8_t RefPicSetLtCurr[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE]; 50 | } StdVideoDecodeH265PictureInfo; 51 | 52 | typedef struct StdVideoDecodeH265ReferenceInfoFlags { 53 | uint32_t used_for_long_term_reference : 1; 54 | uint32_t unused_for_reference : 1; 55 | } StdVideoDecodeH265ReferenceInfoFlags; 56 | 57 | typedef struct StdVideoDecodeH265ReferenceInfo { 58 | StdVideoDecodeH265ReferenceInfoFlags flags; 59 | int32_t PicOrderCntVal; 60 | } StdVideoDecodeH265ReferenceInfo; 61 | 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /tests/common/vulkansdk/include/vk_video/vulkan_video_codecs_common.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_VIDEO_CODECS_COMMON_H_ 2 | #define VULKAN_VIDEO_CODECS_COMMON_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // vulkan_video_codecs_common is a preprocessor guard. Do not pass it to API calls. 23 | #define vulkan_video_codecs_common 1 24 | #if !defined(VK_NO_STDINT_H) 25 | #include 26 | #endif 27 | 28 | #define VK_MAKE_VIDEO_STD_VERSION(major, minor, patch) \ 29 | ((((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch))) 30 | 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tests/common/vulkansdk/include/vulkan/vk_platform.h: -------------------------------------------------------------------------------- 1 | // 2 | // File: vk_platform.h 3 | // 4 | /* 5 | ** Copyright 2014-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | 11 | #ifndef VK_PLATFORM_H_ 12 | #define VK_PLATFORM_H_ 13 | 14 | #ifdef __cplusplus 15 | extern "C" 16 | { 17 | #endif // __cplusplus 18 | 19 | /* 20 | *************************************************************************************************** 21 | * Platform-specific directives and type declarations 22 | *************************************************************************************************** 23 | */ 24 | 25 | /* Platform-specific calling convention macros. 26 | * 27 | * Platforms should define these so that Vulkan clients call Vulkan commands 28 | * with the same calling conventions that the Vulkan implementation expects. 29 | * 30 | * VKAPI_ATTR - Placed before the return type in function declarations. 31 | * Useful for C++11 and GCC/Clang-style function attribute syntax. 32 | * VKAPI_CALL - Placed after the return type in function declarations. 33 | * Useful for MSVC-style calling convention syntax. 34 | * VKAPI_PTR - Placed between the '(' and '*' in function pointer types. 35 | * 36 | * Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void); 37 | * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void); 38 | */ 39 | #if defined(_WIN32) 40 | // On Windows, Vulkan commands use the stdcall convention 41 | #define VKAPI_ATTR 42 | #define VKAPI_CALL __stdcall 43 | #define VKAPI_PTR VKAPI_CALL 44 | #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7 45 | #error "Vulkan is not supported for the 'armeabi' NDK ABI" 46 | #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE) 47 | // On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" 48 | // calling convention, i.e. float parameters are passed in registers. This 49 | // is true even if the rest of the application passes floats on the stack, 50 | // as it does by default when compiling for the armeabi-v7a NDK ABI. 51 | #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp"))) 52 | #define VKAPI_CALL 53 | #define VKAPI_PTR VKAPI_ATTR 54 | #else 55 | // On other platforms, use the default calling convention 56 | #define VKAPI_ATTR 57 | #define VKAPI_CALL 58 | #define VKAPI_PTR 59 | #endif 60 | 61 | #if !defined(VK_NO_STDDEF_H) 62 | #include 63 | #endif // !defined(VK_NO_STDDEF_H) 64 | 65 | #if !defined(VK_NO_STDINT_H) 66 | #if defined(_MSC_VER) && (_MSC_VER < 1600) 67 | typedef signed __int8 int8_t; 68 | typedef unsigned __int8 uint8_t; 69 | typedef signed __int16 int16_t; 70 | typedef unsigned __int16 uint16_t; 71 | typedef signed __int32 int32_t; 72 | typedef unsigned __int32 uint32_t; 73 | typedef signed __int64 int64_t; 74 | typedef unsigned __int64 uint64_t; 75 | #else 76 | #include 77 | #endif 78 | #endif // !defined(VK_NO_STDINT_H) 79 | 80 | #ifdef __cplusplus 81 | } // extern "C" 82 | #endif // __cplusplus 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /tests/common/vulkansdk/include/vulkan/vulkan.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_H_ 2 | #define VULKAN_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | #include "vk_platform.h" 11 | #include "vulkan_core.h" 12 | 13 | #ifdef VK_USE_PLATFORM_ANDROID_KHR 14 | #include "vulkan_android.h" 15 | #endif 16 | 17 | #ifdef VK_USE_PLATFORM_FUCHSIA 18 | #include 19 | #include "vulkan_fuchsia.h" 20 | #endif 21 | 22 | #ifdef VK_USE_PLATFORM_IOS_MVK 23 | #include "vulkan_ios.h" 24 | #endif 25 | 26 | 27 | #ifdef VK_USE_PLATFORM_MACOS_MVK 28 | #include "vulkan_macos.h" 29 | #endif 30 | 31 | #ifdef VK_USE_PLATFORM_METAL_EXT 32 | #include "vulkan_metal.h" 33 | #endif 34 | 35 | #ifdef VK_USE_PLATFORM_VI_NN 36 | #include "vulkan_vi.h" 37 | #endif 38 | 39 | 40 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR 41 | #include "vulkan_wayland.h" 42 | #endif 43 | 44 | 45 | #ifdef VK_USE_PLATFORM_WIN32_KHR 46 | #include 47 | #include "vulkan_win32.h" 48 | #endif 49 | 50 | 51 | #ifdef VK_USE_PLATFORM_XCB_KHR 52 | #include 53 | #include "vulkan_xcb.h" 54 | #endif 55 | 56 | 57 | #ifdef VK_USE_PLATFORM_XLIB_KHR 58 | #include 59 | #include "vulkan_xlib.h" 60 | #endif 61 | 62 | 63 | #ifdef VK_USE_PLATFORM_DIRECTFB_EXT 64 | #include 65 | #include "vulkan_directfb.h" 66 | #endif 67 | 68 | 69 | #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT 70 | #include 71 | #include 72 | #include "vulkan_xlib_xrandr.h" 73 | #endif 74 | 75 | 76 | #ifdef VK_USE_PLATFORM_GGP 77 | #include 78 | #include "vulkan_ggp.h" 79 | #endif 80 | 81 | 82 | #ifdef VK_USE_PLATFORM_SCREEN_QNX 83 | #include 84 | #include "vulkan_screen.h" 85 | #endif 86 | 87 | 88 | #ifdef VK_USE_PLATFORM_SCI 89 | #include 90 | #include 91 | #include "vulkan_sci.h" 92 | #endif 93 | 94 | 95 | #ifdef VK_ENABLE_BETA_EXTENSIONS 96 | #include "vulkan_beta.h" 97 | #endif 98 | 99 | #endif // VULKAN_H_ 100 | -------------------------------------------------------------------------------- /tests/common/vulkansdk/include/vulkan/vulkan_directfb.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_DIRECTFB_H_ 2 | #define VULKAN_DIRECTFB_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // VK_EXT_directfb_surface is a preprocessor guard. Do not pass it to API calls. 23 | #define VK_EXT_directfb_surface 1 24 | #define VK_EXT_DIRECTFB_SURFACE_SPEC_VERSION 1 25 | #define VK_EXT_DIRECTFB_SURFACE_EXTENSION_NAME "VK_EXT_directfb_surface" 26 | typedef VkFlags VkDirectFBSurfaceCreateFlagsEXT; 27 | typedef struct VkDirectFBSurfaceCreateInfoEXT { 28 | VkStructureType sType; 29 | const void* pNext; 30 | VkDirectFBSurfaceCreateFlagsEXT flags; 31 | IDirectFB* dfb; 32 | IDirectFBSurface* surface; 33 | } VkDirectFBSurfaceCreateInfoEXT; 34 | 35 | typedef VkResult (VKAPI_PTR *PFN_vkCreateDirectFBSurfaceEXT)(VkInstance instance, const VkDirectFBSurfaceCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 36 | typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceDirectFBPresentationSupportEXT)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, IDirectFB* dfb); 37 | 38 | #ifndef VK_NO_PROTOTYPES 39 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateDirectFBSurfaceEXT( 40 | VkInstance instance, 41 | const VkDirectFBSurfaceCreateInfoEXT* pCreateInfo, 42 | const VkAllocationCallbacks* pAllocator, 43 | VkSurfaceKHR* pSurface); 44 | 45 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceDirectFBPresentationSupportEXT( 46 | VkPhysicalDevice physicalDevice, 47 | uint32_t queueFamilyIndex, 48 | IDirectFB* dfb); 49 | #endif 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /tests/common/vulkansdk/include/vulkan/vulkan_ggp.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_GGP_H_ 2 | #define VULKAN_GGP_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // VK_GGP_stream_descriptor_surface is a preprocessor guard. Do not pass it to API calls. 23 | #define VK_GGP_stream_descriptor_surface 1 24 | #define VK_GGP_STREAM_DESCRIPTOR_SURFACE_SPEC_VERSION 1 25 | #define VK_GGP_STREAM_DESCRIPTOR_SURFACE_EXTENSION_NAME "VK_GGP_stream_descriptor_surface" 26 | typedef VkFlags VkStreamDescriptorSurfaceCreateFlagsGGP; 27 | typedef struct VkStreamDescriptorSurfaceCreateInfoGGP { 28 | VkStructureType sType; 29 | const void* pNext; 30 | VkStreamDescriptorSurfaceCreateFlagsGGP flags; 31 | GgpStreamDescriptor streamDescriptor; 32 | } VkStreamDescriptorSurfaceCreateInfoGGP; 33 | 34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateStreamDescriptorSurfaceGGP)(VkInstance instance, const VkStreamDescriptorSurfaceCreateInfoGGP* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 35 | 36 | #ifndef VK_NO_PROTOTYPES 37 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateStreamDescriptorSurfaceGGP( 38 | VkInstance instance, 39 | const VkStreamDescriptorSurfaceCreateInfoGGP* pCreateInfo, 40 | const VkAllocationCallbacks* pAllocator, 41 | VkSurfaceKHR* pSurface); 42 | #endif 43 | 44 | 45 | // VK_GGP_frame_token is a preprocessor guard. Do not pass it to API calls. 46 | #define VK_GGP_frame_token 1 47 | #define VK_GGP_FRAME_TOKEN_SPEC_VERSION 1 48 | #define VK_GGP_FRAME_TOKEN_EXTENSION_NAME "VK_GGP_frame_token" 49 | typedef struct VkPresentFrameTokenGGP { 50 | VkStructureType sType; 51 | const void* pNext; 52 | GgpFrameToken frameToken; 53 | } VkPresentFrameTokenGGP; 54 | 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /tests/common/vulkansdk/include/vulkan/vulkan_ios.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_IOS_H_ 2 | #define VULKAN_IOS_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // VK_MVK_ios_surface is a preprocessor guard. Do not pass it to API calls. 23 | #define VK_MVK_ios_surface 1 24 | #define VK_MVK_IOS_SURFACE_SPEC_VERSION 3 25 | #define VK_MVK_IOS_SURFACE_EXTENSION_NAME "VK_MVK_ios_surface" 26 | typedef VkFlags VkIOSSurfaceCreateFlagsMVK; 27 | typedef struct VkIOSSurfaceCreateInfoMVK { 28 | VkStructureType sType; 29 | const void* pNext; 30 | VkIOSSurfaceCreateFlagsMVK flags; 31 | const void* pView; 32 | } VkIOSSurfaceCreateInfoMVK; 33 | 34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateIOSSurfaceMVK)(VkInstance instance, const VkIOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 35 | 36 | #ifndef VK_NO_PROTOTYPES 37 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateIOSSurfaceMVK( 38 | VkInstance instance, 39 | const VkIOSSurfaceCreateInfoMVK* pCreateInfo, 40 | const VkAllocationCallbacks* pAllocator, 41 | VkSurfaceKHR* pSurface); 42 | #endif 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /tests/common/vulkansdk/include/vulkan/vulkan_macos.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_MACOS_H_ 2 | #define VULKAN_MACOS_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // VK_MVK_macos_surface is a preprocessor guard. Do not pass it to API calls. 23 | #define VK_MVK_macos_surface 1 24 | #define VK_MVK_MACOS_SURFACE_SPEC_VERSION 3 25 | #define VK_MVK_MACOS_SURFACE_EXTENSION_NAME "VK_MVK_macos_surface" 26 | typedef VkFlags VkMacOSSurfaceCreateFlagsMVK; 27 | typedef struct VkMacOSSurfaceCreateInfoMVK { 28 | VkStructureType sType; 29 | const void* pNext; 30 | VkMacOSSurfaceCreateFlagsMVK flags; 31 | const void* pView; 32 | } VkMacOSSurfaceCreateInfoMVK; 33 | 34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateMacOSSurfaceMVK)(VkInstance instance, const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 35 | 36 | #ifndef VK_NO_PROTOTYPES 37 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateMacOSSurfaceMVK( 38 | VkInstance instance, 39 | const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, 40 | const VkAllocationCallbacks* pAllocator, 41 | VkSurfaceKHR* pSurface); 42 | #endif 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /tests/common/vulkansdk/include/vulkan/vulkan_vi.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_VI_H_ 2 | #define VULKAN_VI_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // VK_NN_vi_surface is a preprocessor guard. Do not pass it to API calls. 23 | #define VK_NN_vi_surface 1 24 | #define VK_NN_VI_SURFACE_SPEC_VERSION 1 25 | #define VK_NN_VI_SURFACE_EXTENSION_NAME "VK_NN_vi_surface" 26 | typedef VkFlags VkViSurfaceCreateFlagsNN; 27 | typedef struct VkViSurfaceCreateInfoNN { 28 | VkStructureType sType; 29 | const void* pNext; 30 | VkViSurfaceCreateFlagsNN flags; 31 | void* window; 32 | } VkViSurfaceCreateInfoNN; 33 | 34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateViSurfaceNN)(VkInstance instance, const VkViSurfaceCreateInfoNN* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 35 | 36 | #ifndef VK_NO_PROTOTYPES 37 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateViSurfaceNN( 38 | VkInstance instance, 39 | const VkViSurfaceCreateInfoNN* pCreateInfo, 40 | const VkAllocationCallbacks* pAllocator, 41 | VkSurfaceKHR* pSurface); 42 | #endif 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /tests/common/vulkansdk/include/vulkan/vulkan_wayland.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_WAYLAND_H_ 2 | #define VULKAN_WAYLAND_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // VK_KHR_wayland_surface is a preprocessor guard. Do not pass it to API calls. 23 | #define VK_KHR_wayland_surface 1 24 | #define VK_KHR_WAYLAND_SURFACE_SPEC_VERSION 6 25 | #define VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME "VK_KHR_wayland_surface" 26 | typedef VkFlags VkWaylandSurfaceCreateFlagsKHR; 27 | typedef struct VkWaylandSurfaceCreateInfoKHR { 28 | VkStructureType sType; 29 | const void* pNext; 30 | VkWaylandSurfaceCreateFlagsKHR flags; 31 | struct wl_display* display; 32 | struct wl_surface* surface; 33 | } VkWaylandSurfaceCreateInfoKHR; 34 | 35 | typedef VkResult (VKAPI_PTR *PFN_vkCreateWaylandSurfaceKHR)(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 36 | typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, struct wl_display* display); 37 | 38 | #ifndef VK_NO_PROTOTYPES 39 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateWaylandSurfaceKHR( 40 | VkInstance instance, 41 | const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, 42 | const VkAllocationCallbacks* pAllocator, 43 | VkSurfaceKHR* pSurface); 44 | 45 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWaylandPresentationSupportKHR( 46 | VkPhysicalDevice physicalDevice, 47 | uint32_t queueFamilyIndex, 48 | struct wl_display* display); 49 | #endif 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /tests/common/vulkansdk/include/vulkan/vulkan_xcb.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_XCB_H_ 2 | #define VULKAN_XCB_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // VK_KHR_xcb_surface is a preprocessor guard. Do not pass it to API calls. 23 | #define VK_KHR_xcb_surface 1 24 | #define VK_KHR_XCB_SURFACE_SPEC_VERSION 6 25 | #define VK_KHR_XCB_SURFACE_EXTENSION_NAME "VK_KHR_xcb_surface" 26 | typedef VkFlags VkXcbSurfaceCreateFlagsKHR; 27 | typedef struct VkXcbSurfaceCreateInfoKHR { 28 | VkStructureType sType; 29 | const void* pNext; 30 | VkXcbSurfaceCreateFlagsKHR flags; 31 | xcb_connection_t* connection; 32 | xcb_window_t window; 33 | } VkXcbSurfaceCreateInfoKHR; 34 | 35 | typedef VkResult (VKAPI_PTR *PFN_vkCreateXcbSurfaceKHR)(VkInstance instance, const VkXcbSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 36 | typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, xcb_connection_t* connection, xcb_visualid_t visual_id); 37 | 38 | #ifndef VK_NO_PROTOTYPES 39 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateXcbSurfaceKHR( 40 | VkInstance instance, 41 | const VkXcbSurfaceCreateInfoKHR* pCreateInfo, 42 | const VkAllocationCallbacks* pAllocator, 43 | VkSurfaceKHR* pSurface); 44 | 45 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXcbPresentationSupportKHR( 46 | VkPhysicalDevice physicalDevice, 47 | uint32_t queueFamilyIndex, 48 | xcb_connection_t* connection, 49 | xcb_visualid_t visual_id); 50 | #endif 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /tests/common/vulkansdk/include/vulkan/vulkan_xlib.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_XLIB_H_ 2 | #define VULKAN_XLIB_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // VK_KHR_xlib_surface is a preprocessor guard. Do not pass it to API calls. 23 | #define VK_KHR_xlib_surface 1 24 | #define VK_KHR_XLIB_SURFACE_SPEC_VERSION 6 25 | #define VK_KHR_XLIB_SURFACE_EXTENSION_NAME "VK_KHR_xlib_surface" 26 | typedef VkFlags VkXlibSurfaceCreateFlagsKHR; 27 | typedef struct VkXlibSurfaceCreateInfoKHR { 28 | VkStructureType sType; 29 | const void* pNext; 30 | VkXlibSurfaceCreateFlagsKHR flags; 31 | Display* dpy; 32 | Window window; 33 | } VkXlibSurfaceCreateInfoKHR; 34 | 35 | typedef VkResult (VKAPI_PTR *PFN_vkCreateXlibSurfaceKHR)(VkInstance instance, const VkXlibSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 36 | typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display* dpy, VisualID visualID); 37 | 38 | #ifndef VK_NO_PROTOTYPES 39 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR( 40 | VkInstance instance, 41 | const VkXlibSurfaceCreateInfoKHR* pCreateInfo, 42 | const VkAllocationCallbacks* pAllocator, 43 | VkSurfaceKHR* pSurface); 44 | 45 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXlibPresentationSupportKHR( 46 | VkPhysicalDevice physicalDevice, 47 | uint32_t queueFamilyIndex, 48 | Display* dpy, 49 | VisualID visualID); 50 | #endif 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /tests/common/vulkansdk/include/vulkan/vulkan_xlib_xrandr.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_XLIB_XRANDR_H_ 2 | #define VULKAN_XLIB_XRANDR_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2024 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // VK_EXT_acquire_xlib_display is a preprocessor guard. Do not pass it to API calls. 23 | #define VK_EXT_acquire_xlib_display 1 24 | #define VK_EXT_ACQUIRE_XLIB_DISPLAY_SPEC_VERSION 1 25 | #define VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME "VK_EXT_acquire_xlib_display" 26 | typedef VkResult (VKAPI_PTR *PFN_vkAcquireXlibDisplayEXT)(VkPhysicalDevice physicalDevice, Display* dpy, VkDisplayKHR display); 27 | typedef VkResult (VKAPI_PTR *PFN_vkGetRandROutputDisplayEXT)(VkPhysicalDevice physicalDevice, Display* dpy, RROutput rrOutput, VkDisplayKHR* pDisplay); 28 | 29 | #ifndef VK_NO_PROTOTYPES 30 | VKAPI_ATTR VkResult VKAPI_CALL vkAcquireXlibDisplayEXT( 31 | VkPhysicalDevice physicalDevice, 32 | Display* dpy, 33 | VkDisplayKHR display); 34 | 35 | VKAPI_ATTR VkResult VKAPI_CALL vkGetRandROutputDisplayEXT( 36 | VkPhysicalDevice physicalDevice, 37 | Display* dpy, 38 | RROutput rrOutput, 39 | VkDisplayKHR* pDisplay); 40 | #endif 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /tests/common/vulkansdk/lib/libvulkan.so.1.3.290: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nemirtingas/ingame_overlay/ff1e5f493cf5bd24f425368114428dda7e5e3bbf/tests/common/vulkansdk/lib/libvulkan.so.1.3.290 -------------------------------------------------------------------------------- /tests/common/vulkansdk/lib/vulkan-1.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nemirtingas/ingame_overlay/ff1e5f493cf5bd24f425368114428dda7e5e3bbf/tests/common/vulkansdk/lib/vulkan-1.lib -------------------------------------------------------------------------------- /tests/linux_opengl/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd "$(dirname "$0")" 4 | 5 | cmake -DIMGUI_USER_CONFIG="$(pwd)/../common/ingameoverlay_imconfig.h" -DINGAMEOVERLAY_BUILD_TESTS=ON -S ../../ -B ../../OUT/linux_opengl &&\ 6 | cmake --build ../../OUT/linux_opengl 7 | 8 | #../../OUT/linux_opengl/linux_opengl_app 9 | -------------------------------------------------------------------------------- /tests/linux_vulkan/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd "$(dirname "$0")" 4 | 5 | cmake -DIMGUI_USER_CONFIG="$(pwd)/../common/ingameoverlay_imconfig.h" -DINGAMEOVERLAY_BUILD_TESTS=ON -S ../../ -B ../../OUT/linux_vulkan &&\ 6 | cmake --build ../../OUT/linux_vulkan 7 | 8 | #../../OUT/linux_vulkan/linux_vulkan_app -------------------------------------------------------------------------------- /tests/macos_metal/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd "$(dirname "$0")" 4 | 5 | cmake -DIMGUI_USER_CONFIG="$(pwd)/../common/ingameoverlay_imconfig.h" -DINGAMEOVERLAY_BUILD_TESTS=ON -S ../../ -B ../../OUT/macos_metal &&\ 6 | cmake --build ../../OUT/macos_metal 7 | 8 | #../../OUT/macos_metal/macos_metal_app 9 | -------------------------------------------------------------------------------- /tests/macos_metal/macOS/Info-macOS.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | imgui 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSMainStoryboardFile 26 | MainMenu 27 | NSPrincipalClass 28 | NSApplication 29 | 30 | 31 | -------------------------------------------------------------------------------- /tests/macos_opengl2/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd "$(dirname "$0")" 4 | 5 | cmake -DIMGUI_USER_CONFIG="$(pwd)/../common/ingameoverlay_imconfig.h" -DINGAMEOVERLAY_BUILD_TESTS=ON -S ../../ -B ../../OUT/macos_opengl2 &&\ 6 | cmake --build ../../OUT/macos_opengl2 7 | 8 | #../../OUT/macos_opengl2/macos_opengl2_app -------------------------------------------------------------------------------- /tests/macos_opengl3/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd "$(dirname "$0")" 4 | 5 | cmake -DIMGUI_USER_CONFIG="$(pwd)/../common/ingameoverlay_imconfig.h" -DINGAMEOVERLAY_BUILD_TESTS=ON -S ../../ -B ../../OUT/macos_opengl3 &&\ 6 | cmake --build ../../OUT/macos_opengl3 7 | 8 | #../../OUT/macos_opengl2/macos_opengl3_app -------------------------------------------------------------------------------- /tests/windows_shaders_precompile/dx10_shaders.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "shaders.h" 4 | 5 | std::vector BuildDX10VertexShader() 6 | { 7 | static const char* vertexShader = 8 | "cbuffer vertexBuffer : register(b0) \ 9 | {\ 10 | float4x4 ProjectionMatrix; \ 11 | };\ 12 | struct VS_INPUT\ 13 | {\ 14 | float2 pos : POSITION;\ 15 | float4 col : COLOR0;\ 16 | float2 uv : TEXCOORD0;\ 17 | };\ 18 | \ 19 | struct PS_INPUT\ 20 | {\ 21 | float4 pos : SV_POSITION;\ 22 | float4 col : COLOR0;\ 23 | float2 uv : TEXCOORD0;\ 24 | };\ 25 | \ 26 | PS_INPUT main(VS_INPUT input)\ 27 | {\ 28 | PS_INPUT output;\ 29 | output.pos = mul( ProjectionMatrix, float4(input.pos.xy, 0.f, 1.f));\ 30 | output.col = input.col;\ 31 | output.uv = input.uv;\ 32 | return output;\ 33 | }"; 34 | 35 | ID3DBlob* vertexShaderBlob; 36 | if (FAILED(D3DCompile(vertexShader, strlen(vertexShader), nullptr, nullptr, nullptr, "main", "vs_4_0", 0, 0, &vertexShaderBlob, nullptr))) 37 | return {}; 38 | 39 | vertexShaderBlob->GetBufferPointer(), vertexShaderBlob->GetBufferSize(); 40 | std::vector shader( 41 | reinterpret_cast(vertexShaderBlob->GetBufferPointer()), 42 | reinterpret_cast(vertexShaderBlob->GetBufferPointer()) + vertexShaderBlob->GetBufferSize()); 43 | vertexShaderBlob->Release(); 44 | 45 | return shader; 46 | } 47 | 48 | std::vector BuildDX10PixelShader() 49 | { 50 | static const char* pixelShader = 51 | "struct PS_INPUT\ 52 | {\ 53 | float4 pos : SV_POSITION;\ 54 | float4 col : COLOR0;\ 55 | float2 uv : TEXCOORD0;\ 56 | };\ 57 | sampler sampler0;\ 58 | Texture2D texture0;\ 59 | \ 60 | float4 main(PS_INPUT input) : SV_Target\ 61 | {\ 62 | float4 out_col = input.col * texture0.Sample(sampler0, input.uv); \ 63 | return out_col; \ 64 | }"; 65 | 66 | ID3DBlob* pixelShaderBlob; 67 | if (FAILED(D3DCompile(pixelShader, strlen(pixelShader), nullptr, nullptr, nullptr, "main", "ps_4_0", 0, 0, &pixelShaderBlob, nullptr))) 68 | return {}; 69 | 70 | std::vector shader( 71 | reinterpret_cast(pixelShaderBlob->GetBufferPointer()), 72 | reinterpret_cast(pixelShaderBlob->GetBufferPointer()) + pixelShaderBlob->GetBufferSize()); 73 | pixelShaderBlob->Release(); 74 | return shader; 75 | } 76 | 77 | std::vector BuildDX10RGBAPixelShader() 78 | { 79 | static const char* pixelShader = "\ 80 | struct PS_INPUT\ 81 | {\ 82 | float4 pos : SV_POSITION; \ 83 | float4 col : COLOR0; \ 84 | float2 uv : TEXCOORD0; \ 85 | }; \ 86 | sampler sampler0; \ 87 | Texture2D texture0; \ 88 | \ 89 | float4 main(PS_INPUT input) : SV_Target\ 90 | {\ 91 | float4 out_col = texture0.Sample(sampler0, input.uv); \ 92 | return float4(out_col.r, out_col.g, out_col.b, 1.0); \ 93 | }"; 94 | 95 | ID3DBlob* pixelShaderBlob; 96 | if (FAILED(D3DCompile(pixelShader, strlen(pixelShader), nullptr, nullptr, nullptr, "main", "ps_4_0", 0, 0, &pixelShaderBlob, nullptr))) 97 | return {}; 98 | 99 | std::vector shader( 100 | reinterpret_cast(pixelShaderBlob->GetBufferPointer()), 101 | reinterpret_cast(pixelShaderBlob->GetBufferPointer()) + pixelShaderBlob->GetBufferSize()); 102 | pixelShaderBlob->Release(); 103 | return shader; 104 | } -------------------------------------------------------------------------------- /tests/windows_shaders_precompile/dx12_shaders.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "shaders.h" 4 | 5 | std::vector BuildDX12VertexShader() 6 | { 7 | static const char* vertexShader = 8 | "cbuffer vertexBuffer : register(b0) \ 9 | {\ 10 | float4x4 ProjectionMatrix; \ 11 | };\ 12 | struct VS_INPUT\ 13 | {\ 14 | float2 pos : POSITION;\ 15 | float4 col : COLOR0;\ 16 | float2 uv : TEXCOORD0;\ 17 | };\ 18 | \ 19 | struct PS_INPUT\ 20 | {\ 21 | float4 pos : SV_POSITION;\ 22 | float4 col : COLOR0;\ 23 | float2 uv : TEXCOORD0;\ 24 | };\ 25 | \ 26 | PS_INPUT main(VS_INPUT input)\ 27 | {\ 28 | PS_INPUT output;\ 29 | output.pos = mul( ProjectionMatrix, float4(input.pos.xy, 0.f, 1.f));\ 30 | output.col = input.col;\ 31 | output.uv = input.uv;\ 32 | return output;\ 33 | }"; 34 | 35 | ID3DBlob* vertexShaderBlob; 36 | if (FAILED(D3DCompile(vertexShader, strlen(vertexShader), nullptr, nullptr, nullptr, "main", "vs_5_0", 0, 0, &vertexShaderBlob, nullptr))) 37 | return {}; 38 | 39 | std::vector shader( 40 | reinterpret_cast(vertexShaderBlob->GetBufferPointer()), 41 | reinterpret_cast(vertexShaderBlob->GetBufferPointer()) + vertexShaderBlob->GetBufferSize()); 42 | vertexShaderBlob->Release(); 43 | return shader; 44 | } 45 | 46 | std::vector BuildDX12PixelShader() 47 | { 48 | static const char* pixelShader = 49 | "struct PS_INPUT\ 50 | {\ 51 | float4 pos : SV_POSITION;\ 52 | float4 col : COLOR0;\ 53 | float2 uv : TEXCOORD0;\ 54 | };\ 55 | SamplerState sampler0 : register(s0);\ 56 | Texture2D texture0 : register(t0);\ 57 | \ 58 | float4 main(PS_INPUT input) : SV_Target\ 59 | {\ 60 | float4 out_col = input.col * texture0.Sample(sampler0, input.uv); \ 61 | return out_col; \ 62 | }"; 63 | 64 | ID3DBlob* pixelShaderBlob; 65 | if (FAILED(D3DCompile(pixelShader, strlen(pixelShader), nullptr, nullptr, nullptr, "main", "ps_5_0", 0, 0, &pixelShaderBlob, nullptr))) 66 | return {}; 67 | 68 | std::vector shader( 69 | reinterpret_cast(pixelShaderBlob->GetBufferPointer()), 70 | reinterpret_cast(pixelShaderBlob->GetBufferPointer()) + pixelShaderBlob->GetBufferSize()); 71 | pixelShaderBlob->Release(); 72 | return shader; 73 | } -------------------------------------------------------------------------------- /tests/windows_shaders_precompile/dx9_shaders.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "shaders.h" -------------------------------------------------------------------------------- /tests/windows_shaders_precompile/main.cpp: -------------------------------------------------------------------------------- 1 | #include "shaders.h" 2 | #include "sha256.h" 3 | #include 4 | 5 | struct Shader_t 6 | { 7 | std::vector shaderData; 8 | std::string hash; 9 | 10 | Shader_t(std::vector& shaderData) : 11 | shaderData(std::move(shaderData)), 12 | hash(SHA256()(this->shaderData.data(), this->shaderData.size())) 13 | { 14 | } 15 | }; 16 | 17 | void WriteShader(Shader_t const& shader, std::string const& fileName) 18 | { 19 | std::ofstream fShader(fileName, std::ios::out | std::ios::trunc | std::ios::binary); 20 | 21 | fShader.write((const char*)shader.shaderData.data(), shader.shaderData.size()); 22 | } 23 | 24 | int main(int argc, char* argv[]) 25 | { 26 | std::vector pixelShaders; 27 | 28 | pixelShaders.emplace_back(BuildDX10PixelShader()); 29 | pixelShaders.emplace_back(BuildDX10RGBAPixelShader()); 30 | 31 | WriteShader(pixelShaders[1], "RGBA.shader"); 32 | 33 | pixelShaders.emplace_back(BuildDX11PixelShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_9_1)); 34 | pixelShaders.emplace_back(BuildDX11PixelShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_9_2)); 35 | pixelShaders.emplace_back(BuildDX11PixelShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_9_3)); 36 | pixelShaders.emplace_back(BuildDX11PixelShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_10_0)); 37 | pixelShaders.emplace_back(BuildDX11PixelShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_10_1)); 38 | pixelShaders.emplace_back(BuildDX11PixelShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_11_0)); 39 | pixelShaders.emplace_back(BuildDX11PixelShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_11_1)); 40 | pixelShaders.emplace_back(BuildDX11PixelShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_12_0)); 41 | pixelShaders.emplace_back(BuildDX11PixelShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_12_1)); 42 | 43 | pixelShaders.emplace_back(BuildDX12PixelShader()); 44 | 45 | std::vector vertexShaders; 46 | 47 | vertexShaders.emplace_back(BuildDX10VertexShader()); 48 | 49 | vertexShaders.emplace_back(BuildDX11VertexShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_9_1)); 50 | vertexShaders.emplace_back(BuildDX11VertexShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_9_2)); 51 | vertexShaders.emplace_back(BuildDX11VertexShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_9_3)); 52 | vertexShaders.emplace_back(BuildDX11VertexShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_10_0)); 53 | vertexShaders.emplace_back(BuildDX11VertexShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_10_1)); 54 | vertexShaders.emplace_back(BuildDX11VertexShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_11_0)); 55 | vertexShaders.emplace_back(BuildDX11VertexShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_11_1)); 56 | vertexShaders.emplace_back(BuildDX11VertexShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_12_0)); 57 | vertexShaders.emplace_back(BuildDX11VertexShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_12_1)); 58 | 59 | vertexShaders.emplace_back(BuildDX12VertexShader()); 60 | 61 | return 0; 62 | } -------------------------------------------------------------------------------- /tests/windows_shaders_precompile/sha256.h: -------------------------------------------------------------------------------- 1 | // ////////////////////////////////////////////////////////// 2 | // sha256.h 3 | // Copyright (c) 2014,2015 Stephan Brumme. All rights reserved. 4 | // see http://create.stephan-brumme.com/disclaimer.html 5 | // 6 | 7 | #pragma once 8 | 9 | //#include "hash.h" 10 | #include 11 | 12 | // define fixed size integer types 13 | #ifdef _MSC_VER 14 | // Windows 15 | typedef unsigned __int8 uint8_t; 16 | typedef unsigned __int32 uint32_t; 17 | typedef unsigned __int64 uint64_t; 18 | #else 19 | // GCC 20 | #include 21 | #endif 22 | 23 | 24 | /// compute SHA256 hash 25 | /** Usage: 26 | SHA256 sha256; 27 | std::string myHash = sha256("Hello World"); // std::string 28 | std::string myHash2 = sha256("How are you", 11); // arbitrary data, 11 bytes 29 | 30 | // or in a streaming fashion: 31 | 32 | SHA256 sha256; 33 | while (more data available) 34 | sha256.add(pointer to fresh data, number of new bytes); 35 | std::string myHash3 = sha256.getHash(); 36 | */ 37 | class SHA256 //: public Hash 38 | { 39 | public: 40 | /// split into 64 byte blocks (=> 512 bits), hash is 32 bytes long 41 | enum { BlockSize = 512 / 8, HashBytes = 32 }; 42 | 43 | /// same as reset() 44 | SHA256(); 45 | 46 | /// compute SHA256 of a memory block 47 | std::string operator()(const void* data, size_t numBytes); 48 | /// compute SHA256 of a string, excluding final zero 49 | std::string operator()(const std::string& text); 50 | 51 | /// add arbitrary number of bytes 52 | void add(const void* data, size_t numBytes); 53 | 54 | /// return latest hash as 64 hex characters 55 | std::string getHash(); 56 | /// return latest hash as bytes 57 | void getHash(unsigned char buffer[HashBytes]); 58 | 59 | /// restart 60 | void reset(); 61 | 62 | private: 63 | /// process 64 bytes 64 | void processBlock(const void* data); 65 | /// process everything left in the internal buffer 66 | void processBuffer(); 67 | 68 | /// size of processed data in bytes 69 | uint64_t m_numBytes; 70 | /// valid bytes in m_buffer 71 | size_t m_bufferSize; 72 | /// bytes not processed yet 73 | uint8_t m_buffer[BlockSize]; 74 | 75 | enum { HashValues = HashBytes / 4 }; 76 | /// hash, stored as integers 77 | uint32_t m_hash[HashValues]; 78 | }; 79 | -------------------------------------------------------------------------------- /tests/windows_shaders_precompile/shaders.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | std::vector BuildDX10VertexShader(); 8 | std::vector BuildDX10PixelShader(); 9 | std::vector BuildDX10RGBAPixelShader(); 10 | 11 | std::vector BuildDX11VertexShader(D3D_FEATURE_LEVEL feature_level); 12 | std::vector BuildDX11PixelShader(D3D_FEATURE_LEVEL feature_level); 13 | 14 | std::vector BuildDX12VertexShader(); 15 | std::vector BuildDX12PixelShader(); --------------------------------------------------------------------------------