A lot of fixes

This commit is contained in:
Jérôme Leclercq 2021-05-28 22:58:40 +02:00
parent ff505e9019
commit c2b61b6732
6 changed files with 21 additions and 11 deletions

View File

@ -212,7 +212,7 @@ namespace Nz
{ {
if (auto it = m_pending.attachmentToTextures.find(depthStencilOutput); it == m_pending.attachmentToTextures.end()) if (auto it = m_pending.attachmentToTextures.find(depthStencilOutput); it == m_pending.attachmentToTextures.end())
m_pending.attachmentToTextures.emplace(depthStencilOutput, textureId); m_pending.attachmentToTextures.emplace(depthStencilOutput, textureId);
else else if (it->second != textureId)
throw std::runtime_error("depth-stencil output already assigned"); throw std::runtime_error("depth-stencil output already assigned");
} }
} }

View File

@ -14,8 +14,6 @@
#include <stdexcept> #include <stdexcept>
#include <Nazara/OpenGLRenderer/Debug.hpp> #include <Nazara/OpenGLRenderer/Debug.hpp>
#define NAZARA_OPENGLRENDERER_DEBUG 1
namespace Nz::GL namespace Nz::GL
{ {
thread_local const Context* s_currentContext = nullptr; thread_local const Context* s_currentContext = nullptr;
@ -469,7 +467,7 @@ namespace Nz::GL
{ {
if (m_state.renderStates.depthCompare != renderStates.depthCompare) if (m_state.renderStates.depthCompare != renderStates.depthCompare)
{ {
glDepthFunc(ToOpenGL(m_state.renderStates.depthCompare)); glDepthFunc(ToOpenGL(renderStates.depthCompare));
m_state.renderStates.depthCompare = renderStates.depthCompare; m_state.renderStates.depthCompare = renderStates.depthCompare;
} }
@ -516,12 +514,12 @@ namespace Nz::GL
if (currentStencilData.compare != newStencilData.compare || if (currentStencilData.compare != newStencilData.compare ||
currentStencilData.reference != newStencilData.reference || 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.compare = newStencilData.compare;
currentStencilData.compareMask = newStencilData.compareMask;
currentStencilData.reference = newStencilData.reference; currentStencilData.reference = newStencilData.reference;
currentStencilData.writeMask = newStencilData.writeMask;
} }
if (currentStencilData.depthFail != newStencilData.depthFail || if (currentStencilData.depthFail != newStencilData.depthFail ||
@ -533,6 +531,12 @@ namespace Nz::GL
currentStencilData.fail = newStencilData.fail; currentStencilData.fail = newStencilData.fail;
currentStencilData.pass = newStencilData.pass; currentStencilData.pass = newStencilData.pass;
} }
if (currentStencilData.writeMask != newStencilData.writeMask)
{
glStencilMaskSeparate((front) ? GL_FRONT : GL_BACK, newStencilData.writeMask);
currentStencilData.writeMask = newStencilData.writeMask;
}
}; };
ApplyStencilStates(true); ApplyStencilStates(true);

View File

@ -175,7 +175,7 @@ namespace Nz
AppendHeader(); AppendHeader();
sanitizedAst->Visit(*this); targetAst->Visit(*this);
return state.stream.str(); return state.stream.str();
} }

View File

@ -53,7 +53,10 @@ namespace Nz
VkPipelineColorBlendAttachmentState& colorBlendState = colorBlendStates.emplace_back(); VkPipelineColorBlendAttachmentState& colorBlendState = colorBlendStates.emplace_back();
colorBlendState.blendEnable = pipelineInfo.blending; colorBlendState.blendEnable = pipelineInfo.blending;
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 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) if (pipelineInfo.blending)
{ {

View File

@ -115,6 +115,9 @@ namespace Nz
continue; //< Ignore continue; //< Ignore
} }
if (!remainingStages.Test(stageType))
continue;
m_stages.push_back({ m_stages.push_back({
stageType, stageType,
std::move(entryPoint.name) std::move(entryPoint.name)

View File

@ -146,7 +146,7 @@ for name, module in pairs(modules) do
if is_mode("debug") then if is_mode("debug") then
add_defines("NAZARA_DEBUG") add_defines("NAZARA_DEBUG")
add_defines("NAZARA_" .. name:upper() .. "_BUILD") add_defines("NAZARA_" .. name:upper() .. "_DEBUG")
end end
add_headerfiles("include/Nazara/" .. name .. "/**.hpp") add_headerfiles("include/Nazara/" .. name .. "/**.hpp")
@ -156,7 +156,7 @@ for name, module in pairs(modules) do
add_files("src/Nazara/" .. name .. "/**.cpp") add_files("src/Nazara/" .. name .. "/**.cpp")
add_includedirs("src") 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"}) add_files(filepath, {rule="embed_resources"})
end end