mesa/src/intel/vulkan
Danylo Piliaiev c8abe03f3b i965,iris,anv: Make alpha to coverage work with sample mask
From "Alpha Coverage" section of SKL PRM Volume 7:
 "If Pixel Shader outputs oMask, AlphaToCoverage is disabled in
  hardware, regardless of the state setting for this feature."

From OpenGL spec 4.6, "15.2 Shader Execution":
 "The built-in integer array gl_SampleMask can be used to change
 the sample coverage for a fragment from within the shader."

From OpenGL spec 4.6, "17.3.1 Alpha To Coverage":
 "If SAMPLE_ALPHA_TO_COVERAGE is enabled, a temporary coverage value
  is generated where each bit is determined by the alpha value at the
  corresponding sample location. The temporary coverage value is then
  ANDed with the fragment coverage value to generate a new fragment
  coverage value."

Similar wording could be found in Vulkan spec 1.1.100
"25.6. Multisample Coverage"

Thus we need to compute alpha to coverage dithering manually in shader
and replace sample mask store with the bitwise-AND of sample mask and
alpha to coverage dithering.

The following formula is used to compute final sample mask:
  m = int(16.0 * clamp(src0_alpha, 0.0, 1.0))
  dither_mask = 0x1111 * ((0xfea80 >> (m & ~3)) & 0xf) |
     0x0808 * (m & 2) | 0x0100 * (m & 1)
  sample_mask = sample_mask & dither_mask
Credits to Francisco Jerez <currojerez@riseup.net> for creating it.

It gives a number of ones proportional to the alpha for 2, 4, 8 or 16
least significant bits of the result.

