aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-05-21 09:10:35 +0200
committermarha <marha@users.sourceforge.net>2012-05-21 09:10:35 +0200
commitf543ceaca6820260f15a4eff86938214cf43c7d2 (patch)
treed66901c0385bd008ba46600be695c500daa78c8f /mesalib/src/mesa/state_tracker
parent062c45ff0df6a52080dcd74433710d47127cbe29 (diff)
downloadvcxsrv-f543ceaca6820260f15a4eff86938214cf43c7d2.tar.gz
vcxsrv-f543ceaca6820260f15a4eff86938214cf43c7d2.tar.bz2
vcxsrv-f543ceaca6820260f15a4eff86938214cf43c7d2.zip
fontconfig mesa xkeyboard-config xserver pixman git update 21 Mar 2012
Diffstat (limited to 'mesalib/src/mesa/state_tracker')
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c3
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.h1
-rw-r--r--mesalib/src/mesa/state_tracker/st_draw.c181
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_program.c23
-rw-r--r--mesalib/src/mesa/state_tracker/st_program.h4
7 files changed, 34 insertions, 182 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
index 6534a4347..b47a2d87f 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -195,6 +195,9 @@ st_bufferobj_data(struct gl_context *ctx,
case GL_ELEMENT_ARRAY_BUFFER_ARB:
bind = PIPE_BIND_INDEX_BUFFER;
break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER:
+ bind = PIPE_BIND_STREAM_OUTPUT;
+ break;
default:
bind = 0;
}
diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c
index b44976525..132dcc02f 100644
--- a/mesalib/src/mesa/state_tracker/st_context.c
+++ b/mesalib/src/mesa/state_tracker/st_context.c
@@ -247,7 +247,7 @@ static void st_destroy_context_priv( struct st_context *st )
st_destroy_drawtex(st);
for (i = 0; i < Elements(st->state.sampler_views); i++) {
- pipe_sampler_view_reference(&st->state.sampler_views[i], NULL);
+ pipe_sampler_view_release(st->pipe, &st->state.sampler_views[i]);
}
if (st->default_texture) {
diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h
index 00a405b69..55ae65b3c 100644
--- a/mesalib/src/mesa/state_tracker/st_context.h
+++ b/mesalib/src/mesa/state_tracker/st_context.h
@@ -79,7 +79,6 @@ struct st_context
struct draw_stage *feedback_stage; /**< For GL_FEEDBACK rendermode */
struct draw_stage *selection_stage; /**< For GL_SELECT rendermode */
struct draw_stage *rastpos_stage; /**< For glRasterPos */
- GLboolean sw_primitive_restart;
GLboolean clamp_frag_color_in_shader;
GLboolean clamp_vert_color_in_shader;
diff --git a/mesalib/src/mesa/state_tracker/st_draw.c b/mesalib/src/mesa/state_tracker/st_draw.c
index a8c20f45a..0a06e9995 100644
--- a/mesalib/src/mesa/state_tracker/st_draw.c
+++ b/mesalib/src/mesa/state_tracker/st_draw.c
@@ -638,175 +638,6 @@ check_uniforms(struct gl_context *ctx)
}
-/*
- * Notes on primitive restart:
- * The code below is used when the gallium driver does not support primitive
- * restart itself. We map the index buffer, find the restart indexes, unmap
- * the index buffer then draw the sub-primitives delineated by the restarts.
- * A couple possible optimizations:
- * 1. Save the list of sub-primitive (start, count) values in a list attached
- * to the index buffer for re-use in subsequent draws. The list would be
- * invalidated when the contents of the buffer changed.
- * 2. If drawing triangle strips or quad strips, create a new index buffer
- * that uses duplicated vertices to render the disjoint strips as one
- * long strip. We'd have to be careful to avoid using too much memory
- * for this.
- * Finally, some apps might perform better if they don't use primitive restart
- * at all rather than this fallback path. Set MESA_EXTENSION_OVERRIDE to
- * "-GL_NV_primitive_restart" to test that.
- */
-
-
-struct sub_primitive
-{
- unsigned start, count;
-};
-
-
-/**
- * Scan the elements array to find restart indexes. Return a list
- * of primitive (start,count) pairs to indicate how to draw the sub-
- * primitives delineated by the restart index.
- */
-static struct sub_primitive *
-find_sub_primitives(const void *elements, unsigned element_size,
- unsigned start, unsigned end, unsigned restart_index,
- unsigned *num_sub_prims)
-{
- const unsigned max_prims = end - start;
- struct sub_primitive *sub_prims;
- unsigned i, cur_start, cur_count, num;
-
- sub_prims = (struct sub_primitive *)
- malloc(max_prims * sizeof(struct sub_primitive));
-
- if (!sub_prims) {
- *num_sub_prims = 0;
- return NULL;
- }
-
- cur_start = start;
- cur_count = 0;
- num = 0;
-
-#define SCAN_ELEMENTS(TYPE) \
- for (i = start; i < end; i++) { \
- if (((const TYPE *) elements)[i] == restart_index) { \
- if (cur_count > 0) { \
- assert(num < max_prims); \
- sub_prims[num].start = cur_start; \
- sub_prims[num].count = cur_count; \
- num++; \
- } \
- cur_start = i + 1; \
- cur_count = 0; \
- } \
- else { \
- cur_count++; \
- } \
- } \
- if (cur_count > 0) { \
- assert(num < max_prims); \
- sub_prims[num].start = cur_start; \
- sub_prims[num].count = cur_count; \
- num++; \
- }
-
- switch (element_size) {
- case 1:
- SCAN_ELEMENTS(ubyte);
- break;
- case 2:
- SCAN_ELEMENTS(ushort);
- break;
- case 4:
- SCAN_ELEMENTS(uint);
- break;
- default:
- assert(0 && "bad index_size in find_sub_primitives()");
- }
-
-#undef SCAN_ELEMENTS
-
- *num_sub_prims = num;
-
- return sub_prims;
-}
-
-
-/**
- * For gallium drivers that don't support the primitive restart
- * feature, handle it here by breaking up the indexed primitive into
- * sub-primitives.
- */
-static void
-handle_fallback_primitive_restart(struct cso_context *cso,
- struct pipe_context *pipe,
- const struct _mesa_index_buffer *ib,
- struct pipe_index_buffer *ibuffer,
- struct pipe_draw_info *orig_info)
-{
- const unsigned start = orig_info->start;
- const unsigned count = orig_info->count;
- struct pipe_draw_info info = *orig_info;
- struct pipe_transfer *transfer = NULL;
- unsigned instance, i;
- const void *ptr = NULL;
- struct sub_primitive *sub_prims;
- unsigned num_sub_prims;
-
- assert(info.indexed);
- assert(ibuffer->buffer || ibuffer->user_buffer);
- assert(ib);
-
- if (!ibuffer->buffer || !ibuffer->user_buffer || !ib)
- return;
-
- info.primitive_restart = FALSE;
- info.instance_count = 1;
-
- if (_mesa_is_bufferobj(ib->obj)) {
- ptr = pipe_buffer_map_range(pipe, ibuffer->buffer,
- start * ibuffer->index_size, /* start */
- count * ibuffer->index_size, /* length */
- PIPE_TRANSFER_READ, &transfer);
- if (!ptr)
- return;
-
- ptr = (uint8_t*)ptr + (ibuffer->offset - start * ibuffer->index_size);
- }
- else {
- ptr = ib->ptr;
- if (!ptr)
- return;
- }
-
- sub_prims = find_sub_primitives(ptr, ibuffer->index_size,
- 0, count, orig_info->restart_index,
- &num_sub_prims);
-
- if (transfer)
- pipe_buffer_unmap(pipe, transfer);
-
- /* Now draw the sub primitives.
- * Need to loop over instances as well to preserve draw order.
- */
- for (instance = 0; instance < orig_info->instance_count; instance++) {
- info.start_instance = instance + orig_info->start_instance;
- for (i = 0; i < num_sub_prims; i++) {
- info.start = sub_prims[i].start;
- info.count = sub_prims[i].count;
- if (u_trim_pipe_prim(info.mode, &info.count)) {
- cso_draw_vbo(cso, &info);
- }
- }
- }
-
- if (sub_prims)
- free(sub_prims);
-}
-
-
/**
* Translate OpenGL primtive type (GL_POINTS, GL_TRIANGLE_STRIP, etc) to
* the corresponding Gallium type.
@@ -901,7 +732,6 @@ st_draw_vbo(struct gl_context *ctx,
struct gl_transform_feedback_object *tfb_vertcount)
{
struct st_context *st = st_context(ctx);
- struct pipe_context *pipe = st->pipe;
struct pipe_index_buffer ibuffer = {0};
struct pipe_draw_info info;
const struct gl_client_array **arrays = ctx->Array._DrawArrays;
@@ -994,15 +824,8 @@ st_draw_vbo(struct gl_context *ctx,
cso_draw_vbo(st->cso_context, &info);
}
else if (info.primitive_restart) {
- if (st->sw_primitive_restart) {
- /* Handle primitive restart for drivers that doesn't support it */
- handle_fallback_primitive_restart(st->cso_context, pipe, ib,
- &ibuffer, &info);
- }
- else {
- /* don't trim, restarts might be inside index list */
- cso_draw_vbo(st->cso_context, &info);
- }
+ /* don't trim, restarts might be inside index list */
+ cso_draw_vbo(st->cso_context, &info);
}
else if (u_trim_pipe_prim(info.mode, &info.count))
cso_draw_vbo(st->cso_context, &info);
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 1b4bca681..953155f36 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -601,7 +601,7 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.NV_primitive_restart = GL_TRUE;
if (!screen->get_param(screen, PIPE_CAP_PRIMITIVE_RESTART)) {
- st->sw_primitive_restart = GL_TRUE;
+ ctx->Const.PrimitiveRestartInSoftware = GL_TRUE;
}
if (screen->get_param(screen, PIPE_CAP_VERTEX_COLOR_UNCLAMPED)) {
diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c
index deee722cf..e6664fb7c 100644
--- a/mesalib/src/mesa/state_tracker/st_program.c
+++ b/mesalib/src/mesa/state_tracker/st_program.c
@@ -1285,3 +1285,26 @@ st_destroy_program_variants(struct st_context *st)
_mesa_HashWalk(st->ctx->Shared->ShaderObjects,
destroy_shader_program_variants_cb, st);
}
+
+
+/**
+ * For debugging, print/dump the current vertex program.
+ */
+void
+st_print_current_vertex_program(void)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (ctx->VertexProgram._Current) {
+ struct st_vertex_program *stvp =
+ (struct st_vertex_program *) ctx->VertexProgram._Current;
+ struct st_vp_variant *stv;
+
+ debug_printf("Vertex program %u\n", stvp->Base.Base.Id);
+
+ for (stv = stvp->variants; stv; stv = stv->next) {
+ debug_printf("variant %p\n", stv);
+ tgsi_dump(stv->tgsi.tokens, 0);
+ }
+ }
+}
diff --git a/mesalib/src/mesa/state_tracker/st_program.h b/mesalib/src/mesa/state_tracker/st_program.h
index 6c4b4f6c3..23a262ccc 100644
--- a/mesalib/src/mesa/state_tracker/st_program.h
+++ b/mesalib/src/mesa/state_tracker/st_program.h
@@ -315,4 +315,8 @@ extern void
st_destroy_program_variants(struct st_context *st);
+extern void
+st_print_current_vertex_program(void);
+
+
#endif