uint32_t *push_constants,
bool compute)
{
- if (pipeline->shared_consts.dwords > 0) {
+ if (pipeline->program.shared_consts.dwords > 0) {
/* Offset and num_units for shared consts are in units of dwords. */
- unsigned num_units = pipeline->shared_consts.dwords;
- unsigned offset = pipeline->shared_consts.lo;
+ unsigned num_units = pipeline->program.shared_consts.dwords;
+ unsigned offset = pipeline->program.shared_consts.lo;
enum a6xx_state_type st = compute ? ST6_UBO : ST6_CONSTANTS;
uint32_t cp_load_state = compute ? CP_LOAD_STATE6_FRAG : CP_LOAD_STATE6;
{
uint32_t dwords = 0;
- if (pipeline->shared_consts.dwords > 0) {
- dwords += pipeline->shared_consts.dwords + 4;
+ if (pipeline->program.shared_consts.dwords > 0) {
+ dwords += pipeline->program.shared_consts.dwords + 4;
}
if (compute) {
struct tu_cs cs;
tu_cs_begin_sub_stream(&cmd->sub_cs, dwords, &cs);
- if (pipeline->shared_consts.dwords > 0) {
+ if (pipeline->program.shared_consts.dwords > 0) {
tu6_emit_shared_consts(&cs, pipeline, cmd->push_constants, compute);
for (uint32_t i = 0; i < ARRAY_SIZE(pipeline->program.link); i++) {
must_compile = true;
}
- if (tu6_shared_constants_enable(&builder->layout, builder->device->compiler)) {
- pipeline->shared_consts = (struct tu_push_constant_range) {
- .lo = 0,
- .dwords = builder->layout.push_constant_size / 4,
- };
- }
-
/* Forward declare everything due to the goto usage */
nir_shader *nir[ARRAY_SIZE(stage_infos)] = { NULL };
struct tu_shader *shaders[ARRAY_SIZE(stage_infos)] = { NULL };
tu_pipeline_to_graphics_lib(pipeline)->state |= library->state;
if (library->state &
- VK_GRAPHICS_PIPELINE_LIBRARY_VERTEX_INPUT_INTERFACE_BIT_EXT) {
- pipeline->shared_consts = library->base.shared_consts;
- }
-
- if (library->state &
- VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_SHADER_BIT_EXT) {
- pipeline->ds = library->base.ds;
- pipeline->lrz.lrz_status |= library->base.lrz.lrz_status;
- pipeline->shared_consts = library->base.shared_consts;
- }
-
- if (library->state &
VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_OUTPUT_INTERFACE_BIT_EXT) {
pipeline->output = library->base.output;
pipeline->lrz.lrz_status |= library->base.lrz.lrz_status;
tu_pipeline_set_linkage(&pipeline->program.link[i],
&pipeline->shaders[i]->const_state,
variants[i]);
+
+ if (pipeline->shaders[i]->shared_consts.dwords != 0) {
+ pipeline->program.shared_consts =
+ pipeline->shaders[i]->shared_consts;
+ }
}
const struct ir3_shader_variant *vs = variants[MESA_SHADER_VERTEX];
VK_PIPELINE_CREATION_FEEDBACK_APPLICATION_PIPELINE_CACHE_HIT_BIT;
}
- if (tu6_shared_constants_enable(layout, dev->compiler)) {
- pipeline->base.shared_consts = (struct tu_push_constant_range) {
- .lo = 0,
- .dwords = layout->push_constant_size / 4,
- };
- }
-
char *nir_initial_disasm = NULL;
if (!shader) {
creation_feedback->pPipelineStageCreationFeedbacks[0] = pipeline_feedback;
}
+ pipeline->base.program.shared_consts = shader->shared_consts;
+
pipeline->base.active_desc_sets = shader->active_desc_sets;
v = shader->variant;
/* draw states for the pipeline */
struct tu_draw_state load_state;
- struct tu_push_constant_range shared_consts;
-
struct tu_shader *shaders[MESA_SHADER_STAGES];
struct
uint32_t hs_param_dwords;
+ struct tu_push_constant_range shared_consts;
+
struct tu_program_descriptor_linkage link[MESA_SHADER_STAGES];
bool per_view_viewport;
container_of(object, struct tu_shader, base);
blob_write_bytes(blob, &shader->const_state, sizeof(shader->const_state));
+ blob_write_bytes(blob, &shader->shared_consts, sizeof(shader->shared_consts));
blob_write_uint32(blob, shader->view_mask);
blob_write_uint8(blob, shader->active_desc_sets);
return NULL;
blob_copy_bytes(blob, &shader->const_state, sizeof(shader->const_state));
+ blob_copy_bytes(blob, &shader->shared_consts, sizeof(shader->shared_consts));
shader->view_mask = blob_read_uint32(blob);
shader->active_desc_sets = blob_read_uint8(blob);
ir3_finalize_nir(dev->compiler, nir);
bool shared_consts_enable = tu6_shared_constants_enable(layout, dev->compiler);
- if (shared_consts_enable)
+ if (shared_consts_enable) {
assert(!shader->const_state.push_consts.dwords);
+ shader->shared_consts = (struct tu_push_constant_range) {
+ .lo = 0,
+ .dwords = layout->push_constant_size / 4,
+ };
+ }
const struct ir3_shader_options options = {
.reserved_user_consts = reserved_consts_vec4,
uint32_t view_mask;
uint8_t active_desc_sets;
+ /* This is the range of shared consts used by all shaders. It must be the
+ * same between shaders.
+ */
+ struct tu_push_constant_range shared_consts;
+
union {
struct {
unsigned patch_type;