diff --git a/Assets/Fonts/ALGER.shfont b/Assets/Fonts/ALGER.shfont index 738af82d..1acab9da 100644 Binary files a/Assets/Fonts/ALGER.shfont and b/Assets/Fonts/ALGER.shfont differ diff --git a/Assets/Fonts/SegoeUI.shfont b/Assets/Fonts/SegoeUI.shfont index 3f709c2a..321f62c8 100644 Binary files a/Assets/Fonts/SegoeUI.shfont and b/Assets/Fonts/SegoeUI.shfont differ diff --git a/Assets/Shaders/ToSwapchain_VS.glsl b/Assets/Shaders/ToSwapchain_VS.glsl index b230301f..eee22015 100644 --- a/Assets/Shaders/ToSwapchain_VS.glsl +++ b/Assets/Shaders/ToSwapchain_VS.glsl @@ -10,6 +10,6 @@ vec2 CreateQuad(in uint vertexID) void main() { - vec2 vertexPos = CreateQuad(gl_VertexIndex) - vec2(0.5f); + vec2 vertexPos = 2 * (CreateQuad(gl_VertexIndex) - vec2(0.5f)); gl_Position = vec4 (vertexPos, 0.0f, 1.0f); } \ No newline at end of file diff --git a/Assets/Shaders/ToSwapchain_VS.shshaderb b/Assets/Shaders/ToSwapchain_VS.shshaderb index 1868d251..4c3157f9 100644 Binary files a/Assets/Shaders/ToSwapchain_VS.shshaderb and b/Assets/Shaders/ToSwapchain_VS.shshaderb differ diff --git a/SHADE_Application/src/Application/SBApplication.cpp b/SHADE_Application/src/Application/SBApplication.cpp index 5062b4de..1a00941f 100644 --- a/SHADE_Application/src/Application/SBApplication.cpp +++ b/SHADE_Application/src/Application/SBApplication.cpp @@ -80,8 +80,8 @@ namespace Sandbox SHSystemManager::CreateSystem(); SHSystemManager::CreateSystem(); - std::system("FontCompiler.exe ../../Assets/Fonts/SegoeUI.ttf"); - std::system("FontCompiler.exe ../../Assets/Fonts/ALGER.ttf"); + //std::system("FontCompiler.exe ../../Assets/Fonts/SegoeUI.ttf"); + //std::system("FontCompiler.exe ../../Assets/Fonts/ALGER.ttf"); SHSystemManager::CreateSystem(); SHGraphicsSystem* graphicsSystem = static_cast(SHSystemManager::GetSystem()); diff --git a/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.cpp b/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.cpp index 0580d650..2ffd6d13 100644 --- a/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.cpp +++ b/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.cpp @@ -565,8 +565,10 @@ namespace SHADE { cmdBuffer->BindPipeline(renderToSwapchainImageSystem->GetPipeline()); + newSubpass->BindDescriptorInputDescriptorSets (cmdBuffer, frameIndex); + // draw a quad. - cmdBuffer->DrawIndexed(4, 0, 0); + cmdBuffer->DrawArrays(4, 1, 0, 0); }); } } diff --git a/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.cpp b/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.cpp index 0900852c..c1d53632 100644 --- a/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.cpp +++ b/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.cpp @@ -40,7 +40,7 @@ namespace SHADE , inputReferences{} , name { name } , graphStorage{ renderGraphStorage } - , inputImageDescriptors {SHGraphicsConstants::NUM_FRAME_BUFFERS} + , inputImageDescriptorSets{} { } @@ -67,7 +67,7 @@ namespace SHADE , exteriorDrawCalls{ std::move(rhs.exteriorDrawCalls) } , graphStorage{ rhs.graphStorage } , inputNames{ std::move(rhs.inputNames) } - , inputImageDescriptors{ std::move(rhs.inputImageDescriptors) } + , inputImageDescriptorSets{ std::move(rhs.inputImageDescriptorSets) } , inputDescriptorLayout{ rhs.inputDescriptorLayout } , inputSamplers{ rhs.inputSamplers } , name { rhs.name } @@ -102,7 +102,7 @@ namespace SHADE exteriorDrawCalls = std::move(rhs.exteriorDrawCalls); graphStorage = rhs.graphStorage; inputNames = std::move(rhs.inputNames); - inputImageDescriptors = std::move(rhs.inputImageDescriptors); + inputImageDescriptorSets = std::move(rhs.inputImageDescriptorSets); inputDescriptorLayout = rhs.inputDescriptorLayout; inputSamplers = rhs.inputSamplers; name = std::move(rhs.name); @@ -202,6 +202,8 @@ namespace SHADE void SHSubpass::Execute(Handle& commandBuffer, Handle descPool, uint32_t frameIndex) noexcept { commandBuffer->BeginLabeledSegment(name); + + // Ensure correct transforms are provided superBatch->UpdateBuffers(frameIndex, descPool); @@ -221,6 +223,14 @@ namespace SHADE UpdateWriteDescriptors(); } + void SHSubpass::BindDescriptorInputDescriptorSets(Handle cmdBuffer, uint32_t frameIndex) const noexcept + { + if (!inputImageDescriptorSets.empty()) + { + cmdBuffer->BindDescriptorSet(inputImageDescriptorSets[frameIndex], SH_PIPELINE_TYPE::GRAPHICS, SHGraphicsConstants::DescriptorSetIndex::RENDERGRAPH_RESOURCE, { }); + } + } + void SHSubpass::AddExteriorDrawCalls(std::function&, uint32_t)> const& newDrawCall) noexcept { exteriorDrawCalls.push_back(newDrawCall); @@ -237,6 +247,8 @@ namespace SHADE if (inputNames.empty()) return; + inputImageDescriptorSets.resize(SHGraphicsConstants::NUM_FRAME_BUFFERS); + std::vector bindings{}; for (auto& input : inputReferences) @@ -280,7 +292,7 @@ namespace SHADE } } - //// maybe do this in handle resize? + // maybe do this in handle resize? UpdateWriteDescriptors(); } @@ -296,7 +308,7 @@ namespace SHADE // For every frame's descriptor set - for (auto& group : inputImageDescriptors) + for (auto& group : inputImageDescriptorSets) { if (group) group.Free(); diff --git a/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.h b/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.h index c28ff919..69b8fd56 100644 --- a/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.h +++ b/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.h @@ -55,8 +55,11 @@ namespace SHADE //! For getting attachment reference indices using handles std::unordered_map const* resourceAttachmentMapping; - //! Descriptor set group to hold the images for input - std::vector> inputImageDescriptors; + //! Descriptor set group to hold the images for input. We have 3 here just in case + //! one of the images is a swapchain image. Practically speaking its not likely not + //! swapchain images will end up being images used in descriptor sets, but this is + //! to have the support for it. The cost is not much. + std::vector> inputImageDescriptorSets; //! Descriptor set layout for allocating descriptor set for inputs Handle inputDescriptorLayout; @@ -104,6 +107,7 @@ namespace SHADE // Runtime functions void Execute(Handle& commandBuffer, Handle descPool, uint32_t frameIndex) noexcept; void HandleResize (void) noexcept; + void BindDescriptorInputDescriptorSets (Handle cmdBuffer, uint32_t frameIndex) const noexcept; void Init(SHResourceHub& resourceManager) noexcept;