Skip to content

Commit 86bacfd

Browse files
committed
Added a simple compilation test and linux CI
Compilation test is required because the smaple is windows-specific. Linux CI is needed because pull requests must stop breaking linux builds.
1 parent de8e657 commit 86bacfd

File tree

5 files changed

+99
-8
lines changed

5 files changed

+99
-8
lines changed

.github/workflows/linux.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: linux
2+
3+
on: [push, pull_request]
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
cxx: [g++-12, clang++-15]
14+
build_type: [Debug, Release]
15+
include:
16+
- cxx: g++-12
17+
install: sudo apt install g++-12
18+
- cxx: clang++-15
19+
cxxflags: -stdlib=libc++
20+
install: sudo apt install clang-15 libc++-15-dev libc++abi-15-dev
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Prepare Vulkan SDK
26+
uses: humbletim/[email protected]
27+
with:
28+
version: 1.3.290.0
29+
cache: true
30+
31+
- name: Create Build Environment
32+
run: |
33+
sudo apt update
34+
${{matrix.install}}
35+
cmake -E make_directory ${{runner.workspace}}/build
36+
37+
- name: Configure
38+
working-directory: ${{runner.workspace}}/build
39+
env:
40+
CXX: ${{matrix.cxx}}
41+
CXXFLAGS: ${{matrix.cxxflags}}
42+
run: |
43+
cmake -DCPM_SOURCE_CACHE=~/cpm-cache \
44+
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
45+
-DVMA_BUILD_SAMPLES=YES \
46+
$GITHUB_WORKSPACE
47+
48+
- name: Build
49+
working-directory: ${{runner.workspace}}/build
50+
run: |
51+
threads=`nproc`
52+
cmake --build . --target VmaCompilationTest --config ${{matrix.build_type}} --parallel $threads

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,6 @@ if (VMA_ENABLE_INSTALL)
4545
option(VMA_BUILD_SAMPLES "Build samples")
4646
if (VMA_BUILD_SAMPLES)
4747
add_subdirectory(src)
48+
add_subdirectory(compilation_test)
4849
endif()
4950
endif()

compilation_test/CMakeLists.txt

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#
2+
# Copyright (c) 2017-2024 Advanced Micro Devices, Inc. All rights reserved.
3+
#
4+
# Permission is hereby granted, free of charge, to any person obtaining a copy
5+
# of this software and associated documentation files (the "Software"), to deal
6+
# in the Software without restriction, including without limitation the rights
7+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
# copies of the Software, and to permit persons to whom the Software is
9+
# furnished to do so, subject to the following conditions:
10+
#
11+
# The above copyright notice and this permission notice shall be included in
12+
# all copies or substantial portions of the Software.
13+
#
14+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
# THE SOFTWARE.
21+
#
22+
23+
24+
set(CMAKE_CXX_STANDARD 17)
25+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
26+
set(CMAKE_CXX_EXTENSIONS OFF)
27+
28+
find_package(Vulkan REQUIRED)
29+
30+
add_library(VmaCompilationTest)
31+
target_sources(VmaCompilationTest PRIVATE vma_impl.cpp)
32+
33+
target_link_libraries(VmaCompilationTest PRIVATE GPUOpen::VulkanMemoryAllocator)
34+
35+
target_link_libraries(VmaCompilationTest PUBLIC Vulkan::Vulkan)
36+

compilation_test/vma_impl.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#define VMA_IMPLEMENTATION
2+
#include <vk_mem_alloc.h>

include/vk_mem_alloc.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,17 +1467,17 @@ typedef struct VmaAllocationInfo
14671467
typedef struct VmaAllocationInfo2
14681468
{
14691469
/** \brief Basic parameters of the allocation.
1470-
1470+
14711471
If you need only these, you can use function vmaGetAllocationInfo() and structure #VmaAllocationInfo instead.
14721472
*/
14731473
VmaAllocationInfo allocationInfo;
14741474
/** \brief Size of the `VkDeviceMemory` block that the allocation belongs to.
1475-
1475+
14761476
In case of an allocation with dedicated memory, it will be equal to `allocationInfo.size`.
14771477
*/
14781478
VkDeviceSize blockSize;
14791479
/** \brief `VK_TRUE` if the allocation has dedicated memory, `VK_FALSE` if it was placed as part of a larger memory block.
1480-
1480+
14811481
When `VK_TRUE`, it also means `VkMemoryDedicatedAllocateInfo` was used when creating the allocation
14821482
(if VK_KHR_dedicated_allocation extension or Vulkan version >= 1.1 is enabled).
14831483
*/
@@ -2567,7 +2567,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateAliasingBuffer(
25672567
\param allocator
25682568
\param allocation Allocation that provides memory to be used for binding new buffer to it.
25692569
\param allocationLocalOffset Additional offset to be added while binding, relative to the beginning of the allocation. Normally it should be 0.
2570-
\param pBufferCreateInfo
2570+
\param pBufferCreateInfo
25712571
\param[out] pBuffer Buffer that was created.
25722572

25732573
This function automatically:
@@ -6195,7 +6195,7 @@ class VmaWin32Handle
61956195
HANDLE m_hHandle;
61966196
VMA_RW_MUTEX m_Mutex; // Protects access m_Handle
61976197
};
6198-
#else
6198+
#else
61996199
class VmaWin32Handle
62006200
{
62016201
// ABI compatibility
@@ -10594,7 +10594,7 @@ VmaDeviceMemoryBlock::VmaDeviceMemoryBlock(VmaAllocator hAllocator)
1059410594
m_hMemory(VK_NULL_HANDLE),
1059510595
m_MapCount(0),
1059610596
m_pMappedData(VMA_NULL),
10597-
m_Handle(VMA_NULL) {}
10597+
m_Handle() {}
1059810598

1059910599
VmaDeviceMemoryBlock::~VmaDeviceMemoryBlock()
1060010600
{
@@ -16675,7 +16675,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaGetMemoryWin32Handle(VmaAllocator VMA_NOT
1667516675
VMA_DEBUG_GLOBAL_MUTEX_LOCK;
1667616676
return allocation->GetWin32Handle(allocator, hTargetProcess, pHandle);
1667716677
}
16678-
#endif // VMA_EXTERNAL_MEMORY_WIN32
16678+
#endif // VMA_EXTERNAL_MEMORY_WIN32
1667916679
#endif // VMA_STATS_STRING_ENABLED
1668016680
#endif // _VMA_PUBLIC_INTERFACE
1668116681
#endif // VMA_IMPLEMENTATION
@@ -18929,7 +18929,7 @@ res = vmaCreateBuffer(g_Allocator, &bufCreateInfo, &allocCreateInfo, &buf, &allo
1892918929
vmaDestroyBuffer(g_Allocator, buf, alloc);
1893018930
\endcode
1893118931

18932-
If you need each allocation to have its own device memory block and start at offset 0, you can still do
18932+
If you need each allocation to have its own device memory block and start at offset 0, you can still do
1893318933
by using #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT flag. It works also with custom pools.
1893418934

1893518935
\section vk_khr_external_memory_win32_exporting_win32_handle Exporting Win32 handle

0 commit comments

Comments
 (0)