_mesa_lookup_shader_include(struct gl_context *ctx, char *path,
bool error_check);
+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 cursor);
+
static void
yyerror(YYLTYPE *locp, glcpp_parser_t *parser, const char *error);
}
}
| HASH_TOKEN INCLUDE NEWLINE {
+ size_t include_cursor = _mesa_get_shader_include_cursor(parser->gl_ctx->Shared);
+
/* Remove leading and trailing "" or <> */
char *start = strchr($2, '"');
- if (!start)
+ if (!start) {
+ _mesa_set_shader_include_cursor(parser->gl_ctx->Shared, 0);
start = strchr($2, '<');
+ }
char *path = strndup(start + 1, strlen(start + 1) - 1);
const char *shader =
glcpp_lex_destroy(tmp_parser->scanner);
_mesa_hash_table_destroy(tmp_parser->defines, NULL);
}
+
+ _mesa_set_shader_include_cursor(parser->gl_ctx->Shared, include_cursor);
}
| HASH_TOKEN IF pp_tokens NEWLINE {
/* Be careful to only evaluate the 'if' expression if
return NULL;
}
+
+size_t
+_mesa_get_shader_include_cursor(struct gl_shared_state *shared)
+{
+ (void) shared;
+
+ return 0;
+}
+
+void
+_mesa_set_shader_include_cursor(struct gl_shared_state *shared,
+ size_t cursor)
+{
+ (void) shared;
+ (void) cursor;
+}
_mesa_lookup_shader_include(struct gl_context *ctx, char *path,
bool error_check);
+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 cursor);
+
#endif /* PP_STANDALONE_SCAFFOLDING_H */
/* 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;
_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)
{
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);