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 <jason@jlekstrand.net>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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.
|
||||
*
|
||||
|
@@ -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));
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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,
|
||||
|
@@ -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");
|
||||
}
|
||||
|
Reference in New Issue
Block a user