mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
Move sRGB -> linear conversion for vertex color to vertex shader.
This took almost 2% of CPU time on release. Jeez.
This commit is contained in:
@@ -541,14 +541,12 @@ namespace Robust.Client.Graphics.Clyde
|
||||
tr = _currentMatrixModel.Transform(tr);
|
||||
tl = _currentMatrixModel.Transform(tl);
|
||||
|
||||
var modulateLinear = Color.FromSrgb(modulate);
|
||||
|
||||
// TODO: split batch if necessary.
|
||||
var vIdx = BatchVertexIndex;
|
||||
BatchVertexData[vIdx + 0] = new Vertex2D(bl, texCoords.BottomLeft, modulateLinear);
|
||||
BatchVertexData[vIdx + 1] = new Vertex2D(br, texCoords.BottomRight, modulateLinear);
|
||||
BatchVertexData[vIdx + 2] = new Vertex2D(tr, texCoords.TopRight, modulateLinear);
|
||||
BatchVertexData[vIdx + 3] = new Vertex2D(tl, texCoords.TopLeft, modulateLinear);
|
||||
BatchVertexData[vIdx + 0] = new Vertex2D(bl, texCoords.BottomLeft, modulate);
|
||||
BatchVertexData[vIdx + 1] = new Vertex2D(br, texCoords.BottomRight, modulate);
|
||||
BatchVertexData[vIdx + 2] = new Vertex2D(tr, texCoords.TopRight, modulate);
|
||||
BatchVertexData[vIdx + 3] = new Vertex2D(tl, texCoords.TopLeft, modulate);
|
||||
BatchVertexIndex += 4;
|
||||
QuadBatchIndexWrite(BatchIndexData, ref BatchIndexIndex, (ushort) vIdx);
|
||||
|
||||
@@ -645,12 +643,10 @@ namespace Robust.Client.Graphics.Clyde
|
||||
a = _currentMatrixModel.Transform(a);
|
||||
b = _currentMatrixModel.Transform(b);
|
||||
|
||||
var colorLinear = Color.FromSrgb(color);
|
||||
|
||||
// TODO: split batch if necessary.
|
||||
var vIdx = BatchVertexIndex;
|
||||
BatchVertexData[vIdx + 0] = new Vertex2D(a, Vector2.Zero, colorLinear);
|
||||
BatchVertexData[vIdx + 1] = new Vertex2D(b, Vector2.Zero, colorLinear);
|
||||
BatchVertexData[vIdx + 0] = new Vertex2D(a, Vector2.Zero, color);
|
||||
BatchVertexData[vIdx + 1] = new Vertex2D(b, Vector2.Zero, color);
|
||||
BatchVertexIndex += 2;
|
||||
|
||||
_debugStats.LastClydeDrawCalls += 1;
|
||||
|
||||
@@ -36,5 +36,5 @@ void main()
|
||||
gl_Position = vec4(VERTEX, 0.0, 1.0);
|
||||
Pos = (VERTEX + 1.0) / 2.0;
|
||||
UV = mix(modifyUV.xy, modifyUV.zw, tCoord);
|
||||
VtxModulate = modulate;
|
||||
VtxModulate = zFromSrgb(modulate);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user