[Mesa-dev] [PATCH 16/20] program_resource: add subroutine support (v2)
Timothy Arceri
t_arceri at yahoo.com.au
Thu Jul 23 02:05:48 PDT 2015
On Tue, 2015-07-21 at 15:19 +1000, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> This fleshes out the ARB_program_query support for the
> APIs that ARB_shader_subroutine introduces, leaving
> some TODOs for later addition.
>
> v2: reworked for lots of the ARB_program_interface_query
> entry points and tests
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
> src/mesa/main/program_resource.c | 88 ++++++++++++++++++++++++++++++++-----
> ---
> src/mesa/main/shader_query.cpp | 82 ++++++++++++++++++++++++++++++++++++-
>
snip
> @@ -740,6 +773,8 @@ program_resource_location(struct gl_shader_program
> *shProg,
> {
> unsigned index, offset;
> int array_index = -1;
> + long offset_ret;
> + const GLchar *base_name_end;
>
> if (res->Type == GL_PROGRAM_INPUT || res->Type == GL_PROGRAM_OUTPUT) {
> array_index = array_index_of_resource(res, name);
> @@ -780,6 +815,14 @@ program_resource_location(struct gl_shader_program
> *shProg,
> /* location in remap table + array element offset */
> return RESOURCE_UNI(res)->remap_location + offset;
>
> + case GL_VERTEX_SUBROUTINE_UNIFORM:
> + case GL_GEOMETRY_SUBROUTINE_UNIFORM:
> + case GL_FRAGMENT_SUBROUTINE_UNIFORM:
> + case GL_COMPUTE_SUBROUTINE_UNIFORM:
> + case GL_TESS_CONTROL_SUBROUTINE_UNIFORM:
> + case GL_TESS_EVALUATION_SUBROUTINE_UNIFORM:
> + offset_ret = parse_program_resource_name(name, &base_name_end);
> + return RESOURCE_UNI(res)->remap_location + ((offset_ret != -1) ?
> offset_ret : 0);
Sorry for commenting after this has already landed. But shouldn't this just
return -1 if the subscript is invalid?
More information about the mesa-dev
mailing list