Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulkan renderer support #59

Open
wants to merge 103 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
7f4acba
Fixing shaders to only have used vertex inputs
jherico Oct 23, 2018
5c55a89
Change descriptor declarations
jherico Oct 28, 2018
433229e
Put vertex frequency in channel
jherico Oct 22, 2018
4b96341
Remove unused uniform commands
jherico Oct 22, 2018
65488ee
skinned mesh shader cleanup
jherico Oct 28, 2018
21bae4e
GPU state cleanup
jherico Oct 28, 2018
f222e99
Fixup shader interfaces
jherico Oct 29, 2018
809ee8b
Vulkan library
jherico Oct 29, 2018
51c541b
Buffer usage flags
jherico Oct 29, 2018
6eb9204
Plugin gpu backend access
jherico Oct 29, 2018
9ab501d
Add renderpass abstraction
jherico Oct 29, 2018
c0eefd2
Fixing vulkan playback
jherico Oct 29, 2018
2b7eb6f
Add vulkan backend
jherico Nov 10, 2018
fca6b8a
fixup: VkBackend: glColor4f is no more.
lubosz Mar 29, 2024
9b9d061
.
jherico Nov 12, 2018
3e25f23
rebase and shader fixes
jherico Jun 30, 2019
74a3f1e
Vulkan/opengl transfer test
jherico Jul 1, 2019
9afd293
Post-merge fixes to shaders
ksuprynowicz Dec 26, 2021
15f1688
Remove non-standard template specialization, fix QT includes
ksuprynowicz Dec 26, 2021
2bf9546
Changes necessary to build Vulkan branch updated to current master br…
ksuprynowicz Jan 9, 2022
7d19083
Changes necessary to build Vulkan gpu-frame-player
ksuprynowicz Jan 9, 2022
0bbe9de
Vulkan window now works on X11
ksuprynowicz Apr 30, 2022
4fb4d5a
Reverted window flags
ksuprynowicz May 1, 2022
7ed839a
paintStoke: Enable declaration on forward renderer.
lubosz Mar 29, 2024
affd297
FIXUP: libraries: Missing buffer usage constructors.
lubosz Mar 29, 2024
60716b6
Shaders: DEFAULT_DIALECT can only be extern or static.
lubosz Mar 29, 2024
8dcf14d
Renderpass: Include <stdexcept> for std::runtime error.
lubosz Mar 29, 2024
636833b
build/gpu-frame-player: Link Vulkan library for GL case.
lubosz Mar 29, 2024
5c33e73
VmaImplementation: Include stdio.
lubosz Mar 29, 2024
4556edd
vk/Pipelines: Unpack pipeline result.
lubosz Mar 29, 2024
18d9254
Moved to Vulkan C API and updated VKS
ksuprynowicz Aug 4, 2024
ab02470
Modified GPU frame player for Vukan C API
ksuprynowicz Aug 9, 2024
0c0d7bc
Enable Vulkan backend in Interface
ksuprynowicz Aug 10, 2024
17dadf3
Fix Vulkan validation
ksuprynowicz Aug 10, 2024
7efa6e3
Fixed Vulkan extensions
ksuprynowicz Aug 11, 2024
f90b19a
Created files for Vulkan display plugin
ksuprynowicz Aug 12, 2024
1e563b4
VKWindow fixes
ksuprynowicz Aug 12, 2024
e74190c
Fixed present thread names
ksuprynowicz Aug 13, 2024
46961d9
Vulkan fixes
ksuprynowicz Aug 16, 2024
163e6c3
GPU frame player and other fixes
ksuprynowicz Aug 22, 2024
1168b8f
Vulkan shader fixes
ksuprynowicz Aug 27, 2024
f79ba49
Vulkan backend work
ksuprynowicz Sep 8, 2024
4a8016e
Vulkan renderpass work
ksuprynowicz Sep 13, 2024
5c75025
Vulkan work on framebuffers and textures
ksuprynowicz Sep 16, 2024
9ea7410
Vulkan buffer work, upgrade VMA
ksuprynowicz Oct 1, 2024
cfffb7b
Work on Vulkan draw call info buffer
ksuprynowicz Nov 8, 2024
b350da5
Vulkan descriptor sets work
ksuprynowicz Nov 15, 2024
6b3a63a
Fixed vertex and index buffers
ksuprynowicz Nov 17, 2024
f95e8e2
Initial texture transfer functionality
ksuprynowicz Dec 2, 2024
48b4781
Fix descriptors
ksuprynowicz Dec 3, 2024
498ebfc
Vulkan texture binding fixes, cubemap support
ksuprynowicz Dec 4, 2024
792dfc5
Per-frame cleanup
ksuprynowicz Dec 6, 2024
83ef046
Fixed render pass clear operations
ksuprynowicz Dec 6, 2024
a05b640
First run of Interface on Vulkan
ksuprynowicz Dec 7, 2024
de29614
Fix stencil tests on Vulkan
ksuprynowicz Dec 7, 2024
7581acb
Add alpha blending to Vulkan backend
ksuprynowicz Dec 7, 2024
bacc4de
Post-rebase fixes for Vulkan
ksuprynowicz Dec 7, 2024
dc7ea1f
Fixed skeletal animation on Vulkan
ksuprynowicz Dec 8, 2024
f8df9e7
Buffer and validation fixes
ksuprynowicz Dec 8, 2024
d31c5d5
Add Vulkan dependencies to VCPKG.
JulianGro Dec 13, 2024
4da905f
Cleanup and fix for reflections
ksuprynowicz Dec 13, 2024
1aaf2db
Add Vulkan loader.
JulianGro Dec 14, 2024
475af7c
Use Vulkan VCPKG only on Windows.
JulianGro Dec 14, 2024
db10a86
Vulkan backend cleanup
ksuprynowicz Dec 15, 2024
2c940c6
Vulkan objects cleanup
ksuprynowicz Dec 20, 2024
7c492da
Vulkan backend cleanup
ksuprynowicz Dec 14, 2024
074bda3
Fix includes
ksuprynowicz Dec 20, 2024
46d5613
Vulkan texture fixes and cleanup
ksuprynowicz Dec 24, 2024
007e5ed
Vulkan bugfixes
ksuprynowicz Dec 25, 2024
b6dde09
Add missing spirv-tools file
ksuprynowicz Dec 25, 2024
d1bbf9d
Fix particles on Vulkan
ksuprynowicz Dec 25, 2024
8000294
Fix stride issue in Vulkan backend
ksuprynowicz Dec 26, 2024
e1e08af
Add padding for vertex buffers to keep alignment
ksuprynowicz Dec 26, 2024
80e62f5
Add glUniform emulation
ksuprynowicz Dec 26, 2024
0d00f33
Vulkan backend refactor
ksuprynowicz Dec 27, 2024
c1e266e
Add Vulkan-OpenGL texture sharing, shader fixes
ksuprynowicz Dec 28, 2024
7b103e0
Texture sharing between OpenGL and Vulkan
ksuprynowicz Dec 30, 2024
0cde5d9
Work on Vulkan framebuffer attachment layouts
ksuprynowicz Jan 1, 2025
2d3ac6c
Switch to tonemapped output
ksuprynowicz Jan 1, 2025
2a84eea
Fix UI on Vulkan
ksuprynowicz Jan 1, 2025
585c582
Vulkan framebuffer and texture handling enhancements
ksuprynowicz Jan 3, 2025
352073e
Vulkan deferred renderer fixes
ksuprynowicz Jan 5, 2025
984a506
Vulkan validation error fixes
ksuprynowicz Jan 6, 2025
a45d9c5
Default skybox for Vulkan backend
ksuprynowicz Jan 6, 2025
88c6520
Fix bloom in Vulkan
ksuprynowicz Jan 6, 2025
14abca6
Vulkan pipeline caching
ksuprynowicz Jan 7, 2025
dcb51fc
Fix haze initialization
ksuprynowicz Jan 7, 2025
4202741
Fix external texture memory leak
ksuprynowicz Jan 12, 2025
79c30b8
Fix Vulkan memory leaks
ksuprynowicz Jan 17, 2025
f46f57a
Vulkan cleanup on shutdown
ksuprynowicz Jan 19, 2025
7047ade
another possible fix for deferred mtoon haze issue
HifiExperiments Jan 19, 2025
1744878
Fix shapes rendering on Vulkan
ksuprynowicz Jan 24, 2025
cff6ae8
Add VKWidget files
ksuprynowicz Jan 25, 2025
edfab81
Initial work on rendering in main window, currently broken
ksuprynowicz Jan 29, 2025
5a20eef
Vulkan window work
ksuprynowicz Jan 30, 2025
f673829
Vulkan window continued
ksuprynowicz Jan 30, 2025
65d1123
Vulkan rendering in main game window
ksuprynowicz Jan 31, 2025
44d3d7b
Fix comiler warnings
ksuprynowicz Feb 6, 2025
05cf269
Fix UI input on Vulkan
ksuprynowicz Feb 8, 2025
2adf2d8
Vulkan window resizing
ksuprynowicz Feb 9, 2025
94c6edf
Vulkan optimizations (shader reflections)
ksuprynowicz Feb 14, 2025
9c1fca9
Vulkan performance optimizations
ksuprynowicz Feb 15, 2025
f056128
Fixed mipmaps on Vulkan
ksuprynowicz Feb 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 9 additions & 0 deletions android/libraries/oculus/src/main/assets/shaders/present.vert
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,21 @@ layout(location = 0) out vec4 vTexCoordLR;

