mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 06:48:06 +02:00
st/mesa: add support for indirect drawing
This commit is contained in:
parent
59330f13b0
commit
b97b87940b
3 changed files with 14 additions and 1 deletions
|
|
@ -225,6 +225,9 @@ st_bufferobj_data(struct gl_context *ctx,
|
|||
case GL_UNIFORM_BUFFER:
|
||||
bind = PIPE_BIND_CONSTANT_BUFFER;
|
||||
break;
|
||||
case GL_DRAW_INDIRECT_BUFFER:
|
||||
bind = PIPE_BIND_COMMAND_ARGS_BUFFER;
|
||||
break;
|
||||
default:
|
||||
bind = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -244,6 +244,14 @@ st_draw_vbo(struct gl_context *ctx,
|
|||
}
|
||||
}
|
||||
|
||||
if (indirect) {
|
||||
info.indirect = st_buffer_object(indirect)->buffer;
|
||||
|
||||
/* Primitive restart is not handled by the VBO module in this case. */
|
||||
info.primitive_restart = ctx->Array._PrimitiveRestart;
|
||||
info.restart_index = ctx->Array.RestartIndex;
|
||||
}
|
||||
|
||||
/* do actual drawing */
|
||||
for (i = 0; i < nr_prims; i++) {
|
||||
info.mode = translate_prim(ctx, prims[i].mode);
|
||||
|
|
@ -256,6 +264,7 @@ st_draw_vbo(struct gl_context *ctx,
|
|||
info.min_index = info.start;
|
||||
info.max_index = info.start + info.count - 1;
|
||||
}
|
||||
info.indirect_offset = prims[i].indirect_offset;
|
||||
|
||||
if (ST_DEBUG & DEBUG_DRAW) {
|
||||
debug_printf("st/draw: mode %s start %u count %u indexed %d\n",
|
||||
|
|
@ -265,7 +274,7 @@ st_draw_vbo(struct gl_context *ctx,
|
|||
info.indexed);
|
||||
}
|
||||
|
||||
if (info.count_from_stream_output) {
|
||||
if (info.count_from_stream_output || info.indirect) {
|
||||
cso_draw_vbo(st->cso_context, &info);
|
||||
}
|
||||
else if (info.primitive_restart) {
|
||||
|
|
|
|||
|
|
@ -432,6 +432,7 @@ void st_init_extensions(struct st_context *st)
|
|||
{ o(ARB_texture_multisample), PIPE_CAP_TEXTURE_MULTISAMPLE },
|
||||
{ o(ARB_texture_query_lod), PIPE_CAP_TEXTURE_QUERY_LOD },
|
||||
{ o(ARB_sample_shading), PIPE_CAP_SAMPLE_SHADING },
|
||||
{ o(ARB_draw_indirect), PIPE_CAP_DRAW_INDIRECT }
|
||||
};
|
||||
|
||||
/* Required: render target and sampler support */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue