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())
m_pending.attachmentToTextures.emplace(depthStencilOutput, textureId);
else
else if (it->second != textureId)
throw std::runtime_error("depth-stencil output already assigned");
}
}

View File

@ -14,8 +14,6 @@
#include <stdexcept>
#include <Nazara/OpenGLRenderer/Debug.hpp>
#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);

View File

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

View File

@ -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)
{

View File

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

View File

@ -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