void main(void) {
const float depth = 0.0;
#ifdef VULKAN
const vec4 UNIT_QUAD[4] = vec4[4](
vec4(-1.0, 1.0, depth, 1.0),
vec4(1.0, 1.0, depth, 1.0),
vec4(-1.0, -1.0, depth, 1.0),
vec4(1.0, -1.0, depth, 1.0)
);
#else
const vec4 UNIT_QUAD[4] = vec4[4](
vec4(-1.0, -1.0, depth, 1.0),
vec4(1.0, -1.0, depth, 1.0),
vec4(-1.0, 1.0, depth, 1.0),
vec4(1.0, 1.0, depth, 1.0)
);
#endif
vec4 pos = UNIT_QUAD[gl_VertexID];
gl_Position = pos;
vTexCoordLR.xy = pos.xy;
Expand Down
2 changes: 1 addition & 1 deletion cmake/compiler.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if (NOT "${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
Expand Down
29 changes: 17 additions & 12 deletions cmake/macros/AutoScribeShader.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,17 @@ macro(AUTOSCRIBE_SHADER)
AUTOSCRIBE_APPEND_QRC("${SHADER_COUNT}/name" "${SHADER_NAME_FILE}")

if (USE_GLES)
set(SPIRV_CROSS_ARGS --version 310es)
AUTOSCRIBE_PLATFORM_SHADER("310es")
AUTOSCRIBE_PLATFORM_SHADER("310es/stereo")
else()
set(SPIRV_CROSS_ARGS --version 320es)
AUTOSCRIBE_PLATFORM_SHADER("320es")
AUTOSCRIBE_PLATFORM_SHADER("320es/stereo")
elseif(APPLE)
set(SPIRV_CROSS_ARGS --version 410 --no-420pack-extension)
AUTOSCRIBE_PLATFORM_SHADER("410")
AUTOSCRIBE_PLATFORM_SHADER("410/stereo")
if (NOT APPLE)
set(SPIRV_CROSS_ARGS --version 450)
AUTOSCRIBE_PLATFORM_SHADER("450")
AUTOSCRIBE_PLATFORM_SHADER("450/stereo")
endif()
else()
set(SPIRV_CROSS_ARGS --version 450)
AUTOSCRIBE_PLATFORM_SHADER("450")
AUTOSCRIBE_PLATFORM_SHADER("450/stereo")
endif()

string(CONCAT SHADER_LIST "${SHADER_LIST}" "${SHADER_NAME} = ${SHADER_COUNT},\n")
Expand Down Expand Up @@ -407,12 +406,18 @@ macro(AUTOSCRIBE_SHADER_LIBS)
configure_file(shaders.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/shaders.qrc)
list(APPEND QT_RESOURCES_FILE ${CMAKE_CURRENT_BINARY_DIR}/shaders.qrc)

list(APPEND AUTOSCRIBE_SHADER_HEADERS ${AUTOSCRIBE_HEADER_DIR}/mono.glsl ${AUTOSCRIBE_HEADER_DIR}/stereo.glsl)
list(APPEND AUTOSCRIBE_SHADER_HEADERS ${AUTOSCRIBE_HEADER_DIR}/450/header.glsl ${AUTOSCRIBE_HEADER_DIR}/410/header.glsl ${AUTOSCRIBE_HEADER_DIR}/310es/header.glsl)
list(APPEND AUTOSCRIBE_SHADER_HEADERS
${AUTOSCRIBE_HEADER_DIR}/mono.glsl
${AUTOSCRIBE_HEADER_DIR}/stereo.glsl
${AUTOSCRIBE_HEADER_DIR}/450/header.glsl
${AUTOSCRIBE_HEADER_DIR}/410/header.glsl
${AUTOSCRIBE_HEADER_DIR}/320es/header.glsl
)

source_group("Shader Headers" FILES ${AUTOSCRIBE_HEADER_DIR}/mono.glsl ${AUTOSCRIBE_HEADER_DIR}/stereo.glsl)
source_group("Shader Headers\\450" FILES ${AUTOSCRIBE_HEADER_DIR}/450/header.glsl)
source_group("Shader Headers\\410" FILES ${AUTOSCRIBE_HEADER_DIR}/410/header.glsl)
source_group("Shader Headers\\310es" FILES ${AUTOSCRIBE_HEADER_DIR}/310es/header.glsl)
source_group("Shader Headers\\320es" FILES ${AUTOSCRIBE_HEADER_DIR}/320es/header.glsl)

list(APPEND AUTOSCRIBE_SHADER_LIB_SRC ${AUTOSCRIBE_SHADER_HEADERS})
list(APPEND AUTOSCRIBE_SHADER_LIB_SRC ${CMAKE_CURRENT_BINARY_DIR}/ShaderEnums.h ${CMAKE_CURRENT_BINARY_DIR}/ShaderEnums.cpp)
Expand Down
4 changes: 3 additions & 1 deletion cmake/macros/TargetVulkan.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#
macro(TARGET_VULKAN)
find_package(Vulkan REQUIRED)
find_package(Qt5 COMPONENTS X11Extras REQUIRED)
target_include_directories(${TARGET_NAME} PRIVATE ${VULKAN_INCLUDE_DIR})
target_link_libraries(${TARGET_NAME} ${VULKAN_LIBRARY})
endmacro()
target_link_libraries(${TARGET_NAME} ${Qt5X11Extras_LIBRARIES})
endmacro()
16 changes: 16 additions & 0 deletions cmake/modules/FindVulkan.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
if (WIN32)
find_path(VULKAN_INCLUDE_DIR NAMES vulkan/vulkan.h HINTS "$ENV{VULKAN_SDK}/Include" "$ENV{VK_SDK_PATH}/Include")
if (CMAKE_CL_64)
find_library(VULKAN_LIBRARY NAMES vulkan-1 HINTS "$ENV{VULKAN_SDK}/Lib" "$ENV{VK_SDK_PATH}/Bin")
else()
find_library(VULKAN_LIBRARY NAMES vulkan-1 HINTS "$ENV{VULKAN_SDK}/Lib32" "$ENV{VK_SDK_PATH}/Bin32")
endif()
else()
find_path(VULKAN_INCLUDE_DIR NAMES vulkan/vulkan.h HINTS "$ENV{VULKAN_SDK}/include")
find_library(VULKAN_LIBRARY NAMES vulkan HINTS
"$ENV{VULKAN_SDK}/lib")
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Vulkan DEFAULT_MSG VULKAN_LIBRARY VULKAN_INCLUDE_DIR)
mark_as_advanced(VULKAN_INCLUDE_DIR VULKAN_LIBRARY)
2 changes: 1 addition & 1 deletion cmake/ports/hifi-client-deps/CONTROL
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Source: hifi-client-deps
Version: 0.1
Description: Collected dependencies for High Fidelity applications
Build-Depends: hifi-deps, aristo (windows), glslang, liblo (windows), nlohmann-json, openvr ((linux&!arm)|windows), quazip (!android), sdl2 (!android), spirv-cross (!android), spirv-tools (!android), sranipal (windows), vulkanmemoryallocator, discord-rpc (!android)
Build-Depends: hifi-deps, aristo (windows), glslang, liblo (windows), nlohmann-json, openvr ((linux&!arm)|windows), quazip (!android), sdl2 (!android), spirv-cross (!android), spirv-tools (!android), sranipal (windows), vulkanmemoryallocator, vulkan (windows), vulkan-validationlayers (windows), discord-rpc (!android)
12 changes: 12 additions & 0 deletions cmake/ports/mimalloc/add_ref_to_page_malloc_zero.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/src/alloc.c b/src/alloc.c
index 86aaae75..b543e859 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -584,6 +584,7 @@ mi_decl_nodiscard void* mi_new_reallocn(void* p, size_t newcount, size_t size) {
#ifdef __cplusplus
void* _mi_externs[] = {
(void*)&_mi_page_malloc,
+ (void*)&_mi_page_malloc_zero,
(void*)&_mi_heap_malloc_zero,
(void*)&_mi_heap_malloc_zero_ex,
(void*)&mi_malloc,
17 changes: 17 additions & 0 deletions cmake/ports/mimalloc/fix-cmake.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bcfe91d8..a1e5a2b7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -471,10 +471,10 @@ if(MI_BUILD_SHARED)
add_custom_command(TARGET mimalloc POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/bin/mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.dll" $<TARGET_FILE_DIR:mimalloc>
COMMENT "Copy mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.dll to output directory")
- install(FILES "$<TARGET_FILE_DIR:mimalloc>/mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.dll" DESTINATION ${mi_install_bindir})
+ install(FILES "$<TARGET_FILE_DIR:mimalloc>/mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.dll" DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()

- install(TARGETS mimalloc EXPORT mimalloc ARCHIVE DESTINATION ${mi_install_libdir} RUNTIME DESTINATION ${mi_install_bindir} LIBRARY DESTINATION ${mi_install_libdir})
+ install(TARGETS mimalloc EXPORT mimalloc ARCHIVE DESTINATION ${mi_install_libdir} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${mi_install_libdir})
install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir})
endif()

13 changes: 13 additions & 0 deletions cmake/ports/mimalloc/fix-param.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/arena.c b/src/arena.c
index 648ee84..ee55989 100644
--- a/src/arena.c
+++ b/src/arena.c
@@ -794,7 +794,7 @@ bool _mi_arena_segment_clear_abandoned(mi_segment_t* segment )
// clears the thread_id.
void _mi_arena_segment_mark_abandoned(mi_segment_t* segment)
{
- mi_atomic_store_release(&segment->thread_id, 0);
+ mi_atomic_store_release(&segment->thread_id, (uintptr_t)0);
mi_assert_internal(segment->used == segment->abandoned);
if (segment->memid.memkind != MI_MEM_ARENA) {
// not in an arena; count it as abandoned and return
74 changes: 74 additions & 0 deletions cmake/ports/mimalloc/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO microsoft/mimalloc
REF "v${VERSION}"
SHA512 4e30976758015c76a146acc1bfc8501e2e5c61b81db77d253de0d58a8edef987669243f232210667b32ef8da3a33286642acb56ba526fd24c4ba925b44403730
HEAD_REF master
PATCHES
fix-cmake.patch
add_ref_to_page_malloc_zero.patch
fix-param.patch
)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
asm MI_SEE_ASM
secure MI_SECURE
override MI_OVERRIDE
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" MI_BUILD_STATIC)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" MI_BUILD_SHARED)

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS_DEBUG
-DMI_DEBUG_FULL=ON
OPTIONS_RELEASE
-DMI_DEBUG_FULL=OFF
OPTIONS
-DMI_USE_CXX=ON
-DMI_BUILD_TESTS=OFF
-DMI_BUILD_OBJECT=OFF
${FEATURE_OPTIONS}
-DMI_BUILD_STATIC=${MI_BUILD_STATIC}
-DMI_BUILD_SHARED=${MI_BUILD_SHARED}
-DMI_INSTALL_TOPLEVEL=ON
)

vcpkg_cmake_install()

vcpkg_copy_pdbs()

file(COPY
"${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake"
"${CMAKE_CURRENT_LIST_DIR}/usage"
DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}"
)
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/mimalloc)

