Gawain: faster lookup shader attribs by name
Quick hash rejection instead of string comparison. Uniform lookups already work this way. I don't expect a major overall speedup since attributes are looked up less frequently than uniforms.
This commit is contained in:
parent
a5242d08fb
commit
bb3e669d06
|
@ -288,6 +288,7 @@ const ShaderInput* ShaderInterface_attrib(const ShaderInterface* shaderface, con
|
|||
{
|
||||
// attribs are stored after uniforms
|
||||
const uint32_t input_ct = shaderface->uniform_ct + shaderface->attrib_ct;
|
||||
const unsigned name_hash = hash_string(name);
|
||||
for (uint32_t i = shaderface->uniform_ct; i < input_ct; ++i)
|
||||
{
|
||||
const ShaderInput* attrib = shaderface->inputs + i;
|
||||
|
@ -296,6 +297,8 @@ const ShaderInput* ShaderInterface_attrib(const ShaderInterface* shaderface, con
|
|||
if (attrib->name == NULL) continue;
|
||||
#endif
|
||||
|
||||
if (attrib->name_hash != name_hash) continue;
|
||||
|
||||
if (match(attrib->name, name))
|
||||
return attrib;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue