- 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; VkShaderProgram *program;
if (key.SpecialEffect != EFF_NONE) 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 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); prog.frag = LoadFragShader(name, mainfp, usershaders[i].shader, defaultshaders[usershaders[i].shaderType].lightfunc, defines, true, gbufferpass);
mMaterialShaders[j].push_back(std::move(prog)); mMaterialShaders[j].push_back(std::move(prog));
} }
}
for (int i = 0; i < MAX_EFFECTS; i++) for (int i = 0; i < MAX_EFFECTS; i++)
{ {
VkShaderProgram prog; VkShaderProgram prog;
prog.vert = LoadVertShader(effectshaders[i].ShaderName, effectshaders[i].vp, defaultshaders[i].Defines); 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, false); prog.frag = LoadFragShader(effectshaders[i].ShaderName, effectshaders[i].fp1, effectshaders[i].fp2, effectshaders[i].fp3, effectshaders[i].defines, true, gbufferpass);
mEffectShaders[i] = std::move(prog); mEffectShaders[j].push_back(std::move(prog));
}
} }
} }
@ -58,11 +58,11 @@ VkShaderManager::~VkShaderManager()
ShFinalize(); 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; return nullptr;
} }

View file

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