From 9c93aa9141505601d862a7c85fea0679e7c63e86 Mon Sep 17 00:00:00 2001 From: Chad Versace Date: Mon, 5 Oct 2015 08:52:42 -0700 Subject: [PATCH] vk: Better types for VkShaderStage, VkShaderStageFlags vars In most places, the variable type was the uninformative uint32_t. --- src/vulkan/anv_cmd_buffer.c | 15 ++++++++------- src/vulkan/anv_device.c | 2 +- src/vulkan/anv_private.h | 8 ++++---- src/vulkan/gen8_cmd_buffer.c | 5 ++--- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/vulkan/anv_cmd_buffer.c b/src/vulkan/anv_cmd_buffer.c index c74d6d0eb17..419405204d5 100644 --- a/src/vulkan/anv_cmd_buffer.c +++ b/src/vulkan/anv_cmd_buffer.c @@ -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); diff --git a/src/vulkan/anv_device.c b/src/vulkan/anv_device.c index b6f083b4c83..dd9b08ce075 100644 --- a/src/vulkan/anv_device.c +++ b/src/vulkan/anv_device.c @@ -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++) { diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h index a2211bb76b3..29a04cab154 100644 --- a/src/vulkan/anv_private.h +++ b/src/vulkan/anv_private.h @@ -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; diff --git a/src/vulkan/gen8_cmd_buffer.c b/src/vulkan/gen8_cmd_buffer.c index d82a409d886..a294e3ad50c 100644 --- a/src/vulkan/gen8_cmd_buffer.c +++ b/src/vulkan/gen8_cmd_buffer.c @@ -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); -- 2.30.2