diff options
author | Timothy Arceri <[email protected]> | 2016-10-13 11:41:23 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2016-10-26 14:29:36 +1100 |
commit | e1af20f18a86f52a9640faf2d4ff8a71b0a4fa9b (patch) | |
tree | 32b4e9dbc9c03aa7733e1e32721d92c3c54571e0 /src/compiler/spirv | |
parent | 094fe3a9591ce200162d955635eee577c13f9324 (diff) |
nir/i965/anv/radv/gallium: make shader info a pointer
When restoring something from shader cache we won't have and don't
want to create a nir_shader this change detaches the two.
There are other advantages such as being able to reuse the
shader info populated by GLSL IR.
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler/spirv')
-rw-r--r-- | src/compiler/spirv/spirv_to_nir.c | 34 | ||||
-rw-r--r-- | src/compiler/spirv/vtn_variables.c | 14 |
2 files changed, 24 insertions, 24 deletions
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index de2cebc3f2d..9c5d3319b5c 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -972,9 +972,9 @@ handle_workgroup_size_decoration_cb(struct vtn_builder *b, assert(val->const_type == glsl_vector_type(GLSL_TYPE_UINT, 3)); - b->shader->info.cs.local_size[0] = val->constant->value.u[0]; - b->shader->info.cs.local_size[1] = val->constant->value.u[1]; - b->shader->info.cs.local_size[2] = val->constant->value.u[2]; + b->shader->info->cs.local_size[0] = val->constant->value.u[0]; + b->shader->info->cs.local_size[1] = val->constant->value.u[1]; + b->shader->info->cs.local_size[2] = val->constant->value.u[2]; } static void @@ -2560,43 +2560,43 @@ vtn_handle_execution_mode(struct vtn_builder *b, struct vtn_value *entry_point, case SpvExecutionModeEarlyFragmentTests: assert(b->shader->stage == MESA_SHADER_FRAGMENT); - b->shader->info.fs.early_fragment_tests = true; + b->shader->info->fs.early_fragment_tests = true; break; case SpvExecutionModeInvocations: assert(b->shader->stage == MESA_SHADER_GEOMETRY); - b->shader->info.gs.invocations = MAX2(1, mode->literals[0]); + b->shader->info->gs.invocations = MAX2(1, mode->literals[0]); break; case SpvExecutionModeDepthReplacing: assert(b->shader->stage == MESA_SHADER_FRAGMENT); - b->shader->info.fs.depth_layout = FRAG_DEPTH_LAYOUT_ANY; + b->shader->info->fs.depth_layout = FRAG_DEPTH_LAYOUT_ANY; break; case SpvExecutionModeDepthGreater: assert(b->shader->stage == MESA_SHADER_FRAGMENT); - b->shader->info.fs.depth_layout = FRAG_DEPTH_LAYOUT_GREATER; + b->shader->info->fs.depth_layout = FRAG_DEPTH_LAYOUT_GREATER; break; case SpvExecutionModeDepthLess: assert(b->shader->stage == MESA_SHADER_FRAGMENT); - b->shader->info.fs.depth_layout = FRAG_DEPTH_LAYOUT_LESS; + b->shader->info->fs.depth_layout = FRAG_DEPTH_LAYOUT_LESS; break; case SpvExecutionModeDepthUnchanged: assert(b->shader->stage == MESA_SHADER_FRAGMENT); - b->shader->info.fs.depth_layout = FRAG_DEPTH_LAYOUT_UNCHANGED; + b->shader->info->fs.depth_layout = FRAG_DEPTH_LAYOUT_UNCHANGED; break; case SpvExecutionModeLocalSize: assert(b->shader->stage == MESA_SHADER_COMPUTE); - b->shader->info.cs.local_size[0] = mode->literals[0]; - b->shader->info.cs.local_size[1] = mode->literals[1]; - b->shader->info.cs.local_size[2] = mode->literals[2]; + b->shader->info->cs.local_size[0] = mode->literals[0]; + b->shader->info->cs.local_size[1] = mode->literals[1]; + b->shader->info->cs.local_size[2] = mode->literals[2]; break; case SpvExecutionModeLocalSizeHint: break; /* Nothing to do with this */ case SpvExecutionModeOutputVertices: assert(b->shader->stage == MESA_SHADER_GEOMETRY); - b->shader->info.gs.vertices_out = mode->literals[0]; + b->shader->info->gs.vertices_out = mode->literals[0]; break; case SpvExecutionModeInputPoints: @@ -2607,7 +2607,7 @@ vtn_handle_execution_mode(struct vtn_builder *b, struct vtn_value *entry_point, case SpvExecutionModeQuads: case SpvExecutionModeIsolines: if (b->shader->stage == MESA_SHADER_GEOMETRY) { - b->shader->info.gs.vertices_in = + b->shader->info->gs.vertices_in = vertices_in_from_spv_execution_mode(mode->exec_mode); } else { assert(!"Tesselation shaders not yet supported"); @@ -2618,7 +2618,7 @@ vtn_handle_execution_mode(struct vtn_builder *b, struct vtn_value *entry_point, case SpvExecutionModeOutputLineStrip: case SpvExecutionModeOutputTriangleStrip: assert(b->shader->stage == MESA_SHADER_GEOMETRY); - b->shader->info.gs.output_primitive = + b->shader->info->gs.output_primitive = gl_primitive_from_spv_execution_mode(mode->exec_mode); break; @@ -2995,10 +2995,10 @@ spirv_to_nir(const uint32_t *words, size_t word_count, return NULL; } - b->shader = nir_shader_create(NULL, stage, options); + b->shader = nir_shader_create(NULL, stage, options, NULL); /* Set shader info defaults */ - b->shader->info.gs.invocations = 1; + b->shader->info->gs.invocations = 1; /* Parse execution modes */ vtn_foreach_execution_mode(b, b->entry_point, diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index 634058c0e06..c9744c4513d 100644 --- a/src/compiler/spirv/vtn_variables.c +++ b/src/compiler/spirv/vtn_variables.c @@ -933,9 +933,9 @@ apply_var_decoration(struct vtn_builder *b, nir_variable *nir_var, nir_var->data.read_only = true; nir_constant *c = rzalloc(nir_var, nir_constant); - c->value.u[0] = b->shader->info.cs.local_size[0]; - c->value.u[1] = b->shader->info.cs.local_size[1]; - c->value.u[2] = b->shader->info.cs.local_size[2]; + c->value.u[0] = b->shader->info->cs.local_size[0]; + c->value.u[1] = b->shader->info->cs.local_size[1]; + c->value.u[2] = b->shader->info->cs.local_size[2]; nir_var->constant_initializer = c; break; } @@ -1175,18 +1175,18 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode, case SpvStorageClassUniformConstant: if (without_array->block) { var->mode = vtn_variable_mode_ubo; - b->shader->info.num_ubos++; + b->shader->info->num_ubos++; } else if (without_array->buffer_block) { var->mode = vtn_variable_mode_ssbo; - b->shader->info.num_ssbos++; + b->shader->info->num_ssbos++; } else if (glsl_type_is_image(without_array->type)) { var->mode = vtn_variable_mode_image; nir_mode = nir_var_uniform; - b->shader->info.num_images++; + b->shader->info->num_images++; } else if (glsl_type_is_sampler(without_array->type)) { var->mode = vtn_variable_mode_sampler; nir_mode = nir_var_uniform; - b->shader->info.num_textures++; + b->shader->info->num_textures++; } else { assert(!"Invalid uniform variable type"); } |