summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_draw.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/state_tracker/st_draw.c')
-rw-r--r--src/mesa/state_tracker/st_draw.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index e78d98f1e9..b52e488612 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -223,7 +223,7 @@ setup_edgeflags(GLcontext *ctx, GLenum primMode, GLint start, GLint count,
if (!stobj)
return NULL;
- vec = (unsigned *) calloc(sizeof(unsigned), (count + 31) / 32);
+ vec = (unsigned *) _mesa_calloc(sizeof(unsigned) * ((count + 31) / 32));
if (!vec)
return NULL;
@@ -301,18 +301,17 @@ is_interleaved_arrays(const struct st_vertex_program *vp,
}
*userSpace = (num_client_arrays == vp->num_inputs);
- /*printf("user space: %d\n", (int) *userSpace);*/
+ /* printf("user space: %d (%d %d)\n", (int) *userSpace,num_client_arrays,vp->num_inputs); */
return GL_TRUE;
}
/**
- * Once we know all the arrays are in user space, this function
- * computes the memory range occupied by the arrays.
+ * Compute the memory range occupied by the arrays.
*/
static void
-get_user_arrays_bounds(const struct st_vertex_program *vp,
+get_arrays_bounds(const struct st_vertex_program *vp,
const struct gl_client_array **arrays,
GLuint max_index,
const GLubyte **low, const GLubyte **high)
@@ -366,22 +365,23 @@ setup_interleaved_attribs(GLcontext *ctx,
/*printf("stobj %u = %p\n", attr, (void*)stobj);*/
if (attr == 0) {
+ const GLubyte *low, *high;
+
+ get_arrays_bounds(vp, arrays, max_index, &low, &high);
+ /*printf("buffer range: %p %p %d\n", low, high, high-low);*/
+
+ offset0 = low;
if (userSpace) {
- const GLubyte *low, *high;
- get_user_arrays_bounds(vp, arrays, max_index, &low, &high);
- /*printf("user buffer range: %p %p %d\n", low, high, high-low);*/
vbuffer->buffer =
pipe_user_buffer_create(pipe->screen, (void *) low, high - low);
vbuffer->buffer_offset = 0;
- offset0 = low;
}
else {
vbuffer->buffer = NULL;
pipe_buffer_reference(pipe->screen, &vbuffer->buffer, stobj->buffer);
- vbuffer->buffer_offset = (unsigned) arrays[mesaAttr]->Ptr;
- offset0 = arrays[mesaAttr]->Ptr;
+ vbuffer->buffer_offset = (unsigned) low;
}
- vbuffer->pitch = stride; /* in bytes */
+ vbuffer->stride = stride; /* in bytes */
vbuffer->max_index = max_index;
}
@@ -472,7 +472,7 @@ setup_non_interleaved_attribs(GLcontext *ctx,
assert(velements[attr].src_offset <= 2048); /* 11-bit field */
/* common-case setup */
- vbuffer[attr].pitch = stride; /* in bytes */
+ vbuffer[attr].stride = stride; /* in bytes */
vbuffer[attr].max_index = max_index;
velements[attr].vertex_buffer_index = attr;
velements[attr].nr_components = arrays[mesaAttr]->Size;
@@ -541,9 +541,11 @@ st_draw_vbo(GLcontext *ctx,
vp = ctx->st->vp;
vs = &ctx->st->vp->state;
+#if 0
if (MESA_VERBOSE & VERBOSE_GLSL) {
check_uniforms(ctx);
}
+#endif
/*
* Setup the vbuffer[] and velements[] arrays.
@@ -569,7 +571,7 @@ st_draw_vbo(GLcontext *ctx,
{
GLuint i;
for (i = 0; i < num_vbuffers; i++) {
- printf("buffers[%d].pitch = %u\n", i, vbuffer[i].pitch);
+ printf("buffers[%d].stride = %u\n", i, vbuffer[i].stride);
printf("buffers[%d].max_index = %u\n", i, vbuffer[i].max_index);
printf("buffers[%d].buffer_offset = %u\n", i, vbuffer[i].buffer_offset);
printf("buffers[%d].buffer = %p\n", i, (void*) vbuffer[i].buffer);