From: Jason Ekstrand Date: Mon, 6 Jul 2015 23:43:28 +0000 (-0700) Subject: vk: Rename NUM_SHADER_STAGE to SHADER_STAGE_NUM X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8c5e48f3074d11d3541c0d336723cc550800a9e5;p=mesa.git vk: Rename NUM_SHADER_STAGE to SHADER_STAGE_NUM This is a refactor of more than just the header but it lets us finish reformating the shader stage enum. --- diff --git a/include/vulkan/vulkan.h b/include/vulkan/vulkan.h index 7c3aae9d344..1d78177c155 100644 --- a/include/vulkan/vulkan.h +++ b/include/vulkan/vulkan.h @@ -544,8 +544,10 @@ typedef enum { VK_SHADER_STAGE_GEOMETRY = 3, VK_SHADER_STAGE_FRAGMENT = 4, VK_SHADER_STAGE_COMPUTE = 5, - - VK_ENUM_RANGE(SHADER_STAGE, VERTEX, COMPUTE) + VK_SHADER_STAGE_BEGIN_RANGE = VK_SHADER_STAGE_VERTEX, + VK_SHADER_STAGE_END_RANGE = VK_SHADER_STAGE_COMPUTE, + VK_SHADER_STAGE_NUM = (VK_SHADER_STAGE_COMPUTE - VK_SHADER_STAGE_VERTEX + 1), + VK_SHADER_STAGE_MAX_ENUM = 0x7FFFFFFF } VkShaderStage; typedef enum { diff --git a/src/vulkan/compiler.cpp b/src/vulkan/compiler.cpp index b220331408c..7ba42151c19 100644 --- a/src/vulkan/compiler.cpp +++ b/src/vulkan/compiler.cpp @@ -1029,12 +1029,12 @@ anv_compiler_run(struct anv_compiler *compiler, struct anv_pipeline *pipeline) program = brw->ctx.Driver.NewShaderProgram(name); program->Shaders = (struct gl_shader **) - calloc(VK_NUM_SHADER_STAGE, sizeof(struct gl_shader *)); + calloc(VK_SHADER_STAGE_NUM, sizeof(struct gl_shader *)); fail_if(program == NULL || program->Shaders == NULL, "failed to create program\n"); bool all_spirv = true; - for (unsigned i = 0; i < VK_NUM_SHADER_STAGE; i++) { + for (unsigned i = 0; i < VK_SHADER_STAGE_NUM; i++) { if (pipeline->shaders[i] == NULL) continue; @@ -1050,7 +1050,7 @@ anv_compiler_run(struct anv_compiler *compiler, struct anv_pipeline *pipeline) } if (all_spirv) { - for (unsigned i = 0; i < VK_NUM_SHADER_STAGE; i++) { + for (unsigned i = 0; i < VK_SHADER_STAGE_NUM; i++) { if (pipeline->shaders[i]) anv_compile_shader_spirv(compiler, program, pipeline, i); } @@ -1060,7 +1060,7 @@ anv_compiler_run(struct anv_compiler *compiler, struct anv_pipeline *pipeline) program->_LinkedShaders[shader->Stage] = shader; } } else { - for (unsigned i = 0; i < VK_NUM_SHADER_STAGE; i++) { + for (unsigned i = 0; i < VK_SHADER_STAGE_NUM; i++) { if (pipeline->shaders[i]) anv_compile_shader_glsl(compiler, program, pipeline, i); } @@ -1157,7 +1157,7 @@ anv_compiler_run(struct anv_compiler *compiler, struct anv_pipeline *pipeline) void anv_compiler_free(struct anv_pipeline *pipeline) { - for (uint32_t stage = 0; stage < VK_NUM_SHADER_STAGE; stage++) { + for (uint32_t stage = 0; stage < VK_SHADER_STAGE_NUM; stage++) { if (pipeline->prog_data[stage]) { free(pipeline->prog_data[stage]->map_entries); ralloc_free(pipeline->prog_data[stage]->param); diff --git a/src/vulkan/device.c b/src/vulkan/device.c index 64ef36a3041..35eaad21774 100644 --- a/src/vulkan/device.c +++ b/src/vulkan/device.c @@ -1635,8 +1635,8 @@ VkResult anv_CreateDescriptorSetLayout( assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO); - uint32_t sampler_count[VK_NUM_SHADER_STAGE] = { 0, }; - uint32_t surface_count[VK_NUM_SHADER_STAGE] = { 0, }; + uint32_t sampler_count[VK_SHADER_STAGE_NUM] = { 0, }; + uint32_t surface_count[VK_SHADER_STAGE_NUM] = { 0, }; uint32_t num_dynamic_buffers = 0; uint32_t count = 0; uint32_t stages = 0; @@ -1685,7 +1685,7 @@ VkResult anv_CreateDescriptorSetLayout( uint32_t sampler_total = 0; uint32_t surface_total = 0; - for (uint32_t s = 0; s < VK_NUM_SHADER_STAGE; s++) { + for (uint32_t s = 0; s < VK_SHADER_STAGE_NUM; s++) { sampler_total += sampler_count[s]; surface_total += surface_count[s]; } @@ -1702,9 +1702,9 @@ VkResult anv_CreateDescriptorSetLayout( set_layout->shader_stages = stages; struct anv_descriptor_slot *p = set_layout->entries; - struct anv_descriptor_slot *sampler[VK_NUM_SHADER_STAGE]; - struct anv_descriptor_slot *surface[VK_NUM_SHADER_STAGE]; - for (uint32_t s = 0; s < VK_NUM_SHADER_STAGE; s++) { + struct anv_descriptor_slot *sampler[VK_SHADER_STAGE_NUM]; + struct anv_descriptor_slot *surface[VK_SHADER_STAGE_NUM]; + for (uint32_t s = 0; s < VK_SHADER_STAGE_NUM; s++) { set_layout->stage[s].surface_count = surface_count[s]; set_layout->stage[s].surface_start = surface[s] = p; p += surface_count[s]; diff --git a/src/vulkan/pipeline.c b/src/vulkan/pipeline.c index f574038f83f..cd4294bfa08 100644 --- a/src/vulkan/pipeline.c +++ b/src/vulkan/pipeline.c @@ -833,10 +833,10 @@ VkResult anv_CreatePipelineLayout( layout->num_sets = pCreateInfo->descriptorSetCount; - uint32_t surface_start[VK_NUM_SHADER_STAGE] = { 0, }; - uint32_t sampler_start[VK_NUM_SHADER_STAGE] = { 0, }; + uint32_t surface_start[VK_SHADER_STAGE_NUM] = { 0, }; + uint32_t sampler_start[VK_SHADER_STAGE_NUM] = { 0, }; - for (uint32_t s = 0; s < VK_NUM_SHADER_STAGE; s++) { + for (uint32_t s = 0; s < VK_SHADER_STAGE_NUM; s++) { layout->stage[s].surface_count = 0; layout->stage[s].sampler_count = 0; } @@ -846,7 +846,7 @@ VkResult anv_CreatePipelineLayout( (struct anv_descriptor_set_layout *) pCreateInfo->pSetLayouts[i]; layout->set[i].layout = set_layout; - for (uint32_t s = 0; s < VK_NUM_SHADER_STAGE; s++) { + for (uint32_t s = 0; s < VK_SHADER_STAGE_NUM; s++) { layout->set[i].surface_start[s] = surface_start[s]; surface_start[s] += set_layout->stage[s].surface_count; layout->set[i].sampler_start[s] = sampler_start[s]; diff --git a/src/vulkan/private.h b/src/vulkan/private.h index 0f5986b8b8a..a0ccb903224 100644 --- a/src/vulkan/private.h +++ b/src/vulkan/private.h @@ -592,7 +592,7 @@ struct anv_descriptor_set_layout { struct anv_descriptor_slot *surface_start; uint32_t sampler_count; struct anv_descriptor_slot *sampler_start; - } stage[VK_NUM_SHADER_STAGE]; + } stage[VK_SHADER_STAGE_NUM]; uint32_t count; uint32_t num_dynamic_buffers; @@ -616,8 +616,8 @@ struct anv_descriptor_set { struct anv_pipeline_layout { struct { struct anv_descriptor_set_layout *layout; - uint32_t surface_start[VK_NUM_SHADER_STAGE]; - uint32_t sampler_start[VK_NUM_SHADER_STAGE]; + uint32_t surface_start[VK_SHADER_STAGE_NUM]; + uint32_t sampler_start[VK_SHADER_STAGE_NUM]; } set[MAX_SETS]; uint32_t num_sets; @@ -625,7 +625,7 @@ struct anv_pipeline_layout { struct { uint32_t surface_count; uint32_t sampler_count; - } stage[VK_NUM_SHADER_STAGE]; + } stage[VK_SHADER_STAGE_NUM]; }; struct anv_buffer { @@ -712,7 +712,7 @@ struct anv_pipeline { struct anv_device * device; struct anv_batch batch; uint32_t batch_data[256]; - struct anv_shader * shaders[VK_NUM_SHADER_STAGE]; + struct anv_shader * shaders[VK_SHADER_STAGE_NUM]; struct anv_pipeline_layout * layout; bool use_repclear; @@ -720,8 +720,8 @@ struct anv_pipeline { struct brw_wm_prog_data wm_prog_data; struct brw_gs_prog_data gs_prog_data; struct brw_cs_prog_data cs_prog_data; - struct brw_stage_prog_data * prog_data[VK_NUM_SHADER_STAGE]; - uint32_t scratch_start[VK_NUM_SHADER_STAGE]; + struct brw_stage_prog_data * prog_data[VK_SHADER_STAGE_NUM]; + uint32_t scratch_start[VK_SHADER_STAGE_NUM]; uint32_t total_scratch; struct { uint32_t vs_start;