summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2016-10-13 11:41:23 +1100
committerTimothy Arceri <[email protected]>2016-10-26 14:29:36 +1100
commite1af20f18a86f52a9640faf2d4ff8a71b0a4fa9b (patch)
tree32b4e9dbc9c03aa7733e1e32721d92c3c54571e0 /src/compiler
parent094fe3a9591ce200162d955635eee577c13f9324 (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')
-rw-r--r--src/compiler/glsl/glsl_to_nir.cpp66
-rw-r--r--src/compiler/nir/nir.c6
-rw-r--r--src/compiler/nir/nir.h5
-rw-r--r--src/compiler/nir/nir_builder.h2
-rw-r--r--src/compiler/nir/nir_clone.c8
-rw-r--r--src/compiler/nir/nir_gather_info.c30
-rw-r--r--src/compiler/nir/nir_lower_bitmap.c2
-rw-r--r--src/compiler/nir/nir_lower_clip.c2
-rw-r--r--src/compiler/nir/nir_lower_gs_intrinsics.c3
-rw-r--r--src/compiler/nir/nir_lower_system_values.c12
-rw-r--r--src/compiler/nir/nir_print.c8
-rw-r--r--src/compiler/nir/nir_sweep.c6
-rw-r--r--src/compiler/spirv/spirv_to_nir.c34
-rw-r--r--src/compiler/spirv/vtn_variables.c14
14 files changed, 102 insertions, 96 deletions
diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index 18600c484f3..b5318928792 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -136,65 +136,65 @@ glsl_to_nir(const struct gl_shader_program *shader_prog,
{
struct gl_linked_shader *sh = shader_prog->_LinkedShaders[stage];
- nir_shader *shader = nir_shader_create(NULL, stage, options);
+ nir_shader *shader = nir_shader_create(NULL, stage, options, NULL);
nir_visitor v1(shader);
nir_function_visitor v2(&v1);
v2.run(sh->ir);
visit_exec_list(sh->ir, &v1);
- shader->info.name = ralloc_asprintf(shader, "GLSL%d", shader_prog->Name);
+ shader->info->name = ralloc_asprintf(shader, "GLSL%d", shader_prog->Name);
if (shader_prog->Label)
- shader->info.label = ralloc_strdup(shader, shader_prog->Label);
- shader->info.num_textures = util_last_bit(sh->Program->SamplersUsed);
- shader->info.num_ubos = sh->NumUniformBlocks;
- shader->info.num_abos = shader_prog->NumAtomicBuffers;
- shader->info.num_ssbos = sh->NumShaderStorageBlocks;
- shader->info.num_images = sh->NumImages;
- shader->info.inputs_read = sh->Program->InputsRead;
- shader->info.double_inputs_read = sh->Program->DoubleInputsRead;
- shader->info.outputs_written = sh->Program->OutputsWritten;
- shader->info.outputs_read = sh->Program->OutputsRead;
- shader->info.patch_inputs_read = sh->Program->PatchInputsRead;
- shader->info.patch_outputs_written = sh->Program->PatchOutputsWritten;
- shader->info.system_values_read = sh->Program->SystemValuesRead;
- shader->info.uses_texture_gather = sh->Program->UsesGather;
- shader->info.uses_clip_distance_out =
+ shader->info->label = ralloc_strdup(shader, shader_prog->Label);
+ shader->info->num_textures = util_last_bit(sh->Program->SamplersUsed);
+ shader->info->num_ubos = sh->NumUniformBlocks;
+ shader->info->num_abos = shader_prog->NumAtomicBuffers;
+ shader->info->num_ssbos = sh->NumShaderStorageBlocks;
+ shader->info->num_images = sh->NumImages;
+ shader->info->inputs_read = sh->Program->InputsRead;
+ shader->info->double_inputs_read = sh->Program->DoubleInputsRead;
+ shader->info->outputs_written = sh->Program->OutputsWritten;
+ shader->info->outputs_read = sh->Program->OutputsRead;
+ shader->info->patch_inputs_read = sh->Program->PatchInputsRead;
+ shader->info->patch_outputs_written = sh->Program->PatchOutputsWritten;
+ shader->info->system_values_read = sh->Program->SystemValuesRead;
+ shader->info->uses_texture_gather = sh->Program->UsesGather;
+ shader->info->uses_clip_distance_out =
sh->Program->ClipDistanceArraySize != 0;
- shader->info.separate_shader = shader_prog->SeparateShader;
- shader->info.has_transform_feedback_varyings =
+ shader->info->separate_shader = shader_prog->SeparateShader;
+ shader->info->has_transform_feedback_varyings =
shader_prog->TransformFeedback.NumVarying > 0;
switch (stage) {
case MESA_SHADER_TESS_CTRL:
- shader->info.tcs.vertices_out = sh->info.TessCtrl.VerticesOut;
+ shader->info->tcs.vertices_out = sh->info.TessCtrl.VerticesOut;
break;
case MESA_SHADER_GEOMETRY:
- shader->info.gs.vertices_in = shader_prog->Geom.VerticesIn;
- shader->info.gs.output_primitive = sh->info.Geom.OutputType;
- shader->info.gs.vertices_out = sh->info.Geom.VerticesOut;
- shader->info.gs.invocations = sh->info.Geom.Invocations;
- shader->info.gs.uses_end_primitive = shader_prog->Geom.UsesEndPrimitive;
- shader->info.gs.uses_streams = shader_prog->Geom.UsesStreams;
+ shader->info->gs.vertices_in = shader_prog->Geom.VerticesIn;
+ shader->info->gs.output_primitive = sh->info.Geom.OutputType;
+ shader->info->gs.vertices_out = sh->info.Geom.VerticesOut;
+ shader->info->gs.invocations = sh->info.Geom.Invocations;
+ shader->info->gs.uses_end_primitive = shader_prog->Geom.UsesEndPrimitive;
+ shader->info->gs.uses_streams = shader_prog->Geom.UsesStreams;
break;
case MESA_SHADER_FRAGMENT: {
struct gl_fragment_program *fp =
(struct gl_fragment_program *)sh->Program;
- shader->info.fs.uses_discard = fp->UsesKill;
- shader->info.fs.uses_sample_qualifier = fp->IsSample != 0;
- shader->info.fs.early_fragment_tests = sh->info.EarlyFragmentTests;
- shader->info.fs.depth_layout = fp->FragDepthLayout;
+ shader->info->fs.uses_discard = fp->UsesKill;
+ shader->info->fs.uses_sample_qualifier = fp->IsSample != 0;
+ shader->info->fs.early_fragment_tests = sh->info.EarlyFragmentTests;
+ shader->info->fs.depth_layout = fp->FragDepthLayout;
break;
}
case MESA_SHADER_COMPUTE: {
struct gl_compute_program *cp = (struct gl_compute_program *)sh->Program;
- shader->info.cs.local_size[0] = cp->LocalSize[0];
- shader->info.cs.local_size[1] = cp->LocalSize[1];
- shader->info.cs.local_size[2] = cp->LocalSize[2];
+ shader->info->cs.local_size[0] = cp->LocalSize[0];
+ shader->info->cs.local_size[1] = cp->LocalSize[1];
+ shader->info->cs.local_size[2] = cp->LocalSize[2];
break;
}
diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index 098e1b2759e..09aad57e87f 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -32,7 +32,8 @@
nir_shader *
nir_shader_create(void *mem_ctx,
gl_shader_stage stage,
- const nir_shader_compiler_options *options)
+ const nir_shader_compiler_options *options,
+ shader_info *si)
{
nir_shader *shader = ralloc(mem_ctx, nir_shader);
@@ -42,7 +43,8 @@ nir_shader_create(void *mem_ctx,
exec_list_make_empty(&shader->shared);
shader->options = options;
- memset(&shader->info, 0, sizeof(shader->info));
+
+ shader->info = si ? si : rzalloc(shader, shader_info);
exec_list_make_empty(&shader->functions);
exec_list_make_empty(&shader->registers);
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 04b0301367a..54302f82a9a 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -1805,7 +1805,7 @@ typedef struct nir_shader {
const struct nir_shader_compiler_options *options;
/** Various bits of compile-time information about a given shader */
- struct shader_info info;
+ struct shader_info *info;
/** list of global variables in the shader (nir_variable) */
struct exec_list globals;
@@ -1848,7 +1848,8 @@ nir_shader_get_entrypoint(nir_shader *shader)
nir_shader *nir_shader_create(void *mem_ctx,
gl_shader_stage stage,
- const nir_shader_compiler_options *options);
+ const nir_shader_compiler_options *options,
+ shader_info *si);
/** creates a register, including assigning it an index and adding it to the list */
nir_register *nir_global_reg_create(nir_shader *shader);
diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h
index 040f03ef9d3..0ee7d1a6f39 100644
--- a/src/compiler/nir/nir_builder.h
+++ b/src/compiler/nir/nir_builder.h
@@ -52,7 +52,7 @@ nir_builder_init_simple_shader(nir_builder *build, void *mem_ctx,
gl_shader_stage stage,
const nir_shader_compiler_options *options)
{
- build->shader = nir_shader_create(mem_ctx, stage, options);
+ build->shader = nir_shader_create(mem_ctx, stage, options, NULL);
nir_function *func = nir_function_create(build->shader, "main");
build->exact = false;
build->impl = nir_function_impl_create(func);
diff --git a/src/compiler/nir/nir_clone.c b/src/compiler/nir/nir_clone.c
index 0e397b03821..f23fabc7015 100644
--- a/src/compiler/nir/nir_clone.c
+++ b/src/compiler/nir/nir_clone.c
@@ -682,7 +682,7 @@ nir_shader_clone(void *mem_ctx, const nir_shader *s)
clone_state state;
init_clone_state(&state, true);
- nir_shader *ns = nir_shader_create(mem_ctx, s->stage, s->options);
+ nir_shader *ns = nir_shader_create(mem_ctx, s->stage, s->options, NULL);
state.ns = ns;
clone_var_list(&state, &ns->uniforms, &s->uniforms);
@@ -711,9 +711,9 @@ nir_shader_clone(void *mem_ctx, const nir_shader *s)
ns->reg_alloc = s->reg_alloc;
ns->info = s->info;
- ns->info.name = ralloc_strdup(ns, ns->info.name);
- if (ns->info.label)
- ns->info.label = ralloc_strdup(ns, ns->info.label);
+ ns->info->name = ralloc_strdup(ns, ns->info->name);
+ if (ns->info->label)
+ ns->info->label = ralloc_strdup(ns, ns->info->label);
ns->num_inputs = s->num_inputs;
ns->num_uniforms = s->num_uniforms;
diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c
index 2d6efd55a68..380140ad5ce 100644
--- a/src/compiler/nir/nir_gather_info.c
+++ b/src/compiler/nir/nir_gather_info.c
@@ -30,7 +30,7 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, nir_shader *shader)
case nir_intrinsic_discard:
case nir_intrinsic_discard_if:
assert(shader->stage == MESA_SHADER_FRAGMENT);
- shader->info.fs.uses_discard = true;
+ shader->info->fs.uses_discard = true;
break;
case nir_intrinsic_load_front_face:
@@ -47,14 +47,14 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, nir_shader *shader)
case nir_intrinsic_load_local_invocation_index:
case nir_intrinsic_load_work_group_id:
case nir_intrinsic_load_num_work_groups:
- shader->info.system_values_read |=
+ shader->info->system_values_read |=
(1 << nir_system_value_from_intrinsic(instr->intrinsic));
break;
case nir_intrinsic_end_primitive:
case nir_intrinsic_end_primitive_with_counter:
assert(shader->stage == MESA_SHADER_GEOMETRY);
- shader->info.gs.uses_end_primitive = 1;
+ shader->info->gs.uses_end_primitive = 1;
break;
default:
@@ -66,7 +66,7 @@ static void
gather_tex_info(nir_tex_instr *instr, nir_shader *shader)
{
if (instr->op == nir_texop_tg4)
- shader->info.uses_texture_gather = true;
+ shader->info->uses_texture_gather = true;
}
static void
@@ -127,26 +127,26 @@ nir_shader_gather_info(nir_shader *shader, nir_function_impl *entrypoint)
shader->stage == MESA_SHADER_COMPUTE);
bool uses_sample_qualifier = false;
- shader->info.inputs_read = 0;
+ shader->info->inputs_read = 0;
foreach_list_typed(nir_variable, var, node, &shader->inputs) {
- shader->info.inputs_read |= get_io_mask(var, shader->stage);
+ shader->info->inputs_read |= get_io_mask(var, shader->stage);
uses_sample_qualifier |= var->data.sample;
}
if (shader->stage == MESA_SHADER_FRAGMENT)
- shader->info.fs.uses_sample_qualifier = uses_sample_qualifier;
+ shader->info->fs.uses_sample_qualifier = uses_sample_qualifier;
/* TODO: Some day we may need to add stream support to NIR */
- shader->info.outputs_written = 0;
+ shader->info->outputs_written = 0;
foreach_list_typed(nir_variable, var, node, &shader->outputs)
- shader->info.outputs_written |= get_io_mask(var, shader->stage);
+ shader->info->outputs_written |= get_io_mask(var, shader->stage);
- shader->info.system_values_read = 0;
+ shader->info->system_values_read = 0;
foreach_list_typed(nir_variable, var, node, &shader->system_values)
- shader->info.system_values_read |= get_io_mask(var, shader->stage);
+ shader->info->system_values_read |= get_io_mask(var, shader->stage);
- shader->info.num_textures = 0;
- shader->info.num_images = 0;
+ shader->info->num_textures = 0;
+ shader->info->num_images = 0;
nir_foreach_variable(var, &shader->uniforms) {
const struct glsl_type *type = var->type;
unsigned count = 1;
@@ -156,9 +156,9 @@ nir_shader_gather_info(nir_shader *shader, nir_function_impl *entrypoint)
}
if (glsl_type_is_image(type)) {
- shader->info.num_images += count;
+ shader->info->num_images += count;
} else if (glsl_type_is_sampler(type)) {
- shader->info.num_textures += count;
+ shader->info->num_textures += count;
}
}
diff --git a/src/compiler/nir/nir_lower_bitmap.c b/src/compiler/nir/nir_lower_bitmap.c
index 216bedf5740..fefe53cbd81 100644
--- a/src/compiler/nir/nir_lower_bitmap.c
+++ b/src/compiler/nir/nir_lower_bitmap.c
@@ -108,7 +108,7 @@ lower_bitmap(nir_shader *shader, nir_builder *b,
discard->src[0] = nir_src_for_ssa(cond);
nir_builder_instr_insert(b, &discard->instr);
- shader->info.fs.uses_discard = true;
+ shader->info->fs.uses_discard = true;
}
static void
diff --git a/src/compiler/nir/nir_lower_clip.c b/src/compiler/nir/nir_lower_clip.c
index b74e6cca39f..62540ac11d9 100644
--- a/src/compiler/nir/nir_lower_clip.c
+++ b/src/compiler/nir/nir_lower_clip.c
@@ -287,7 +287,7 @@ lower_clip_fs(nir_function_impl *impl, unsigned ucp_enables,
discard->src[0] = nir_src_for_ssa(cond);
nir_builder_instr_insert(&b, &discard->instr);
- b.shader->info.fs.uses_discard = true;
+ b.shader->info->fs.uses_discard = true;
}
}
}
diff --git a/src/compiler/nir/nir_lower_gs_intrinsics.c b/src/compiler/nir/nir_lower_gs_intrinsics.c
index 9bbaf836843..a955e8b5dc7 100644
--- a/src/compiler/nir/nir_lower_gs_intrinsics.c
+++ b/src/compiler/nir/nir_lower_gs_intrinsics.c
@@ -76,7 +76,8 @@ rewrite_emit_vertex(nir_intrinsic_instr *intrin, struct state *state)
b->cursor = nir_before_instr(&intrin->instr);
nir_ssa_def *count = nir_load_var(b, state->vertex_count_var);
- nir_ssa_def *max_vertices = nir_imm_int(b, b->shader->info.gs.vertices_out);
+ nir_ssa_def *max_vertices =
+ nir_imm_int(b, b->shader->info->gs.vertices_out);
/* Create: if (vertex_count < max_vertices) and insert it.
*
diff --git a/src/compiler/nir/nir_lower_system_values.c b/src/compiler/nir/nir_lower_system_values.c
index 9747ac473d3..6ad5ad6940d 100644
--- a/src/compiler/nir/nir_lower_system_values.c
+++ b/src/compiler/nir/nir_lower_system_values.c
@@ -58,9 +58,9 @@ convert_block(nir_block *block, nir_builder *b)
*/
nir_const_value local_size;
- local_size.u32[0] = b->shader->info.cs.local_size[0];
- local_size.u32[1] = b->shader->info.cs.local_size[1];
- local_size.u32[2] = b->shader->info.cs.local_size[2];
+ local_size.u32[0] = b->shader->info->cs.local_size[0];
+ local_size.u32[1] = b->shader->info->cs.local_size[1];
+ local_size.u32[2] = b->shader->info->cs.local_size[2];
nir_ssa_def *group_id = nir_load_work_group_id(b);
nir_ssa_def *local_id = nir_load_local_invocation_id(b);
@@ -87,8 +87,10 @@ convert_block(nir_block *block, nir_builder *b)
*/
nir_ssa_def *local_id = nir_load_local_invocation_id(b);
- nir_ssa_def *size_x = nir_imm_int(b, b->shader->info.cs.local_size[0]);
- nir_ssa_def *size_y = nir_imm_int(b, b->shader->info.cs.local_size[1]);
+ nir_ssa_def *size_x =
+ nir_imm_int(b, b->shader->info->cs.local_size[0]);
+ nir_ssa_def *size_y =
+ nir_imm_int(b, b->shader->info->cs.local_size[1]);
sysval = nir_imul(b, nir_channel(b, local_id, 2),
nir_imul(b, size_x, size_y));
diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
index 35f64684d29..242bffba472 100644
--- a/src/compiler/nir/nir_print.c
+++ b/src/compiler/nir/nir_print.c
@@ -1143,11 +1143,11 @@ nir_print_shader_annotated(nir_shader *shader, FILE *fp,
fprintf(fp, "shader: %s\n", gl_shader_stage_name(shader->stage));
- if (shader->info.name)
- fprintf(fp, "name: %s\n", shader->info.name);
+ if (shader->info->name)
+ fprintf(fp, "name: %s\n", shader->info->name);
- if (shader->info.label)
- fprintf(fp, "label: %s\n", shader->info.label);
+ if (shader->info->label)
+ fprintf(fp, "label: %s\n", shader->info->label);
fprintf(fp, "inputs: %u\n", shader->num_inputs);
fprintf(fp, "outputs: %u\n", shader->num_outputs);
diff --git a/src/compiler/nir/nir_sweep.c b/src/compiler/nir/nir_sweep.c
index 0f1debce3ad..faf696d6dec 100644
--- a/src/compiler/nir/nir_sweep.c
+++ b/src/compiler/nir/nir_sweep.c
@@ -153,9 +153,9 @@ nir_sweep(nir_shader *nir)
/* First, move ownership of all the memory to a temporary context; assume dead. */
ralloc_adopt(rubbish, nir);
- ralloc_steal(nir, (char *)nir->info.name);
- if (nir->info.label)
- ralloc_steal(nir, (char *)nir->info.label);
+ ralloc_steal(nir, (char *)nir->info->name);
+ if (nir->info->label)
+ ralloc_steal(nir, (char *)nir->info->label);
/* Variables and registers are not dead. Steal them back. */
steal_list(nir, nir_variable, &nir->uniforms);
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");
}