Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2017-04-13 01:03:18 +0300
committerMike Erwin <significant.bit@gmail.com>2017-04-13 08:07:50 +0300
commitc61b7b02635f90529b8c08a6914e87dda5f77df0 (patch)
tree73301282acb0f404afda26548ff2f8240fb92f3e /intern
parent02fd9a1aaf14469b7ea1c4a78fdd966319038369 (diff)
Gawain: add (temp) legacy GLSL support to ShaderInterface
A temporary measure needed by GPU_basic_shader. Part of T51164
Diffstat (limited to 'intern')
-rw-r--r--intern/gawain/src/shader_interface.c41
1 files changed, 29 insertions, 12 deletions
diff --git a/intern/gawain/src/shader_interface.c b/intern/gawain/src/shader_interface.c
index 85fa1d0b676..d3c9ad0240c 100644
--- a/intern/gawain/src/shader_interface.c
+++ b/intern/gawain/src/shader_interface.c
@@ -14,6 +14,7 @@
#include <stddef.h>
#include <string.h>
+#define SUPPORT_LEGACY_GLSL 1
#define DEBUG_SHADER_INTERFACE 0
#if DEBUG_SHADER_INTERFACE
@@ -92,17 +93,23 @@ ShaderInterface* ShaderInterface_create(GLint program)
input->location = glGetUniformLocation(program, name);
-#if TRUST_NO_ONE
- assert(input->location != -1);
+#if SUPPORT_LEGACY_GLSL
+ if (input->location != -1)
+ {
+#elif TRUST_NO_ONE
+ assert(input->location != -1);
#endif
- if (setup_builtin_uniform(input, name))
- ; // reclaim space from name buffer (don't advance offset)
- else
- {
- input->name = name;
- name_buffer_offset += name_len + 1; // include NULL terminator
+ if (setup_builtin_uniform(input, name))
+ ; // reclaim space from name buffer (don't advance offset)
+ else
+ {
+ input->name = name;
+ name_buffer_offset += name_len + 1; // include NULL terminator
+ }
+#if SUPPORT_LEGACY_GLSL
}
+#endif
#if DEBUG_SHADER_INTERFACE
printf("uniform[%u] '%s' at location %d\n", i, name, input->location);
@@ -122,12 +129,18 @@ ShaderInterface* ShaderInterface_create(GLint program)
input->location = glGetAttribLocation(program, name);
-#if TRUST_NO_ONE
- assert(input->location != -1);
+#if SUPPORT_LEGACY_GLSL
+ if (input->location != -1)
+ {
+#elif TRUST_NO_ONE
+ assert(input->location != -1);
#endif
- input->name = name;
- name_buffer_offset += name_len + 1; // include NULL terminator
+ input->name = name;
+ name_buffer_offset += name_len + 1; // include NULL terminator
+#if SUPPORT_LEGACY_GLSL
+ }
+#endif
#if DEBUG_SHADER_INTERFACE
printf("attrib[%u] '%s' at location %d\n", i, name, input->location);
@@ -157,6 +170,10 @@ const ShaderInput* ShaderInterface_uniform(const ShaderInterface* shaderface, co
{
const ShaderInput* uniform = shaderface->inputs + i;
+#if SUPPORT_LEGACY_GLSL
+ if (uniform->name == NULL) continue;
+#endif
+
if (strcmp(uniform->name, name) == 0)
return uniform;
}