glsl/standalone: Make all standalone contexts have NewProgram set.

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 <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21886>
This commit is contained in:
Emma Anholt 2023-02-28 16:12:33 -08:00 committed by Marge Bot
parent 9b5326bdc1
commit 41f51fe815
2 changed files with 21 additions and 20 deletions

View file

@ -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. */

View file

@ -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 *