Skip to content

Commit

Permalink
Merge pull request #134 from crud89/x86-compat-fixes
Browse files Browse the repository at this point in the history
Fix Win32 build errors.
  • Loading branch information
crud89 authored Jul 15, 2024
2 parents e600830 + a59a1fa commit b1043f1
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 33 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,19 @@ jobs:
uses: lukka/run-cmake@v10
with:
cmakeListsTxtPath: '${{ github.workspace }}/src/CMakeLists.txt'
configurePreset: '${{ matrix.profile }}-publish'
buildPreset: '${{ matrix.profile }}-publish'
configurePreset: '${{ matrix.profile }}-release'
buildPreset: '${{ matrix.profile }}-release'

- name: Upload build artifacts (Release)
uses: actions/upload-artifact@v3
if: failure()
with:
name: LiteFX-${{ matrix.triplet }}-build-rel
path: '${{ github.workspace }}/out/build/${{ matrix.profile }}-publish'
path: '${{ github.workspace }}/out/build/${{ matrix.profile }}-release'

- name: Install with CMake (Release)
run: |
Set-Location '${{ github.workspace }}/out/build/${{ matrix.profile }}-publish'
Set-Location '${{ github.workspace }}/out/build/${{ matrix.profile }}-release'
cmake --install .
- name: Sign binaries
Expand All @@ -122,7 +122,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: LiteFX-${{ matrix.triplet }}-install
path: '${{ github.workspace }}/out/install/${{ matrix.profile }}-publish'
path: '${{ github.workspace }}/out/install/${{ matrix.profile }}-release'
if-no-files-found: error

publish:
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ windows-latest ]
profile: [ windows-x64, windows-x86 ]
include:
- os: windows-latest
- profile: windows-x64
triplet: x64-windows
configuration: windows-x64-publish
configuration: windows-x64-release
architecture: x64
- profile: windows-x86
triplet: x86-windows
configuration: windows-x86-release
architecture: x86

