zink: implement ARB_draw_indirect
other than the vaguely gross case of primitive restart with incompatible draw modes and/or restart index, this is no trouble since the buffer formats are compatible Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7191>
This commit is contained in:

committed by
Marge Bot

parent
3e3b6e995f
commit
7c5129985b
@@ -114,7 +114,7 @@ GL 3.3, GLSL 3.30 --- all DONE: i965, nv50, nvc0, r600, radeonsi, llvmpipe, soft
|
|||||||
GL 4.0, GLSL 4.00 --- all DONE: i965/gen7+, nvc0, r600, radeonsi, llvmpipe, virgl
|
GL 4.0, GLSL 4.00 --- all DONE: i965/gen7+, nvc0, r600, radeonsi, llvmpipe, virgl
|
||||||
|
|
||||||
GL_ARB_draw_buffers_blend DONE (freedreno, i965/gen6+, nv50, softpipe, swr, zink, panfrost)
|
GL_ARB_draw_buffers_blend DONE (freedreno, i965/gen6+, nv50, softpipe, swr, zink, panfrost)
|
||||||
GL_ARB_draw_indirect DONE (freedreno, i965/gen7+, softpipe, swr, v3d)
|
GL_ARB_draw_indirect DONE (freedreno, i965/gen7+, softpipe, swr, v3d, zink)
|
||||||
GL_ARB_gpu_shader5 DONE (i965/gen7+)
|
GL_ARB_gpu_shader5 DONE (i965/gen7+)
|
||||||
- 'precise' qualifier DONE (softpipe)
|
- 'precise' qualifier DONE (softpipe)
|
||||||
- Dynamically uniform sampler array indices DONE (softpipe)
|
- Dynamically uniform sampler array indices DONE (softpipe)
|
||||||
|
@@ -509,17 +509,25 @@ zink_draw_vbo(struct pipe_context *pctx,
|
|||||||
struct zink_resource *res = zink_resource(index_buffer);
|
struct zink_resource *res = zink_resource(index_buffer);
|
||||||
vkCmdBindIndexBuffer(batch->cmdbuf, res->buffer, index_offset, index_type);
|
vkCmdBindIndexBuffer(batch->cmdbuf, res->buffer, index_offset, index_type);
|
||||||
zink_batch_reference_resource_rw(batch, res, false);
|
zink_batch_reference_resource_rw(batch, res, false);
|
||||||
vkCmdDrawIndexed(batch->cmdbuf,
|
if (dinfo->indirect) {
|
||||||
dinfo->count, dinfo->instance_count,
|
struct zink_resource *indirect = zink_resource(dinfo->indirect->buffer);
|
||||||
need_index_buffer_unref ? 0 : dinfo->start, dinfo->index_bias, dinfo->start_instance);
|
zink_batch_reference_resource_rw(batch, indirect, false);
|
||||||
|
vkCmdDrawIndexedIndirect(batch->cmdbuf, indirect->buffer, dinfo->indirect->offset, dinfo->indirect->draw_count, dinfo->indirect->stride);
|
||||||
|
} else
|
||||||
|
vkCmdDrawIndexed(batch->cmdbuf,
|
||||||
|
dinfo->count, dinfo->instance_count,
|
||||||
|
need_index_buffer_unref ? 0 : dinfo->start, dinfo->index_bias, dinfo->start_instance);
|
||||||
} else {
|
} else {
|
||||||
if (so_target && screen->info.tf_props.transformFeedbackDraw) {
|
if (so_target && screen->info.tf_props.transformFeedbackDraw) {
|
||||||
zink_batch_reference_resource_rw(batch, zink_resource(so_target->counter_buffer), true);
|
zink_batch_reference_resource_rw(batch, zink_resource(so_target->counter_buffer), true);
|
||||||
screen->vk_CmdDrawIndirectByteCountEXT(batch->cmdbuf, dinfo->instance_count, dinfo->start_instance,
|
screen->vk_CmdDrawIndirectByteCountEXT(batch->cmdbuf, dinfo->instance_count, dinfo->start_instance,
|
||||||
zink_resource(so_target->counter_buffer)->buffer, so_target->counter_buffer_offset, 0,
|
zink_resource(so_target->counter_buffer)->buffer, so_target->counter_buffer_offset, 0,
|
||||||
MIN2(so_target->stride, screen->info.tf_props.maxTransformFeedbackBufferDataStride));
|
MIN2(so_target->stride, screen->info.tf_props.maxTransformFeedbackBufferDataStride));
|
||||||
}
|
} else if (dinfo->indirect) {
|
||||||
else
|
struct zink_resource *indirect = zink_resource(dinfo->indirect->buffer);
|
||||||
|
zink_batch_reference_resource_rw(batch, indirect, false);
|
||||||
|
vkCmdDrawIndirect(batch->cmdbuf, indirect->buffer, dinfo->indirect->offset, dinfo->indirect->draw_count, dinfo->indirect->stride);
|
||||||
|
} else
|
||||||
vkCmdDraw(batch->cmdbuf, dinfo->count, dinfo->instance_count, dinfo->start, dinfo->start_instance);
|
vkCmdDraw(batch->cmdbuf, dinfo->count, dinfo->instance_count, dinfo->start, dinfo->start_instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -97,6 +97,7 @@ zink_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
|
|||||||
switch (param) {
|
switch (param) {
|
||||||
case PIPE_CAP_NPOT_TEXTURES:
|
case PIPE_CAP_NPOT_TEXTURES:
|
||||||
case PIPE_CAP_TGSI_TEXCOORD:
|
case PIPE_CAP_TGSI_TEXCOORD:
|
||||||
|
case PIPE_CAP_DRAW_INDIRECT:
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR:
|
case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR:
|
||||||
|
Reference in New Issue
Block a user