panfrost: Remove postfix parameter from UBO upload
Need to signal push constants via a side channel. I tried to disentangle this code, but there are a number of stacked issues here: * We need to upload sysvals. Currently we prefix UBO #0 with sysvals, but this requires a memcpy() of the entire contents of UBO #0. We could create a synthetic UBO instead with sysvals at the end. * We want to push uniforms/sysvals. Currently we push UBO #0 as much as we can, which pushes sysvals automatically by point 1. * We want to optimize out f2f16(uniform). We don't currently handle this. * We want to optimize out uniform-on-uniform/constant operations. Mesa doesn't currently have good support for this. The real solution will look something like: * Create a separate UBO for sysvals. * Let the compiler allocate push constant space as it sees fit ("copy word 12:15 of UBO 1 to word 2:3 of push constant space, as fp16"). * Somehow handle uniform folding when NIR gains support. For now, let's not block the depostfixening. Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6476>
This commit is contained in:
parent
1357eec801
commit
8b5f9fc08a
|
@ -975,16 +975,16 @@ panfrost_map_constant_buffer_cpu(struct panfrost_constant_buffer *buf,
|
|||
unreachable("No constant buffer");
|
||||
}
|
||||
|
||||
void
|
||||
mali_ptr
|
||||
panfrost_emit_const_buf(struct panfrost_batch *batch,
|
||||
enum pipe_shader_type stage,
|
||||
struct mali_vertex_tiler_postfix *postfix)
|
||||
mali_ptr *push_constants)
|
||||
{
|
||||
struct panfrost_context *ctx = batch->ctx;
|
||||
struct panfrost_shader_variants *all = ctx->shader[stage];
|
||||
|
||||
if (!all)
|
||||
return;
|
||||
return 0;
|
||||
|
||||
struct panfrost_constant_buffer *buf = &ctx->constant_buffer[stage];
|
||||
|
||||
|
@ -1052,10 +1052,10 @@ panfrost_emit_const_buf(struct panfrost_batch *batch,
|
|||
}
|
||||
}
|
||||
|
||||
postfix->uniforms = transfer.gpu;
|
||||
postfix->uniform_buffers = ubos.gpu;
|
||||
*push_constants = transfer.gpu;
|
||||
|
||||
buf->dirty_mask = 0;
|
||||
return ubos.gpu;
|
||||
}
|
||||
|
||||
mali_ptr
|
||||
|
|
|
@ -60,10 +60,10 @@ panfrost_emit_frag_shader_meta(struct panfrost_batch *batch);
|
|||
mali_ptr
|
||||
panfrost_emit_viewport(struct panfrost_batch *batch);
|
||||
|
||||
void
|
||||
mali_ptr
|
||||
panfrost_emit_const_buf(struct panfrost_batch *batch,
|
||||
enum pipe_shader_type stage,
|
||||
struct mali_vertex_tiler_postfix *postfix);
|
||||
mali_ptr *push_constants);
|
||||
|
||||
mali_ptr
|
||||
panfrost_emit_shared_memory(struct panfrost_batch *batch,
|
||||
|
|
|
@ -119,8 +119,10 @@ panfrost_launch_grid(struct pipe_context *pipe,
|
|||
|
||||
panfrost_vt_init(ctx, PIPE_SHADER_COMPUTE, &payload.prefix, &payload.postfix);
|
||||
|
||||
mali_ptr push = 0;
|
||||
payload.postfix.shader = panfrost_emit_compute_shader_meta(batch, PIPE_SHADER_COMPUTE);
|
||||
panfrost_emit_const_buf(batch, PIPE_SHADER_COMPUTE, &payload.postfix);
|
||||
payload.postfix.uniform_buffers = panfrost_emit_const_buf(batch, PIPE_SHADER_COMPUTE, &push);
|
||||
payload.postfix.uniforms = push;
|
||||
payload.postfix.shared_memory = panfrost_emit_shared_memory(batch, info);
|
||||
|
||||
/* Invoke according to the grid info */
|
||||
|
|
|
@ -319,6 +319,8 @@ panfrost_draw_vbo(
|
|||
1, 1, 1);
|
||||
|
||||
/* Emit all sort of descriptors. */
|
||||
mali_ptr push_vert = 0, push_frag = 0;
|
||||
|
||||
panfrost_emit_vertex_data(batch, &vertex_postfix);
|
||||
panfrost_emit_varying_descriptor(batch,
|
||||
ctx->padded_count *
|
||||
|
@ -329,8 +331,10 @@ panfrost_draw_vbo(
|
|||
tiler_postfix.sampler_descriptor = panfrost_emit_sampler_descriptors(batch, PIPE_SHADER_FRAGMENT);
|
||||
vertex_postfix.textures = panfrost_emit_texture_descriptors(batch, PIPE_SHADER_VERTEX);
|
||||
tiler_postfix.textures = panfrost_emit_texture_descriptors(batch, PIPE_SHADER_FRAGMENT);
|
||||
panfrost_emit_const_buf(batch, PIPE_SHADER_VERTEX, &vertex_postfix);
|
||||
panfrost_emit_const_buf(batch, PIPE_SHADER_FRAGMENT, &tiler_postfix);
|
||||
vertex_postfix.uniform_buffers = panfrost_emit_const_buf(batch, PIPE_SHADER_VERTEX, &push_vert);
|
||||
tiler_postfix.uniform_buffers = panfrost_emit_const_buf(batch, PIPE_SHADER_FRAGMENT, &push_frag);
|
||||
vertex_postfix.uniforms = push_vert;
|
||||
tiler_postfix.uniforms = push_frag;
|
||||
tiler_postfix.viewport = panfrost_emit_viewport(batch);
|
||||
|
||||
vertex_postfix.shader = panfrost_emit_compute_shader_meta(batch, PIPE_SHADER_VERTEX);
|
||||
|
|
Loading…
Reference in New Issue