steps:
- name: Checking out sources
Expand Down
6 changes: 3 additions & 3 deletions src/Backends/DirectX12/src/blas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ void DirectX12BottomLevelAccelerationStructure::build(const DirectX12CommandBuff
else if (maxSize < requiredMemory) [[unlikely]]
throw ArgumentOutOfRangeException("maxSize", 0ull, maxSize, requiredMemory, "The maximum available size is not sufficient to contain the acceleration structure.");
else if (buffer->size() < offset + requiredMemory) [[unlikely]]
throw ArgumentOutOfRangeException("buffer", 0ull, buffer->size(), offset + requiredMemory, "The buffer does not contain enough memory after offset {0} to fully contain the acceleration structure.", offset);
throw ArgumentOutOfRangeException("buffer", 0ull, (UInt64)buffer->size(), offset + requiredMemory, "The buffer does not contain enough memory after offset {0} to fully contain the acceleration structure.", offset);

// Perform the build.
commandBuffer.buildAccelerationStructure(*this, scratchBuffer, *buffer, offset);
Expand Down Expand Up @@ -222,7 +222,7 @@ void DirectX12BottomLevelAccelerationStructure::update(const DirectX12CommandBuf
else if (maxSize < requiredMemory) [[unlikely]]
throw ArgumentOutOfRangeException("maxSize", 0ull, maxSize, requiredMemory, "The maximum available size is not sufficient to contain the acceleration structure.");
else if (buffer->size() < offset + requiredMemory) [[unlikely]]
throw ArgumentOutOfRangeException("buffer", 0ull, buffer->size(), offset + requiredMemory, "The buffer does not contain enough memory after offset {0} to fully contain the acceleration structure.", offset);
throw ArgumentOutOfRangeException("buffer", 0ull, (UInt64)buffer->size(), offset + requiredMemory, "The buffer does not contain enough memory after offset {0} to fully contain the acceleration structure.", offset);

// Perform the update.
commandBuffer.updateAccelerationStructure(*this, scratchBuffer, *buffer, offset);
Expand Down Expand Up @@ -257,7 +257,7 @@ void DirectX12BottomLevelAccelerationStructure::copy(const DirectX12CommandBuffe
if (buffer == nullptr)
buffer = destination.m_impl->m_buffer->size() >= requiredMemory ? destination.m_impl->m_buffer : device.factory().createBuffer(BufferType::AccelerationStructure, ResourceHeap::Resource, requiredMemory, 1, ResourceUsage::AllowWrite);
else if (buffer->size() < offset + requiredMemory) [[unlikely]]
throw ArgumentOutOfRangeException("buffer", 0ull, buffer->size(), offset + requiredMemory, "The buffer does not contain enough memory after offset {0} to fully contain the acceleration structure.", offset);
throw ArgumentOutOfRangeException("buffer", 0ull, (UInt64)buffer->size(), offset + requiredMemory, "The buffer does not contain enough memory after offset {0} to fully contain the acceleration structure.", offset);

// Store the buffer and the offset.
destination.m_impl->m_offset = offset;
Expand Down
3 changes: 3 additions & 0 deletions src/Backends/DirectX12/src/queue.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include <litefx/backends/dx12.hpp>

#if defined(LITEFX_BUILD_SUPPORT_DEBUG_MARKERS) && defined(LITEFX_BUILD_WITH_PIX_RUNTIME)
#include <pix3.h>
#endif defined(LITEFX_BUILD_SUPPORT_DEBUG_MARKERS) && defined(LITEFX_BUILD_WITH_PIX_RUNTIME)

using namespace LiteFX::Rendering::Backends;

Expand Down
3 changes: 3 additions & 0 deletions src/Backends/DirectX12/src/render_pass.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#include <litefx/backends/dx12.hpp>
#include <litefx/backends/dx12_builders.hpp>

#if defined(LITEFX_BUILD_SUPPORT_DEBUG_MARKERS) && defined(LITEFX_BUILD_WITH_PIX_RUNTIME)
#include <pix3.h>
#endif // defined(LITEFX_BUILD_SUPPORT_DEBUG_MARKERS) && defined(LITEFX_BUILD_WITH_PIX_RUNTIME)

using namespace LiteFX::Rendering::Backends;

Expand Down
4 changes: 2 additions & 2 deletions src/Backends/DirectX12/src/shader_program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,13 +486,13 @@ class DirectX12ShaderProgram::DirectX12ShaderProgramImpl : public Implement<Dire

co_yield makeUnique<DirectX12DescriptorSetLayout>(m_device, std::move(descriptors), descriptorSet.space, descriptorSet.stage);
}
}() | std::views::as_rvalue;
}() | std::views::as_rvalue | std::ranges::to<Enumerable<UniquePtr<DirectX12DescriptorSetLayout>>>();

// Create the push constants layout.
auto pushConstants = [&pushConstantRanges]() -> std::generator<UniquePtr<DirectX12PushConstantsRange>> {
for (auto range = pushConstantRanges.begin(); range != pushConstantRanges.end(); ++range)
co_yield makeUnique<DirectX12PushConstantsRange>(range->stage, range->offset, range->size, range->space, range->location);
}() | std::views::as_rvalue;
}() | std::views::as_rvalue | std::ranges::to<Enumerable<UniquePtr<DirectX12PushConstantsRange>>>();

