vk/0.210.0: Rework a few raster/input enums
authorJason Ekstrand <jason.ekstrand@intel.com>
Mon, 30 Nov 2015 21:28:09 +0000 (13:28 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Mon, 30 Nov 2015 21:28:17 +0000 (13:28 -0800)
include/vulkan/vulkan.h
src/vulkan/anv_meta.c
src/vulkan/anv_meta_clear.c
src/vulkan/anv_pipeline.c
src/vulkan/gen7_pipeline.c
src/vulkan/gen8_pipeline.c

index 2f2dc11c3c283368e15790bfca4ce06610c9c2b8..1520d993d04e68da2b507baf8eb6b8afdf6729ff 100644 (file)
@@ -494,14 +494,14 @@ typedef enum {
     VK_SHADER_STAGE_MAX_ENUM = 0x7FFFFFFF
 } VkShaderStage;
 
-typedef enum {
-    VK_VERTEX_INPUT_STEP_RATE_VERTEX = 0,
-    VK_VERTEX_INPUT_STEP_RATE_INSTANCE = 1,
-    VK_VERTEX_INPUT_STEP_RATE_BEGIN_RANGE = VK_VERTEX_INPUT_STEP_RATE_VERTEX,
-    VK_VERTEX_INPUT_STEP_RATE_END_RANGE = VK_VERTEX_INPUT_STEP_RATE_INSTANCE,
-    VK_VERTEX_INPUT_STEP_RATE_NUM = (VK_VERTEX_INPUT_STEP_RATE_INSTANCE - VK_VERTEX_INPUT_STEP_RATE_VERTEX + 1),
-    VK_VERTEX_INPUT_STEP_RATE_MAX_ENUM = 0x7FFFFFFF
-} VkVertexInputStepRate;
+typedef enum VkVertexInputRate {
+    VK_VERTEX_INPUT_RATE_VERTEX = 0,
+    VK_VERTEX_INPUT_RATE_INSTANCE = 1,
+    VK_VERTEX_INPUT_RATE_BEGIN_RANGE = VK_VERTEX_INPUT_RATE_VERTEX,
+    VK_VERTEX_INPUT_RATE_END_RANGE = VK_VERTEX_INPUT_RATE_INSTANCE,
+    VK_VERTEX_INPUT_RATE_RANGE_SIZE = (VK_VERTEX_INPUT_RATE_INSTANCE - VK_VERTEX_INPUT_RATE_VERTEX + 1),
+    VK_VERTEX_INPUT_RATE_MAX_ENUM = 0x7FFFFFFF
+} VkVertexInputRate;
 
 typedef enum VkPrimitiveTopology {
     VK_PRIMITIVE_TOPOLOGY_POINT_LIST = 0,
@@ -521,33 +521,22 @@ typedef enum VkPrimitiveTopology {
     VK_PRIMITIVE_TOPOLOGY_MAX_ENUM = 0x7FFFFFFF
 } VkPrimitiveTopology;
 
-typedef enum {
-    VK_FILL_MODE_POINTS = 0,
-    VK_FILL_MODE_WIREFRAME = 1,
-    VK_FILL_MODE_SOLID = 2,
-    VK_FILL_MODE_BEGIN_RANGE = VK_FILL_MODE_POINTS,
-    VK_FILL_MODE_END_RANGE = VK_FILL_MODE_SOLID,
-    VK_FILL_MODE_NUM = (VK_FILL_MODE_SOLID - VK_FILL_MODE_POINTS + 1),
-    VK_FILL_MODE_MAX_ENUM = 0x7FFFFFFF
-} VkFillMode;
-
-typedef enum {
-    VK_CULL_MODE_NONE = 0,
-    VK_CULL_MODE_FRONT = 1,
-    VK_CULL_MODE_BACK = 2,
-    VK_CULL_MODE_FRONT_AND_BACK = 3,
-    VK_CULL_MODE_BEGIN_RANGE = VK_CULL_MODE_NONE,
-    VK_CULL_MODE_END_RANGE = VK_CULL_MODE_FRONT_AND_BACK,
-    VK_CULL_MODE_NUM = (VK_CULL_MODE_FRONT_AND_BACK - VK_CULL_MODE_NONE + 1),
-    VK_CULL_MODE_MAX_ENUM = 0x7FFFFFFF
-} VkCullMode;
-
-typedef enum {
-    VK_FRONT_FACE_CCW = 0,
-    VK_FRONT_FACE_CW = 1,
-    VK_FRONT_FACE_BEGIN_RANGE = VK_FRONT_FACE_CCW,
-    VK_FRONT_FACE_END_RANGE = VK_FRONT_FACE_CW,
-    VK_FRONT_FACE_NUM = (VK_FRONT_FACE_CW - VK_FRONT_FACE_CCW + 1),
+typedef enum VkPolygonMode {
+    VK_POLYGON_MODE_FILL = 0,
+    VK_POLYGON_MODE_LINE = 1,
+    VK_POLYGON_MODE_POINT = 2,
+    VK_POLYGON_MODE_BEGIN_RANGE = VK_POLYGON_MODE_FILL,
+    VK_POLYGON_MODE_END_RANGE = VK_POLYGON_MODE_POINT,
+    VK_POLYGON_MODE_RANGE_SIZE = (VK_POLYGON_MODE_POINT - VK_POLYGON_MODE_FILL + 1),
+    VK_POLYGON_MODE_MAX_ENUM = 0x7FFFFFFF
+} VkPolygonMode;
+
+typedef enum VkFrontFace {
+    VK_FRONT_FACE_COUNTER_CLOCKWISE = 0,
+    VK_FRONT_FACE_CLOCKWISE = 1,
+    VK_FRONT_FACE_BEGIN_RANGE = VK_FRONT_FACE_COUNTER_CLOCKWISE,
+    VK_FRONT_FACE_END_RANGE = VK_FRONT_FACE_CLOCKWISE,
+    VK_FRONT_FACE_RANGE_SIZE = (VK_FRONT_FACE_CLOCKWISE - VK_FRONT_FACE_COUNTER_CLOCKWISE + 1),
     VK_FRONT_FACE_MAX_ENUM = 0x7FFFFFFF
 } VkFrontFace;
 
@@ -979,6 +968,14 @@ typedef enum VkShaderStageFlagBits {
     VK_SHADER_STAGE_ALL_GRAPHICS = 0x1F,
     VK_SHADER_STAGE_ALL = 0x7FFFFFFF,
 } VkShaderStageFlagBits;
+
+typedef enum VkCullModeFlagBits {
+    VK_CULL_MODE_NONE = 0,
+    VK_CULL_MODE_FRONT_BIT = 0x00000001,
+    VK_CULL_MODE_BACK_BIT = 0x00000002,
+    VK_CULL_MODE_FRONT_AND_BACK = 0x3,
+} VkCullModeFlagBits;
+typedef VkFlags VkCullModeFlags;
 typedef VkFlags VkShaderStageFlags;
 
 typedef enum VkAttachmentDescriptionFlagBits {
@@ -1569,7 +1566,7 @@ typedef struct {
 typedef struct {
     uint32_t                                    binding;
     uint32_t                                    strideInBytes;
-    VkVertexInputStepRate                       stepRate;
+    VkVertexInputRate                           inputRate;
 } VkVertexInputBindingDescription;
 
 typedef struct {
@@ -1639,8 +1636,8 @@ typedef struct {
     const void*                                 pNext;
     VkBool32                                    depthClipEnable;
     VkBool32                                    rasterizerDiscardEnable;
-    VkFillMode                                  fillMode;
-    VkCullMode                                  cullMode;
+    VkPolygonMode                               polygonMode;
+    VkCullModeFlags                             cullMode;
     VkFrontFace                                 frontFace;
     VkBool32                                    depthBiasEnable;
     float                                       depthBias;
index 130557c1aa739e69b996876d631da4d939baf152..eabe207389e8ed436995a64ecb878a9a354538e2 100644 (file)
@@ -269,12 +269,12 @@ anv_device_init_meta_blit_state(struct anv_device *device)
          {
             .binding = 0,
             .strideInBytes = 0,
-            .stepRate = VK_VERTEX_INPUT_STEP_RATE_VERTEX
+            .inputRate = VK_VERTEX_INPUT_RATE_VERTEX
          },
          {
             .binding = 1,
             .strideInBytes = 5 * sizeof(float),
-            .stepRate = VK_VERTEX_INPUT_STEP_RATE_VERTEX
+            .inputRate = VK_VERTEX_INPUT_RATE_VERTEX
          },
       },
       .attributeCount = 3,
@@ -359,9 +359,9 @@ anv_device_init_meta_blit_state(struct anv_device *device)
          .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTER_STATE_CREATE_INFO,
          .depthClipEnable = true,
          .rasterizerDiscardEnable = false,
-         .fillMode = VK_FILL_MODE_SOLID,
+         .polygonMode = VK_POLYGON_MODE_FILL,
          .cullMode = VK_CULL_MODE_NONE,
-         .frontFace = VK_FRONT_FACE_CCW
+         .frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE
       },
       .pMultisampleState = &(VkPipelineMultisampleStateCreateInfo) {
          .sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO,
index ff8183a736a383200e89fa90c55755c6a9bcbf88..bcdc9e4d5b4524f2089bb4b6faa3f30e5b700f6b 100644 (file)
@@ -177,9 +177,9 @@ create_pipeline(struct anv_device *device,
             .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTER_STATE_CREATE_INFO,
             .depthClipEnable = false,
             .rasterizerDiscardEnable = false,
-            .fillMode = VK_FILL_MODE_SOLID,
+            .polygonMode = VK_POLYGON_MODE_FILL,
             .cullMode = VK_CULL_MODE_NONE,
-            .frontFace = VK_FRONT_FACE_CCW,
+            .frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE,
             .depthBiasEnable = false,
             .depthClipEnable = false,
          },
@@ -246,7 +246,7 @@ init_color_pipeline(struct anv_device *device)
          {
             .binding = 0,
             .strideInBytes = sizeof(struct color_clear_vattrs),
-            .stepRate = VK_VERTEX_INPUT_STEP_RATE_VERTEX
+            .inputRate = VK_VERTEX_INPUT_RATE_VERTEX
          },
       },
       .attributeCount = 3,
@@ -429,7 +429,7 @@ create_depthstencil_pipeline(struct anv_device *device,
          {
             .binding = 0,
             .strideInBytes = sizeof(struct depthstencil_clear_vattrs),
-            .stepRate = VK_VERTEX_INPUT_STEP_RATE_VERTEX
+            .inputRate = VK_VERTEX_INPUT_RATE_VERTEX
          },
       },
       .attributeCount = 2,
index a61f0c16757c5ac7a0fd60080bf326d292144ec2..16d054665f52b660296a48dfab38fe5d84c14ed5 100644 (file)
@@ -1043,12 +1043,12 @@ anv_pipeline_init(struct anv_pipeline *pipeline, struct anv_device *device,
       /* Step rate is programmed per vertex element (attribute), not
        * binding. Set up a map of which bindings step per instance, for
        * reference by vertex element setup. */
-      switch (desc->stepRate) {
+      switch (desc->inputRate) {
       default:
-      case VK_VERTEX_INPUT_STEP_RATE_VERTEX:
+      case VK_VERTEX_INPUT_RATE_VERTEX:
          pipeline->instancing_enable[desc->binding] = false;
          break;
-      case VK_VERTEX_INPUT_STEP_RATE_INSTANCE:
+      case VK_VERTEX_INPUT_RATE_INSTANCE:
          pipeline->instancing_enable[desc->binding] = true;
          break;
       }
index 2d26a0380c565370fa41dea75c04eacd845b2788..d3ec1001ba8863bf75e68b5c5f4870676d2df98d 100644 (file)
@@ -83,20 +83,20 @@ gen7_emit_vertex_input(struct anv_pipeline *pipeline,
 
 static const uint32_t vk_to_gen_cullmode[] = {
    [VK_CULL_MODE_NONE]                          = CULLMODE_NONE,
-   [VK_CULL_MODE_FRONT]                         = CULLMODE_FRONT,
-   [VK_CULL_MODE_BACK]                          = CULLMODE_BACK,
+   [VK_CULL_MODE_FRONT_BIT]                     = CULLMODE_FRONT,
+   [VK_CULL_MODE_BACK_BIT]                      = CULLMODE_BACK,
    [VK_CULL_MODE_FRONT_AND_BACK]                = CULLMODE_BOTH
 };
 
 static const uint32_t vk_to_gen_fillmode[] = {
-   [VK_FILL_MODE_POINTS]                        = RASTER_POINT,
-   [VK_FILL_MODE_WIREFRAME]                     = RASTER_WIREFRAME,
-   [VK_FILL_MODE_SOLID]                         = RASTER_SOLID
+   [VK_POLYGON_MODE_FILL]                       = RASTER_SOLID,
+   [VK_POLYGON_MODE_LINE]                       = RASTER_WIREFRAME,
+   [VK_POLYGON_MODE_POINT]                      = RASTER_POINT,
 };
 
 static const uint32_t vk_to_gen_front_face[] = {
-   [VK_FRONT_FACE_CCW]                          = 1,
-   [VK_FRONT_FACE_CW]                           = 0
+   [VK_FRONT_FACE_COUNTER_CLOCKWISE]            = 1,
+   [VK_FRONT_FACE_CLOCKWISE]                    = 0
 };
 
 static void
@@ -113,8 +113,8 @@ gen7_emit_rs_state(struct anv_pipeline *pipeline,
       /* LegacyGlobalDepthBiasEnable */
 
       .StatisticsEnable                         = true,
-      .FrontFaceFillMode                        = vk_to_gen_fillmode[info->fillMode],
-      .BackFaceFillMode                         = vk_to_gen_fillmode[info->fillMode],
+      .FrontFaceFillMode                        = vk_to_gen_fillmode[info->polygonMode],
+      .BackFaceFillMode                         = vk_to_gen_fillmode[info->polygonMode],
       .ViewTransformEnable                      = !(extra && extra->disable_viewport),
       .FrontWinding                             = vk_to_gen_front_face[info->frontFace],
       /* bool                                         AntiAliasingEnable; */
index b62bc44e7106baa808bde7c7c095a1e5aa4bfc0d..8f106571a87c0f6d0e7d65f47b461d5773da0698 100644 (file)
@@ -97,20 +97,20 @@ emit_rs_state(struct anv_pipeline *pipeline,
 {
    static const uint32_t vk_to_gen_cullmode[] = {
       [VK_CULL_MODE_NONE]                       = CULLMODE_NONE,
-      [VK_CULL_MODE_FRONT]                      = CULLMODE_FRONT,
-      [VK_CULL_MODE_BACK]                       = CULLMODE_BACK,
+      [VK_CULL_MODE_FRONT_BIT]                  = CULLMODE_FRONT,
+      [VK_CULL_MODE_BACK_BIT]                   = CULLMODE_BACK,
       [VK_CULL_MODE_FRONT_AND_BACK]             = CULLMODE_BOTH
    };
 
    static const uint32_t vk_to_gen_fillmode[] = {
-      [VK_FILL_MODE_POINTS]                     = RASTER_POINT,
-      [VK_FILL_MODE_WIREFRAME]                  = RASTER_WIREFRAME,
-      [VK_FILL_MODE_SOLID]                      = RASTER_SOLID
+      [VK_POLYGON_MODE_FILL]                    = RASTER_SOLID,
+      [VK_POLYGON_MODE_LINE]                    = RASTER_WIREFRAME,
+      [VK_POLYGON_MODE_POINT]                   = RASTER_POINT,
    };
 
    static const uint32_t vk_to_gen_front_face[] = {
-      [VK_FRONT_FACE_CCW]                       = CounterClockwise,
-      [VK_FRONT_FACE_CW]                        = Clockwise
+      [VK_FRONT_FACE_COUNTER_CLOCKWISE]         = 1,
+      [VK_FRONT_FACE_CLOCKWISE]                 = 0
    };
 
    struct GENX(3DSTATE_SF) sf = {
@@ -131,8 +131,8 @@ emit_rs_state(struct anv_pipeline *pipeline,
       GENX(3DSTATE_RASTER_header),
       .FrontWinding = vk_to_gen_front_face[info->frontFace],
       .CullMode = vk_to_gen_cullmode[info->cullMode],
-      .FrontFaceFillMode = vk_to_gen_fillmode[info->fillMode],
-      .BackFaceFillMode = vk_to_gen_fillmode[info->fillMode],
+      .FrontFaceFillMode = vk_to_gen_fillmode[info->polygonMode],
+      .BackFaceFillMode = vk_to_gen_fillmode[info->polygonMode],
       .ScissorRectangleEnable = !(extra && extra->disable_scissor),
 #if ANV_GEN == 8
       .ViewportZClipTestEnable = info->depthClipEnable