panfrost: Detangle postfix from varying emits

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:
Alyssa Rosenzweig
2020-08-25 13:37:22 -04:00
committed by Marge Bot
parent 3a4d930571
commit e5c77cbead
3 changed files with 24 additions and 15 deletions

View File

@@ -1694,9 +1694,11 @@ pan_emit_special_input(struct mali_attribute_buffer_packed *out,
void
panfrost_emit_varying_descriptor(struct panfrost_batch *batch,
unsigned vertex_count,
struct mali_vertex_tiler_postfix *vertex_postfix,
struct mali_vertex_tiler_postfix *tiler_postfix,
union midgard_primitive_size *primitive_size)
mali_ptr *vs_attribs,
mali_ptr *fs_attribs,
mali_ptr *buffers,
mali_ptr *position,
mali_ptr *psiz)
{
/* Load the shaders */
struct panfrost_context *ctx = batch->ctx;
@@ -1782,12 +1784,12 @@ panfrost_emit_varying_descriptor(struct panfrost_batch *batch,
gen_stride, vertex_count);
/* fp32 vec4 gl_Position */
tiler_postfix->position_varying = panfrost_emit_varyings(batch,
*position = panfrost_emit_varyings(batch,
&varyings[pan_varying_index(present, PAN_VARY_POSITION)],
sizeof(float) * 4, vertex_count);
if (present & (1 << PAN_VARY_PSIZ)) {
primitive_size->pointer = panfrost_emit_varyings(batch,
*psiz = panfrost_emit_varyings(batch,
&varyings[pan_varying_index(present, PAN_VARY_PSIZ)],
2, vertex_count);
}
@@ -1796,11 +1798,9 @@ panfrost_emit_varying_descriptor(struct panfrost_batch *batch,
pan_emit_special_input(varyings, present, PAN_VARY_FACE, MALI_ATTRIBUTE_SPECIAL_FRONT_FACING);
pan_emit_special_input(varyings, present, PAN_VARY_FRAGCOORD, MALI_ATTRIBUTE_SPECIAL_FRAG_COORD);
vertex_postfix->varyings = T.gpu;
tiler_postfix->varyings = T.gpu;
vertex_postfix->varying_meta = trans.gpu;
tiler_postfix->varying_meta = trans.gpu + vs_size;
*buffers = T.gpu;
*vs_attribs = trans.gpu;
*fs_attribs = trans.gpu + vs_size;
}
void

View File

@@ -79,9 +79,11 @@ panfrost_get_index_buffer_bounded(struct panfrost_context *ctx,
void
panfrost_emit_varying_descriptor(struct panfrost_batch *batch,
unsigned vertex_count,
struct mali_vertex_tiler_postfix *vertex_postfix,
struct mali_vertex_tiler_postfix *tiler_postfix,
union midgard_primitive_size *primitive_size);
mali_ptr *vs_attribs,
mali_ptr *fs_attribs,
mali_ptr *buffers,
mali_ptr *position,
mali_ptr *psiz);
void
panfrost_emit_vertex_tiler_jobs(struct panfrost_batch *batch,

View File

@@ -391,14 +391,20 @@ panfrost_draw_vbo(
/* Emit all sort of descriptors. */
mali_ptr push_vert = 0, push_frag = 0, attribs = 0;
mali_ptr varyings = 0, vs_vary = 0, fs_vary = 0, pos = 0, psiz = 0;
vertex_postfix.attribute_meta = panfrost_emit_vertex_data(batch, &attribs);
vertex_postfix.attributes = attribs;
panfrost_emit_varying_descriptor(batch,
ctx->padded_count *
ctx->instance_count,
&vertex_postfix, &tiler_postfix,
&primitive_size);
&vs_vary, &fs_vary, &varyings,
&pos, &psiz);
vertex_postfix.varyings = varyings;
tiler_postfix.varyings = varyings;
vertex_postfix.varying_meta = vs_vary;
tiler_postfix.varying_meta = fs_vary;
tiler_postfix.position_varying = pos;
vertex_postfix.sampler_descriptor = panfrost_emit_sampler_descriptors(batch, PIPE_SHADER_VERTEX);
tiler_postfix.sampler_descriptor = panfrost_emit_sampler_descriptors(batch, PIPE_SHADER_FRAGMENT);
vertex_postfix.textures = panfrost_emit_texture_descriptors(batch, PIPE_SHADER_VERTEX);
@@ -412,6 +418,7 @@ panfrost_draw_vbo(
vertex_postfix.shader = panfrost_emit_compute_shader_meta(batch, PIPE_SHADER_VERTEX);
tiler_postfix.shader = panfrost_emit_frag_shader_meta(batch);
primitive_size.pointer = psiz;
panfrost_vt_update_primitive_size(ctx, &tiler_prefix, &primitive_size);
/* Fire off the draw itself */