aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2019-08-26 11:23:39 +1000
committerTimothy Arceri <[email protected]>2019-11-20 05:05:55 +0000
commita47bfbe189d8ca05683da9dc2732d7fd435112d8 (patch)
tree29565b711c0da01bcae8114bcaca18110cc16ca6 /src/mesa
parentfc573c9816ec71ee43f3bd90a386f4dfa4533d0a (diff)
mesa: implement glGetNamedStringARB()
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.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 3d764ff075e..82f4bdc8210 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -3415,6 +3415,28 @@ GLvoid GLAPIENTRY
_mesa_GetNamedStringARB(GLint namelen, const GLchar *name, GLsizei bufSize,
GLint *stringlen, GLchar *string)
{
+ GET_CURRENT_CONTEXT(ctx);
+ const char *caller = "glGetNamedStringARB";
+
+ char *name_cp = copy_string(ctx, name, namelen, caller);
+ if (!name_cp)
+ return;
+
+ const char *source = _mesa_lookup_shader_include(ctx, name_cp);
+ if (!source) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "%s(no string associated with path %s)", caller, name_cp);
+ free(name_cp);
+ return;
+ }
+
+ size_t size = MIN2(strlen(source), bufSize - 1);
+ memcpy(string, source, size);
+ string[size] = '\0';
+
+ *stringlen = size;
+
+ free(name_cp);
}
GLvoid GLAPIENTRY