mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-31 14:10:09 +01:00
st/mesa: don't call translate_*_program functions for NIR
move the initializaton to st_link_nir Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
This commit is contained in:
parent
f86b28dfdc
commit
f54dcaf232
3 changed files with 21 additions and 27 deletions
|
|
@ -160,7 +160,8 @@ st_program_string_notify( struct gl_context *ctx,
|
|||
}
|
||||
|
||||
st_release_fp_variants(st, stfp);
|
||||
if (!st_translate_fragment_program(st, stfp))
|
||||
if (!stfp->shader_program && /* not GLSL->NIR */
|
||||
!st_translate_fragment_program(st, stfp))
|
||||
return false;
|
||||
|
||||
if (st->fp == stfp)
|
||||
|
|
@ -169,7 +170,8 @@ st_program_string_notify( struct gl_context *ctx,
|
|||
struct st_vertex_program *stvp = (struct st_vertex_program *) prog;
|
||||
|
||||
st_release_vp_variants(st, stvp);
|
||||
if (!st_translate_vertex_program(st, stvp))
|
||||
if (!stvp->shader_program && /* not GLSL->NIR */
|
||||
!st_translate_vertex_program(st, stvp))
|
||||
return false;
|
||||
|
||||
if (st->vp == stvp)
|
||||
|
|
@ -178,7 +180,8 @@ st_program_string_notify( struct gl_context *ctx,
|
|||
struct st_common_program *stcp = st_common_program(prog);
|
||||
|
||||
st_release_basic_variants(st, stcp);
|
||||
if (!st_translate_common_program(st, stcp))
|
||||
if (!stcp->shader_program && /* not GLSL->NIR */
|
||||
!st_translate_common_program(st, stcp))
|
||||
return false;
|
||||
|
||||
if ((prog->info.stage == MESA_SHADER_TESS_CTRL && st->tcp == stcp) ||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
#include "st_context.h"
|
||||
#include "st_glsl_types.h"
|
||||
#include "st_program.h"
|
||||
#include "st_shader_cache.h"
|
||||
|
||||
#include "compiler/nir/nir.h"
|
||||
#include "compiler/glsl_types.h"
|
||||
|
|
@ -803,6 +804,18 @@ st_link_nir(struct gl_context *ctx,
|
|||
struct gl_program *prog = shader->Program;
|
||||
st_glsl_to_nir_post_opts(st, prog, shader_program);
|
||||
|
||||
/* Initialize st_vertex_program members. */
|
||||
if (i == MESA_SHADER_VERTEX)
|
||||
st_prepare_vertex_program(st_vertex_program(prog));
|
||||
|
||||
/* Get pipe_stream_output_info. */
|
||||
if (i == MESA_SHADER_VERTEX ||
|
||||
i == MESA_SHADER_TESS_EVAL ||
|
||||
i == MESA_SHADER_GEOMETRY)
|
||||
st_translate_stream_output_info(prog);
|
||||
|
||||
st_store_ir_in_disk_cache(st, prog, true);
|
||||
|
||||
if (!ctx->Driver.ProgramStringNotify(ctx,
|
||||
_mesa_shader_stage_to_program(i),
|
||||
prog)) {
|
||||
|
|
|
|||
|
|
@ -525,7 +525,7 @@ st_translate_vertex_program(struct st_context *st,
|
|||
output_semantic_index[num_outputs] = 0;
|
||||
|
||||
/* ARB_vp: */
|
||||
if (!stvp->glsl_to_tgsi && !stvp->shader_program) {
|
||||
if (!stvp->glsl_to_tgsi) {
|
||||
_mesa_remove_output_reads(&stvp->Base, PROGRAM_OUTPUT);
|
||||
|
||||
/* This determines which states will be updated when the assembly
|
||||
|
|
@ -541,12 +541,6 @@ st_translate_vertex_program(struct st_context *st,
|
|||
/* No samplers are allowed in ARB_vp. */
|
||||
}
|
||||
|
||||
if (stvp->shader_program) {
|
||||
st_translate_stream_output_info(&stvp->Base);
|
||||
st_store_ir_in_disk_cache(st, &stvp->Base, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
ureg = ureg_create_with_screen(PIPE_SHADER_VERTEX, st->pipe->screen);
|
||||
if (ureg == NULL)
|
||||
return false;
|
||||
|
|
@ -766,12 +760,6 @@ bool
|
|||
st_translate_fragment_program(struct st_context *st,
|
||||
struct st_fragment_program *stfp)
|
||||
{
|
||||
/* We have already compiled to NIR so just return */
|
||||
if (stfp->shader_program) {
|
||||
st_store_ir_in_disk_cache(st, &stfp->Base, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
ubyte outputMapping[2 * FRAG_RESULT_MAX];
|
||||
ubyte inputMapping[VARYING_SLOT_MAX];
|
||||
ubyte inputSlotToAttr[VARYING_SLOT_MAX];
|
||||
|
|
@ -793,7 +781,7 @@ st_translate_fragment_program(struct st_context *st,
|
|||
memset(inputSlotToAttr, ~0, sizeof(inputSlotToAttr));
|
||||
|
||||
/* Non-GLSL programs: */
|
||||
if (!stfp->glsl_to_tgsi && !stfp->shader_program) {
|
||||
if (!stfp->glsl_to_tgsi) {
|
||||
_mesa_remove_output_reads(&stfp->Base, PROGRAM_OUTPUT);
|
||||
if (st->ctx->Const.GLSLFragCoordIsSysVal)
|
||||
_mesa_program_fragment_position_to_sysval(&stfp->Base);
|
||||
|
|
@ -1446,16 +1434,6 @@ bool
|
|||
st_translate_common_program(struct st_context *st,
|
||||
struct st_common_program *stcp)
|
||||
{
|
||||
/* We have already compiled to NIR so just return */
|
||||
if (stcp->shader_program) {
|
||||
/* No variants */
|
||||
if (stcp->Base.info.stage == MESA_SHADER_TESS_EVAL ||
|
||||
stcp->Base.info.stage == MESA_SHADER_GEOMETRY)
|
||||
st_translate_stream_output_info(&stcp->Base);
|
||||
st_store_ir_in_disk_cache(st, &stcp->Base, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
struct gl_program *prog = &stcp->Base;
|
||||
enum pipe_shader_type stage =
|
||||
pipe_shader_type_from_mesa(stcp->Base.info.stage);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue