st/mesa: start deduplicating some program code

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
This commit is contained in:
Marek Olšák 2019-11-01 22:04:57 -04:00
parent 445ec0fc63
commit 60398e2d45
4 changed files with 13 additions and 13 deletions

View file

@ -123,7 +123,6 @@ st_delete_program(struct gl_context *ctx, struct gl_program *prog)
_mesa_delete_program( ctx, prog );
}
/**
* Called via ctx->Driver.ProgramStringNotify()
* Called when the program's text/code is changed. We have to free
@ -135,7 +134,6 @@ st_program_string_notify( struct gl_context *ctx,
struct gl_program *prog )
{
struct st_context *st = st_context(ctx);
gl_shader_stage stage = _mesa_program_enum_to_shader_stage(target);
if (target == GL_FRAGMENT_PROGRAM_ARB ||
target == GL_FRAGMENT_SHADER_ATI) {
@ -180,10 +178,7 @@ st_program_string_notify( struct gl_context *ctx,
st->dirty |= stcp->affected_states;
}
if (ST_DEBUG & DEBUG_PRECOMPILE ||
st->shader_has_one_variant[stage])
st_precompile_shader_variant(st, prog);
st_finalize_program(st, prog);
return GL_TRUE;
}

View file

@ -2005,7 +2005,7 @@ st_destroy_program_variants(struct st_context *st)
/**
* Compile one shader variant.
*/
void
static void
st_precompile_shader_variant(struct st_context *st,
struct gl_program *prog)
{
@ -2050,3 +2050,12 @@ st_precompile_shader_variant(struct st_context *st,
assert(0);
}
}
void
st_finalize_program(struct st_context *st, struct gl_program *prog)
{
/* Create Gallium shaders now instead of on demand. */
if (ST_DEBUG & DEBUG_PRECOMPILE ||
st->shader_has_one_variant[prog->info.stage])
st_precompile_shader_variant(st, prog);
}

View file

@ -378,8 +378,7 @@ st_translate_common_program(struct st_context *st,
struct st_common_program *stcp);
extern void
st_precompile_shader_variant(struct st_context *st,
struct gl_program *prog);
st_finalize_program(struct st_context *st, struct gl_program *prog);
#ifdef __cplusplus
}

View file

@ -270,10 +270,7 @@ st_deserialise_ir_program(struct gl_context *ctx,
st_set_prog_affected_state_flags(prog);
_mesa_associate_uniform_storage(ctx, shProg, prog);
/* Create Gallium shaders now instead of on demand. */
if (ST_DEBUG & DEBUG_PRECOMPILE ||
st->shader_has_one_variant[prog->info.stage])
st_precompile_shader_variant(st, prog);
st_finalize_program(st, prog);
}
bool