diff options
author | marha <marha@users.sourceforge.net> | 2013-11-26 08:07:23 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-11-26 08:07:23 +0100 |
commit | cec4285e4e6b06babf340165148ff8c31601b382 (patch) | |
tree | 9e19864958826fb517b22ba224aa713307272687 /mesalib/src/mesa/vbo/vbo_primitive_restart.c | |
parent | 0f333fb1102f4886a8ce39f3c09b12e89e5a7f19 (diff) | |
parent | 4042ec939a2cdc8473479c900871c4c8c0b4e818 (diff) | |
download | vcxsrv-cec4285e4e6b06babf340165148ff8c31601b382.tar.gz vcxsrv-cec4285e4e6b06babf340165148ff8c31601b382.tar.bz2 vcxsrv-cec4285e4e6b06babf340165148ff8c31601b382.zip |
Merge remote-tracking branch 'origin/released'
* origin/released:
xkeyboard-config mesa git update 26 nov 2013
Diffstat (limited to 'mesalib/src/mesa/vbo/vbo_primitive_restart.c')
-rw-r--r-- | mesalib/src/mesa/vbo/vbo_primitive_restart.c | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/mesalib/src/mesa/vbo/vbo_primitive_restart.c b/mesalib/src/mesa/vbo/vbo_primitive_restart.c index 418f8829d..e0bd233ee 100644 --- a/mesalib/src/mesa/vbo/vbo_primitive_restart.c +++ b/mesalib/src/mesa/vbo/vbo_primitive_restart.c @@ -163,7 +163,8 @@ void vbo_sw_primitive_restart(struct gl_context *ctx, const struct _mesa_prim *prims, GLuint nr_prims, - const struct _mesa_index_buffer *ib) + const struct _mesa_index_buffer *ib, + struct gl_buffer_object *indirect) { GLuint prim_num; struct sub_primitive *sub_prims; @@ -179,6 +180,39 @@ vbo_sw_primitive_restart(struct gl_context *ctx, GLboolean map_ib = ib->obj->Name && !ib->obj->Pointer; void *ptr; + /* If there is an indirect buffer, map it and extract the draw params */ + if (indirect && prims[0].is_indirect) { + struct _mesa_prim new_prim = *prims; + struct _mesa_index_buffer new_ib = *ib; + const uint32_t *indirect_params; + if (!ctx->Driver.MapBufferRange(ctx, 0, indirect->Size, GL_MAP_READ_BIT, + indirect)) { + + /* something went wrong with mapping, give up */ + _mesa_error(ctx, GL_OUT_OF_MEMORY, + "failed to map indirect buffer for sw primitive restart"); + return; + } + + assert(nr_prims == 1); + indirect_params = (const uint32_t *) ADD_POINTERS(indirect->Pointer, + new_prim.indirect_offset); + + new_prim.is_indirect = 0; + new_prim.count = indirect_params[0]; + new_prim.num_instances = indirect_params[1]; + new_prim.start = indirect_params[2]; + new_prim.basevertex = indirect_params[3]; + new_prim.base_instance = indirect_params[4]; + + new_ib.count = new_prim.count; + + prims = &new_prim; + ib = &new_ib; + + ctx->Driver.UnmapBuffer(ctx, indirect); + } + /* Find the sub-primitives. These are regions in the index buffer which * are split based on the primitive restart index value. */ @@ -214,11 +248,11 @@ vbo_sw_primitive_restart(struct gl_context *ctx, (temp_prim.count == sub_prim->count)) { draw_prims_func(ctx, &temp_prim, 1, ib, GL_TRUE, sub_prim->min_index, sub_prim->max_index, - NULL); + NULL, NULL); } else { draw_prims_func(ctx, &temp_prim, 1, ib, GL_FALSE, -1, -1, - NULL); + NULL, NULL); } } if (sub_end_index >= end_index) { |