diff --git a/.pick_status.json b/.pick_status.json index 946ea1b4bc5..8c4dacb31f1 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -3734,7 +3734,7 @@ "description": "r300: fix r300_draw_elements() behavior", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "330d0607ed60fd3edca192e54b4246310f06652f", "notes": null 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-rv370-fails.txt b/src/gallium/drivers/r300/ci/r300-rv370-fails.txt index 0c43c21baff..cd0b1b7b85d 100644 --- a/src/gallium/drivers/r300/ci/r300-rv370-fails.txt +++ b/src/gallium/drivers/r300/ci/r300-rv370-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.completeness.renderable.texture.color0.rgba_half_float_oes,Fail dEQP-GLES2.functional.fbo.render.repeated_clear.tex2d_rgb,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 07fa9e6435b..21a8043dcb8 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 d7a784ac083..ff0962e835e 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -744,7 +744,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 858d1798b48..978d7d6c59d 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -601,6 +601,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, @@ -608,7 +609,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) { @@ -628,10 +629,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 f3749815773..32d6a2ec5a9 100644 --- a/src/gallium/drivers/r300/r300_render_translate.c +++ b/src/gallium/drivers/r300/r300_render_translate.c @@ -29,20 +29,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; @@ -52,12 +53,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; } @@ -67,12 +68,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; }