diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-01-26 14:46:37 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-01-26 14:46:37 +0300 |
commit | 5b299e5999e2b59e30edd4e770f64aa700e482d6 (patch) | |
tree | 17052358b339e20c44ca942e62b735ef63b23f88 /source/blender/draw/intern/draw_shader_shared.h | |
parent | 9bce134e56c28045aee37080f5c5b6622a07927b (diff) |
D13910: Workbench: Port shaders to use GPUShaderCreateInfo
Also adds a few things to GPUShader for easily create shaders.
Heavy usage of macros to compose the createInfo and avoid
duplications and copy paste bugs.
This makes the link between the shader request functions
(in workbench_shader.cc) and the actual createInfo a bit
obscure since the names are composed and not searchable.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D13910
Diffstat (limited to 'source/blender/draw/intern/draw_shader_shared.h')
-rw-r--r-- | source/blender/draw/intern/draw_shader_shared.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/source/blender/draw/intern/draw_shader_shared.h b/source/blender/draw/intern/draw_shader_shared.h index aa117f44e84..35350417ca8 100644 --- a/source/blender/draw/intern/draw_shader_shared.h +++ b/source/blender/draw/intern/draw_shader_shared.h @@ -16,7 +16,7 @@ struct ViewInfos { float4x4 winmat; float4x4 wininv; - float4 clipplanes[6]; + float4 clip_planes[6]; float4 viewvecs[2]; /* Should not be here. Not view dependent (only main view). */ float4 viewcamtexcofac; @@ -30,7 +30,7 @@ BLI_STATIC_ASSERT_ALIGN(ViewInfos, 16) #define ViewMatrixInverse drw_view.viewinv #define ProjectionMatrix drw_view.winmat #define ProjectionMatrixInverse drw_view.wininv -#define clipPlanes drw_view.clipplanes +#define clipPlanes drw_view.clip_planes #define ViewVecs drw_view.viewvecs #define CameraTexCoFactors drw_view.viewcamtexcofac @@ -39,3 +39,14 @@ struct ObjectMatrices { float4x4 drw_modelMatrixInverse; }; BLI_STATIC_ASSERT_ALIGN(ViewInfos, 16) + +struct ObjectInfos { + float4 drw_OrcoTexCoFactors[2]; + float4 drw_ObjectColor; + float4 drw_Infos; +}; +BLI_STATIC_ASSERT_ALIGN(ViewInfos, 16) + +#define OrcoTexCoFactors (drw_infos[resource_id].drw_OrcoTexCoFactors) +#define ObjectInfo (drw_infos[resource_id].drw_Infos) +#define ObjectColor (drw_infos[resource_id].drw_ObjectColor) |