From: Christoph Bumiller Date: Fri, 5 Apr 2013 12:29:37 +0000 (+0200) Subject: st/mesa: add support for indirect drawing X-Git-Tag: upstream/10.3~1196 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b97b87940b1f7e093325ece4c1dd97b1d56835a1;p=platform%2Fupstream%2Fmesa.git st/mesa: add support for indirect drawing --- diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index 0262461..3b4d28d 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -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; } diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index c8189fa..64d6ef5 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -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) { diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 3b6681e..bfad04f 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -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 */