Blender  V3.3
gpencil_shader_shared.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #ifndef GPU_SHADER
5 
6 # ifndef __cplusplus
7 typedef struct gpMaterial gpMaterial;
8 typedef struct gpLight gpLight;
9 typedef enum gpMaterialFlag gpMaterialFlag;
10 typedef enum gpLightType gpLightType;
11 # endif
12 #endif
13 
19  GP_STROKE_OVERLAP = (1u << 2u),
20  GP_STROKE_TEXTURE_USE = (1u << 3u),
23  GP_STROKE_DOTS = (1u << 6u),
24  GP_STROKE_HOLDOUT = (1u << 7u),
25  GP_FILL_HOLDOUT = (1u << 8u),
26  GP_FILL_TEXTURE_USE = (1u << 10u),
27  GP_FILL_TEXTURE_PREMUL = (1u << 11u),
28  GP_FILL_TEXTURE_CLIP = (1u << 12u),
29  GP_FILL_GRADIENT_USE = (1u << 13u),
30  GP_FILL_GRADIENT_RADIAL = (1u << 14u),
33 };
34 
40 };
41 
42 /* Avoid compiler funkiness with enum types not being strongly typed in C. */
43 #ifndef GPU_SHADER
44 # define gpMaterialFlag uint
45 # define gpLightType uint
46 #endif
47 
48 struct gpMaterial {
53 #ifndef GPU_SHADER
60 #else
61  /* Some drivers are completely messing the alignment or the fetches here.
62  * We are forced to pack these into vec4 otherwise we only get 0.0 as value. */
63  /* NOTE(@fclem): This was the case on MacOS OpenGL implementation.
64  * This might be fixed in newer APIs. */
65  float4 packed1;
66  float4 packed2;
67 # define _fill_uv_offset packed1.xy
68 # define _alignment_rot packed1.zw
69 # define _stroke_texture_mix packed2.x
70 # define _stroke_u_scale packed2.y
71 # define _fill_texture_mix packed2.z
73 # define _flag packed2.w
74 #endif
75 };
77 
78 struct gpLight {
79 #ifndef GPU_SHADER
83  float spot_size;
85  float spot_blend;
87  float _pad0;
89  float _pad1;
90 #else
91  /* Some drivers are completely messing the alignment or the fetches here.
92  * We are forced to pack these into vec4 otherwise we only get 0.0 as value. */
93  /* NOTE(@fclem): This was the case on MacOS OpenGL implementation.
94  * This might be fixed in newer APIs. */
95  float4 packed0;
96  float4 packed1;
97  float4 packed2;
98  float4 packed3;
99  float4 packed4;
100 # define _color packed0.xyz
101 # define _type packed0.w
102 # define _right packed1.xyz
103 # define _spot_size packed1.w
104 # define _up packed2.xyz
105 # define _spot_blend packed2.w
106 # define _forward packed3.xyz
107 # define _position packed4.xyz
108 #endif
109 };
111 
112 #ifndef GPU_SHADER
113 # undef gpMaterialFlag
114 # undef gpLightType
115 #endif
#define BLI_STATIC_ASSERT_ALIGN(st, align)
Definition: BLI_assert.h:86
float float4[4]
#define gpLightType
@ GP_LIGHT_TYPE_AMBIENT
@ GP_LIGHT_TYPE_SUN
@ GP_LIGHT_TYPE_POINT
@ GP_LIGHT_TYPE_SPOT
@ GP_FILL_TEXTURE_USE
@ GP_STROKE_TEXTURE_STENCIL
@ GP_STROKE_DOTS
@ GP_STROKE_HOLDOUT
@ GP_FILL_FLAGS
@ GP_STROKE_TEXTURE_PREMUL
@ GP_STROKE_ALIGNMENT_STROKE
@ GP_STROKE_ALIGNMENT
@ GP_FILL_TEXTURE_PREMUL
@ GP_STROKE_TEXTURE_USE
@ GP_STROKE_ALIGNMENT_OBJECT
@ GP_FILL_GRADIENT_USE
@ GP_FILL_TEXTURE_CLIP
@ GP_FILL_GRADIENT_RADIAL
@ GP_STROKE_OVERLAP
@ GP_FILL_HOLDOUT
@ GP_STROKE_ALIGNMENT_FIXED
#define gpMaterialFlag
gpLightType type
gpMaterialFlag flag