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 {
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;
}
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);
}
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);
}
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);
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;
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];
}
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];
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;
}
(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];
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;
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;
struct {
uint32_t surface_count;
uint32_t sampler_count;
- } stage[VK_NUM_SHADER_STAGE];
+ } stage[VK_SHADER_STAGE_NUM];
};
struct anv_buffer {
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;
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;