gpu: reintroduce reuse of offset-only stenciling

Reintroduce support for offset in stencil vertex so we can reuse
cached values if the only difference in transform is offset. Split
current transform into a pure-offset part and the rest and use
only the complex part as cache key.

Signed-off-by: Viktor <viktor.ogeman@gmail.com>
This commit is contained in:
Viktor
2020-06-20 23:29:55 +02:00
committed by Elias Naur
parent 380938c602
commit cfb9565895
4 changed files with 55 additions and 35 deletions
+5 -4
View File
@@ -6,6 +6,7 @@ precision highp float;
layout(binding = 0) uniform Block {
vec4 transform;
vec2 pathOffset;
};
layout(location=0) in float corner;
@@ -22,10 +23,10 @@ void main() {
// Add a one pixel overlap so curve quads cover their
// entire curves. Could use conservative rasterization
// if available.
vec2 from = from;
vec2 ctrl = ctrl;
vec2 to = to;
float maxy = maxy;
vec2 from = from + pathOffset;
vec2 ctrl = ctrl + pathOffset;
vec2 to = to + pathOffset;
float maxy = maxy + pathOffset.y;
vec2 pos;
float c = corner;
if (c >= 0.375) {