GEN6 hardware does not have issue with simultaneous usage of sample mask
and alpha to coverage however due to the wrong sending order of oMask
and src0_alpha it is still affected by it.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109743

Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
2019-03-25 13:54:55 -07:00
..
tests anv/tests: compile to something sensible in release builds 2019-02-14 12:52:34 +00:00
.gitignore anv,nir: add generated files to .gitignore(s) 2018-05-12 20:14:49 -07:00
anv_allocator.c anv: use anv_gem_munmap in block pool cleanup 2019-03-07 07:36:28 +02:00
anv_android.c anv: fix build on Nougat 2019-03-21 15:36:39 -07:00
anv_android.h anv/android: support creating images from external format 2018-12-19 09:38:41 +02:00
anv_android_stubs.c anv/android: support creating images from external format 2018-12-19 09:38:41 +02:00
anv_batch_chain.c intel/decoders: handle decoding MI_BBS from ring 2019-03-07 15:08:31 +00:00
anv_blorp.c anv/blorp: Delete a pointless assert 2019-02-14 16:04:42 -06:00
anv_cmd_buffer.c anv: Implement VK_EXT_inline_uniform_block 2019-03-05 10:06:50 -06:00
anv_descriptor_set.c anv: Fix destroying descriptor sets when pool gets reset 2019-03-12 17:09:37 +00:00
anv_device.c anv: fix build on Nougat 2019-03-21 15:36:39 -07:00
anv_dump.c anv: drop unneeded KHR suffix 2019-01-08 18:47:56 +00:00
anv_entrypoints_gen.py anv: use the platform defines in vk.xml instead of hard-coding them 2019-03-05 11:57:10 +00:00
anv_extensions.py anv: implement VK_EXT_pipeline_creation_feedback 2019-03-20 16:18:35 +00:00
anv_extensions_gen.py anv: Add EXT_acquire_xlib_display to anv driver [v3] 2018-06-19 14:17:46 -07:00
anv_formats.c drm-uapi: use local files, not system libdrm 2019-02-14 11:20:00 +00:00
anv_gem.c vulkan: Add VK_EXT_calibrated_timestamps extension (radv and anv) [v5] 2018-10-17 20:10:15 -07:00
anv_gem_stubs.c vulkan: Add VK_EXT_calibrated_timestamps extension (radv and anv) [v5] 2018-10-17 20:10:15 -07:00
anv_genX.h anv: Implement VK_EXT_conditional_rendering for gen 7.5+ 2019-01-18 18:31:44 +00:00
anv_icd.py anv: fix python whitespace warning 2018-07-25 20:55:35 +01:00
anv_image.c anv: fix build on Nougat 2019-03-21 15:36:39 -07:00
anv_intel.c anv: drop unneeded KHR suffix 2019-01-08 18:47:56 +00:00
anv_nir.h anv/nir: Rework arguments to apply_pipeline_layout 2018-11-22 09:17:28 -06:00
anv_nir_add_base_work_group_id.c anv: Implement vkCmdDispatchBase 2018-03-07 12:13:47 -08:00
anv_nir_apply_pipeline_layout.c nir: Rename nir_address_format_vk_index_offset to not be vk 2019-03-15 01:02:19 +00:00
anv_nir_lower_input_attachments.c nir, glsl: move pixel_center_integer/origin_upper_left to shader_info.fs 2019-02-21 11:47:59 +01:00
anv_nir_lower_multiview.c nir/builder: Add a build_deref_array_imm helper 2019-03-07 21:20:30 +00:00
anv_nir_lower_push_constants.c spirv/i965/anv: Relax push constant offset assertions being 32-bit aligned 2018-02-28 21:37:40 -08:00
anv_nir_lower_ycbcr_textures.c anv: retain the is_array state in create_plane_tex_instr_implicit 2019-03-05 10:38:31 +00:00
anv_pass.c anv/pass: Flag the need for a RT flush for resolve attachments 2019-03-13 17:58:27 -05:00
anv_pipeline.c i965,iris,anv: Make alpha to coverage work with sample mask 2019-03-25 13:54:55 -07:00
anv_pipeline_cache.c anv: implement VK_EXT_pipeline_creation_feedback 2019-03-20 16:18:35 +00:00
anv_private.h anv: implement VK_EXT_pipeline_creation_feedback 2019-03-20 16:18:35 +00:00
anv_queue.c intel/decoders: handle decoding MI_BBS from ring 2019-03-07 15:08:31 +00:00
anv_util.c anv/util: Split a vk_errorv helper out of vk_errorf 2018-10-26 13:27:21 -05:00
anv_wsi.c vulkan/wsi: Use VK_EXT_pci_bus_info for DRM fd matching 2018-10-18 11:29:00 -05:00
anv_wsi_display.c anv,radv: Add support for VK_KHR_get_display_properties2 2018-07-09 17:09:41 -07:00
anv_wsi_wayland.c anv: drop unused includes 2018-10-24 18:15:05 +01:00
anv_wsi_x11.c vulkan: drop always-true param 2018-10-26 18:33:11 +01:00
gen7_cmd_buffer.c anv/cmd_buffer: check for NULL framebuffer 2019-02-12 19:19:13 +01:00
gen8_cmd_buffer.c anv: Remove state flush. 2019-01-17 15:08:22 -08:00
genX_blorp_exec.c anv: narrow flushing of the render target to buffer writes 2019-01-19 15:45:41 +00:00
genX_cmd_buffer.c anv: Treat zero size XFB buffer as disabled 2019-03-18 16:09:42 +00:00
genX_gpu_memcpy.c anv: narrow flushing of the render target to buffer writes 2019-01-19 15:45:41 +00:00
genX_pipeline.c anv: Only set 3DSTATE_PS::VectorMaskEnable on gen8+ 2019-03-14 12:22:20 -05:00
genX_query.c anv: Implement VK_EXT_host_query_reset 2019-03-18 14:48:41 +00:00
genX_state.c anv/icl: Add WA_2204188704 to disable pixel shader panic dispatch 2019-03-19 14:42:19 -07:00
meson.build drm-uapi: use local files, not system libdrm 2019-02-14 11:20:00 +00:00
TODO anv: Implement pipeline statistics queries 2017-03-17 12:12:50 -07:00
vk_format_info.h anv: fix build on Nougat 2019-03-21 15:36:39 -07:00