panfrost: Dissociate shader meta patching from the desc emission
Right now we emit two shader descriptors for the fragment shader, one when panfrost_patch_shader_state() is called, and the final one including both the shader_meta and the blend RT descriptors. The first generated fragment shader descriptor is never used, since the second one overrides the postfix.shader pointer. Let's dissociate the state patching logic from the descriptor emission so we don't upload descriptors that are never used. Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>
This commit is contained in:
parent
36725be4d9
commit
5d33d42b4d
|
@ -28,6 +28,29 @@
|
|||
#include "pan_context.h"
|
||||
#include "pan_job.h"
|
||||
|
||||
void
|
||||
panfrost_emit_shader_meta(struct panfrost_batch *batch,
|
||||
enum pipe_shader_type st,
|
||||
struct midgard_payload_vertex_tiler *vtp)
|
||||
{
|
||||
struct panfrost_context *ctx = batch->ctx;
|
||||
struct panfrost_shader_state *ss = panfrost_get_shader_state(ctx, st);
|
||||
|
||||
if (!ss) {
|
||||
vtp->postfix.shader = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Add the shader BO to the batch. */
|
||||
panfrost_batch_add_bo(batch, ss->bo,
|
||||
PAN_BO_ACCESS_PRIVATE |
|
||||
PAN_BO_ACCESS_READ |
|
||||
panfrost_bo_access_for_stage(st));
|
||||
|
||||
vtp->postfix.shader = panfrost_upload_transient(batch, ss->tripipe,
|
||||
sizeof(*ss->tripipe));
|
||||
}
|
||||
|
||||
static void
|
||||
panfrost_mali_viewport_init(struct panfrost_context *ctx,
|
||||
struct mali_viewport *mvp)
|
||||
|
|
|
@ -32,6 +32,11 @@
|
|||
|
||||
#include "pan_job.h"
|
||||
|
||||
void
|
||||
panfrost_emit_shader_meta(struct panfrost_batch *batch,
|
||||
enum pipe_shader_type st,
|
||||
struct midgard_payload_vertex_tiler *vtp);
|
||||
|
||||
void
|
||||
panfrost_emit_viewport(struct panfrost_batch *batch,
|
||||
struct midgard_payload_vertex_tiler *tp);
|
||||
|
|
|
@ -538,10 +538,8 @@ panfrost_patch_shader_state(struct panfrost_context *ctx,
|
|||
{
|
||||
struct panfrost_shader_state *ss = panfrost_get_shader_state(ctx, stage);
|
||||
|
||||
if (!ss) {
|
||||
ctx->payloads[stage].postfix.shader = 0;
|
||||
if (!ss)
|
||||
return;
|
||||
}
|
||||
|
||||
ss->tripipe->texture_count = ctx->sampler_view_count[stage];
|
||||
ss->tripipe->sampler_count = ctx->sampler_count[stage];
|
||||
|
@ -550,18 +548,6 @@ panfrost_patch_shader_state(struct panfrost_context *ctx,
|
|||
|
||||
unsigned ubo_count = panfrost_ubo_count(ctx, stage);
|
||||
ss->tripipe->midgard1.uniform_buffer_count = ubo_count;
|
||||
|
||||
struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
|
||||
|
||||
/* Add the shader BO to the batch. */
|
||||
panfrost_batch_add_bo(batch, ss->bo,
|
||||
PAN_BO_ACCESS_PRIVATE |
|
||||
PAN_BO_ACCESS_READ |
|
||||
panfrost_bo_access_for_stage(stage));
|
||||
|
||||
ctx->payloads[stage].postfix.shader = panfrost_upload_transient(batch,
|
||||
ss->tripipe,
|
||||
sizeof(struct mali_shader_meta));
|
||||
}
|
||||
|
||||
/* Go through dirty flags and actualise them in the cmdstream. */
|
||||
|
@ -601,7 +587,11 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data)
|
|||
}
|
||||
|
||||
panfrost_patch_shader_state(ctx, PIPE_SHADER_VERTEX);
|
||||
panfrost_emit_shader_meta(batch, PIPE_SHADER_VERTEX,
|
||||
&ctx->payloads[PIPE_SHADER_VERTEX]);
|
||||
panfrost_patch_shader_state(ctx, PIPE_SHADER_COMPUTE);
|
||||
panfrost_emit_shader_meta(batch, PIPE_SHADER_COMPUTE,
|
||||
&ctx->payloads[PIPE_SHADER_COMPUTE]);
|
||||
|
||||
if (ctx->shader[PIPE_SHADER_VERTEX] && ctx->shader[PIPE_SHADER_FRAGMENT]) {
|
||||
/* Check if we need to link the gl_PointSize varying */
|
||||
|
|
Loading…
Reference in New Issue