diff options
author | Dave Airlie <[email protected]> | 2017-07-27 21:52:20 +0100 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2017-08-01 00:10:23 +0100 |
commit | df61a05019d5c7479d4b29d251af4231f125e61c (patch) | |
tree | 80d8e3ccb86c3f5627eef17fe0cb1472368b04ef /src/amd/vulkan | |
parent | b7dd86a04ec415b7ef4f3bfc9a4708820519137f (diff) |
radv: handle 10-bit format clamping workaround.
This fixes:
dEQP-VK.api.copy_and_blit.core.blit_image.all_formats.*
for a2r10g10b10 formats as destination on SI/CIK hardware.
This adds support to the meta program for emitting 10-bit
outputs, and adds 10-bit support to the fragment shader key.
It also only does the int8/10 on SI/CIK.
Fixes: f4e499ec7 (radv: add initial non-conformant radv vulkan driver)
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/amd/vulkan')
-rw-r--r-- | src/amd/vulkan/radv_meta_blit.c | 2 | ||||
-rw-r--r-- | src/amd/vulkan/radv_meta_blit2d.c | 2 | ||||
-rw-r--r-- | src/amd/vulkan/radv_meta_clear.c | 2 | ||||
-rw-r--r-- | src/amd/vulkan/radv_meta_resolve_fs.c | 2 | ||||
-rw-r--r-- | src/amd/vulkan/radv_pipeline.c | 37 | ||||
-rw-r--r-- | src/amd/vulkan/radv_private.h | 2 |
6 files changed, 37 insertions, 10 deletions
diff --git a/src/amd/vulkan/radv_meta_blit.c b/src/amd/vulkan/radv_meta_blit.c index 718e9c50e6e..3510e871bbe 100644 --- a/src/amd/vulkan/radv_meta_blit.c +++ b/src/amd/vulkan/radv_meta_blit.c @@ -695,6 +695,8 @@ static VkFormat pipeline_formats[] = { VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_R8G8B8A8_UINT, VK_FORMAT_R8G8B8A8_SINT, + VK_FORMAT_A2R10G10B10_UINT_PACK32, + VK_FORMAT_A2R10G10B10_SINT_PACK32, VK_FORMAT_R16G16B16A16_UNORM, VK_FORMAT_R16G16B16A16_SNORM, VK_FORMAT_R16G16B16A16_UINT, diff --git a/src/amd/vulkan/radv_meta_blit2d.c b/src/amd/vulkan/radv_meta_blit2d.c index 2f18350fd71..79e76be49bc 100644 --- a/src/amd/vulkan/radv_meta_blit2d.c +++ b/src/amd/vulkan/radv_meta_blit2d.c @@ -1134,6 +1134,8 @@ static VkFormat pipeline_formats[] = { VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_R8G8B8A8_UINT, VK_FORMAT_R8G8B8A8_SINT, + VK_FORMAT_A2R10G10B10_UINT_PACK32, + VK_FORMAT_A2R10G10B10_SINT_PACK32, VK_FORMAT_R16G16B16A16_UNORM, VK_FORMAT_R16G16B16A16_SNORM, VK_FORMAT_R16G16B16A16_UINT, diff --git a/src/amd/vulkan/radv_meta_clear.c b/src/amd/vulkan/radv_meta_clear.c index d007f97b30e..e3d823fb58a 100644 --- a/src/amd/vulkan/radv_meta_clear.c +++ b/src/amd/vulkan/radv_meta_clear.c @@ -754,6 +754,8 @@ static VkFormat pipeline_formats[] = { VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_R8G8B8A8_UINT, VK_FORMAT_R8G8B8A8_SINT, + VK_FORMAT_A2R10G10B10_UINT_PACK32, + VK_FORMAT_A2R10G10B10_SINT_PACK32, VK_FORMAT_R16G16B16A16_UNORM, VK_FORMAT_R16G16B16A16_SNORM, VK_FORMAT_R16G16B16A16_UINT, diff --git a/src/amd/vulkan/radv_meta_resolve_fs.c b/src/amd/vulkan/radv_meta_resolve_fs.c index 65c5075e2a1..a90678a2a3e 100644 --- a/src/amd/vulkan/radv_meta_resolve_fs.c +++ b/src/amd/vulkan/radv_meta_resolve_fs.c @@ -160,6 +160,8 @@ static VkFormat pipeline_formats[] = { VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_R8G8B8A8_UINT, VK_FORMAT_R8G8B8A8_SINT, + VK_FORMAT_A2R10G10B10_UINT_PACK32, + VK_FORMAT_A2R10G10B10_SINT_PACK32, VK_FORMAT_R16G16B16A16_UNORM, VK_FORMAT_R16G16B16A16_SNORM, VK_FORMAT_R16G16B16A16_UINT, diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index c4407ec7e23..28389368cec 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -1067,20 +1067,37 @@ format_is_int8(VkFormat format) desc->channel[channel].size == 8; } +static bool +format_is_int10(VkFormat format) +{ + const struct vk_format_description *desc = vk_format_description(format); + + if (desc->nr_channels != 4) + return false; + for (unsigned i = 0; i < 4; i++) { + if (desc->channel[i].pure_integer && desc->channel[i].size == 10) + return true; + } + return false; +} + unsigned radv_format_meta_fs_key(VkFormat format) { unsigned col_format = si_choose_spi_color_format(format, false, false) - 1; bool is_int8 = format_is_int8(format); + bool is_int10 = format_is_int10(format); - return col_format + (is_int8 ? 3 : 0); + return col_format + (is_int8 ? 3 : is_int10 ? 5 : 0); } -static unsigned -radv_pipeline_compute_is_int8(const VkGraphicsPipelineCreateInfo *pCreateInfo) +static void +radv_pipeline_compute_get_int_clamp(const VkGraphicsPipelineCreateInfo *pCreateInfo, + unsigned *is_int8, unsigned *is_int10) { RADV_FROM_HANDLE(radv_render_pass, pass, pCreateInfo->renderPass); struct radv_subpass *subpass = pass->subpasses + pCreateInfo->subpass; - unsigned is_int8 = 0; + *is_int8 = 0; + *is_int10 = 0; for (unsigned i = 0; i < subpass->color_count; ++i) { struct radv_render_pass_attachment *attachment; @@ -1091,10 +1108,10 @@ radv_pipeline_compute_is_int8(const VkGraphicsPipelineCreateInfo *pCreateInfo) attachment = pass->attachments + subpass->color_attachments[i].attachment; if (format_is_int8(attachment->format)) - is_int8 |= 1 << i; + *is_int8 |= 1 << i; + if (format_is_int10(attachment->format)) + *is_int10 |= 1 << i; } - - return is_int8; } static void @@ -2053,9 +2070,11 @@ radv_pipeline_init(struct radv_pipeline *pipeline, } if (modules[MESA_SHADER_FRAGMENT]) { - union ac_shader_variant_key key; + union ac_shader_variant_key key = {0}; key.fs.col_format = pipeline->graphics.blend.spi_shader_col_format; - key.fs.is_int8 = radv_pipeline_compute_is_int8(pCreateInfo); + + if (pipeline->device->physical_device->rad_info.chip_class < VI) + radv_pipeline_compute_get_int_clamp(pCreateInfo, &key.fs.is_int8, &key.fs.is_int10); const VkPipelineShaderStageCreateInfo *stage = pStages[MESA_SHADER_FRAGMENT]; diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index 21a8d410f00..25afd497da0 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -84,7 +84,7 @@ typedef uint32_t xcb_window_t; #define MAX_PUSH_DESCRIPTORS 32 #define MAX_DYNAMIC_BUFFERS 16 #define MAX_SAMPLES_LOG2 4 -#define NUM_META_FS_KEYS 11 +#define NUM_META_FS_KEYS 13 #define RADV_MAX_DRM_DEVICES 8 #define NUM_DEPTH_CLEAR_PIPELINES 3 |