summaryrefslogtreecommitdiff
path: root/src/gallium/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/vc5/vc5_context.h1
-rw-r--r--src/gallium/drivers/vc5/vc5_draw.c3
-rw-r--r--src/gallium/drivers/vc5/vc5_emit.c39
-rw-r--r--src/gallium/drivers/vc5/vc5_program.c14
4 files changed, 53 insertions, 4 deletions
diff --git a/src/gallium/drivers/vc5/vc5_context.h b/src/gallium/drivers/vc5/vc5_context.h
index e08a2a59909..9e55f80f947 100644
--- a/src/gallium/drivers/vc5/vc5_context.h
+++ b/src/gallium/drivers/vc5/vc5_context.h
@@ -82,6 +82,7 @@ void vc5_job_add_bo(struct vc5_job *job, struct vc5_bo *bo);
#define VC5_DIRTY_FS_INPUTS (1 << 26)
#define VC5_DIRTY_STREAMOUT (1 << 27)
#define VC5_DIRTY_OQ (1 << 28)
+#define VC5_DIRTY_CENTROID_FLAGS (1 << 29)
#define VC5_MAX_FS_INPUTS 64
diff --git a/src/gallium/drivers/vc5/vc5_draw.c b/src/gallium/drivers/vc5/vc5_draw.c
index ff14d1c1358..ecb1aa37831 100644
--- a/src/gallium/drivers/vc5/vc5_draw.c
+++ b/src/gallium/drivers/vc5/vc5_draw.c
@@ -177,6 +177,9 @@ vc5_emit_gl_shader_state(struct vc5_context *vc5,
(vc5->prog.fs->prog_data.fs->writes_z ||
vc5->prog.fs->prog_data.fs->discard);
+ shader.fragment_shader_uses_real_pixel_centre_w_in_addition_to_centroid_w2 =
+ vc5->prog.fs->prog_data.fs->uses_centroid_and_center_w;
+
shader.number_of_varyings_in_fragment_shader =
vc5->prog.fs->prog_data.base->num_inputs;
diff --git a/src/gallium/drivers/vc5/vc5_emit.c b/src/gallium/drivers/vc5/vc5_emit.c
index 0d11d7e1ad1..cb8af953300 100644
--- a/src/gallium/drivers/vc5/vc5_emit.c
+++ b/src/gallium/drivers/vc5/vc5_emit.c
@@ -589,6 +589,45 @@ v3dX(emit_state)(struct pipe_context *pctx)
}
}
+#if V3D_VERSION >= 40
+ if (vc5->dirty & VC5_DIRTY_CENTROID_FLAGS) {
+ bool emitted_any = false;
+
+ for (int i = 0; i < ARRAY_SIZE(vc5->prog.fs->prog_data.fs->centroid_flags); i++) {
+ if (!vc5->prog.fs->prog_data.fs->centroid_flags[i])
+ continue;
+
+ cl_emit(&job->bcl, CENTROID_FLAGS, flags) {
+ flags.varying_offset_v0 = i;
+
+ if (emitted_any) {
+ flags.action_for_centroid_flags_of_lower_numbered_varyings =
+ V3D_VARYING_FLAGS_ACTION_UNCHANGED;
+ flags.action_for_centroid_flags_of_higher_numbered_varyings =
+ V3D_VARYING_FLAGS_ACTION_UNCHANGED;
+ } else {
+ flags.action_for_centroid_flags_of_lower_numbered_varyings =
+ ((i == 0) ?
+ V3D_VARYING_FLAGS_ACTION_UNCHANGED :
+ V3D_VARYING_FLAGS_ACTION_ZEROED);
+
+ flags.action_for_centroid_flags_of_higher_numbered_varyings =
+ V3D_VARYING_FLAGS_ACTION_ZEROED;
+ }
+
+ flags.centroid_flags_for_varyings_v024 =
+ vc5->prog.fs->prog_data.fs->centroid_flags[i];
+ }
+
+ emitted_any = true;
+ }
+
+ if (!emitted_any) {
+ cl_emit(&job->bcl, ZERO_ALL_CENTROID_FLAGS, flags);
+ }
+ }
+#endif
+
/* Set up the transform feedback data specs (which VPM entries to
* output to which buffers).
*/
diff --git a/src/gallium/drivers/vc5/vc5_program.c b/src/gallium/drivers/vc5/vc5_program.c
index d885cdf2975..23d2d73a2dc 100644
--- a/src/gallium/drivers/vc5/vc5_program.c
+++ b/src/gallium/drivers/vc5/vc5_program.c
@@ -477,10 +477,16 @@ vc5_update_compiled_fs(struct vc5_context *vc5, uint8_t prim_mode)
vc5->dirty |= VC5_DIRTY_COMPILED_FS;
- if (old_fs &&
- vc5->prog.fs->prog_data.fs->flat_shade_flags !=
- old_fs->prog_data.fs->flat_shade_flags) {
- vc5->dirty |= VC5_DIRTY_FLAT_SHADE_FLAGS;
+ if (old_fs) {
+ if (vc5->prog.fs->prog_data.fs->flat_shade_flags !=
+ old_fs->prog_data.fs->flat_shade_flags) {
+ vc5->dirty |= VC5_DIRTY_FLAT_SHADE_FLAGS;
+ }
+
+ if (vc5->prog.fs->prog_data.fs->centroid_flags !=
+ old_fs->prog_data.fs->centroid_flags) {
+ vc5->dirty |= VC5_DIRTY_CENTROID_FLAGS;
+ }
}
if (old_fs && memcmp(vc5->prog.fs->prog_data.fs->input_slots,