Extract OpenGL shader uniform catalog
This commit is contained in:
@@ -262,7 +262,7 @@ bool Shader::create(const std::string& vertex, const std::string& fragment)
|
||||
{
|
||||
glGetActiveUniform(ps, (GLuint)i, bufSize, &length, &size, &type, name);
|
||||
name[length] = 0;
|
||||
kShaderUniform id = (kShaderUniform)const_hash(name);
|
||||
kShaderUniform id = static_cast<kShaderUniform>(pp::renderer::gl::shader_uniform_id(name));
|
||||
if (m_umap.find(id) != m_umap.end())
|
||||
LOG("UNIFORM ALREADY DEFINED: %s", name);
|
||||
m_umap[id] = glGetUniformLocation(ps, name);
|
||||
@@ -422,58 +422,7 @@ void ShaderManager::invalidate()
|
||||
|
||||
bool check_uniform_uniqueness()
|
||||
{
|
||||
std::vector<uint16_t> v = {
|
||||
const_hash("mvp"),
|
||||
const_hash("tex"),
|
||||
const_hash("tex_alpha"),
|
||||
const_hash("tex_fg"),
|
||||
const_hash("tex_bg"),
|
||||
const_hash("tex_mix"),
|
||||
const_hash("tex_mix_alpha"),
|
||||
const_hash("tex_mask"),
|
||||
const_hash("tex_dual"),
|
||||
const_hash("tex_stroke"),
|
||||
const_hash("tex_pattern"),
|
||||
const_hash("pattern_offset"),
|
||||
const_hash("pattern_alpha"),
|
||||
const_hash("mix_alpha"),
|
||||
const_hash("opacity"),
|
||||
const_hash("wet"),
|
||||
const_hash("lock"),
|
||||
const_hash("col"),
|
||||
const_hash("tof"),
|
||||
const_hash("tsz"),
|
||||
const_hash("alpha"),
|
||||
const_hash("mask"),
|
||||
const_hash("resolution"),
|
||||
const_hash("highlight"),
|
||||
const_hash("blend_mode"),
|
||||
const_hash("dual_blend_mode"),
|
||||
const_hash("noise"),
|
||||
const_hash("dir"),
|
||||
const_hash("use_dual"),
|
||||
const_hash("use_pattern"),
|
||||
const_hash("light_dir"),
|
||||
const_hash("mode"),
|
||||
const_hash("ambient"),
|
||||
const_hash("pattern_invert"),
|
||||
const_hash("pattern_scale"),
|
||||
const_hash("pattern_bright"),
|
||||
const_hash("pattern_contr"),
|
||||
const_hash("pattern_depth"),
|
||||
const_hash("patt_blend_mode"),
|
||||
const_hash("colorize"),
|
||||
const_hash("dual_alpha"),
|
||||
const_hash("use_fragcoord"),
|
||||
const_hash("draw_outline"),
|
||||
};
|
||||
std::sort(v.begin(), v.end());
|
||||
int last = 0;
|
||||
for (auto o : v)
|
||||
{
|
||||
if (o == last)
|
||||
return false;
|
||||
last = o;
|
||||
}
|
||||
return true;
|
||||
return pp::renderer::gl::validate_shader_uniform_names(
|
||||
pp::renderer::gl::panopainter_shader_uniform_names())
|
||||
.ok();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user