Blender V4.3
gpencil_shader_shared.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#ifndef GPU_SHADER
6# pragma once
7
9
10# ifndef __cplusplus
11typedef struct gpMaterial gpMaterial;
12typedef struct gpLight gpLight;
14# ifdef GP_LIGHT
15typedef enum gpLightType gpLightType;
16# endif
17# endif
18#endif
19
41
48
49#define GP_IS_STROKE_VERTEX_BIT (1 << 30)
50#define GP_VERTEX_ID_SHIFT 2
51
52/* Avoid compiler funkiness with enum types not being strongly typed in C. */
53#ifndef GPU_SHADER
54# define gpMaterialFlag uint
55# define gpLightType uint
56#endif
57
58struct gpMaterial {
60 float4 fill_color;
63#ifndef GPU_SHADER
70#else
71 /* Some drivers are completely messing the alignment or the fetches here.
72 * We are forced to pack these into vec4 otherwise we only get 0.0 as value. */
73 /* NOTE(@fclem): This was the case on MacOS OpenGL implementation.
74 * This might be fixed in newer APIs. */
75 float4 packed1;
76 float4 packed2;
77# define _fill_uv_offset packed1.xy
78# define _alignment_rot packed1.zw
79# define _stroke_texture_mix packed2.x
80# define _stroke_u_scale packed2.y
81# define _fill_texture_mix packed2.z
83# define _flag packed2.w
84#endif
85};
87
88#ifdef GP_LIGHT
89struct gpLight {
90# ifndef GPU_SHADER
92 gpLightType type;
93 float3 right;
94 float spot_size;
95 float3 up;
96 float spot_blend;
97 float3 forward;
98 float _pad0;
99 float3 position;
100 float _pad1;
101# else
102 /* Some drivers are completely messing the alignment or the fetches here.
103 * We are forced to pack these into vec4 otherwise we only get 0.0 as value. */
104 /* NOTE(@fclem): This was the case on MacOS OpenGL implementation.
105 * This might be fixed in newer APIs. */
106 float4 packed0;
107 float4 packed1;
108 float4 packed2;
109 float4 packed3;
110 float4 packed4;
111# define _color packed0.xyz
112# define _type packed0.w
113# define _right packed1.xyz
114# define _spot_size packed1.w
115# define _up packed2.xyz
116# define _spot_blend packed2.w
117# define _forward packed3.xyz
118# define _position packed4.xyz
119# endif
120};
122#endif
123
124#ifndef GPU_SHADER
125# undef gpMaterialFlag
126# undef gpLightType
127#endif
#define BLI_STATIC_ASSERT_ALIGN(st, align)
Definition BLI_assert.h:90
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert Invert a color
#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
struct gpLight gpLight
gpMaterialFlag flag