diff options
author | Timothy Arceri <[email protected]> | 2019-09-02 12:31:17 +1000 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2019-11-20 05:05:56 +0000 |
commit | 1201d3377ef8665797bf00839fd49a76e3e44101 (patch) | |
tree | 0ec23d706882ba8f9fcced2bdf4f23675029f203 /src/mesa/main | |
parent | db5197cec54e7926211acef2ff3b40344f01b4f9 (diff) |
mesa: add support cursor support for relative path shader includes
This will allow us to continue searching the current path for
relative shader includes.
From the ARB_shading_language_include spec:
"If it is quoted with double quotes in a previously included
string, then the first search point will be the tree location
where the previously included string had been found."
Reviewed-by: Witold Baryluk <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/shaderapi.c | 13 | ||||
-rw-r--r-- | src/mesa/main/shaderapi.h | 6 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index efbdda4ddb0..f028653700d 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -3162,6 +3162,7 @@ struct shader_includes { /* Array to hold include paths given to glCompileShaderIncludeARB() */ struct sh_incl_path_entry **include_paths; size_t num_include_paths; + size_t relative_path_cursor; /* Root hash table holding the shader include tree */ struct hash_table *shader_include_tree; @@ -3176,6 +3177,18 @@ _mesa_init_shader_includes(struct gl_shared_state *shared) _mesa_key_string_equal); } +size_t +_mesa_get_shader_include_cursor(struct gl_shared_state *shared) +{ + return shared->ShaderIncludes->relative_path_cursor; +} + +void +_mesa_set_shader_include_cursor(struct gl_shared_state *shared, size_t cursor) +{ + shared->ShaderIncludes->relative_path_cursor = cursor; +} + static void destroy_shader_include(struct hash_entry *entry) { diff --git a/src/mesa/main/shaderapi.h b/src/mesa/main/shaderapi.h index 13cde963ff8..66acb6a9694 100644 --- a/src/mesa/main/shaderapi.h +++ b/src/mesa/main/shaderapi.h @@ -412,6 +412,12 @@ _mesa_dump_shader_source(const gl_shader_stage stage, const char *source); void _mesa_init_shader_includes(struct gl_shared_state *shared); +size_t +_mesa_get_shader_include_cursor(struct gl_shared_state *shared); + +void +_mesa_set_shader_include_cursor(struct gl_shared_state *shared, size_t cusor); + void _mesa_destroy_shader_includes(struct gl_shared_state *shared); |