- fix mirror effect shader

This commit is contained in:
Magnus Norddahl 2019-05-06 00:15:02 +02:00
parent e75ab8ed09
commit 97375feee6
3 changed files with 13 additions and 13 deletions

View file

@ -261,7 +261,7 @@ void VkRenderPassSetup::CreatePipeline(const VkRenderPassKey &key)
VkShaderProgram *program;
if (key.SpecialEffect != EFF_NONE)
{
program = fb->GetShaderManager()->GetEffect(key.SpecialEffect);
program = fb->GetShaderManager()->GetEffect(key.SpecialEffect, key.DrawBuffers > 1 ? GBUFFER_PASS : NORMAL_PASS);
}
else
{

View file

@ -42,14 +42,14 @@ VkShaderManager::VkShaderManager(VulkanDevice *device) : device(device)
prog.frag = LoadFragShader(name, mainfp, usershaders[i].shader, defaultshaders[usershaders[i].shaderType].lightfunc, defines, true, gbufferpass);
mMaterialShaders[j].push_back(std::move(prog));
}
}
for (int i = 0; i < MAX_EFFECTS; i++)
{
VkShaderProgram prog;
prog.vert = LoadVertShader(effectshaders[i].ShaderName, effectshaders[i].vp, defaultshaders[i].Defines);
prog.frag = LoadFragShader(effectshaders[i].ShaderName, effectshaders[i].fp1, effectshaders[i].fp2, effectshaders[i].fp3, effectshaders[i].defines, true, false);
mEffectShaders[i] = std::move(prog);
for (int i = 0; i < MAX_EFFECTS; i++)
{
VkShaderProgram prog;
prog.vert = LoadVertShader(effectshaders[i].ShaderName, effectshaders[i].vp, effectshaders[i].defines);
prog.frag = LoadFragShader(effectshaders[i].ShaderName, effectshaders[i].fp1, effectshaders[i].fp2, effectshaders[i].fp3, effectshaders[i].defines, true, gbufferpass);
mEffectShaders[j].push_back(std::move(prog));
}
}
}
@ -58,11 +58,11 @@ VkShaderManager::~VkShaderManager()
ShFinalize();
}
VkShaderProgram *VkShaderManager::GetEffect(int effect)
VkShaderProgram *VkShaderManager::GetEffect(int effect, EPassType passType)
{
if (effect >= 0 && effect < MAX_EFFECTS && mEffectShaders[effect].frag)
if (effect >= 0 && effect < MAX_EFFECTS && mEffectShaders[passType][effect].frag)
{
return &mEffectShaders[effect];
return &mEffectShaders[passType][effect];
}
return nullptr;
}

View file

@ -61,7 +61,7 @@ public:
VkShaderManager(VulkanDevice *device);
~VkShaderManager();
VkShaderProgram *GetEffect(int effect);
VkShaderProgram *GetEffect(int effect, EPassType passType);
VkShaderProgram *Get(unsigned int eff, bool alphateston, EPassType passType);
private:
@ -76,5 +76,5 @@ private:
std::vector<VkShaderProgram> mMaterialShaders[MAX_PASS_TYPES];
std::vector<VkShaderProgram> mMaterialShadersNAT[MAX_PASS_TYPES];
VkShaderProgram mEffectShaders[MAX_EFFECTS];
std::vector<VkShaderProgram> mEffectShaders[MAX_PASS_TYPES];
};