Change the internal constant color from a (per-draw) vertex attribute to a uniform. Pack most built-in uniforms into a single vec4 array and update them all with a single glUniform call.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2019-11-18 21:13:54 -04:00
parent 37c579929b
commit 3435a6bcbf
10 changed files with 98 additions and 172 deletions
+3 -5
View File
@@ -309,7 +309,7 @@ void Graphics::setActive(bool enable)
void Graphics::draw(const DrawCommand &cmd)
{
gl.prepareDraw();
gl.prepareDraw(this);
gl.setVertexAttributes(*cmd.attributes, *cmd.buffers);
gl.bindTextureToUnit(cmd.texture, 0, false);
gl.setCullMode(cmd.cullMode);
@@ -326,7 +326,7 @@ void Graphics::draw(const DrawCommand &cmd)
void Graphics::draw(const DrawIndexedCommand &cmd)
{
gl.prepareDraw();
gl.prepareDraw(this);
gl.setVertexAttributes(*cmd.attributes, *cmd.buffers);
gl.bindTextureToUnit(cmd.texture, 0, false);
gl.setCullMode(cmd.cullMode);
@@ -373,7 +373,7 @@ void Graphics::drawQuads(int start, int count, const vertex::Attributes &attribu
const int MAX_VERTICES_PER_DRAW = LOVE_UINT16_MAX;
const int MAX_QUADS_PER_DRAW = MAX_VERTICES_PER_DRAW / 4;
gl.prepareDraw();
gl.prepareDraw(this);
gl.bindTextureToUnit(texture, 0, false);
gl.setCullMode(CULL_NONE);
@@ -1223,8 +1223,6 @@ void Graphics::setColor(Colorf c)
c.b = std::min(std::max(c.b, 0.0f), 1.0f);
c.a = std::min(std::max(c.a, 0.0f), 1.0f);
gl.setConstantColor(c);
states.back().color = c;
}