vk/vulkan.h: Update clear color handling to 130
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 7 Jul 2015 23:37:43 +0000 (16:37 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 7 Jul 2015 23:37:43 +0000 (16:37 -0700)
include/vulkan/vulkan.h
src/vulkan/meta.c
src/vulkan/private.h

index 0c50b877573459cce0abf6e6b3291e8204e02dc0..03d49d6182893767bf3bc64e3ab4b861fb25176a 100644 (file)
@@ -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);
 
index 57e0ec5093a183a54544c8bfe403d02eea4431ac..7e22269e36898a53f3ca687160bc4e82fdb1e567 100644 (file)
@@ -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);
index 2663d97834ff1ccc13ce312047c4fcc4b1477eea..77de59340cf3af2267583a019149f25162f70b9f 100644 (file)
@@ -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 {