if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
vcpkg_replace_string(
"${CURRENT_PACKAGES_DIR}/include/mimalloc.h"
"!defined(MI_SHARED_LIB)"
"0 // !defined(MI_SHARED_LIB)"
)
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")

vcpkg_fixup_pkgconfig()
set(mi_basename "mimalloc")
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "static")
string(APPEND mi_basename "-static")
endif()
if("secure" IN_LIST FEATURES)
string(APPEND mi_basename "-secure")
endif()
if(NOT "mimalloc" STREQUAL "${mi_basename}")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/mimalloc.pc" " -lmimalloc" " -l${mi_basename}")
endif()
if(NOT VCPKG_BUILD_TYPE)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/mimalloc.pc" " -lmimalloc" " -l${mi_basename}-debug")
endif()

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
9 changes: 9 additions & 0 deletions cmake/ports/mimalloc/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
mimalloc provides CMake targets:

find_package(mimalloc CONFIG REQUIRED)
target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:mimalloc-static>,mimalloc-static,mimalloc>)

To ensure the mimalloc-override.dll is loaded at runtime on Windows with
dynamic linkage, it is suggested to insert some call to the mimalloc API
in the main function, eg. `mi_version()`. Cf.
https://github.com/microsoft/mimalloc/blob/dev/readme.md#dynamic-override-on-windows
21 changes: 21 additions & 0 deletions cmake/ports/mimalloc/vcpkg-cmake-wrapper.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
_find_package(${ARGS})

