2021-12-03 03:41:41 +11:00
|
|
|
struct ElementRef
|
|
|
|
{
|
|
|
|
uint offset;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ElementTag
|
|
|
|
{
|
|
|
|
uint tag;
|
|
|
|
uint flags;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DrawMonoid
|
|
|
|
{
|
|
|
|
uint path_ix;
|
|
|
|
uint clip_ix;
|
|
|
|
};
|
|
|
|
|
2021-12-09 05:42:35 +11:00
|
|
|
static const uint3 gl_WorkGroupSize = uint3(256u, 1u, 1u);
|
2021-12-03 03:41:41 +11:00
|
|
|
|
|
|
|
struct Alloc
|
|
|
|
{
|
|
|
|
uint offset;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Config
|
|
|
|
{
|
|
|
|
uint n_elements;
|
|
|
|
uint n_pathseg;
|
|
|
|
uint width_in_tiles;
|
|
|
|
uint height_in_tiles;
|
|
|
|
Alloc tile_alloc;
|
|
|
|
Alloc bin_alloc;
|
|
|
|
Alloc ptcl_alloc;
|
|
|
|
Alloc pathseg_alloc;
|
|
|
|
Alloc anno_alloc;
|
|
|
|
Alloc trans_alloc;
|
|
|
|
Alloc bbox_alloc;
|
|
|
|
Alloc drawmonoid_alloc;
|
|
|
|
uint n_trans;
|
2021-12-03 10:07:33 +11:00
|
|
|
uint n_path;
|
2021-12-03 03:41:41 +11:00
|
|
|
uint trans_offset;
|
|
|
|
uint linewidth_offset;
|
2021-12-03 10:07:33 +11:00
|
|
|
uint pathtag_offset;
|
2021-12-03 03:41:41 +11:00
|
|
|
uint pathseg_offset;
|
|
|
|
};
|
|
|
|
|
2021-12-08 12:24:07 +11:00
|
|
|
static const DrawMonoid _87 = { 1u, 0u };
|
|
|
|
static const DrawMonoid _89 = { 1u, 1u };
|
|
|
|
static const DrawMonoid _91 = { 0u, 0u };
|
2021-12-03 03:41:41 +11:00
|
|
|
|
2021-12-04 10:49:58 +11:00
|
|
|
ByteAddressBuffer _46 : register(t2, space0);
|
2021-12-09 05:42:35 +11:00
|
|
|
RWByteAddressBuffer _199 : register(u3, space0);
|
|
|
|
RWByteAddressBuffer _213 : register(u0, space0);
|
|
|
|
ByteAddressBuffer _219 : register(t1, space0);
|
2021-12-03 03:41:41 +11:00
|
|
|
|
|
|
|
static uint3 gl_WorkGroupID;
|
|
|
|
static uint3 gl_LocalInvocationID;
|
|
|
|
static uint3 gl_GlobalInvocationID;
|
|
|
|
struct SPIRV_Cross_Input
|
|
|
|
{
|
|
|
|
uint3 gl_WorkGroupID : SV_GroupID;
|
|
|
|
uint3 gl_LocalInvocationID : SV_GroupThreadID;
|
|
|
|
uint3 gl_GlobalInvocationID : SV_DispatchThreadID;
|
|
|
|
};
|
|
|
|
|
2021-12-09 05:42:35 +11:00
|
|
|
groupshared DrawMonoid sh_scratch[256];
|
2021-12-03 03:41:41 +11:00
|
|
|
|
|
|
|
ElementTag Element_tag(ElementRef ref)
|
|
|
|
{
|
|
|
|
uint tag_and_flags = _46.Load((ref.offset >> uint(2)) * 4 + 0);
|
|
|
|
ElementTag _60 = { tag_and_flags & 65535u, tag_and_flags >> uint(16) };
|
|
|
|
return _60;
|
|
|
|
}
|
|
|
|
|
|
|
|
DrawMonoid map_tag(uint tag_word)
|
|
|
|
{
|
|
|
|
switch (tag_word)
|
|
|
|
{
|
|
|
|
case 4u:
|
|
|
|
case 5u:
|
|
|
|
case 6u:
|
|
|
|
{
|
2021-12-08 12:24:07 +11:00
|
|
|
return _87;
|
2021-12-03 03:41:41 +11:00
|
|
|
}
|
|
|
|
case 9u:
|
|
|
|
case 10u:
|
|
|
|
{
|
2021-12-08 12:24:07 +11:00
|
|
|
return _89;
|
2021-12-03 03:41:41 +11:00
|
|
|
}
|
|
|
|
default:
|
|
|
|
{
|
2021-12-08 12:24:07 +11:00
|
|
|
return _91;
|
2021-12-03 03:41:41 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ElementRef Element_index(ElementRef ref, uint index)
|
|
|
|
{
|
|
|
|
ElementRef _39 = { ref.offset + (index * 36u) };
|
|
|
|
return _39;
|
|
|
|
}
|
|
|
|
|
|
|
|
DrawMonoid combine_tag_monoid(DrawMonoid a, DrawMonoid b)
|
|
|
|
{
|
|
|
|
DrawMonoid c;
|
|
|
|
c.path_ix = a.path_ix + b.path_ix;
|
|
|
|
c.clip_ix = a.clip_ix + b.clip_ix;
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
|
|
|
void comp_main()
|
|
|
|
{
|
|
|
|
uint ix = gl_GlobalInvocationID.x * 8u;
|
2021-12-08 12:24:07 +11:00
|
|
|
ElementRef _107 = { ix * 36u };
|
|
|
|
ElementRef ref = _107;
|
2021-12-03 03:41:41 +11:00
|
|
|
ElementRef param = ref;
|
|
|
|
uint tag_word = Element_tag(param).tag;
|
|
|
|
uint param_1 = tag_word;
|
|
|
|
DrawMonoid agg = map_tag(param_1);
|
|
|
|
for (uint i = 1u; i < 8u; i++)
|
|
|
|
{
|
|
|
|
ElementRef param_2 = ref;
|
|
|
|
uint param_3 = i;
|
|
|
|
ElementRef param_4 = Element_index(param_2, param_3);
|
|
|
|
tag_word = Element_tag(param_4).tag;
|
|
|
|
uint param_5 = tag_word;
|
|
|
|
DrawMonoid param_6 = agg;
|
|
|
|
DrawMonoid param_7 = map_tag(param_5);
|
|
|
|
agg = combine_tag_monoid(param_6, param_7);
|
|
|
|
}
|
|
|
|
sh_scratch[gl_LocalInvocationID.x] = agg;
|
2021-12-09 05:42:35 +11:00
|
|
|
for (uint i_1 = 0u; i_1 < 8u; i_1++)
|
2021-12-03 03:41:41 +11:00
|
|
|
{
|
|
|
|
GroupMemoryBarrierWithGroupSync();
|
2021-12-09 05:42:35 +11:00
|
|
|
if ((gl_LocalInvocationID.x + (1u << i_1)) < 256u)
|
2021-12-03 03:41:41 +11:00
|
|
|
{
|
|
|
|
DrawMonoid other = sh_scratch[gl_LocalInvocationID.x + (1u << i_1)];
|
|
|
|
DrawMonoid param_8 = agg;
|
|
|
|
DrawMonoid param_9 = other;
|
|
|
|
agg = combine_tag_monoid(param_8, param_9);
|
|
|
|
}
|
|
|
|
GroupMemoryBarrierWithGroupSync();
|
|
|
|
sh_scratch[gl_LocalInvocationID.x] = agg;
|
|
|
|
}
|
|
|
|
if (gl_LocalInvocationID.x == 0u)
|
|
|
|
{
|
2021-12-09 05:42:35 +11:00
|
|
|
_199.Store(gl_WorkGroupID.x * 8 + 0, agg.path_ix);
|
|
|
|
_199.Store(gl_WorkGroupID.x * 8 + 4, agg.clip_ix);
|
2021-12-03 03:41:41 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-09 05:42:35 +11:00
|
|
|
[numthreads(256, 1, 1)]
|
2021-12-03 03:41:41 +11:00
|
|
|
void main(SPIRV_Cross_Input stage_input)
|
|
|
|
{
|
|
|
|
gl_WorkGroupID = stage_input.gl_WorkGroupID;
|
|
|
|
gl_LocalInvocationID = stage_input.gl_LocalInvocationID;
|
|
|
|
gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID;
|
|
|
|
comp_main();
|
|
|
|
}
|