uint32_t prog_offset = params->get_wm_prog(brw, &prog_data);
gen6_blorp_emit_batch_head(brw, params);
gen6_emit_3dstate_multisample(brw, params->num_samples);
- gen6_emit_3dstate_sample_mask(brw, params->num_samples);
+ gen6_emit_3dstate_sample_mask(brw, params->num_samples, 1.0, false);
gen6_blorp_emit_state_base_address(brw, params);
gen6_blorp_emit_vertices(brw, params);
gen6_blorp_emit_urb_config(brw, params);
*/
void
gen6_emit_3dstate_sample_mask(struct brw_context *brw,
- unsigned num_samples)
+ unsigned num_samples, float coverage,
+ bool coverage_invert)
{
struct intel_context *intel = &brw->intel;
BEGIN_BATCH(2);
OUT_BATCH(_3DSTATE_SAMPLE_MASK << 16 | (2 - 2));
- OUT_BATCH(num_samples > 0 ? 15 : 1);
+ if (num_samples > 0) {
+ int coverage_int = (int) (num_samples * coverage + 0.5);
+ uint32_t coverage_bits = (1 << coverage_int) - 1;
+ if (coverage_invert)
+ coverage_bits ^= (1 << num_samples) - 1;
+ OUT_BATCH(coverage_bits);
+ } else {
+ OUT_BATCH(1);
+ }
ADVANCE_BATCH();
}
struct intel_context *intel = &brw->intel;
struct gl_context *ctx = &intel->ctx;
unsigned num_samples = 0;
+ float coverage = 1.0;
+ float coverage_invert = false;
+
+ /* _NEW_MULTISAMPLE */
+ if (ctx->Multisample._Enabled && ctx->Multisample.SampleCoverage) {
+ coverage = ctx->Multisample.SampleCoverageValue;
+ coverage_invert = ctx->Multisample.SampleCoverageInvert;
+ }
/* _NEW_BUFFERS */
if (ctx->DrawBuffer->_ColorDrawBuffers[0])
intel_emit_post_sync_nonzero_flush(intel);
gen6_emit_3dstate_multisample(brw, num_samples);
- gen6_emit_3dstate_sample_mask(brw, num_samples);
+ gen6_emit_3dstate_sample_mask(brw, num_samples, coverage, coverage_invert);
}
const struct brw_tracked_state gen6_multisample_state = {
.dirty = {
- .mesa = _NEW_BUFFERS,
+ .mesa = _NEW_BUFFERS |
+ _NEW_MULTISAMPLE,
.brw = BRW_NEW_CONTEXT,
.cache = 0
},
gen6_blorp_emit_batch_head(brw, params);
gen7_allocate_push_constants(brw);
gen6_emit_3dstate_multisample(brw, params->num_samples);
- gen6_emit_3dstate_sample_mask(brw, params->num_samples);
+ gen6_emit_3dstate_sample_mask(brw, params->num_samples, 1.0, false);
gen6_blorp_emit_state_base_address(brw, params);
gen6_blorp_emit_vertices(brw, params);
gen7_blorp_emit_urb_config(brw, params);