diff --git a/src/gallium/drivers/r300/ci/r300-r480-fails.txt b/src/gallium/drivers/r300/ci/r300-r480-fails.txt index d092bbe3b38..a18f099845b 100644 --- a/src/gallium/drivers/r300/ci/r300-r480-fails.txt +++ b/src/gallium/drivers/r300/ci/r300-r480-fails.txt @@ -3,7 +3,6 @@ dEQP-GLES2.functional.clipping.line.wide_line_clip_viewport_corner,Fail dEQP-GLES2.functional.clipping.point.wide_point_clip,Fail dEQP-GLES2.functional.clipping.point.wide_point_clip_viewport_center,Fail dEQP-GLES2.functional.clipping.point.wide_point_clip_viewport_corner,Fail -dEQP-GLES2.functional.draw.draw_elements.indices.user_ptr.index_byte,Fail dEQP-GLES2.functional.fbo.completeness.renderable.texture.color0.rgb_half_float_oes,Fail dEQP-GLES2.functional.fbo.render.repeated_clear.tex2d_rgb,Fail dEQP-GLES2.functional.fbo.render.repeated_clear.tex2d_rgba,Fail diff --git a/src/gallium/drivers/r300/ci/r300-rv380-fails.txt b/src/gallium/drivers/r300/ci/r300-rv380-fails.txt index 35e3dbde358..3e8fead58f1 100644 --- a/src/gallium/drivers/r300/ci/r300-rv380-fails.txt +++ b/src/gallium/drivers/r300/ci/r300-rv380-fails.txt @@ -3,7 +3,6 @@ dEQP-GLES2.functional.clipping.line.wide_line_clip_viewport_corner,Fail dEQP-GLES2.functional.clipping.point.wide_point_clip,Fail dEQP-GLES2.functional.clipping.point.wide_point_clip_viewport_center,Fail dEQP-GLES2.functional.clipping.point.wide_point_clip_viewport_corner,Fail -dEQP-GLES2.functional.draw.draw_elements.indices.user_ptr.index_byte,Fail dEQP-GLES2.functional.fbo.completeness.renderable.texture.color0.rgb_half_float_oes,Fail dEQP-GLES2.functional.fbo.render.repeated_clear.tex2d_rgb,Fail dEQP-GLES2.functional.fbo.render.repeated_clear.tex2d_rgba,Fail diff --git a/src/gallium/drivers/r300/ci/r300-rv530-nohiz-fails.txt b/src/gallium/drivers/r300/ci/r300-rv530-nohiz-fails.txt index 4d0ce1121ee..55dfa49640c 100644 --- a/src/gallium/drivers/r300/ci/r300-rv530-nohiz-fails.txt +++ b/src/gallium/drivers/r300/ci/r300-rv530-nohiz-fails.txt @@ -5,7 +5,6 @@ dEQP-GLES2.functional.clipping.point.wide_point_clip_viewport_corner,Fail dEQP-GLES2.functional.clipping.line.wide_line_clip_viewport_center,Fail dEQP-GLES2.functional.clipping.line.wide_line_clip_viewport_corner,Fail -dEQP-GLES2.functional.draw.draw_elements.indices.user_ptr.index_byte,Fail # "Framebuffer checked as complete, expected incomplete" dEQP-GLES2.functional.fbo.completeness.renderable.texture.color0.rgb_half_float_oes,Fail diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 8a7baa44450..bd1be07ef1d 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -727,7 +727,8 @@ void r300_translate_index_buffer(struct r300_context *r300, const struct pipe_draw_info *info, struct pipe_resource **out_index_buffer, unsigned *index_size, unsigned index_offset, - unsigned *start, unsigned count); + unsigned *start, unsigned count, + const uint8_t **export_ptr); /* r300_render_stencilref.c */ void r300_plug_in_stencil_ref_fallback(struct r300_context *r300); diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 9704be6836e..d3ed9f8ecc8 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -584,6 +584,7 @@ static void r300_draw_elements(struct r300_context *r300, unsigned short_count; int buffer_offset = 0, index_offset = 0; /* for index bias emulation */ uint16_t indices3[3]; + const uint8_t *local_ptr = info->index.user; if (draw->index_bias && !r300->screen->caps.is_r500) { r300_split_index_bias(r300, draw->index_bias, &buffer_offset, @@ -591,7 +592,7 @@ static void r300_draw_elements(struct r300_context *r300, } r300_translate_index_buffer(r300, info, &indexBuffer, - &indexSize, index_offset, &start, count); + &indexSize, index_offset, &start, count, &local_ptr); /* Fallback for misaligned ushort indices. */ if (indexSize == 2 && (start & 1) && indexBuffer) { @@ -611,10 +612,18 @@ static void r300_draw_elements(struct r300_context *r300, count, (uint8_t*)ptr); } } else { - if (info->has_user_indices) - r300_upload_index_buffer(r300, &indexBuffer, indexSize, + if (info->has_user_indices) { + struct pipe_resource* indexSaved = indexBuffer; + + if (local_ptr != info->index.user) + start = 0; + + r300_upload_index_buffer(r300, &indexBuffer, indexSize, &start, count, - info->index.user); + local_ptr); + + pipe_resource_reference(&indexSaved, NULL); + } } /* 19 dwords for emit_draw_elements. Give up if the function fails. */ diff --git a/src/gallium/drivers/r300/r300_render_translate.c b/src/gallium/drivers/r300/r300_render_translate.c index a143539157b..b579960c49a 100644 --- a/src/gallium/drivers/r300/r300_render_translate.c +++ b/src/gallium/drivers/r300/r300_render_translate.c @@ -12,20 +12,21 @@ void r300_translate_index_buffer(struct r300_context *r300, const struct pipe_draw_info *info, struct pipe_resource **out_buffer, unsigned *index_size, unsigned index_offset, - unsigned *start, unsigned count) + unsigned *start, unsigned count, + const uint8_t **export_ptr) { unsigned out_offset; - void *ptr; + void **ptr = (void **)export_ptr; switch (*index_size) { case 1: *out_buffer = NULL; u_upload_alloc(r300->uploader, 0, count * 2, 4, - &out_offset, out_buffer, &ptr); + &out_offset, out_buffer, ptr); util_shorten_ubyte_elts_to_userptr( &r300->context, info, PIPE_MAP_UNSYNCHRONIZED, index_offset, - *start, count, ptr); + *start, count, *ptr); *index_size = 2; *start = out_offset / 2; @@ -35,12 +36,12 @@ void r300_translate_index_buffer(struct r300_context *r300, if (index_offset) { *out_buffer = NULL; u_upload_alloc(r300->uploader, 0, count * 2, 4, - &out_offset, out_buffer, &ptr); + &out_offset, out_buffer, ptr); util_rebuild_ushort_elts_to_userptr(&r300->context, info, PIPE_MAP_UNSYNCHRONIZED, index_offset, *start, - count, ptr); + count, *ptr); *start = out_offset / 2; } @@ -50,12 +51,12 @@ void r300_translate_index_buffer(struct r300_context *r300, if (index_offset) { *out_buffer = NULL; u_upload_alloc(r300->uploader, 0, count * 4, 4, - &out_offset, out_buffer, &ptr); + &out_offset, out_buffer, ptr); util_rebuild_uint_elts_to_userptr(&r300->context, info, PIPE_MAP_UNSYNCHRONIZED, index_offset, *start, - count, ptr); + count, *ptr); *start = out_offset / 4; }