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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2022-03-19 23:59:29 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-03-20 00:05:34 +0300
commiteccb0b222e3465baa71430223c5ee2f0206a7b02 (patch)
tree1b8888acea69d78466a2a727aac93b3fb1ea2e8f /source/blender/draw/engines/gpencil/shaders/infos/gpencil_info.hh
parent36b02c3815af8f76aa9d7ce017fd00b66e8b1965 (diff)
GPencil: Port main object shader to ShaderCreateInfo
This is quite a huge cleanup. Making use of the `common_gpencil_lib.glsl` to share more codes and use more consistent codestyle. The gpencil engine specifics are now out of the `gpencil_vertex()` function making it easier to add more features. There should be no regression as all workarounds are kept as is.
Diffstat (limited to 'source/blender/draw/engines/gpencil/shaders/infos/gpencil_info.hh')
-rw-r--r--source/blender/draw/engines/gpencil/shaders/infos/gpencil_info.hh44
1 files changed, 44 insertions, 0 deletions
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 76fa8ae609b..3b4de704c00 100644
--- a/source/blender/draw/engines/gpencil/shaders/infos/gpencil_info.hh
+++ b/source/blender/draw/engines/gpencil/shaders/infos/gpencil_info.hh
@@ -3,6 +3,50 @@
#include "gpu_shader_create_info.hh"
/* -------------------------------------------------------------------- */
+/** \name GPencil Object rendering
+ * \{ */
+
+GPU_SHADER_INTERFACE_INFO(gpencil_geometry_iface, "gp_interp")
+ .smooth(Type::VEC4, "color_mul")
+ .smooth(Type::VEC4, "color_add")
+ .smooth(Type::VEC3, "pos")
+ .smooth(Type::VEC2, "uv")
+ .no_perspective(Type::VEC2, "thickness")
+ .no_perspective(Type::FLOAT, "hardness")
+ .flat(Type::VEC2, "aspect")
+ .flat(Type::VEC4, "sspos")
+ .flat(Type::UINT, "mat_flag")
+ .flat(Type::FLOAT, "depth");
+
+GPU_SHADER_CREATE_INFO(gpencil_geometry)
+ .do_static_compilation(true)
+ .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")
+ .sampler(3, ImageType::FLOAT_2D, "gpMaskTexture")
+ .uniform_buf(2, "gpMaterial", "materials[GPENCIL_MATERIAL_BUFFER_LEN]", Frequency::BATCH)
+ .uniform_buf(3, "gpLight", "lights[GPENCIL_LIGHT_BUFFER_LEN]", Frequency::BATCH)
+ /* Per Object */
+ .push_constant(Type::VEC3, "gpNormal")
+ .push_constant(Type::BOOL, "gpStrokeOrder3d")
+ .push_constant(Type::INT, "gpMaterialOffset")
+ /* Per Layer */
+ .push_constant(Type::FLOAT, "gpVertexColorOpacity")
+ .push_constant(Type::VEC4, "gpLayerTint")
+ .push_constant(Type::FLOAT, "gpLayerOpacity")
+ .push_constant(Type::FLOAT, "gpStrokeIndexOffset")
+ .fragment_out(0, Type::VEC4, "fragColor")
+ .fragment_out(1, Type::VEC4, "revealColor")
+ .vertex_out(gpencil_geometry_iface)
+ .vertex_source("gpencil_vert.glsl")
+ .fragment_source("gpencil_frag.glsl")
+ .additional_info("draw_gpencil");
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
/** \name Fullscreen shaders
* \{ */