diff options
author | Timothy Arceri <[email protected]> | 2019-08-27 13:25:57 +1000 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2019-11-20 05:05:55 +0000 |
commit | ae2e41841fa93a14e76f63033b7691c007141062 (patch) | |
tree | 4c8debec4892793a23784f6d80f737632050c2cd /src/mesa | |
parent | 575137e61348ae0fdc6da4a6c280bc4148b8628f (diff) |
mesa: implement glGetNamedStringivARB()
Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]>
Reviewed-by: Witold Baryluk <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/shaderapi.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 0af9871a508..77513c5c529 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -3464,6 +3464,34 @@ GLvoid GLAPIENTRY _mesa_GetNamedStringivARB(GLint namelen, const GLchar *name, GLenum pname, GLint *params) { + GET_CURRENT_CONTEXT(ctx); + const char *caller = "glGetNamedStringivARB"; + + char *name_cp = copy_string(ctx, name, namelen, caller); + if (!name_cp) + return; + + const char *source = _mesa_lookup_shader_include(ctx, name_cp, true); + if (!source) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "%s(no string associated with path %s)", caller, name_cp); + free(name_cp); + return; + } + + switch (pname) { + case GL_NAMED_STRING_LENGTH_ARB: + *params = strlen(source) + 1; + break; + case GL_NAMED_STRING_TYPE_ARB: + *params = GL_SHADER_INCLUDE_ARB; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname)", caller); + break; + } + + free(name_cp); } static int |