diff options
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/shaderapi.c | 22 |
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 |