summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/glcpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/glsl/glcpp')
-rw-r--r--src/compiler/glsl/glcpp/glcpp-parse.y14
-rw-r--r--src/compiler/glsl/glcpp/glcpp.h4
-rw-r--r--src/compiler/glsl/glcpp/pp.c2
3 files changed, 17 insertions, 3 deletions
diff --git a/src/compiler/glsl/glcpp/glcpp-parse.y b/src/compiler/glsl/glcpp/glcpp-parse.y
index 63012bc6e52..ee553773670 100644
--- a/src/compiler/glsl/glcpp/glcpp-parse.y
+++ b/src/compiler/glsl/glcpp/glcpp-parse.y
@@ -1334,7 +1334,8 @@ add_builtin_define(glcpp_parser_t *parser, const char *name, int value)
}
glcpp_parser_t *
-glcpp_parser_create(glcpp_extension_iterator extensions, void *state, gl_api api)
+glcpp_parser_create(const struct gl_extensions *extension_list,
+ glcpp_extension_iterator extensions, void *state, gl_api api)
{
glcpp_parser_t *parser;
@@ -1369,6 +1370,7 @@ glcpp_parser_create(glcpp_extension_iterator extensions, void *state, gl_api api
parser->error = 0;
parser->extensions = extensions;
+ parser->extension_list = extension_list;
parser->state = state;
parser->api = api;
parser->version = 0;
@@ -2335,6 +2337,16 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t versio
parser->extensions(parser->state, add_builtin_define, parser,
version, parser->is_gles);
+ if (parser->extension_list) {
+ /* If MESA_shader_integer_functions is supported, then the building
+ * blocks required for the 64x64 => 64 multiply exist. Add defines for
+ * those functions so that they can be tested.
+ */
+ if (parser->extension_list->MESA_shader_integer_functions) {
+ add_builtin_define(parser, "__have_builtin_builtin_umul64", 1);
+ }
+ }
+
if (explicitly_set) {
ralloc_asprintf_rewrite_tail(&parser->output, &parser->output_length,
"#version %" PRIiMAX "%s%s", version,
diff --git a/src/compiler/glsl/glcpp/glcpp.h b/src/compiler/glsl/glcpp/glcpp.h
index 232e053f46b..2804636c30e 100644
--- a/src/compiler/glsl/glcpp/glcpp.h
+++ b/src/compiler/glsl/glcpp/glcpp.h
@@ -205,6 +205,7 @@ struct glcpp_parser {
size_t info_log_length;
int error;
glcpp_extension_iterator extensions;
+ const struct gl_extensions *extension_list;
void *state;
gl_api api;
unsigned version;
@@ -225,7 +226,8 @@ struct glcpp_parser {
};
glcpp_parser_t *
-glcpp_parser_create (glcpp_extension_iterator extensions, void *state, gl_api api);
+glcpp_parser_create(const struct gl_extensions *extension_list,
+ glcpp_extension_iterator extensions, void *state, gl_api api);
int
glcpp_parser_parse (glcpp_parser_t *parser);
diff --git a/src/compiler/glsl/glcpp/pp.c b/src/compiler/glsl/glcpp/pp.c
index b5912799371..c526f37719c 100644
--- a/src/compiler/glsl/glcpp/pp.c
+++ b/src/compiler/glsl/glcpp/pp.c
@@ -218,7 +218,7 @@ glcpp_preprocess(void *ralloc_ctx, const char **shader, char **info_log,
{
int errors;
glcpp_parser_t *parser =
- glcpp_parser_create(extensions, state, gl_ctx->API);
+ glcpp_parser_create(&gl_ctx->Extensions, extensions, state, gl_ctx->API);
if (! gl_ctx->Const.DisableGLSLLineContinuations)
*shader = remove_line_continuations(parser, *shader);