diff options
author | Bas Nieuwenhuizen <[email protected]> | 2018-08-11 23:26:26 +0200 |
---|---|---|
committer | Bas Nieuwenhuizen <[email protected]> | 2018-08-14 10:26:06 +0200 |
commit | 806a792b438815ec6ae15cdb0e6fedcaf7db2dd0 (patch) | |
tree | 00f32d48c1c82a8211e4256a8408707d31de2a83 /src/amd/vulkan/radv_pipeline.c | |
parent | 0be5e9f5a1a7333c252d8b7c1da7b4ec0c4d21cf (diff) |
radv: Make fs key exemplars ordered to be a reverse fs_key lookup.
While at it, share the exemplars and account for a non-occurring
fs key.
Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/amd/vulkan/radv_pipeline.c')
-rw-r--r-- | src/amd/vulkan/radv_pipeline.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index eb58e8a1c0a..e63c481d1e7 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -565,9 +565,34 @@ format_is_int10(VkFormat format) return false; } +/* + * Ordered so that for each i, + * radv_format_meta_fs_key(radv_fs_key_format_exemplars[i]) == i. + */ +const VkFormat radv_fs_key_format_exemplars[NUM_META_FS_KEYS] = { + VK_FORMAT_R32_SFLOAT, + VK_FORMAT_R32G32_SFLOAT, + VK_FORMAT_R8G8B8A8_UNORM, + VK_FORMAT_R16G16B16A16_UNORM, + VK_FORMAT_R16G16B16A16_SNORM, + VK_FORMAT_R16G16B16A16_UINT, + VK_FORMAT_R16G16B16A16_SINT, + VK_FORMAT_R32G32B32A32_SFLOAT, + VK_FORMAT_R8G8B8A8_UINT, + VK_FORMAT_R8G8B8A8_SINT, + VK_FORMAT_A2R10G10B10_UINT_PACK32, + VK_FORMAT_A2R10G10B10_SINT_PACK32, +}; + unsigned radv_format_meta_fs_key(VkFormat format) { - unsigned col_format = si_choose_spi_color_format(format, false, false) - 1; + unsigned col_format = si_choose_spi_color_format(format, false, false); + + assert(col_format != V_028714_SPI_SHADER_32_AR); + if (col_format >= V_028714_SPI_SHADER_32_AR) + --col_format; /* Skip V_028714_SPI_SHADER_32_AR since there is no such VkFormat */ + + --col_format; /* Skip V_028714_SPI_SHADER_ZERO */ bool is_int8 = format_is_int8(format); bool is_int10 = format_is_int10(format); |