add const qualifiers on color puns

This commit is contained in:
veclav talica 2024-07-28 22:23:28 +03:00
parent 8846e788b2
commit 945b1d21fe

View File

@ -114,7 +114,7 @@ static struct sprite_batch {
.constant_colored = true, .constant_colored = true,
}; };
const uint32_t uniform_color = *(uint32_t *)&primitives[0].sprite.color; const uint32_t uniform_color = *(const uint32_t *)&primitives[0].sprite.color;
/* batch size is clamped so that reallocated short indices could be used */ /* batch size is clamped so that reallocated short indices could be used */
if (len >= QUAD_ELEMENT_BUFFER_LENGTH) if (len >= QUAD_ELEMENT_BUFFER_LENGTH)
@ -137,7 +137,7 @@ static struct sprite_batch {
break; break;
/* if all are modulated the same we can skip sending the color data */ /* if all are modulated the same we can skip sending the color data */
if (batch.constant_colored && *(uint32_t *)&current->sprite.color == uniform_color) if (batch.constant_colored && *(const uint32_t *)&current->sprite.color == uniform_color)
batch.constant_colored = false; batch.constant_colored = false;
++batch.size; ++batch.size;