mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-12-29 19:21:18 +00:00
glViewer: don't generate GL errors with invalid UBO indices (happens on OSX since tessellation is not supported)
This commit is contained in:
parent
9c9f00ef18
commit
7b77a08281
@ -971,21 +971,23 @@ EffectDrawRegistry::_CreateDrawConfig(
|
||||
ConfigType * config = BaseRegistry::_CreateDrawConfig(desc.first, sconfig);
|
||||
assert(config);
|
||||
|
||||
GLuint uboIndex;
|
||||
|
||||
// XXXdyu can use layout(binding=) with GLSL 4.20 and beyond
|
||||
g_transformBinding = 0;
|
||||
glUniformBlockBinding(config->program,
|
||||
glGetUniformBlockIndex(config->program, "Transform"),
|
||||
g_transformBinding);
|
||||
uboIndex = glGetUniformBlockIndex(config->program, "Transform");
|
||||
if (uboIndex != GL_INVALID_INDEX)
|
||||
glUniformBlockBinding(config->program, uboIndex, g_transformBinding);
|
||||
|
||||
g_tessellationBinding = 1;
|
||||
glUniformBlockBinding(config->program,
|
||||
glGetUniformBlockIndex(config->program, "Tessellation"),
|
||||
g_tessellationBinding);
|
||||
uboIndex = glGetUniformBlockIndex(config->program, "Tessellation");
|
||||
if (uboIndex != GL_INVALID_INDEX)
|
||||
glUniformBlockBinding(config->program, uboIndex, g_tessellationBinding);
|
||||
|
||||
g_lightingBinding = 2;
|
||||
glUniformBlockBinding(config->program,
|
||||
glGetUniformBlockIndex(config->program, "Lighting"),
|
||||
g_lightingBinding);
|
||||
uboIndex = glGetUniformBlockIndex(config->program, "Lighting");
|
||||
if (uboIndex != GL_INVALID_INDEX)
|
||||
glUniformBlockBinding(config->program, uboIndex, g_lightingBinding);
|
||||
|
||||
GLint loc;
|
||||
#if not defined(GL_ARB_separate_shader_objects) || defined(GL_VERSION_4_1)
|
||||
|
Loading…
Reference in New Issue
Block a user