words = vtn_foreach_instruction(b, words, word_end,
vtn_handle_preamble_instruction);
- if (b->entry_point == NULL) {
+ if (!options->create_library && b->entry_point == NULL) {
vtn_fail("Entry point not found for %s shader \"%s\"",
_mesa_shader_stage_to_string(stage), entry_point_name);
ralloc_free(b);
b->shader->info.gs.invocations = 1;
/* Parse execution modes. */
- vtn_foreach_execution_mode(b, b->entry_point,
- vtn_handle_execution_mode, NULL);
+ if (!options->create_library)
+ vtn_foreach_execution_mode(b, b->entry_point,
+ vtn_handle_execution_mode, NULL);
b->specializations = spec;
b->num_specializations = num_spec;
/* Parse execution modes that depend on IDs. Must happen after we have
* constants parsed.
*/
- vtn_foreach_execution_mode(b, b->entry_point,
- vtn_handle_execution_mode_id, NULL);
+ if (!options->create_library)
+ vtn_foreach_execution_mode(b, b->entry_point,
+ vtn_handle_execution_mode_id, NULL);
if (b->workgroup_size_builtin) {
vtn_assert(b->workgroup_size_builtin->type->type ==
vtn_build_cfg(b, words, word_end);
- assert(b->entry_point->value_type == vtn_value_type_function);
- b->entry_point->func->referenced = true;
+ if (!options->create_library) {
+ assert(b->entry_point->value_type == vtn_value_type_function);
+ b->entry_point->func->referenced = true;
+ }
bool progress;
do {
progress = false;
vtn_foreach_cf_node(node, &b->functions) {
struct vtn_function *func = vtn_cf_node_as_function(node);
- if (func->referenced && !func->emitted) {
+ if ((options->create_library || func->referenced) && !func->emitted) {
b->const_table = _mesa_pointer_hash_table_create(b);
vtn_function_emit(b, func, vtn_handle_body_instruction);
}
} while (progress);
- vtn_assert(b->entry_point->value_type == vtn_value_type_function);
- nir_function *entry_point = b->entry_point->func->impl->function;
- vtn_assert(entry_point);
+ if (!options->create_library) {
+ vtn_assert(b->entry_point->value_type == vtn_value_type_function);
+ nir_function *entry_point = b->entry_point->func->impl->function;
+ vtn_assert(entry_point);
+
+ /* post process entry_points with input params */
+ if (entry_point->num_params && b->shader->info.stage == MESA_SHADER_KERNEL)
+ entry_point = vtn_emit_kernel_entry_point_wrapper(b, entry_point);
- /* post process entry_points with input params */
- if (entry_point->num_params && b->shader->info.stage == MESA_SHADER_KERNEL)
- entry_point = vtn_emit_kernel_entry_point_wrapper(b, entry_point);
+ entry_point->is_entrypoint = true;
+ }
/* structurize the CFG */
nir_lower_goto_ifs(b->shader);
- entry_point->is_entrypoint = true;
-
/* When multiple shader stages exist in the same SPIR-V module, we
* generate input and output variables for every stage, in the same
* NIR program. These dead variables can be invalid NIR. For example,