freedreno/ir3: move ubo_state into const_state
As with const_state, this will also need to move into the variant. To simplify that, just move it into the const_state itself, since after all it is related. Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5508>
This commit is contained in:
@@ -1461,7 +1461,7 @@ emit_intrinsic(struct ir3_context *ctx, nir_intrinsic_instr *intr)
|
||||
* addr reg value can be:
|
||||
*/
|
||||
ctx->so->constlen = MAX2(ctx->so->constlen,
|
||||
ctx->so->shader->ubo_state.size / 16);
|
||||
const_state->ubo_state.size / 16);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -479,8 +479,8 @@ ir3_setup_const_state(struct ir3_shader *shader, nir_shader *nir,
|
||||
/* num_driver_params is scalar, align to vec4: */
|
||||
const_state->num_driver_params = align(const_state->num_driver_params, 4);
|
||||
|
||||
debug_assert((shader->ubo_state.size % 16) == 0);
|
||||
unsigned constoff = shader->ubo_state.size / 16;
|
||||
debug_assert((const_state->ubo_state.size % 16) == 0);
|
||||
unsigned constoff = const_state->ubo_state.size / 16;
|
||||
unsigned ptrsz = ir3_pointer_size(compiler);
|
||||
|
||||
if (const_state->num_ubos > 0) {
|
||||
|
||||
@@ -304,7 +304,7 @@ instr_is_load_ubo(nir_instr *instr)
|
||||
bool
|
||||
ir3_nir_analyze_ubo_ranges(nir_shader *nir, struct ir3_shader *shader)
|
||||
{
|
||||
struct ir3_ubo_analysis_state *state = &shader->ubo_state;
|
||||
struct ir3_ubo_analysis_state *state = &shader->const_state.ubo_state;
|
||||
|
||||
memset(state, 0, sizeof(*state));
|
||||
for (int i = 0; i < IR3_MAX_UBO_PUSH_RANGES; i++) {
|
||||
|
||||
@@ -73,6 +73,22 @@ enum ir3_driver_param {
|
||||
#define IR3_MAX_UBO_PUSH_RANGES 32
|
||||
|
||||
|
||||
struct ir3_ubo_range {
|
||||
uint32_t offset; /* start offset to push in the const register file */
|
||||
uint32_t block; /* Which constant block */
|
||||
uint32_t start, end; /* range of block that's actually used */
|
||||
uint16_t bindless_base; /* For bindless, which base register is used */
|
||||
bool bindless;
|
||||
};
|
||||
|
||||
struct ir3_ubo_analysis_state {
|
||||
struct ir3_ubo_range range[IR3_MAX_UBO_PUSH_RANGES];
|
||||
uint32_t num_enabled;
|
||||
uint32_t size;
|
||||
uint32_t lower_count;
|
||||
uint32_t cmdstream_size; /* for per-gen backend to stash required cmdstream size */
|
||||
};
|
||||
|
||||
/**
|
||||
* Describes the layout of shader consts. This includes:
|
||||
* + User consts + driver lowered UBO ranges
|
||||
@@ -157,6 +173,9 @@ struct ir3_const_state {
|
||||
struct {
|
||||
uint32_t val[4];
|
||||
} *immediates;
|
||||
|
||||
/* State of ubo access lowered to push consts: */
|
||||
struct ir3_ubo_analysis_state ubo_state;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -588,22 +607,6 @@ ir3_shader_stage(struct ir3_shader_variant *v)
|
||||
}
|
||||
}
|
||||
|
||||
struct ir3_ubo_range {
|
||||
uint32_t offset; /* start offset to push in the const register file */
|
||||
uint32_t block; /* Which constant block */
|
||||
uint32_t start, end; /* range of block that's actually used */
|
||||
uint16_t bindless_base; /* For bindless, which base register is used */
|
||||
bool bindless;
|
||||
};
|
||||
|
||||
struct ir3_ubo_analysis_state {
|
||||
struct ir3_ubo_range range[IR3_MAX_UBO_PUSH_RANGES];
|
||||
uint32_t num_enabled;
|
||||
uint32_t size;
|
||||
uint32_t lower_count;
|
||||
uint32_t cmdstream_size; /* for per-gen backend to stash required cmdstream size */
|
||||
};
|
||||
|
||||
|
||||
struct ir3_shader {
|
||||
gl_shader_stage type;
|
||||
@@ -619,8 +622,6 @@ struct ir3_shader {
|
||||
|
||||
struct ir3_compiler *compiler;
|
||||
|
||||
struct ir3_ubo_analysis_state ubo_state;
|
||||
|
||||
/* Number of UBOs loaded by LDC, as opposed to LDG through pointers in
|
||||
* ubo_state.
|
||||
*/
|
||||
|
||||
@@ -2912,7 +2912,7 @@ tu6_emit_user_consts(struct tu_cs *cs, const struct tu_pipeline *pipeline,
|
||||
{
|
||||
const struct tu_program_descriptor_linkage *link =
|
||||
&pipeline->program.link[type];
|
||||
const struct ir3_ubo_analysis_state *state = &link->ubo_state;
|
||||
const struct ir3_ubo_analysis_state *state = &link->const_state.ubo_state;
|
||||
|
||||
if (link->push_consts.count > 0) {
|
||||
unsigned num_units = link->push_consts.count;
|
||||
|
||||
@@ -1807,7 +1807,6 @@ tu_pipeline_set_linkage(struct tu_program_descriptor_linkage *link,
|
||||
struct tu_shader *shader,
|
||||
struct ir3_shader_variant *v)
|
||||
{
|
||||
link->ubo_state = v->shader->ubo_state;
|
||||
link->const_state = *ir3_const_state(v);
|
||||
link->constlen = v->constlen;
|
||||
link->push_consts = shader->push_consts;
|
||||
|
||||
@@ -1045,7 +1045,6 @@ tu_shader_destroy(struct tu_device *dev,
|
||||
|
||||
struct tu_program_descriptor_linkage
|
||||
{
|
||||
struct ir3_ubo_analysis_state ubo_state;
|
||||
struct ir3_const_state const_state;
|
||||
|
||||
uint32_t constlen;
|
||||
|
||||
@@ -280,7 +280,7 @@ fd6_emit_ubos(struct fd_context *ctx, const struct ir3_shader_variant *v,
|
||||
static unsigned
|
||||
user_consts_cmdstream_size(struct ir3_shader_variant *v)
|
||||
{
|
||||
struct ir3_ubo_analysis_state *ubo_state = &v->shader->ubo_state;
|
||||
struct ir3_ubo_analysis_state *ubo_state = &ir3_const_state(v)->ubo_state;
|
||||
|
||||
if (unlikely(!ubo_state->cmdstream_size)) {
|
||||
unsigned packets, size;
|
||||
|
||||
@@ -93,8 +93,8 @@ static inline void
|
||||
ir3_emit_user_consts(struct fd_screen *screen, const struct ir3_shader_variant *v,
|
||||
struct fd_ringbuffer *ring, struct fd_constbuf_stateobj *constbuf)
|
||||
{
|
||||
struct ir3_ubo_analysis_state *state;
|
||||
state = &v->shader->ubo_state;
|
||||
const struct ir3_const_state *const_state = ir3_const_state(v);
|
||||
const struct ir3_ubo_analysis_state *state = &const_state->ubo_state;
|
||||
|
||||
for (unsigned i = 0; i < state->num_enabled; i++) {
|
||||
assert(!state->range[i].bindless);
|
||||
|
||||
Reference in New Issue
Block a user