pan_pack(&prop, BIFROST_PROPERTIES, cfg) {
cfg.unknown = 0x800000; /* XXX */
- cfg.uniform_buffer_count = panfrost_ubo_count(ctx, st);
+ cfg.uniform_buffer_count = ss->ubo_count;
}
/* TODO: True compute shaders */
struct mali_midgard_properties_packed prop;
pan_pack(&prop, MIDGARD_PROPERTIES, cfg) {
- cfg.uniform_buffer_count = panfrost_ubo_count(ctx, st);
+ cfg.uniform_buffer_count = ss->ubo_count;
cfg.uniform_count = ss->uniform_count;
cfg.work_register_count = ss->work_reg_count;
cfg.writes_globals = ss->writes_global;
pan_pack(&prop, BIFROST_PROPERTIES, cfg) {
cfg.unknown = 0x950020; /* XXX */
- cfg.uniform_buffer_count = panfrost_ubo_count(ctx, PIPE_SHADER_FRAGMENT);
+ cfg.uniform_buffer_count = fs->ubo_count;
cfg.early_z_enable = !fs->can_discard && !fs->writes_depth && no_blend;
}
has_blend_shader |= blend[c].is_shader;
pan_pack(&prop, MIDGARD_PROPERTIES, cfg) {
- cfg.uniform_buffer_count = panfrost_ubo_count(ctx, PIPE_SHADER_FRAGMENT);
+ cfg.uniform_buffer_count = fs->ubo_count;
cfg.uniform_count = fs->uniform_count;
cfg.work_register_count = fs->work_reg_count;
cfg.writes_globals = fs->writes_global;
}
/* Next up, attach UBOs. UBO #0 is the uniforms we just
- * uploaded */
+ * uploaded, so it's always included. The count is the highest UBO
+ * addressable -- gaps are included. */
- unsigned ubo_count = panfrost_ubo_count(ctx, stage);
- assert(ubo_count >= 1);
+ unsigned ubo_count = 32 - __builtin_clz(buf->enabled_mask | 1);
size_t sz = MALI_UNIFORM_BUFFER_LENGTH * ubo_count;
struct panfrost_transfer ubos =
return vs->writes_point_size && ctx->active_prim == PIPE_PRIM_POINTS;
}
-/* Compute number of UBOs active (more specifically, compute the highest UBO
- * number addressable -- if there are gaps, include them in the count anyway).
- * We always include UBO #0 in the count, since we *need* uniforms enabled for
- * sysvals. */
-
-unsigned
-panfrost_ubo_count(struct panfrost_context *ctx, enum pipe_shader_type stage)
-{
- unsigned mask = ctx->constant_buffer[stage].enabled_mask | 1;
- return 32 - __builtin_clz(mask);
-}
-
/* The entire frame is in memory -- send it off to the kernel! */
void
/* For Bifrost - output type for each RT */
enum bifrost_shader_type blend_types[BIFROST_MAX_RENDER_TARGET_COUNT];
- unsigned attribute_count, varying_count;
+ unsigned attribute_count, varying_count, ubo_count;
enum mali_format varyings[PIPE_MAX_ATTRIBS];
gl_varying_slot varyings_loc[PIPE_MAX_ATTRIBS];
struct pipe_stream_output_info stream_output;
struct panfrost_shader_state *state,
uint64_t *outputs_written);
-unsigned
-panfrost_ubo_count(struct panfrost_context *ctx, enum pipe_shader_type stage);
-
void
panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so,
struct pipe_context *pctx,