From 5af16f5e20d113da60ae9c425495bf9f3392a87c Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 25 Jan 2018 21:58:31 -0800 Subject: [PATCH] iris: alpha testing in PSB --- src/gallium/drivers/iris/iris_state.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index b52b0ced1b7..aa770c827ed 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -395,8 +395,8 @@ iris_create_blend_state(struct pipe_context *ctx, cso->alpha_to_coverage = state->alpha_to_coverage; iris_pack_command(GENX(3DSTATE_PS_BLEND), cso->ps_blend, pb) { - //pb.HasWriteableRT = :( - //pb.AlphaTestEnable = :( + /* pb.HasWriteableRT is filled in at draw time. */ + /* pb.AlphaTestEnable is filled in at draw time. */ pb.AlphaToCoverageEnable = state->alpha_to_coverage; pb.IndependentAlphaBlendEnable = state->independent_blend_enable; @@ -414,8 +414,7 @@ iris_create_blend_state(struct pipe_context *ctx, bs.AlphaToOneEnable = state->alpha_to_one; bs.AlphaToCoverageDitherEnable = state->alpha_to_coverage; bs.ColorDitherEnable = state->dither; - //bs.AlphaTestEnable = :( - //bs.AlphaTestFunction = :( + /* bl.AlphaTestEnable and bs.AlphaTestFunction are filled in later. */ } blend_state += GENX(BLEND_STATE_length); @@ -1956,8 +1955,16 @@ iris_upload_render_state(struct iris_context *ice, // -> bunch of shader state... if (dirty & IRIS_DIRTY_PS_BLEND) { - struct iris_blend_state *cso = ice->state.cso_blend; - iris_batch_emit(batch, cso->ps_blend, sizeof(cso->ps_blend)); + struct iris_blend_state *cso_blend = ice->state.cso_blend; + struct iris_depth_stencil_alpha_state *cso_zsa = ice->state.cso_zsa; + uint32_t dynamic_pb[GENX(3DSTATE_PS_BLEND_length)]; + iris_pack_command(GENX(3DSTATE_PS_BLEND), &dynamic_pb, pb) { + pb.HasWriteableRT = true; // XXX: comes from somewhere :( + pb.AlphaTestEnable = cso_zsa->alpha.enabled; + } + + iris_emit_merge(batch, cso_blend->ps_blend, dynamic_pb, + ARRAY_SIZE(cso_blend->ps_blend)); } if (dirty & IRIS_DIRTY_WM_DEPTH_STENCIL) { -- 2.30.2