diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/broadcom/cle/v3d_packet_v33.xml | 39 | ||||
-rw-r--r-- | src/gallium/drivers/v3d/v3d_screen.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/v3d/v3dx_draw.c | 32 |
3 files changed, 70 insertions, 2 deletions
diff --git a/src/broadcom/cle/v3d_packet_v33.xml b/src/broadcom/cle/v3d_packet_v33.xml index a5fb4eaae52..9258534a2e6 100644 --- a/src/broadcom/cle/v3d_packet_v33.xml +++ b/src/broadcom/cle/v3d_packet_v33.xml @@ -457,6 +457,37 @@ <field name="mode" size="6" start="0" type="Primitive"/> </packet> + <packet code="33" name="Indirect Indexed Instanced Prim List" cl="B" max_ver="33"> + <field name="Stride in Multiples of 4 Bytes" size="8" start="104" type="uint"/> + <field name="Address of Indices List" size="32" start="72" type="address"/> + <field name="Address" size="32" start="40" type="address"/> + <field name="Enable Primitive Restarts" size="1" start="39" type="bool"/> + <field name="Number of Draw Indirect Indexed Records" size="31" start="8" type="uint"/> + + <field name="Index type" size="2" start="6" type="uint"> + <value name="Index type 8-bit" value="0"/> + <value name="Index type 16-bit" value="1"/> + <value name="Index type 32-bit" value="2"/> + </field> + + <field name="mode" size="6" start="0" type="Primitive"/> + </packet> + + <packet code="33" name="Indirect Indexed Instanced Prim List" cl="B" min_ver="41"> + <field name="Stride in Multiples of 4 Bytes" size="8" start="72" type="uint"/> + <field name="Address" size="32" start="40" type="address"/> + <field name="Enable Primitive Restarts" size="1" start="39" type="bool"/> + <field name="Number of Draw Indirect Indexed Records" size="31" start="8" type="uint"/> + + <field name="Index type" size="2" start="6" type="uint"> + <value name="Index type 8-bit" value="0"/> + <value name="Index type 16-bit" value="1"/> + <value name="Index type 32-bit" value="2"/> + </field> + + <field name="mode" size="6" start="0" type="Primitive"/> + </packet> + <packet code="34" name="Indexed Instanced Prim List" cl="B" max_ver="33"> <field name="Enable Primitive Restarts" size="1" start="135" type="bool"/> <field name="Maximum index" size="31" start="104" type="uint"/> @@ -495,6 +526,14 @@ <field name="mode" size="8" start="0" type="Primitive"/> </packet> + <packet code="37" name="Indirect Vertex Array Instanced Prims" cl="B"> + <field name="Stride in Multiples of 4 Bytes" size="8" start="72" type="uint"/> + <field name="Address" size="32" start="40" type="address"/> + <field name="Number of Draw Indirect Array Records" size="32" start="8" type="uint"/> + + <field name="mode" size="8" start="0" type="Primitive"/> + </packet> + <packet code="38" name="Vertex Array Instanced Prims" cl="B"> <field name="Index of First Vertex" size="32" start="72" type="uint"/> <field name="Number of Instances" size="32" start="40" type="uint"/> diff --git a/src/gallium/drivers/v3d/v3d_screen.c b/src/gallium/drivers/v3d/v3d_screen.c index 6f6c11f1ef1..f6846080c1c 100644 --- a/src/gallium/drivers/v3d/v3d_screen.c +++ b/src/gallium/drivers/v3d/v3d_screen.c @@ -122,6 +122,7 @@ v3d_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME: case PIPE_CAP_COMPUTE: case PIPE_CAP_DRAW_INDIRECT: + case PIPE_CAP_MULTI_DRAW_INDIRECT: case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION: case PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET: case PIPE_CAP_TGSI_CAN_READ_OUTPUTS: diff --git a/src/gallium/drivers/v3d/v3dx_draw.c b/src/gallium/drivers/v3d/v3dx_draw.c index d48970e1e2b..692f1fe3c04 100644 --- a/src/gallium/drivers/v3d/v3dx_draw.c +++ b/src/gallium/drivers/v3d/v3dx_draw.c @@ -450,6 +450,9 @@ v3d_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info) for (int s = 0; s < PIPE_SHADER_TYPES; s++) v3d_predraw_check_stage_inputs(pctx, s); + if (info->indirect) + v3d_flush_jobs_writing_resource(v3d, info->indirect->buffer); + struct v3d_job *job = v3d_get_job_for_fbo(v3d); /* If vertex texturing depends on the output of rendering, we need to @@ -547,7 +550,23 @@ v3d_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info) } #endif - if (info->instance_count > 1) { + if (info->indirect) { + cl_emit(&job->bcl, INDIRECT_INDEXED_INSTANCED_PRIM_LIST, prim) { + prim.index_type = ffs(info->index_size) - 1; +#if V3D_VERSION < 40 + prim.address_of_indices_list = + cl_address(rsc->bo, offset); +#endif /* V3D_VERSION < 40 */ + prim.mode = info->mode | prim_tf_enable; + prim.enable_primitive_restarts = info->primitive_restart; + + prim.number_of_draw_indirect_indexed_records = info->indirect->draw_count; + + prim.stride_in_multiples_of_4_bytes = info->indirect->stride >> 2; + prim.address = cl_address(v3d_resource(info->indirect->buffer)->bo, + info->indirect->offset); + } + } else if (info->instance_count > 1) { cl_emit(&job->bcl, INDEXED_INSTANCED_PRIM_LIST, prim) { prim.index_type = ffs(info->index_size) - 1; #if V3D_VERSION >= 40 @@ -584,7 +603,16 @@ v3d_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info) if (info->has_user_indices) pipe_resource_reference(&prsc, NULL); } else { - if (info->instance_count > 1) { + if (info->indirect) { + cl_emit(&job->bcl, INDIRECT_VERTEX_ARRAY_INSTANCED_PRIMS, prim) { + prim.mode = info->mode | prim_tf_enable; + prim.number_of_draw_indirect_array_records = info->indirect->draw_count; + + prim.stride_in_multiples_of_4_bytes = info->indirect->stride >> 2; + prim.address = cl_address(v3d_resource(info->indirect->buffer)->bo, + info->indirect->offset); + } + } else if (info->instance_count > 1) { cl_emit(&job->bcl, VERTEX_ARRAY_INSTANCED_PRIMS, prim) { prim.mode = info->mode | prim_tf_enable; prim.index_of_first_vertex = info->start; |