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-04-14 19:47:58 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-04-14 19:47:58 +0300
commit80859a6cb2726a39fb22cb49f06e0355dc9390a7 (patch)
treefd3f8ead5a247a79ea11e4aacc720843bbc5e2c2 /source/blender/draw/intern/draw_shader_shared.h
parent66dc4d4efb88ecf2d18bfa08ab9c43b024ebd2fb (diff)
GPU: Make nodetree GLSL Codegen render engine agnostic
This commit removes all EEVEE specific code from the `gpu_shader_material*.glsl` files. It defines a clear interface to evaluate the closure nodes leaving more flexibility to the render engine. Some of the long standing workaround are fixed: - bump mapping support is no longer duplicating a lot of node and is instead compiled into a function call. - bump rewiring to Normal socket is no longer needed as we now use a global `g_data.N` for that. Closure sampling with upstread weight eval is now supported if the engine needs it. This also makes all the material GLSL sources use `GPUSource` for better debugging experience. The `GPUFunction` parsing now happens in `GPUSource` creation. The whole `GPUCodegen` now uses the `ShaderCreateInfo` and is object type agnostic. Is has also been rewritten in C++. This patch changes a view behavior for EEVEE: - Mix shader node factor imput is now clamped. - Tangent Vector displacement behavior is now matching cycles. - The chosen BSDF used for SSR might change. - Hair shading may have very small changes on very large hairs when using hair polygon stripes. - ShaderToRGB node will remove any SSR and SSS form a shader. - SSS radius input now is no longer a scaling factor but defines an average radius. The SSS kernel "shape" (radii) are still defined by the socket default values. Appart from the listed changes no other regressions are expected.
Diffstat (limited to 'source/blender/draw/intern/draw_shader_shared.h')
-rw-r--r--source/blender/draw/intern/draw_shader_shared.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/source/blender/draw/intern/draw_shader_shared.h b/source/blender/draw/intern/draw_shader_shared.h
index 5fc76bc25e6..58875c0496a 100644
--- a/source/blender/draw/intern/draw_shader_shared.h
+++ b/source/blender/draw/intern/draw_shader_shared.h
@@ -36,16 +36,19 @@ struct ViewInfos {
};
BLI_STATIC_ASSERT_ALIGN(ViewInfos, 16)
+/* Do not override old definitions if the shader uses this header but not shader info. */
+#ifdef USE_GPU_SHADER_CREATE_INFO
/* TODO(@fclem): Mass rename. */
-#define ViewProjectionMatrix drw_view.persmat
-#define ViewProjectionMatrixInverse drw_view.persinv
-#define ViewMatrix drw_view.viewmat
-#define ViewMatrixInverse drw_view.viewinv
-#define ProjectionMatrix drw_view.winmat
-#define ProjectionMatrixInverse drw_view.wininv
-#define clipPlanes drw_view.clip_planes
-#define ViewVecs drw_view.viewvecs
-#define CameraTexCoFactors drw_view.viewcamtexcofac
+# define ViewProjectionMatrix drw_view.persmat
+# define ViewProjectionMatrixInverse drw_view.persinv
+# define ViewMatrix drw_view.viewmat
+# define ViewMatrixInverse drw_view.viewinv
+# define ProjectionMatrix drw_view.winmat
+# define ProjectionMatrixInverse drw_view.wininv
+# define clipPlanes drw_view.clip_planes
+# define ViewVecs drw_view.viewvecs
+# define CameraTexCoFactors drw_view.viewcamtexcofac
+#endif
struct ObjectMatrices {
float4x4 drw_modelMatrix;