Skip to content

Commit

Permalink
std::string in LocalShaderParamState
Browse files Browse the repository at this point in the history
  • Loading branch information
no-lex committed Oct 15, 2023
1 parent b4fa97b commit d3a2a5f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/engine/render/shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ void Shader::linkglslprogram(bool msg)
}
for(SlotShaderParamState &param : defaultparams)
{
param.loc = glGetUniformLocation(program, param.name);
param.loc = glGetUniformLocation(program, param.name.c_str());
}
for(UniformLoc &loc : uniformlocs)
{
Expand Down Expand Up @@ -919,7 +919,7 @@ void Shader::setslotparams(Slot &slot, const VSlot &vslot)
for(uint i = 0; i < defaultparams.size(); i++)
{
const SlotShaderParamState &l = defaultparams.at(i);
setslotparam(l, unimask, i, l.flags&SlotShaderParam::REUSE ? findslotparam(vslot, l.name, l.val) : l.val);
setslotparam(l, unimask, i, l.flags&SlotShaderParam::REUSE ? findslotparam(vslot, l.name.c_str(), l.val) : l.val);
}
}
}
Expand Down Expand Up @@ -1421,7 +1421,7 @@ static void genuniformdefs(std::string &vs, std::string &ps, Shader *variant = n
{
for(const auto &param : variant->defaultparams)
{
DEF_FORMAT_STRING(uni, "\nuniform vec4 %s;\n", param.name);
DEF_FORMAT_STRING(uni, "\nuniform vec4 %s;\n", param.name.c_str());
params += uni;
}
}
Expand Down Expand Up @@ -2100,7 +2100,7 @@ bool shouldreuseparams(const Slot &s, const VSlot &p)
{
if(param.flags & SlotShaderParam::REUSE)
{
const float *val = findslotparam(p, param.name);
const float *val = findslotparam(p, param.name.c_str());
if(val && std::memcmp(param.val, val, sizeof(param.val)))
{
for(uint j = 0; j < s.params.size(); j++)
Expand Down
2 changes: 1 addition & 1 deletion src/engine/render/shaderparam.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct GlobalShaderParamUse : ShaderParamBinding

struct LocalShaderParamState : ShaderParamBinding
{
const char *name;
std::string name;
};

struct SlotShaderParamState : LocalShaderParamState
Expand Down

0 comments on commit d3a2a5f

Please sign in to comment.