summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2018-05-08 14:28:33 -0700
committerEric Anholt <[email protected]>2018-05-17 15:09:46 +0100
commit97894b1267923dee25ea5263e547ac8822ef7095 (patch)
tree1a937b563cad17d3fa0a910d644ab5ad68d31417 /src/gallium
parent9bbc3f8cf1f116aa17ebcd399c0d3a8fb07b5266 (diff)
v3d: Add support for glSampleMask / glSampleCoverage.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/v3d/v3d_context.h2
-rw-r--r--src/gallium/drivers/v3d/v3d_program.c2
-rw-r--r--src/gallium/drivers/v3d/v3d_uniforms.c2
-rw-r--r--src/gallium/drivers/v3d/v3dx_emit.c23
-rw-r--r--src/gallium/drivers/v3d/v3dx_state.c2
5 files changed, 26 insertions, 5 deletions
diff --git a/src/gallium/drivers/v3d/v3d_context.h b/src/gallium/drivers/v3d/v3d_context.h
index d110ed50222..47945f96497 100644
--- a/src/gallium/drivers/v3d/v3d_context.h
+++ b/src/gallium/drivers/v3d/v3d_context.h
@@ -61,7 +61,7 @@ void v3d_job_add_bo(struct v3d_job *job, struct v3d_bo *bo);
#define VC5_DIRTY_BLEND_COLOR (1 << 7)
#define VC5_DIRTY_STENCIL_REF (1 << 8)
-#define VC5_DIRTY_SAMPLE_MASK (1 << 9)
+#define VC5_DIRTY_SAMPLE_STATE (1 << 9)
#define VC5_DIRTY_FRAMEBUFFER (1 << 10)
#define VC5_DIRTY_STIPPLE (1 << 11)
#define VC5_DIRTY_VIEWPORT (1 << 12)
diff --git a/src/gallium/drivers/v3d/v3d_program.c b/src/gallium/drivers/v3d/v3d_program.c
index 63e6fda5471..036f7c6e672 100644
--- a/src/gallium/drivers/v3d/v3d_program.c
+++ b/src/gallium/drivers/v3d/v3d_program.c
@@ -399,7 +399,7 @@ v3d_update_compiled_fs(struct v3d_context *v3d, uint8_t prim_mode)
VC5_DIRTY_FRAMEBUFFER |
VC5_DIRTY_ZSA |
VC5_DIRTY_RASTERIZER |
- VC5_DIRTY_SAMPLE_MASK |
+ VC5_DIRTY_SAMPLE_STATE |
VC5_DIRTY_FRAGTEX |
VC5_DIRTY_UNCOMPILED_FS))) {
return;
diff --git a/src/gallium/drivers/v3d/v3d_uniforms.c b/src/gallium/drivers/v3d/v3d_uniforms.c
index 9dd128ab418..ad46c691218 100644
--- a/src/gallium/drivers/v3d/v3d_uniforms.c
+++ b/src/gallium/drivers/v3d/v3d_uniforms.c
@@ -475,7 +475,7 @@ v3d_set_shader_uniform_dirty_flags(struct v3d_compiled_shader *shader)
break;
case QUNIFORM_SAMPLE_MASK:
- dirty |= VC5_DIRTY_SAMPLE_MASK;
+ dirty |= VC5_DIRTY_SAMPLE_STATE;
break;
default:
diff --git a/src/gallium/drivers/v3d/v3dx_emit.c b/src/gallium/drivers/v3d/v3dx_emit.c
index 8a65478a161..161ce51b2ff 100644
--- a/src/gallium/drivers/v3d/v3dx_emit.c
+++ b/src/gallium/drivers/v3d/v3dx_emit.c
@@ -387,8 +387,17 @@ v3dX(emit_state)(struct pipe_context *pctx)
config.enable_depth_offset =
v3d->rasterizer->base.offset_tri;
+ /* V3D follows GL behavior where the sample mask only
+ * applies when MSAA is enabled. Gallium has sample
+ * mask apply anyway, and the MSAA blit shaders will
+ * set sample mask without explicitly setting
+ * rasterizer oversample. Just force it on here,
+ * since the blit shaders are the only way to have
+ * !multisample && samplemask != 0xf.
+ */
config.rasterizer_oversample_mode =
- v3d->rasterizer->base.multisample;
+ v3d->rasterizer->base.multisample ||
+ v3d->sample_mask != 0xf;
config.direct3d_provoking_vertex =
v3d->rasterizer->base.flatshade_first;
@@ -719,4 +728,16 @@ v3dX(emit_state)(struct pipe_context *pctx)
}
}
}
+
+#if V3D_VERSION >= 40
+ if (v3d->dirty & VC5_DIRTY_SAMPLE_STATE) {
+ cl_emit(&job->bcl, SAMPLE_STATE, state) {
+ /* Note: SampleCoverage was handled at the
+ * state_tracker level by converting to sample_mask.
+ */
+ state.coverage = fui(1.0) >> 16;
+ state.mask = job->msaa ? v3d->sample_mask : 0xf;
+ }
+ }
+#endif
}
diff --git a/src/gallium/drivers/v3d/v3dx_state.c b/src/gallium/drivers/v3d/v3dx_state.c
index 1387a22e048..e48e0f3767d 100644
--- a/src/gallium/drivers/v3d/v3dx_state.c
+++ b/src/gallium/drivers/v3d/v3dx_state.c
@@ -88,7 +88,7 @@ v3d_set_sample_mask(struct pipe_context *pctx, unsigned sample_mask)
{
struct v3d_context *v3d = v3d_context(pctx);
v3d->sample_mask = sample_mask & ((1 << VC5_MAX_SAMPLES) - 1);
- v3d->dirty |= VC5_DIRTY_SAMPLE_MASK;
+ v3d->dirty |= VC5_DIRTY_SAMPLE_STATE;
}
static uint16_t