aboutsummaryrefslogtreecommitdiff
path: root/mesalib
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-06-21 08:11:16 +0200
committermarha <marha@users.sourceforge.net>2012-06-21 08:11:16 +0200
commit478ec8cab167e7d8be4973fc3f8d425b1baa4496 (patch)
tree0b05eb5a0e3a989a66baff04a954db416444f7c5 /mesalib
parent62d040da7ea0a76d48014b5247d98b428ca50a15 (diff)
parentda6ea6d64418710cbf7e0639dfefd2d856d53f1a (diff)
downloadvcxsrv-478ec8cab167e7d8be4973fc3f8d425b1baa4496.tar.gz
vcxsrv-478ec8cab167e7d8be4973fc3f8d425b1baa4496.tar.bz2
vcxsrv-478ec8cab167e7d8be4973fc3f8d425b1baa4496.zip
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'mesalib')
-rw-r--r--mesalib/bin/confdiff.sh48
-rw-r--r--mesalib/docs/GL3.txt2
-rw-r--r--mesalib/src/mapi/glapi/gen/ARB_base_instance.xml40
-rw-r--r--mesalib/src/mapi/glapi/gen/Makefile1
-rw-r--r--mesalib/src/mapi/glapi/gen/gl_API.xml3
-rw-r--r--mesalib/src/mesa/main/dd.h10
-rw-r--r--mesalib/src/mesa/main/dlist.c45
-rw-r--r--mesalib/src/mesa/main/extensions.c1
-rw-r--r--mesalib/src/mesa/main/mtypes.h1
-rw-r--r--mesalib/src/mesa/main/vtxfmt.c3
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_drawpixels.c41
-rw-r--r--mesalib/src/mesa/state_tracker/st_draw.c1
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp49
-rw-r--r--mesalib/src/mesa/vbo/vbo.h1
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_api.c1
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_array.c114
-rw-r--r--mesalib/src/mesa/vbo/vbo_save_api.c2
-rw-r--r--mesalib/src/mesa/vbo/vbo_split_inplace.c6
19 files changed, 261 insertions, 110 deletions
diff --git a/mesalib/bin/confdiff.sh b/mesalib/bin/confdiff.sh
deleted file mode 100644
index 568fcd6d5..000000000
--- a/mesalib/bin/confdiff.sh
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/bash -e
-
-usage()
-{
- echo "Usage: $0 <target1> <target2>"
- echo "Highlight differences between Mesa configs"
- echo "Example:"
- echo " $0 linux linux-x86"
-}
-
-die()
-{
- echo "$@" >&2
- return 1
-}
-
-case "$1" in
--h|--help) usage; exit 0;;
-esac
-
-[ $# -lt 2 ] && die 2 targets needed. See $0 --help
-target1=$1
-target2=$2
-
-topdir=$(cd "`dirname $0`"/..; pwd)
-cd "$topdir"
-
-[ -f "./configs/$target1" ] || die Missing configs/$target1
-[ -f "./configs/$target2" ] || die Missing configs/$target2
-
-trap 'rm -f "$t1" "$t2"' 0
-
-t1=$(mktemp)
-t2=$(mktemp)
-
-make -f- -n -p <<EOF | sed '/^# Not a target/,/^$/d' > $t1
-TOP = .
-include \$(TOP)/configs/$target1
-default:
-EOF
-
-make -f- -n -p <<EOF | sed '/^# Not a target/,/^$/d' > $t2
-TOP = .
-include \$(TOP)/configs/$target2
-default:
-EOF
-
-diff -pu -I'^#' $t1 $t2
diff --git a/mesalib/docs/GL3.txt b/mesalib/docs/GL3.txt
index 17136de31..89b46c0a4 100644
--- a/mesalib/docs/GL3.txt
+++ b/mesalib/docs/GL3.txt
@@ -119,7 +119,7 @@ GL_ARB_compressed_texture_pixel_storage not started
GL_ARB_shader_atomic_counters not started
GL_ARB_texture_storage DONE (r300, r600, swrast)
GL_ARB_transform_feedback_instanced not started
-GL_ARB_base_instance not started
+GL_ARB_base_instance DONE (nv50, nvc0, r600, radeonsi)
GL_ARB_shader_image_load_store not started
GL_ARB_conservative_depth DONE (softpipe)
GL_ARB_shading_language_420pack not started
diff --git a/mesalib/src/mapi/glapi/gen/ARB_base_instance.xml b/mesalib/src/mapi/glapi/gen/ARB_base_instance.xml
new file mode 100644
index 000000000..8e81553f6
--- /dev/null
+++ b/mesalib/src/mapi/glapi/gen/ARB_base_instance.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
+
+<!-- Note: no GLX protocol info yet. -->
+
+
+<OpenGLAPI>
+
+<category name="GL_ARB_base_instance" number="107">
+
+ <function name="DrawArraysInstancedBaseInstance" offset="assign">
+ <param name="mode" type="GLenum"/>
+ <param name="first" type="GLint"/>
+ <param name="count" type="GLsizei"/>
+ <param name="primcount" type="GLsizei"/>
+ <param name="baseinstance" type="GLuint"/>
+ </function>
+
+ <function name="DrawElementsInstancedBaseInstance" offset="assign">
+ <param name="mode" type="GLenum"/>
+ <param name="count" type="GLsizei"/>
+ <param name="type" type="GLenum"/>
+ <param name="indices" type="const GLvoid *"/>
+ <param name="primcount" type="GLsizei"/>
+ <param name="baseinstance" type="GLuint"/>
+ </function>
+
+ <function name="DrawElementsInstancedBaseVertexBaseInstance" offset="assign">
+ <param name="mode" type="GLenum"/>
+ <param name="count" type="GLsizei"/>
+ <param name="type" type="GLenum"/>
+ <param name="indices" type="const GLvoid *"/>
+ <param name="primcount" type="GLsizei"/>
+ <param name="basevertex" type="GLint"/>
+ <param name="baseinstance" type="GLuint"/>
+ </function>
+
+</category>
+
+</OpenGLAPI>
diff --git a/mesalib/src/mapi/glapi/gen/Makefile b/mesalib/src/mapi/glapi/gen/Makefile
index 75dbb1446..0ac798957 100644
--- a/mesalib/src/mapi/glapi/gen/Makefile
+++ b/mesalib/src/mapi/glapi/gen/Makefile
@@ -63,6 +63,7 @@ XORG_OUTPUTS = \
API_XML = \
gl_API.xml \
+ ARB_base_instance.xml \
ARB_color_buffer_float.xml \
ARB_copy_buffer.xml \
ARB_debug_output.xml \
diff --git a/mesalib/src/mapi/glapi/gen/gl_API.xml b/mesalib/src/mapi/glapi/gen/gl_API.xml
index b3756a87c..10b6ba91a 100644
--- a/mesalib/src/mapi/glapi/gen/gl_API.xml
+++ b/mesalib/src/mapi/glapi/gen/gl_API.xml
@@ -7995,8 +7995,9 @@
<!-- ARB extensions #106...#116 -->
-<xi:include href="ARB_texture_storage.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
+<xi:include href="ARB_base_instance.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
+<xi:include href="ARB_texture_storage.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<!-- Non-ARB extensions sorted by extension number. -->
diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h
index 1582a8c81..5bcf36bfa 100644
--- a/mesalib/src/mesa/main/dd.h
+++ b/mesalib/src/mesa/main/dd.h
@@ -1029,12 +1029,22 @@ typedef struct {
const GLint *basevertex);
void (GLAPIENTRYP DrawArraysInstanced)(GLenum mode, GLint first,
GLsizei count, GLsizei primcount);
+ void (GLAPIENTRYP DrawArraysInstancedBaseInstance)(GLenum mode, GLint first,
+ GLsizei count, GLsizei primcount,
+ GLuint baseinstance);
void (GLAPIENTRYP DrawElementsInstanced)(GLenum mode, GLsizei count,
GLenum type, const GLvoid *indices,
GLsizei primcount);
+ void (GLAPIENTRYP DrawElementsInstancedBaseInstance)(GLenum mode, GLsizei count,
+ GLenum type, const GLvoid *indices,
+ GLsizei primcount, GLuint baseinstance);
void (GLAPIENTRYP DrawElementsInstancedBaseVertex)(GLenum mode, GLsizei count,
GLenum type, const GLvoid *indices,
GLsizei primcount, GLint basevertex);
+ void (GLAPIENTRYP DrawElementsInstancedBaseVertexBaseInstance)(GLenum mode, GLsizei count,
+ GLenum type, const GLvoid *indices,
+ GLsizei primcount, GLint basevertex,
+ GLuint baseinstance);
void (GLAPIENTRYP DrawTransformFeedback)(GLenum mode, GLuint name);
/*@}*/
diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c
index e04f7ae6b..a0d84cfdc 100644
--- a/mesalib/src/mesa/main/dlist.c
+++ b/mesalib/src/mesa/main/dlist.c
@@ -1337,6 +1337,46 @@ save_DrawElementsInstancedBaseVertexARB(GLenum mode,
"glDrawElementsInstancedBaseVertex() during display list compile");
}
+/* GL_ARB_base_instance. */
+static void GLAPIENTRY
+save_DrawArraysInstancedBaseInstance(GLenum mode,
+ GLint first,
+ GLsizei count,
+ GLsizei primcount,
+ GLuint baseinstance)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glDrawArraysInstancedBaseInstance() during display list compile");
+}
+
+static void APIENTRY
+save_DrawElementsInstancedBaseInstance(GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei primcount,
+ GLuint baseinstance)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glDrawElementsInstancedBaseInstance() during display list compile");
+}
+
+static void APIENTRY
+save_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei primcount,
+ GLint basevertex,
+ GLuint baseinstance)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
+}
+
static void invalidate_saved_current_state( struct gl_context *ctx )
{
GLint i;
@@ -10816,6 +10856,11 @@ _mesa_save_vtxfmt_init(GLvertexformat * vfmt)
/* GL_ARB_draw_elements_base_vertex */
vfmt->DrawElementsInstancedBaseVertex = save_DrawElementsInstancedBaseVertexARB;
+ /* GL_ARB_base_instance */
+ vfmt->DrawArraysInstancedBaseInstance = save_DrawArraysInstancedBaseInstance;
+ vfmt->DrawElementsInstancedBaseInstance = save_DrawElementsInstancedBaseInstance;
+ vfmt->DrawElementsInstancedBaseVertexBaseInstance = save_DrawElementsInstancedBaseVertexBaseInstance;
+
/* The driver is required to implement these as
* 1) They can probably do a better job.
* 2) A lot of new mechanisms would have to be added to this module
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index 0e8178397..079316145 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -78,6 +78,7 @@ struct extension {
static const struct extension extension_table[] = {
/* ARB Extensions */
{ "GL_ARB_ES2_compatibility", o(ARB_ES2_compatibility), GL, 2009 },
+ { "GL_ARB_base_instance", o(ARB_base_instance), GL, 2011 },
{ "GL_ARB_blend_func_extended", o(ARB_blend_func_extended), GL, 2009 },
{ "GL_ARB_color_buffer_float", o(ARB_color_buffer_float), GL, 2004 },
{ "GL_ARB_copy_buffer", o(ARB_copy_buffer), GL, 2008 },
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 3d18b7c48..d52ab151a 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -2869,6 +2869,7 @@ struct gl_extensions
GLboolean dummy_true; /* Set true by _mesa_init_extensions(). */
GLboolean dummy_false; /* Set false by _mesa_init_extensions(). */
GLboolean ARB_ES2_compatibility;
+ GLboolean ARB_base_instance;
GLboolean ARB_blend_func_extended;
GLboolean ARB_color_buffer_float;
GLboolean ARB_conservative_depth;
diff --git a/mesalib/src/mesa/main/vtxfmt.c b/mesalib/src/mesa/main/vtxfmt.c
index 6fb016b9e..a27596a98 100644
--- a/mesalib/src/mesa/main/vtxfmt.c
+++ b/mesalib/src/mesa/main/vtxfmt.c
@@ -105,8 +105,11 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt )
SET_DrawRangeElementsBaseVertex(tab, vfmt->DrawRangeElementsBaseVertex);
SET_MultiDrawElementsBaseVertex(tab, vfmt->MultiDrawElementsBaseVertex);
SET_DrawArraysInstancedARB(tab, vfmt->DrawArraysInstanced);
+ SET_DrawArraysInstancedBaseInstance(tab, vfmt->DrawArraysInstancedBaseInstance);
SET_DrawElementsInstancedARB(tab, vfmt->DrawElementsInstanced);
+ SET_DrawElementsInstancedBaseInstance(tab, vfmt->DrawElementsInstancedBaseInstance);
SET_DrawElementsInstancedBaseVertex(tab, vfmt->DrawElementsInstancedBaseVertex);
+ SET_DrawElementsInstancedBaseVertexBaseInstance(tab, vfmt->DrawElementsInstancedBaseVertexBaseInstance);
SET_DrawTransformFeedback(tab, vfmt->DrawTransformFeedback);
/* GL_NV_vertex_program */
diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
index d3f8d1368..2bcbada4f 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -1056,6 +1056,28 @@ get_depth_stencil_fp_variant(struct st_context *st, GLboolean write_depth,
/**
+ * Clamp glDrawPixels width and height to the maximum texture size.
+ */
+static void
+clamp_size(struct pipe_context *pipe, GLsizei *width, GLsizei *height,
+ struct gl_pixelstore_attrib *unpack)
+{
+ const unsigned maxSize =
+ 1 << (pipe->screen->get_param(pipe->screen,
+ PIPE_CAP_MAX_TEXTURE_2D_LEVELS) - 1);
+
+ if (*width > maxSize) {
+ if (unpack->RowLength == 0)
+ unpack->RowLength = *width;
+ *width = maxSize;
+ }
+ if (*height > maxSize) {
+ *height = maxSize;
+ }
+}
+
+
+/**
* Called via ctx->Driver.DrawPixels()
*/
static void
@@ -1072,6 +1094,20 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
struct pipe_sampler_view *sv[2];
int num_sampler_view = 1;
struct st_fp_variant *fpv;
+ struct gl_pixelstore_attrib clippedUnpack;
+
+ /* Mesa state should be up to date by now */
+ assert(ctx->NewState == 0x0);
+
+ st_validate_state(st);
+
+ /* Limit the size of the glDrawPixels to the max texture size.
+ * Strictly speaking, that's not correct but since we don't handle
+ * larger images yet, this is better than crashing.
+ */
+ clippedUnpack = *unpack;
+ unpack = &clippedUnpack;
+ clamp_size(st->pipe, &width, &height, &clippedUnpack);
if (format == GL_DEPTH_STENCIL)
write_stencil = write_depth = GL_TRUE;
@@ -1088,11 +1124,6 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
return;
}
- /* Mesa state should be up to date by now */
- assert(ctx->NewState == 0x0);
-
- st_validate_state(st);
-
/*
* Get vertex/fragment shaders
*/
diff --git a/mesalib/src/mesa/state_tracker/st_draw.c b/mesalib/src/mesa/state_tracker/st_draw.c
index db8caa566..4dc09e7fb 100644
--- a/mesalib/src/mesa/state_tracker/st_draw.c
+++ b/mesalib/src/mesa/state_tracker/st_draw.c
@@ -246,6 +246,7 @@ st_draw_vbo(struct gl_context *ctx,
info.mode = translate_prim( ctx, prims[i].mode );
info.start = prims[i].start;
info.count = prims[i].count;
+ info.start_instance = prims[i].base_instance;
info.instance_count = prims[i].num_instances;
info.index_bias = prims[i].basevertex;
if (!ib) {
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index a9071f58c..dacad9bfb 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -222,6 +222,7 @@ void st_init_limits(struct st_context *st)
options->MaxUnrollIterations = MIN2(screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_INSTRUCTIONS), 65536);
else
options->MaxUnrollIterations = 255; /* SM3 limit */
+ options->LowerClipDistance = true;
}
/* PIPE_SHADER_CAP_MAX_INPUTS for the FS specifies the maximum number
@@ -337,6 +338,7 @@ void st_init_extensions(struct st_context *st)
GLboolean *extensions = (GLboolean *) &ctx->Extensions;
static const struct st_extension_cap_mapping cap_mapping[] = {
+ { o(ARB_base_instance), PIPE_CAP_START_INSTANCE },
{ o(ARB_depth_clamp), PIPE_CAP_DEPTH_CLIP_DISABLE },
{ o(ARB_depth_texture), PIPE_CAP_TEXTURE_SHADOW_MAP },
{ o(ARB_draw_buffers_blend), PIPE_CAP_INDEP_BLEND_FUNC },
diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 5802b52b7..b6abe84ac 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -304,7 +304,6 @@ public:
int samplers_used;
bool indirect_addr_temps;
bool indirect_addr_consts;
- int num_clip_distances;
int glsl_version;
bool native_integers;
@@ -2825,7 +2824,6 @@ glsl_to_tgsi_visitor::glsl_to_tgsi_visitor()
samplers_used = 0;
indirect_addr_temps = false;
indirect_addr_consts = false;
- num_clip_distances = 0;
glsl_version = 0;
native_integers = false;
mem_ctx = ralloc_context(NULL);
@@ -4593,17 +4591,9 @@ st_translate_program(
}
for (i = 0; i < numOutputs; i++) {
- if (outputSemanticName[i] == TGSI_SEMANTIC_CLIPDIST) {
- int mask = ((1 << (program->num_clip_distances - 4*outputSemanticIndex[i])) - 1) & TGSI_WRITEMASK_XYZW;
- t->outputs[i] = ureg_DECL_output_masked(ureg,
- outputSemanticName[i],
- outputSemanticIndex[i],
- mask);
- } else {
- t->outputs[i] = ureg_DECL_output(ureg,
- outputSemanticName[i],
- outputSemanticIndex[i]);
- }
+ t->outputs[i] = ureg_DECL_output(ureg,
+ outputSemanticName[i],
+ outputSemanticIndex[i]);
}
if (passthrough_edgeflags)
emit_edgeflags(t);
@@ -4759,8 +4749,7 @@ out:
static struct gl_program *
get_mesa_program(struct gl_context *ctx,
struct gl_shader_program *shader_program,
- struct gl_shader *shader,
- int num_clip_distances)
+ struct gl_shader *shader)
{
glsl_to_tgsi_visitor* v = new glsl_to_tgsi_visitor();
struct gl_program *prog;
@@ -4800,7 +4789,6 @@ get_mesa_program(struct gl_context *ctx,
v->options = options;
v->glsl_version = ctx->Const.GLSLVersion;
v->native_integers = ctx->Const.NativeIntegers;
- v->num_clip_distances = num_clip_distances;
_mesa_generate_parameters_list_for_uniforms(shader_program, shader,
prog->Parameters);
@@ -4925,25 +4913,6 @@ get_mesa_program(struct gl_context *ctx,
return prog;
}
-/**
- * Searches through the IR for a declaration of gl_ClipDistance and returns the
- * declared size of the gl_ClipDistance array. Returns 0 if gl_ClipDistance is
- * not declared in the IR.
- */
-int get_clip_distance_size(exec_list *ir)
-{
- foreach_iter (exec_list_iterator, iter, *ir) {
- ir_instruction *inst = (ir_instruction *)iter.get();
- ir_variable *var = inst->as_variable();
- if (var == NULL) continue;
- if (!strcmp(var->name, "gl_ClipDistance")) {
- return var->type->length;
- }
- }
-
- return 0;
-}
-
extern "C" {
struct gl_shader *
@@ -4982,7 +4951,6 @@ st_new_shader_program(struct gl_context *ctx, GLuint name)
GLboolean
st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
{
- int num_clip_distances[MESA_SHADER_TYPES];
assert(prog->LinkStatus);
for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
@@ -4994,11 +4962,6 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
const struct gl_shader_compiler_options *options =
&ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(prog->_LinkedShaders[i]->Type)];
- /* We have to determine the length of the gl_ClipDistance array before
- * the array is lowered to two vec4s by lower_clip_distance().
- */
- num_clip_distances[i] = get_clip_distance_size(ir);
-
do {
unsigned what_to_lower = MOD_TO_FRACT | DIV_TO_MUL_RCP |
EXP_TO_EXP2 | LOG_TO_LOG2;
@@ -5020,7 +4983,6 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
|| progress;
progress = lower_quadop_vector(ir, false) || progress;
- progress = lower_clip_distance(ir) || progress;
if (options->MaxIfDepth == 0)
progress = lower_discard(ir) || progress;
@@ -5055,8 +5017,7 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
if (prog->_LinkedShaders[i] == NULL)
continue;
- linked_prog = get_mesa_program(ctx, prog, prog->_LinkedShaders[i],
- num_clip_distances[i]);
+ linked_prog = get_mesa_program(ctx, prog, prog->_LinkedShaders[i]);
if (linked_prog) {
static const GLenum targets[] = {
diff --git a/mesalib/src/mesa/vbo/vbo.h b/mesalib/src/mesa/vbo/vbo.h
index 4387e10b7..eb06bf9b5 100644
--- a/mesalib/src/mesa/vbo/vbo.h
+++ b/mesalib/src/mesa/vbo/vbo.h
@@ -51,6 +51,7 @@ struct _mesa_prim {
GLuint count;
GLint basevertex;
GLsizei num_instances;
+ GLuint base_instance;
};
/* Would like to call this a "vbo_index_buffer", but this would be
diff --git a/mesalib/src/mesa/vbo/vbo_exec_api.c b/mesalib/src/mesa/vbo/vbo_exec_api.c
index 28d2c4de9..bfa1b1db8 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_api.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_api.c
@@ -827,6 +827,7 @@ static void GLAPIENTRY vbo_exec_Begin( GLenum mode )
exec->vtx.prim[i].start = exec->vtx.vert_count;
exec->vtx.prim[i].count = 0;
exec->vtx.prim[i].num_instances = 1;
+ exec->vtx.prim[i].base_instance = 0;
ctx->Driver.CurrentExecPrimitive = mode;
}
diff --git a/mesalib/src/mesa/vbo/vbo_exec_array.c b/mesalib/src/mesa/vbo/vbo_exec_array.c
index 3fb7c6480..ebf008536 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_array.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_array.c
@@ -581,7 +581,7 @@ vbo_handle_primitive_restart(struct gl_context *ctx,
*/
static void
vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
- GLsizei count, GLuint numInstances)
+ GLsizei count, GLuint numInstances, GLuint baseInstance)
{
struct vbo_context *vbo = vbo_context(ctx);
struct vbo_exec_context *exec = &vbo->exec;
@@ -595,6 +595,7 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
prim[0].end = 1;
prim[0].mode = mode;
prim[0].num_instances = numInstances;
+ prim[0].base_instance = baseInstance;
/* Implement the primitive restart index */
if (ctx->Array.PrimitiveRestart && ctx->Array.RestartIndex < count) {
@@ -673,7 +674,7 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count)
if (0)
check_draw_arrays_data(ctx, start, count);
- vbo_draw_arrays(ctx, mode, start, count, 1);
+ vbo_draw_arrays(ctx, mode, start, count, 1, 0);
if (0)
print_draw_arrays(ctx, mode, start, count);
@@ -702,7 +703,7 @@ vbo_exec_DrawArraysInstanced(GLenum mode, GLint start, GLsizei count,
if (0)
check_draw_arrays_data(ctx, start, count);
- vbo_draw_arrays(ctx, mode, start, count, numInstances);
+ vbo_draw_arrays(ctx, mode, start, count, numInstances, 0);
if (0)
print_draw_arrays(ctx, mode, start, count);
@@ -710,6 +711,40 @@ vbo_exec_DrawArraysInstanced(GLenum mode, GLint start, GLsizei count,
/**
+ * Called from glDrawArraysInstancedBaseInstance when in immediate mode.
+ */
+static void GLAPIENTRY
+vbo_exec_DrawArraysInstancedBaseInstance(GLenum mode, GLint first, GLsizei count,
+ GLsizei numInstances, GLuint baseInstance)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (MESA_VERBOSE & VERBOSE_DRAW)
+ _mesa_debug(ctx, "glDrawArraysInstancedBaseInstance(%s, %d, %d, %d, %d)\n",
+ _mesa_lookup_enum_by_nr(mode), first, count,
+ numInstances, baseInstance);
+
+ if (!_mesa_validate_DrawArraysInstanced(ctx, mode, first, count,
+ numInstances))
+ return;
+
+ FLUSH_CURRENT(ctx, 0);
+
+ if (!_mesa_valid_to_render(ctx, "glDrawArraysInstancedBaseInstance"))
+ return;
+
+ if (0)
+ check_draw_arrays_data(ctx, first, count);
+
+ vbo_draw_arrays(ctx, mode, first, count, numInstances, baseInstance);
+
+ if (0)
+ print_draw_arrays(ctx, mode, first, count);
+}
+
+
+
+/**
* Map GL_ELEMENT_ARRAY_BUFFER and print contents.
* For debugging.
*/
@@ -779,7 +814,8 @@ vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode,
GLuint start, GLuint end,
GLsizei count, GLenum type,
const GLvoid *indices,
- GLint basevertex, GLint numInstances)
+ GLint basevertex, GLint numInstances,
+ GLuint baseInstance)
{
struct vbo_context *vbo = vbo_context(ctx);
struct vbo_exec_context *exec = &vbo->exec;
@@ -803,6 +839,7 @@ vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode,
prim[0].indexed = 1;
prim[0].basevertex = basevertex;
prim[0].num_instances = numInstances;
+ prim[0].base_instance = baseInstance;
/* Need to give special consideration to rendering a range of
* indices starting somewhere above zero. Typically the
@@ -927,7 +964,7 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
#endif
vbo_validated_drawrangeelements(ctx, mode, index_bounds_valid, start, end,
- count, type, indices, basevertex, 1);
+ count, type, indices, basevertex, 1, 0);
}
@@ -971,7 +1008,7 @@ vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type,
return;
vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
- count, type, indices, 0, 1);
+ count, type, indices, 0, 1, 0);
}
@@ -996,7 +1033,7 @@ vbo_exec_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
return;
vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
- count, type, indices, basevertex, 1);
+ count, type, indices, basevertex, 1, 0);
}
@@ -1021,9 +1058,10 @@ vbo_exec_DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type,
return;
vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
- count, type, indices, 0, numInstances);
+ count, type, indices, 0, numInstances, 0);
}
+
/**
* Called by glDrawElementsInstancedBaseVertex() in immediate mode.
*/
@@ -1047,7 +1085,59 @@ vbo_exec_DrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type
return;
vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
- count, type, indices, basevertex, numInstances);
+ count, type, indices, basevertex, numInstances, 0);
+}
+
+
+/**
+ * Called by glDrawElementsInstancedBaseInstance() in immediate mode.
+ */
+static void GLAPIENTRY
+vbo_exec_DrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum type,
+ const GLvoid *indices, GLsizei numInstances,
+ GLuint baseInstance)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (MESA_VERBOSE & VERBOSE_DRAW)
+ _mesa_debug(ctx, "glDrawElementsInstancedBaseInstance(%s, %d, %s, %p, %d, %d)\n",
+ _mesa_lookup_enum_by_nr(mode), count,
+ _mesa_lookup_enum_by_nr(type), indices,
+ numInstances, baseInstance);
+
+ if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices,
+ numInstances, 0))
+ return;
+
+ vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
+ count, type, indices, 0, numInstances,
+ baseInstance);
+}
+
+
+/**
+ * Called by glDrawElementsInstancedBaseVertexBaseInstance() in immediate mode.
+ */
+static void GLAPIENTRY
+vbo_exec_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count, GLenum type,
+ const GLvoid *indices, GLsizei numInstances,
+ GLint basevertex, GLuint baseInstance)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (MESA_VERBOSE & VERBOSE_DRAW)
+ _mesa_debug(ctx, "glDrawElementsInstancedBaseVertexBaseInstance(%s, %d, %s, %p, %d, %d, %d)\n",
+ _mesa_lookup_enum_by_nr(mode), count,
+ _mesa_lookup_enum_by_nr(type), indices,
+ numInstances, basevertex, baseInstance);
+
+ if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices,
+ numInstances, basevertex))
+ return;
+
+ vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
+ count, type, indices, basevertex, numInstances,
+ baseInstance);
}
@@ -1128,6 +1218,7 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
prim[i].count = count[i];
prim[i].indexed = 1;
prim[i].num_instances = 1;
+ prim[i].base_instance = 0;
if (basevertex != NULL)
prim[i].basevertex = basevertex[i];
else
@@ -1154,6 +1245,7 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
prim[0].count = count[i];
prim[0].indexed = 1;
prim[0].num_instances = 1;
+ prim[0].base_instance = 0;
if (basevertex != NULL)
prim[0].basevertex = basevertex[i];
else
@@ -1236,6 +1328,7 @@ vbo_draw_transform_feedback(struct gl_context *ctx, GLenum mode,
prim[0].end = 1;
prim[0].mode = mode;
prim[0].num_instances = numInstances;
+ prim[0].base_instance = 0;
/* Maybe we should do some primitive splitting for primitive restart
* (like in DrawArrays), but we have no way to know how many vertices
@@ -1295,8 +1388,11 @@ vbo_exec_array_init( struct vbo_exec_context *exec )
exec->vtxfmt.DrawRangeElementsBaseVertex = vbo_exec_DrawRangeElementsBaseVertex;
exec->vtxfmt.MultiDrawElementsBaseVertex = vbo_exec_MultiDrawElementsBaseVertex;
exec->vtxfmt.DrawArraysInstanced = vbo_exec_DrawArraysInstanced;
+ exec->vtxfmt.DrawArraysInstancedBaseInstance = vbo_exec_DrawArraysInstancedBaseInstance;
exec->vtxfmt.DrawElementsInstanced = vbo_exec_DrawElementsInstanced;
+ exec->vtxfmt.DrawElementsInstancedBaseInstance = vbo_exec_DrawElementsInstancedBaseInstance;
exec->vtxfmt.DrawElementsInstancedBaseVertex = vbo_exec_DrawElementsInstancedBaseVertex;
+ exec->vtxfmt.DrawElementsInstancedBaseVertexBaseInstance = vbo_exec_DrawElementsInstancedBaseVertexBaseInstance;
#if FEATURE_EXT_transform_feedback
exec->vtxfmt.DrawTransformFeedback = vbo_exec_DrawTransformFeedback;
#endif
diff --git a/mesalib/src/mesa/vbo/vbo_save_api.c b/mesalib/src/mesa/vbo/vbo_save_api.c
index f202375ca..b2c9dd5f0 100644
--- a/mesalib/src/mesa/vbo/vbo_save_api.c
+++ b/mesalib/src/mesa/vbo/vbo_save_api.c
@@ -471,6 +471,7 @@ _save_wrap_buffers(struct gl_context *ctx)
save->prim[0].start = 0;
save->prim[0].count = 0;
save->prim[0].num_instances = 1;
+ save->prim[0].base_instance = 0;
save->prim_count = 1;
}
@@ -907,6 +908,7 @@ vbo_save_NotifyBegin(struct gl_context *ctx, GLenum mode)
save->prim[i].start = save->vert_count;
save->prim[i].count = 0;
save->prim[i].num_instances = 1;
+ save->prim[i].base_instance = 0;
if (save->out_of_memory) {
_mesa_install_save_vtxfmt(ctx, &save->vtxfmt_noop);
diff --git a/mesalib/src/mesa/vbo/vbo_split_inplace.c b/mesalib/src/mesa/vbo/vbo_split_inplace.c
index 00464049d..686b30a76 100644
--- a/mesalib/src/mesa/vbo/vbo_split_inplace.c
+++ b/mesalib/src/mesa/vbo/vbo_split_inplace.c
@@ -180,13 +180,14 @@ static void split_prims( struct split_context *split)
nr = MIN2( available, remaining );
nr -= (nr - first) % incr;
-
+
outprim->mode = prim->mode;
outprim->begin = (j == 0 && prim->begin);
outprim->end = (nr == remaining && prim->end);
outprim->start = prim->start + j;
outprim->count = nr;
outprim->num_instances = prim->num_instances;
+ outprim->base_instance = prim->base_instance;
update_index_bounds(split, outprim);
@@ -225,12 +226,13 @@ static void split_prims( struct split_context *split)
ib.type = GL_UNSIGNED_INT;
ib.obj = split->ctx->Shared->NullBufferObj;
ib.ptr = elts;
-
+
tmpprim = *prim;
tmpprim.indexed = 1;
tmpprim.start = 0;
tmpprim.count = count;
tmpprim.num_instances = 1;
+ tmpprim.base_instance = 0;
flush_vertex(split);