vk: Better types for VkShaderStage, VkShaderStageFlags vars
authorChad Versace <chad.versace@intel.com>
Mon, 5 Oct 2015 15:52:42 +0000 (08:52 -0700)
committerChad Versace <chad.versace@intel.com>
Mon, 5 Oct 2015 15:55:09 +0000 (08:55 -0700)
In most places, the variable type was the uninformative uint32_t.

src/vulkan/anv_cmd_buffer.c
src/vulkan/anv_device.c
src/vulkan/anv_private.h
src/vulkan/gen8_cmd_buffer.c

index c74d6d0eb17ef3447897c83f9669cf4a276079c1..419405204d5b2a10d7110a5eb3f9c6b697c7ff5c 100644 (file)
@@ -333,7 +333,7 @@ void anv_CmdBindDescriptorSets(
       }
 
       if (set_layout->num_dynamic_buffers > 0) {
-         uint32_t s;
+         VkShaderStage s;
          for_each_bit(s, set_layout->shader_stages) {
             anv_cmd_buffer_ensure_push_constant_field(cmd_buffer, s,
                                                       dynamic_offsets);
@@ -389,7 +389,7 @@ add_surface_state_reloc(struct anv_cmd_buffer *cmd_buffer,
 
 VkResult
 anv_cmd_buffer_emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
-                                  unsigned stage, struct anv_state *bt_state)
+                                  VkShaderStage stage, struct anv_state *bt_state)
 {
    struct anv_framebuffer *fb = cmd_buffer->state.framebuffer;
    struct anv_subpass *subpass = cmd_buffer->state.subpass;
@@ -473,7 +473,7 @@ anv_cmd_buffer_emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
 
 VkResult
 anv_cmd_buffer_emit_samplers(struct anv_cmd_buffer *cmd_buffer,
-                             unsigned stage, struct anv_state *state)
+                             VkShaderStage stage, struct anv_state *state)
 {
    struct anv_pipeline_layout *layout;
    uint32_t sampler_count;
@@ -517,7 +517,7 @@ anv_cmd_buffer_emit_samplers(struct anv_cmd_buffer *cmd_buffer,
 }
 
 static VkResult
-flush_descriptor_set(struct anv_cmd_buffer *cmd_buffer, uint32_t stage)
+flush_descriptor_set(struct anv_cmd_buffer *cmd_buffer, VkShaderStage stage)
 {
    struct anv_state surfaces = { 0, }, samplers = { 0, };
    VkResult result;
@@ -567,8 +567,9 @@ flush_descriptor_set(struct anv_cmd_buffer *cmd_buffer, uint32_t stage)
 void
 anv_flush_descriptor_sets(struct anv_cmd_buffer *cmd_buffer)
 {
-   uint32_t s, dirty = cmd_buffer->state.descriptors_dirty &
-                       cmd_buffer->state.pipeline->active_stages;
+   VkShaderStage s;
+   VkShaderStageFlags dirty = cmd_buffer->state.descriptors_dirty &
+                              cmd_buffer->state.pipeline->active_stages;
 
    VkResult result = VK_SUCCESS;
    for_each_bit(s, dirty) {
@@ -715,7 +716,7 @@ void anv_CmdPushConstants(
     const void*                                 values)
 {
    ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, cmdBuffer);
-   uint32_t stage;
+   VkShaderStage stage;
 
    for_each_bit(stage, stageFlags) {
       anv_cmd_buffer_ensure_push_constant_field(cmd_buffer, stage, client_data);
index b6f083b4c83fe0d84bb31f32035c4234376ed691..dd9b08ce075eb1aad80d6565ecb1a434d1c969fd 100644 (file)
@@ -1462,7 +1462,7 @@ VkResult anv_CreateDescriptorSetLayout(
    uint32_t surface_count[VK_SHADER_STAGE_NUM] = { 0, };
    uint32_t num_dynamic_buffers = 0;
    uint32_t count = 0;
-   uint32_t stages = 0;
+   VkShaderStageFlags stages = 0;
    uint32_t s;
 
    for (uint32_t i = 0; i < pCreateInfo->count; i++) {
index a2211bb76b3d1f29dc3010f7d3526d7dccf6680a..29a04cab15413a8c62ba7504f38fb0a449e5b802 100644 (file)
@@ -724,7 +724,7 @@ struct anv_descriptor_set_layout {
 
    uint32_t count;
    uint32_t num_dynamic_buffers;
-   uint32_t shader_stages;
+   VkShaderStageFlags shader_stages;
    struct anv_descriptor_slot entries[0];
 };
 
@@ -828,8 +828,8 @@ struct anv_cmd_state {
    uint32_t                                     vb_dirty;
    uint32_t                                     dirty;
    uint32_t                                     compute_dirty;
-   uint32_t                                     descriptors_dirty;
-   uint32_t                                     push_constants_dirty;
+   VkShaderStageFlags                           descriptors_dirty;
+   VkShaderStageFlags                           push_constants_dirty;
    uint32_t                                     scratch_size;
    struct anv_pipeline *                        pipeline;
    struct anv_pipeline *                        compute_pipeline;
@@ -1034,7 +1034,7 @@ struct anv_pipeline {
       uint32_t                                  nr_gs_entries;
    } urb;
 
-   uint32_t                                     active_stages;
+   VkShaderStageFlags                           active_stages;
    struct anv_state_stream                      program_stream;
    struct anv_state                             blend_state;
    uint32_t                                     vs_simd8;
index d82a409d886030a5c2e7060794d321761a6b9de3..a294e3ad50c71e0389babe27be39f957b6e9c32b 100644 (file)
@@ -32,8 +32,6 @@
 static void
 gen8_cmd_buffer_flush_push_constants(struct anv_cmd_buffer *cmd_buffer)
 {
-   uint32_t stage;
-
    static const uint32_t push_constant_opcodes[] = {
       [VK_SHADER_STAGE_VERTEX]                  = 21,
       [VK_SHADER_STAGE_TESS_CONTROL]            = 25, /* HS */
@@ -43,7 +41,8 @@ gen8_cmd_buffer_flush_push_constants(struct anv_cmd_buffer *cmd_buffer)
       [VK_SHADER_STAGE_COMPUTE]                 = 0,
    };
 
-   uint32_t flushed = 0;
+   VkShaderStage stage;
+   VkShaderStageFlags flushed = 0;
 
    for_each_bit(stage, cmd_buffer->state.push_constants_dirty) {
       struct anv_state state = anv_cmd_buffer_push_constants(cmd_buffer, stage);