aligned for vectorization commor primitives, uint32_t cast for color comparison in batch collection
This commit is contained in:
@ -15,6 +15,7 @@
|
||||
|
||||
/* interleaved vertex array data */
|
||||
/* TODO: use int16_t for uvs */
|
||||
/* TODO: use packed types? */
|
||||
/* TODO: int16_t could be used for positioning, but we would need to have more CPU calcs */
|
||||
struct sprite_primitive_payload {
|
||||
/* upper-left */
|
||||
@ -113,7 +114,7 @@ static struct sprite_batch {
|
||||
.constant_colored = true,
|
||||
};
|
||||
|
||||
const t_color uniform_color = primitives[0].sprite.color;
|
||||
const uint32_t uniform_color = *(uint32_t *)&primitives[0].sprite.color;
|
||||
|
||||
/* batch size is clamped so that reallocated short indices could be used */
|
||||
if (len >= QUAD_ELEMENT_BUFFER_LENGTH)
|
||||
@ -136,10 +137,7 @@ static struct sprite_batch {
|
||||
break;
|
||||
|
||||
/* if all are modulated the same we can skip sending the color data */
|
||||
if (batch.constant_colored && (current->sprite.color.r != uniform_color.r ||
|
||||
current->sprite.color.g != uniform_color.g ||
|
||||
current->sprite.color.b != uniform_color.b ||
|
||||
current->sprite.color.a != uniform_color.a ))
|
||||
if (batch.constant_colored && *(uint32_t *)¤t->sprite.color == uniform_color)
|
||||
batch.constant_colored = false;
|
||||
|
||||
++batch.size;
|
||||
|
Reference in New Issue
Block a user