From 4ffa33a4e5c875244f721cd5c07be5d6346a482e Mon Sep 17 00:00:00 2001 From: Pyry Haulos Date: Thu, 24 Sep 2015 14:12:41 -0700 Subject: [PATCH] Add _LAST member to Vk* enums This adds VK_*_LAST to all Vk* enums that have linearly increasing enum values. For example VK_RESULT_LAST is not added as the values are not linearly increasing. Change-Id: I717d7f58972e30c4e531af498dfba36b97f1587e --- .../vulkancts/framework/vulkan/vkBasicTypes.inl | 76 ++++++++++++++++++++++ external/vulkancts/gen_framework.py | 22 +++++++ 2 files changed, 98 insertions(+) diff --git a/external/vulkancts/framework/vulkan/vkBasicTypes.inl b/external/vulkancts/framework/vulkan/vkBasicTypes.inl index c6af3bf..2b1749b 100644 --- a/external/vulkancts/framework/vulkan/vkBasicTypes.inl +++ b/external/vulkancts/framework/vulkan/vkBasicTypes.inl @@ -139,6 +139,8 @@ enum VkStructureType VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY = 47, VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = 48, VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO = 49, + + VK_STRUCTURE_TYPE_LAST }; enum VkSystemAllocType @@ -148,6 +150,8 @@ enum VkSystemAllocType VK_SYSTEM_ALLOC_TYPE_INTERNAL_TEMP = 2, VK_SYSTEM_ALLOC_TYPE_INTERNAL_SHADER = 3, VK_SYSTEM_ALLOC_TYPE_DEBUG = 4, + + VK_SYSTEM_ALLOC_TYPE_LAST }; enum VkFormat @@ -326,6 +330,8 @@ enum VkFormat VK_FORMAT_B10G10R10A2_SSCALED = 171, VK_FORMAT_B10G10R10A2_UINT = 172, VK_FORMAT_B10G10R10A2_SINT = 173, + + VK_FORMAT_LAST }; enum VkImageType @@ -333,12 +339,16 @@ enum VkImageType VK_IMAGE_TYPE_1D = 0, VK_IMAGE_TYPE_2D = 1, VK_IMAGE_TYPE_3D = 2, + + VK_IMAGE_TYPE_LAST }; enum VkImageTiling { VK_IMAGE_TILING_LINEAR = 0, VK_IMAGE_TILING_OPTIMAL = 1, + + VK_IMAGE_TILING_LAST }; enum VkPhysicalDeviceType @@ -348,6 +358,8 @@ enum VkPhysicalDeviceType VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU = 2, VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU = 3, VK_PHYSICAL_DEVICE_TYPE_CPU = 4, + + VK_PHYSICAL_DEVICE_TYPE_LAST }; enum VkImageAspect @@ -356,24 +368,32 @@ enum VkImageAspect VK_IMAGE_ASPECT_DEPTH = 1, VK_IMAGE_ASPECT_STENCIL = 2, VK_IMAGE_ASPECT_METADATA = 3, + + VK_IMAGE_ASPECT_LAST }; enum VkQueryType { VK_QUERY_TYPE_OCCLUSION = 0, VK_QUERY_TYPE_PIPELINE_STATISTICS = 1, + + VK_QUERY_TYPE_LAST }; enum VkSharingMode { VK_SHARING_MODE_EXCLUSIVE = 0, VK_SHARING_MODE_CONCURRENT = 1, + + VK_SHARING_MODE_LAST }; enum VkBufferViewType { VK_BUFFER_VIEW_TYPE_RAW = 0, VK_BUFFER_VIEW_TYPE_FORMATTED = 1, + + VK_BUFFER_VIEW_TYPE_LAST }; enum VkImageViewType @@ -385,6 +405,8 @@ enum VkImageViewType VK_IMAGE_VIEW_TYPE_1D_ARRAY = 4, VK_IMAGE_VIEW_TYPE_2D_ARRAY = 5, VK_IMAGE_VIEW_TYPE_CUBE_ARRAY = 6, + + VK_IMAGE_VIEW_TYPE_LAST }; enum VkChannelSwizzle @@ -395,6 +417,8 @@ enum VkChannelSwizzle VK_CHANNEL_SWIZZLE_G = 3, VK_CHANNEL_SWIZZLE_B = 4, VK_CHANNEL_SWIZZLE_A = 5, + + VK_CHANNEL_SWIZZLE_LAST }; enum VkShaderStage @@ -405,12 +429,16 @@ enum VkShaderStage VK_SHADER_STAGE_GEOMETRY = 3, VK_SHADER_STAGE_FRAGMENT = 4, VK_SHADER_STAGE_COMPUTE = 5, + + VK_SHADER_STAGE_LAST }; enum VkVertexInputStepRate { VK_VERTEX_INPUT_STEP_RATE_VERTEX = 0, VK_VERTEX_INPUT_STEP_RATE_INSTANCE = 1, + + VK_VERTEX_INPUT_STEP_RATE_LAST }; enum VkPrimitiveTopology @@ -426,6 +454,8 @@ enum VkPrimitiveTopology VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_ADJ = 8, VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_ADJ = 9, VK_PRIMITIVE_TOPOLOGY_PATCH = 10, + + VK_PRIMITIVE_TOPOLOGY_LAST }; enum VkFillMode @@ -433,6 +463,8 @@ enum VkFillMode VK_FILL_MODE_POINTS = 0, VK_FILL_MODE_WIREFRAME = 1, VK_FILL_MODE_SOLID = 2, + + VK_FILL_MODE_LAST }; enum VkCullMode @@ -441,12 +473,16 @@ enum VkCullMode VK_CULL_MODE_FRONT = 1, VK_CULL_MODE_BACK = 2, VK_CULL_MODE_FRONT_AND_BACK = 3, + + VK_CULL_MODE_LAST }; enum VkFrontFace { VK_FRONT_FACE_CCW = 0, VK_FRONT_FACE_CW = 1, + + VK_FRONT_FACE_LAST }; enum VkCompareOp @@ -459,6 +495,8 @@ enum VkCompareOp VK_COMPARE_OP_NOT_EQUAL = 5, VK_COMPARE_OP_GREATER_EQUAL = 6, VK_COMPARE_OP_ALWAYS = 7, + + VK_COMPARE_OP_LAST }; enum VkStencilOp @@ -471,6 +509,8 @@ enum VkStencilOp VK_STENCIL_OP_INVERT = 5, VK_STENCIL_OP_INC_WRAP = 6, VK_STENCIL_OP_DEC_WRAP = 7, + + VK_STENCIL_OP_LAST }; enum VkLogicOp @@ -491,6 +531,8 @@ enum VkLogicOp VK_LOGIC_OP_OR_INVERTED = 13, VK_LOGIC_OP_NAND = 14, VK_LOGIC_OP_SET = 15, + + VK_LOGIC_OP_LAST }; enum VkBlend @@ -514,6 +556,8 @@ enum VkBlend VK_BLEND_ONE_MINUS_SRC1_COLOR = 16, VK_BLEND_SRC1_ALPHA = 17, VK_BLEND_ONE_MINUS_SRC1_ALPHA = 18, + + VK_BLEND_LAST }; enum VkBlendOp @@ -523,12 +567,16 @@ enum VkBlendOp VK_BLEND_OP_REVERSE_SUBTRACT = 2, VK_BLEND_OP_MIN = 3, VK_BLEND_OP_MAX = 4, + + VK_BLEND_OP_LAST }; enum VkTexFilter { VK_TEX_FILTER_NEAREST = 0, VK_TEX_FILTER_LINEAR = 1, + + VK_TEX_FILTER_LAST }; enum VkTexMipmapMode @@ -536,6 +584,8 @@ enum VkTexMipmapMode VK_TEX_MIPMAP_MODE_BASE = 0, VK_TEX_MIPMAP_MODE_NEAREST = 1, VK_TEX_MIPMAP_MODE_LINEAR = 2, + + VK_TEX_MIPMAP_MODE_LAST }; enum VkTexAddress @@ -545,6 +595,8 @@ enum VkTexAddress VK_TEX_ADDRESS_CLAMP = 2, VK_TEX_ADDRESS_MIRROR_ONCE = 3, VK_TEX_ADDRESS_CLAMP_BORDER = 4, + + VK_TEX_ADDRESS_LAST }; enum VkBorderColor @@ -555,6 +607,8 @@ enum VkBorderColor VK_BORDER_COLOR_INT_OPAQUE_BLACK = 3, VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE = 4, VK_BORDER_COLOR_INT_OPAQUE_WHITE = 5, + + VK_BORDER_COLOR_LAST }; enum VkDescriptorType @@ -570,18 +624,24 @@ enum VkDescriptorType VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC = 8, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC = 9, VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 10, + + VK_DESCRIPTOR_TYPE_LAST }; enum VkDescriptorPoolUsage { VK_DESCRIPTOR_POOL_USAGE_ONE_SHOT = 0, VK_DESCRIPTOR_POOL_USAGE_DYNAMIC = 1, + + VK_DESCRIPTOR_POOL_USAGE_LAST }; enum VkDescriptorSetUsage { VK_DESCRIPTOR_SET_USAGE_ONE_SHOT = 0, VK_DESCRIPTOR_SET_USAGE_STATIC = 1, + + VK_DESCRIPTOR_SET_USAGE_LAST }; enum VkImageLayout @@ -594,6 +654,8 @@ enum VkImageLayout VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL = 5, VK_IMAGE_LAYOUT_TRANSFER_SOURCE_OPTIMAL = 6, VK_IMAGE_LAYOUT_TRANSFER_DESTINATION_OPTIMAL = 7, + + VK_IMAGE_LAYOUT_LAST }; enum VkAttachmentLoadOp @@ -601,42 +663,56 @@ enum VkAttachmentLoadOp VK_ATTACHMENT_LOAD_OP_LOAD = 0, VK_ATTACHMENT_LOAD_OP_CLEAR = 1, VK_ATTACHMENT_LOAD_OP_DONT_CARE = 2, + + VK_ATTACHMENT_LOAD_OP_LAST }; enum VkAttachmentStoreOp { VK_ATTACHMENT_STORE_OP_STORE = 0, VK_ATTACHMENT_STORE_OP_DONT_CARE = 1, + + VK_ATTACHMENT_STORE_OP_LAST }; enum VkPipelineBindPoint { VK_PIPELINE_BIND_POINT_COMPUTE = 0, VK_PIPELINE_BIND_POINT_GRAPHICS = 1, + + VK_PIPELINE_BIND_POINT_LAST }; enum VkCmdBufferLevel { VK_CMD_BUFFER_LEVEL_PRIMARY = 0, VK_CMD_BUFFER_LEVEL_SECONDARY = 1, + + VK_CMD_BUFFER_LEVEL_LAST }; enum VkIndexType { VK_INDEX_TYPE_UINT16 = 0, VK_INDEX_TYPE_UINT32 = 1, + + VK_INDEX_TYPE_LAST }; enum VkTimestampType { VK_TIMESTAMP_TYPE_TOP = 0, VK_TIMESTAMP_TYPE_BOTTOM = 1, + + VK_TIMESTAMP_TYPE_LAST }; enum VkRenderPassContents { VK_RENDER_PASS_CONTENTS_INLINE = 0, VK_RENDER_PASS_CONTENTS_SECONDARY_CMD_BUFFERS = 1, + + VK_RENDER_PASS_CONTENTS_LAST }; enum VkFormatFeatureFlagBits diff --git a/external/vulkancts/gen_framework.py b/external/vulkancts/gen_framework.py index 30a3de6..df35926 100644 --- a/external/vulkancts/gen_framework.py +++ b/external/vulkancts/gen_framework.py @@ -323,11 +323,33 @@ def writeHandleType (api, filename): writeInlFile(filename, INL_HEADER, gen()) +def getEnumValuePrefix (enum): + prefix = enum.name[0] + for i in range(1, len(enum.name)): + if enum.name[i].isupper(): + prefix += "_" + prefix += enum.name[i].upper() + return prefix + +def areEnumValuesLinear (enum): + curIndex = 0 + for name, value in enum.values: + if int(value) != curIndex: + return False + curIndex += 1 + return True + def genEnumSrc (enum): yield "enum %s" % enum.name yield "{" + for line in indentLines(["\t%s\t= %s," % v for v in enum.values]): yield line + + if areEnumValuesLinear(enum): + yield "" + yield "\t%s_LAST" % getEnumValuePrefix(enum) + yield "};" def genBitfieldSrc (bitfield): -- 2.7.4