if(CMAKE_CURRENT_LIST_DIR STREQUAL "${MIMALLOC_CMAKE_DIR}/${MIMALLOC_VERSION_DIR}")
set(MIMALLOC_INCLUDE_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include")
# As in vcpkg.cmake
if(NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE MATCHES "^[Dd][Ee][Bb][Uu][Gg]$")
set(MIMALLOC_LIBRARY_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib")
else()
set(MIMALLOC_LIBRARY_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib")
endif()
set(MIMALLOC_OBJECT_DIR "MIMALLOC_OBJECT_DIR-NOTFOUND") # not installed
set(MIMALLOC_TARGET_DIR "${MIMALLOC_LIBRARY_DIR}")
endif()

if(TARGET mimalloc AND NOT TARGET mimalloc-static)
add_library(mimalloc-static INTERFACE IMPORTED)
set_target_properties(mimalloc-static PROPERTIES INTERFACE_LINK_LIBRARIES mimalloc)
elseif(TARGET mimalloc-static AND NOT TARGET mimalloc)
add_library(mimalloc INTERFACE IMPORTED)
set_target_properties(mimalloc PROPERTIES INTERFACE_LINK_LIBRARIES mimalloc-static)
endif()
30 changes: 30 additions & 0 deletions cmake/ports/mimalloc/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "mimalloc",
"version": "2.1.7",
"port-version": 1,
"description": "Compact general purpose allocator with excellent performance",
"homepage": "https://github.com/microsoft/mimalloc",
"license": "MIT",
"supports": "!uwp",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"features": {
"asm": {
"description": "Generate assembly files"
},
"override": {
"description": "Override the standard malloc interface"
},
"secure": {
"description": "Use security mitigations (like guard pages and randomization)"
}
}
}
26 changes: 26 additions & 0 deletions cmake/ports/robin-hood-hashing/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO martinus/robin-hood-hashing
REF 3.11.5
SHA512 5f73e089b1e8ec41a9bedded22bc64a789d3a3d04873a2ad9f8cc2970797a473b0f4d3436c2324b3ced85a0d983998a75b1dfaf2b7f3b77235b29806ff2fd489
HEAD_REF master
)

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DRH_STANDALONE_PROJECT=OFF
)

