Welcome to mirror list, hosted at ThFree Co, Russian Federation.

common_subdiv_vbo_sculpt_data_comp.glsl « shaders « intern « draw « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7182ce57ad39c57306549a0347d4f683764cb516 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

/* To be compile with common_subdiv_lib.glsl */

struct SculptData {
  uint face_set_color;
  float mask;
};

layout(std430, binding = 0) readonly restrict buffer sculptMask
{
  float sculpt_mask[];
};

layout(std430, binding = 1) readonly restrict buffer faceSetColor
{
  uint face_set_color[];
};

layout(std430, binding = 2) writeonly restrict buffer sculptData
{
  SculptData sculpt_data[];
};

void main()
{
  /* We execute for each quad. */
  uint quad_index = get_global_invocation_index();
  if (quad_index >= total_dispatch_size) {
    return;
  }

  uint start_loop_index = quad_index * 4;

  for (uint loop_index = start_loop_index; loop_index < start_loop_index + 4; loop_index++) {
    SculptData data;
    data.face_set_color = face_set_color[loop_index];

    if (has_sculpt_mask) {
      data.mask = sculpt_mask[loop_index];
    }
    else {
      data.mask = 0.0;
    }

    sculpt_data[loop_index] = data;
  }
}