Adding basic depth prepass

This commit is contained in:
Dynamitos
2021-05-06 17:02:10 +02:00
parent 4a078bd24c
commit 0cf13bcff5
52 changed files with 880 additions and 155 deletions
+17 -2
View File
@@ -2,6 +2,8 @@
#include "Material/MaterialInstance.h"
#include "Material/Material.h"
#include "Graphics.h"
#include "RenderPass/DepthPrepass.h"
#include "RenderPass/BasePass.h"
using namespace Seele;
using namespace Seele::Gfx;
@@ -18,6 +20,16 @@ std::string getShaderNameFromRenderPassType(Gfx::RenderPassType type)
return "";
}
}
void modifyRenderPassMacros(Gfx::RenderPassType type, Map<const char*, const char*>& defines)
{
switch (type)
{
case Gfx::RenderPassType::DepthPrepass:
DepthPrepass::modifyRenderPassMacros(defines);
case Gfx::RenderPassType::BasePass:
BasePass::modifyRenderPassMacros(defines);
}
}
ShaderMap::ShaderMap()
{
@@ -55,6 +67,8 @@ ShaderCollection& ShaderMap::createShaders(
createInfo.defines["MATERIAL_IMPORT"] = material->getName().c_str();
createInfo.defines["NUM_MATERIAL_TEXCOORDS"] = "1";
createInfo.defines["USE_INSTANCING"] = "0";
modifyRenderPassMacros(renderPass, createInfo.defines);
createInfo.name = getShaderNameFromRenderPassType(renderPass) + " Material " + material->getName();
std::ifstream codeStream("./shaders/" + getShaderNameFromRenderPassType(renderPass), std::ios::ate);
auto fileSize = codeStream.tellg();
@@ -113,7 +127,8 @@ void PipelineLayout::addDescriptorLayout(uint32 setIndex, PDescriptorLayout layo
{
descriptorSetLayouts.resize(setIndex + 1);
}
if (descriptorSetLayouts[setIndex] != nullptr)
// After a second thought, merging descriptor layout bindings is not a good idea
/*if (descriptorSetLayouts[setIndex] != nullptr)
{
auto &thisBindings = descriptorSetLayouts[setIndex]->descriptorBindings;
auto &otherBindings = layout->descriptorBindings;
@@ -126,7 +141,7 @@ void PipelineLayout::addDescriptorLayout(uint32 setIndex, PDescriptorLayout layo
}
}
}
else
else*/
{
descriptorSetLayouts[setIndex] = layout;
}