mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
gallium/util: Drop unused translate_prim_restart_ib
Signed-off-by: António Monteiro <antonio.fmr.monteiro@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19428>
This commit is contained in:
parent
2c25d2ea90
commit
4abb08ac60
2 changed files with 0 additions and 85 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue