mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 15:30:14 +01:00
gallium/indices: don't expand prim-type for 8-bit indices
Expanding the primitive-type has two undesirable effects: 1. It breaks primitive-restart. This is possible to fix by explicitly handling primitive-restart in more conversion routines. But u_indices_gen.py is kind of a mess, so it's not trivial as-is. 2. It changes the reported gl_VertexID. While it might be possible to work around this in each driver, it seems better to avoid this when we can. 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:
parent
0c85d6c523
commit
2122b902b8
1 changed files with 19 additions and 6 deletions
|
|
@ -45,6 +45,19 @@ static void translate_memcpy_uint( const void *in,
|
||||||
memcpy(out, &((int *)in)[start], out_nr*sizeof(int));
|
memcpy(out, &((int *)in)[start], out_nr*sizeof(int));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void translate_byte_to_ushort( const void *in,
|
||||||
|
unsigned start,
|
||||||
|
UNUSED unsigned in_nr,
|
||||||
|
unsigned out_nr,
|
||||||
|
UNUSED unsigned restart_index,
|
||||||
|
void *out )
|
||||||
|
{
|
||||||
|
uint8_t *src = (uint8_t *)in + start;
|
||||||
|
uint16_t *dst = out;
|
||||||
|
while (out_nr--) {
|
||||||
|
*dst++ = *src++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translate indexes when a driver can't support certain types
|
* Translate indexes when a driver can't support certain types
|
||||||
|
|
@ -98,14 +111,14 @@ u_index_translator(unsigned hw_mask,
|
||||||
out_idx = out_size_idx(*out_index_size);
|
out_idx = out_size_idx(*out_index_size);
|
||||||
|
|
||||||
if ((hw_mask & (1<<prim)) &&
|
if ((hw_mask & (1<<prim)) &&
|
||||||
in_index_size == *out_index_size &&
|
|
||||||
in_pv == out_pv)
|
in_pv == out_pv)
|
||||||
{
|
{
|
||||||
/* Index translation not really needed */
|
|
||||||
if (in_index_size == 4)
|
if (in_index_size == 4)
|
||||||
*out_translate = translate_memcpy_uint;
|
*out_translate = translate_memcpy_uint;
|
||||||
else
|
else if (in_index_size == 2)
|
||||||
*out_translate = translate_memcpy_ushort;
|
*out_translate = translate_memcpy_ushort;
|
||||||
|
else
|
||||||
|
*out_translate = translate_byte_to_ushort;
|
||||||
|
|
||||||
*out_prim = prim;
|
*out_prim = prim;
|
||||||
*out_nr = nr;
|
*out_nr = nr;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue