gallium/indices: translate primitive-restart values

This adds a config-option to u_primconvert that translates primitive
restart values to the max-values for the index size. This allows us to
support arbitrary primitive-restart indices on hardware that only
supports fixed restart-indices.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5976>
This commit is contained in:
Erik Faye-Lund 2020-06-25 12:26:54 +02:00 committed by Marge Bot
parent 21952f1400
commit f5cce8929a
2 changed files with 10 additions and 0 deletions

View File

@ -44,6 +44,7 @@
#include "util/u_draw.h"
#include "util/u_inlines.h"
#include "util/u_memory.h"
#include "util/u_prim_restart.h"
#include "util/u_upload_mgr.h"
#include "indices/u_indices.h"
@ -152,6 +153,14 @@ util_primconvert_draw_vbo(struct primconvert_context *pc,
if (info->index_size) {
trans_func(src, info->start, info->count, new_info.count, info->restart_index, dst);
if (pc->cfg.fixed_prim_restart && info->primitive_restart) {
new_info.restart_index = (1ull << (new_info.index_size * 8)) - 1;
if (info->restart_index != new_info.restart_index)
util_translate_prim_restart_data(new_info.index_size, dst, dst,
new_info.count,
info->restart_index);
}
}
else {
gen_func(info->start, new_info.count, dst);

View File

@ -33,6 +33,7 @@ struct primconvert_context;
struct primconvert_config {
uint32_t primtypes_mask;
bool fixed_prim_restart;
};
struct primconvert_context *util_primconvert_create(struct pipe_context *pipe,