summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2018-07-06 15:48:46 -0700
committerEric Anholt <[email protected]>2018-07-09 11:48:32 -0700
commitbeeb94402f9d33081147c88de2b9d4c4ea24e842 (patch)
tree16b9c11668b6a0fe39c667b229aebceb8dfd2a01 /src/gallium
parent4b4795be9de7a73ebc89916753d18a2d0f2ef7a3 (diff)
v3d: Implement noperspective varyings on V3D 4.x.
Fixes a bunch of piglit interpolation tests, and reduces my concern about some MSAA blit shaders with noperspective varyings.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/v3d/v3d_context.h1
-rw-r--r--src/gallium/drivers/v3d/v3d_program.c5
-rw-r--r--src/gallium/drivers/v3d/v3dx_emit.c25
3 files changed, 31 insertions, 0 deletions
diff --git a/src/gallium/drivers/v3d/v3d_context.h b/src/gallium/drivers/v3d/v3d_context.h
index dea9f9f3d2c..5822ca9f7f8 100644
--- a/src/gallium/drivers/v3d/v3d_context.h
+++ b/src/gallium/drivers/v3d/v3d_context.h
@@ -81,6 +81,7 @@ void v3d_job_add_bo(struct v3d_job *job, struct v3d_bo *bo);
#define VC5_DIRTY_STREAMOUT (1 << 27)
#define VC5_DIRTY_OQ (1 << 28)
#define VC5_DIRTY_CENTROID_FLAGS (1 << 29)
+#define VC5_DIRTY_NOPERSPECTIVE_FLAGS (1 << 30)
#define VC5_MAX_FS_INPUTS 64
diff --git a/src/gallium/drivers/v3d/v3d_program.c b/src/gallium/drivers/v3d/v3d_program.c
index 93228b53c5c..85554586a6c 100644
--- a/src/gallium/drivers/v3d/v3d_program.c
+++ b/src/gallium/drivers/v3d/v3d_program.c
@@ -485,6 +485,11 @@ v3d_update_compiled_fs(struct v3d_context *v3d, uint8_t prim_mode)
v3d->dirty |= VC5_DIRTY_FLAT_SHADE_FLAGS;
}
+ if (v3d->prog.fs->prog_data.fs->noperspective_flags !=
+ old_fs->prog_data.fs->noperspective_flags) {
+ v3d->dirty |= VC5_DIRTY_NOPERSPECTIVE_FLAGS;
+ }
+
if (v3d->prog.fs->prog_data.fs->centroid_flags !=
old_fs->prog_data.fs->centroid_flags) {
v3d->dirty |= VC5_DIRTY_CENTROID_FLAGS;
diff --git a/src/gallium/drivers/v3d/v3dx_emit.c b/src/gallium/drivers/v3d/v3dx_emit.c
index 09965f68250..9c97bb6c25d 100644
--- a/src/gallium/drivers/v3d/v3dx_emit.c
+++ b/src/gallium/drivers/v3d/v3dx_emit.c
@@ -328,6 +328,23 @@ emit_flat_shade_flags(struct v3d_job *job,
#if V3D_VERSION >= 40
static void
+emit_noperspective_flags(struct v3d_job *job,
+ int varying_offset,
+ uint32_t varyings,
+ enum V3DX(Varying_Flags_Action) lower,
+ enum V3DX(Varying_Flags_Action) higher)
+{
+ cl_emit(&job->bcl, NON_PERSPECTIVE_FLAGS, flags) {
+ flags.varying_offset_v0 = varying_offset;
+ flags.non_perspective_flags_for_varyings_v024 = varyings;
+ flags.action_for_non_perspective_flags_of_lower_numbered_varyings =
+ lower;
+ flags.action_for_non_perspective_flags_of_higher_numbered_varyings =
+ higher;
+ }
+}
+
+static void
emit_centroid_flags(struct v3d_job *job,
int varying_offset,
uint32_t varyings,
@@ -648,6 +665,14 @@ v3dX(emit_state)(struct pipe_context *pctx)
}
#if V3D_VERSION >= 40
+ if (v3d->dirty & VC5_DIRTY_NOPERSPECTIVE_FLAGS) {
+ if (!emit_varying_flags(job,
+ v3d->prog.fs->prog_data.fs->noperspective_flags,
+ emit_noperspective_flags)) {
+ cl_emit(&job->bcl, ZERO_ALL_NON_PERSPECTIVE_FLAGS, flags);
+ }
+ }
+
if (v3d->dirty & VC5_DIRTY_CENTROID_FLAGS) {
if (!emit_varying_flags(job,
v3d->prog.fs->prog_data.fs->centroid_flags,