diff options
author | Tapani Pälli <[email protected]> | 2015-03-12 14:08:38 +0200 |
---|---|---|
committer | Tapani Pälli <[email protected]> | 2015-04-16 07:55:56 +0300 |
commit | 9367ade331e5d0a7724c595e7afb0322caaaddf7 (patch) | |
tree | 61aa6e1cd1aa43f858c3d0a854036e5d88179eec /src/mesa/main/shader_query.cpp | |
parent | e0e4d77f0120865b3ca0a4055358fc87d38d1cfe (diff) |
mesa: glGetProgramResourceLocationIndex
Patch adds required helper functions to shaderapi.h and
the actual implementation.
The added functionality can be tested by tests for following
functions that are refactored by later patches:
GetFragDataIndex
v2: return -1 if output not referenced by fragment stage
(Ilia Mirkin)
Signed-off-by: Tapani Pälli <[email protected]>
Reviewed-by: Martin Peres <[email protected]>
Diffstat (limited to 'src/mesa/main/shader_query.cpp')
-rw-r--r-- | src/mesa/main/shader_query.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp index f50ceb6a56b..8b2281ddd5c 100644 --- a/src/mesa/main/shader_query.cpp +++ b/src/mesa/main/shader_query.cpp @@ -821,3 +821,21 @@ _mesa_program_resource_location(struct gl_shader_program *shProg, return program_resource_location(shProg, res, name); } + +/** + * Function implements following index queries: + * glGetFragDataIndex + */ +GLint +_mesa_program_resource_location_index(struct gl_shader_program *shProg, + GLenum interface, const char *name) +{ + struct gl_program_resource *res = + _mesa_program_resource_find_name(shProg, interface, name); + + /* Non-existent variable or resource is not referenced by fragment stage. */ + if (!res || !(res->StageReferences & (1 << MESA_SHADER_FRAGMENT))) + return -1; + + return RESOURCE_VAR(res)->data.index; +} |