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.
This commit is contained in:
Jason Ekstrand 2015-07-06 16:43:28 -07:00
parent d9176f2ec7
commit 8c5e48f307
5 changed files with 26 additions and 24 deletions

View File

@ -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 {

View File

@ -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);

View File

@ -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];

View File

@ -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];

View File

@ -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;