summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/anv_meta_blit.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-03-01 17:19:43 -0800
committerJason Ekstrand <[email protected]>2016-03-01 21:45:20 -0800
commit5b70aa11ee136baf5aa1b2ba21f10fc42af53c88 (patch)
tree764eff8cccce4f91baa1c4d8ac432b091e50aaff /src/intel/vulkan/anv_meta_blit.c
parent89e421369c54a8edc4930352e062f03b5c66b886 (diff)
anv/meta_blit: Use unorm formats for 8 and 16-bit RGB and RGBA values
While Broadwell is very good about UINT formats, HSW is more restrictive. Neither R8G8B8_UINT nor R16G16B16_UINT really exist on HSW. It should be safe to just use the unorm formats.
Diffstat (limited to 'src/intel/vulkan/anv_meta_blit.c')
-rw-r--r--src/intel/vulkan/anv_meta_blit.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/intel/vulkan/anv_meta_blit.c b/src/intel/vulkan/anv_meta_blit.c
index 2ec428b5f4a..96a3b7669ac 100644
--- a/src/intel/vulkan/anv_meta_blit.c
+++ b/src/intel/vulkan/anv_meta_blit.c
@@ -375,17 +375,26 @@ meta_finish_blit(struct anv_cmd_buffer *cmd_buffer,
static VkFormat
vk_format_for_size(int bs)
{
- /* Note: We intentionally use the 4-channel formats whenever we can.
- * This is so that, when we do a RGB <-> RGBX copy, the two formats will
- * line up even though one of them is 3/4 the size of the other.
+ /* The choice of UNORM and UINT formats is very intentional here. Most of
+ * the time, we want to use a UINT format to avoid any rounding error in
+ * the blit. For stencil blits, R8_UINT is required by the hardware.
+ * (It's the only format allowed in conjunction with W-tiling.) Also we
+ * intentionally use the 4-channel formats whenever we can. This is so
+ * that, when we do a RGB <-> RGBX copy, the two formats will line up even
+ * though one of them is 3/4 the size of the other. The choice of UNORM
+ * vs. UINT is also very intentional because Haswell doesn't handle 8 or
+ * 16-bit RGB UINT formats at all so we have to use UNORM there.
+ * Fortunately, the only time we should ever use two different formats in
+ * the table below is for RGB -> RGBA blits and so we will never have any
+ * UNORM/UINT mismatch.
*/
switch (bs) {
case 1: return VK_FORMAT_R8_UINT;
case 2: return VK_FORMAT_R8G8_UINT;
- case 3: return VK_FORMAT_R8G8B8_UINT;
- case 4: return VK_FORMAT_R8G8B8A8_UINT;
- case 6: return VK_FORMAT_R16G16B16_UINT;
- case 8: return VK_FORMAT_R16G16B16A16_UINT;
+ case 3: return VK_FORMAT_R8G8B8_UNORM;
+ case 4: return VK_FORMAT_R8G8B8A8_UNORM;
+ case 6: return VK_FORMAT_R16G16B16_UNORM;
+ case 8: return VK_FORMAT_R16G16B16A16_UNORM;
case 12: return VK_FORMAT_R32G32B32_UINT;
case 16: return VK_FORMAT_R32G32B32A32_UINT;
default: