diff options
author | Timothy Arceri <[email protected]> | 2017-06-28 14:40:25 +1000 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2017-06-29 08:54:11 +1000 |
commit | aed0fc5efd1283c2a7f45f27b1dac1a6e8471c2a (patch) | |
tree | f811422b7d342d8135c512728d98973fa31d42d3 /src | |
parent | cb209dae9919eca304213768fc73b0b91eb96cfe (diff) |
mesa: add bind_frag_data_location() helper
Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/shader_query.cpp | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp index 0f66f757038..6e373ef6411 100644 --- a/src/mesa/main/shader_query.cpp +++ b/src/mesa/main/shader_query.cpp @@ -254,6 +254,24 @@ _mesa_longest_attribute_name_length(struct gl_shader_program *shProg) return longest; } +void static +bind_frag_data_location(struct gl_shader_program *const shProg, + const char *name, unsigned colorNumber, + unsigned index) +{ + /* Replace the current value if it's already in the list. Add + * FRAG_RESULT_DATA0 because that's how the linker differentiates + * between built-in attributes and user-defined attributes. + */ + shProg->FragDataBindings->put(colorNumber + FRAG_RESULT_DATA0, name); + shProg->FragDataIndexBindings->put(index, name); + + /* + * Note that this binding won't go into effect until + * glLinkProgram is called again. + */ +} + void GLAPIENTRY _mesa_BindFragDataLocation(GLuint program, GLuint colorNumber, const GLchar *name) @@ -295,17 +313,7 @@ _mesa_BindFragDataLocationIndexed(GLuint program, GLuint colorNumber, return; } - /* Replace the current value if it's already in the list. Add - * FRAG_RESULT_DATA0 because that's how the linker differentiates - * between built-in attributes and user-defined attributes. - */ - shProg->FragDataBindings->put(colorNumber + FRAG_RESULT_DATA0, name); - shProg->FragDataIndexBindings->put(index, name); - /* - * Note that this binding won't go into effect until - * glLinkProgram is called again. - */ - + bind_frag_data_location(shProg, name, colorNumber, index); } GLint GLAPIENTRY |