vk/vulkan.h: Move over to the new border color enums
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 8 Jul 2015 18:44:52 +0000 (11:44 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 8 Jul 2015 18:44:52 +0000 (11:44 -0700)
include/vulkan/vulkan.h
src/vulkan/device.c
src/vulkan/private.h

index 3ff56aae5ea6af3202ceec4d93b7dfad3fa14016..14d4bd52706285cd7331d2f931b7c930a71f1223 100644 (file)
@@ -732,12 +732,15 @@ typedef enum {
 } VkTexAddress;
 
 typedef enum {
-    VK_BORDER_COLOR_OPAQUE_WHITE = 0,
-    VK_BORDER_COLOR_TRANSPARENT_BLACK = 1,
-    VK_BORDER_COLOR_OPAQUE_BLACK = 2,
-    VK_BORDER_COLOR_BEGIN_RANGE = VK_BORDER_COLOR_OPAQUE_WHITE,
-    VK_BORDER_COLOR_END_RANGE = VK_BORDER_COLOR_OPAQUE_BLACK,
-    VK_BORDER_COLOR_NUM = (VK_BORDER_COLOR_OPAQUE_BLACK - VK_BORDER_COLOR_OPAQUE_WHITE + 1),
+    VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK = 0,
+    VK_BORDER_COLOR_INT_TRANSPARENT_BLACK = 1,
+    VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK = 2,
+    VK_BORDER_COLOR_INT_OPAQUE_BLACK = 3,
+    VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE = 4,
+    VK_BORDER_COLOR_INT_OPAQUE_WHITE = 5,
+    VK_BORDER_COLOR_BEGIN_RANGE = VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK,
+    VK_BORDER_COLOR_END_RANGE = VK_BORDER_COLOR_INT_OPAQUE_WHITE,
+    VK_BORDER_COLOR_NUM = (VK_BORDER_COLOR_INT_OPAQUE_WHITE - VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK + 1),
     VK_BORDER_COLOR_MAX_ENUM = 0x7FFFFFFF
 } VkBorderColor;
 
index ce12c0defa8629794cafa12d1c7e70579a42ac08..4040745c25ad3a6cf96a6254cfdd78d92547f7be 100644 (file)
@@ -338,30 +338,19 @@ anv_queue_finish(struct anv_queue *queue)
 static void
 anv_device_init_border_colors(struct anv_device *device)
 {
-   float float_border_colors[][4] = {
-      [VK_BORDER_COLOR_OPAQUE_WHITE]            = { 1.0, 1.0, 1.0, 1.0 },
-      [VK_BORDER_COLOR_TRANSPARENT_BLACK]       = { 0.0, 0.0, 0.0, 0.0 },
-      [VK_BORDER_COLOR_OPAQUE_BLACK]            = { 0.0, 0.0, 0.0, 1.0 }
+   static const VkClearColorValue border_colors[] = {
+      [VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK] =  { .f32 = { 0.0, 0.0, 0.0, 0.0 } },
+      [VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK] =       { .f32 = { 0.0, 0.0, 0.0, 1.0 } },
+      [VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE] =       { .f32 = { 1.0, 1.0, 1.0, 1.0 } },
+      [VK_BORDER_COLOR_INT_TRANSPARENT_BLACK] =    { .u32 = { 0, 0, 0, 0 } },
+      [VK_BORDER_COLOR_INT_OPAQUE_BLACK] =         { .u32 = { 0, 0, 0, 1 } },
+      [VK_BORDER_COLOR_INT_OPAQUE_WHITE] =         { .u32 = { 1, 1, 1, 1 } },
    };
 
-   uint32_t uint32_border_colors[][4] = {
-      [VK_BORDER_COLOR_OPAQUE_WHITE]            = { 1, 1, 1, 1 },
-      [VK_BORDER_COLOR_TRANSPARENT_BLACK]       = { 0, 0, 0, 0 },
-      [VK_BORDER_COLOR_OPAQUE_BLACK]            = { 0, 0, 0, 1 }
-   };
-
-   device->float_border_colors =
+   device->border_colors =
       anv_state_pool_alloc(&device->dynamic_state_pool,
-                           sizeof(float_border_colors), 32);
-   memcpy(device->float_border_colors.map,
-          float_border_colors, sizeof(float_border_colors));
-
-   device->uint32_border_colors =
-      anv_state_pool_alloc(&device->dynamic_state_pool,
-                           sizeof(uint32_border_colors), 32);
-   memcpy(device->uint32_border_colors.map,
-          uint32_border_colors, sizeof(uint32_border_colors));
-
+                           sizeof(border_colors), 32);
+   memcpy(device->border_colors.map, border_colors, sizeof(border_colors));
 }
 
 static const uint32_t BATCH_SIZE = 8192;
@@ -451,10 +440,7 @@ VkResult anv_DestroyDevice(
    /* We only need to free these to prevent valgrind errors.  The backing
     * BO will go away in a couple of lines so we don't actually leak.
     */
-   anv_state_pool_free(&device->dynamic_state_pool,
-                       device->float_border_colors);
-   anv_state_pool_free(&device->dynamic_state_pool,
-                       device->uint32_border_colors);
+   anv_state_pool_free(&device->dynamic_state_pool, device->border_colors);
 #endif
 
    anv_bo_pool_finish(&device->batch_bo_pool);
@@ -1537,7 +1523,7 @@ VkResult anv_CreateSampler(
       .CubeSurfaceControlMode = 0,
 
       .IndirectStatePointer =
-         device->float_border_colors.offset +
+         device->border_colors.offset +
          pCreateInfo->borderColor * sizeof(float) * 4,
 
       .LODClampMagnificationMode = MIPNONE,
index 77de59340cf3af2267583a019149f25162f70b9f..4eb3a9531731e623d548dcf078cee018e59cf783 100644 (file)
@@ -412,8 +412,7 @@ struct anv_device {
 
     struct anv_meta_state                       meta_state;
 
-    struct anv_state                            float_border_colors;
-    struct anv_state                            uint32_border_colors;
+    struct anv_state                            border_colors;
 
     struct anv_queue                            queue;