mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
util/prim_restart: pre-trim degenerate primitives during draw rewrite
these will be eliminated by drivers anyway Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10966>
This commit is contained in:
parent
5d54b64e6d
commit
69d47fdd7a
1 changed files with 7 additions and 2 deletions
|
|
@ -28,6 +28,7 @@
|
|||
#include "u_inlines.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "u_prim_restart.h"
|
||||
#include "u_prim.h"
|
||||
|
||||
typedef struct {
|
||||
uint32_t count;
|
||||
|
|
@ -184,8 +185,12 @@ struct range_info {
|
|||
* \return true for success, false if out of memory
|
||||
*/
|
||||
static boolean
|
||||
add_range(struct range_info *info, unsigned start, unsigned count)
|
||||
add_range(enum pipe_prim_type mode, struct range_info *info, unsigned start, unsigned count)
|
||||
{
|
||||
/* degenerate primitive: ignore */
|
||||
if (!u_trim_pipe_prim(mode, (unsigned*)&count))
|
||||
return TRUE;
|
||||
|
||||
if (info->max == 0) {
|
||||
info->max = 10;
|
||||
info->ranges = MALLOC(info->max * sizeof(struct range));
|
||||
|
|
@ -285,7 +290,7 @@ util_draw_vbo_without_prim_restart(struct pipe_context *context,
|
|||
((const TYPE *) src_map)[i] == info->restart_index) { \
|
||||
/* cut / restart */ \
|
||||
if (count > 0) { \
|
||||
if (!add_range(&ranges, info_start + start, count)) { \
|
||||
if (!add_range(info->mode, &ranges, info_start + start, count)) { \
|
||||
if (src_transfer) \
|
||||
pipe_buffer_unmap(context, src_transfer); \
|
||||
return PIPE_ERROR_OUT_OF_MEMORY; \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue