mesa: split _mesa_lookup_shader_include() in two
authorTimothy Arceri <tarceri@itsqueeze.com>
Tue, 27 Aug 2019 04:22:30 +0000 (14:22 +1000)
committerTimothy Arceri <tarceri@itsqueeze.com>
Wed, 20 Nov 2019 05:05:55 +0000 (05:05 +0000)
The new local function lookup_shader_include() will be used by
glDeleteNamedStringARB() in the following patch.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Witold Baryluk <witold.baryluk@gmail.com>
src/mesa/main/shaderapi.c

index 77513c5c52931b5907c28366e3834a124eadf7e2..162015c5b396808b095724619ecb3fdd6f750cfc 100644 (file)
@@ -3280,9 +3280,9 @@ validate_and_tokenise_sh_incl(struct gl_context *ctx,
    return true;
 }
 
-const char *
-_mesa_lookup_shader_include(struct gl_context *ctx, char *path,
-                            bool error_check)
+static struct sh_incl_path_ht_entry *
+lookup_shader_include(struct gl_context *ctx, char *path,
+                      bool error_check)
 {
    void *mem_ctx = ralloc_context(NULL);
    struct sh_incl_path_entry *path_list;
@@ -3313,7 +3313,17 @@ _mesa_lookup_shader_include(struct gl_context *ctx, char *path,
 
    ralloc_free(mem_ctx);
 
-   return sh_incl_ht_entry ? sh_incl_ht_entry->shader_source : NULL;
+   return sh_incl_ht_entry;
+}
+
+const char *
+_mesa_lookup_shader_include(struct gl_context *ctx, char *path,
+                            bool error_check)
+{
+   struct sh_incl_path_ht_entry *shader_include =
+      lookup_shader_include(ctx, path, error_check);
+
+   return shader_include ? shader_include->shader_source : NULL;
 }
 
 static char *