diff --git a/src/Graphics/src/blitter_d3d12.cpp b/src/Graphics/src/blitter_d3d12.cpp index 4169f966..2d6d0cae 100644 --- a/src/Graphics/src/blitter_d3d12.cpp +++ b/src/Graphics/src/blitter_d3d12.cpp @@ -30,10 +30,10 @@ class Blitter::BlitImpl { void initialize(const DirectX12Device& device) { // Allocate shader module. - Array> modules; auto blitShader = LiteFX::Graphics::Shaders::blit_dxi::open(); - modules.push_back(std::move(makeUnique(device, ShaderStage::Compute, blitShader, LiteFX::Graphics::Shaders::blit_dxi::name(), "main"))); - auto shaderProgram = DirectX12ShaderProgram::create(device, std::move(modules | std::views::as_rvalue)); + Array> modules; + modules.push_back(makeUnique(device, ShaderStage::Compute, blitShader, LiteFX::Graphics::Shaders::blit_dxi::name(), "main")); + auto shaderProgram = DirectX12ShaderProgram::create(device, modules | std::views::as_rvalue); // Allocate descriptor set layouts. // NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers) @@ -58,12 +58,14 @@ class Blitter::BlitImpl { // Shared interface. // ------------------------------------------------------------------------------------------------ +template <> Blitter::Blitter(const DirectX12Device& device) : m_impl(device) { m_impl->initialize(device); } +template <> void Blitter::generateMipMaps(IDirectX12Image& image, DirectX12CommandBuffer& commandBuffer) { auto device = m_impl->m_device.lock(); @@ -81,7 +83,7 @@ void Blitter::generateMipMaps(IDirectX12Image& image, DirectX1 // Create the array of parameter data. Array parametersData(image.levels()); - std::ranges::generate(parametersData, [this, &image, i = 0]() mutable { + std::ranges::generate(parametersData, [&image, i = 0]() mutable { auto level = i++; return Parameters{ @@ -92,7 +94,7 @@ void Blitter::generateMipMaps(IDirectX12Image& image, DirectX1 }); auto parametersBlock = parametersData | - std::views::transform([](const Parameters& parameters) { return reinterpret_cast(¶meters); }) | + std::views::transform([](const Parameters& parameters) { return static_cast(¶meters); }) | std::ranges::to>(); // Set the active pipeline state. @@ -135,7 +137,7 @@ void Blitter::generateMipMaps(IDirectX12Image& image, DirectX1 // Dispatch the pipeline. commandBuffer.bind(*(*resource), pipeline); - commandBuffer.dispatch({ std::max(static_cast(size.width()) / 8, 1), std::max(static_cast(size.height()) / 8, 1), 1 }); + commandBuffer.dispatch({ std::max(static_cast(size.width()) / 8, 1), std::max(static_cast(size.height()) / 8, 1), 1 }); // NOLINT(cppcoreguidelines-avoid-magic-numbers) // Wait for all writes. DirectX12Barrier subBarrier(PipelineStage::Compute, PipelineStage::Compute); @@ -155,6 +157,6 @@ void Blitter::generateMipMaps(IDirectX12Image& image, DirectX1 // Export definition. // ------------------------------------------------------------------------------------------------ -template class LITEFX_GRAPHICS_API Blitter; +template class LITEFX_GRAPHICS_API LiteFX::Graphics::Blitter; #endif // LITEFX_BUILD_DIRECTX_12_BACKEND \ No newline at end of file diff --git a/src/Graphics/src/blitter_vk.cpp b/src/Graphics/src/blitter_vk.cpp index 0b23a076..52ce8038 100644 --- a/src/Graphics/src/blitter_vk.cpp +++ b/src/Graphics/src/blitter_vk.cpp @@ -22,11 +22,13 @@ class Blitter::BlitImpl { // Shared interface. // ------------------------------------------------------------------------------------------------ +template <> Blitter::Blitter(const VulkanDevice& /*device*/) : m_impl() { } +template <> void Blitter::generateMipMaps(IVulkanImage& image, VulkanCommandBuffer& commandBuffer) { VulkanBarrier startBarrier(PipelineStage::None, PipelineStage::Transfer); @@ -89,6 +91,6 @@ void Blitter::generateMipMaps(IVulkanImage& image, VulkanCommandB // Export definition. // ------------------------------------------------------------------------------------------------ -template class LITEFX_GRAPHICS_API Blitter; +template class LITEFX_GRAPHICS_API LiteFX::Graphics::Blitter; #endif // LITEFX_BUILD_VULKAN_BACKEND \ No newline at end of file diff --git a/src/Samples/Textures/src/sample.cpp b/src/Samples/Textures/src/sample.cpp index 36d99d60..61afb191 100644 --- a/src/Samples/Textures/src/sample.cpp +++ b/src/Samples/Textures/src/sample.cpp @@ -159,7 +159,7 @@ void loadTexture(TDevice& device, SharedPtr& textu } template -UInt64 initBuffers(SampleApp& app, TDevice& device, SharedPtr inputAssembler) +UInt64 initBuffers(SampleApp& app, TDevice& device, const SharedPtr& inputAssembler) { using image_type = TDevice::image_type; using sampler_type = TDevice::sampler_type;