From 80046a7d54591e4a68a10413df47d1661e0dd31f Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Tue, 7 Jul 2015 16:37:43 -0700 Subject: [PATCH] vk/vulkan.h: Update clear color handling to 130 --- include/vulkan/vulkan.h | 19 +++++++------------ src/vulkan/meta.c | 12 ++++++------ src/vulkan/private.h | 2 +- 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/include/vulkan/vulkan.h b/include/vulkan/vulkan.h index 0c50b877573..03d49d61828 100644 --- a/include/vulkan/vulkan.h +++ b/include/vulkan/vulkan.h @@ -1671,17 +1671,12 @@ typedef struct { uint32_t layers; } VkFramebufferCreateInfo; -typedef union VkClearColorValue_ -{ - float floatColor[4]; - uint32_t rawColor[4]; +typedef union { + float f32[4]; + int32_t s32[4]; + uint32_t u32[4]; } VkClearColorValue; -typedef struct { - VkClearColorValue color; - bool32_t useRawValue; -} VkClearColor; - typedef struct { VkStructureType sType; const void* pNext; @@ -1694,7 +1689,7 @@ typedef struct { const VkImageLayout* pColorLayouts; const VkAttachmentLoadOp* pColorLoadOps; const VkAttachmentStoreOp* pColorStoreOps; - const VkClearColor* pColorLoadClearValues; + const VkClearColorValue* pColorLoadClearValues; VkFormat depthStencilFormat; VkImageLayout depthStencilLayout; VkAttachmentLoadOp depthLoadOp; @@ -1992,7 +1987,7 @@ typedef void (VKAPI *PFN_vkCmdCopyBufferToImage)(VkCmdBuffer cmdBuffer, VkBuffer typedef void (VKAPI *PFN_vkCmdCopyImageToBuffer)(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer destBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions); typedef void (VKAPI *PFN_vkCmdUpdateBuffer)(VkCmdBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize dataSize, const uint32_t* pData); typedef void (VKAPI *PFN_vkCmdFillBuffer)(VkCmdBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize fillSize, uint32_t data); -typedef void (VKAPI *PFN_vkCmdClearColorImage)(VkCmdBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, VkClearColor color, uint32_t rangeCount, const VkImageSubresourceRange* pRanges); +typedef void (VKAPI *PFN_vkCmdClearColorImage)(VkCmdBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges); typedef void (VKAPI *PFN_vkCmdClearDepthStencilImage)(VkCmdBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, float depth, uint32_t stencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges); typedef void (VKAPI *PFN_vkCmdClearColorAttachment)(VkCmdBuffer cmdBuffer, uint32_t colorAttachment, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rectCount, const VkRect3D* pRects); typedef void (VKAPI *PFN_vkCmdClearDepthStencilAttachment)(VkCmdBuffer cmdBuffer, VkImageAspectFlags imageAspectMask, VkImageLayout imageLayout, float depth, uint32_t stencil, uint32_t rectCount, const VkRect3D* pRects); @@ -2521,7 +2516,7 @@ void VKAPI vkCmdClearColorImage( VkCmdBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, - VkClearColor color, + const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges); diff --git a/src/vulkan/meta.c b/src/vulkan/meta.c index 57e0ec5093a..7e22269e368 100644 --- a/src/vulkan/meta.c +++ b/src/vulkan/meta.c @@ -283,7 +283,7 @@ anv_cmd_buffer_clear(struct anv_cmd_buffer *cmd_buffer, .ViewportIndex = 0, .PointWidth = 0.0 }, - .color = pass->layers[i].clear_color.color, + .color = pass->layers[i].clear_color, }; } } @@ -627,8 +627,8 @@ meta_emit_blit(struct anv_cmd_buffer *cmd_buffer, .pColorLayouts = (VkImageLayout[]) { VK_IMAGE_LAYOUT_GENERAL }, .pColorLoadOps = (VkAttachmentLoadOp[]) { VK_ATTACHMENT_LOAD_OP_LOAD }, .pColorStoreOps = (VkAttachmentStoreOp[]) { VK_ATTACHMENT_STORE_OP_STORE }, - .pColorLoadClearValues = (VkClearColor[]) { - { .color = { .floatColor = { 1.0, 0.0, 0.0, 1.0 } }, .useRawValue = false } + .pColorLoadClearValues = (VkClearColorValue[]) { + { .f32 = { 1.0, 0.0, 0.0, 1.0 } } }, .depthStencilFormat = VK_FORMAT_UNDEFINED, }, &pass); @@ -1185,7 +1185,7 @@ void anv_CmdClearColorImage( VkCmdBuffer cmdBuffer, VkImage _image, VkImageLayout imageLayout, - VkClearColor color, + const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) { @@ -1241,7 +1241,7 @@ void anv_CmdClearColorImage( .pColorLayouts = (VkImageLayout[]) { imageLayout }, .pColorLoadOps = (VkAttachmentLoadOp[]) { VK_ATTACHMENT_LOAD_OP_DONT_CARE }, .pColorStoreOps = (VkAttachmentStoreOp[]) { VK_ATTACHMENT_STORE_OP_STORE }, - .pColorLoadClearValues = &color, + .pColorLoadClearValues = pColor, .depthStencilFormat = VK_FORMAT_UNDEFINED, }, &pass); @@ -1257,7 +1257,7 @@ void anv_CmdClearColorImage( .ViewportIndex = 0, .PointWidth = 0.0 }, - .color = color.color, + .color = *pColor, }; meta_emit_clear(cmd_buffer, 1, &instance_data); diff --git a/src/vulkan/private.h b/src/vulkan/private.h index 2663d97834f..77de59340cf 100644 --- a/src/vulkan/private.h +++ b/src/vulkan/private.h @@ -920,7 +920,7 @@ struct anv_framebuffer { struct anv_render_pass_layer { VkAttachmentLoadOp color_load_op; - VkClearColor clear_color; + VkClearColorValue clear_color; }; struct anv_render_pass { -- 2.30.2