From 41f51fe815c74c2bcd2611c47e228236c3e827e4 Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Tue, 28 Feb 2023 16:12:33 -0800 Subject: [PATCH] glsl/standalone: Make all standalone contexts have NewProgram set. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit It was in the standalone compiler but not unit tests. Only the standalone compiler had done linking and needed it, so far. Reviewed-by: Marek Olšák Part-of: --- src/compiler/glsl/standalone.cpp | 20 -------------------- src/compiler/glsl/standalone_scaffolding.cpp | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/compiler/glsl/standalone.cpp b/src/compiler/glsl/standalone.cpp index 16f4c4c..e8e4012 100644 --- a/src/compiler/glsl/standalone.cpp +++ b/src/compiler/glsl/standalone.cpp @@ -96,24 +96,6 @@ private: set *variables; }; -static void -init_gl_program(struct gl_program *prog, bool is_arb_asm, gl_shader_stage stage) -{ - prog->RefCount = 1; - prog->Format = GL_PROGRAM_FORMAT_ASCII_ARB; - prog->info.use_legacy_math_rules = is_arb_asm; - prog->info.stage = stage; -} - -static struct gl_program * -new_program(UNUSED struct gl_context *ctx, gl_shader_stage stage, - UNUSED GLuint id, bool is_arb_asm) -{ - struct gl_program *prog = rzalloc(NULL, struct gl_program); - init_gl_program(prog, is_arb_asm, stage); - return prog; -} - static const struct standalone_options *options; static void @@ -327,8 +309,6 @@ initialize_context(struct gl_context *ctx, gl_api api) /* GL_ARB_explicit_uniform_location, GL_MAX_UNIFORM_LOCATIONS */ ctx->Const.MaxUserAssignableUniformLocations = 4 * MESA_SHADER_STAGES * MAX_UNIFORMS; - - ctx->Driver.NewProgram = new_program; } /* Returned string will have 'ctx' as its ralloc owner. */ diff --git a/src/compiler/glsl/standalone_scaffolding.cpp b/src/compiler/glsl/standalone_scaffolding.cpp index 6396d3e..aa02880 100644 --- a/src/compiler/glsl/standalone_scaffolding.cpp +++ b/src/compiler/glsl/standalone_scaffolding.cpp @@ -178,6 +178,25 @@ _mesa_clear_shader_program_data(struct gl_context *ctx, shProg->data->NumAtomicBuffers = 0; } + +static void +init_gl_program(struct gl_program *prog, bool is_arb_asm, gl_shader_stage stage) +{ + prog->RefCount = 1; + prog->Format = GL_PROGRAM_FORMAT_ASCII_ARB; + prog->info.use_legacy_math_rules = is_arb_asm; + prog->info.stage = stage; +} + +static struct gl_program * +standalone_new_program(UNUSED struct gl_context *ctx, gl_shader_stage stage, + UNUSED GLuint id, bool is_arb_asm) +{ + struct gl_program *prog = rzalloc(NULL, struct gl_program); + init_gl_program(prog, is_arb_asm, stage); + return prog; +} + void initialize_context_to_defaults(struct gl_context *ctx, gl_api api) { memset(ctx, 0, sizeof(*ctx)); @@ -271,6 +290,8 @@ void initialize_context_to_defaults(struct gl_context *ctx, gl_api api) memcpy(&ctx->Const.ShaderCompilerOptions[sh], &options, sizeof(options)); _mesa_locale_init(); + + ctx->Driver.NewProgram = standalone_new_program; } struct gl_shader_program * -- 2.7.4