summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc5/vc5_draw.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2017-11-01 15:16:59 -0700
committerEric Anholt <[email protected]>2017-11-07 09:19:48 -0800
commit078b163a9c581e5b0e7bcc7436f0bf569cbc020d (patch)
treedadb992d438dec013473a147831be2a021d5d9cb /src/gallium/drivers/vc5/vc5_draw.c
parent735b844b1b32a440738b1a6096ea3aa4df6b52a7 (diff)
broadcom/vc5: Add a cl_emit() variant for merging with a pre-packed struct.
Cleans up the hand-written code, at the cost of another ugly macro.
Diffstat (limited to 'src/gallium/drivers/vc5/vc5_draw.c')
-rw-r--r--src/gallium/drivers/vc5/vc5_draw.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/gallium/drivers/vc5/vc5_draw.c b/src/gallium/drivers/vc5/vc5_draw.c
index 2ff604f02f2..edc52859154 100644
--- a/src/gallium/drivers/vc5/vc5_draw.c
+++ b/src/gallium/drivers/vc5/vc5_draw.c
@@ -221,25 +221,20 @@ vc5_emit_gl_shader_state(struct vc5_context *vc5,
&vertexbuf->vb[elem->vertex_buffer_index];
struct vc5_resource *rsc = vc5_resource(vb->buffer.resource);
- struct V3D33_GL_SHADER_STATE_ATTRIBUTE_RECORD attr_unpacked = {
- .stride = vb->stride,
- .address = cl_address(rsc->bo,
- vb->buffer_offset +
- elem->src_offset),
- .number_of_values_read_by_coordinate_shader =
- vc5->prog.cs->prog_data.vs->vattr_sizes[i],
- .number_of_values_read_by_vertex_shader =
- vc5->prog.vs->prog_data.vs->vattr_sizes[i],
- };
const uint32_t size =
cl_packet_length(GL_SHADER_STATE_ATTRIBUTE_RECORD);
- uint8_t attr_packed[size];
- V3D33_GL_SHADER_STATE_ATTRIBUTE_RECORD_pack(&job->indirect,
- attr_packed,
- &attr_unpacked);
- for (int j = 0; j < size; j++)
- attr_packed[j] |= vtx->attrs[i * size + j];
- cl_emit_prepacked(&job->indirect, &attr_packed);
+ cl_emit_with_prepacked(&job->indirect,
+ GL_SHADER_STATE_ATTRIBUTE_RECORD,
+ &vtx->attrs[i * size], attr) {
+ attr.stride = vb->stride;
+ attr.address = cl_address(rsc->bo,
+ vb->buffer_offset +
+ elem->src_offset);
+ attr.number_of_values_read_by_coordinate_shader =
+ vc5->prog.cs->prog_data.vs->vattr_sizes[i];
+ attr.number_of_values_read_by_vertex_shader =
+ vc5->prog.vs->prog_data.vs->vattr_sizes[i];
+ }
}
if (vtx->num_elements == 0) {