blob: e897fb3f3c030be978d7b6e9e0fa68cd79616445 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
/* To be compile with common_subdiv_lib.glsl */
layout(std430, binding = 1) readonly buffer inputCoarseData
{
float coarse_stretch_area[];
};
layout(std430, binding = 2) writeonly buffer outputSubdivData
{
float subdiv_stretch_area[];
};
void main()
{
/* We execute for each quad. */
uint quad_index = get_global_invocation_index();
if (quad_index >= total_dispatch_size) {
return;
}
/* The start index of the loop is quad_index * 4. */
uint start_loop_index = quad_index * 4;
uint coarse_quad_index = coarse_polygon_index_from_subdiv_quad_index(quad_index,
coarse_poly_count);
for (int i = 0; i < 4; i++) {
subdiv_stretch_area[start_loop_index + i] = coarse_stretch_area[coarse_quad_index];
}
}
|