diff --git a/src/Nazara/Graphics/FrameGraph.cpp b/src/Nazara/Graphics/FrameGraph.cpp index f825c0ef8..c9d43aed1 100644 --- a/src/Nazara/Graphics/FrameGraph.cpp +++ b/src/Nazara/Graphics/FrameGraph.cpp @@ -212,7 +212,7 @@ namespace Nz { if (auto it = m_pending.attachmentToTextures.find(depthStencilOutput); it == m_pending.attachmentToTextures.end()) m_pending.attachmentToTextures.emplace(depthStencilOutput, textureId); - else + else if (it->second != textureId) throw std::runtime_error("depth-stencil output already assigned"); } } diff --git a/src/Nazara/OpenGLRenderer/Wrapper/Context.cpp b/src/Nazara/OpenGLRenderer/Wrapper/Context.cpp index dc55efcce..e23a3c7a9 100644 --- a/src/Nazara/OpenGLRenderer/Wrapper/Context.cpp +++ b/src/Nazara/OpenGLRenderer/Wrapper/Context.cpp @@ -14,8 +14,6 @@ #include #include -#define NAZARA_OPENGLRENDERER_DEBUG 1 - namespace Nz::GL { thread_local const Context* s_currentContext = nullptr; @@ -469,7 +467,7 @@ namespace Nz::GL { if (m_state.renderStates.depthCompare != renderStates.depthCompare) { - glDepthFunc(ToOpenGL(m_state.renderStates.depthCompare)); + glDepthFunc(ToOpenGL(renderStates.depthCompare)); m_state.renderStates.depthCompare = renderStates.depthCompare; } @@ -516,12 +514,12 @@ namespace Nz::GL if (currentStencilData.compare != newStencilData.compare || currentStencilData.reference != newStencilData.reference || - currentStencilData.writeMask != newStencilData.writeMask) + currentStencilData.compareMask != newStencilData.compareMask) { - glStencilFuncSeparate((front) ? GL_FRONT : GL_BACK, ToOpenGL(newStencilData.compare), newStencilData.reference, newStencilData.writeMask); + glStencilFuncSeparate((front) ? GL_FRONT : GL_BACK, ToOpenGL(newStencilData.compare), newStencilData.reference, newStencilData.compareMask); currentStencilData.compare = newStencilData.compare; + currentStencilData.compareMask = newStencilData.compareMask; currentStencilData.reference = newStencilData.reference; - currentStencilData.writeMask = newStencilData.writeMask; } if (currentStencilData.depthFail != newStencilData.depthFail || @@ -533,6 +531,12 @@ namespace Nz::GL currentStencilData.fail = newStencilData.fail; currentStencilData.pass = newStencilData.pass; } + + if (currentStencilData.writeMask != newStencilData.writeMask) + { + glStencilMaskSeparate((front) ? GL_FRONT : GL_BACK, newStencilData.writeMask); + currentStencilData.writeMask = newStencilData.writeMask; + } }; ApplyStencilStates(true); diff --git a/src/Nazara/Shader/GlslWriter.cpp b/src/Nazara/Shader/GlslWriter.cpp index 226b5d19a..9d793a628 100644 --- a/src/Nazara/Shader/GlslWriter.cpp +++ b/src/Nazara/Shader/GlslWriter.cpp @@ -175,7 +175,7 @@ namespace Nz AppendHeader(); - sanitizedAst->Visit(*this); + targetAst->Visit(*this); return state.stream.str(); } diff --git a/src/Nazara/VulkanRenderer/VulkanRenderPipeline.cpp b/src/Nazara/VulkanRenderer/VulkanRenderPipeline.cpp index 2e6498d15..d84fb59bf 100644 --- a/src/Nazara/VulkanRenderer/VulkanRenderPipeline.cpp +++ b/src/Nazara/VulkanRenderer/VulkanRenderPipeline.cpp @@ -53,7 +53,10 @@ namespace Nz VkPipelineColorBlendAttachmentState& colorBlendState = colorBlendStates.emplace_back(); colorBlendState.blendEnable = pipelineInfo.blending; - colorBlendState.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT; //< TODO + if (pipelineInfo.colorWrite) + colorBlendState.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT; //< TODO + else + colorBlendState.colorWriteMask = 0; if (pipelineInfo.blending) { diff --git a/src/Nazara/VulkanRenderer/VulkanShaderModule.cpp b/src/Nazara/VulkanRenderer/VulkanShaderModule.cpp index 13d58d353..a414d4551 100644 --- a/src/Nazara/VulkanRenderer/VulkanShaderModule.cpp +++ b/src/Nazara/VulkanRenderer/VulkanShaderModule.cpp @@ -115,6 +115,9 @@ namespace Nz continue; //< Ignore } + if (!remainingStages.Test(stageType)) + continue; + m_stages.push_back({ stageType, std::move(entryPoint.name) diff --git a/xmake.lua b/xmake.lua index 7eab59c56..769bb3da7 100644 --- a/xmake.lua +++ b/xmake.lua @@ -146,7 +146,7 @@ for name, module in pairs(modules) do if is_mode("debug") then add_defines("NAZARA_DEBUG") - add_defines("NAZARA_" .. name:upper() .. "_BUILD") + add_defines("NAZARA_" .. name:upper() .. "_DEBUG") end add_headerfiles("include/Nazara/" .. name .. "/**.hpp") @@ -156,7 +156,7 @@ for name, module in pairs(modules) do add_files("src/Nazara/" .. name .. "/**.cpp") add_includedirs("src") - for _, filepath in pairs(os.files("src/Nazara/" .. name .. "/Resources/**|*.h")) do + for _, filepath in pairs(os.files("src/Nazara/" .. name .. "/Resources/**|**.h")) do add_files(filepath, {rule="embed_resources"}) end