From 04f77595f0bb5adc31e9e0ff2114c1ed5b60371d Mon Sep 17 00:00:00 2001 From: Arcady Goldmints-Orlov Date: Thu, 7 May 2020 19:34:56 -0500 Subject: intel/compiler: Always apply sample mask on Vulkan. With OpenGL, shader writes to the sample mask are ignored when not rendering to a multisample render target. However, on Vulkan, writes to the sample mask have still have their effect in that case. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3016 Reviewed-by: Jason Ekstrand Part-of: --- src/intel/compiler/brw_compiler.h | 1 + src/intel/compiler/brw_fs.cpp | 4 ++-- src/intel/vulkan/anv_pipeline.c | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src/intel') diff --git a/src/intel/compiler/brw_compiler.h b/src/intel/compiler/brw_compiler.h index 963d8fa2fc8..d5ec740225e 100644 --- a/src/intel/compiler/brw_compiler.h +++ b/src/intel/compiler/brw_compiler.h @@ -457,6 +457,7 @@ struct brw_wm_prog_key { bool high_quality_derivatives:1; bool force_dual_color_blend:1; bool coherent_fb_fetch:1; + bool ignore_sample_mask_out:1; uint8_t color_outputs_valid; uint64_t input_slots_valid; diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp index a41d15270b9..d3dc1f45110 100644 --- a/src/intel/compiler/brw_fs.cpp +++ b/src/intel/compiler/brw_fs.cpp @@ -8565,8 +8565,8 @@ brw_compile_fs(const struct brw_compiler *compiler, void *log_data, */ prog_data->uses_kill = shader->info.fs.uses_discard || key->alpha_test_func; - prog_data->uses_omask = key->multisample_fbo && - shader->info.outputs_written & BITFIELD64_BIT(FRAG_RESULT_SAMPLE_MASK); + prog_data->uses_omask = !key->ignore_sample_mask_out && + (shader->info.outputs_written & BITFIELD64_BIT(FRAG_RESULT_SAMPLE_MASK)); prog_data->computed_depth_mode = computed_depth_mode(shader); prog_data->computed_stencil = shader->info.outputs_written & BITFIELD64_BIT(FRAG_RESULT_STENCIL); diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index 9ddb2ebabeb..856c018d10e 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -516,6 +516,8 @@ populate_wm_prog_key(const struct gen_device_info *devinfo, /* XXX Vulkan doesn't appear to specify */ key->clamp_fragment_color = false; + key->ignore_sample_mask_out = false; + assert(subpass->color_count <= MAX_RTS); for (uint32_t i = 0; i < subpass->color_count; i++) { if (subpass->color_attachments[i].attachment != VK_ATTACHMENT_UNUSED) -- cgit v1.2.3