aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Roberts <[email protected]>2020-06-22 09:52:25 +0200
committerMarge Bot <[email protected]>2020-07-06 21:59:16 +0000
commit207da33a86d1a2b45995a7fd123afb761b1d841f (patch)
tree75d11d8858731e7fa7e648652eb08ea7ca8857f7
parent121b82f6387c267731a18f3cb9762cedf99ebb6d (diff)
v3d: Handle the line width intrinsics
Adds new QUNIFORMs to store the line widths. v2: Also handle the aa_line_width intrinsic Reviewed-by: Eric Anholt <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5624>
-rw-r--r--src/broadcom/compiler/nir_to_vir.c10
-rw-r--r--src/broadcom/compiler/v3d_compiler.h7
-rw-r--r--src/broadcom/compiler/vir_dump.c2
-rw-r--r--src/gallium/drivers/v3d/v3d_uniforms.c11
4 files changed, 30 insertions, 0 deletions
diff --git a/src/broadcom/compiler/nir_to_vir.c b/src/broadcom/compiler/nir_to_vir.c
index 3fba318373f..d95361731cb 100644
--- a/src/broadcom/compiler/nir_to_vir.c
+++ b/src/broadcom/compiler/nir_to_vir.c
@@ -2169,6 +2169,16 @@ ntq_emit_intrinsic(struct v3d_compile *c, nir_intrinsic_instr *instr)
ntq_store_dest(c, &instr->dest, 0, vir_MOV(c, c->line_x));
break;
+ case nir_intrinsic_load_line_width:
+ ntq_store_dest(c, &instr->dest, 0,
+ vir_uniform(c, QUNIFORM_LINE_WIDTH, 0));
+ break;
+
+ case nir_intrinsic_load_aa_line_width:
+ ntq_store_dest(c, &instr->dest, 0,
+ vir_uniform(c, QUNIFORM_AA_LINE_WIDTH, 0));
+ break;
+
case nir_intrinsic_load_sample_mask_in:
ntq_store_dest(c, &instr->dest, 0, vir_MSF(c));
break;
diff --git a/src/broadcom/compiler/v3d_compiler.h b/src/broadcom/compiler/v3d_compiler.h
index 296bd840314..d6de62486d9 100644
--- a/src/broadcom/compiler/v3d_compiler.h
+++ b/src/broadcom/compiler/v3d_compiler.h
@@ -261,6 +261,13 @@ enum quniform_contents {
QUNIFORM_ALPHA_REF,
+ QUNIFORM_LINE_WIDTH,
+
+ /* The line width sent to hardware. This includes the expanded width
+ * when anti-aliasing is enabled.
+ */
+ QUNIFORM_AA_LINE_WIDTH,
+
/* Number of workgroups passed to glDispatchCompute in the dimension
* selected by the data value.
*/
diff --git a/src/broadcom/compiler/vir_dump.c b/src/broadcom/compiler/vir_dump.c
index 9e1ef1e9d4c..daf9e37843f 100644
--- a/src/broadcom/compiler/vir_dump.c
+++ b/src/broadcom/compiler/vir_dump.c
@@ -31,6 +31,8 @@ vir_dump_uniform(enum quniform_contents contents,
{
static const char *quniform_names[] = {
[QUNIFORM_ALPHA_REF] = "alpha_ref",
+ [QUNIFORM_LINE_WIDTH] = "line_width",
+ [QUNIFORM_AA_LINE_WIDTH] = "aa_line_width",
[QUNIFORM_VIEWPORT_X_SCALE] = "vp_x_scale",
[QUNIFORM_VIEWPORT_Y_SCALE] = "vp_y_scale",
[QUNIFORM_VIEWPORT_Z_OFFSET] = "vp_z_offset",
diff --git a/src/gallium/drivers/v3d/v3d_uniforms.c b/src/gallium/drivers/v3d/v3d_uniforms.c
index ab57880f06f..64fde274a99 100644
--- a/src/gallium/drivers/v3d/v3d_uniforms.c
+++ b/src/gallium/drivers/v3d/v3d_uniforms.c
@@ -312,6 +312,12 @@ v3d_write_uniforms(struct v3d_context *v3d, struct v3d_job *job,
v3d->zsa->base.alpha.ref_value);
break;
+ case QUNIFORM_LINE_WIDTH:
+ case QUNIFORM_AA_LINE_WIDTH:
+ cl_aligned_f(&uniforms,
+ v3d->rasterizer->base.line_width);
+ break;
+
case QUNIFORM_UBO_ADDR: {
uint32_t unit = v3d_unit_data_get_unit(data);
/* Constant buffer 0 may be a system memory pointer,
@@ -464,6 +470,11 @@ v3d_set_shader_uniform_dirty_flags(struct v3d_compiled_shader *shader)
dirty |= VC5_DIRTY_ZSA;
break;
+ case QUNIFORM_LINE_WIDTH:
+ case QUNIFORM_AA_LINE_WIDTH:
+ dirty |= VC5_DIRTY_RASTERIZER;
+ break;
+
case QUNIFORM_NUM_WORK_GROUPS:
case QUNIFORM_SHARED_OFFSET:
/* Compute always recalculates uniforms. */