int size = glarray->Size;
if (unlikely(INTEL_DEBUG & DEBUG_VERTS))
- printf("type %s size %d normalized %d\n",
- _mesa_lookup_enum_by_nr(glarray->Type),
- glarray->Size, glarray->Normalized);
+ fprintf(stderr, "type %s size %d normalized %d\n",
+ _mesa_lookup_enum_by_nr(glarray->Type),
+ glarray->Size, glarray->Normalized);
if (glarray->Integer) {
assert(glarray->Format == GL_RGBA); /* sanity check */
const unsigned char *src = element->glarray->Ptr + min * src_stride;
int count = max - min + 1;
GLuint size = count * dst_stride;
+ uint8_t *dst = intel_upload_space(brw, size, dst_stride,
+ &buffer->bo, &buffer->offset);
if (dst_stride == src_stride) {
- intel_upload_data(brw, src, size, dst_stride,
- &buffer->bo, &buffer->offset);
+ memcpy(dst, src, size);
} else {
- char * const map = intel_upload_map(brw, size, dst_stride);
- char *dst = map;
-
while (count--) {
memcpy(dst, src, dst_stride);
src += src_stride;
dst += dst_stride;
}
- intel_upload_unmap(brw, map, size, dst_stride,
- &buffer->bo, &buffer->offset);
}
buffer->stride = dst_stride;
}
}
if (0)
- printf("%s %d..%d\n", __FUNCTION__, min_index, max_index);
+ fprintf(stderr, "%s %d..%d\n", __FUNCTION__, min_index, max_index);
/* Accumulate the list of enabled arrays. */
brw->vb.nr_enabled = 0;
uint32_t comp2 = BRW_VE1_COMPONENT_STORE_SRC;
uint32_t comp3 = BRW_VE1_COMPONENT_STORE_SRC;
- /* The gen4 driver expects edgeflag to come in as a float, and passes
- * that float on to the tests in the clipper. Mesa's current vertex
- * attribute value for EdgeFlag is stored as a float, which works out.
- * glEdgeFlagPointer, on the other hand, gives us an unnormalized
- * integer ubyte. Just rewrite that to convert to a float.
- */
- if (input->attrib == VERT_ATTRIB_EDGEFLAG) {
+ if (input == &brw->vb.inputs[VERT_ATTRIB_EDGEFLAG]) {
/* Gen6+ passes edgeflag as sideband along with the vertex, instead
* of in the VUE. We have to upload it sideband as the last vertex
* element according to the B-Spec.
gen6_edgeflag_input = input;
continue;
}
-
- if (format == BRW_SURFACEFORMAT_R8_UINT)
- format = BRW_SURFACEFORMAT_R8_SSCALED;
}
switch (input->glarray->Size) {
struct gl_context *ctx = &brw->ctx;
const struct _mesa_index_buffer *index_buffer = brw->ib.ib;
GLuint ib_size;
- drm_intel_bo *bo = NULL;
+ drm_intel_bo *old_bo = brw->ib.bo;
struct gl_buffer_object *bufferobj;
GLuint offset;
GLuint ib_type_size;
/* Turn into a proper VBO:
*/
if (!_mesa_is_bufferobj(bufferobj)) {
-
/* Get new bufferobj, offset:
*/
intel_upload_data(brw, index_buffer->ptr, ib_size, ib_type_size,
- &bo, &offset);
- brw->ib.start_vertex_offset = offset / ib_type_size;
+ &brw->ib.bo, &offset);
} else {
offset = (GLuint) (unsigned long) index_buffer->ptr;
/* If the index buffer isn't aligned to its element size, we have to
* rebase it into a temporary.
*/
- if ((ib_type_size - 1) & offset) {
- perf_debug("copying index buffer to a temporary to work around "
- "misaligned offset %d\n", offset);
-
- GLubyte *map = ctx->Driver.MapBufferRange(ctx,
- offset,
- ib_size,
- GL_MAP_READ_BIT,
- bufferobj);
-
- intel_upload_data(brw, map, ib_size, ib_type_size, &bo, &offset);
- brw->ib.start_vertex_offset = offset / ib_type_size;
-
- ctx->Driver.UnmapBuffer(ctx, bufferobj);
- } else {
- /* Use CMD_3D_PRIM's start_vertex_offset to avoid re-uploading
- * the index buffer state when we're just moving the start index
- * of our drawing.
- */
- brw->ib.start_vertex_offset = offset / ib_type_size;
-
- bo = intel_bufferobj_buffer(brw, intel_buffer_object(bufferobj),
- offset, ib_size);
- drm_intel_bo_reference(bo);
- }
+ if ((ib_type_size - 1) & offset) {
+ perf_debug("copying index buffer to a temporary to work around "
+ "misaligned offset %d\n", offset);
+
+ GLubyte *map = ctx->Driver.MapBufferRange(ctx,
+ offset,
+ ib_size,
+ GL_MAP_READ_BIT,
+ bufferobj,
+ MAP_INTERNAL);
+
+ intel_upload_data(brw, map, ib_size, ib_type_size,
+ &brw->ib.bo, &offset);
+
+ ctx->Driver.UnmapBuffer(ctx, bufferobj, MAP_INTERNAL);
+ } else {
+ drm_intel_bo *bo =
+ intel_bufferobj_buffer(brw, intel_buffer_object(bufferobj),
+ offset, ib_size);
+ if (bo != brw->ib.bo) {
+ drm_intel_bo_unreference(brw->ib.bo);
+ brw->ib.bo = bo;
+ drm_intel_bo_reference(bo);
+ }
+ }
}
- if (brw->ib.bo != bo) {
- drm_intel_bo_unreference(brw->ib.bo);
- brw->ib.bo = bo;
+ /* Use 3DPRIMITIVE's start_vertex_offset to avoid re-uploading
+ * the index buffer state when we're just moving the start index
+ * of our drawing.
+ */
+ brw->ib.start_vertex_offset = offset / ib_type_size;
+ if (brw->ib.bo != old_bo)
brw->state.dirty.brw |= BRW_NEW_INDEX_BUFFER;
- } else {
- drm_intel_bo_unreference(bo);
- }
if (index_buffer->type != brw->ib.type) {
brw->ib.type = index_buffer->type;