diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-08-11 17:19:58 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-08-14 21:40:04 +0300 |
commit | c81c5358ac72883b459bcba224f04cc692933737 (patch) | |
tree | 6a52f45619401932c72a10411232534282696610 /source/blender/draw/engines | |
parent | 4b14fea38e742665ff28277c719532e5cc36e677 (diff) |
GPencil: Engine: Make GL lights declaration optional
This avoid some macro name clashing with other engines where this struct
is not needed.
Diffstat (limited to 'source/blender/draw/engines')
3 files changed, 18 insertions, 12 deletions
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h index 332c7f67c64..2f9d20b3902 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine.h +++ b/source/blender/draw/engines/gpencil/gpencil_engine.h @@ -19,6 +19,8 @@ extern "C" { #endif +#define GP_LIGHT + #include "gpencil_defines.h" #include "gpencil_shader_shared.h" diff --git a/source/blender/draw/engines/gpencil/gpencil_shader_shared.h b/source/blender/draw/engines/gpencil/gpencil_shader_shared.h index 50ff7e7efc7..4c621e955b9 100644 --- a/source/blender/draw/engines/gpencil/gpencil_shader_shared.h +++ b/source/blender/draw/engines/gpencil/gpencil_shader_shared.h @@ -7,7 +7,9 @@ typedef struct gpMaterial gpMaterial; typedef struct gpLight gpLight; typedef enum gpMaterialFlag gpMaterialFlag; +# ifdef GP_LIGHT typedef enum gpLightType gpLightType; +# endif # endif #endif @@ -75,8 +77,9 @@ struct gpMaterial { }; BLI_STATIC_ASSERT_ALIGN(gpMaterial, 16) +#ifdef GP_LIGHT struct gpLight { -#ifndef GPU_SHADER +# ifndef GPU_SHADER float3 color; gpLightType type; float3 right; @@ -87,7 +90,7 @@ struct gpLight { float _pad0; float3 position; float _pad1; -#else +# else /* Some drivers are completely messing the alignment or the fetches here. * We are forced to pack these into vec4 otherwise we only get 0.0 as value. */ /* NOTE(@fclem): This was the case on MacOS OpenGL implementation. @@ -97,17 +100,18 @@ struct gpLight { float4 packed2; float4 packed3; float4 packed4; -# define _color packed0.xyz -# define _type packed0.w -# define _right packed1.xyz -# define _spot_size packed1.w -# define _up packed2.xyz -# define _spot_blend packed2.w -# define _forward packed3.xyz -# define _position packed4.xyz -#endif +# define _color packed0.xyz +# define _type packed0.w +# define _right packed1.xyz +# define _spot_size packed1.w +# define _up packed2.xyz +# define _spot_blend packed2.w +# define _forward packed3.xyz +# define _position packed4.xyz +# endif }; BLI_STATIC_ASSERT_ALIGN(gpLight, 16) +#endif #ifndef GPU_SHADER # undef gpMaterialFlag diff --git a/source/blender/draw/engines/gpencil/shaders/infos/gpencil_info.hh b/source/blender/draw/engines/gpencil/shaders/infos/gpencil_info.hh index 3b4de704c00..1db98d13c4a 100644 --- a/source/blender/draw/engines/gpencil/shaders/infos/gpencil_info.hh +++ b/source/blender/draw/engines/gpencil/shaders/infos/gpencil_info.hh @@ -20,8 +20,8 @@ GPU_SHADER_INTERFACE_INFO(gpencil_geometry_iface, "gp_interp") GPU_SHADER_CREATE_INFO(gpencil_geometry) .do_static_compilation(true) + .define("GP_LIGHT") .typedef_source("gpencil_defines.h") - .typedef_source("gpencil_shader_shared.h") .sampler(0, ImageType::FLOAT_2D, "gpFillTexture") .sampler(1, ImageType::FLOAT_2D, "gpStrokeTexture") .sampler(2, ImageType::DEPTH_2D, "gpSceneDepthTexture") |