vk/0.210.0: More fun with flags fields
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 1 Dec 2015 01:46:38 +0000 (17:46 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 3 Dec 2015 21:43:52 +0000 (13:43 -0800)
include/vulkan/vulkan.h
src/vulkan/anv_batch_chain.c
src/vulkan/anv_cmd_buffer.c
src/vulkan/anv_dump.c
src/vulkan/anv_private.h

index afe54d9814a0f62e9d6e892db1778dfb4057f603..28e9b3283ce7135bb79212bab2f121f901e305b8 100644 (file)
@@ -791,6 +791,7 @@ typedef enum VkSubpassContents {
     VK_SUBPASS_CONTENTS_MAX_ENUM = 0x7FFFFFFF
 } VkSubpassContents;
 
+typedef VkFlags VkInstanceCreateFlags;
 
 typedef enum VkFormatFeatureFlagBits {
     VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT = 0x00000001,
@@ -858,10 +859,12 @@ typedef enum {
 } VkMemoryPropertyFlagBits;
 typedef VkFlags VkMemoryPropertyFlags;
 
-typedef enum {
+typedef enum VkMemoryHeapFlagBits {
     VK_MEMORY_HEAP_HOST_LOCAL_BIT = 0x00000001,
 } VkMemoryHeapFlagBits;
 typedef VkFlags VkMemoryHeapFlags;
+typedef VkFlags VkDeviceCreateFlags;
+typedef VkFlags VkDeviceQueueCreateFlags;
 typedef VkFlags VkMemoryMapFlags;
 
 typedef enum {
@@ -882,6 +885,7 @@ typedef enum VkFenceCreateFlagBits {
 typedef VkFlags VkFenceCreateFlags;
 typedef VkFlags VkSemaphoreCreateFlags;
 typedef VkFlags VkEventCreateFlags;
+typedef VkFlags VkQueryPoolCreateFlags;
 
 typedef enum VkQueryPipelineStatisticFlagBits {
     VK_QUERY_PIPELINE_STATISTIC_IA_VERTICES_BIT = 0x00000001,
@@ -907,6 +911,13 @@ typedef enum VkQueryResultFlagBits {
 } VkQueryResultFlagBits;
 typedef VkFlags VkQueryResultFlags;
 
+typedef enum VkBufferCreateFlagBits {
+    VK_BUFFER_CREATE_SPARSE_BINDING_BIT = 0x00000001,
+    VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002,
+    VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 0x00000004,
+} VkBufferCreateFlagBits;
+typedef VkFlags VkBufferCreateFlags;
+
 typedef enum VkBufferUsageFlagBits {
     VK_BUFFER_USAGE_TRANSFER_SRC_BIT = 0x00000001,
     VK_BUFFER_USAGE_TRANSFER_DST_BIT = 0x00000002,
@@ -919,13 +930,7 @@ typedef enum VkBufferUsageFlagBits {
     VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 0x00000100,
 } VkBufferUsageFlagBits;
 typedef VkFlags VkBufferUsageFlags;
-
-typedef enum {
-    VK_BUFFER_CREATE_SPARSE_BINDING_BIT = 0x00000001,
-    VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002,
-    VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 0x00000004,
-} VkBufferCreateFlagBits;
-typedef VkFlags VkBufferCreateFlags;
+typedef VkFlags VkBufferViewCreateFlags;
 
 typedef enum {
     VK_IMAGE_ASPECT_COLOR_BIT = 0x00000001,
@@ -941,6 +946,7 @@ typedef enum {
 } VkImageViewCreateFlagBits;
 typedef VkFlags VkImageViewCreateFlags;
 typedef VkFlags VkShaderModuleCreateFlags;
+typedef VkFlags VkPipelineCacheCreateFlags;
 typedef VkFlags VkShaderCreateFlags;
 
 typedef enum {
@@ -986,16 +992,23 @@ typedef VkFlags VkPipelineMultisampleStateCreateFlags;
 typedef VkFlags VkPipelineDepthStencilStateCreateFlags;
 typedef VkFlags VkPipelineColorBlendStateCreateFlags;
 typedef VkFlags VkPipelineDynamicStateCreateFlags;
+typedef VkFlags VkPipelineLayoutCreateFlags;
 typedef VkFlags VkShaderStageFlags;
+typedef VkFlags VkSamplerCreateFlags;
+typedef VkFlags VkDescriptorSetLayoutCreateFlags;
+
+typedef enum VkDescriptorPoolCreateFlagBits {
+    VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 0x00000001,
+} VkDescriptorPoolCreateFlagBits;
+typedef VkFlags VkDescriptorPoolCreateFlags;
+typedef VkFlags VkDescriptorPoolResetFlags;
+typedef VkFlags VkFramebufferCreateFlags;
+typedef VkFlags VkRenderPassCreateFlags;
 
 typedef enum VkAttachmentDescriptionFlagBits {
     VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT = 0x00000001,
 } VkAttachmentDescriptionFlagBits;
 typedef VkFlags VkAttachmentDescriptionFlags;
-
-typedef enum {
-    VK_SUBPASS_DESCRIPTION_NO_OVERDRAW_BIT = 0x00000001,
-} VkSubpassDescriptionFlagBits;
 typedef VkFlags VkSubpassDescriptionFlags;
 
 typedef enum VkPipelineStageFlagBits {
@@ -1053,14 +1066,12 @@ typedef enum VkCommandPoolResetFlagBits {
 typedef VkFlags VkCommandPoolResetFlags;
 typedef VkFlags VkCommandBufferCreateFlags;
 
-typedef enum {
-    VK_CMD_BUFFER_OPTIMIZE_SMALL_BATCH_BIT = 0x00000001,
-    VK_CMD_BUFFER_OPTIMIZE_PIPELINE_SWITCH_BIT = 0x00000002,
-    VK_CMD_BUFFER_OPTIMIZE_ONE_TIME_SUBMIT_BIT = 0x00000004,
-    VK_CMD_BUFFER_OPTIMIZE_DESCRIPTOR_SET_SWITCH_BIT = 0x00000008,
-    VK_CMD_BUFFER_OPTIMIZE_NO_SIMULTANEOUS_USE_BIT = 0x00000010,
-} VkCommandBufferOptimizeFlagBits;
-typedef VkFlags VkCommandBufferOptimizeFlags;
+typedef enum VkCommandBufferUsageFlagBits {
+    VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT = 0x00000001,
+    VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT = 0x00000002,
+    VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = 0x00000004,
+} VkCommandBufferUsageFlagBits;
+typedef VkFlags VkCommandBufferUsageFlags;
 
 typedef enum VkCommandBufferResetFlagBits {
     VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT = 0x00000001,
@@ -1110,6 +1121,7 @@ typedef struct {
 typedef struct {
     VkStructureType                             sType;
     const void*                                 pNext;
+    VkInstanceCreateFlags                       flags;
     const VkApplicationInfo*                    pAppInfo;
     const VkAllocCallbacks*                     pAllocCb;
     uint32_t                                    layerCount;
@@ -1338,6 +1350,7 @@ typedef struct VkPhysicalDeviceMemoryProperties {
 typedef struct VkDeviceQueueCreateInfo {
     VkStructureType                             sType;
     const void*                                 pNext;
+    VkDeviceQueueCreateFlags                    flags;
     uint32_t                                    queueFamilyIndex;
     uint32_t                                    queueCount;
 } VkDeviceQueueCreateInfo;
@@ -1345,6 +1358,7 @@ typedef struct VkDeviceQueueCreateInfo {
 typedef struct VkDeviceCreateInfo {
     VkStructureType                             sType;
     const void*                                 pNext;
+    VkDeviceCreateFlags                         flags;
     uint32_t                                    queueRecordCount;
     const VkDeviceQueueCreateInfo*              pRequestedQueues;
     uint32_t                                    layerCount;
@@ -1484,6 +1498,7 @@ typedef struct VkEventCreateInfo {
 typedef struct VkQueryPoolCreateInfo {
     VkStructureType                             sType;
     const void*                                 pNext;
+    VkQueryPoolCreateFlags                      flags;
     VkQueryType                                 queryType;
     uint32_t                                    slots;
     VkQueryPipelineStatisticFlags               pipelineStatistics;
@@ -1492,9 +1507,9 @@ typedef struct VkQueryPoolCreateInfo {
 typedef struct VkBufferCreateInfo {
     VkStructureType                             sType;
     const void*                                 pNext;
+    VkBufferCreateFlags                         flags;
     VkDeviceSize                                size;
     VkBufferUsageFlags                          usage;
-    VkBufferCreateFlags                         flags;
     VkSharingMode                               sharingMode;
     uint32_t                                    queueFamilyCount;
     const uint32_t*                             pQueueFamilyIndices;
@@ -1503,6 +1518,7 @@ typedef struct VkBufferCreateInfo {
 typedef struct VkBufferViewCreateInfo {
     VkStructureType                             sType;
     const void*                                 pNext;
+    VkBufferViewCreateFlags                     flags;
     VkBuffer                                    buffer;
     VkFormat                                    format;
     VkDeviceSize                                offset;
@@ -1512,6 +1528,7 @@ typedef struct VkBufferViewCreateInfo {
 typedef struct VkImageCreateInfo {
     VkStructureType                             sType;
     const void*                                 pNext;
+    VkImageCreateFlags                          flags;
     VkImageType                                 imageType;
     VkFormat                                    format;
     VkExtent3D                                  extent;
@@ -1520,7 +1537,6 @@ typedef struct VkImageCreateInfo {
     uint32_t                                    samples;
     VkImageTiling                               tiling;
     VkImageUsageFlags                           usage;
-    VkImageCreateFlags                          flags;
     VkSharingMode                               sharingMode;
     uint32_t                                    queueFamilyCount;
     const uint32_t*                             pQueueFamilyIndices;
@@ -1552,12 +1568,12 @@ typedef struct VkImageSubresourceRange {
 typedef struct VkImageViewCreateInfo {
     VkStructureType                             sType;
     const void*                                 pNext;
+    VkImageViewCreateFlags                      flags;
     VkImage                                     image;
     VkImageViewType                             viewType;
     VkFormat                                    format;
     VkComponentMapping                          components;
     VkImageSubresourceRange                     subresourceRange;
-    VkImageViewCreateFlags                      flags;
 } VkImageViewCreateInfo;
 
 typedef struct VkShaderModuleCreateInfo {
@@ -1580,6 +1596,7 @@ typedef struct {
 typedef struct VkPipelineCacheCreateInfo {
     VkStructureType                             sType;
     const void*                                 pNext;
+    VkPipelineCacheCreateFlags                  flags;
     size_t                                      initialSize;
     const void*                                 initialData;
     size_t                                      maxSize;
@@ -1803,6 +1820,7 @@ typedef struct VkPushConstantRange {
 typedef struct VkPipelineLayoutCreateInfo {
     VkStructureType                             sType;
     const void*                                 pNext;
+    VkPipelineLayoutCreateFlags                 flags;
     uint32_t                                    descriptorSetCount;
     const VkDescriptorSetLayout*                pSetLayouts;
     uint32_t                                    pushConstantRangeCount;
@@ -1812,6 +1830,7 @@ typedef struct VkPipelineLayoutCreateInfo {
 typedef struct VkSamplerCreateInfo {
     VkStructureType                             sType;
     const void*                                 pNext;
+    VkSamplerCreateFlags                        flags;
     VkFilter                                    magFilter;
     VkFilter                                    minFilter;
     VkSamplerMipmapMode                         mipmapMode;
@@ -1838,6 +1857,7 @@ typedef struct VkDescriptorSetLayoutBinding {
 typedef struct VkDescriptorSetLayoutCreateInfo {
     VkStructureType                             sType;
     const void*                                 pNext;
+    VkDescriptorSetLayoutCreateFlags            flags;
     uint32_t                                    count;
     const VkDescriptorSetLayoutBinding*         pBinding;
 } VkDescriptorSetLayoutCreateInfo;
@@ -1850,6 +1870,7 @@ typedef struct {
 typedef struct VkDescriptorPoolCreateInfo {
     VkStructureType                             sType;
     const void*                                 pNext;
+    VkDescriptorPoolCreateFlags                 flags;
     VkDescriptorPoolUsage                       poolUsage;
     uint32_t                                    maxSets;
     uint32_t                                    count;
@@ -1896,6 +1917,7 @@ typedef struct VkCopyDescriptorSet {
 typedef struct VkFramebufferCreateInfo {
     VkStructureType                             sType;
     const void*                                 pNext;
+    VkFramebufferCreateFlags                    flags;
     VkRenderPass                                renderPass;
     uint32_t                                    attachmentCount;
     const VkImageView*                          pAttachments;
@@ -1907,6 +1929,7 @@ typedef struct VkFramebufferCreateInfo {
 typedef struct VkAttachmentDescription {
     VkStructureType                             sType;
     const void*                                 pNext;
+    VkAttachmentDescriptionFlags                flags;
     VkFormat                                    format;
     uint32_t                                    samples;
     VkAttachmentLoadOp                          loadOp;
@@ -1915,7 +1938,6 @@ typedef struct VkAttachmentDescription {
     VkAttachmentStoreOp                         stencilStoreOp;
     VkImageLayout                               initialLayout;
     VkImageLayout                               finalLayout;
-    VkAttachmentDescriptionFlags                flags;
 } VkAttachmentDescription;
 
 typedef struct VkAttachmentReference {
@@ -1926,8 +1948,8 @@ typedef struct VkAttachmentReference {
 typedef struct VkSubpassDescription {
     VkStructureType                             sType;
     const void*                                 pNext;
-    VkPipelineBindPoint                         pipelineBindPoint;
     VkSubpassDescriptionFlags                   flags;
+    VkPipelineBindPoint                         pipelineBindPoint;
     uint32_t                                    inputCount;
     const VkAttachmentReference*                pInputAttachments;
     uint32_t                                    colorCount;
@@ -1953,6 +1975,7 @@ typedef struct VkSubpassDependency {
 typedef struct VkRenderPassCreateInfo {
     VkStructureType                             sType;
     const void*                                 pNext;
+    VkRenderPassCreateFlags                     flags;
     uint32_t                                    attachmentCount;
     const VkAttachmentDescription*              pAttachments;
     uint32_t                                    subpassCount;
@@ -1979,7 +2002,7 @@ typedef struct {
 typedef struct VkCommandBufferBeginInfo {
     VkStructureType                             sType;
     const void*                                 pNext;
-    VkCommandBufferOptimizeFlags                    flags;
+    VkCommandBufferUsageFlags                   flags;
     VkRenderPass                                renderPass;
     uint32_t                                    subpass;
     VkFramebuffer                               framebuffer;
index 62189afec2fecfaa3fd2762415096cb88d446c2c..34d7268631d6b4a2ee374af32ce9ff10364b23a5 100644 (file)
@@ -667,8 +667,8 @@ anv_cmd_buffer_end_batch_buffer(struct anv_cmd_buffer *cmd_buffer)
           * probably better of simply copying it into our batch.
           */
          cmd_buffer->exec_mode = ANV_CMD_BUFFER_EXEC_MODE_EMIT;
-      } else if (cmd_buffer->opt_flags &
-                 VK_CMD_BUFFER_OPTIMIZE_NO_SIMULTANEOUS_USE_BIT) {
+      } else if (!(cmd_buffer->usage_flags &
+                   VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT)) {
          cmd_buffer->exec_mode = ANV_CMD_BUFFER_EXEC_MODE_CHAIN;
 
          /* When we chain, we need to add an MI_BATCH_BUFFER_START command
index 7c00f9d46baf343b792c897c66e3a90b62e40c33..adba2072c51410a7a285dce2d280a0d4a8bf8d40 100644 (file)
@@ -188,7 +188,7 @@ VkResult anv_CreateCommandBuffer(
                          &device->dynamic_state_block_pool);
 
    cmd_buffer->level = pCreateInfo->level;
-   cmd_buffer->opt_flags = 0;
+   cmd_buffer->usage_flags = 0;
 
    anv_cmd_state_init(&cmd_buffer->state);
 
@@ -265,7 +265,7 @@ VkResult anv_BeginCommandBuffer(
 
    anv_cmd_buffer_reset_batch_bo_chain(cmd_buffer);
 
-   cmd_buffer->opt_flags = pBeginInfo->flags;
+   cmd_buffer->usage_flags = pBeginInfo->flags;
 
    if (cmd_buffer->level == VK_COMMAND_BUFFER_LEVEL_SECONDARY) {
       cmd_buffer->state.framebuffer =
index 6192361e491bc77cc88f45c71197ad3baa0081ab..b2d0b385d0a3db0caf02c6047f14973e71da907b 100644 (file)
@@ -94,7 +94,7 @@ anv_dump_image_to_ppm(struct anv_device *device,
    result = anv_BeginCommandBuffer(cmd,
       &(VkCommandBufferBeginInfo) {
          .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,
-         .flags = VK_CMD_BUFFER_OPTIMIZE_ONE_TIME_SUBMIT_BIT,
+         .flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT,
       });
    assert(result == VK_SUCCESS);
 
index c86003f58238c6fa99374ec559ac7045c2a7677c..6130cb97b75affebe6333832d84ab44e8e18c457 100644 (file)
@@ -1044,7 +1044,7 @@ struct anv_cmd_buffer {
    struct anv_state_stream                      surface_state_stream;
    struct anv_state_stream                      dynamic_state_stream;
 
-   VkCommandBufferOptimizeFlags                 opt_flags;
+   VkCommandBufferUsageFlags                    usage_flags;
    VkCommandBufferLevel                         level;
 
    struct anv_cmd_state                         state;