From aaa0bc4ec0afa6881c50d6747b020ad5f62f0a92 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Tue, 4 Dec 2018 09:46:50 -0600 Subject: [PATCH] blorp: Pass z_offset through to the shader for MCS partial resolves --- src/intel/blorp/blorp_clear.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/intel/blorp/blorp_clear.c b/src/intel/blorp/blorp_clear.c index 5b575dccc22..8b3db4668b8 100644 --- a/src/intel/blorp/blorp_clear.c +++ b/src/intel/blorp/blorp_clear.c @@ -932,6 +932,7 @@ struct blorp_mcs_partial_resolve_key enum blorp_shader_type shader_type; bool indirect_clear_color; bool int_format; + bool need_z_offset; uint32_t num_samples; }; @@ -943,6 +944,7 @@ blorp_params_get_mcs_partial_resolve_kernel(struct blorp_context *blorp, .shader_type = BLORP_SHADER_TYPE_MCS_PARTIAL_RESOLVE, .indirect_clear_color = params->dst.clear_color_addr.buffer != NULL, .int_format = isl_format_has_int_channel(params->dst.view.format), + .need_z_offset = params->src.z_offset, .num_samples = params->num_samples, }; @@ -964,6 +966,13 @@ blorp_params_get_mcs_partial_resolve_kernel(struct blorp_context *blorp, glsl_vec4_type(), "gl_FragColor"); frag_color->data.location = FRAG_RESULT_COLOR; + nir_ssa_def *layer = nir_load_layer_id(&b); + if (blorp_key.need_z_offset) { + nir_variable *v_src_z = + BLORP_CREATE_NIR_INPUT(b.shader, src_z, glsl_int_type()); + layer = nir_iadd(&b, layer, nir_load_var(&b, v_src_z)); + } + /* Do an MCS fetch and check if it is equal to the magic clear value */ nir_ssa_def *mcs = blorp_nir_txf_ms_mcs(&b, nir_f2i32(&b, blorp_nir_frag_coord(&b)), @@ -1036,6 +1045,11 @@ blorp_mcs_partial_resolve(struct blorp_batch *batch, params.num_layers = num_layers; params.dst_clear_color_as_input = surf->clear_color_addr.buffer != NULL; + /* For layered MSAA textures, we need the Z passed into the shader due to + * minimum layer not working properly on IVB. + */ + params.wm_inputs.src_z = params.src.z_offset; + memcpy(¶ms.wm_inputs.clear_color, surf->clear_color.f32, sizeof(float) * 4); -- 2.19.2