vcpkg_cmake_install()
vcpkg_cmake_config_fixup(
PACKAGE_NAME robin_hood
CONFIG_PATH lib/cmake/robin_hood
)

file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug"
"${CURRENT_PACKAGES_DIR}/lib"
)

file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
16 changes: 16 additions & 0 deletions cmake/ports/robin-hood-hashing/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "robin-hood-hashing",
"version": "3.11.5",
"description": "Fast & memory efficient hashtable based on robin hood hashing for C++11/14/17/20",
"homepage": "https://github.com/martinus/robin-hood-hashing",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
20 changes: 20 additions & 0 deletions cmake/ports/spirv-headers/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO KhronosGroup/SPIRV-Headers
REF "vulkan-sdk-${VERSION}"
SHA512 b4f975d3051eda41ef5c3a6efc832607a165adfd6f43d7af171d2c0446b227bdcb5de0017a081fa9e7a3d2710ba8583fadbc06c0a364043b2778b02818d01040
HEAD_REF master
)

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug")

vcpkg_fixup_pkgconfig()

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
16 changes: 16 additions & 0 deletions cmake/ports/spirv-headers/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "spirv-headers",
"version": "1.3.296.0",
"description": "Machine-readable files for the SPIR-V Registry",
"homepage": "https://github.com/KhronosGroup/SPIRV-Headers",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
Loading
Loading