2017-03-02 21:27:51 -05:00
|
|
|
|
|
|
|
// Gawain shader interface (C --> GLSL)
|
|
|
|
//
|
|
|
|
// This code is part of the Gawain library, with modifications
|
|
|
|
// specific to integration with Blender.
|
|
|
|
//
|
|
|
|
// Copyright 2017 Mike Erwin
|
|
|
|
//
|
|
|
|
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of
|
|
|
|
// the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
|
2017-08-16 00:20:14 +10:00
|
|
|
#include "gwn_shader_interface.h"
|
2017-03-02 21:27:51 -05:00
|
|
|
#include <stdlib.h>
|
2017-03-03 14:50:35 -05:00
|
|
|
#include <stddef.h>
|
2017-04-12 17:56:26 -04:00
|
|
|
#include <string.h>
|
2017-03-02 21:27:51 -05:00
|
|
|
|
2017-04-12 18:03:18 -04:00
|
|
|
#define SUPPORT_LEGACY_GLSL 1
|
2017-03-02 21:27:51 -05:00
|
|
|
#define DEBUG_SHADER_INTERFACE 0
|
|
|
|
|
|
|
|
#if DEBUG_SHADER_INTERFACE
|
|
|
|
#include <stdio.h>
|
|
|
|
#endif
|
|
|
|
|
2017-06-19 20:18:04 +10:00
|
|
|
static const char* BuiltinUniform_name(Gwn_UniformBuiltin u)
|
2017-03-02 21:27:51 -05:00
|
|
|
{
|
|
|
|
static const char* names[] =
|
|
|
|
{
|
2017-06-19 20:18:04 +10:00
|
|
|
[GWN_UNIFORM_NONE] = NULL,
|
2017-03-02 21:27:51 -05:00
|
|
|
|
2017-06-19 20:18:04 +10:00
|
|
|
[GWN_UNIFORM_MODELVIEW] = "ModelViewMatrix",
|
|
|
|
[GWN_UNIFORM_PROJECTION] = "ProjectionMatrix",
|
|
|
|
[GWN_UNIFORM_MVP] = "ModelViewProjectionMatrix",
|
2017-04-12 17:56:26 -04:00
|
|
|
|
2017-06-19 20:18:04 +10:00
|
|
|
[GWN_UNIFORM_MODELVIEW_INV] = "ModelViewInverseMatrix",
|
|
|
|
[GWN_UNIFORM_PROJECTION_INV] = "ProjectionInverseMatrix",
|
2017-03-02 21:27:51 -05:00
|
|
|
|
2017-06-19 20:18:04 +10:00
|
|
|
[GWN_UNIFORM_NORMAL] = "NormalMatrix",
|
2017-04-15 19:19:00 -04:00
|
|
|
|
2017-06-19 20:18:04 +10:00
|
|
|
[GWN_UNIFORM_COLOR] = "color",
|
2017-03-02 21:27:51 -05:00
|
|
|
|
2017-10-05 16:19:14 +05:00
|
|
|
[GWN_UNIFORM_CUSTOM] = NULL,
|
|
|
|
[GWN_NUM_UNIFORMS] = NULL,
|
2017-03-02 21:27:51 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
return names[u];
|
|
|
|
}
|
|
|
|
|
2017-10-04 16:53:02 +05:00
|
|
|
GWN_INLINE bool match(const char* a, const char* b)
|
2017-04-15 19:19:00 -04:00
|
|
|
{
|
|
|
|
return strcmp(a, b) == 0;
|
|
|
|
}
|
|
|
|
|
2017-10-04 16:53:02 +05:00
|
|
|
GWN_INLINE unsigned hash_string(const char *str)
|
2017-06-01 12:26:27 +02:00
|
|
|
{
|
|
|
|
unsigned i = 0, c;
|
|
|
|
|
|
|
|
while ((c = *str++))
|
|
|
|
{
|
|
|
|
i = i * 37 + c;
|
|
|
|
}
|
|
|
|
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
2017-10-04 16:53:02 +05:00
|
|
|
GWN_INLINE void set_input_name(Gwn_ShaderInput* input, const char* name)
|
2017-06-01 12:26:27 +02:00
|
|
|
{
|
|
|
|
input->name = name;
|
|
|
|
input->name_hash = hash_string(name);
|
|
|
|
}
|
|
|
|
|
2017-10-04 17:36:52 +05:00
|
|
|
GWN_INLINE void shader_input_to_bucket(Gwn_ShaderInput* input,
|
2017-10-06 01:50:16 +02:00
|
|
|
Gwn_ShaderInput_Entry* buckets[GWN_NUM_SHADERINTERFACE_BUCKETS])
|
2017-10-04 17:36:52 +05:00
|
|
|
{
|
2017-10-06 01:50:16 +02:00
|
|
|
Gwn_ShaderInput_Entry* entry = malloc(sizeof(Gwn_ShaderInput_Entry));
|
2017-10-04 17:36:52 +05:00
|
|
|
const unsigned bucket_index = input->name_hash % GWN_NUM_SHADERINTERFACE_BUCKETS;
|
2017-10-06 01:50:16 +02:00
|
|
|
entry->next = buckets[bucket_index];
|
|
|
|
entry->shader_input = input;
|
|
|
|
buckets[bucket_index] = entry;
|
2017-10-04 17:36:52 +05:00
|
|
|
}
|
|
|
|
|
2017-10-06 01:50:16 +02:00
|
|
|
GWN_INLINE Gwn_ShaderInput* buckets_lookup(Gwn_ShaderInput_Entry* const buckets[GWN_NUM_SHADERINTERFACE_BUCKETS],
|
2017-10-04 17:36:52 +05:00
|
|
|
const char *name)
|
|
|
|
{
|
|
|
|
const unsigned name_hash = hash_string(name);
|
|
|
|
const unsigned bucket_index = name_hash % GWN_NUM_SHADERINTERFACE_BUCKETS;
|
2017-10-06 01:50:16 +02:00
|
|
|
const Gwn_ShaderInput_Entry* entry = buckets[bucket_index];
|
|
|
|
if (entry == NULL)
|
2017-10-04 17:36:52 +05:00
|
|
|
{
|
|
|
|
// Requested uniform is not found at all.
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
// Optimization bit: if there is no hash collision detected when constructing shader interface
|
|
|
|
// it means we can only request the single possible uniform. Surely, it's possible we request
|
|
|
|
// uniform which causes hash collision, but that will be detected in debug builds.
|
2017-10-06 01:50:16 +02:00
|
|
|
if (entry->next == NULL)
|
2017-10-04 17:36:52 +05:00
|
|
|
{
|
2017-10-06 01:50:16 +02:00
|
|
|
if (name_hash == entry->shader_input->name_hash)
|
2017-10-04 17:36:52 +05:00
|
|
|
{
|
|
|
|
#if TRUST_NO_ONE
|
2017-10-06 01:50:16 +02:00
|
|
|
assert(match(entry->shader_input->name, name));
|
2017-10-04 17:36:52 +05:00
|
|
|
#endif
|
2017-10-06 01:50:16 +02:00
|
|
|
return entry->shader_input;
|
2017-10-04 17:36:52 +05:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
// Work through possible collisions.
|
2017-10-06 01:50:16 +02:00
|
|
|
while (entry != NULL)
|
2017-10-04 17:36:52 +05:00
|
|
|
{
|
2017-10-06 01:50:16 +02:00
|
|
|
Gwn_ShaderInput* uniform = entry->shader_input;
|
|
|
|
entry = entry->next;
|
2017-10-04 17:36:52 +05:00
|
|
|
#if SUPPORT_LEGACY_GLSL
|
|
|
|
if (uniform->name == NULL) continue;
|
|
|
|
#endif
|
|
|
|
if (uniform->name_hash != name_hash)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (match(uniform->name, name))
|
|
|
|
{
|
|
|
|
return uniform;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL; // not found
|
|
|
|
}
|
|
|
|
|
2017-10-06 01:50:16 +02:00
|
|
|
GWN_INLINE void buckets_free(Gwn_ShaderInput_Entry* buckets[GWN_NUM_SHADERINTERFACE_BUCKETS])
|
|
|
|
{
|
|
|
|
for (unsigned bucket_index = 0; bucket_index < GWN_NUM_SHADERINTERFACE_BUCKETS; ++bucket_index)
|
|
|
|
{
|
|
|
|
Gwn_ShaderInput_Entry *entry = buckets[bucket_index];
|
|
|
|
while (entry != NULL)
|
|
|
|
{
|
|
|
|
Gwn_ShaderInput_Entry *entry_next = entry->next;
|
|
|
|
free(entry);
|
|
|
|
entry = entry_next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-19 20:18:04 +10:00
|
|
|
// keep these in sync with Gwn_UniformBuiltin order
|
|
|
|
#define FIRST_MAT4_UNIFORM GWN_UNIFORM_MODELVIEW
|
|
|
|
#define LAST_MAT4_UNIFORM GWN_UNIFORM_PROJECTION_INV
|
2017-04-15 19:19:00 -04:00
|
|
|
|
2017-06-19 20:18:04 +10:00
|
|
|
static bool setup_builtin_uniform(Gwn_ShaderInput* input, const char* name)
|
2017-03-02 21:27:51 -05:00
|
|
|
{
|
|
|
|
// TODO: reject DOUBLE, IMAGE, ATOMIC_COUNTER gl_types
|
|
|
|
|
2017-04-15 19:19:00 -04:00
|
|
|
// detect built-in uniforms (gl_type and name must match)
|
|
|
|
// if a match is found, use BuiltinUniform_name so name buffer space can be reclaimed
|
|
|
|
switch (input->gl_type)
|
|
|
|
{
|
|
|
|
case GL_FLOAT_MAT4:
|
2017-06-19 20:18:04 +10:00
|
|
|
for (Gwn_UniformBuiltin u = FIRST_MAT4_UNIFORM; u <= LAST_MAT4_UNIFORM; ++u)
|
2017-04-15 19:19:00 -04:00
|
|
|
{
|
|
|
|
const char* builtin_name = BuiltinUniform_name(u);
|
|
|
|
if (match(name, builtin_name))
|
|
|
|
{
|
2017-06-01 12:26:27 +02:00
|
|
|
set_input_name(input, builtin_name);
|
2017-04-15 19:19:00 -04:00
|
|
|
input->builtin_type = u;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GL_FLOAT_MAT3:
|
|
|
|
{
|
2017-06-19 20:18:04 +10:00
|
|
|
const char* builtin_name = BuiltinUniform_name(GWN_UNIFORM_NORMAL);
|
2017-04-15 19:19:00 -04:00
|
|
|
if (match(name, builtin_name))
|
|
|
|
{
|
2017-06-01 12:26:27 +02:00
|
|
|
set_input_name(input, builtin_name);
|
2017-06-19 20:18:04 +10:00
|
|
|
input->builtin_type = GWN_UNIFORM_NORMAL;
|
2017-04-15 19:19:00 -04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GL_FLOAT_VEC4:
|
|
|
|
{
|
2017-06-19 20:18:04 +10:00
|
|
|
const char* builtin_name = BuiltinUniform_name(GWN_UNIFORM_COLOR);
|
2017-04-15 19:19:00 -04:00
|
|
|
if (match(name, builtin_name))
|
|
|
|
{
|
2017-06-01 12:26:27 +02:00
|
|
|
set_input_name(input, builtin_name);
|
2017-06-19 20:18:04 +10:00
|
|
|
input->builtin_type = GWN_UNIFORM_COLOR;
|
2017-04-15 19:19:00 -04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
2017-06-19 20:18:04 +10:00
|
|
|
input->builtin_type = GWN_UNIFORM_CUSTOM;
|
2017-03-02 21:27:51 -05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-06-19 20:18:04 +10:00
|
|
|
Gwn_ShaderInterface* GWN_shaderinterface_create(GLint program)
|
2017-03-02 21:27:51 -05:00
|
|
|
{
|
|
|
|
#if DEBUG_SHADER_INTERFACE
|
|
|
|
printf("%s {\n", __func__); // enter function
|
|
|
|
#endif
|
|
|
|
|
|
|
|
GLint uniform_ct, attrib_ct;
|
|
|
|
glGetProgramiv(program, GL_ACTIVE_UNIFORMS, &uniform_ct);
|
|
|
|
glGetProgramiv(program, GL_ACTIVE_ATTRIBUTES, &attrib_ct);
|
|
|
|
const GLint input_ct = uniform_ct + attrib_ct;
|
|
|
|
|
|
|
|
GLint max_uniform_name_len, max_attrib_name_len;
|
|
|
|
glGetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &max_uniform_name_len);
|
|
|
|
glGetProgramiv(program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &max_attrib_name_len);
|
|
|
|
const uint32_t name_buffer_len = uniform_ct * max_uniform_name_len + attrib_ct * max_attrib_name_len;
|
|
|
|
|
|
|
|
// allocate enough space for input counts, details for each input, and a buffer for name strings
|
2017-06-19 20:18:04 +10:00
|
|
|
Gwn_ShaderInterface* shaderface = calloc(1, offsetof(Gwn_ShaderInterface, inputs) + input_ct * sizeof(Gwn_ShaderInput) + name_buffer_len);
|
2017-04-12 17:56:26 -04:00
|
|
|
shaderface->uniform_ct = uniform_ct;
|
|
|
|
shaderface->attrib_ct = attrib_ct;
|
2017-03-02 21:27:51 -05:00
|
|
|
|
2017-06-19 20:18:04 +10:00
|
|
|
char* name_buffer = (char*)shaderface + offsetof(Gwn_ShaderInterface, inputs) + input_ct * sizeof(Gwn_ShaderInput);
|
2017-03-02 21:27:51 -05:00
|
|
|
uint32_t name_buffer_offset = 0;
|
|
|
|
|
|
|
|
for (uint32_t i = 0; i < uniform_ct; ++i)
|
|
|
|
{
|
2017-06-19 20:18:04 +10:00
|
|
|
Gwn_ShaderInput* input = shaderface->inputs + i;
|
2017-03-02 21:27:51 -05:00
|
|
|
GLsizei remaining_buffer = name_buffer_len - name_buffer_offset;
|
|
|
|
char* name = name_buffer + name_buffer_offset;
|
|
|
|
GLsizei name_len = 0;
|
|
|
|
|
|
|
|
glGetActiveUniform(program, i, remaining_buffer, &name_len, &input->size, &input->gl_type, name);
|
|
|
|
|
2017-04-12 17:56:26 -04:00
|
|
|
input->location = glGetUniformLocation(program, name);
|
|
|
|
|
2017-04-12 18:03:18 -04:00
|
|
|
#if SUPPORT_LEGACY_GLSL
|
|
|
|
if (input->location != -1)
|
|
|
|
{
|
|
|
|
#elif TRUST_NO_ONE
|
|
|
|
assert(input->location != -1);
|
2017-04-12 17:56:26 -04:00
|
|
|
#endif
|
|
|
|
|
2017-04-12 18:03:18 -04:00
|
|
|
if (setup_builtin_uniform(input, name))
|
|
|
|
; // reclaim space from name buffer (don't advance offset)
|
|
|
|
else
|
|
|
|
{
|
2017-06-01 12:26:27 +02:00
|
|
|
set_input_name(input, name);
|
2017-04-12 18:03:18 -04:00
|
|
|
name_buffer_offset += name_len + 1; // include NULL terminator
|
|
|
|
}
|
|
|
|
#if SUPPORT_LEGACY_GLSL
|
2017-04-12 17:56:26 -04:00
|
|
|
}
|
2017-04-12 18:03:18 -04:00
|
|
|
#endif
|
2017-03-02 21:27:51 -05:00
|
|
|
|
|
|
|
#if DEBUG_SHADER_INTERFACE
|
|
|
|
printf("uniform[%u] '%s' at location %d\n", i, name, input->location);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
for (uint32_t i = 0; i < attrib_ct; ++i)
|
|
|
|
{
|
2017-06-19 20:18:04 +10:00
|
|
|
Gwn_ShaderInput* input = shaderface->inputs + uniform_ct + i;
|
2017-03-02 21:27:51 -05:00
|
|
|
GLsizei remaining_buffer = name_buffer_len - name_buffer_offset;
|
|
|
|
char* name = name_buffer + name_buffer_offset;
|
|
|
|
GLsizei name_len = 0;
|
|
|
|
|
|
|
|
glGetActiveAttrib(program, i, remaining_buffer, &name_len, &input->size, &input->gl_type, name);
|
|
|
|
|
|
|
|
// TODO: reject DOUBLE gl_types
|
|
|
|
|
2017-04-12 17:56:26 -04:00
|
|
|
input->location = glGetAttribLocation(program, name);
|
|
|
|
|
2017-04-12 18:03:18 -04:00
|
|
|
#if SUPPORT_LEGACY_GLSL
|
|
|
|
if (input->location != -1)
|
|
|
|
{
|
|
|
|
#elif TRUST_NO_ONE
|
|
|
|
assert(input->location != -1);
|
2017-04-12 17:56:26 -04:00
|
|
|
#endif
|
|
|
|
|
2017-06-01 12:26:27 +02:00
|
|
|
set_input_name(input, name);
|
2017-04-12 18:03:18 -04:00
|
|
|
name_buffer_offset += name_len + 1; // include NULL terminator
|
|
|
|
#if SUPPORT_LEGACY_GLSL
|
|
|
|
}
|
|
|
|
#endif
|
2017-03-02 21:27:51 -05:00
|
|
|
|
|
|
|
#if DEBUG_SHADER_INTERFACE
|
|
|
|
printf("attrib[%u] '%s' at location %d\n", i, name, input->location);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2017-04-17 01:45:21 -04:00
|
|
|
const uint32_t name_buffer_used = name_buffer_offset;
|
2017-03-02 21:27:51 -05:00
|
|
|
|
|
|
|
#if DEBUG_SHADER_INTERFACE
|
2017-04-17 01:45:21 -04:00
|
|
|
printf("using %u of %u bytes from name buffer\n", name_buffer_used, name_buffer_len);
|
2017-03-02 21:27:51 -05:00
|
|
|
printf("}\n"); // exit function
|
|
|
|
#endif
|
|
|
|
|
2017-04-17 01:45:21 -04:00
|
|
|
if (name_buffer_used < name_buffer_len)
|
|
|
|
{
|
|
|
|
// realloc shaderface to shrink name buffer
|
2017-04-18 22:04:00 +10:00
|
|
|
const size_t shaderface_alloc =
|
2017-06-19 20:18:04 +10:00
|
|
|
offsetof(Gwn_ShaderInterface, inputs) + (input_ct * sizeof(Gwn_ShaderInput)) + name_buffer_used;
|
2017-04-18 22:04:00 +10:00
|
|
|
const char* shaderface_orig_start = (const char*)shaderface;
|
|
|
|
const char* shaderface_orig_end = &shaderface_orig_start[shaderface_alloc];
|
|
|
|
shaderface = realloc(shaderface, shaderface_alloc);
|
|
|
|
const ptrdiff_t delta = (char*)shaderface - shaderface_orig_start;
|
2017-04-17 01:45:21 -04:00
|
|
|
|
|
|
|
if (delta)
|
|
|
|
{
|
|
|
|
// each input->name will need adjustment (except static built-in names)
|
2017-04-18 22:04:00 +10:00
|
|
|
for (uint32_t i = 0; i < input_ct; ++i)
|
2017-04-17 01:45:21 -04:00
|
|
|
{
|
2017-06-19 20:18:04 +10:00
|
|
|
Gwn_ShaderInput* input = shaderface->inputs + i;
|
2017-04-17 01:45:21 -04:00
|
|
|
|
2017-04-18 22:04:00 +10:00
|
|
|
if (input->name >= shaderface_orig_start && input->name < shaderface_orig_end)
|
2017-04-17 01:45:21 -04:00
|
|
|
input->name += delta;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-05 16:19:14 +05:00
|
|
|
memset(shaderface->builtin_uniforms, 0, sizeof(shaderface->builtin_uniforms));
|
2017-10-04 17:36:52 +05:00
|
|
|
for (uint32_t i = 0; i < shaderface->uniform_ct; ++i)
|
|
|
|
{
|
|
|
|
Gwn_ShaderInput* input = &shaderface->inputs[i];
|
|
|
|
shader_input_to_bucket(input, shaderface->uniform_buckets);
|
2017-10-05 16:19:14 +05:00
|
|
|
if (input->builtin_type != GWN_UNIFORM_NONE &&
|
|
|
|
input->builtin_type != GWN_UNIFORM_CUSTOM)
|
|
|
|
{
|
|
|
|
shaderface->builtin_uniforms[input->builtin_type] = input;
|
|
|
|
}
|
2017-10-04 17:36:52 +05:00
|
|
|
}
|
|
|
|
for (uint32_t i = 0; i < shaderface->attrib_ct; ++i)
|
|
|
|
{
|
|
|
|
Gwn_ShaderInput* input = &shaderface->inputs[i + shaderface->uniform_ct];
|
|
|
|
shader_input_to_bucket(input, shaderface->attrib_buckets);
|
|
|
|
}
|
|
|
|
|
2017-03-02 21:27:51 -05:00
|
|
|
return shaderface;
|
|
|
|
}
|
|
|
|
|
2017-06-19 20:18:04 +10:00
|
|
|
void GWN_shaderinterface_discard(Gwn_ShaderInterface* shaderface)
|
2017-03-02 21:27:51 -05:00
|
|
|
{
|
2017-10-06 01:50:16 +02:00
|
|
|
// Free memory used by buckets and has entries.
|
|
|
|
buckets_free(shaderface->uniform_buckets);
|
|
|
|
buckets_free(shaderface->attrib_buckets);
|
2017-10-04 17:36:52 +05:00
|
|
|
// Free memory used by shader interface by its self.
|
2017-03-02 21:27:51 -05:00
|
|
|
free(shaderface);
|
|
|
|
}
|
2017-04-12 17:56:26 -04:00
|
|
|
|
2017-06-19 20:18:04 +10:00
|
|
|
const Gwn_ShaderInput* GWN_shaderinterface_uniform(const Gwn_ShaderInterface* shaderface, const char* name)
|
2017-04-12 17:56:26 -04:00
|
|
|
{
|
2017-10-04 17:36:52 +05:00
|
|
|
// TODO: Warn if we find a matching builtin, since these can be looked up much quicker.
|
|
|
|
return buckets_lookup(shaderface->uniform_buckets, name);
|
2017-04-12 17:56:26 -04:00
|
|
|
}
|
|
|
|
|
2017-06-19 20:18:04 +10:00
|
|
|
const Gwn_ShaderInput* GWN_shaderinterface_uniform_builtin(const Gwn_ShaderInterface* shaderface, Gwn_UniformBuiltin builtin)
|
2017-04-12 17:56:26 -04:00
|
|
|
{
|
2017-06-04 22:09:39 -04:00
|
|
|
#if TRUST_NO_ONE
|
2017-06-19 20:18:04 +10:00
|
|
|
assert(builtin != GWN_UNIFORM_NONE);
|
|
|
|
assert(builtin != GWN_UNIFORM_CUSTOM);
|
2017-10-05 16:19:14 +05:00
|
|
|
assert(builtin != GWN_NUM_UNIFORMS);
|
2017-06-04 22:09:39 -04:00
|
|
|
#endif
|
|
|
|
|
2017-10-05 16:19:14 +05:00
|
|
|
return shaderface->builtin_uniforms[builtin];
|
2017-04-12 17:56:26 -04:00
|
|
|
}
|
2017-04-15 18:06:54 -04:00
|
|
|
|
2017-06-19 20:18:04 +10:00
|
|
|
const Gwn_ShaderInput* GWN_shaderinterface_attr(const Gwn_ShaderInterface* shaderface, const char* name)
|
2017-04-15 18:06:54 -04:00
|
|
|
{
|
2017-10-04 17:36:52 +05:00
|
|
|
return buckets_lookup(shaderface->attrib_buckets, name);
|
2017-04-15 18:06:54 -04:00
|
|
|
}
|