From 4abb08ac60c28ad6afcefc79928654d19c8d67de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B3nio=20Monteiro?= Date: Mon, 31 Oct 2022 22:10:57 +0000 Subject: [PATCH] gallium/util: Drop unused translate_prim_restart_ib MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: António Monteiro Reviewed-by: Marek Olšák Part-of: --- src/gallium/auxiliary/util/u_prim_restart.c | 78 --------------------- src/gallium/auxiliary/util/u_prim_restart.h | 7 -- 2 files changed, 85 deletions(-) diff --git a/src/gallium/auxiliary/util/u_prim_restart.c b/src/gallium/auxiliary/util/u_prim_restart.c index 85ce9f17490..82fca678885 100644 --- a/src/gallium/auxiliary/util/u_prim_restart.c +++ b/src/gallium/auxiliary/util/u_prim_restart.c @@ -90,84 +90,6 @@ util_translate_prim_restart_data(unsigned index_size, } } -/** - * Translate an index buffer for primitive restart. - * Create a new index buffer which is a copy of the original index buffer - * except that instances of 'restart_index' are converted to 0xffff or - * 0xffffffff. - * Also, index buffers using 1-byte indexes are converted to 2-byte indexes. - */ -enum pipe_error -util_translate_prim_restart_ib(struct pipe_context *context, - const struct pipe_draw_info *info, - const struct pipe_draw_indirect_info *indirect_info, - const struct pipe_draw_start_count_bias *draw, - struct pipe_resource **dst_buffer) -{ - struct pipe_screen *screen = context->screen; - struct pipe_transfer *src_transfer = NULL, *dst_transfer = NULL; - void *src_map = NULL, *dst_map = NULL; - const unsigned src_index_size = info->index_size; - unsigned dst_index_size; - DrawElementsIndirectCommand indirect; - unsigned count = draw->count; - unsigned start = draw->start; - - /* 1-byte indexes are converted to 2-byte indexes, 4-byte stays 4-byte */ - dst_index_size = MAX2(2, info->index_size); - assert(dst_index_size == 2 || dst_index_size == 4); - - if (indirect_info && indirect_info->buffer) { - indirect = read_indirect_elements(context, indirect_info); - count = indirect.count; - start = indirect.firstIndex; - } - - /* Create new index buffer */ - *dst_buffer = pipe_buffer_create(screen, PIPE_BIND_INDEX_BUFFER, - PIPE_USAGE_STREAM, - count * dst_index_size); - if (!*dst_buffer) - goto error; - - /* Map new / dest index buffer */ - dst_map = pipe_buffer_map(context, *dst_buffer, - PIPE_MAP_WRITE, &dst_transfer); - if (!dst_map) - goto error; - - if (info->has_user_indices) - src_map = (unsigned char*)info->index.user + start * src_index_size; - else - /* Map original / src index buffer */ - src_map = pipe_buffer_map_range(context, info->index.resource, - start * src_index_size, - count * src_index_size, - PIPE_MAP_READ, - &src_transfer); - if (!src_map) - goto error; - - util_translate_prim_restart_data(src_index_size, src_map, dst_map, - count, info->restart_index); - - if (src_transfer) - pipe_buffer_unmap(context, src_transfer); - pipe_buffer_unmap(context, dst_transfer); - - return PIPE_OK; - -error: - if (src_transfer) - pipe_buffer_unmap(context, src_transfer); - if (dst_transfer) - pipe_buffer_unmap(context, dst_transfer); - if (*dst_buffer) - pipe_resource_reference(dst_buffer, NULL); - return PIPE_ERROR_OUT_OF_MEMORY; -} - - /** Helper structs for util_draw_vbo_without_prim_restart() */ struct range_info { diff --git a/src/gallium/auxiliary/util/u_prim_restart.h b/src/gallium/auxiliary/util/u_prim_restart.h index eb06b8e7744..45038d468a7 100644 --- a/src/gallium/auxiliary/util/u_prim_restart.h +++ b/src/gallium/auxiliary/util/u_prim_restart.h @@ -46,13 +46,6 @@ util_translate_prim_restart_data(unsigned index_size, void *src_map, void *dst_map, unsigned count, unsigned restart_index); -enum pipe_error -util_translate_prim_restart_ib(struct pipe_context *context, - const struct pipe_draw_info *info, - const struct pipe_draw_indirect_info *indirect, - const struct pipe_draw_start_count_bias *draw, - struct pipe_resource **dst_buffer); - struct pipe_draw_start_count_bias * util_prim_restart_convert_to_direct(const void *index_map, const struct pipe_draw_info *info,