diff options
author | Marek Olšák <[email protected]> | 2019-10-15 22:20:17 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2019-10-16 20:10:47 -0400 |
commit | 4857d695f5827cbdfb406a55c2d5d75f7fd8cee9 (patch) | |
tree | 23f76450632e14c7b46c86172ec009fda6ab1f41 /src | |
parent | 5d0630e5043fc25aea3788c6a94059e2aceedf06 (diff) |
st/mesa: reorder and document code in st_translate_vertex_program
move the TGSI code after the ARB_vp code
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/state_tracker/st_program.c | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 0d74ad4bb60..4d0906ace78 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -509,21 +509,6 @@ st_translate_vertex_program(struct st_context *st, st_prepare_vertex_program(stvp); - /* Get semantic names and indices. */ - for (attr = 0; attr < VARYING_SLOT_MAX; attr++) { - if (stvp->Base.info.outputs_written & BITFIELD64_BIT(attr)) { - unsigned slot = num_outputs++; - unsigned semantic_name, semantic_index; - tgsi_get_gl_varying_semantic(attr, st->needs_texcoord_semantic, - &semantic_name, &semantic_index); - output_semantic_name[slot] = semantic_name; - output_semantic_index[slot] = semantic_index; - } - } - /* pre-setup potentially unused edgeflag output */ - output_semantic_name[num_outputs] = TGSI_SEMANTIC_EDGEFLAG; - output_semantic_index[num_outputs] = 0; - /* ARB_vp: */ if (!stvp->glsl_to_tgsi) { _mesa_remove_output_reads(&stvp->Base, PROGRAM_OUTPUT); @@ -541,6 +526,21 @@ st_translate_vertex_program(struct st_context *st, /* No samplers are allowed in ARB_vp. */ } + /* Get semantic names and indices. */ + for (attr = 0; attr < VARYING_SLOT_MAX; attr++) { + if (stvp->Base.info.outputs_written & BITFIELD64_BIT(attr)) { + unsigned slot = num_outputs++; + unsigned semantic_name, semantic_index; + tgsi_get_gl_varying_semantic(attr, st->needs_texcoord_semantic, + &semantic_name, &semantic_index); + output_semantic_name[slot] = semantic_name; + output_semantic_index[slot] = semantic_index; + } + } + /* pre-setup potentially unused edgeflag output */ + output_semantic_name[num_outputs] = TGSI_SEMANTIC_EDGEFLAG; + output_semantic_index[num_outputs] = 0; + ureg = ureg_create_with_screen(PIPE_SHADER_VERTEX, st->pipe->screen); if (ureg == NULL) return false; @@ -612,11 +612,17 @@ st_translate_vertex_program(struct st_context *st, st_store_ir_in_disk_cache(st, &stvp->Base, false); } - bool use_nir = PIPE_SHADER_IR_NIR == - st->pipe->screen->get_shader_param(st->pipe->screen, PIPE_SHADER_VERTEX, - PIPE_SHADER_CAP_PREFERRED_IR); + /* Translate to NIR. + * + * This must be done after the translation to TGSI is done, because + * we'll pass the NIR shader to the driver and the TGSI version to + * the draw module for the select/feedback/rasterpos code. + */ + if (st->pipe->screen->get_shader_param(st->pipe->screen, + PIPE_SHADER_VERTEX, + PIPE_SHADER_CAP_PREFERRED_IR)) { + assert(!stvp->glsl_to_tgsi); - if (use_nir) { nir_shader *nir = st_translate_prog_to_nir(st, &stvp->Base, MESA_SHADER_VERTEX); |