[wip, win32, canvas] Correctly setup path index in segment_setup.glsl
This commit is contained in:
parent
b61d8868d3
commit
899ad4c030
|
@ -116,6 +116,10 @@ int main()
|
||||||
mg_close_path();
|
mg_close_path();
|
||||||
mg_set_color_rgba(0, 1, 0, 1);
|
mg_set_color_rgba(0, 1, 0, 1);
|
||||||
mg_fill();
|
mg_fill();
|
||||||
|
|
||||||
|
mg_set_color_rgba(0, 1, 1, 1);
|
||||||
|
mg_rectangle_fill(120, 120, 200, 200);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
mg_move_to(400, 400);
|
mg_move_to(400, 400);
|
||||||
mg_quadratic_to(600, 601, 800, 400);
|
mg_quadratic_to(600, 601, 800, 400);
|
||||||
|
|
|
@ -150,9 +150,6 @@ void main()
|
||||||
|
|
||||||
while(opIndex >= 0)
|
while(opIndex >= 0)
|
||||||
{
|
{
|
||||||
// imageStore(outTexture, ivec2(sampleCoord), vec4(0, 1, 1, 1));
|
|
||||||
// return;
|
|
||||||
|
|
||||||
mg_gl_tile_op op = tileOpBuffer.elements[opIndex];
|
mg_gl_tile_op op = tileOpBuffer.elements[opIndex];
|
||||||
opIndex = op.next;
|
opIndex = op.next;
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ layout(binding = 6) restrict buffer tileOpBufferSSBO
|
||||||
layout(location = 0) uniform float scale;
|
layout(location = 0) uniform float scale;
|
||||||
layout(location = 1) uniform uint tileSize;
|
layout(location = 1) uniform uint tileSize;
|
||||||
|
|
||||||
int push_segment(in vec2 p[4], int kind)
|
int push_segment(in vec2 p[4], int kind, int pathIndex)
|
||||||
{
|
{
|
||||||
int segIndex = atomicAdd(segmentCountBuffer.elements[0], 1);
|
int segIndex = atomicAdd(segmentCountBuffer.elements[0], 1);
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ int push_segment(in vec2 p[4], int kind)
|
||||||
max(s.y, e.y));
|
max(s.y, e.y));
|
||||||
|
|
||||||
segmentBuffer.elements[segIndex].kind = kind;
|
segmentBuffer.elements[segIndex].kind = kind;
|
||||||
segmentBuffer.elements[segIndex].pathIndex = 0; ///
|
segmentBuffer.elements[segIndex].pathIndex = pathIndex;
|
||||||
segmentBuffer.elements[segIndex].windingIncrement = goingUp ? 1 : -1;
|
segmentBuffer.elements[segIndex].windingIncrement = goingUp ? 1 : -1;
|
||||||
segmentBuffer.elements[segIndex].box = box;
|
segmentBuffer.elements[segIndex].box = box;
|
||||||
|
|
||||||
|
@ -288,9 +288,9 @@ void bin_to_tiles(int segIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void line_setup(vec2 p[4])
|
void line_setup(vec2 p[4], int pathIndex)
|
||||||
{
|
{
|
||||||
int segIndex = push_segment(p, MG_GL_LINE);
|
int segIndex = push_segment(p, MG_GL_LINE, pathIndex);
|
||||||
segmentBuffer.elements[segIndex].hullVertex = p[0];
|
segmentBuffer.elements[segIndex].hullVertex = p[0];
|
||||||
|
|
||||||
bin_to_tiles(segIndex);
|
bin_to_tiles(segIndex);
|
||||||
|
@ -307,7 +307,7 @@ void main()
|
||||||
case MG_GL_LINE:
|
case MG_GL_LINE:
|
||||||
{
|
{
|
||||||
vec2 p[4] = {elt.p[0]*scale, elt.p[1]*scale, vec2(0), vec2(0)};
|
vec2 p[4] = {elt.p[0]*scale, elt.p[1]*scale, vec2(0), vec2(0)};
|
||||||
line_setup(p);
|
line_setup(p, elt.pathIndex);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue