From: Samuel Pitoiset Date: Mon, 27 Jan 2020 17:45:26 +0000 (+0100) Subject: compiler: add PERSP to the existing barycentric system values X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=15d53d8294bf5cfd0685422de99e8398bb52fdb8;p=mesa.git compiler: add PERSP to the existing barycentric system values We need the LINEAR versions for AMD_shader_explicit_vertex_parameter. Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen Part-of: --- diff --git a/src/compiler/shader_enums.c b/src/compiler/shader_enums.c index 90b9881ff78..6f61728032a 100644 --- a/src/compiler/shader_enums.c +++ b/src/compiler/shader_enums.c @@ -250,10 +250,10 @@ gl_system_value_name(gl_system_value sysval) ENUM(SYSTEM_VALUE_DEVICE_INDEX), ENUM(SYSTEM_VALUE_VIEW_INDEX), ENUM(SYSTEM_VALUE_VERTEX_CNT), - ENUM(SYSTEM_VALUE_BARYCENTRIC_PIXEL), - ENUM(SYSTEM_VALUE_BARYCENTRIC_SAMPLE), - ENUM(SYSTEM_VALUE_BARYCENTRIC_CENTROID), - ENUM(SYSTEM_VALUE_BARYCENTRIC_SIZE), + ENUM(SYSTEM_VALUE_BARYCENTRIC_PERSP_PIXEL), + ENUM(SYSTEM_VALUE_BARYCENTRIC_PERSP_SAMPLE), + ENUM(SYSTEM_VALUE_BARYCENTRIC_PERSP_CENTROID), + ENUM(SYSTEM_VALUE_BARYCENTRIC_PERSP_SIZE), ENUM(SYSTEM_VALUE_GS_HEADER_IR3), ENUM(SYSTEM_VALUE_TCS_HEADER_IR3), }; diff --git a/src/compiler/shader_enums.h b/src/compiler/shader_enums.h index 86ae5e9b87a..29b88c9cd43 100644 --- a/src/compiler/shader_enums.h +++ b/src/compiler/shader_enums.h @@ -636,10 +636,10 @@ typedef enum * The _SIZE value is "primitive size", used to scale i/j in primitive * space to pixel space. */ - SYSTEM_VALUE_BARYCENTRIC_PIXEL, - SYSTEM_VALUE_BARYCENTRIC_SAMPLE, - SYSTEM_VALUE_BARYCENTRIC_CENTROID, - SYSTEM_VALUE_BARYCENTRIC_SIZE, + SYSTEM_VALUE_BARYCENTRIC_PERSP_PIXEL, + SYSTEM_VALUE_BARYCENTRIC_PERSP_SAMPLE, + SYSTEM_VALUE_BARYCENTRIC_PERSP_CENTROID, + SYSTEM_VALUE_BARYCENTRIC_PERSP_SIZE, /** * IR3 specific geometry shader and tesselation control shader system diff --git a/src/freedreno/ir3/ir3_compiler_nir.c b/src/freedreno/ir3/ir3_compiler_nir.c index 51715025561..1ae1dfd8e63 100644 --- a/src/freedreno/ir3/ir3_compiler_nir.c +++ b/src/freedreno/ir3/ir3_compiler_nir.c @@ -1268,7 +1268,7 @@ get_barycentric_centroid(struct ir3_context *ctx) struct ir3_instruction *xy[2]; struct ir3_instruction *ij; - ij = create_sysval_input(ctx, SYSTEM_VALUE_BARYCENTRIC_CENTROID, 0x3); + ij = create_sysval_input(ctx, SYSTEM_VALUE_BARYCENTRIC_PERSP_CENTROID, 0x3); ir3_split_dest(ctx->block, xy, ij, 0, 2); ctx->ij_centroid = ir3_create_collect(ctx, xy, 2); @@ -1284,7 +1284,7 @@ get_barycentric_sample(struct ir3_context *ctx) struct ir3_instruction *xy[2]; struct ir3_instruction *ij; - ij = create_sysval_input(ctx, SYSTEM_VALUE_BARYCENTRIC_SAMPLE, 0x3); + ij = create_sysval_input(ctx, SYSTEM_VALUE_BARYCENTRIC_PERSP_SAMPLE, 0x3); ir3_split_dest(ctx->block, xy, ij, 0, 2); ctx->ij_sample = ir3_create_collect(ctx, xy, 2); @@ -1509,7 +1509,7 @@ emit_intrinsic(struct ir3_context *ctx, nir_intrinsic_instr *intr) case nir_intrinsic_load_size_ir3: if (!ctx->ij_size) { ctx->ij_size = - create_sysval_input(ctx, SYSTEM_VALUE_BARYCENTRIC_SIZE, 0x1); + create_sysval_input(ctx, SYSTEM_VALUE_BARYCENTRIC_PERSP_SIZE, 0x1); } dst[0] = ctx->ij_size; break; @@ -3059,7 +3059,7 @@ emit_instructions(struct ir3_context *ctx) * because sysvals need to be appended after varyings: */ if (vcoord) { - add_sysval_input_compmask(ctx, SYSTEM_VALUE_BARYCENTRIC_PIXEL, + add_sysval_input_compmask(ctx, SYSTEM_VALUE_BARYCENTRIC_PERSP_PIXEL, 0x3, vcoord); } @@ -3462,7 +3462,7 @@ ir3_compile_shader_nir(struct ir3_compiler *compiler, int idx = 0; foreach_input(instr, ir) { - if (instr->input.sysval != SYSTEM_VALUE_BARYCENTRIC_PIXEL) + if (instr->input.sysval != SYSTEM_VALUE_BARYCENTRIC_PERSP_PIXEL) continue; assert(idx < ARRAY_SIZE(precolor)); diff --git a/src/freedreno/ir3/ir3_depth.c b/src/freedreno/ir3/ir3_depth.c index d2ab9feaa45..f1f7b94b2fc 100644 --- a/src/freedreno/ir3/ir3_depth.c +++ b/src/freedreno/ir3/ir3_depth.c @@ -224,7 +224,7 @@ compute_depth_and_remove_unused(struct ir3 *ir, struct ir3_shader_variant *so) */ if (so->num_sampler_prefetch && (instr->opc == OPC_META_INPUT) && - (instr->input.sysval == SYSTEM_VALUE_BARYCENTRIC_PIXEL)) + (instr->input.sysval == SYSTEM_VALUE_BARYCENTRIC_PERSP_PIXEL)) continue; instr->flags |= IR3_INSTR_UNUSED; } diff --git a/src/freedreno/ir3/ir3_shader.c b/src/freedreno/ir3/ir3_shader.c index 3ee0617bf4b..559a017d747 100644 --- a/src/freedreno/ir3/ir3_shader.c +++ b/src/freedreno/ir3/ir3_shader.c @@ -470,11 +470,11 @@ ir3_shader_disasm(struct ir3_shader_variant *so, uint32_t *bin, FILE *out) break; case MESA_SHADER_FRAGMENT: dump_reg(out, "pos (ij_pixel)", - ir3_find_sysval_regid(so, SYSTEM_VALUE_BARYCENTRIC_PIXEL)); + ir3_find_sysval_regid(so, SYSTEM_VALUE_BARYCENTRIC_PERSP_PIXEL)); dump_reg(out, "pos (ij_centroid)", - ir3_find_sysval_regid(so, SYSTEM_VALUE_BARYCENTRIC_CENTROID)); + ir3_find_sysval_regid(so, SYSTEM_VALUE_BARYCENTRIC_PERSP_CENTROID)); dump_reg(out, "pos (ij_size)", - ir3_find_sysval_regid(so, SYSTEM_VALUE_BARYCENTRIC_SIZE)); + ir3_find_sysval_regid(so, SYSTEM_VALUE_BARYCENTRIC_PERSP_SIZE)); dump_output(out, so, FRAG_RESULT_DEPTH, "posz"); if (so->color0_mrt) { dump_output(out, so, FRAG_RESULT_COLOR, "color"); diff --git a/src/freedreno/vulkan/tu_pipeline.c b/src/freedreno/vulkan/tu_pipeline.c index 0aff134637a..a0e22e7bce8 100644 --- a/src/freedreno/vulkan/tu_pipeline.c +++ b/src/freedreno/vulkan/tu_pipeline.c @@ -760,10 +760,10 @@ tu6_emit_fs_inputs(struct tu_cs *cs, const struct ir3_shader_variant *fs) face_regid = ir3_find_sysval_regid(fs, SYSTEM_VALUE_FRONT_FACE); coord_regid = ir3_find_sysval_regid(fs, SYSTEM_VALUE_FRAG_COORD); zwcoord_regid = VALIDREG(coord_regid) ? coord_regid + 2 : regid(63, 0); - ij_pix_regid = ir3_find_sysval_regid(fs, SYSTEM_VALUE_BARYCENTRIC_PIXEL); - ij_samp_regid = ir3_find_sysval_regid(fs, SYSTEM_VALUE_BARYCENTRIC_SAMPLE); - ij_cent_regid = ir3_find_sysval_regid(fs, SYSTEM_VALUE_BARYCENTRIC_CENTROID); - ij_size_regid = ir3_find_sysval_regid(fs, SYSTEM_VALUE_BARYCENTRIC_SIZE); + ij_pix_regid = ir3_find_sysval_regid(fs, SYSTEM_VALUE_BARYCENTRIC_PERSP_PIXEL); + ij_samp_regid = ir3_find_sysval_regid(fs, SYSTEM_VALUE_BARYCENTRIC_PERSP_SAMPLE); + ij_cent_regid = ir3_find_sysval_regid(fs, SYSTEM_VALUE_BARYCENTRIC_PERSP_CENTROID); + ij_size_regid = ir3_find_sysval_regid(fs, SYSTEM_VALUE_BARYCENTRIC_PERSP_SIZE); if (fs->num_sampler_prefetch > 0) { assert(VALIDREG(ij_pix_regid)); diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_program.c b/src/gallium/drivers/freedreno/a3xx/fd3_program.c index 6c0f066e15a..c6a07b19389 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_program.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_program.c @@ -174,7 +174,7 @@ fd3_program_emit(struct fd_ringbuffer *ring, struct fd3_emit *emit, face_regid = ir3_find_sysval_regid(fp, SYSTEM_VALUE_FRONT_FACE); coord_regid = ir3_find_sysval_regid(fp, SYSTEM_VALUE_FRAG_COORD); zwcoord_regid = (coord_regid == regid(63,0)) ? regid(63,0) : (coord_regid + 2); - vcoord_regid = ir3_find_sysval_regid(fp, SYSTEM_VALUE_BARYCENTRIC_PIXEL); + vcoord_regid = ir3_find_sysval_regid(fp, SYSTEM_VALUE_BARYCENTRIC_PERSP_PIXEL); /* adjust regids for alpha output formats. there is no alpha render * format, so it's just treated like red diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_program.c b/src/gallium/drivers/freedreno/a4xx/fd4_program.c index ae86c35fe45..4a0e7568250 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_program.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_program.c @@ -208,7 +208,7 @@ fd4_program_emit(struct fd_ringbuffer *ring, struct fd4_emit *emit, face_regid = ir3_find_sysval_regid(s[FS].v, SYSTEM_VALUE_FRONT_FACE); coord_regid = ir3_find_sysval_regid(s[FS].v, SYSTEM_VALUE_FRAG_COORD); zwcoord_regid = (coord_regid == regid(63,0)) ? regid(63,0) : (coord_regid + 2); - vcoord_regid = ir3_find_sysval_regid(s[FS].v, SYSTEM_VALUE_BARYCENTRIC_PIXEL); + vcoord_regid = ir3_find_sysval_regid(s[FS].v, SYSTEM_VALUE_BARYCENTRIC_PERSP_PIXEL); /* we could probably divide this up into things that need to be * emitted if frag-prog is dirty vs if vert-prog is dirty.. diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_program.c b/src/gallium/drivers/freedreno/a5xx/fd5_program.c index 53718db341b..b427f989470 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_program.c +++ b/src/gallium/drivers/freedreno/a5xx/fd5_program.c @@ -320,7 +320,7 @@ fd5_program_emit(struct fd_context *ctx, struct fd_ringbuffer *ring, face_regid = ir3_find_sysval_regid(s[FS].v, SYSTEM_VALUE_FRONT_FACE); coord_regid = ir3_find_sysval_regid(s[FS].v, SYSTEM_VALUE_FRAG_COORD); zwcoord_regid = (coord_regid == regid(63,0)) ? regid(63,0) : (coord_regid + 2); - vcoord_regid = ir3_find_sysval_regid(s[FS].v, SYSTEM_VALUE_BARYCENTRIC_PIXEL); + vcoord_regid = ir3_find_sysval_regid(s[FS].v, SYSTEM_VALUE_BARYCENTRIC_PERSP_PIXEL); /* we could probably divide this up into things that need to be * emitted if frag-prog is dirty vs if vert-prog is dirty.. diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_program.c b/src/gallium/drivers/freedreno/a6xx/fd6_program.c index ffd633aa6c0..96bed761579 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_program.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_program.c @@ -352,10 +352,10 @@ setup_stateobj(struct fd_ringbuffer *ring, struct fd_screen *screen, face_regid = ir3_find_sysval_regid(fs, SYSTEM_VALUE_FRONT_FACE); coord_regid = ir3_find_sysval_regid(fs, SYSTEM_VALUE_FRAG_COORD); zwcoord_regid = next_regid(coord_regid, 2); - ij_pix_regid = ir3_find_sysval_regid(fs, SYSTEM_VALUE_BARYCENTRIC_PIXEL); - ij_samp_regid = ir3_find_sysval_regid(fs, SYSTEM_VALUE_BARYCENTRIC_SAMPLE); - ij_cent_regid = ir3_find_sysval_regid(fs, SYSTEM_VALUE_BARYCENTRIC_CENTROID); - ij_size_regid = ir3_find_sysval_regid(fs, SYSTEM_VALUE_BARYCENTRIC_SIZE); + ij_pix_regid = ir3_find_sysval_regid(fs, SYSTEM_VALUE_BARYCENTRIC_PERSP_PIXEL); + ij_samp_regid = ir3_find_sysval_regid(fs, SYSTEM_VALUE_BARYCENTRIC_PERSP_SAMPLE); + ij_cent_regid = ir3_find_sysval_regid(fs, SYSTEM_VALUE_BARYCENTRIC_PERSP_CENTROID); + ij_size_regid = ir3_find_sysval_regid(fs, SYSTEM_VALUE_BARYCENTRIC_PERSP_SIZE); posz_regid = ir3_find_output_regid(fs, FRAG_RESULT_DEPTH); smask_regid = ir3_find_output_regid(fs, FRAG_RESULT_SAMPLE_MASK); diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 15e912d27aa..f23d27c09ad 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -5879,10 +5879,10 @@ _mesa_sysval_to_semantic(unsigned sysval) case SYSTEM_VALUE_LOCAL_INVOCATION_INDEX: case SYSTEM_VALUE_GLOBAL_INVOCATION_ID: case SYSTEM_VALUE_VERTEX_CNT: - case SYSTEM_VALUE_BARYCENTRIC_PIXEL: - case SYSTEM_VALUE_BARYCENTRIC_SAMPLE: - case SYSTEM_VALUE_BARYCENTRIC_CENTROID: - case SYSTEM_VALUE_BARYCENTRIC_SIZE: + case SYSTEM_VALUE_BARYCENTRIC_PERSP_PIXEL: + case SYSTEM_VALUE_BARYCENTRIC_PERSP_SAMPLE: + case SYSTEM_VALUE_BARYCENTRIC_PERSP_CENTROID: + case SYSTEM_VALUE_BARYCENTRIC_PERSP_SIZE: default: assert(!"Unexpected SYSTEM_VALUE_ enum"); return TGSI_SEMANTIC_COUNT;