diff --git a/Assets/CollisionTags.SHConfig b/Assets/CollisionTags.SHConfig index 18a339dd..d3ebe7e2 100644 --- a/Assets/CollisionTags.SHConfig +++ b/Assets/CollisionTags.SHConfig @@ -1,20 +1,16 @@ -0 1 -1 2 -2 3 -3 4 -4 5 -5 6 -6 7 -7 8 -8 9 -9 10 -10 11 -11 12 -12 13 -13 14 -14 15 -15 16 - -note: -All collision tags should follow the above format "indextag name". -If it fails to follow this, the default tag names will be used. \ No newline at end of file +0 1 +1 2 +2 3 +3 4 +4 5 +5 6 +6 7 +7 8 +8 9 +9 10 +10 11 +11 12 +12 13 +13 14 +14 15 +15 16 diff --git a/Assets/Shaders/ToSwapchain_FS.glsl b/Assets/Shaders/ToSwapchain_FS.glsl index a68fa0c7..9a35d1c4 100644 --- a/Assets/Shaders/ToSwapchain_FS.glsl +++ b/Assets/Shaders/ToSwapchain_FS.glsl @@ -3,12 +3,17 @@ #extension GL_ARB_shading_language_420pack : enable #extension GL_EXT_nonuniform_qualifier : require -layout (input_attachment_index = 0, set = 4, binding = 0) uniform subpassInput sceneTexture; +layout (input_attachment_index = 0, set = 4, binding = 0) uniform subpassInput vec4 sceneTexture; +layout(location = 0) in struct +{ + vec2 uv; // location = 0 + +} In; layout(location = 0) out vec4 fragColor; void main() { - fragColor = vec4 (subpassLoad(sceneTexture).rgb, 1.0f); + fragColor = vec4 (texture (sceneTexture, In.uv).rgb, 1.0f); } \ No newline at end of file diff --git a/Assets/Shaders/ToSwapchain_FS.shshaderb b/Assets/Shaders/ToSwapchain_FS.shshaderb deleted file mode 100644 index b10a9d6c..00000000 Binary files a/Assets/Shaders/ToSwapchain_FS.shshaderb and /dev/null differ diff --git a/Assets/Shaders/ToSwapchain_FS.shshaderb.shmeta b/Assets/Shaders/ToSwapchain_FS.shshaderb.shmeta deleted file mode 100644 index 731b2783..00000000 --- a/Assets/Shaders/ToSwapchain_FS.shshaderb.shmeta +++ /dev/null @@ -1,3 +0,0 @@ -Name: ToSwapchain_FS -ID: 36869006 -Type: 2 diff --git a/Assets/Shaders/ToSwapchain_VS.glsl b/Assets/Shaders/ToSwapchain_VS.glsl index eee22015..cc3e2c28 100644 --- a/Assets/Shaders/ToSwapchain_VS.glsl +++ b/Assets/Shaders/ToSwapchain_VS.glsl @@ -1,6 +1,11 @@ #version 450 #extension GL_KHR_vulkan_glsl : enable +layout(location = 0) out struct +{ + vec2 uv; // location = 0 + +} Out; vec2 CreateQuad(in uint vertexID) { @@ -10,6 +15,7 @@ vec2 CreateQuad(in uint vertexID) void main() { - vec2 vertexPos = 2 * (CreateQuad(gl_VertexIndex) - vec2(0.5f)); + vec2 texCoord = CreateQuad (gl_VertexIndex); + vec2 vertexPos = texCoord - 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 deleted file mode 100644 index 4c3157f9..00000000 Binary files a/Assets/Shaders/ToSwapchain_VS.shshaderb and /dev/null differ diff --git a/Assets/Shaders/ToSwapchain_VS.shshaderb.shmeta b/Assets/Shaders/ToSwapchain_VS.shshaderb.shmeta deleted file mode 100644 index 23bcbe08..00000000 --- a/Assets/Shaders/ToSwapchain_VS.shshaderb.shmeta +++ /dev/null @@ -1,3 +0,0 @@ -Name: ToSwapchain_VS -ID: 48082949 -Type: 2 diff --git a/SHADE_Application/src/Application/SBApplication.cpp b/SHADE_Application/src/Application/SBApplication.cpp index 1a00941f..5062b4de 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/Camera/SHCameraDirector.cpp b/SHADE_Engine/src/Camera/SHCameraDirector.cpp index ec539fa1..29e2dcde 100644 --- a/SHADE_Engine/src/Camera/SHCameraDirector.cpp +++ b/SHADE_Engine/src/Camera/SHCameraDirector.cpp @@ -43,7 +43,9 @@ namespace SHADE if (!camComponent) { SHLOG_WARNING("Camera Director warning: Entity does not have a camera"); + return nullptr; } + return camComponent; } diff --git a/SHADE_Engine/src/ECS_Base/Managers/SHEntityManager.cpp b/SHADE_Engine/src/ECS_Base/Managers/SHEntityManager.cpp index 19eb5168..1c603c57 100644 --- a/SHADE_Engine/src/ECS_Base/Managers/SHEntityManager.cpp +++ b/SHADE_Engine/src/ECS_Base/Managers/SHEntityManager.cpp @@ -146,7 +146,7 @@ namespace SHADE //Call all the children to Destroy themselves first before the parent is destroyed. if (entityVec[eIndex]) { - auto& children = SHSceneManager::GetCurrentSceneGraph().GetChildren(eID); + auto children = SHSceneManager::GetCurrentSceneGraph().GetChildren(eID); for (auto& child : children) { DestroyEntity(child->GetEntityID()); diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp index af09c819..a2276ed6 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp @@ -84,7 +84,7 @@ namespace SHADE if (width == 0 || height == 0) return; - PrepareResize(width, height); + PrepareResize(resizeWidth, resizeHeight); }); window->RegisterWindowCloseCallback([&](void) @@ -125,8 +125,6 @@ namespace SHADE //SHAssetManager::CompileAsset("../../Assets/Shaders/UI_VS.glsl", false); //SHAssetManager::CompileAsset("../../Assets/Shaders/UI_FS.glsl", false); //SHAssetManager::CompileAsset("../../Assets/Models/Quad.gltf", false); - //SHAssetManager::CompileAsset("../../Assets/Shaders/ToSwapchain_VS.glsl", false); - //SHAssetManager::CompileAsset("../../Assets/Shaders/ToSwapchain_FS.glsl", false); // Load Built In Shaders static constexpr AssetID VS_DEFAULT = 39210065; defaultVertShader = SHResourceManager::LoadOrGet(VS_DEFAULT); @@ -138,8 +136,6 @@ namespace SHADE static constexpr AssetID SSAO_BLUR = 39760835; ssaoBlurShader = SHResourceManager::LoadOrGet(SSAO_BLUR); static constexpr AssetID TEXT_VS = 39816727; textVS = SHResourceManager::LoadOrGet(TEXT_VS); static constexpr AssetID TEXT_FS = 38024754; textFS = SHResourceManager::LoadOrGet(TEXT_FS); - static constexpr AssetID RENDER_SC_VS = 48082949; renderToSwapchainVS = SHResourceManager::LoadOrGet(RENDER_SC_VS); - static constexpr AssetID RENDER_SC_FS = 36869006; renderToSwapchainFS = SHResourceManager::LoadOrGet(RENDER_SC_FS); } void SHGraphicsSystem::InitSceneRenderGraph(void) noexcept @@ -303,7 +299,6 @@ namespace SHADE textRenderingSubSystem->Render(cmdBuffer, frameIndex); }); -#ifdef SHEDITOR { // Dummy Node to transition scene render graph resource auto dummyNode = screenRenderGraph->AddNode("Dummy Pass", { "Scene" }, { "Screen Space Pass" }); // no predecessors @@ -311,9 +306,7 @@ namespace SHADE dummySubpass->AddInput("Scene"); } -#else - screenRenderGraph->AddRenderToSwapchainNode("Scene", "Present", {"Screen Space Pass"}, {renderToSwapchainVS, renderToSwapchainFS}); -#endif + //screenRenderGraph->AddRenderToSwapchainNode ("Scene", "Present", ) screenRenderGraph->Generate(); diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.h b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.h index 8c65f233..c201e9a5 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.h +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.h @@ -444,8 +444,6 @@ namespace SHADE Handle ssaoBlurShader; Handle textVS; Handle textFS; - Handle renderToSwapchainVS; - Handle renderToSwapchainFS; // Fonts Handle testFont; diff --git a/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.cpp b/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.cpp index 2ffd6d13..0580d650 100644 --- a/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.cpp +++ b/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.cpp @@ -565,10 +565,8 @@ namespace SHADE { cmdBuffer->BindPipeline(renderToSwapchainImageSystem->GetPipeline()); - newSubpass->BindDescriptorInputDescriptorSets (cmdBuffer, frameIndex); - // draw a quad. - cmdBuffer->DrawArrays(4, 1, 0, 0); + cmdBuffer->DrawIndexed(4, 0, 0); }); } } diff --git a/SHADE_Engine/src/Graphics/RenderGraph/SHRenderToSwapchainImageSystem.cpp b/SHADE_Engine/src/Graphics/RenderGraph/SHRenderToSwapchainImageSystem.cpp index 770217ee..e4f020e4 100644 --- a/SHADE_Engine/src/Graphics/RenderGraph/SHRenderToSwapchainImageSystem.cpp +++ b/SHADE_Engine/src/Graphics/RenderGraph/SHRenderToSwapchainImageSystem.cpp @@ -3,8 +3,6 @@ #include "Graphics/Devices/SHVkLogicalDevice.h" #include "Graphics/MiddleEnd/GlobalData/SHGraphicsGlobalData.h" #include "Graphics/RenderGraph/SHRenderGraphNode.h" -#include "Graphics/RenderGraph/SHSubpass.h" -#include "Graphics/SHVkUtil.h" namespace SHADE { @@ -27,34 +25,14 @@ namespace SHADE .globalDescSetLayouts = SHGraphicsGlobalData::GetDescSetLayouts(), }); - pipeline = logicalDevice->CreateGraphicsPipeline(pipelineLayout, nullptr, renderGraphNode->GetRenderpass(), subpass); + auto newPipeline = logicalDevice->CreateGraphicsPipeline(pipelineLayout, nullptr, renderGraphNode->GetRenderpass(), subpass); SHInputAssemblyState inputAssembly{}; inputAssembly.topology = vk::PrimitiveTopology::eTriangleFan; - pipeline->GetPipelineState().SetInputAssemblyState(inputAssembly); + newPipeline->GetPipelineState().SetInputAssemblyState(inputAssembly); - SHColorBlendState colorBlendState{}; - colorBlendState.logic_op_enable = VK_FALSE; - colorBlendState.logic_op = vk::LogicOp::eCopy; - - auto const& subpassColorReference = subpass->GetColorAttachmentReferences()[0]; - colorBlendState.attachments.push_back(vk::PipelineColorBlendAttachmentState - { - .blendEnable = SHVkUtil::IsBlendCompatible(subpass->GetFormatFromAttachmentReference(subpassColorReference.attachment)), - .srcColorBlendFactor = vk::BlendFactor::eSrcAlpha, - .dstColorBlendFactor = vk::BlendFactor::eOneMinusSrcAlpha, - .colorBlendOp = vk::BlendOp::eAdd, - .srcAlphaBlendFactor = vk::BlendFactor::eOne, - .dstAlphaBlendFactor = vk::BlendFactor::eZero, - .alphaBlendOp = vk::BlendOp::eAdd, - .colorWriteMask = vk::ColorComponentFlagBits::eR | vk::ColorComponentFlagBits::eG | vk::ColorComponentFlagBits::eB | vk::ColorComponentFlagBits::eA, - } - ); - - pipeline->GetPipelineState().SetColorBlenState(colorBlendState); - - pipeline->ConstructPipeline(); + newPipeline->ConstructPipeline(); } diff --git a/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.cpp b/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.cpp index c1d53632..1eae9768 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 } - , inputImageDescriptorSets{} + , inputImageDescriptors {SHGraphicsConstants::NUM_FRAME_BUFFERS} { } @@ -67,7 +67,7 @@ namespace SHADE , exteriorDrawCalls{ std::move(rhs.exteriorDrawCalls) } , graphStorage{ rhs.graphStorage } , inputNames{ std::move(rhs.inputNames) } - , inputImageDescriptorSets{ std::move(rhs.inputImageDescriptorSets) } + , inputImageDescriptors{ std::move(rhs.inputImageDescriptors) } , 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); - inputImageDescriptorSets = std::move(rhs.inputImageDescriptorSets); + inputImageDescriptors = std::move(rhs.inputImageDescriptors); inputDescriptorLayout = rhs.inputDescriptorLayout; inputSamplers = rhs.inputSamplers; name = std::move(rhs.name); @@ -202,8 +202,6 @@ 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); @@ -223,14 +221,6 @@ 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); @@ -247,8 +237,6 @@ namespace SHADE if (inputNames.empty()) return; - inputImageDescriptorSets.resize(SHGraphicsConstants::NUM_FRAME_BUFFERS); - std::vector bindings{}; for (auto& input : inputReferences) @@ -292,8 +280,8 @@ namespace SHADE } } - // maybe do this in handle resize? - UpdateWriteDescriptors(); + //// maybe do this in handle resize? + //UpdateWriteDescriptors(); } void SHSubpass::UpdateWriteDescriptors(void) noexcept @@ -308,7 +296,7 @@ namespace SHADE // For every frame's descriptor set - for (auto& group : inputImageDescriptorSets) + for (auto& group : inputImageDescriptors) { if (group) group.Free(); diff --git a/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.h b/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.h index 69b8fd56..c28ff919 100644 --- a/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.h +++ b/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.h @@ -55,11 +55,8 @@ namespace SHADE //! For getting attachment reference indices using handles std::unordered_map const* resourceAttachmentMapping; - //! 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 group to hold the images for input + std::vector> inputImageDescriptors; //! Descriptor set layout for allocating descriptor set for inputs Handle inputDescriptorLayout; @@ -107,7 +104,6 @@ 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;