.push_const_addr_format = nir_address_format_logical,
.shared_addr_format = nir_address_format_32bit_offset,
};
- nir_function *entry_point = spirv_to_nir(spirv, module->size / 4,
- spec_entries, num_spec_entries,
- stage, entrypoint_name,
- &spirv_options, &nir_options);
- nir = entry_point->shader;
+ nir = spirv_to_nir(spirv, module->size / 4,
+ spec_entries, num_spec_entries,
+ stage, entrypoint_name,
+ &spirv_options, &nir_options);
assert(nir->info.stage == stage);
nir_validate_shader(nir, "after spirv_to_nir");
struct nir_spirv_specialization *spec, unsigned num_spec,
gl_shader_stage stage, const char *entry_point_name);
-nir_function *spirv_to_nir(const uint32_t *words, size_t word_count,
- struct nir_spirv_specialization *specializations,
- unsigned num_specializations,
- gl_shader_stage stage, const char *entry_point_name,
- const struct spirv_to_nir_options *options,
- const nir_shader_compiler_options *nir_options);
+nir_shader *spirv_to_nir(const uint32_t *words, size_t word_count,
+ struct nir_spirv_specialization *specializations,
+ unsigned num_specializations,
+ gl_shader_stage stage, const char *entry_point_name,
+ const struct spirv_to_nir_options *options,
+ const nir_shader_compiler_options *nir_options);
#ifdef __cplusplus
}
struct spirv_to_nir_options spirv_opts = {};
- nir_function *func = spirv_to_nir(map, word_count, NULL, 0,
- MESA_SHADER_FRAGMENT, "main",
- &spirv_opts, NULL);
- nir_print_shader(func->shader, stderr);
+ nir_shader *nir = spirv_to_nir(map, word_count, NULL, 0,
+ MESA_SHADER_FRAGMENT, "main",
+ &spirv_opts, NULL);
+ nir_print_shader(nir, stderr);
return 0;
}
return main_entry_point;
}
-nir_function *
+nir_shader *
spirv_to_nir(const uint32_t *words, size_t word_count,
struct nir_spirv_specialization *spec, unsigned num_spec,
gl_shader_stage stage, const char *entry_point_name,
/* Unparent the shader from the vtn_builder before we delete the builder */
ralloc_steal(NULL, b->shader);
+ nir_shader *shader = b->shader;
ralloc_free(b);
- return entry_point;
+ return shader;
}
num_spec = spec_info->mapEntryCount;
}
- nir_function *entry_point =
+ nir_shader *nir =
spirv_to_nir(words, word_count, spec, num_spec, stage, entry_point_name,
&spirv_options, nir_options);
free(spec);
- assert(entry_point->shader->info.stage == stage);
- nir_validate_shader(entry_point->shader, "after spirv_to_nir");
+ assert(nir->info.stage == stage);
+ nir_validate_shader(nir, "after spirv_to_nir");
- return entry_point->shader;
+ return nir;
}
static void
.func = debug_func,
}
};
- nir_function *entry_point;
+ nir_shader *nir;
void *buf;
size_t size;
read_file(filename, &buf, &size);
- entry_point = spirv_to_nir(buf, size / 4,
+ nir = spirv_to_nir(buf, size / 4,
NULL, 0, /* spec_entries */
stage, entry,
&spirv_options,
ir3_get_compiler_options(compiler));
- nir_print_shader(entry_point->shader, stdout);
+ nir_print_shader(nir, stdout);
- return entry_point->shader;
+ return nir;
}
static void print_usage(void)
};
- nir_function *entry_point =
+ nir_shader *nir =
spirv_to_nir(spirv, module->size / 4,
spec_entries, num_spec_entries,
stage, entrypoint_name, &spirv_options, nir_options);
- nir_shader *nir = entry_point->shader;
assert(nir->info.stage == stage);
nir_validate_shader(nir, "after spirv_to_nir");
ralloc_steal(mem_ctx, nir);
gl_shader_stage stage,
const nir_shader_compiler_options *options)
{
- nir_shader *nir = NULL;
-
struct gl_linked_shader *linked_shader = prog->_LinkedShaders[stage];
assert (linked_shader);
.caps = ctx->Const.SpirVCapabilities
};
- nir_function *entry_point =
+ nir_shader *nir =
spirv_to_nir((const uint32_t *) &spirv_module->Binary[0],
spirv_module->Length / 4,
spec_entries, spirv_data->NumSpecializationConstants,
options);
free(spec_entries);
- assert (entry_point);
- nir = entry_point->shader;
+ assert(nir);
assert(nir->info.stage == stage);
nir->options = options;