* access plus one
*/
unsigned num_inputs, num_uniforms, num_outputs, num_shared;
+
+ /** Constant data associated with this shader.
+ *
+ * Constant data is loaded through load_constant intrinsics. See also
+ * nir_opt_large_constants.
+ */
+ void *constant_data;
+ unsigned constant_data_size;
} nir_shader;
static inline nir_function_impl *
ns->num_outputs = s->num_outputs;
ns->num_shared = s->num_shared;
+ ns->constant_data_size = s->constant_data_size;
+ if (s->constant_data_size > 0) {
+ ns->constant_data = ralloc_size(ns, s->constant_data_size);
+ memcpy(ns->constant_data, s->constant_data, s->constant_data_size);
+ }
+
free_clone_state(&state);
return ns;
load("shared", 1, [BASE], [CAN_ELIMINATE])
# src[] = { offset }. const_index[] = { base, range }
load("push_constant", 1, [BASE, RANGE], [CAN_ELIMINATE, CAN_REORDER])
+# src[] = { offset }. const_index[] = { base, range }
+load("constant", 1, [BASE, RANGE], [CAN_ELIMINATE, CAN_REORDER])
# Stores work the same way as loads, except now the first source is the value
# to store and the second (and possibly third) source specify where to store
write_function_impl(&ctx, fxn->impl);
}
+ blob_write_uint32(blob, nir->constant_data_size);
+ if (nir->constant_data_size > 0)
+ blob_write_bytes(blob, nir->constant_data, nir->constant_data_size);
+
*(uintptr_t *)(blob->data + idx_size_offset) = ctx.next_idx;
_mesa_hash_table_destroy(ctx.remap_table, NULL);
nir_foreach_function(fxn, ctx.nir)
fxn->impl = read_function_impl(&ctx, fxn);
+ ctx.nir->constant_data_size = blob_read_uint32(blob);
+ if (ctx.nir->constant_data_size > 0) {
+ ctx.nir->constant_data =
+ ralloc_size(ctx.nir, ctx.nir->constant_data_size);
+ blob_copy_bytes(blob, ctx.nir->constant_data,
+ ctx.nir->constant_data_size);
+ }
+
free(ctx.idx_table);
return ctx.nir;
sweep_function(nir, func);
}
+ ralloc_steal(nir, nir->constant_data);
+
/* Free everything we didn't steal back. */
ralloc_free(rubbish);
}