auto overallSize = std::accumulate(pushConstantRanges.begin(), pushConstantRanges.end(), 0, [](UInt32 currentSize, const auto& range) { return currentSize + range.size; });
auto pushConstantsLayout = makeUnique<DirectX12PushConstantsLayout>(std::move(pushConstants), overallSize);
Expand Down
6 changes: 3 additions & 3 deletions src/Backends/DirectX12/src/tlas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void DirectX12TopLevelAccelerationStructure::build(const DirectX12CommandBuffer&
else if (maxSize < requiredMemory) [[unlikely]]
throw ArgumentOutOfRangeException("maxSize", 0ull, maxSize, requiredMemory, "The maximum available size is not sufficient to contain the acceleration structure.");
else if (buffer->size() < offset + requiredMemory) [[unlikely]]
throw ArgumentOutOfRangeException("buffer", 0ull, buffer->size(), offset + requiredMemory, "The buffer does not contain enough memory after offset {0} to fully contain the acceleration structure.", offset);
throw ArgumentOutOfRangeException("buffer", 0ull, (UInt64)buffer->size(), offset + requiredMemory, "The buffer does not contain enough memory after offset {0} to fully contain the acceleration structure.", offset);

// Perform the build.
commandBuffer.buildAccelerationStructure(*this, scratchBuffer, *buffer, offset);
Expand Down Expand Up @@ -186,7 +186,7 @@ void DirectX12TopLevelAccelerationStructure::update(const DirectX12CommandBuffer
else if (maxSize < requiredMemory) [[unlikely]]
throw ArgumentOutOfRangeException("maxSize", 0ull, maxSize, requiredMemory, "The maximum available size is not sufficient to contain the acceleration structure.");
else if (buffer->size() < offset + requiredMemory) [[unlikely]]
throw ArgumentOutOfRangeException("buffer", 0ull, buffer->size(), offset + requiredMemory, "The buffer does not contain enough memory after offset {0} to fully contain the acceleration structure.", offset);
throw ArgumentOutOfRangeException("buffer", 0ull, (UInt64)buffer->size(), offset + requiredMemory, "The buffer does not contain enough memory after offset {0} to fully contain the acceleration structure.", offset);

// Perform the update.
commandBuffer.updateAccelerationStructure(*this, scratchBuffer, *buffer, offset);
Expand Down Expand Up @@ -221,7 +221,7 @@ void DirectX12TopLevelAccelerationStructure::copy(const DirectX12CommandBuffer&
if (buffer == nullptr)
buffer = destination.m_impl->m_buffer->size() >= requiredMemory ? destination.m_impl->m_buffer : device.factory().createBuffer(BufferType::AccelerationStructure, ResourceHeap::Resource, requiredMemory, 1, ResourceUsage::AllowWrite);
else if (buffer->size() < offset + requiredMemory) [[unlikely]]
throw ArgumentOutOfRangeException("buffer", 0ull, buffer->size(), offset + requiredMemory, "The buffer does not contain enough memory after offset {0} to fully contain the acceleration structure.", offset);
throw ArgumentOutOfRangeException("buffer", 0ull, (UInt64)buffer->size(), offset + requiredMemory, "The buffer does not contain enough memory after offset {0} to fully contain the acceleration structure.", offset);

// Store the buffer and the offset.
destination.m_impl->m_offset = offset;
Expand Down
6 changes: 3 additions & 3 deletions src/Backends/Vulkan/src/blas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ void VulkanBottomLevelAccelerationStructure::build(const VulkanCommandBuffer& co
else if (maxSize < requiredMemory) [[unlikely]]
throw ArgumentOutOfRangeException("maxSize", 0ull, maxSize, requiredMemory, "The maximum available size is not sufficient to contain the acceleration structure.");
else if (buffer->size() < offset + requiredMemory) [[unlikely]]
throw ArgumentOutOfRangeException("buffer", 0ull, buffer->size(), offset + requiredMemory, "The buffer does not contain enough memory after offset {0} to fully contain the acceleration structure.", offset);
throw ArgumentOutOfRangeException("buffer", 0ull, (UInt64)buffer->size(), offset + requiredMemory, "The buffer does not contain enough memory after offset {0} to fully contain the acceleration structure.", offset);

// If the acceleration structure allows for compaction, create a query pool in order to query the compacted size later.
if (LITEFX_FLAG_IS_SET(m_impl->m_flags, AccelerationStructureFlags::AllowCompaction))
Expand Down Expand Up @@ -229,7 +229,7 @@ void VulkanBottomLevelAccelerationStructure::update(const VulkanCommandBuffer& c
else if (maxSize < requiredMemory) [[unlikely]]
throw ArgumentOutOfRangeException("maxSize", 0ull, maxSize, requiredMemory, "The maximum available size is not sufficient to contain the acceleration structure.");
else if (buffer->size() < offset + requiredMemory) [[unlikely]]
throw ArgumentOutOfRangeException("buffer", 0ull, buffer->size(), offset + requiredMemory, "The buffer does not contain enough memory after offset {0} to fully contain the acceleration structure.", offset);
throw ArgumentOutOfRangeException("buffer", 0ull, (UInt64)buffer->size(), offset + requiredMemory, "The buffer does not contain enough memory after offset {0} to fully contain the acceleration structure.", offset);

// If the acceleration structure allows for compaction, reset the query pool.
if (LITEFX_FLAG_IS_SET(m_impl->m_flags, AccelerationStructureFlags::AllowCompaction))
Expand Down Expand Up @@ -280,7 +280,7 @@ void VulkanBottomLevelAccelerationStructure::copy(const VulkanCommandBuffer& com
if (buffer == nullptr)
buffer = destination.m_impl->m_buffer->size() >= requiredMemory[0] ? destination.m_impl->m_buffer : device.factory().createBuffer(BufferType::AccelerationStructure, ResourceHeap::Resource, requiredMemory[0], 1, ResourceUsage::AllowWrite);
else if (buffer->size() < offset + requiredMemory[0]) [[unlikely]]
throw ArgumentOutOfRangeException("buffer", 0ull, buffer->size(), offset + requiredMemory[0], "The buffer does not contain enough memory after offset {0} to fully contain the acceleration structure.", offset);
throw ArgumentOutOfRangeException("buffer", 0ull, (UInt64)buffer->size(), offset + requiredMemory[0], "The buffer does not contain enough memory after offset {0} to fully contain the acceleration structure.", offset);

// Create or reset query pool on destination, if required.
if (LITEFX_FLAG_IS_SET(destination.flags(), AccelerationStructureFlags::AllowCompaction))
Expand Down
2 changes: 1 addition & 1 deletion src/Backends/Vulkan/src/queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class VulkanQueue::VulkanQueueImpl : public Implement<VulkanQueue> {
{
m_submittedCommandBuffers.clear();

if (m_timelineSemaphore != nullptr)
if (m_timelineSemaphore != VK_NULL_HANDLE)
::vkDestroySemaphore(m_device.handle(), m_timelineSemaphore, nullptr);

m_timelineSemaphore = {};
Expand Down
4 changes: 2 additions & 2 deletions src/Backends/Vulkan/src/shader_program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,13 +342,13 @@ class VulkanShaderProgram::VulkanShaderProgramImpl : public Implement<VulkanShad

co_yield makeUnique<VulkanDescriptorSetLayout>(m_device, std::move(descriptorLayouts), descriptorSet.space, descriptorSet.stage);
}
}() | std::views::as_rvalue;
}() | std::views::as_rvalue | std::ranges::to<Enumerable<UniquePtr<VulkanDescriptorSetLayout>>>();

// Create the push constants layout.
auto pushConstants = [&pushConstantRanges]() -> std::generator<UniquePtr<VulkanPushConstantsRange>> {
for (auto it = pushConstantRanges.begin(); it != pushConstantRanges.end(); ++it)
co_yield makeUnique<VulkanPushConstantsRange>(it->stage, it->offset, it->size, 0, 0); // No space or binding for Vulkan push constants.
}() | std::views::as_rvalue;
}() | std::views::as_rvalue | std::ranges::to<Enumerable<UniquePtr<VulkanPushConstantsRange>>>();

auto overallSize = std::accumulate(pushConstantRanges.begin(), pushConstantRanges.end(), 0, [](UInt32 currentSize, const auto& range) { return currentSize + range.size; });
auto pushConstantsLayout = makeUnique<VulkanPushConstantsLayout>(std::move(pushConstants), overallSize);
Expand Down
6 changes: 3 additions & 3 deletions src/Backends/Vulkan/src/tlas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void VulkanTopLevelAccelerationStructure::build(const VulkanCommandBuffer& comma
else if (maxSize < requiredMemory) [[unlikely]]
throw ArgumentOutOfRangeException("maxSize", 0ull, maxSize, requiredMemory, "The maximum available size is not sufficient to contain the acceleration structure.");
else if (buffer->size() < offset + requiredMemory) [[unlikely]]
throw ArgumentOutOfRangeException("buffer", 0ull, buffer->size(), offset + requiredMemory, "The buffer does not contain enough memory after offset {0} to fully contain the acceleration structure.", offset);
throw ArgumentOutOfRangeException("buffer", 0ull, (UInt64)buffer->size(), offset + requiredMemory, "The buffer does not contain enough memory after offset {0} to fully contain the acceleration structure.", offset);

// If the acceleration structure allows for compaction, create a query pool in order to query the compacted size later.
if (LITEFX_FLAG_IS_SET(m_impl->m_flags, AccelerationStructureFlags::AllowCompaction))
Expand Down Expand Up @@ -174,7 +174,7 @@ void VulkanTopLevelAccelerationStructure::update(const VulkanCommandBuffer& comm
else if (maxSize < requiredMemory) [[unlikely]]
throw ArgumentOutOfRangeException("maxSize", 0ull, maxSize, requiredMemory, "The maximum available size is not sufficient to contain the acceleration structure.");
else if (buffer->size() < offset + requiredMemory) [[unlikely]]
throw ArgumentOutOfRangeException("buffer", 0ull, buffer->size(), offset + requiredMemory, "The buffer does not contain enough memory after offset {0} to fully contain the acceleration structure.", offset);
throw ArgumentOutOfRangeException("buffer", 0ull, (UInt64)buffer->size(), offset + requiredMemory, "The buffer does not contain enough memory after offset {0} to fully contain the acceleration structure.", offset);

// If the acceleration structure allows for compaction, reset the query pool.
if (LITEFX_FLAG_IS_SET(m_impl->m_flags, AccelerationStructureFlags::AllowCompaction))
Expand Down Expand Up @@ -220,7 +220,7 @@ void VulkanTopLevelAccelerationStructure::copy(const VulkanCommandBuffer& comman
if (buffer == nullptr)
buffer = destination.m_impl->m_buffer->size() >= requiredMemory[0] ? destination.m_impl->m_buffer : device.factory().createBuffer(BufferType::AccelerationStructure, ResourceHeap::Resource, requiredMemory[0], 1, ResourceUsage::AllowWrite);
else if (buffer->size() < offset + requiredMemory[0]) [[unlikely]]
throw ArgumentOutOfRangeException("buffer", 0ull, buffer->size(), offset + requiredMemory[0], "The buffer does not contain enough memory after offset {0} to fully contain the acceleration structure.", offset);
throw ArgumentOutOfRangeException("buffer", 0ull, (UInt64)buffer->size(), offset + requiredMemory[0], "The buffer does not contain enough memory after offset {0} to fully contain the acceleration structure.", offset);

// Create or reset query pool on destination, if required.
if (LITEFX_FLAG_IS_SET(destination.flags(), AccelerationStructureFlags::AllowCompaction))
Expand Down
4 changes: 2 additions & 2 deletions src/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@
],
"buildPresets": [
{
"name": "windows-x86-publish",
"name": "windows-x86-release",
"configurePreset": "windows-x86-release"
},
{
"name": "windows-x64-publish",
"name": "windows-x64-release",
"configurePreset": "windows-x64-release"
}
],
Expand Down
Loading

0 comments on commit b1043f1

Please sign in to comment.