Skip to content
Permalink
Browse files

- fix mirror effect shader

  • Loading branch information...
dpjudas authored and madame-rachelle committed May 5, 2019
1 parent b19e114 commit d1e8bd61b05c2dffe259a13de2d74901ce73db22
@@ -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
{
@@ -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;
}
@@ -61,7 +61,7 @@ class VkShaderManager
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 @@ class VkShaderManager

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];
};

0 comments on commit d1e8bd6

Please sign in to comment.
You can’t perform that action at this time.