From 7530d4abfcf9d39fb1b4abeb77cdbf6cf1d411a7 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Fri, 22 Feb 2019 11:51:24 +1100 Subject: glsl/freedreno/panfrost: pass gl_context to the standalone compiler This allows us to use the ctx with glsl_to_nir() in a following patch. Reviewed-by: Eric Anholt --- src/compiler/glsl/main.cpp | 5 ++++- src/compiler/glsl/standalone.cpp | 4 +--- src/compiler/glsl/standalone.h | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src/compiler/glsl') diff --git a/src/compiler/glsl/main.cpp b/src/compiler/glsl/main.cpp index a730c033917..2ff561e011d 100644 --- a/src/compiler/glsl/main.cpp +++ b/src/compiler/glsl/main.cpp @@ -34,6 +34,7 @@ * offline compile GLSL code and examine the resulting GLSL IR. */ +#include "main/mtypes.h" #include "standalone.h" static struct standalone_options options; @@ -91,8 +92,10 @@ main(int argc, char * const* argv) usage_fail(argv[0]); struct gl_shader_program *whole_program; + static struct gl_context local_ctx; - whole_program = standalone_compile_shader(&options, argc - optind, &argv[optind]); + whole_program = standalone_compile_shader(&options, argc - optind, + &argv[optind], &local_ctx); if (!whole_program) usage_fail(argv[0]); diff --git a/src/compiler/glsl/standalone.cpp b/src/compiler/glsl/standalone.cpp index add4e4ea478..06869a0b3dc 100644 --- a/src/compiler/glsl/standalone.cpp +++ b/src/compiler/glsl/standalone.cpp @@ -400,11 +400,9 @@ compile_shader(struct gl_context *ctx, struct gl_shader *shader) extern "C" struct gl_shader_program * standalone_compile_shader(const struct standalone_options *_options, - unsigned num_files, char* const* files) + unsigned num_files, char* const* files, struct gl_context *ctx) { int status = EXIT_SUCCESS; - static struct gl_context local_ctx; - struct gl_context *ctx = &local_ctx; bool glsl_es = false; options = _options; diff --git a/src/compiler/glsl/standalone.h b/src/compiler/glsl/standalone.h index 5029e168119..d9e14f798a3 100644 --- a/src/compiler/glsl/standalone.h +++ b/src/compiler/glsl/standalone.h @@ -42,7 +42,8 @@ struct gl_shader_program; struct gl_shader_program * standalone_compile_shader( const struct standalone_options *options, - unsigned num_files, char* const* files); + unsigned num_files, char* const* files, + struct gl_context *ctx); void standalone_compiler_cleanup(struct gl_shader_program *prog); -- cgit v1.2.3