From 36a3ff07ce9e0730e9394240a10251cd5ec8f531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sun, 22 Sep 2024 20:19:21 +0200 Subject: [PATCH 01/90] Experiment with C++ stubs --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 151 ++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh new file mode 100644 index 00000000000..7d00073759e --- /dev/null +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -0,0 +1,151 @@ +/* SPDX-FileCopyrightText: 2024 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +#include + +#define BLI_ENABLE_IF(condition) typename std::enable_if_t<(condition)> * = nullptr +#define BLI_ENABLE_IF_VEC(_size, _test) int S = _size, BLI_ENABLE_IF((S _test)) + +template= 3, bool at_least_vec4 = Size >= 4> +struct swizzle { + T x; + T y; + std::enable_if_t z; + std::enable_if_t w; +}; + +template= 3, bool at_least_vec4 = Size >= 4> +struct VecBase : swizzle { + + using swizzleT_vec2 = swizzle; + using swizzleT_vec3 = swizzle; + using swizzleT_vec4 = swizzle; + + using swizzle2_vec3 = std::enable_if_t; + using swizzle3_vec3 = std::enable_if_t; + using swizzle4_vec3 = std::enable_if_t; + + using swizzle2_vec4 = std::enable_if_t; + using swizzle3_vec4 = std::enable_if_t; + using swizzle4_vec4 = std::enable_if_t; + + union { + swizzleT_vec2 xx, xy, yx, yy; + swizzleT_vec3 xxx, xxy, xyx, xyy, yxx, yxy, yyx, yyy; + swizzleT_vec4 xxxx, xxxy, xxyx, xxyy, xyxx, xyxy, xyyx, xyyy, yxxx, yxxy, yxyx, yxyy, yyxx, + yyxy, yyyx, yyyy; + + swizzle2_vec3 xz, yz, zx, zy, zz, zw; + swizzle3_vec3 xxz, xyz, xzx, xzy, xzz, yxz, yyz, yzx, yzy, yzz, zxx, zxy, zxz, zyx, zyy, zyz, + zzx, zzy, zzz; + swizzle4_vec3 xxxz, xxyz, xxzx, xxzy, xxzz, xyxz, xyyz, xyzx, xyzy, xyzz, xzxx, xzxy, xzxz, + xzyx, xzyy, xzyz, xzzx, xzzy, xzzz, yxxz, yxyz, yxzx, yxzy, yxzz, yyxz, yyyz, yyzx, yyzy, + yyzz, yzxx, yzxy, yzxz, yzyx, yzyy, yzyz, yzzx, yzzy, yzzz, zxxx, zxxy, zxxz, zxyx, zxyy, + zxyz, zxzx, zxzy, zxzz, zyxx, zyxy, zyxz, zyyx, zyyy, zyyz, zyzx, zyzy, zyzz, zzxx, zzxy, + zzxz, zzyx, zzyy, zzyz, zzzx, zzzy, zzzz; + + swizzle2_vec4 xw, yw, wx, wy, wz, ww; + swizzle3_vec4 xxw, xyw, xzw, xwx, xwy, xwz, xww, yxw, yyw, yzw, ywx, ywy, ywz, yww, zxw, zyw, + zzw, zwx, zwy, zwz, zww, wxx, wxy, wxz, wxw, wyx, wyy, wyz, wyw, wzx, wzy, wzz, wzw, wwx, + wwy, wwz, www; + swizzle4_vec4 xxxw, xxyw, xxzw, xxwx, xxwy, xxwz, xxww, xyxw, xyyw, xyzw, xywx, xywy, xywz, + xyww, xzxw, xzyw, xzzw, xzwx, xzwy, xzwz, xzww, xwxx, xwxy, xwxz, xwxw, xwyx, xwyy, xwyz, + xwyw, xwzx, xwzy, xwzz, xwzw, xwwx, xwwy, xwwz, xwww, yxxw, yxyw, yxzw, yxwx, yxwy, yxwz, + yxww, yyxw, yyyw, yyzw, yywx, yywy, yywz, yyww, yzxw, yzyw, yzzw, yzwx, yzwy, yzwz, yzww, + ywxx, ywxy, ywxz, ywxw, ywyx, ywyy, ywyz, ywyw, ywzx, ywzy, ywzz, ywzw, ywwx, ywwy, ywwz, + ywww, zxxw, zxyw, zxzw, zxwx, zxwy, zxwz, zxww, zyxw, zyyw, zyzw, zywx, zywy, zywz, zyww, + zzxw, zzyw, zzzw, zzwx, zzwy, zzwz, zzww, zwxx, zwxy, zwxz, zwxw, zwyx, zwyy, zwyz, zwyw, + zwzx, zwzy, zwzz, zwzw, zwwx, zwwy, zwwz, zwww, wxxx, wxxy, wxxz, wxxw, wxyx, wxyy, wxyz, + wxyw, wxzx, wxzy, wxzz, wxzw, wxwx, wxwy, wxwz, wxww, wyxx, wyxy, wyxz, wyxw, wyyx, wyyy, + wyyz, wyyw, wyzx, wyzy, wyzz, wyzw, wywx, wywy, wywz, wyww, wzxx, wzxy, wzxz, wzxw, wzyx, + wzyy, wzyz, wzyw, wzzx, wzzy, wzzz, wzzw, wzwx, wzwy, wzwz, wzww, wwxx, wwxy, wwxz, wwxw, + wwyx, wwyy, wwyz, wwyw, wwzx, wwzy, wwzz, wwzw, wwwx, wwwy, wwwz, wwww; + }; + + VecBase() {} + VecBase(const VecBase &) {} + + VecBase(T) {} + VecBase(const swizzle &) {} + + template VecBase(T, T) {} + template VecBase(T, T, T) {} + template VecBase(T, T, T, T) {} + + template VecBase(swizzle, T) {} + template VecBase(T, swizzle) {} + + template VecBase(swizzle, T, T) {} + template VecBase(T, swizzle, T) {} + template VecBase(T, T, swizzle) {} + template VecBase(swizzle, swizzle) {} + template VecBase(swizzle, T) {} + template VecBase(T, swizzle) {} + + T operator[](int) {} +}; + +template VecBase operator+(swizzle a, swizzle b) {} +template VecBase operator-(swizzle a, swizzle b) {} +template VecBase operator/(swizzle a, swizzle b) {} +template VecBase operator*(swizzle a, swizzle b) {} + +template VecBase operator+(swizzle a, T b) {} +template VecBase operator-(swizzle a, T b) {} +template VecBase operator/(swizzle a, T b) {} +template VecBase operator*(swizzle a, T b) {} + +template VecBase operator+(T a, swizzle b) {} +template VecBase operator-(T a, swizzle b) {} +template VecBase operator/(T a, swizzle b) {} +template VecBase operator*(T a, swizzle b) {} + +/* Needed to support double literals. */ +template VecBase operator+(swizzle a, double b) {} +template VecBase operator-(swizzle a, double b) {} +template VecBase operator/(swizzle a, double b) {} +template VecBase operator*(swizzle a, double b) {} + +template VecBase operator+(double a, swizzle b) {} +template VecBase operator-(double a, swizzle b) {} +template VecBase operator/(double a, swizzle b) {} +template VecBase operator*(double a, swizzle b) {} + +#define BLI_INT_OP template))> +BLI_INT_OP VecBase operator%(swizzle a, swizzle b) {} +BLI_INT_OP VecBase operator&(swizzle a, swizzle b) {} +BLI_INT_OP VecBase operator|(swizzle a, swizzle b) {} +BLI_INT_OP VecBase operator^(swizzle a, swizzle b) {} + +BLI_INT_OP VecBase operator%(swizzle a, T b) {} +BLI_INT_OP VecBase operator&(swizzle a, T b) {} +BLI_INT_OP VecBase operator|(swizzle a, T b) {} +BLI_INT_OP VecBase operator^(swizzle a, T b) {} + +BLI_INT_OP VecBase operator%(T a, swizzle b) {} +BLI_INT_OP VecBase operator&(T a, swizzle b) {} +BLI_INT_OP VecBase operator|(T a, swizzle b) {} +BLI_INT_OP VecBase operator^(T a, swizzle b) {} + +using uint = unsigned int; + +using float2 = VecBase; +using float3 = VecBase; +using float4 = VecBase; + +using uint2 = VecBase; +using uint3 = VecBase; +using uint4 = VecBase; + +using int2 = VecBase; +using int3 = VecBase; +using int4 = VecBase; + +using vec2 = float2; +using vec3 = float3; +using vec4 = float4; + +#define inout +#define in +#define out -- 2.30.2 From 3cfff3249a666acb41d33a19fe5626846ea49dc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Mon, 23 Sep 2024 08:44:12 +0200 Subject: [PATCH 02/90] Cleanup template and dependency, support recursive swizzle --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 238 +++++++++--------- 1 file changed, 125 insertions(+), 113 deletions(-) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index 7d00073759e..479f275843b 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -7,132 +7,144 @@ #define BLI_ENABLE_IF(condition) typename std::enable_if_t<(condition)> * = nullptr #define BLI_ENABLE_IF_VEC(_size, _test) int S = _size, BLI_ENABLE_IF((S _test)) -template= 3, bool at_least_vec4 = Size >= 4> -struct swizzle { - T x; - T y; - std::enable_if_t z; - std::enable_if_t w; -}; - -template= 3, bool at_least_vec4 = Size >= 4> -struct VecBase : swizzle { - - using swizzleT_vec2 = swizzle; - using swizzleT_vec3 = swizzle; - using swizzleT_vec4 = swizzle; - - using swizzle2_vec3 = std::enable_if_t; - using swizzle3_vec3 = std::enable_if_t; - using swizzle4_vec3 = std::enable_if_t; - - using swizzle2_vec4 = std::enable_if_t; - using swizzle3_vec4 = std::enable_if_t; - using swizzle4_vec4 = std::enable_if_t; - - union { - swizzleT_vec2 xx, xy, yx, yy; - swizzleT_vec3 xxx, xxy, xyx, xyy, yxx, yxy, yyx, yyy; - swizzleT_vec4 xxxx, xxxy, xxyx, xxyy, xyxx, xyxy, xyyx, xyyy, yxxx, yxxy, yxyx, yxyy, yyxx, - yyxy, yyyx, yyyy; - - swizzle2_vec3 xz, yz, zx, zy, zz, zw; - swizzle3_vec3 xxz, xyz, xzx, xzy, xzz, yxz, yyz, yzx, yzy, yzz, zxx, zxy, zxz, zyx, zyy, zyz, - zzx, zzy, zzz; - swizzle4_vec3 xxxz, xxyz, xxzx, xxzy, xxzz, xyxz, xyyz, xyzx, xyzy, xyzz, xzxx, xzxy, xzxz, - xzyx, xzyy, xzyz, xzzx, xzzy, xzzz, yxxz, yxyz, yxzx, yxzy, yxzz, yyxz, yyyz, yyzx, yyzy, - yyzz, yzxx, yzxy, yzxz, yzyx, yzyy, yzyz, yzzx, yzzy, yzzz, zxxx, zxxy, zxxz, zxyx, zxyy, - zxyz, zxzx, zxzy, zxzz, zyxx, zyxy, zyxz, zyyx, zyyy, zyyz, zyzx, zyzy, zyzz, zzxx, zzxy, - zzxz, zzyx, zzyy, zzyz, zzzx, zzzy, zzzz; - - swizzle2_vec4 xw, yw, wx, wy, wz, ww; - swizzle3_vec4 xxw, xyw, xzw, xwx, xwy, xwz, xww, yxw, yyw, yzw, ywx, ywy, ywz, yww, zxw, zyw, - zzw, zwx, zwy, zwz, zww, wxx, wxy, wxz, wxw, wyx, wyy, wyz, wyw, wzx, wzy, wzz, wzw, wwx, - wwy, wwz, www; - swizzle4_vec4 xxxw, xxyw, xxzw, xxwx, xxwy, xxwz, xxww, xyxw, xyyw, xyzw, xywx, xywy, xywz, - xyww, xzxw, xzyw, xzzw, xzwx, xzwy, xzwz, xzww, xwxx, xwxy, xwxz, xwxw, xwyx, xwyy, xwyz, - xwyw, xwzx, xwzy, xwzz, xwzw, xwwx, xwwy, xwwz, xwww, yxxw, yxyw, yxzw, yxwx, yxwy, yxwz, - yxww, yyxw, yyyw, yyzw, yywx, yywy, yywz, yyww, yzxw, yzyw, yzzw, yzwx, yzwy, yzwz, yzww, - ywxx, ywxy, ywxz, ywxw, ywyx, ywyy, ywyz, ywyw, ywzx, ywzy, ywzz, ywzw, ywwx, ywwy, ywwz, - ywww, zxxw, zxyw, zxzw, zxwx, zxwy, zxwz, zxww, zyxw, zyyw, zyzw, zywx, zywy, zywz, zyww, - zzxw, zzyw, zzzw, zzwx, zzwy, zzwz, zzww, zwxx, zwxy, zwxz, zwxw, zwyx, zwyy, zwyz, zwyw, - zwzx, zwzy, zwzz, zwzw, zwwx, zwwy, zwwz, zwww, wxxx, wxxy, wxxz, wxxw, wxyx, wxyy, wxyz, - wxyw, wxzx, wxzy, wxzz, wxzw, wxwx, wxwy, wxwz, wxww, wyxx, wyxy, wyxz, wyxw, wyyx, wyyy, - wyyz, wyyw, wyzx, wyzy, wyzz, wyzw, wywx, wywy, wywz, wyww, wzxx, wzxy, wzxz, wzxw, wzyx, - wzyy, wzyz, wzyw, wzzx, wzzy, wzzz, wzzw, wzwx, wzwy, wzwz, wzww, wwxx, wwxy, wwxz, wwxw, - wwyx, wwyy, wwyz, wwyw, wwzx, wwzy, wwzz, wwzw, wwwx, wwwy, wwwz, wwww; - }; - - VecBase() {} - VecBase(const VecBase &) {} - - VecBase(T) {} - VecBase(const swizzle &) {} - - template VecBase(T, T) {} - template VecBase(T, T, T) {} - template VecBase(T, T, T, T) {} - - template VecBase(swizzle, T) {} - template VecBase(T, swizzle) {} - - template VecBase(swizzle, T, T) {} - template VecBase(T, swizzle, T) {} - template VecBase(T, T, swizzle) {} - template VecBase(swizzle, swizzle) {} - template VecBase(swizzle, T) {} - template VecBase(T, swizzle) {} - +template struct VecOp { T operator[](int) {} + + VecOp operator+() const {} + VecOp operator-() const {} + + VecOp operator+(VecOp b) const {} + VecOp operator-(VecOp b) const {} + VecOp operator/(VecOp b) const {} + VecOp operator*(VecOp b) const {} + + VecOp operator+=(VecOp b) const {} + VecOp operator-=(VecOp b) const {} + VecOp operator/=(VecOp b) const {} + VecOp operator*=(VecOp b) const {} + + VecOp operator+(T b) const {} + VecOp operator-(T b) const {} + VecOp operator/(T b) const {} + VecOp operator*(T b) const {} + + VecOp operator+=(T b) const {} + VecOp operator-=(T b) const {} + VecOp operator/=(T b) const {} + VecOp operator*=(T b) const {} + + friend VecOp operator+(T a, VecOp b) {} + friend VecOp operator-(T a, VecOp b) {} + friend VecOp operator/(T a, VecOp b) {} + friend VecOp operator*(T a, VecOp b) {} + +#define BLI_INT_OP(_T) template))> + + BLI_INT_OP(T) VecOp operator%(VecOp b) {} + BLI_INT_OP(T) VecOp operator&(VecOp b) {} + BLI_INT_OP(T) VecOp operator|(VecOp b) {} + BLI_INT_OP(T) VecOp operator^(VecOp b) {} + + BLI_INT_OP(T) VecOp operator%=(VecOp b) {} + BLI_INT_OP(T) VecOp operator&=(VecOp b) {} + BLI_INT_OP(T) VecOp operator|=(VecOp b) {} + BLI_INT_OP(T) VecOp operator^=(VecOp b) {} + + BLI_INT_OP(T) VecOp operator%(T b) {} + BLI_INT_OP(T) VecOp operator&(T b) {} + BLI_INT_OP(T) VecOp operator|(T b) {} + BLI_INT_OP(T) VecOp operator^(T b) {} + + BLI_INT_OP(T) VecOp operator%=(T b) {} + BLI_INT_OP(T) VecOp operator&=(T b) {} + BLI_INT_OP(T) VecOp operator|=(T b) {} + BLI_INT_OP(T) VecOp operator^=(T b) {} + + BLI_INT_OP(T) friend VecOp operator%(T a, VecOp b) {} + BLI_INT_OP(T) friend VecOp operator&(T a, VecOp b) {} + BLI_INT_OP(T) friend VecOp operator|(T a, VecOp b) {} + BLI_INT_OP(T) friend VecOp operator^(T a, VecOp b) {} }; -template VecBase operator+(swizzle a, swizzle b) {} -template VecBase operator-(swizzle a, swizzle b) {} -template VecBase operator/(swizzle a, swizzle b) {} -template VecBase operator*(swizzle a, swizzle b) {} +template struct VecBase {}; -template VecBase operator+(swizzle a, T b) {} -template VecBase operator-(swizzle a, T b) {} -template VecBase operator/(swizzle a, T b) {} -template VecBase operator*(swizzle a, T b) {} +template struct VecSwizzle2 { + static VecBase xx, xy, yx, yy; + static VecBase xxx, xxy, xyx, xyy, yxx, yxy, yyx, yyy; + static VecBase xxxx, xxxy, xxyx, xxyy, xyxx, xyxy, xyyx, xyyy, yxxx, yxxy, yxyx, yxyy, + yyxx, yyxy, yyyx, yyyy; +}; -template VecBase operator+(T a, swizzle b) {} -template VecBase operator-(T a, swizzle b) {} -template VecBase operator/(T a, swizzle b) {} -template VecBase operator*(T a, swizzle b) {} +template struct VecSwizzle3 : VecSwizzle2 { + static VecBase xz, yz, zx, zy, zz, zw; + static VecBase xxz, xyz, xzx, xzy, xzz, yxz, yyz, yzx, yzy, yzz, zxx, zxy, zxz, zyx, zyy, + zyz, zzx, zzy, zzz; + static VecBase xxxz, xxyz, xxzx, xxzy, xxzz, xyxz, xyyz, xyzx, xyzy, xyzz, xzxx, xzxy, + xzxz, xzyx, xzyy, xzyz, xzzx, xzzy, xzzz, yxxz, yxyz, yxzx, yxzy, yxzz, yyxz, yyyz, yyzx, + yyzy, yyzz, yzxx, yzxy, yzxz, yzyx, yzyy, yzyz, yzzx, yzzy, yzzz, zxxx, zxxy, zxxz, zxyx, + zxyy, zxyz, zxzx, zxzy, zxzz, zyxx, zyxy, zyxz, zyyx, zyyy, zyyz, zyzx, zyzy, zyzz, zzxx, + zzxy, zzxz, zzyx, zzyy, zzyz, zzzx, zzzy, zzzz; +}; -/* Needed to support double literals. */ -template VecBase operator+(swizzle a, double b) {} -template VecBase operator-(swizzle a, double b) {} -template VecBase operator/(swizzle a, double b) {} -template VecBase operator*(swizzle a, double b) {} +template struct VecSwizzle4 : VecSwizzle3 { + static VecBase xw, yw, wx, wy, wz, ww; + static VecBase xxw, xyw, xzw, xwx, xwy, xwz, xww, yxw, yyw, yzw, ywx, ywy, ywz, yww, zxw, + zyw, zzw, zwx, zwy, zwz, zww, wxx, wxy, wxz, wxw, wyx, wyy, wyz, wyw, wzx, wzy, wzz, wzw, + wwx, wwy, wwz, www; + static VecBase xxxw, xxyw, xxzw, xxwx, xxwy, xxwz, xxww, xyxw, xyyw, xyzw, xywx, xywy, + xywz, xyww, xzxw, xzyw, xzzw, xzwx, xzwy, xzwz, xzww, xwxx, xwxy, xwxz, xwxw, xwyx, xwyy, + xwyz, xwyw, xwzx, xwzy, xwzz, xwzw, xwwx, xwwy, xwwz, xwww, yxxw, yxyw, yxzw, yxwx, yxwy, + yxwz, yxww, yyxw, yyyw, yyzw, yywx, yywy, yywz, yyww, yzxw, yzyw, yzzw, yzwx, yzwy, yzwz, + yzww, ywxx, ywxy, ywxz, ywxw, ywyx, ywyy, ywyz, ywyw, ywzx, ywzy, ywzz, ywzw, ywwx, ywwy, + ywwz, ywww, zxxw, zxyw, zxzw, zxwx, zxwy, zxwz, zxww, zyxw, zyyw, zyzw, zywx, zywy, zywz, + zyww, zzxw, zzyw, zzzw, zzwx, zzwy, zzwz, zzww, zwxx, zwxy, zwxz, zwxw, zwyx, zwyy, zwyz, + zwyw, zwzx, zwzy, zwzz, zwzw, zwwx, zwwy, zwwz, zwww, wxxx, wxxy, wxxz, wxxw, wxyx, wxyy, + wxyz, wxyw, wxzx, wxzy, wxzz, wxzw, wxwx, wxwy, wxwz, wxww, wyxx, wyxy, wyxz, wyxw, wyyx, + wyyy, wyyz, wyyw, wyzx, wyzy, wyzz, wyzw, wywx, wywy, wywz, wyww, wzxx, wzxy, wzxz, wzxw, + wzyx, wzyy, wzyz, wzyw, wzzx, wzzy, wzzz, wzzw, wzwx, wzwy, wzwz, wzww, wwxx, wwxy, wwxz, + wwxw, wwyx, wwyy, wwyz, wwyw, wwzx, wwzy, wwzz, wwzw, wwwx, wwwy, wwwz, wwww; +}; -template VecBase operator+(double a, swizzle b) {} -template VecBase operator-(double a, swizzle b) {} -template VecBase operator/(double a, swizzle b) {} -template VecBase operator*(double a, swizzle b) {} +template struct VecBase : VecOp, VecSwizzle2 { + T x, y; -#define BLI_INT_OP template))> -BLI_INT_OP VecBase operator%(swizzle a, swizzle b) {} -BLI_INT_OP VecBase operator&(swizzle a, swizzle b) {} -BLI_INT_OP VecBase operator|(swizzle a, swizzle b) {} -BLI_INT_OP VecBase operator^(swizzle a, swizzle b) {} + VecBase() = default; + VecBase(VecOp) {} + explicit VecBase(T) {} + explicit VecBase(T, T) {} +}; -BLI_INT_OP VecBase operator%(swizzle a, T b) {} -BLI_INT_OP VecBase operator&(swizzle a, T b) {} -BLI_INT_OP VecBase operator|(swizzle a, T b) {} -BLI_INT_OP VecBase operator^(swizzle a, T b) {} +template struct VecBase : VecOp, VecSwizzle3 { + T x, y, z; -BLI_INT_OP VecBase operator%(T a, swizzle b) {} -BLI_INT_OP VecBase operator&(T a, swizzle b) {} -BLI_INT_OP VecBase operator|(T a, swizzle b) {} -BLI_INT_OP VecBase operator^(T a, swizzle b) {} + VecBase() = default; + VecBase(VecOp) {} + explicit VecBase(T) {} + explicit VecBase(T, T, T) {} + explicit VecBase(VecBase, T) {} + explicit VecBase(T, VecBase) {} +}; + +template struct VecBase : VecOp, VecSwizzle4 { + T x, y, z, w; + + VecBase() = default; + VecBase(VecOp) {} + explicit VecBase(T) {} + explicit VecBase(T, T, T, T) {} + explicit VecBase(VecBase, T, T) {} + explicit VecBase(T, VecBase, T) {} + explicit VecBase(T, T, VecBase) {} + explicit VecBase(VecBase, VecBase) {} + explicit VecBase(VecBase, T) {} + explicit VecBase(T, VecBase) {} +}; using uint = unsigned int; -using float2 = VecBase; -using float3 = VecBase; -using float4 = VecBase; +using float2 = VecBase; +using float3 = VecBase; +using float4 = VecBase; using uint2 = VecBase; using uint3 = VecBase; -- 2.30.2 From 554b83ee52ef280376a77115b151418644a2540f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Mon, 23 Sep 2024 08:46:40 +0200 Subject: [PATCH 03/90] Cleanup macros --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index 479f275843b..eaee47a1c85 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -4,9 +4,6 @@ #include -#define BLI_ENABLE_IF(condition) typename std::enable_if_t<(condition)> * = nullptr -#define BLI_ENABLE_IF_VEC(_size, _test) int S = _size, BLI_ENABLE_IF((S _test)) - template struct VecOp { T operator[](int) {} @@ -38,32 +35,35 @@ template struct VecOp { friend VecOp operator/(T a, VecOp b) {} friend VecOp operator*(T a, VecOp b) {} -#define BLI_INT_OP(_T) template))> +#define INT_OP \ + template> * = nullptr> - BLI_INT_OP(T) VecOp operator%(VecOp b) {} - BLI_INT_OP(T) VecOp operator&(VecOp b) {} - BLI_INT_OP(T) VecOp operator|(VecOp b) {} - BLI_INT_OP(T) VecOp operator^(VecOp b) {} + INT_OP VecOp operator%(VecOp b) {} + INT_OP VecOp operator&(VecOp b) {} + INT_OP VecOp operator|(VecOp b) {} + INT_OP VecOp operator^(VecOp b) {} - BLI_INT_OP(T) VecOp operator%=(VecOp b) {} - BLI_INT_OP(T) VecOp operator&=(VecOp b) {} - BLI_INT_OP(T) VecOp operator|=(VecOp b) {} - BLI_INT_OP(T) VecOp operator^=(VecOp b) {} + INT_OP VecOp operator%=(VecOp b) {} + INT_OP VecOp operator&=(VecOp b) {} + INT_OP VecOp operator|=(VecOp b) {} + INT_OP VecOp operator^=(VecOp b) {} - BLI_INT_OP(T) VecOp operator%(T b) {} - BLI_INT_OP(T) VecOp operator&(T b) {} - BLI_INT_OP(T) VecOp operator|(T b) {} - BLI_INT_OP(T) VecOp operator^(T b) {} + INT_OP VecOp operator%(T b) {} + INT_OP VecOp operator&(T b) {} + INT_OP VecOp operator|(T b) {} + INT_OP VecOp operator^(T b) {} - BLI_INT_OP(T) VecOp operator%=(T b) {} - BLI_INT_OP(T) VecOp operator&=(T b) {} - BLI_INT_OP(T) VecOp operator|=(T b) {} - BLI_INT_OP(T) VecOp operator^=(T b) {} + INT_OP VecOp operator%=(T b) {} + INT_OP VecOp operator&=(T b) {} + INT_OP VecOp operator|=(T b) {} + INT_OP VecOp operator^=(T b) {} - BLI_INT_OP(T) friend VecOp operator%(T a, VecOp b) {} - BLI_INT_OP(T) friend VecOp operator&(T a, VecOp b) {} - BLI_INT_OP(T) friend VecOp operator|(T a, VecOp b) {} - BLI_INT_OP(T) friend VecOp operator^(T a, VecOp b) {} + INT_OP friend VecOp operator%(T a, VecOp b) {} + INT_OP friend VecOp operator&(T a, VecOp b) {} + INT_OP friend VecOp operator|(T a, VecOp b) {} + INT_OP friend VecOp operator^(T a, VecOp b) {} + +#undef INT_OP }; template struct VecBase {}; -- 2.30.2 From e67be951bbb46529bd59a7f08b6c287182cf8b37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Mon, 23 Sep 2024 11:21:21 +0200 Subject: [PATCH 04/90] Fix typo --- source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index eaee47a1c85..104974b0b87 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -114,7 +114,7 @@ template struct VecBase : VecOp, VecSwizzle2 { explicit VecBase(T, T) {} }; -template struct VecBase : VecOp, VecSwizzle3 { +template struct VecBase : VecOp, VecSwizzle3 { T x, y, z; VecBase() = default; @@ -125,7 +125,7 @@ template struct VecBase : VecOp, VecSwizzle3 { explicit VecBase(T, VecBase) {} }; -template struct VecBase : VecOp, VecSwizzle4 { +template struct VecBase : VecOp, VecSwizzle4 { T x, y, z, w; VecBase() = default; -- 2.30.2 From f74f36b32e5e3544ba96d3d78d1dc19c9bd14dd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Mon, 23 Sep 2024 11:21:53 +0200 Subject: [PATCH 05/90] Add 1 component vector with auto cast --- source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index 104974b0b87..00d226c374f 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -105,6 +105,14 @@ template struct VecSwizzle4 : VecSwizzle3 { wwxw, wwyx, wwyy, wwyz, wwyw, wwzx, wwzy, wwzz, wwzw, wwwx, wwwy, wwwz, wwww; }; +template struct VecBase { + T x; + + VecBase() = default; + VecBase(VecOp) {} + operator T() const {} +}; + template struct VecBase : VecOp, VecSwizzle2 { T x, y; -- 2.30.2 From cb7624eeef7472274b62d6e207684cf922e83d07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Mon, 23 Sep 2024 11:23:24 +0200 Subject: [PATCH 06/90] Add texture stubs --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index 00d226c374f..aa5df4ecd7f 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -169,3 +169,62 @@ using vec4 = float4; #define inout #define in #define out + +template using Vec4 = VecBase; +template using VecInt = VecBase; +template using VecFlt = VecBase; + +template struct SamplerBase { + static constexpr int coord_dim = Dimensions + int(Cube) + int(Array); + static constexpr int deriv_dim = Dimensions + int(Cube); + static constexpr int extent_dim = Dimensions + int(Array); + + using int_coord_type = VecBase; + using flt_coord_type = VecBase; + using derivative_type = VecBase; + using data_vec_type = VecBase; + using size_vec_type = VecBase; +}; + +#define TEX_TEMPLATE \ + template + +TEX_TEMPLATE SizeVec textureSize(T, int) {} +TEX_TEMPLATE DataVec texelFetch(T, IntCoord, int) {} +TEX_TEMPLATE DataVec texelFetchOffset(T, IntCoord, int, IntCoord) {} +TEX_TEMPLATE DataVec texture(T, FltCoord) {} +TEX_TEMPLATE DataVec textureGather(T, FltCoord) {} +TEX_TEMPLATE DataVec textureGrad(T, FltCoord, DerivVec, DerivVec) {} +TEX_TEMPLATE DataVec textureLod(T, FltCoord, double) {} + +#undef TEX_TEMPLATE + +using sampler1D = SamplerBase; +using sampler2D = SamplerBase; +using sampler3D = SamplerBase; +using isampler1D = SamplerBase; +using isampler2D = SamplerBase; +using isampler3D = SamplerBase; +using usampler1D = SamplerBase; +using usampler2D = SamplerBase; +using usampler3D = SamplerBase; + +using sampler1DArray = SamplerBase; +using sampler2DArray = SamplerBase; +using isampler1DArray = SamplerBase; +using isampler2DArray = SamplerBase; +using usampler1DArray = SamplerBase; +using usampler2DArray = SamplerBase; + +using samplerCube = SamplerBase; +using isamplerCube = SamplerBase; +using usamplerCube = SamplerBase; + +using samplerCubeArray = SamplerBase; +using isamplerCubeArray = SamplerBase; +using usamplerCubeArray = SamplerBase; -- 2.30.2 From fcd3772baffe97e1e6e31b07a28a245d6eecc821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Mon, 23 Sep 2024 11:45:31 +0200 Subject: [PATCH 07/90] Int vectors alias --- source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index aa5df4ecd7f..3b651d8895c 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -166,6 +166,14 @@ using vec2 = float2; using vec3 = float3; using vec4 = float4; +using ivec2 = int2; +using ivec3 = int3; +using ivec4 = int4; + +using uvec2 = uint2; +using uvec3 = uint3; +using uvec4 = uint4; + #define inout #define in #define out -- 2.30.2 From 01c1a2e60f04169877e63706f467d5d0eb649eb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Mon, 23 Sep 2024 11:45:40 +0200 Subject: [PATCH 08/90] image stubs --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index 3b651d8895c..e4ad5b24e65 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -236,3 +236,53 @@ using usamplerCube = SamplerBase; using samplerCubeArray = SamplerBase; using isamplerCubeArray = SamplerBase; using usamplerCubeArray = SamplerBase; + +template struct ImageBase { + static constexpr int coord_dim = Dimensions + int(Cube) + int(Array); + static constexpr int deriv_dim = Dimensions + int(Cube); + static constexpr int extent_dim = Dimensions + int(Array); + + using int_coord_type = VecBase; + using data_vec_type = VecBase; + using size_vec_type = VecBase; +}; + +#define IMG_TEMPLATE \ + template + +IMG_TEMPLATE SizeVec imageSize(T) {} +IMG_TEMPLATE DataVec imageLoad(T, IntCoord) {} +IMG_TEMPLATE void imageStore(T, IntCoord, DataVec) {} +IMG_TEMPLATE void imageFence(T) {} +#define imageLoadFast imageLoad +#define imageStoreFast imageStore + +#undef IMG_TEMPLATE + +using sampler1D = SamplerBase; +using sampler2D = SamplerBase; +using sampler3D = SamplerBase; +using isampler1D = SamplerBase; +using isampler2D = SamplerBase; +using isampler3D = SamplerBase; +using usampler1D = SamplerBase; +using usampler2D = SamplerBase; +using usampler3D = SamplerBase; + +using sampler1DArray = SamplerBase; +using sampler2DArray = SamplerBase; +using isampler1DArray = SamplerBase; +using isampler2DArray = SamplerBase; +using usampler1DArray = SamplerBase; +using usampler2DArray = SamplerBase; + +using samplerCube = SamplerBase; +using isamplerCube = SamplerBase; +using usamplerCube = SamplerBase; + +using samplerCubeArray = SamplerBase; +using isamplerCubeArray = SamplerBase; +using usamplerCubeArray = SamplerBase; -- 2.30.2 From 4568437b044aa4db743473d8ee614dbf9847a9b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Mon, 23 Sep 2024 12:25:22 +0200 Subject: [PATCH 09/90] Add vector explicit casts --- source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index e4ad5b24e65..1f099781a45 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -110,6 +110,7 @@ template struct VecBase { VecBase() = default; VecBase(VecOp) {} + template explicit VecBase(VecBase) {} operator T() const {} }; @@ -118,6 +119,7 @@ template struct VecBase : VecOp, VecSwizzle2 { VecBase() = default; VecBase(VecOp) {} + template explicit VecBase(VecBase) {} explicit VecBase(T) {} explicit VecBase(T, T) {} }; @@ -127,6 +129,7 @@ template struct VecBase : VecOp, VecSwizzle3 { VecBase() = default; VecBase(VecOp) {} + template explicit VecBase(VecBase) {} explicit VecBase(T) {} explicit VecBase(T, T, T) {} explicit VecBase(VecBase, T) {} @@ -138,6 +141,7 @@ template struct VecBase : VecOp, VecSwizzle4 { VecBase() = default; VecBase(VecOp) {} + template explicit VecBase(VecBase) {} explicit VecBase(T) {} explicit VecBase(T, T, T, T) {} explicit VecBase(VecBase, T, T) {} -- 2.30.2 From 0738573cfc70024eb9d257d58758aeb7d2ad5b65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Mon, 23 Sep 2024 12:59:11 +0200 Subject: [PATCH 10/90] Boolean vectors --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index 1f099781a45..b3973006aba 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -152,6 +152,47 @@ template struct VecBase : VecOp, VecSwizzle4 { explicit VecBase(T, VecBase) {} }; +/* Boolean vectors do not have operators and are not convertible from other types. */ + +template<> struct VecBase { + bool x; + + VecBase() = default; + operator bool() const {} +}; + +template<> struct VecBase : VecSwizzle2 { + bool x, y; + + VecBase() = default; + explicit VecBase(bool) {} + explicit VecBase(bool, bool) {} +}; + +template<> struct VecBase : VecSwizzle3 { + bool x, y, z; + + VecBase() = default; + explicit VecBase(bool) {} + explicit VecBase(bool, bool, bool) {} + explicit VecBase(VecBase, bool) {} + explicit VecBase(bool, VecBase) {} +}; + +template<> struct VecBase : VecSwizzle4 { + bool x, y, z, w; + + VecBase() = default; + explicit VecBase(bool) {} + explicit VecBase(bool, bool, bool, bool) {} + explicit VecBase(VecBase, bool, bool) {} + explicit VecBase(bool, VecBase, bool) {} + explicit VecBase(bool, bool, VecBase) {} + explicit VecBase(VecBase, VecBase) {} + explicit VecBase(VecBase, bool) {} + explicit VecBase(bool, VecBase) {} +}; + using uint = unsigned int; using float2 = VecBase; @@ -166,6 +207,10 @@ using int2 = VecBase; using int3 = VecBase; using int4 = VecBase; +using bool2 = VecBase; +using bool3 = VecBase; +using bool4 = VecBase; + using vec2 = float2; using vec3 = float3; using vec4 = float4; @@ -178,6 +223,22 @@ using uvec2 = uint2; using uvec3 = uint3; using uvec4 = uint4; +using bvec2 = bool2; +using bvec3 = bool3; +using bvec4 = bool4; + +template VecBase greaterThan(VecBase, VecBase) {} +template VecBase lessThan(VecBase, VecBase) {} +template VecBase lessThanEqual(VecBase, VecBase) {} +template VecBase greaterThanEqual(VecBase, VecBase) {} +template VecBase equal(VecBase, VecBase) {} +template VecBase notEqual(VecBase, VecBase) {} +template bool any(VecBase) {} +template bool all(VecBase) {} +/* `not` is a C++ keyword. Use dirty macro to allow this. */ +template VecBase not_impl(VecBase) {} +#define not not_impl + #define inout #define in #define out -- 2.30.2 From f3759f717c496fee3ac1bd9383aa7b1ed8181f84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Mon, 23 Sep 2024 16:48:15 +0200 Subject: [PATCH 11/90] Simplify vector ops and remove vec1 --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 109 ++++++++---------- 1 file changed, 46 insertions(+), 63 deletions(-) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index b3973006aba..b5d8f7896e2 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -4,70 +4,72 @@ #include +template struct VecBase {}; + template struct VecOp { + using VecT = VecBase; + T operator[](int) {} - VecOp operator+() const {} - VecOp operator-() const {} + VecT operator+() const {} + VecT operator-() const {} - VecOp operator+(VecOp b) const {} - VecOp operator-(VecOp b) const {} - VecOp operator/(VecOp b) const {} - VecOp operator*(VecOp b) const {} + VecT operator+(VecT b) const {} + VecT operator-(VecT b) const {} + VecT operator/(VecT b) const {} + VecT operator*(VecT b) const {} - VecOp operator+=(VecOp b) const {} - VecOp operator-=(VecOp b) const {} - VecOp operator/=(VecOp b) const {} - VecOp operator*=(VecOp b) const {} + VecT operator+=(VecT b) const {} + VecT operator-=(VecT b) const {} + VecT operator/=(VecT b) const {} + VecT operator*=(VecT b) const {} - VecOp operator+(T b) const {} - VecOp operator-(T b) const {} - VecOp operator/(T b) const {} - VecOp operator*(T b) const {} + VecT operator+(T b) const {} + VecT operator-(T b) const {} + VecT operator/(T b) const {} + VecT operator*(T b) const {} - VecOp operator+=(T b) const {} - VecOp operator-=(T b) const {} - VecOp operator/=(T b) const {} - VecOp operator*=(T b) const {} + VecT operator+=(T b) const {} + VecT operator-=(T b) const {} + VecT operator/=(T b) const {} + VecT operator*=(T b) const {} - friend VecOp operator+(T a, VecOp b) {} - friend VecOp operator-(T a, VecOp b) {} - friend VecOp operator/(T a, VecOp b) {} - friend VecOp operator*(T a, VecOp b) {} + friend VecT operator+(T a, VecT b) {} + friend VecT operator-(T a, VecT b) {} + friend VecT operator/(T a, VecT b) {} + friend VecT operator*(T a, VecT b) {} #define INT_OP \ template> * = nullptr> - INT_OP VecOp operator%(VecOp b) {} - INT_OP VecOp operator&(VecOp b) {} - INT_OP VecOp operator|(VecOp b) {} - INT_OP VecOp operator^(VecOp b) {} + INT_OP VecT operator%(VecT b) {} + INT_OP VecT operator&(VecT b) {} + INT_OP VecT operator|(VecT b) {} + INT_OP VecT operator^(VecT b) {} - INT_OP VecOp operator%=(VecOp b) {} - INT_OP VecOp operator&=(VecOp b) {} - INT_OP VecOp operator|=(VecOp b) {} - INT_OP VecOp operator^=(VecOp b) {} + INT_OP VecT operator%=(VecT b) {} + INT_OP VecT operator&=(VecT b) {} + INT_OP VecT operator|=(VecT b) {} + INT_OP VecT operator^=(VecT b) {} - INT_OP VecOp operator%(T b) {} - INT_OP VecOp operator&(T b) {} - INT_OP VecOp operator|(T b) {} - INT_OP VecOp operator^(T b) {} + INT_OP VecT operator%(T b) {} + INT_OP VecT operator&(T b) {} + INT_OP VecT operator|(T b) {} + INT_OP VecT operator^(T b) {} - INT_OP VecOp operator%=(T b) {} - INT_OP VecOp operator&=(T b) {} - INT_OP VecOp operator|=(T b) {} - INT_OP VecOp operator^=(T b) {} + INT_OP VecT operator%=(T b) {} + INT_OP VecT operator&=(T b) {} + INT_OP VecT operator|=(T b) {} + INT_OP VecT operator^=(T b) {} - INT_OP friend VecOp operator%(T a, VecOp b) {} - INT_OP friend VecOp operator&(T a, VecOp b) {} - INT_OP friend VecOp operator|(T a, VecOp b) {} - INT_OP friend VecOp operator^(T a, VecOp b) {} + INT_OP friend VecT operator%(T a, VecT b) {} + INT_OP friend VecT operator&(T a, VecT b) {} + INT_OP friend VecT operator|(T a, VecT b) {} + INT_OP friend VecT operator^(T a, VecT b) {} #undef INT_OP }; -template struct VecBase {}; - template struct VecSwizzle2 { static VecBase xx, xy, yx, yy; static VecBase xxx, xxy, xyx, xyy, yxx, yxy, yyx, yyy; @@ -105,20 +107,10 @@ template struct VecSwizzle4 : VecSwizzle3 { wwxw, wwyx, wwyy, wwyz, wwyw, wwzx, wwzy, wwzz, wwzw, wwwx, wwwy, wwwz, wwww; }; -template struct VecBase { - T x; - - VecBase() = default; - VecBase(VecOp) {} - template explicit VecBase(VecBase) {} - operator T() const {} -}; - template struct VecBase : VecOp, VecSwizzle2 { T x, y; VecBase() = default; - VecBase(VecOp) {} template explicit VecBase(VecBase) {} explicit VecBase(T) {} explicit VecBase(T, T) {} @@ -128,7 +120,6 @@ template struct VecBase : VecOp, VecSwizzle3 { T x, y, z; VecBase() = default; - VecBase(VecOp) {} template explicit VecBase(VecBase) {} explicit VecBase(T) {} explicit VecBase(T, T, T) {} @@ -140,7 +131,6 @@ template struct VecBase : VecOp, VecSwizzle4 { T x, y, z, w; VecBase() = default; - VecBase(VecOp) {} template explicit VecBase(VecBase) {} explicit VecBase(T) {} explicit VecBase(T, T, T, T) {} @@ -154,13 +144,6 @@ template struct VecBase : VecOp, VecSwizzle4 { /* Boolean vectors do not have operators and are not convertible from other types. */ -template<> struct VecBase { - bool x; - - VecBase() = default; - operator bool() const {} -}; - template<> struct VecBase : VecSwizzle2 { bool x, y; -- 2.30.2 From 552be099cbbf616a3f905f8adc78f0aa73ef40ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Mon, 23 Sep 2024 16:48:48 +0200 Subject: [PATCH 12/90] Add optional bias to texture function --- source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index b5d8f7896e2..2ae42b481c3 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -253,7 +253,7 @@ template stru TEX_TEMPLATE SizeVec textureSize(T, int) {} TEX_TEMPLATE DataVec texelFetch(T, IntCoord, int) {} TEX_TEMPLATE DataVec texelFetchOffset(T, IntCoord, int, IntCoord) {} -TEX_TEMPLATE DataVec texture(T, FltCoord) {} +TEX_TEMPLATE DataVec texture(T, FltCoord, double bias = 0.0) {} TEX_TEMPLATE DataVec textureGather(T, FltCoord) {} TEX_TEMPLATE DataVec textureGrad(T, FltCoord, DerivVec, DerivVec) {} TEX_TEMPLATE DataVec textureLod(T, FltCoord, double) {} -- 2.30.2 From d917537e2c19466bfce9346899f3cd787ab68ad9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Mon, 23 Sep 2024 16:49:04 +0200 Subject: [PATCH 13/90] Builtin functions --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index 2ae42b481c3..d9d6908cdcc 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -334,3 +334,124 @@ using usamplerCube = SamplerBase; using samplerCubeArray = SamplerBase; using isamplerCubeArray = SamplerBase; using usamplerCubeArray = SamplerBase; + +template VecBase bitCount(VecBase) {} +template VecBase bitCount(VecBase) {} +template VecBase bitfieldExtract(VecBase, int, int) {} +template VecBase bitfieldExtract(VecBase, int, int) {} +template VecBase bitfieldInsert(VecBase, VecBase, int, int) {} +template VecBase bitfieldInsert(VecBase, VecBase, int, int) {} +template VecBase bitfieldReverse(VecBase) {} +template VecBase bitfieldReverse(VecBase) {} +int bitCount(int) {} +int bitCount(uint) {} +int bitfieldExtract(int) {} +int bitfieldExtract(uint) {} +int bitfieldInsert(int) {} +int bitfieldInsert(uint) {} +int bitfieldReverse(int) {} +int bitfieldReverse(uint) {} + +template VecBase findLSB(VecBase) {} +template VecBase findLSB(VecBase) {} +template VecBase findMSB(VecBase) {} +template VecBase findMSB(VecBase) {} +int findMSB(int) {} +int findMSB(uint) {} + +/* Math Functions. */ +template T abs(T) {} +template T clamp(T, T, T) {} +template T max(T, T) {} +template T min(T, T) {} +template T sign(T, T) {} +template T clamp(T, U, U) {} +template T max(T, U) {} +template T min(T, U) {} +/* TODO(fclem): These should be restricted to floats. */ +template T ceil(T) {} +template T exp(T) {} +template T exp2(T) {} +template T floor(T) {} +template T fma(T, T, T) {} +template T fract(T) {} +template T frexp(T, T) {} +template T inversesqrt(T) {} +template T isinf(T) {} +template T isnan(T) {} +template T log(T) {} +template T log2(T) {} +template T mod(T, double); +template T mod(T, T); +template T modf(T, T); +template T pow(T, T) {} +template T round(T) {} +template T smoothstep(T, T, T) {} +template T sqrt(T) {} +template T step(T) {} +template T trunc(T) {} +template T ldexp(T, U) {} + +template T acos(T) {} +template T acosh(T) {} +template T asin(T) {} +template T asinh(T) {} +template T atan(T, T) {} +template T atan(T) {} +template T atanh(T) {} +template T cos(T) {} +template T cosh(T) {} +template T sin(T) {} +template T sinh(T) {} +template T tan(T) {} +template T tanh(T) {} + +template T degrees(T) {} +template T radians(T) {} + +/* Declared explicitely to avoid type errors. */ +double mix(double, double, double) {} +template VecBase mix(VecBase, VecBase, double) {} +template VecBase mix(VecBase, VecBase, VecBase) {} + +VecBase cross(VecBase, VecBase) {} +template float dot(VecBase, VecBase) {} +template float distance(VecBase, VecBase) {} +template float length(VecBase) {} +template VecBase normalize(VecBase) {} + +template VecBase floatBitsToInt(VecBase) {} +template VecBase floatBitsToUint(VecBase) {} +template VecBase intBitsToFloat(VecBase) {} +template VecBase uintBitsToFloat(VecBase) {} +int floatBitsToInt(double) {} +uint floatBitsToUint(double) {} +double intBitsToFloat(int) {} +double uintBitsToFloat(uint) {} + +template T dFdx(T) {} +template T dFdy(T) {} +template T fwidth(T) {} + +/* Geometric functions. */ +template float faceforward(VecBase, VecBase, VecBase) {} +template float reflect(VecBase, VecBase) {} +template float refract(VecBase, VecBase, double) {} + +/* Packing functions. */ +uint packHalf2x16(float2) {} +uint packUnorm2x16(float2) {} +uint packSnorm2x16(float2) {} +uint packUnorm4x8(float4) {} +uint packSnorm4x8(float4) {} +float2 unpackHalf2x16(uint) {} +float2 unpackUnorm2x16(uint) {} +float2 unpackSnorm2x16(uint) {} +float4 unpackUnorm4x8(uint) {} +float4 unpackSnorm4x8(uint) {} + +#if 0 /* TODO Matrices */ +template float determinant(MatBase) {} +template MatBase inverse(MatBase) {} +template MatBase transpose(MatBase) {} +#endif -- 2.30.2 From ddc4e33fbcccd0046ded7ef04225ff67a23ef012 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Mon, 23 Sep 2024 17:14:03 +0200 Subject: [PATCH 14/90] Add color swizzle --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 46 +++++++++++++++++-- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index d9d6908cdcc..dd14017f99a 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -77,6 +77,13 @@ template struct VecSwizzle2 { yyxx, yyxy, yyyx, yyyy; }; +template struct ColSwizzle2 { + static VecBase rr, rg, gr, gg; + static VecBase rrr, rrg, rgr, rgg, grr, grg, ggr, ggg; + static VecBase rrrr, rrrg, rrgr, rrgg, rgrr, rgrg, rggr, rggg, grrr, grrg, grgr, grgg, + ggrr, ggrg, gggr, gggg; +}; + template struct VecSwizzle3 : VecSwizzle2 { static VecBase xz, yz, zx, zy, zz, zw; static VecBase xxz, xyz, xzx, xzy, xzz, yxz, yyz, yzx, yzy, yzz, zxx, zxy, zxz, zyx, zyy, @@ -88,6 +95,17 @@ template struct VecSwizzle3 : VecSwizzle2 { zzxy, zzxz, zzyx, zzyy, zzyz, zzzx, zzzy, zzzz; }; +template struct ColSwizzle3 : ColSwizzle2 { + static VecBase rb, gb, br, bg, bb, bw; + static VecBase rrb, rgb, rbr, rbg, rbb, grb, ggb, gbr, gbg, gbb, brr, brg, brb, bgr, bgg, + bgb, bbr, bbg, bbb; + static VecBase rrrb, rrgb, rrbr, rrbg, rrbb, rgrb, rggb, rgbr, rgbg, rgbb, rbrr, rbrg, + rbrb, rbgr, rbgg, rbgb, rbbr, rbbg, rbbb, grrb, grgb, grbr, grbg, grbb, ggrb, gggb, ggbr, + ggbg, ggbb, gbrr, gbrg, gbrb, gbgr, gbgg, gbgb, gbbr, gbbg, gbbb, brrr, brrg, brrb, brgr, + brgg, brgb, brbr, brbg, brbb, bgrr, bgrg, bgrb, bggr, bggg, bggb, bgbr, bgbg, bgbb, bbrr, + bbrg, bbrb, bbgr, bbgg, bbgb, bbbr, bbbg, bbbb; +}; + template struct VecSwizzle4 : VecSwizzle3 { static VecBase xw, yw, wx, wy, wz, ww; static VecBase xxw, xyw, xzw, xwx, xwy, xwz, xww, yxw, yyw, yzw, ywx, ywy, ywz, yww, zxw, @@ -107,8 +125,28 @@ template struct VecSwizzle4 : VecSwizzle3 { wwxw, wwyx, wwyy, wwyz, wwyw, wwzx, wwzy, wwzz, wwzw, wwwx, wwwy, wwwz, wwww; }; -template struct VecBase : VecOp, VecSwizzle2 { +template struct ColSwizzle4 : ColSwizzle3 { + static VecBase ra, ga, ar, ag, ab, aa; + static VecBase rra, rga, rba, rar, rag, rab, raa, gra, gga, gba, gar, gag, gab, gaa, bra, + bga, bba, bar, bag, bab, baa, arr, arg, arb, ara, agr, agg, agb, aga, abr, abg, abb, aba, + aar, aag, aab, aaa; + static VecBase rrra, rrga, rrba, rrar, rrag, rrab, rraa, rgra, rgga, rgba, rgar, rgag, + rgab, rgaa, rbra, rbga, rbba, rbar, rbag, rbab, rbaa, rarr, rarg, rarb, rara, ragr, ragg, + ragb, raga, rabr, rabg, rabb, raba, raar, raag, raab, raaa, grra, grga, grba, grar, grag, + grab, graa, ggra, ggga, ggba, ggar, ggag, ggab, ggaa, gbra, gbga, gbba, gbar, gbag, gbab, + gbaa, garr, garg, garb, gara, gagr, gagg, gagb, gaga, gabr, gabg, gabb, gaba, gaar, gaag, + gaab, gaaa, brra, brga, brba, brar, brag, brab, braa, bgra, bgga, bgba, bgar, bgag, bgab, + bgaa, bbra, bbga, bbba, bbar, bbag, bbab, bbaa, barr, barg, barb, bara, bagr, bagg, bagb, + baga, babr, babg, babb, baba, baar, baag, baab, baaa, arrr, arrg, arrb, arra, argr, argg, + argb, arga, arbr, arbg, arbb, arba, arar, arag, arab, araa, agrr, agrg, agrb, agra, aggr, + aggg, aggb, agga, agbr, agbg, agbb, agba, agar, agag, agab, agaa, abrr, abrg, abrb, abra, + abgr, abgg, abgb, abga, abbr, abbg, abbb, abba, abar, abag, abab, abaa, aarr, aarg, aarb, + aara, aagr, aagg, aagb, aaga, aabr, aabg, aabb, aaba, aaar, aaag, aaab, aaaa; +}; + +template struct VecBase : VecOp, VecSwizzle2, ColSwizzle2 { T x, y; + T r, g; VecBase() = default; template explicit VecBase(VecBase) {} @@ -116,8 +154,9 @@ template struct VecBase : VecOp, VecSwizzle2 { explicit VecBase(T, T) {} }; -template struct VecBase : VecOp, VecSwizzle3 { +template struct VecBase : VecOp, VecSwizzle3, ColSwizzle3 { T x, y, z; + T r, g, b; VecBase() = default; template explicit VecBase(VecBase) {} @@ -127,8 +166,9 @@ template struct VecBase : VecOp, VecSwizzle3 { explicit VecBase(T, VecBase) {} }; -template struct VecBase : VecOp, VecSwizzle4 { +template struct VecBase : VecOp, VecSwizzle4, ColSwizzle4 { T x, y, z, w; + T r, g, b, a; VecBase() = default; template explicit VecBase(VecBase) {} -- 2.30.2 From ae91a46e37ad8dd857953a8bd9ea1393d17aa350 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Mon, 23 Sep 2024 17:20:43 +0200 Subject: [PATCH 15/90] Add builtin and keywords --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index dd14017f99a..91362c0601a 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -495,3 +495,26 @@ template float determinant(MatBase) {} template MatBase inverse(MatBase) {} template MatBase transpose(MatBase) {} #endif + +/* Vertex Shader Special Variables. */ +const int gl_VertexID; +const int gl_InstanceID; +const int gl_BaseVertex; +const int gl_BaseInstance; +float4 gl_Position; +float gl_PointSize; +/* Fragment Shader Special Variables. */ +const float4 gl_FragCoord; +const bool gl_FrontFacing; +const float2 gl_PointCoord; +const int gl_PrimitiveID; +float gl_FragDepth; +/* Read-only in Fragment Shader and write-only in vertex shader. */ +float gl_ClipDistance[]; +float gl_CullDistance[]; +/* Use GPU variant as they can be emulated. */ +int gpu_Layer; +int gpu_ViewportIndex; + +/* Keywords. */ +void discard; -- 2.30.2 From 4592d2f6c6eb6917cd8a6af74484930f701de109 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Mon, 23 Sep 2024 18:08:00 +0200 Subject: [PATCH 16/90] Remove vector ops argument names --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 80 +++++++++---------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index 91362c0601a..b0530388c5a 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -14,58 +14,58 @@ template struct VecOp { VecT operator+() const {} VecT operator-() const {} - VecT operator+(VecT b) const {} - VecT operator-(VecT b) const {} - VecT operator/(VecT b) const {} - VecT operator*(VecT b) const {} + VecT operator+(VecT) const {} + VecT operator-(VecT) const {} + VecT operator/(VecT) const {} + VecT operator*(VecT) const {} - VecT operator+=(VecT b) const {} - VecT operator-=(VecT b) const {} - VecT operator/=(VecT b) const {} - VecT operator*=(VecT b) const {} + VecT operator+=(VecT) const {} + VecT operator-=(VecT) const {} + VecT operator/=(VecT) const {} + VecT operator*=(VecT) const {} - VecT operator+(T b) const {} - VecT operator-(T b) const {} - VecT operator/(T b) const {} - VecT operator*(T b) const {} + VecT operator+(T) const {} + VecT operator-(T) const {} + VecT operator/(T) const {} + VecT operator*(T) const {} - VecT operator+=(T b) const {} - VecT operator-=(T b) const {} - VecT operator/=(T b) const {} - VecT operator*=(T b) const {} + VecT operator+=(T) const {} + VecT operator-=(T) const {} + VecT operator/=(T) const {} + VecT operator*=(T) const {} - friend VecT operator+(T a, VecT b) {} - friend VecT operator-(T a, VecT b) {} - friend VecT operator/(T a, VecT b) {} - friend VecT operator*(T a, VecT b) {} + friend VecT operator+(T, VecT) {} + friend VecT operator-(T, VecT) {} + friend VecT operator/(T, VecT) {} + friend VecT operator*(T, VecT) {} #define INT_OP \ template> * = nullptr> - INT_OP VecT operator%(VecT b) {} - INT_OP VecT operator&(VecT b) {} - INT_OP VecT operator|(VecT b) {} - INT_OP VecT operator^(VecT b) {} + INT_OP VecT operator%(VecT) const {} + INT_OP VecT operator&(VecT) const {} + INT_OP VecT operator|(VecT) const {} + INT_OP VecT operator^(VecT) const {} - INT_OP VecT operator%=(VecT b) {} - INT_OP VecT operator&=(VecT b) {} - INT_OP VecT operator|=(VecT b) {} - INT_OP VecT operator^=(VecT b) {} + INT_OP VecT operator%=(VecT) const {} + INT_OP VecT operator&=(VecT) const {} + INT_OP VecT operator|=(VecT) const {} + INT_OP VecT operator^=(VecT) const {} - INT_OP VecT operator%(T b) {} - INT_OP VecT operator&(T b) {} - INT_OP VecT operator|(T b) {} - INT_OP VecT operator^(T b) {} + INT_OP VecT operator%(T) const {} + INT_OP VecT operator&(T) const {} + INT_OP VecT operator|(T) const {} + INT_OP VecT operator^(T) const {} - INT_OP VecT operator%=(T b) {} - INT_OP VecT operator&=(T b) {} - INT_OP VecT operator|=(T b) {} - INT_OP VecT operator^=(T b) {} + INT_OP VecT operator%=(T) const {} + INT_OP VecT operator&=(T) const {} + INT_OP VecT operator|=(T) const {} + INT_OP VecT operator^=(T) const {} - INT_OP friend VecT operator%(T a, VecT b) {} - INT_OP friend VecT operator&(T a, VecT b) {} - INT_OP friend VecT operator|(T a, VecT b) {} - INT_OP friend VecT operator^(T a, VecT b) {} + INT_OP friend VecT operator%(T, VecT) {} + INT_OP friend VecT operator&(T, VecT) {} + INT_OP friend VecT operator|(T, VecT) {} + INT_OP friend VecT operator^(T, VecT) {} #undef INT_OP }; -- 2.30.2 From 4f48b6fa601c04be8d3949c14447bde0db720495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Mon, 23 Sep 2024 18:08:21 +0200 Subject: [PATCH 17/90] Matrices --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 80 +++++++++++++++++-- 1 file changed, 74 insertions(+), 6 deletions(-) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index b0530388c5a..ef4817ed024 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -9,7 +9,7 @@ template struct VecBase {}; template struct VecOp { using VecT = VecBase; - T operator[](int) {} + T &operator[](int) {} VecT operator+() const {} VecT operator-() const {} @@ -250,6 +250,76 @@ using bvec2 = bool2; using bvec3 = bool3; using bvec4 = bool4; +template struct MatBase {}; + +template struct MatOp { + using MatT = MatBase; + using ColT = VecBase; + using RowT = VecBase; + + ColT &operator[](int) {} + + MatT operator*(MatT) const {} + + friend ColT operator*(RowT, MatT) {} + friend RowT operator*(MatT, ColT) {} +}; + +template struct MatBase<2, R> : MatOp<2, R> { + using T = double; + using ColT = VecBase; + ColT x, y; + + MatBase() = default; + explicit MatBase(T) {} + explicit MatBase(ColT, ColT) {} + template explicit MatBase(const MatBase &) {} +}; + +template struct MatBase<3, R> : MatOp<3, R> { + using ColT = VecBase; + ColT x, y, z; + + MatBase() = default; + explicit MatBase(double) {} + explicit MatBase(ColT, ColT, ColT) {} + template explicit MatBase(const MatBase &) {} +}; + +template struct MatBase<4, R> : MatOp<4, R> { + using ColT = VecBase; + ColT x, y, z, w; + + MatBase() = default; + explicit MatBase(double) {} + explicit MatBase(ColT, ColT, ColT, ColT) {} + template explicit MatBase(const MatBase &) {} +}; + +using float2x2 = MatBase<2, 2>; +using float2x3 = MatBase<2, 3>; +using float2x4 = MatBase<2, 4>; +using float3x2 = MatBase<3, 2>; +using float3x3 = MatBase<3, 3>; +using float3x4 = MatBase<3, 4>; +using float4x2 = MatBase<4, 2>; +using float4x3 = MatBase<4, 3>; +using float4x4 = MatBase<4, 4>; + +using mat2x2 = float2x2; +using mat2x3 = float2x3; +using mat2x4 = float2x4; +using mat3x2 = float3x2; +using mat3x3 = float3x3; +using mat3x4 = float3x4; +using mat4x2 = float4x2; +using mat4x3 = float4x3; +using mat4x4 = float4x4; + +using mat2 = float2x2; +using mat3 = float3x3; +using mat4 = float4x4; + template VecBase greaterThan(VecBase, VecBase) {} template VecBase lessThan(VecBase, VecBase) {} template VecBase lessThanEqual(VecBase, VecBase) {} @@ -490,11 +560,9 @@ float2 unpackSnorm2x16(uint) {} float4 unpackUnorm4x8(uint) {} float4 unpackSnorm4x8(uint) {} -#if 0 /* TODO Matrices */ -template float determinant(MatBase) {} -template MatBase inverse(MatBase) {} -template MatBase transpose(MatBase) {} -#endif +template float determinant(MatBase) {} +template MatBase inverse(MatBase) {} +template MatBase transpose(MatBase) {} /* Vertex Shader Special Variables. */ const int gl_VertexID; -- 2.30.2 From 88fb3cdf1de0ca89bc82ed85330c865dbf827139 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Mon, 23 Sep 2024 18:08:29 +0200 Subject: [PATCH 18/90] Some missing functions --- source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index ef4817ed024..9276ac6037c 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -524,6 +524,8 @@ double mix(double, double, double) {} template VecBase mix(VecBase, VecBase, double) {} template VecBase mix(VecBase, VecBase, VecBase) {} +#define select(A, B, C) mix(A, B, C) + VecBase cross(VecBase, VecBase) {} template float dot(VecBase, VecBase) {} template float distance(VecBase, VecBase) {} @@ -586,3 +588,8 @@ int gpu_ViewportIndex; /* Keywords. */ void discard; + +/* TODO(fclem): Should be in a lib instead of being impemented by each backend. */ +bool is_zero(vec2 A) {} +bool is_zero(vec3 A) {} +bool is_zero(vec4 A) {} -- 2.30.2 From 04a22845e98ea8520f9aa1d64fee83e5a65f3b1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Mon, 23 Sep 2024 18:13:04 +0200 Subject: [PATCH 19/90] Remove unused parameters --- source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index 9276ac6037c..a2cbe8b6c30 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -590,6 +590,6 @@ int gpu_ViewportIndex; void discard; /* TODO(fclem): Should be in a lib instead of being impemented by each backend. */ -bool is_zero(vec2 A) {} -bool is_zero(vec3 A) {} -bool is_zero(vec4 A) {} +bool is_zero(vec2) {} +bool is_zero(vec3) {} +bool is_zero(vec4) {} -- 2.30.2 From e73430e3593edbec153b98ab0cb23d61093b2000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Mon, 23 Sep 2024 19:07:35 +0200 Subject: [PATCH 20/90] Add array syntax compatibility --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 20 +++++++++++++++++++ .../gpu/shaders/metal/mtl_shader_defines.msl | 20 +++++++++++++++++++ .../shaders/opengl/glsl_shader_defines.glsl | 18 +++++++++++++++++ 3 files changed, 58 insertions(+) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index a2cbe8b6c30..476568b30ac 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -593,3 +593,23 @@ void discard; bool is_zero(vec2) {} bool is_zero(vec3) {} bool is_zero(vec4) {} + +/* Array syntax compatibility. */ +/* clang-format off */ +#define float_array(...) { __VA_ARGS__ } +#define float2_array(...) { __VA_ARGS__ } +#define float3_array(...) { __VA_ARGS__ } +#define float4_array(...) { __VA_ARGS__ } +#define int_array(...) { __VA_ARGS__ } +#define int2_array(...) { __VA_ARGS__ } +#define int3_array(...) { __VA_ARGS__ } +#define int4_array(...) { __VA_ARGS__ } +#define uint_array(...) { __VA_ARGS__ } +#define uint2_array(...) { __VA_ARGS__ } +#define uint3_array(...) { __VA_ARGS__ } +#define uint4_array(...) { __VA_ARGS__ } +#define bool_array(...) { __VA_ARGS__ } +#define bool2_array(...) { __VA_ARGS__ } +#define bool3_array(...) { __VA_ARGS__ } +#define bool4_array(...) { __VA_ARGS__ } +/* clang-format on */ diff --git a/source/blender/gpu/shaders/metal/mtl_shader_defines.msl b/source/blender/gpu/shaders/metal/mtl_shader_defines.msl index f605da8baa5..961fb63ad30 100644 --- a/source/blender/gpu/shaders/metal/mtl_shader_defines.msl +++ b/source/blender/gpu/shaders/metal/mtl_shader_defines.msl @@ -2529,3 +2529,23 @@ mat3x4 MAT3x4(mat2 m) #define MAT2 MAT2x2 #define MAT3 MAT3x3 #define MAT4 MAT4x4 + +/* Array syntax compatibility. */ +/* clang-format off */ +#define float_array(...) { __VA_ARGS__ } +#define float2_array(...) { __VA_ARGS__ } +#define float3_array(...) { __VA_ARGS__ } +#define float4_array(...) { __VA_ARGS__ } +#define int_array(...) { __VA_ARGS__ } +#define int2_array(...) { __VA_ARGS__ } +#define int3_array(...) { __VA_ARGS__ } +#define int4_array(...) { __VA_ARGS__ } +#define uint_array(...) { __VA_ARGS__ } +#define uint2_array(...) { __VA_ARGS__ } +#define uint3_array(...) { __VA_ARGS__ } +#define uint4_array(...) { __VA_ARGS__ } +#define bool_array(...) { __VA_ARGS__ } +#define bool2_array(...) { __VA_ARGS__ } +#define bool3_array(...) { __VA_ARGS__ } +#define bool4_array(...) { __VA_ARGS__ } +/* clang-format on */ diff --git a/source/blender/gpu/shaders/opengl/glsl_shader_defines.glsl b/source/blender/gpu/shaders/opengl/glsl_shader_defines.glsl index 29413d63605..9f10b4ba88d 100644 --- a/source/blender/gpu/shaders/opengl/glsl_shader_defines.glsl +++ b/source/blender/gpu/shaders/opengl/glsl_shader_defines.glsl @@ -103,3 +103,21 @@ bool is_zero(vec4 A) { return all(equal(A, vec4(0.0))); } + +/* Array syntax compatibility. */ +#define float_array float[] +#define float2_array vec2[] +#define float3_array vec3[] +#define float4_array vec4[] +#define int_array int[] +#define int2_array int2[] +#define int3_array int3[] +#define int4_array int4[] +#define uint_array uint[] +#define uint2_array uint2[] +#define uint3_array uint3[] +#define uint4_array uint4[] +#define bool_array bool[] +#define bool2_array bool2[] +#define bool3_array bool3[] +#define bool4_array bool4[] -- 2.30.2 From 20d11b10e4b08448ca9833de786e7dc367b4570a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Tue, 24 Sep 2024 11:41:40 +0200 Subject: [PATCH 21/90] Guard against GLSL / MSL include --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 56 ++++++++++--------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index 476568b30ac..8a44e6a2210 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -2,7 +2,11 @@ * * SPDX-License-Identifier: GPL-2.0-or-later */ -#include +#pragma once + +#if defined(__cplusplus) && !defined(GPU_SHADER) + +# include template struct VecBase {}; @@ -39,8 +43,8 @@ template struct VecOp { friend VecT operator/(T, VecT) {} friend VecT operator*(T, VecT) {} -#define INT_OP \ - template> * = nullptr> +# define INT_OP \ + template> * = nullptr> INT_OP VecT operator%(VecT) const {} INT_OP VecT operator&(VecT) const {} @@ -67,7 +71,7 @@ template struct VecOp { INT_OP friend VecT operator|(T, VecT) {} INT_OP friend VecT operator^(T, VecT) {} -#undef INT_OP +# undef INT_OP }; template struct VecSwizzle2 { @@ -330,11 +334,11 @@ template bool any(VecBase) {} template bool all(VecBase) {} /* `not` is a C++ keyword. Use dirty macro to allow this. */ template VecBase not_impl(VecBase) {} -#define not not_impl +# define not not_impl -#define inout -#define in -#define out +# define inout +# define in +# define out template using Vec4 = VecBase; template using VecInt = VecBase; @@ -352,13 +356,13 @@ template stru using size_vec_type = VecBase; }; -#define TEX_TEMPLATE \ - template +# define TEX_TEMPLATE \ + template TEX_TEMPLATE SizeVec textureSize(T, int) {} TEX_TEMPLATE DataVec texelFetch(T, IntCoord, int) {} @@ -368,7 +372,7 @@ TEX_TEMPLATE DataVec textureGather(T, FltCoord) {} TEX_TEMPLATE DataVec textureGrad(T, FltCoord, DerivVec, DerivVec) {} TEX_TEMPLATE DataVec textureLod(T, FltCoord, double) {} -#undef TEX_TEMPLATE +# undef TEX_TEMPLATE using sampler1D = SamplerBase; using sampler2D = SamplerBase; @@ -405,20 +409,20 @@ template struct ImageBase { using size_vec_type = VecBase; }; -#define IMG_TEMPLATE \ - template +# define IMG_TEMPLATE \ + template IMG_TEMPLATE SizeVec imageSize(T) {} IMG_TEMPLATE DataVec imageLoad(T, IntCoord) {} IMG_TEMPLATE void imageStore(T, IntCoord, DataVec) {} IMG_TEMPLATE void imageFence(T) {} -#define imageLoadFast imageLoad -#define imageStoreFast imageStore +# define imageLoadFast imageLoad +# define imageStoreFast imageStore -#undef IMG_TEMPLATE +# undef IMG_TEMPLATE using sampler1D = SamplerBase; using sampler2D = SamplerBase; @@ -524,7 +528,7 @@ double mix(double, double, double) {} template VecBase mix(VecBase, VecBase, double) {} template VecBase mix(VecBase, VecBase, VecBase) {} -#define select(A, B, C) mix(A, B, C) +# define select(A, B, C) mix(A, B, C) VecBase cross(VecBase, VecBase) {} template float dot(VecBase, VecBase) {} @@ -613,3 +617,5 @@ bool is_zero(vec4) {} #define bool3_array(...) { __VA_ARGS__ } #define bool4_array(...) { __VA_ARGS__ } /* clang-format on */ + +#endif -- 2.30.2 From 9d0552039105948159416cb90357411a8e47ce69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Tue, 24 Sep 2024 12:23:06 +0200 Subject: [PATCH 22/90] Add sections, add documentation, fix integer ops, fix image types --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 161 ++++++++++++------ 1 file changed, 109 insertions(+), 52 deletions(-) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index 8a44e6a2210..cb19cfde3d4 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -2,12 +2,32 @@ * * SPDX-License-Identifier: GPL-2.0-or-later */ +/** + * GLSL to C++ stubs. + * + * The goal of this header is to make the GLSL source file compile using a modern C++ compiler. + * This allows for linting and IDE functionalities to work. + * + * This is why the implementation of each function is not needed. + * + * Some of the features of GLSL are omitted by design. They are either: + * - not needed (e.g. per component matrix multiplication) + * - against our code-style (e.g. stpq swizzle) + * - unsupported by our Metal Shading Language layer (e.g. mixed vector-scalar matrix constructor). + * + * IMPORTANT: Please ask the module team if you need some feature that are not listed in this file. + */ + #pragma once -#if defined(__cplusplus) && !defined(GPU_SHADER) +#ifndef GPU_SHADER # include +/* -------------------------------------------------------------------- */ +/** \name Vector Types + * \{ */ + template struct VecBase {}; template struct VecOp { @@ -44,7 +64,7 @@ template struct VecOp { friend VecT operator*(T, VecT) {} # define INT_OP \ - template> * = nullptr> + template> * = nullptr> INT_OP VecT operator%(VecT) const {} INT_OP VecT operator&(VecT) const {} @@ -254,6 +274,12 @@ using bvec2 = bool2; using bvec3 = bool3; using bvec4 = bool4; +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Matrix Types + * \{ */ + template struct MatBase {}; template struct MatOp { @@ -324,25 +350,11 @@ using mat2 = float2x2; using mat3 = float3x3; using mat4 = float4x4; -template VecBase greaterThan(VecBase, VecBase) {} -template VecBase lessThan(VecBase, VecBase) {} -template VecBase lessThanEqual(VecBase, VecBase) {} -template VecBase greaterThanEqual(VecBase, VecBase) {} -template VecBase equal(VecBase, VecBase) {} -template VecBase notEqual(VecBase, VecBase) {} -template bool any(VecBase) {} -template bool all(VecBase) {} -/* `not` is a C++ keyword. Use dirty macro to allow this. */ -template VecBase not_impl(VecBase) {} -# define not not_impl +/** \} */ -# define inout -# define in -# define out - -template using Vec4 = VecBase; -template using VecInt = VecBase; -template using VecFlt = VecBase; +/* -------------------------------------------------------------------- */ +/** \name Sampler Types + * \{ */ template struct SamplerBase { static constexpr int coord_dim = Dimensions + int(Cube) + int(Array); @@ -399,14 +411,18 @@ using samplerCubeArray = SamplerBase; using isamplerCubeArray = SamplerBase; using usamplerCubeArray = SamplerBase; +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Image Types + * \{ */ + template struct ImageBase { - static constexpr int coord_dim = Dimensions + int(Cube) + int(Array); - static constexpr int deriv_dim = Dimensions + int(Cube); - static constexpr int extent_dim = Dimensions + int(Array); + static constexpr int coord_dim = Dimensions + int(Array); using int_coord_type = VecBase; using data_vec_type = VecBase; - using size_vec_type = VecBase; + using size_vec_type = VecBase; }; # define IMG_TEMPLATE \ @@ -424,30 +440,42 @@ IMG_TEMPLATE void imageFence(T) {} # undef IMG_TEMPLATE -using sampler1D = SamplerBase; -using sampler2D = SamplerBase; -using sampler3D = SamplerBase; -using isampler1D = SamplerBase; -using isampler2D = SamplerBase; -using isampler3D = SamplerBase; -using usampler1D = SamplerBase; -using usampler2D = SamplerBase; -using usampler3D = SamplerBase; +using image1D = ImageBase; +using image2D = ImageBase; +using image3D = ImageBase; +using iimage1D = ImageBase; +using iimage2D = ImageBase; +using iimage3D = ImageBase; +using uimage1D = ImageBase; +using uimage2D = ImageBase; +using uimage3D = ImageBase; -using sampler1DArray = SamplerBase; -using sampler2DArray = SamplerBase; -using isampler1DArray = SamplerBase; -using isampler2DArray = SamplerBase; -using usampler1DArray = SamplerBase; -using usampler2DArray = SamplerBase; +using image1DArray = ImageBase; +using image2DArray = ImageBase; +using iimage1DArray = ImageBase; +using iimage2DArray = ImageBase; +using uimage1DArray = ImageBase; +using uimage2DArray = ImageBase; -using samplerCube = SamplerBase; -using isamplerCube = SamplerBase; -using usamplerCube = SamplerBase; +/* Forbid Cube and cube arrays. Bind them as 3D textures instead. */ -using samplerCubeArray = SamplerBase; -using isamplerCubeArray = SamplerBase; -using usamplerCubeArray = SamplerBase; +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Builtin Functions + * \{ */ + +template VecBase greaterThan(VecBase, VecBase) {} +template VecBase lessThan(VecBase, VecBase) {} +template VecBase lessThanEqual(VecBase, VecBase) {} +template VecBase greaterThanEqual(VecBase, VecBase) {} +template VecBase equal(VecBase, VecBase) {} +template VecBase notEqual(VecBase, VecBase) {} +template bool any(VecBase) {} +template bool all(VecBase) {} +/* `not` is a C++ keyword. Use dirty macro to allow this. */ +template VecBase not_impl(VecBase) {} +# define not not_impl template VecBase bitCount(VecBase) {} template VecBase bitCount(VecBase) {} @@ -566,10 +594,22 @@ float2 unpackSnorm2x16(uint) {} float4 unpackUnorm4x8(uint) {} float4 unpackSnorm4x8(uint) {} +/* Matrices functions. */ template float determinant(MatBase) {} template MatBase inverse(MatBase) {} template MatBase transpose(MatBase) {} +/* TODO(fclem): Should be in a lib instead of being impemented by each backend. */ +bool is_zero(vec2) {} +bool is_zero(vec3) {} +bool is_zero(vec4) {} + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Special Variables + * \{ */ + /* Vertex Shader Special Variables. */ const int gl_VertexID; const int gl_InstanceID; @@ -585,18 +625,33 @@ const int gl_PrimitiveID; float gl_FragDepth; /* Read-only in Fragment Shader and write-only in vertex shader. */ float gl_ClipDistance[]; -float gl_CullDistance[]; -/* Use GPU variant as they can be emulated. */ +/* Note: Use GPU variant as they might be emulated. */ int gpu_Layer; int gpu_ViewportIndex; -/* Keywords. */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Keywords + * \{ */ + +/* Note: Cannot easily mutate them. Pass every by copy for now. */ + +/* Pass argument by reference. */ +# define inout +/* Pass argument by reference but only write to it. Its initial value is undefined. */ +# define out +/* Pass argument by copy (default). */ +# define in + +/* Cannot easily mutate them. Pass every by copy for now. */ void discard; -/* TODO(fclem): Should be in a lib instead of being impemented by each backend. */ -bool is_zero(vec2) {} -bool is_zero(vec3) {} -bool is_zero(vec4) {} +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Compatibility + * \{ */ /* Array syntax compatibility. */ /* clang-format off */ @@ -618,4 +673,6 @@ bool is_zero(vec4) {} #define bool4_array(...) { __VA_ARGS__ } /* clang-format on */ +/** \} */ + #endif -- 2.30.2 From ede38b7d98716cf88d7e54d61bbe422c2f73d43c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Tue, 24 Sep 2024 12:31:16 +0200 Subject: [PATCH 23/90] Matrix scalar constructors, more documentation --- source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index cb19cfde3d4..dc1a2fbf502 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -8,7 +8,12 @@ * The goal of this header is to make the GLSL source file compile using a modern C++ compiler. * This allows for linting and IDE functionalities to work. * - * This is why the implementation of each function is not needed. + * This is why the implementation of each function is not needed. However, we make sure that type + * casting is always explicit. This is because implicit casts are not always supported on all + * implementations. + * + * Float types are set to double to accept float literals without trailing f and avoid casting + * issues. * * Some of the features of GLSL are omitted by design. They are either: * - not needed (e.g. per component matrix multiplication) @@ -302,26 +307,31 @@ template struct MatBase<2, R> : MatOp<2, R> { MatBase() = default; explicit MatBase(T) {} + explicit MatBase(T, T, T, T) {} explicit MatBase(ColT, ColT) {} template explicit MatBase(const MatBase &) {} }; template struct MatBase<3, R> : MatOp<3, R> { + using T = double; using ColT = VecBase; ColT x, y, z; MatBase() = default; - explicit MatBase(double) {} + explicit MatBase(T) {} + explicit MatBase(T, T, T, T, T, T, T, T, T) {} explicit MatBase(ColT, ColT, ColT) {} template explicit MatBase(const MatBase &) {} }; template struct MatBase<4, R> : MatOp<4, R> { + using T = double; using ColT = VecBase; ColT x, y, z, w; MatBase() = default; - explicit MatBase(double) {} + explicit MatBase(T) {} + explicit MatBase(T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T) {} explicit MatBase(ColT, ColT, ColT, ColT) {} template explicit MatBase(const MatBase &) {} }; -- 2.30.2 From 3745cc45552e7a4714440c10257b7a4a8ab2cc97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Tue, 24 Sep 2024 12:50:55 +0200 Subject: [PATCH 24/90] Add atomic functions --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index dc1a2fbf502..0be1fef74ff 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -448,6 +448,14 @@ IMG_TEMPLATE void imageFence(T) {} # define imageLoadFast imageLoad # define imageStoreFast imageStore +IMG_TEMPLATE uint imageAtomicAdd(T, IntCoord, uint); +IMG_TEMPLATE uint imageAtomicMin(T, IntCoord, uint); +IMG_TEMPLATE uint imageAtomicMax(T, IntCoord, uint); +IMG_TEMPLATE uint imageAtomicAnd(T, IntCoord, uint); +IMG_TEMPLATE uint imageAtomicXor(T, IntCoord, uint); +IMG_TEMPLATE uint imageAtomicExchange(T, IntCoord, uint); +IMG_TEMPLATE uint imageAtomicCompSwap(T, IntCoord, uint, uint); + # undef IMG_TEMPLATE using image1D = ImageBase; @@ -583,6 +591,7 @@ uint floatBitsToUint(double) {} double intBitsToFloat(int) {} double uintBitsToFloat(uint) {} +/* Derivative functions. */ template T dFdx(T) {} template T dFdy(T) {} template T fwidth(T) {} @@ -592,6 +601,24 @@ template float faceforward(VecBase, VecBase, VecB template float reflect(VecBase, VecBase) {} template float refract(VecBase, VecBase, double) {} +/* Atomic operations. */ +int atomicAdd(int &, int); +int atomicAnd(int &, int); +int atomicOr(int &, int); +int atomicXor(int &, int); +int atomicMin(int &, int); +int atomicMax(int &, int); +int atomicExchange(int &, int); +int atomicCompSwap(int &, int, int); +uint atomicAdd(uint &, uint); +uint atomicAnd(uint &, uint); +uint atomicOr(uint &, uint); +uint atomicXor(uint &, uint); +uint atomicMin(uint &, uint); +uint atomicMax(uint &, uint); +uint atomicExchange(uint &, uint); +uint atomicCompSwap(uint &, uint, uint); + /* Packing functions. */ uint packHalf2x16(float2) {} uint packUnorm2x16(float2) {} -- 2.30.2 From 0f7c26c72ad4316b9608ef2b4f3f094012f3ebca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Tue, 24 Sep 2024 12:56:52 +0200 Subject: [PATCH 25/90] Add usage documentation --- source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index 0be1fef74ff..fafe9d29344 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -8,6 +8,9 @@ * The goal of this header is to make the GLSL source file compile using a modern C++ compiler. * This allows for linting and IDE functionalities to work. * + * This file can be included inside any GLSL file to make the GLSL syntax to work. Then your IDE + * must to be configured to associate .glsl files to C++ so that the C++ linter does the analysis. + * * This is why the implementation of each function is not needed. However, we make sure that type * casting is always explicit. This is because implicit casts are not always supported on all * implementations. -- 2.30.2 From bfc53ec21496a3960cd23cf9ca65638758d4ee4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Tue, 24 Sep 2024 13:02:37 +0200 Subject: [PATCH 26/90] Fix sign --- source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index fafe9d29344..a237d89882b 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -527,7 +527,7 @@ template T abs(T) {} template T clamp(T, T, T) {} template T max(T, T) {} template T min(T, T) {} -template T sign(T, T) {} +template T sign(T) {} template T clamp(T, U, U) {} template T max(T, U) {} template T min(T, U) {} -- 2.30.2 From 9066c90b3ef59e0d0a27a9cb9759b96b629ec314 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Tue, 24 Sep 2024 13:26:05 +0200 Subject: [PATCH 27/90] Fix a few errors on some compilers --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 66 +++++++++---------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index a237d89882b..dcfdf354cd9 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -312,7 +312,7 @@ template struct MatBase<2, R> : MatOp<2, R> { explicit MatBase(T) {} explicit MatBase(T, T, T, T) {} explicit MatBase(ColT, ColT) {} - template explicit MatBase(const MatBase &) {} + template explicit MatBase(const MatBase &) {} }; template struct MatBase<3, R> : MatOp<3, R> { @@ -605,22 +605,22 @@ template float reflect(VecBase, VecBase) {} template float refract(VecBase, VecBase, double) {} /* Atomic operations. */ -int atomicAdd(int &, int); -int atomicAnd(int &, int); -int atomicOr(int &, int); -int atomicXor(int &, int); -int atomicMin(int &, int); -int atomicMax(int &, int); -int atomicExchange(int &, int); -int atomicCompSwap(int &, int, int); -uint atomicAdd(uint &, uint); -uint atomicAnd(uint &, uint); -uint atomicOr(uint &, uint); -uint atomicXor(uint &, uint); -uint atomicMin(uint &, uint); -uint atomicMax(uint &, uint); -uint atomicExchange(uint &, uint); -uint atomicCompSwap(uint &, uint, uint); +int atomicAdd(int &, int) {} +int atomicAnd(int &, int) {} +int atomicOr(int &, int) {} +int atomicXor(int &, int) {} +int atomicMin(int &, int) {} +int atomicMax(int &, int) {} +int atomicExchange(int &, int) {} +int atomicCompSwap(int &, int, int) {} +uint atomicAdd(uint &, uint) {} +uint atomicAnd(uint &, uint) {} +uint atomicOr(uint &, uint) {} +uint atomicXor(uint &, uint) {} +uint atomicMin(uint &, uint) {} +uint atomicMax(uint &, uint) {} +uint atomicExchange(uint &, uint) {} +uint atomicCompSwap(uint &, uint, uint) {} /* Packing functions. */ uint packHalf2x16(float2) {} @@ -651,23 +651,23 @@ bool is_zero(vec4) {} * \{ */ /* Vertex Shader Special Variables. */ -const int gl_VertexID; -const int gl_InstanceID; -const int gl_BaseVertex; -const int gl_BaseInstance; -float4 gl_Position; -float gl_PointSize; +const int gl_VertexID = 0; +const int gl_InstanceID = 0; +const int gl_BaseVertex = 0; +const int gl_BaseInstance = 0; +float4 gl_Position = float4(0); +double gl_PointSize = 0; /* Fragment Shader Special Variables. */ -const float4 gl_FragCoord; -const bool gl_FrontFacing; -const float2 gl_PointCoord; -const int gl_PrimitiveID; -float gl_FragDepth; +const float4 gl_FragCoord = float4(0); +const bool gl_FrontFacing = true; +const float2 gl_PointCoord = float2(0); +const int gl_PrimitiveID = 0; +float gl_FragDepth = 0; /* Read-only in Fragment Shader and write-only in vertex shader. */ -float gl_ClipDistance[]; +float gl_ClipDistance[6] = {0}; /* Note: Use GPU variant as they might be emulated. */ -int gpu_Layer; -int gpu_ViewportIndex; +int gpu_Layer = 0; +int gpu_ViewportIndex = 0; /** \} */ @@ -684,8 +684,8 @@ int gpu_ViewportIndex; /* Pass argument by copy (default). */ # define in -/* Cannot easily mutate them. Pass every by copy for now. */ -void discard; +/* Discards the output of the current fragment shader invocation and halts its execution. */ +# define discard /** \} */ -- 2.30.2 From fc233a2501890846be58cd8dfb89e648ac66e9e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Tue, 24 Sep 2024 13:51:21 +0200 Subject: [PATCH 28/90] Compiler compatibility --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 265 +++++++++--------- 1 file changed, 136 insertions(+), 129 deletions(-) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index dcfdf354cd9..a8c6060cd4a 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -486,163 +486,170 @@ using uimage2DArray = ImageBase; /** \name Builtin Functions * \{ */ -template VecBase greaterThan(VecBase, VecBase) {} -template VecBase lessThan(VecBase, VecBase) {} -template VecBase lessThanEqual(VecBase, VecBase) {} -template VecBase greaterThanEqual(VecBase, VecBase) {} -template VecBase equal(VecBase, VecBase) {} -template VecBase notEqual(VecBase, VecBase) {} -template bool any(VecBase) {} -template bool all(VecBase) {} -/* `not` is a C++ keyword. Use dirty macro to allow this. */ -template VecBase not_impl(VecBase) {} -# define not not_impl +/* Some compilers complain about lack of return values. Keep it short. */ +# define RET \ + { \ + return {}; \ + } -template VecBase bitCount(VecBase) {} -template VecBase bitCount(VecBase) {} -template VecBase bitfieldExtract(VecBase, int, int) {} -template VecBase bitfieldExtract(VecBase, int, int) {} -template VecBase bitfieldInsert(VecBase, VecBase, int, int) {} -template VecBase bitfieldInsert(VecBase, VecBase, int, int) {} -template VecBase bitfieldReverse(VecBase) {} -template VecBase bitfieldReverse(VecBase) {} -int bitCount(int) {} -int bitCount(uint) {} -int bitfieldExtract(int) {} -int bitfieldExtract(uint) {} -int bitfieldInsert(int) {} -int bitfieldInsert(uint) {} -int bitfieldReverse(int) {} -int bitfieldReverse(uint) {} +template VecBase greaterThan(VecBase, VecBase) RET; +template VecBase lessThan(VecBase, VecBase) RET; +template VecBase lessThanEqual(VecBase, VecBase) RET; +template VecBase greaterThanEqual(VecBase, VecBase) RET; +template VecBase equal(VecBase, VecBase) RET; +template VecBase notEqual(VecBase, VecBase) RET; +template bool any(VecBase) RET; +template bool all(VecBase) RET; +/* `not` is a C++ keyword that aliases the `!` operator. Simply overload it. */ +template VecBase operator!(VecBase) RET; -template VecBase findLSB(VecBase) {} -template VecBase findLSB(VecBase) {} -template VecBase findMSB(VecBase) {} -template VecBase findMSB(VecBase) {} -int findMSB(int) {} -int findMSB(uint) {} +template VecBase bitCount(VecBase) RET; +template VecBase bitCount(VecBase) RET; +template VecBase bitfieldExtract(VecBase, int, int) RET; +template VecBase bitfieldExtract(VecBase, int, int) RET; +template VecBase bitfieldInsert(VecBase, VecBase, int, int) RET; +template VecBase bitfieldInsert(VecBase, VecBase, int, int) RET; +template VecBase bitfieldReverse(VecBase) RET; +template VecBase bitfieldReverse(VecBase) RET; +int bitCount(int) RET; +int bitCount(uint) RET; +int bitfieldExtract(int) RET; +int bitfieldExtract(uint) RET; +int bitfieldInsert(int) RET; +int bitfieldInsert(uint) RET; +int bitfieldReverse(int) RET; +int bitfieldReverse(uint) RET; + +template VecBase findLSB(VecBase) RET; +template VecBase findLSB(VecBase) RET; +template VecBase findMSB(VecBase) RET; +template VecBase findMSB(VecBase) RET; +int findMSB(int) RET; +int findMSB(uint) RET; /* Math Functions. */ -template T abs(T) {} -template T clamp(T, T, T) {} -template T max(T, T) {} -template T min(T, T) {} -template T sign(T) {} -template T clamp(T, U, U) {} -template T max(T, U) {} -template T min(T, U) {} +template T abs(T) RET; +template T clamp(T, T, T) RET; +template T max(T, T) RET; +template T min(T, T) RET; +template T sign(T) RET; +template T clamp(T, U, U) RET; +template T max(T, U) RET; +template T min(T, U) RET; /* TODO(fclem): These should be restricted to floats. */ -template T ceil(T) {} -template T exp(T) {} -template T exp2(T) {} -template T floor(T) {} -template T fma(T, T, T) {} -template T fract(T) {} -template T frexp(T, T) {} -template T inversesqrt(T) {} -template T isinf(T) {} -template T isnan(T) {} -template T log(T) {} -template T log2(T) {} +template T ceil(T) RET; +template T exp(T) RET; +template T exp2(T) RET; +template T floor(T) RET; +template T fma(T, T, T) RET; +template T fract(T) RET; +template T frexp(T, T) RET; +template T inversesqrt(T) RET; +template T isinf(T) RET; +template T isnan(T) RET; +template T log(T) RET; +template T log2(T) RET; template T mod(T, double); template T mod(T, T); template T modf(T, T); -template T pow(T, T) {} -template T round(T) {} -template T smoothstep(T, T, T) {} -template T sqrt(T) {} -template T step(T) {} -template T trunc(T) {} -template T ldexp(T, U) {} +template T pow(T, T) RET; +template T round(T) RET; +template T smoothstep(T, T, T) RET; +template T sqrt(T) RET; +template T step(T) RET; +template T trunc(T) RET; +template T ldexp(T, U) RET; -template T acos(T) {} -template T acosh(T) {} -template T asin(T) {} -template T asinh(T) {} -template T atan(T, T) {} -template T atan(T) {} -template T atanh(T) {} -template T cos(T) {} -template T cosh(T) {} -template T sin(T) {} -template T sinh(T) {} -template T tan(T) {} -template T tanh(T) {} +template T acos(T) RET; +template T acosh(T) RET; +template T asin(T) RET; +template T asinh(T) RET; +template T atan(T, T) RET; +template T atan(T) RET; +template T atanh(T) RET; +template T cos(T) RET; +template T cosh(T) RET; +template T sin(T) RET; +template T sinh(T) RET; +template T tan(T) RET; +template T tanh(T) RET; -template T degrees(T) {} -template T radians(T) {} +template T degrees(T) RET; +template T radians(T) RET; /* Declared explicitely to avoid type errors. */ -double mix(double, double, double) {} -template VecBase mix(VecBase, VecBase, double) {} -template VecBase mix(VecBase, VecBase, VecBase) {} +double mix(double, double, double) RET; +template VecBase mix(VecBase, VecBase, double) RET; +template VecBase mix(VecBase, VecBase, VecBase) RET; # define select(A, B, C) mix(A, B, C) -VecBase cross(VecBase, VecBase) {} -template float dot(VecBase, VecBase) {} -template float distance(VecBase, VecBase) {} -template float length(VecBase) {} -template VecBase normalize(VecBase) {} +VecBase cross(VecBase, VecBase) RET; +template float dot(VecBase, VecBase) RET; +template float distance(VecBase, VecBase) RET; +template float length(VecBase) RET; +template VecBase normalize(VecBase) RET; -template VecBase floatBitsToInt(VecBase) {} -template VecBase floatBitsToUint(VecBase) {} -template VecBase intBitsToFloat(VecBase) {} -template VecBase uintBitsToFloat(VecBase) {} -int floatBitsToInt(double) {} -uint floatBitsToUint(double) {} -double intBitsToFloat(int) {} -double uintBitsToFloat(uint) {} +template VecBase floatBitsToInt(VecBase) RET; +template VecBase floatBitsToUint(VecBase) RET; +template VecBase intBitsToFloat(VecBase) RET; +template VecBase uintBitsToFloat(VecBase) RET; +int floatBitsToInt(double) RET; +uint floatBitsToUint(double) RET; +double intBitsToFloat(int) RET; +double uintBitsToFloat(uint) RET; /* Derivative functions. */ -template T dFdx(T) {} -template T dFdy(T) {} -template T fwidth(T) {} +template T dFdx(T) RET; +template T dFdy(T) RET; +template T fwidth(T) RET; /* Geometric functions. */ -template float faceforward(VecBase, VecBase, VecBase) {} -template float reflect(VecBase, VecBase) {} -template float refract(VecBase, VecBase, double) {} +template float faceforward(VecBase, VecBase, VecBase) RET; +template float reflect(VecBase, VecBase) RET; +template float refract(VecBase, VecBase, double) RET; /* Atomic operations. */ -int atomicAdd(int &, int) {} -int atomicAnd(int &, int) {} -int atomicOr(int &, int) {} -int atomicXor(int &, int) {} -int atomicMin(int &, int) {} -int atomicMax(int &, int) {} -int atomicExchange(int &, int) {} -int atomicCompSwap(int &, int, int) {} -uint atomicAdd(uint &, uint) {} -uint atomicAnd(uint &, uint) {} -uint atomicOr(uint &, uint) {} -uint atomicXor(uint &, uint) {} -uint atomicMin(uint &, uint) {} -uint atomicMax(uint &, uint) {} -uint atomicExchange(uint &, uint) {} -uint atomicCompSwap(uint &, uint, uint) {} +int atomicAdd(int &, int) RET; +int atomicAnd(int &, int) RET; +int atomicOr(int &, int) RET; +int atomicXor(int &, int) RET; +int atomicMin(int &, int) RET; +int atomicMax(int &, int) RET; +int atomicExchange(int &, int) RET; +int atomicCompSwap(int &, int, int) RET; +uint atomicAdd(uint &, uint) RET; +uint atomicAnd(uint &, uint) RET; +uint atomicOr(uint &, uint) RET; +uint atomicXor(uint &, uint) RET; +uint atomicMin(uint &, uint) RET; +uint atomicMax(uint &, uint) RET; +uint atomicExchange(uint &, uint) RET; +uint atomicCompSwap(uint &, uint, uint) RET; /* Packing functions. */ -uint packHalf2x16(float2) {} -uint packUnorm2x16(float2) {} -uint packSnorm2x16(float2) {} -uint packUnorm4x8(float4) {} -uint packSnorm4x8(float4) {} -float2 unpackHalf2x16(uint) {} -float2 unpackUnorm2x16(uint) {} -float2 unpackSnorm2x16(uint) {} -float4 unpackUnorm4x8(uint) {} -float4 unpackSnorm4x8(uint) {} +uint packHalf2x16(float2) RET; +uint packUnorm2x16(float2) RET; +uint packSnorm2x16(float2) RET; +uint packUnorm4x8(float4) RET; +uint packSnorm4x8(float4) RET; +float2 unpackHalf2x16(uint) RET; +float2 unpackUnorm2x16(uint) RET; +float2 unpackSnorm2x16(uint) RET; +float4 unpackUnorm4x8(uint) RET; +float4 unpackSnorm4x8(uint) RET; /* Matrices functions. */ -template float determinant(MatBase) {} -template MatBase inverse(MatBase) {} -template MatBase transpose(MatBase) {} +template float determinant(MatBase) RET; +template MatBase inverse(MatBase) RET; +template MatBase transpose(MatBase) RET; /* TODO(fclem): Should be in a lib instead of being impemented by each backend. */ -bool is_zero(vec2) {} -bool is_zero(vec3) {} -bool is_zero(vec4) {} +bool is_zero(vec2) RET; +bool is_zero(vec3) RET; +bool is_zero(vec4) RET; + +# undef RET /** \} */ -- 2.30.2 From fc0b9efd5e979a506cfa260fcac3a14a8dc7887f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Wed, 25 Sep 2024 10:52:49 +0200 Subject: [PATCH 29/90] Compute shader builtins --- source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index a8c6060cd4a..bcc2c1e0db2 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -676,6 +676,15 @@ float gl_ClipDistance[6] = {0}; int gpu_Layer = 0; int gpu_ViewportIndex = 0; +/* Compute Shader Special Variables */ + +const uint3 gl_NumWorkGroups; +constexpr uint3 gl_WorkGroupSize; +const uint3 gl_WorkGroupID; +const uint3 gl_LocalInvocationID; +const uint3 gl_GlobalInvocationID; +const uint gl_LocalInvocationIndex; + /** \} */ /* -------------------------------------------------------------------- */ -- 2.30.2 From 684cdd792d3d15b3a896b68da84e5d33ee711687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Wed, 25 Sep 2024 10:57:43 +0200 Subject: [PATCH 30/90] Put namespaces for special variables --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index bcc2c1e0db2..a849e6a845b 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -657,26 +657,34 @@ bool is_zero(vec4) RET; /** \name Special Variables * \{ */ -/* Vertex Shader Special Variables. */ +namespace gl_VertexShader { + const int gl_VertexID = 0; const int gl_InstanceID = 0; const int gl_BaseVertex = 0; const int gl_BaseInstance = 0; float4 gl_Position = float4(0); double gl_PointSize = 0; -/* Fragment Shader Special Variables. */ +float gl_ClipDistance[6] = {0}; +int gpu_Layer = 0; +int gpu_ViewportIndex = 0; + +} // namespace gl_VertexShader + +namespace gl_FragmentShader { + const float4 gl_FragCoord = float4(0); const bool gl_FrontFacing = true; const float2 gl_PointCoord = float2(0); const int gl_PrimitiveID = 0; float gl_FragDepth = 0; -/* Read-only in Fragment Shader and write-only in vertex shader. */ -float gl_ClipDistance[6] = {0}; -/* Note: Use GPU variant as they might be emulated. */ -int gpu_Layer = 0; -int gpu_ViewportIndex = 0; +const float gl_ClipDistance[6] = {0}; +const int gpu_Layer = 0; +const int gpu_ViewportIndex = 0; -/* Compute Shader Special Variables */ +} // namespace gl_FragmentShader + +namespace gl_ComputeShader { const uint3 gl_NumWorkGroups; constexpr uint3 gl_WorkGroupSize; @@ -685,6 +693,8 @@ const uint3 gl_LocalInvocationID; const uint3 gl_GlobalInvocationID; const uint gl_LocalInvocationIndex; +} // namespace gl_ComputeShader + /** \} */ /* -------------------------------------------------------------------- */ -- 2.30.2 From 9f191c31f55ec564852e3566f95d4318dabab6b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Wed, 25 Sep 2024 12:16:07 +0200 Subject: [PATCH 31/90] Add compute shader functions --- source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index a849e6a845b..db38143d5ef 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -599,10 +599,12 @@ uint floatBitsToUint(double) RET; double intBitsToFloat(int) RET; double uintBitsToFloat(uint) RET; +namespace gl_FragmentShader { /* Derivative functions. */ template T dFdx(T) RET; template T dFdy(T) RET; template T fwidth(T) RET; +} // namespace gl_FragmentShader /* Geometric functions. */ template float faceforward(VecBase, VecBase, VecBase) RET; @@ -713,6 +715,15 @@ const uint gl_LocalInvocationIndex; /* Discards the output of the current fragment shader invocation and halts its execution. */ # define discard +namespace gl_ComputeShader { +void barrier() {} +void memoryBarrier() {} +void memoryBarrierShared() {} +void memoryBarrierImage() {} +void memoryBarrierBuffer() {} +void groupMemoryBarrier() {} +} // namespace gl_ComputeShader + /** \} */ /* -------------------------------------------------------------------- */ -- 2.30.2 From df5444967870728c0c73872d99be58efda67a88a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Thu, 26 Sep 2024 16:13:33 +0200 Subject: [PATCH 32/90] Add shared keyword --- source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index db38143d5ef..a65f8a59e21 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -715,6 +715,9 @@ const uint gl_LocalInvocationIndex; /* Discards the output of the current fragment shader invocation and halts its execution. */ # define discard +/* Decorate a variable in global scope that is common to all threads in a threadgroup. */ +# define shared + namespace gl_ComputeShader { void barrier() {} void memoryBarrier() {} -- 2.30.2 From 3017a7d6b645a6cbba9864c21ea0ff1a35af7dfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Thu, 26 Sep 2024 16:25:46 +0200 Subject: [PATCH 33/90] Use references for swizzle (GCC compatible) and use single line. --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 86 +++++++------------ 1 file changed, 30 insertions(+), 56 deletions(-) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index a65f8a59e21..08d63cd6ae0 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -103,77 +103,51 @@ template struct VecOp { }; template struct VecSwizzle2 { - static VecBase xx, xy, yx, yy; - static VecBase xxx, xxy, xyx, xyy, yxx, yxy, yyx, yyy; - static VecBase xxxx, xxxy, xxyx, xxyy, xyxx, xyxy, xyyx, xyyy, yxxx, yxxy, yxyx, yxyy, - yyxx, yyxy, yyyx, yyyy; + /* clang-format off */ + static VecBase &xx, &xy, &yx, &yy; + static VecBase &xxx, &xxy, &xyx, &xyy, &yxx, &yxy, &yyx, &yyy; + static VecBase &xxxx, &xxxy, &xxyx, &xxyy, &xyxx, &xyxy, &xyyx, &xyyy, &yxxx, &yxxy, &yxyx, &yxyy, &yyxx, &yyxy, &yyyx, &yyyy; + /* clang-format on */ }; template struct ColSwizzle2 { - static VecBase rr, rg, gr, gg; - static VecBase rrr, rrg, rgr, rgg, grr, grg, ggr, ggg; - static VecBase rrrr, rrrg, rrgr, rrgg, rgrr, rgrg, rggr, rggg, grrr, grrg, grgr, grgg, - ggrr, ggrg, gggr, gggg; + /* clang-format off */ + static VecBase &rr, &rg, &gr, ≫ + static VecBase &rrr, &rrg, &rgr, &rgg, &grr, &grg, &ggr, ⋙ + static VecBase &rrrr, &rrrg, &rrgr, &rrgg, &rgrr, &rgrg, &rggr, &rggg, &grrr, &grrg, &grgr, &grgg, &ggrr, &ggrg, &gggr, &gggg; + /* clang-format on */ }; template struct VecSwizzle3 : VecSwizzle2 { - static VecBase xz, yz, zx, zy, zz, zw; - static VecBase xxz, xyz, xzx, xzy, xzz, yxz, yyz, yzx, yzy, yzz, zxx, zxy, zxz, zyx, zyy, - zyz, zzx, zzy, zzz; - static VecBase xxxz, xxyz, xxzx, xxzy, xxzz, xyxz, xyyz, xyzx, xyzy, xyzz, xzxx, xzxy, - xzxz, xzyx, xzyy, xzyz, xzzx, xzzy, xzzz, yxxz, yxyz, yxzx, yxzy, yxzz, yyxz, yyyz, yyzx, - yyzy, yyzz, yzxx, yzxy, yzxz, yzyx, yzyy, yzyz, yzzx, yzzy, yzzz, zxxx, zxxy, zxxz, zxyx, - zxyy, zxyz, zxzx, zxzy, zxzz, zyxx, zyxy, zyxz, zyyx, zyyy, zyyz, zyzx, zyzy, zyzz, zzxx, - zzxy, zzxz, zzyx, zzyy, zzyz, zzzx, zzzy, zzzz; + /* clang-format off */ + static VecBase &xz, &yz, &zx, &zy, &zz, &zw; + static VecBase &xxz, &xyz, &xzx, &xzy, &xzz, &yxz, &yyz, &yzx, &yzy, &yzz, &zxx, &zxy, &zxz, &zyx, &zyy, &zyz, &zzx, &zzy, &zzz; + static VecBase &xxxz, &xxyz, &xxzx, &xxzy, &xxzz, &xyxz, &xyyz, &xyzx, &xyzy, &xyzz, &xzxx, &xzxy, &xzxz, &xzyx, &xzyy, &xzyz, &xzzx, &xzzy, &xzzz, &yxxz, &yxyz, &yxzx, &yxzy, &yxzz, &yyxz, &yyyz, &yyzx, &yyzy, &yyzz, &yzxx, &yzxy, &yzxz, &yzyx, &yzyy, &yzyz, &yzzx, &yzzy, &yzzz, &zxxx, &zxxy, &zxxz, &zxyx, &zxyy, &zxyz, &zxzx, &zxzy, &zxzz, &zyxx, &zyxy, &zyxz, &zyyx, &zyyy, &zyyz, &zyzx, &zyzy, &zyzz, &zzxx, &zzxy, &zzxz, &zzyx, &zzyy, &zzyz, &zzzx, &zzzy, &zzzz; + /* clang-format on */ }; template struct ColSwizzle3 : ColSwizzle2 { - static VecBase rb, gb, br, bg, bb, bw; - static VecBase rrb, rgb, rbr, rbg, rbb, grb, ggb, gbr, gbg, gbb, brr, brg, brb, bgr, bgg, - bgb, bbr, bbg, bbb; - static VecBase rrrb, rrgb, rrbr, rrbg, rrbb, rgrb, rggb, rgbr, rgbg, rgbb, rbrr, rbrg, - rbrb, rbgr, rbgg, rbgb, rbbr, rbbg, rbbb, grrb, grgb, grbr, grbg, grbb, ggrb, gggb, ggbr, - ggbg, ggbb, gbrr, gbrg, gbrb, gbgr, gbgg, gbgb, gbbr, gbbg, gbbb, brrr, brrg, brrb, brgr, - brgg, brgb, brbr, brbg, brbb, bgrr, bgrg, bgrb, bggr, bggg, bggb, bgbr, bgbg, bgbb, bbrr, - bbrg, bbrb, bbgr, bbgg, bbgb, bbbr, bbbg, bbbb; + /* clang-format off */ + static VecBase &rb, &gb, &br, &bg, &bb, &bw; + static VecBase &rrb, &rgb, &rbr, &rbg, &rbb, &grb, &ggb, &gbr, &gbg, &gbb, &brr, &brg, &brb, &bgr, &bgg, &bgb, &bbr, &bbg, &bbb; + static VecBase &rrrb, &rrgb, &rrbr, &rrbg, &rrbb, &rgrb, &rggb, &rgbr, &rgbg, &rgbb, &rbrr, &rbrg, &rbrb, &rbgr, &rbgg, &rbgb, &rbbr, &rbbg, &rbbb, &grrb, &grgb, &grbr, &grbg, &grbb, &ggrb, &gggb, &ggbr, &ggbg, &ggbb, &gbrr, &gbrg, &gbrb, &gbgr, &gbgg, &gbgb, &gbbr, &gbbg, &gbbb, &brrr, &brrg, &brrb, &brgr, &brgg, &brgb, &brbr, &brbg, &brbb, &bgrr, &bgrg, &bgrb, &bggr, &bggg, &bggb, &bgbr, &bgbg, &bgbb, &bbrr, &bbrg, &bbrb, &bbgr, &bbgg, &bbgb, &bbbr, &bbbg, &bbbb; + /* clang-format on */ }; template struct VecSwizzle4 : VecSwizzle3 { - static VecBase xw, yw, wx, wy, wz, ww; - static VecBase xxw, xyw, xzw, xwx, xwy, xwz, xww, yxw, yyw, yzw, ywx, ywy, ywz, yww, zxw, - zyw, zzw, zwx, zwy, zwz, zww, wxx, wxy, wxz, wxw, wyx, wyy, wyz, wyw, wzx, wzy, wzz, wzw, - wwx, wwy, wwz, www; - static VecBase xxxw, xxyw, xxzw, xxwx, xxwy, xxwz, xxww, xyxw, xyyw, xyzw, xywx, xywy, - xywz, xyww, xzxw, xzyw, xzzw, xzwx, xzwy, xzwz, xzww, xwxx, xwxy, xwxz, xwxw, xwyx, xwyy, - xwyz, xwyw, xwzx, xwzy, xwzz, xwzw, xwwx, xwwy, xwwz, xwww, yxxw, yxyw, yxzw, yxwx, yxwy, - yxwz, yxww, yyxw, yyyw, yyzw, yywx, yywy, yywz, yyww, yzxw, yzyw, yzzw, yzwx, yzwy, yzwz, - yzww, ywxx, ywxy, ywxz, ywxw, ywyx, ywyy, ywyz, ywyw, ywzx, ywzy, ywzz, ywzw, ywwx, ywwy, - ywwz, ywww, zxxw, zxyw, zxzw, zxwx, zxwy, zxwz, zxww, zyxw, zyyw, zyzw, zywx, zywy, zywz, - zyww, zzxw, zzyw, zzzw, zzwx, zzwy, zzwz, zzww, zwxx, zwxy, zwxz, zwxw, zwyx, zwyy, zwyz, - zwyw, zwzx, zwzy, zwzz, zwzw, zwwx, zwwy, zwwz, zwww, wxxx, wxxy, wxxz, wxxw, wxyx, wxyy, - wxyz, wxyw, wxzx, wxzy, wxzz, wxzw, wxwx, wxwy, wxwz, wxww, wyxx, wyxy, wyxz, wyxw, wyyx, - wyyy, wyyz, wyyw, wyzx, wyzy, wyzz, wyzw, wywx, wywy, wywz, wyww, wzxx, wzxy, wzxz, wzxw, - wzyx, wzyy, wzyz, wzyw, wzzx, wzzy, wzzz, wzzw, wzwx, wzwy, wzwz, wzww, wwxx, wwxy, wwxz, - wwxw, wwyx, wwyy, wwyz, wwyw, wwzx, wwzy, wwzz, wwzw, wwwx, wwwy, wwwz, wwww; + /* clang-format off */ + static VecBase &xw, &yw, &wx, &wy, &wz, &ww; + static VecBase &xxw, &xyw, &xzw, &xwx, &xwy, &xwz, &xww, &yxw, &yyw, &yzw, &ywx, &ywy, &ywz, &yww, &zxw, &zyw, &zzw, &zwx, &zwy, &zwz, &zww, &wxx, &wxy, &wxz, &wxw, &wyx, &wyy, &wyz, &wyw, &wzx, &wzy, &wzz, &wzw, &wwx, &wwy, &wwz, &www; + static VecBase &xxxw, &xxyw, &xxzw, &xxwx, &xxwy, &xxwz, &xxww, &xyxw, &xyyw, &xyzw, &xywx, &xywy, &xywz, &xyww, &xzxw, &xzyw, &xzzw, &xzwx, &xzwy, &xzwz, &xzww, &xwxx, &xwxy, &xwxz, &xwxw, &xwyx, &xwyy, &xwyz, &xwyw, &xwzx, &xwzy, &xwzz, &xwzw, &xwwx, &xwwy, &xwwz, &xwww, &yxxw, &yxyw, &yxzw, &yxwx, &yxwy, &yxwz, &yxww, &yyxw, &yyyw, &yyzw, &yywx, &yywy, &yywz, &yyww, &yzxw, &yzyw, &yzzw, &yzwx, &yzwy, &yzwz, &yzww, &ywxx, &ywxy, &ywxz, &ywxw, &ywyx, &ywyy, &ywyz, &ywyw, &ywzx, &ywzy, &ywzz, &ywzw, &ywwx, &ywwy, &ywwz, &ywww, &zxxw, &zxyw, &zxzw, &zxwx, &zxwy, &zxwz, &zxww, &zyxw, &zyyw, &zyzw, &zywx, &zywy, &zywz, &zyww, &zzxw, &zzyw, &zzzw, &zzwx, &zzwy, &zzwz, &zzww, &zwxx, &zwxy, &zwxz, &zwxw, &zwyx, &zwyy, &zwyz, &zwyw, &zwzx, &zwzy, &zwzz, &zwzw, &zwwx, &zwwy, &zwwz, &zwww, &wxxx, &wxxy, &wxxz, &wxxw, &wxyx, &wxyy, &wxyz, &wxyw, &wxzx, &wxzy, &wxzz, &wxzw, &wxwx, &wxwy, &wxwz, &wxww, &wyxx, &wyxy, &wyxz, &wyxw, &wyyx, &wyyy, &wyyz, &wyyw, &wyzx, &wyzy, &wyzz, &wyzw, &wywx, &wywy, &wywz, &wyww, &wzxx, &wzxy, &wzxz, &wzxw, &wzyx, &wzyy, &wzyz, &wzyw, &wzzx, &wzzy, &wzzz, &wzzw, &wzwx, &wzwy, &wzwz, &wzww, &wwxx, &wwxy, &wwxz, &wwxw, &wwyx, &wwyy, &wwyz, &wwyw, &wwzx, &wwzy, &wwzz, &wwzw, &wwwx, &wwwy, &wwwz, &wwww; + /* clang-format on */ }; template struct ColSwizzle4 : ColSwizzle3 { - static VecBase ra, ga, ar, ag, ab, aa; - static VecBase rra, rga, rba, rar, rag, rab, raa, gra, gga, gba, gar, gag, gab, gaa, bra, - bga, bba, bar, bag, bab, baa, arr, arg, arb, ara, agr, agg, agb, aga, abr, abg, abb, aba, - aar, aag, aab, aaa; - static VecBase rrra, rrga, rrba, rrar, rrag, rrab, rraa, rgra, rgga, rgba, rgar, rgag, - rgab, rgaa, rbra, rbga, rbba, rbar, rbag, rbab, rbaa, rarr, rarg, rarb, rara, ragr, ragg, - ragb, raga, rabr, rabg, rabb, raba, raar, raag, raab, raaa, grra, grga, grba, grar, grag, - grab, graa, ggra, ggga, ggba, ggar, ggag, ggab, ggaa, gbra, gbga, gbba, gbar, gbag, gbab, - gbaa, garr, garg, garb, gara, gagr, gagg, gagb, gaga, gabr, gabg, gabb, gaba, gaar, gaag, - gaab, gaaa, brra, brga, brba, brar, brag, brab, braa, bgra, bgga, bgba, bgar, bgag, bgab, - bgaa, bbra, bbga, bbba, bbar, bbag, bbab, bbaa, barr, barg, barb, bara, bagr, bagg, bagb, - baga, babr, babg, babb, baba, baar, baag, baab, baaa, arrr, arrg, arrb, arra, argr, argg, - argb, arga, arbr, arbg, arbb, arba, arar, arag, arab, araa, agrr, agrg, agrb, agra, aggr, - aggg, aggb, agga, agbr, agbg, agbb, agba, agar, agag, agab, agaa, abrr, abrg, abrb, abra, - abgr, abgg, abgb, abga, abbr, abbg, abbb, abba, abar, abag, abab, abaa, aarr, aarg, aarb, - aara, aagr, aagg, aagb, aaga, aabr, aabg, aabb, aaba, aaar, aaag, aaab, aaaa; + /* clang-format off */ + static VecBase &ra, &ga, &ar, &ag, &ab, &aa; + static VecBase &rra, &rga, &rba, &rar, &rag, &rab, &raa, &gra, &gga, &gba, &gar, &gag, &gab, &gaa, &bra, &bga, &bba, &bar, &bag, &bab, &baa, &arr, &arg, &arb, &ara, &agr, &agg, &agb, &aga, &abr, &abg, &abb, &aba, &aar, &aag, &aab, &aaa; + static VecBase &rrra, &rrga, &rrba, &rrar, &rrag, &rrab, &rraa, &rgra, &rgga, &rgba, &rgar, &rgag, &rgab, &rgaa, &rbra, &rbga, &rbba, &rbar, &rbag, &rbab, &rbaa, &rarr, &rarg, &rarb, &rara, &ragr, &ragg, &ragb, &raga, &rabr, &rabg, &rabb, &raba, &raar, &raag, &raab, &raaa, &grra, &grga, &grba, &grar, &grag, &grab, &graa, &ggra, &ggga, &ggba, &ggar, &ggag, &ggab, &ggaa, &gbra, &gbga, &gbba, &gbar, &gbag, &gbab, &gbaa, &garr, &garg, &garb, &gara, &gagr, &gagg, &gagb, &gaga, &gabr, &gabg, &gabb, &gaba, &gaar, &gaag, &gaab, &gaaa, &brra, &brga, &brba, &brar, &brag, &brab, &braa, &bgra, &bgga, &bgba, &bgar, &bgag, &bgab, &bgaa, &bbra, &bbga, &bbba, &bbar, &bbag, &bbab, &bbaa, &barr, &barg, &barb, &bara, &bagr, &bagg, &bagb, &baga, &babr, &babg, &babb, &baba, &baar, &baag, &baab, &baaa, &arrr, &arrg, &arrb, &arra, &argr, &argg, &argb, &arga, &arbr, &arbg, &arbb, &arba, &arar, &arag, &arab, &araa, &agrr, &agrg, &agrb, &agra, &aggr, &aggg, &aggb, &agga, &agbr, &agbg, &agbb, &agba, &agar, &agag, &agab, &agaa, &abrr, &abrg, &abrb, &abra, &abgr, &abgg, &abgb, &abga, &abbr, &abbg, &abbb, &abba, &abar, &abag, &abab, &abaa, &aarr, &aarg, &aarb, &aara, &aagr, &aagg, &aagb, &aaga, &aabr, &aabg, &aabb, &aaba, &aaar, &aaag, &aaab, &aaaa; + /* clang-format on */ }; template struct VecBase : VecOp, VecSwizzle2, ColSwizzle2 { -- 2.30.2 From 9e8c2a9fe7579931a68abc6a75d5d53e302a7a10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Thu, 26 Sep 2024 16:34:37 +0200 Subject: [PATCH 34/90] Remove GPU_SHADER guard as it won't get included for shader anymore --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 66 +++++++++---------- 1 file changed, 31 insertions(+), 35 deletions(-) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index 08d63cd6ae0..cd18d4e4c2d 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -28,9 +28,7 @@ #pragma once -#ifndef GPU_SHADER - -# include +#include /* -------------------------------------------------------------------- */ /** \name Vector Types @@ -71,8 +69,8 @@ template struct VecOp { friend VecT operator/(T, VecT) {} friend VecT operator*(T, VecT) {} -# define INT_OP \ - template> * = nullptr> +#define INT_OP \ + template> * = nullptr> INT_OP VecT operator%(VecT) const {} INT_OP VecT operator&(VecT) const {} @@ -99,7 +97,7 @@ template struct VecOp { INT_OP friend VecT operator|(T, VecT) {} INT_OP friend VecT operator^(T, VecT) {} -# undef INT_OP +#undef INT_OP }; template struct VecSwizzle2 { @@ -355,13 +353,13 @@ template stru using size_vec_type = VecBase; }; -# define TEX_TEMPLATE \ - template +#define TEX_TEMPLATE \ + template TEX_TEMPLATE SizeVec textureSize(T, int) {} TEX_TEMPLATE DataVec texelFetch(T, IntCoord, int) {} @@ -371,7 +369,7 @@ TEX_TEMPLATE DataVec textureGather(T, FltCoord) {} TEX_TEMPLATE DataVec textureGrad(T, FltCoord, DerivVec, DerivVec) {} TEX_TEMPLATE DataVec textureLod(T, FltCoord, double) {} -# undef TEX_TEMPLATE +#undef TEX_TEMPLATE using sampler1D = SamplerBase; using sampler2D = SamplerBase; @@ -412,18 +410,18 @@ template struct ImageBase { using size_vec_type = VecBase; }; -# define IMG_TEMPLATE \ - template +#define IMG_TEMPLATE \ + template IMG_TEMPLATE SizeVec imageSize(T) {} IMG_TEMPLATE DataVec imageLoad(T, IntCoord) {} IMG_TEMPLATE void imageStore(T, IntCoord, DataVec) {} IMG_TEMPLATE void imageFence(T) {} -# define imageLoadFast imageLoad -# define imageStoreFast imageStore +#define imageLoadFast imageLoad +#define imageStoreFast imageStore IMG_TEMPLATE uint imageAtomicAdd(T, IntCoord, uint); IMG_TEMPLATE uint imageAtomicMin(T, IntCoord, uint); @@ -433,7 +431,7 @@ IMG_TEMPLATE uint imageAtomicXor(T, IntCoord, uint); IMG_TEMPLATE uint imageAtomicExchange(T, IntCoord, uint); IMG_TEMPLATE uint imageAtomicCompSwap(T, IntCoord, uint, uint); -# undef IMG_TEMPLATE +#undef IMG_TEMPLATE using image1D = ImageBase; using image2D = ImageBase; @@ -461,10 +459,10 @@ using uimage2DArray = ImageBase; * \{ */ /* Some compilers complain about lack of return values. Keep it short. */ -# define RET \ - { \ - return {}; \ - } +#define RET \ + { \ + return {}; \ + } template VecBase greaterThan(VecBase, VecBase) RET; template VecBase lessThan(VecBase, VecBase) RET; @@ -556,7 +554,7 @@ double mix(double, double, double) RET; template VecBase mix(VecBase, VecBase, double) RET; template VecBase mix(VecBase, VecBase, VecBase) RET; -# define select(A, B, C) mix(A, B, C) +#define select(A, B, C) mix(A, B, C) VecBase cross(VecBase, VecBase) RET; template float dot(VecBase, VecBase) RET; @@ -625,7 +623,7 @@ bool is_zero(vec2) RET; bool is_zero(vec3) RET; bool is_zero(vec4) RET; -# undef RET +#undef RET /** \} */ @@ -680,17 +678,17 @@ const uint gl_LocalInvocationIndex; /* Note: Cannot easily mutate them. Pass every by copy for now. */ /* Pass argument by reference. */ -# define inout +#define inout /* Pass argument by reference but only write to it. Its initial value is undefined. */ -# define out +#define out /* Pass argument by copy (default). */ -# define in +#define in /* Discards the output of the current fragment shader invocation and halts its execution. */ -# define discard +#define discard /* Decorate a variable in global scope that is common to all threads in a threadgroup. */ -# define shared +#define shared namespace gl_ComputeShader { void barrier() {} @@ -728,5 +726,3 @@ void groupMemoryBarrier() {} /* clang-format on */ /** \} */ - -#endif -- 2.30.2 From d00d870cf8513b705d49a865ba19731abd55e77d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Thu, 26 Sep 2024 16:43:34 +0200 Subject: [PATCH 35/90] Add shader shared --- source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index cd18d4e4c2d..8601668b732 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -726,3 +726,13 @@ void groupMemoryBarrier() {} /* clang-format on */ /** \} */ + +/* Include all shader shared files to that custom type definitions are available when create infos + * macros are included. */ +#include "GPU_shader_shared.hh" +#include "draw_common_shader_shared.hh" +#include "draw_shader_shared.hh" +#include "eevee_shader_shared.hh" +#include "overlay_shader_shared.h" +#include "select_shader_shared.hh" +#include "workbench_shader_shared.h" -- 2.30.2 From 052c1fe354910946903b77db46f24e0abc9e57e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Thu, 26 Sep 2024 16:46:30 +0200 Subject: [PATCH 36/90] Remove clang-format off for swizzle --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 76 +++++++++++++------ 1 file changed, 54 insertions(+), 22 deletions(-) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index 8601668b732..e6912269fb1 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -101,51 +101,83 @@ template struct VecOp { }; template struct VecSwizzle2 { - /* clang-format off */ static VecBase &xx, &xy, &yx, &yy; static VecBase &xxx, &xxy, &xyx, &xyy, &yxx, &yxy, &yyx, &yyy; - static VecBase &xxxx, &xxxy, &xxyx, &xxyy, &xyxx, &xyxy, &xyyx, &xyyy, &yxxx, &yxxy, &yxyx, &yxyy, &yyxx, &yyxy, &yyyx, &yyyy; - /* clang-format on */ + static VecBase &xxxx, &xxxy, &xxyx, &xxyy, &xyxx, &xyxy, &xyyx, &xyyy, &yxxx, &yxxy, &yxyx, + &yxyy, &yyxx, &yyxy, &yyyx, &yyyy; }; template struct ColSwizzle2 { - /* clang-format off */ static VecBase &rr, &rg, &gr, ≫ static VecBase &rrr, &rrg, &rgr, &rgg, &grr, &grg, &ggr, ⋙ - static VecBase &rrrr, &rrrg, &rrgr, &rrgg, &rgrr, &rgrg, &rggr, &rggg, &grrr, &grrg, &grgr, &grgg, &ggrr, &ggrg, &gggr, &gggg; - /* clang-format on */ + static VecBase &rrrr, &rrrg, &rrgr, &rrgg, &rgrr, &rgrg, &rggr, &rggg, &grrr, &grrg, &grgr, + &grgg, &ggrr, &ggrg, &gggr, &gggg; }; template struct VecSwizzle3 : VecSwizzle2 { - /* clang-format off */ static VecBase &xz, &yz, &zx, &zy, &zz, &zw; - static VecBase &xxz, &xyz, &xzx, &xzy, &xzz, &yxz, &yyz, &yzx, &yzy, &yzz, &zxx, &zxy, &zxz, &zyx, &zyy, &zyz, &zzx, &zzy, &zzz; - static VecBase &xxxz, &xxyz, &xxzx, &xxzy, &xxzz, &xyxz, &xyyz, &xyzx, &xyzy, &xyzz, &xzxx, &xzxy, &xzxz, &xzyx, &xzyy, &xzyz, &xzzx, &xzzy, &xzzz, &yxxz, &yxyz, &yxzx, &yxzy, &yxzz, &yyxz, &yyyz, &yyzx, &yyzy, &yyzz, &yzxx, &yzxy, &yzxz, &yzyx, &yzyy, &yzyz, &yzzx, &yzzy, &yzzz, &zxxx, &zxxy, &zxxz, &zxyx, &zxyy, &zxyz, &zxzx, &zxzy, &zxzz, &zyxx, &zyxy, &zyxz, &zyyx, &zyyy, &zyyz, &zyzx, &zyzy, &zyzz, &zzxx, &zzxy, &zzxz, &zzyx, &zzyy, &zzyz, &zzzx, &zzzy, &zzzz; - /* clang-format on */ + static VecBase &xxz, &xyz, &xzx, &xzy, &xzz, &yxz, &yyz, &yzx, &yzy, &yzz, &zxx, &zxy, + &zxz, &zyx, &zyy, &zyz, &zzx, &zzy, &zzz; + static VecBase &xxxz, &xxyz, &xxzx, &xxzy, &xxzz, &xyxz, &xyyz, &xyzx, &xyzy, &xyzz, &xzxx, + &xzxy, &xzxz, &xzyx, &xzyy, &xzyz, &xzzx, &xzzy, &xzzz, &yxxz, &yxyz, &yxzx, &yxzy, &yxzz, + &yyxz, &yyyz, &yyzx, &yyzy, &yyzz, &yzxx, &yzxy, &yzxz, &yzyx, &yzyy, &yzyz, &yzzx, &yzzy, + &yzzz, &zxxx, &zxxy, &zxxz, &zxyx, &zxyy, &zxyz, &zxzx, &zxzy, &zxzz, &zyxx, &zyxy, &zyxz, + &zyyx, &zyyy, &zyyz, &zyzx, &zyzy, &zyzz, &zzxx, &zzxy, &zzxz, &zzyx, &zzyy, &zzyz, &zzzx, + &zzzy, &zzzz; }; template struct ColSwizzle3 : ColSwizzle2 { - /* clang-format off */ static VecBase &rb, &gb, &br, &bg, &bb, &bw; - static VecBase &rrb, &rgb, &rbr, &rbg, &rbb, &grb, &ggb, &gbr, &gbg, &gbb, &brr, &brg, &brb, &bgr, &bgg, &bgb, &bbr, &bbg, &bbb; - static VecBase &rrrb, &rrgb, &rrbr, &rrbg, &rrbb, &rgrb, &rggb, &rgbr, &rgbg, &rgbb, &rbrr, &rbrg, &rbrb, &rbgr, &rbgg, &rbgb, &rbbr, &rbbg, &rbbb, &grrb, &grgb, &grbr, &grbg, &grbb, &ggrb, &gggb, &ggbr, &ggbg, &ggbb, &gbrr, &gbrg, &gbrb, &gbgr, &gbgg, &gbgb, &gbbr, &gbbg, &gbbb, &brrr, &brrg, &brrb, &brgr, &brgg, &brgb, &brbr, &brbg, &brbb, &bgrr, &bgrg, &bgrb, &bggr, &bggg, &bggb, &bgbr, &bgbg, &bgbb, &bbrr, &bbrg, &bbrb, &bbgr, &bbgg, &bbgb, &bbbr, &bbbg, &bbbb; - /* clang-format on */ + static VecBase &rrb, &rgb, &rbr, &rbg, &rbb, &grb, &ggb, &gbr, &gbg, &gbb, &brr, &brg, + &brb, &bgr, &bgg, &bgb, &bbr, &bbg, &bbb; + static VecBase &rrrb, &rrgb, &rrbr, &rrbg, &rrbb, &rgrb, &rggb, &rgbr, &rgbg, &rgbb, &rbrr, + &rbrg, &rbrb, &rbgr, &rbgg, &rbgb, &rbbr, &rbbg, &rbbb, &grrb, &grgb, &grbr, &grbg, &grbb, + &ggrb, &gggb, &ggbr, &ggbg, &ggbb, &gbrr, &gbrg, &gbrb, &gbgr, &gbgg, &gbgb, &gbbr, &gbbg, + &gbbb, &brrr, &brrg, &brrb, &brgr, &brgg, &brgb, &brbr, &brbg, &brbb, &bgrr, &bgrg, &bgrb, + &bggr, &bggg, &bggb, &bgbr, &bgbg, &bgbb, &bbrr, &bbrg, &bbrb, &bbgr, &bbgg, &bbgb, &bbbr, + &bbbg, &bbbb; }; template struct VecSwizzle4 : VecSwizzle3 { - /* clang-format off */ static VecBase &xw, &yw, &wx, &wy, &wz, &ww; - static VecBase &xxw, &xyw, &xzw, &xwx, &xwy, &xwz, &xww, &yxw, &yyw, &yzw, &ywx, &ywy, &ywz, &yww, &zxw, &zyw, &zzw, &zwx, &zwy, &zwz, &zww, &wxx, &wxy, &wxz, &wxw, &wyx, &wyy, &wyz, &wyw, &wzx, &wzy, &wzz, &wzw, &wwx, &wwy, &wwz, &www; - static VecBase &xxxw, &xxyw, &xxzw, &xxwx, &xxwy, &xxwz, &xxww, &xyxw, &xyyw, &xyzw, &xywx, &xywy, &xywz, &xyww, &xzxw, &xzyw, &xzzw, &xzwx, &xzwy, &xzwz, &xzww, &xwxx, &xwxy, &xwxz, &xwxw, &xwyx, &xwyy, &xwyz, &xwyw, &xwzx, &xwzy, &xwzz, &xwzw, &xwwx, &xwwy, &xwwz, &xwww, &yxxw, &yxyw, &yxzw, &yxwx, &yxwy, &yxwz, &yxww, &yyxw, &yyyw, &yyzw, &yywx, &yywy, &yywz, &yyww, &yzxw, &yzyw, &yzzw, &yzwx, &yzwy, &yzwz, &yzww, &ywxx, &ywxy, &ywxz, &ywxw, &ywyx, &ywyy, &ywyz, &ywyw, &ywzx, &ywzy, &ywzz, &ywzw, &ywwx, &ywwy, &ywwz, &ywww, &zxxw, &zxyw, &zxzw, &zxwx, &zxwy, &zxwz, &zxww, &zyxw, &zyyw, &zyzw, &zywx, &zywy, &zywz, &zyww, &zzxw, &zzyw, &zzzw, &zzwx, &zzwy, &zzwz, &zzww, &zwxx, &zwxy, &zwxz, &zwxw, &zwyx, &zwyy, &zwyz, &zwyw, &zwzx, &zwzy, &zwzz, &zwzw, &zwwx, &zwwy, &zwwz, &zwww, &wxxx, &wxxy, &wxxz, &wxxw, &wxyx, &wxyy, &wxyz, &wxyw, &wxzx, &wxzy, &wxzz, &wxzw, &wxwx, &wxwy, &wxwz, &wxww, &wyxx, &wyxy, &wyxz, &wyxw, &wyyx, &wyyy, &wyyz, &wyyw, &wyzx, &wyzy, &wyzz, &wyzw, &wywx, &wywy, &wywz, &wyww, &wzxx, &wzxy, &wzxz, &wzxw, &wzyx, &wzyy, &wzyz, &wzyw, &wzzx, &wzzy, &wzzz, &wzzw, &wzwx, &wzwy, &wzwz, &wzww, &wwxx, &wwxy, &wwxz, &wwxw, &wwyx, &wwyy, &wwyz, &wwyw, &wwzx, &wwzy, &wwzz, &wwzw, &wwwx, &wwwy, &wwwz, &wwww; - /* clang-format on */ + static VecBase &xxw, &xyw, &xzw, &xwx, &xwy, &xwz, &xww, &yxw, &yyw, &yzw, &ywx, &ywy, + &ywz, &yww, &zxw, &zyw, &zzw, &zwx, &zwy, &zwz, &zww, &wxx, &wxy, &wxz, &wxw, &wyx, &wyy, + &wyz, &wyw, &wzx, &wzy, &wzz, &wzw, &wwx, &wwy, &wwz, &www; + static VecBase &xxxw, &xxyw, &xxzw, &xxwx, &xxwy, &xxwz, &xxww, &xyxw, &xyyw, &xyzw, &xywx, + &xywy, &xywz, &xyww, &xzxw, &xzyw, &xzzw, &xzwx, &xzwy, &xzwz, &xzww, &xwxx, &xwxy, &xwxz, + &xwxw, &xwyx, &xwyy, &xwyz, &xwyw, &xwzx, &xwzy, &xwzz, &xwzw, &xwwx, &xwwy, &xwwz, &xwww, + &yxxw, &yxyw, &yxzw, &yxwx, &yxwy, &yxwz, &yxww, &yyxw, &yyyw, &yyzw, &yywx, &yywy, &yywz, + &yyww, &yzxw, &yzyw, &yzzw, &yzwx, &yzwy, &yzwz, &yzww, &ywxx, &ywxy, &ywxz, &ywxw, &ywyx, + &ywyy, &ywyz, &ywyw, &ywzx, &ywzy, &ywzz, &ywzw, &ywwx, &ywwy, &ywwz, &ywww, &zxxw, &zxyw, + &zxzw, &zxwx, &zxwy, &zxwz, &zxww, &zyxw, &zyyw, &zyzw, &zywx, &zywy, &zywz, &zyww, &zzxw, + &zzyw, &zzzw, &zzwx, &zzwy, &zzwz, &zzww, &zwxx, &zwxy, &zwxz, &zwxw, &zwyx, &zwyy, &zwyz, + &zwyw, &zwzx, &zwzy, &zwzz, &zwzw, &zwwx, &zwwy, &zwwz, &zwww, &wxxx, &wxxy, &wxxz, &wxxw, + &wxyx, &wxyy, &wxyz, &wxyw, &wxzx, &wxzy, &wxzz, &wxzw, &wxwx, &wxwy, &wxwz, &wxww, &wyxx, + &wyxy, &wyxz, &wyxw, &wyyx, &wyyy, &wyyz, &wyyw, &wyzx, &wyzy, &wyzz, &wyzw, &wywx, &wywy, + &wywz, &wyww, &wzxx, &wzxy, &wzxz, &wzxw, &wzyx, &wzyy, &wzyz, &wzyw, &wzzx, &wzzy, &wzzz, + &wzzw, &wzwx, &wzwy, &wzwz, &wzww, &wwxx, &wwxy, &wwxz, &wwxw, &wwyx, &wwyy, &wwyz, &wwyw, + &wwzx, &wwzy, &wwzz, &wwzw, &wwwx, &wwwy, &wwwz, &wwww; }; template struct ColSwizzle4 : ColSwizzle3 { - /* clang-format off */ static VecBase &ra, &ga, &ar, &ag, &ab, &aa; - static VecBase &rra, &rga, &rba, &rar, &rag, &rab, &raa, &gra, &gga, &gba, &gar, &gag, &gab, &gaa, &bra, &bga, &bba, &bar, &bag, &bab, &baa, &arr, &arg, &arb, &ara, &agr, &agg, &agb, &aga, &abr, &abg, &abb, &aba, &aar, &aag, &aab, &aaa; - static VecBase &rrra, &rrga, &rrba, &rrar, &rrag, &rrab, &rraa, &rgra, &rgga, &rgba, &rgar, &rgag, &rgab, &rgaa, &rbra, &rbga, &rbba, &rbar, &rbag, &rbab, &rbaa, &rarr, &rarg, &rarb, &rara, &ragr, &ragg, &ragb, &raga, &rabr, &rabg, &rabb, &raba, &raar, &raag, &raab, &raaa, &grra, &grga, &grba, &grar, &grag, &grab, &graa, &ggra, &ggga, &ggba, &ggar, &ggag, &ggab, &ggaa, &gbra, &gbga, &gbba, &gbar, &gbag, &gbab, &gbaa, &garr, &garg, &garb, &gara, &gagr, &gagg, &gagb, &gaga, &gabr, &gabg, &gabb, &gaba, &gaar, &gaag, &gaab, &gaaa, &brra, &brga, &brba, &brar, &brag, &brab, &braa, &bgra, &bgga, &bgba, &bgar, &bgag, &bgab, &bgaa, &bbra, &bbga, &bbba, &bbar, &bbag, &bbab, &bbaa, &barr, &barg, &barb, &bara, &bagr, &bagg, &bagb, &baga, &babr, &babg, &babb, &baba, &baar, &baag, &baab, &baaa, &arrr, &arrg, &arrb, &arra, &argr, &argg, &argb, &arga, &arbr, &arbg, &arbb, &arba, &arar, &arag, &arab, &araa, &agrr, &agrg, &agrb, &agra, &aggr, &aggg, &aggb, &agga, &agbr, &agbg, &agbb, &agba, &agar, &agag, &agab, &agaa, &abrr, &abrg, &abrb, &abra, &abgr, &abgg, &abgb, &abga, &abbr, &abbg, &abbb, &abba, &abar, &abag, &abab, &abaa, &aarr, &aarg, &aarb, &aara, &aagr, &aagg, &aagb, &aaga, &aabr, &aabg, &aabb, &aaba, &aaar, &aaag, &aaab, &aaaa; - /* clang-format on */ + static VecBase &rra, &rga, &rba, &rar, &rag, &rab, &raa, &gra, &gga, &gba, &gar, &gag, + &gab, &gaa, &bra, &bga, &bba, &bar, &bag, &bab, &baa, &arr, &arg, &arb, &ara, &agr, &agg, + &agb, &aga, &abr, &abg, &abb, &aba, &aar, &aag, &aab, &aaa; + static VecBase &rrra, &rrga, &rrba, &rrar, &rrag, &rrab, &rraa, &rgra, &rgga, &rgba, &rgar, + &rgag, &rgab, &rgaa, &rbra, &rbga, &rbba, &rbar, &rbag, &rbab, &rbaa, &rarr, &rarg, &rarb, + &rara, &ragr, &ragg, &ragb, &raga, &rabr, &rabg, &rabb, &raba, &raar, &raag, &raab, &raaa, + &grra, &grga, &grba, &grar, &grag, &grab, &graa, &ggra, &ggga, &ggba, &ggar, &ggag, &ggab, + &ggaa, &gbra, &gbga, &gbba, &gbar, &gbag, &gbab, &gbaa, &garr, &garg, &garb, &gara, &gagr, + &gagg, &gagb, &gaga, &gabr, &gabg, &gabb, &gaba, &gaar, &gaag, &gaab, &gaaa, &brra, &brga, + &brba, &brar, &brag, &brab, &braa, &bgra, &bgga, &bgba, &bgar, &bgag, &bgab, &bgaa, &bbra, + &bbga, &bbba, &bbar, &bbag, &bbab, &bbaa, &barr, &barg, &barb, &bara, &bagr, &bagg, &bagb, + &baga, &babr, &babg, &babb, &baba, &baar, &baag, &baab, &baaa, &arrr, &arrg, &arrb, &arra, + &argr, &argg, &argb, &arga, &arbr, &arbg, &arbb, &arba, &arar, &arag, &arab, &araa, &agrr, + &agrg, &agrb, &agra, &aggr, &aggg, &aggb, &agga, &agbr, &agbg, &agbb, &agba, &agar, &agag, + &agab, &agaa, &abrr, &abrg, &abrb, &abra, &abgr, &abgg, &abgb, &abga, &abbr, &abbg, &abbb, + &abba, &abar, &abag, &abab, &abaa, &aarr, &aarg, &aarb, &aara, &aagr, &aagg, &aagb, &aaga, + &aabr, &aabg, &aabb, &aaba, &aaar, &aaag, &aaab, &aaaa; }; template struct VecBase : VecOp, VecSwizzle2, ColSwizzle2 { -- 2.30.2 From e145811e71791401e4c5f6cc2a5fe2cf86d35b7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Thu, 26 Sep 2024 17:04:47 +0200 Subject: [PATCH 37/90] Add shared declarations and avoid GPU_shader_shared_utils to mess with stubs --- source/blender/gpu/GPU_shader_shared_utils.hh | 4 +++- source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/source/blender/gpu/GPU_shader_shared_utils.hh b/source/blender/gpu/GPU_shader_shared_utils.hh index 5fe801e44e1..244d877c57e 100644 --- a/source/blender/gpu/GPU_shader_shared_utils.hh +++ b/source/blender/gpu/GPU_shader_shared_utils.hh @@ -28,7 +28,9 @@ * NOTE: You can use bool type using bool32_t a int boolean type matching the GLSL type. */ -#ifdef GPU_SHADER +#ifdef GLSL_CPP_STUBS +/* Do nothing. */ +#elif defined(GPU_SHADER) /* Silence macros when compiling for shaders. */ # define BLI_STATIC_ASSERT(cond, msg) # define BLI_STATIC_ASSERT_ALIGN(type_, align_) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index e6912269fb1..ddebc382bb3 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -759,8 +759,10 @@ void groupMemoryBarrier() {} /** \} */ +#define GLSL_CPP_STUBS + /* Include all shader shared files to that custom type definitions are available when create infos - * macros are included. */ + * macros are included. Include them here so that only including this file is needed. */ #include "GPU_shader_shared.hh" #include "draw_common_shader_shared.hh" #include "draw_shader_shared.hh" @@ -768,3 +770,6 @@ void groupMemoryBarrier() {} #include "overlay_shader_shared.h" #include "select_shader_shared.hh" #include "workbench_shader_shared.h" + +/* TODO(fclem): Include all create infos here so that they don't need to be individually included + * inside shaders. */ -- 2.30.2 From 2dacd2a9b36091dda23aa56c5e7554e9245963c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Tue, 24 Sep 2024 21:44:43 +0200 Subject: [PATCH 38/90] Macro work --- .../gpu/intern/gpu_shader_create_info.hh | 197 +++++++++++++++++- 1 file changed, 195 insertions(+), 2 deletions(-) diff --git a/source/blender/gpu/intern/gpu_shader_create_info.hh b/source/blender/gpu/intern/gpu_shader_create_info.hh index c7e10447e97..3f9d2f5542d 100644 --- a/source/blender/gpu/intern/gpu_shader_create_info.hh +++ b/source/blender/gpu/intern/gpu_shader_create_info.hh @@ -40,12 +40,205 @@ namespace blender::gpu::shader { /* Helps intellisense / auto-completion. */ #ifndef GPU_SHADER_CREATE_INFO -# define GPU_SHADER_INTERFACE_INFO(_interface, _inst_name) \ +# define GPU_SHADER_NAMED_INTERFACE_INFO(_interface, _inst_name) \ StageInterfaceInfo _interface(#_interface, _inst_name); \ _interface +# define GPU_SHADER_INTERFACE_INFO(_interface) \ + StageInterfaceInfo _interface(#_interface); \ + _interface # define GPU_SHADER_CREATE_INFO(_info) \ ShaderCreateInfo _info(#_info); \ _info + +# define GPU_SHADER_NAMED_INTERFACE_END(_inst_name) ; +# define GPU_SHADER_INTERFACE_END ; +# define GPU_SHADER_CREATE_END ; + +#elif defined(GLSL_CPP_STUBS) + +# define GPU_SHADER_NAMED_INTERFACE_INFO(_interface, _inst_name) \ + namespace _interface { \ + struct { +# define GPU_SHADER_NAMED_INTERFACE_END(_inst_name) \ + } \ + _inst_name; \ + } + +# define GPU_SHADER_INTERFACE_INFO(_interface, _inst_name) namespace _interface { +# define GPU_SHADER_INTERFACE_END } + +# define GPU_SHADER_CREATE_INFO(_info) namespace _info { +# define GPU_SHADER_CREATE_END } +#endif + +#ifdef GPU_CREATE_INFO_RUNTIME_IMPL +# define SMOOTH(type, name) .smooth(type, name) +# define FLAT(type, name) .flat(type, name) +# define NO_PERSPECTIVE(type, name) .no_perspective(type, name) + +/* LOCAL_GROUP_SIZE(int size_x, int size_y = -1, int size_z = -1) */ +# define LOCAL_GROUP_SIZE(...) .local_group_size(__VA_ARGS__) + +# define VERTEX_IN(slot, type, name) .vertex_in(slot, Type::##type, #name) +# define VERTEX_OUT(stage_interface) .vertex_out(stage_interface) +/* TO REMOVE. */ +# define GEOMETRY_LAYOUT(...) .geometry_layout(__VA_ARGS__) +# define GEOMETRY_OUT(stage_interface) .geometry_out(stage_interface) + +# define SUBPASS_IN(slot, type, name, rog) .subpass_in(slot, Type::##type, #name, rog) + +# define FRAGMENT_OUT(slot, type, name) .fragment_out(slot, Type::##type, #name) +# define FRAGMENT_OUT_DUAL(slot, type, name, blend) \ + .fragment_out(slot, Type::##type, #name, blend) +# define FRAGMENT_OUT_ROG(slot, type, name, rog) \ + .fragment_out(slot, Type::##type, #name, DualBlend::NONE, rog) + +# define EARLY_FRAGMENT_TEST(enable) .early_fragment_test(enable) +# define DEPTH_WRITE(value) .depth_write(value) + +# define SPECIALIZATION_CONSTANT(type, name, default_value) \ + .specialization_constant(Type::##type, #name, default_value) + +# define PUSH_CONSTANT(type, name, array_size) .push_constant(Type::##type, #name, array_size) + +# define UNIFORM_BUF(slot, type_name, name, freq) .uniform_buf(slot, #type_name, #name) +# define UNIFORM_BUF_FREQ(slot, type_name, name, freq) \ + .uniform_buf(slot, #type_name, #name, Frequency::##freq) + +# define STORAGE_BUF(slot, qualifiers, type_name, name) \ + .storage_buf(slot, Qualifier::##qualifiers, #type_name, #name, freq) +# define STORAGE_BUF_FREQ(slot, qualifiers, type_name, name, freq) \ + .storage_buf(slot, Qualifier::##qualifiers, #type_name, #name, Frequency::##freq) + +# define SAMPLER(slot, type, name) .sampler(slot, ImageType::##type, #name) +# define SAMPLER_FREQ(slot, type, name, freq) \ + .sampler(slot, ImageType::##type, #name, Frequency::##freq) + +# define IMAGE(slot, format, qualifiers, type, name) \ + .image(slot, format, Qualifier::##qualifiers, ImageType::##type, #name) +# define IMAGE_FREQ(slot, format, qualifiers, type, name, freq) \ + .image(slot, format, Qualifier::##qualifiers, ImageType::##type, #name, Frequency::##freq) + +# define BUILTINS(builtin) .builtins(builtin) + +# define VERTEX_SOURCE(filename) .vertex_source(filename) +# define GEOMETRY_SOURCE(filename) .geometry_source(filename) +# define FRAGMENT_SOURCE(filename) .fragment_source(filename) +# define COMPUTE_SOURCE(filename) .compute_source(filename) + +# define DEFINE(name) .define(#name) +# define DEFINE_VALUE(name, value) .define(#name, #value) + +# define DO_STATIC_COMPILATION() .do_static_compilation(true) +# define AUTO_RESOURCE_LOCATION() .auto_resource_location(true) + +/* TO REMOVE. */ +# define METAL_BACKEND_ONLY() .metal_backend_only(true) + +# define ADDITIONAL_INFO(info_name) .additional_info(info_name) +# define TYPEDEF_SOURCE(filename) .typedef_source(filename) + +# define MTL_MAX_TOTAL_THREADS_PER_THREADGROUP(value) \ + .mtl_max_total_threads_per_threadgroup(value) + +#else + +# define READ const +# define WRITE +# define READ_WRITE + +# define _FLOAT_BUFFER(T) T##Buffer +# define _FLOAT_1D(T) T##1D +# define _FLOAT_1D_ARRAY(T) T##1DArray +# define _FLOAT_2D(T) T##2D +# define _FLOAT_2D_ARRAY(T) T##2DArray +# define _FLOAT_3D(T) T##3D +# define _FLOAT_CUBE(T) T##Cube +# define _FLOAT_CUBE_ARRAY(T) T##CubeArray +# define _INT_BUFFER(T) i##T##Buffer +# define _INT_1D(T) i##T##1D +# define _INT_1D_ARRAY(T) i##T##1DArray +# define _INT_2D(T) i##T##2D +# define _INT_2D_ARRAY(T) i##T##2DArray +# define _INT_3D(T) i##T##3D +# define _INT_CUBE(T) i##T##Cube +# define _INT_CUBE_ARRAY(T) i##T##CubeArray +# define _UINT_BUFFER(T) u##T##Buffer +# define _UINT_1D(T) u##T##1D +# define _UINT_1D_ARRAY(T) u##T##1DArray +# define _UINT_2D(T) u##T##2D +# define _UINT_2D_ARRAY(T) u##T##2DArray +# define _UINT_3D(T) u##T##3D +# define _UINT_CUBE(T) u##T##Cube +# define _UINT_CUBE_ARRAY(T) u##T##CubeArray +# define _SHADOW_2D(T) T##2DShadow +# define _SHADOW_2D_ARRAY(T) T##2DArrayShadow +# define _SHADOW_CUBE(T) T##CubeShadow +# define _SHADOW_CUBE_ARRAY(T) T##CubeArrayShadow +# define _DEPTH_2D(T) T##2D +# define _DEPTH_2D_ARRAY(T) T##2DArray +# define _DEPTH_CUBE(T) T##Cube +# define _DEPTH_CUBE_ARRAY(T) T##CubeArray + +# define SMOOTH(type, name) type name = {}; +# define FLAT(type, name) type name = {}; +# define NO_PERSPECTIVE(type, name) type name = {}; + +/* LOCAL_GROUP_SIZE(int size_x, int size_y = -1, int size_z = -1) */ +# define LOCAL_GROUP_SIZE(...) + +# define VERTEX_IN(slot, type, name) const type name = {}; +# define VERTEX_OUT(stage_interface) using namespace stage_interface; +/* TO REMOVE. */ +# define GEOMETRY_LAYOUT(...) +# define GEOMETRY_OUT(stage_interface) using namespace stage_interface; + +# define SUBPASS_IN(slot, type, name, rog) const type name = {}; + +# define FRAGMENT_OUT(slot, type, name) type name; +# define FRAGMENT_OUT_DUAL(slot, type, name, blend) type name; +# define FRAGMENT_OUT_ROG(slot, type, name, rog) type name; + +# define EARLY_FRAGMENT_TEST(enable) +# define DEPTH_WRITE(value) + +# define SPECIALIZATION_CONSTANT(type, name, default_value) constexpr type name = {}; + +# define PUSH_CONSTANT(type, name, array_size) const type name = {}; + +# define UNIFORM_BUF(slot, type_name, name, freq) const type_name name; +# define UNIFORM_BUF_FREQ(slot, type_name, name, freq) const type_name name; + +# define STORAGE_BUF(slot, qualifiers, type_name, name) qualifiers type_name name; +# define STORAGE_BUF_FREQ(slot, qualifiers, type_name, name, freq) qualifiers type_name name; + +# define SAMPLER(slot, type, name) _##type(sampler) name; +# define SAMPLER_FREQ(slot, type, name, freq) _##type(sampler) name; + +# define IMAGE(slot, format, qualifiers, type, name) qualifiers _##type(image) name; +# define IMAGE_FREQ(slot, format, qualifiers, type, name, freq) qualifiers _##type(image) name; + +# define BUILTINS(builtin) + +# define VERTEX_SOURCE(filename) +# define GEOMETRY_SOURCE(filename) +# define FRAGMENT_SOURCE(filename) +# define COMPUTE_SOURCE(filename) + +# define DEFINE(name) +# define DEFINE_VALUE(name, value) + +# define DO_STATIC_COMPILATION() +# define AUTO_RESOURCE_LOCATION() + +/* TO REMOVE. */ +# define METAL_BACKEND_ONLY() + +# define ADDITIONAL_INFO(info_name) using namespace info_name; +# define TYPEDEF_SOURCE(filename) + +# define MTL_MAX_TOTAL_THREADS_PER_THREADGROUP(value) \ + .mtl_max_total_threads_per_threadgroup(value) #endif /* All of these functions is a bit out of place */ @@ -326,7 +519,7 @@ struct StageInterfaceInfo { /** List of all members of the interface. */ Vector inouts; - StageInterfaceInfo(const char *name_, const char *instance_name_) + StageInterfaceInfo(const char *name_, const char *instance_name_ = "") : name(name_), instance_name(instance_name_){}; ~StageInterfaceInfo(){}; -- 2.30.2 From 601da1c78f84b4cc0aa5a728366d6cf663ed8068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Tue, 24 Sep 2024 23:07:51 +0200 Subject: [PATCH 39/90] Make macro work --- .../gpu/intern/gpu_shader_create_info.hh | 49 ++++++++++--------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/source/blender/gpu/intern/gpu_shader_create_info.hh b/source/blender/gpu/intern/gpu_shader_create_info.hh index 3f9d2f5542d..a2aad59b0f5 100644 --- a/source/blender/gpu/intern/gpu_shader_create_info.hh +++ b/source/blender/gpu/intern/gpu_shader_create_info.hh @@ -38,8 +38,25 @@ namespace blender::gpu::shader { -/* Helps intellisense / auto-completion. */ -#ifndef GPU_SHADER_CREATE_INFO +#if defined(GLSL_CPP_STUBS) +# define GPU_SHADER_NAMED_INTERFACE_INFO(_interface, _inst_name) \ + namespace _interface { \ + struct { +# define GPU_SHADER_NAMED_INTERFACE_END(_inst_name) \ + } \ + _inst_name; \ + } + +# define GPU_SHADER_INTERFACE_INFO(_interface, _inst_name) namespace _interface { +# define GPU_SHADER_INTERFACE_END() } + +# define GPU_SHADER_CREATE_INFO(_info) namespace _info { +# define GPU_SHADER_CREATE_END() } + +# define USE_CREATE_INFO(_info) using namespace _info; + +#elif !defined(GPU_SHADER_CREATE_INFO) +/* Helps intellisense / auto-completion inside info files. */ # define GPU_SHADER_NAMED_INTERFACE_INFO(_interface, _inst_name) \ StageInterfaceInfo _interface(#_interface, _inst_name); \ _interface @@ -51,27 +68,12 @@ namespace blender::gpu::shader { _info # define GPU_SHADER_NAMED_INTERFACE_END(_inst_name) ; -# define GPU_SHADER_INTERFACE_END ; -# define GPU_SHADER_CREATE_END ; +# define GPU_SHADER_INTERFACE_END() ; +# define GPU_SHADER_CREATE_END() ; -#elif defined(GLSL_CPP_STUBS) - -# define GPU_SHADER_NAMED_INTERFACE_INFO(_interface, _inst_name) \ - namespace _interface { \ - struct { -# define GPU_SHADER_NAMED_INTERFACE_END(_inst_name) \ - } \ - _inst_name; \ - } - -# define GPU_SHADER_INTERFACE_INFO(_interface, _inst_name) namespace _interface { -# define GPU_SHADER_INTERFACE_END } - -# define GPU_SHADER_CREATE_INFO(_info) namespace _info { -# define GPU_SHADER_CREATE_END } #endif -#ifdef GPU_CREATE_INFO_RUNTIME_IMPL +#ifndef GLSL_CPP_STUBS # define SMOOTH(type, name) .smooth(type, name) # define FLAT(type, name) .flat(type, name) # define NO_PERSPECTIVE(type, name) .no_perspective(type, name) @@ -99,7 +101,9 @@ namespace blender::gpu::shader { # define SPECIALIZATION_CONSTANT(type, name, default_value) \ .specialization_constant(Type::##type, #name, default_value) -# define PUSH_CONSTANT(type, name, array_size) .push_constant(Type::##type, #name, array_size) +# define PUSH_CONSTANT(type, name) .push_constant(Type::##type, #name) +# define PUSH_CONSTANT_ARRAY(type, name, array_size) \ + .push_constant(Type::##type, #name, array_size) # define UNIFORM_BUF(slot, type_name, name, freq) .uniform_buf(slot, #type_name, #name) # define UNIFORM_BUF_FREQ(slot, type_name, name, freq) \ @@ -204,7 +208,8 @@ namespace blender::gpu::shader { # define SPECIALIZATION_CONSTANT(type, name, default_value) constexpr type name = {}; -# define PUSH_CONSTANT(type, name, array_size) const type name = {}; +# define PUSH_CONSTANT(type, name) const type name = {}; +# define PUSH_CONSTANT_ARRAY(type, name, array_size) const type name[array_size] = {}; # define UNIFORM_BUF(slot, type_name, name, freq) const type_name name; # define UNIFORM_BUF_FREQ(slot, type_name, name, freq) const type_name name; -- 2.30.2 From 2e657ac4ca2aa8d8b21d53bc3e369774d20f0972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Tue, 24 Sep 2024 23:08:26 +0200 Subject: [PATCH 40/90] Port of gpu_shader_icon --- .../gpu/shaders/infos/gpu_interface_info.hh | 45 ++++++++++++++----- .../gpu/shaders/infos/gpu_shader_icon_info.hh | 44 +++++++++--------- 2 files changed, 56 insertions(+), 33 deletions(-) diff --git a/source/blender/gpu/shaders/infos/gpu_interface_info.hh b/source/blender/gpu/shaders/infos/gpu_interface_info.hh index 8b53f08dabb..0b021d472c0 100644 --- a/source/blender/gpu/shaders/infos/gpu_interface_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_interface_info.hh @@ -10,15 +10,36 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(flat_color_iface, "").flat(Type::VEC4, "finalColor"); -GPU_SHADER_INTERFACE_INFO(no_perspective_color_iface, "").no_perspective(Type::VEC4, "finalColor"); -GPU_SHADER_INTERFACE_INFO(smooth_color_iface, "").smooth(Type::VEC4, "finalColor"); -GPU_SHADER_INTERFACE_INFO(smooth_tex_coord_interp_iface, "").smooth(Type::VEC2, "texCoord_interp"); -GPU_SHADER_INTERFACE_INFO(smooth_radii_iface, "").smooth(Type::VEC2, "radii"); -GPU_SHADER_INTERFACE_INFO(smooth_radii_outline_iface, "").smooth(Type::VEC4, "radii"); -GPU_SHADER_INTERFACE_INFO(flat_color_smooth_tex_coord_interp_iface, "") - .flat(Type::VEC4, "finalColor") - .smooth(Type::VEC2, "texCoord_interp"); -GPU_SHADER_INTERFACE_INFO(smooth_icon_interp_iface, "") - .smooth(Type::VEC2, "texCoord_interp") - .smooth(Type::VEC2, "mask_coord_interp"); +GPU_SHADER_INTERFACE_INFO(flat_color_iface) +FLAT(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() + +GPU_SHADER_INTERFACE_INFO(no_perspective_color_iface) +NO_PERSPECTIVE(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() + +GPU_SHADER_INTERFACE_INFO(smooth_color_iface) +SMOOTH(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() + +GPU_SHADER_INTERFACE_INFO(smooth_tex_coord_interp_iface) +SMOOTH(VEC2, texCoord_interp) +GPU_SHADER_INTERFACE_END() + +GPU_SHADER_INTERFACE_INFO(smooth_radii_iface) +SMOOTH(VEC2, radii) +GPU_SHADER_INTERFACE_END() + +GPU_SHADER_INTERFACE_INFO(smooth_radii_outline_iface) +SMOOTH(VEC4, radii) +GPU_SHADER_INTERFACE_END() + +GPU_SHADER_INTERFACE_INFO(flat_color_smooth_tex_coord_interp_iface) +FLAT(VEC4, finalColor) +SMOOTH(VEC2, texCoord_interp) +GPU_SHADER_INTERFACE_END() + +GPU_SHADER_INTERFACE_INFO(smooth_icon_interp_iface) +SMOOTH(VEC2, texCoord_interp) +SMOOTH(VEC2, mask_coord_interp) +GPU_SHADER_INTERFACE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_icon_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_icon_info.hh index a4995cc28c0..2909b3061ba 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_icon_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_icon_info.hh @@ -10,26 +10,28 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_icon) - .define("DO_CORNER_MASKING") - .vertex_out(smooth_icon_interp_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC4, "finalColor") - .push_constant(Type::VEC4, "rect_icon") - .push_constant(Type::VEC4, "rect_geom") - .push_constant(Type::FLOAT, "text_width") - .sampler(0, ImageType::FLOAT_2D, "image") - .vertex_source("gpu_shader_icon_vert.glsl") - .fragment_source("gpu_shader_icon_frag.glsl") - .do_static_compilation(true); +DEFINE(DO_CORNER_MASKING) +VERTEX_OUT(smooth_icon_interp_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC4, finalColor) +PUSH_CONSTANT(VEC4, rect_icon) +PUSH_CONSTANT(VEC4, rect_geom) +PUSH_CONSTANT(FLOAT, text_width) +SAMPLER(0, FLOAT_2D, image) +VERTEX_SOURCE("gpu_shader_icon_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_icon_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_icon_multi) - .vertex_in(0, Type::VEC2, "pos") - .vertex_out(flat_color_smooth_tex_coord_interp_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .uniform_buf(0, "MultiIconCallData", "multi_icon_data") - .sampler(0, ImageType::FLOAT_2D, "image") - .typedef_source("GPU_shader_shared.hh") - .vertex_source("gpu_shader_icon_multi_vert.glsl") - .fragment_source("gpu_shader_icon_frag.glsl") - .do_static_compilation(true); +VERTEX_IN(0, VEC2, pos) +VERTEX_OUT(flat_color_smooth_tex_coord_interp_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +UNIFORM_BUF(0, MultiIconCallData, multi_icon_data) +SAMPLER(0, FLOAT_2D, image) +TYPEDEF_SOURCE("GPU_shader_shared.hh") +VERTEX_SOURCE("gpu_shader_icon_multi_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_icon_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() -- 2.30.2 From eaf577f654a82be7c21d83e20fe1e0e7ca987167 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Tue, 24 Sep 2024 23:08:52 +0200 Subject: [PATCH 41/90] Example usage --- source/blender/gpu/shaders/gpu_shader_icon_vert.glsl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/blender/gpu/shaders/gpu_shader_icon_vert.glsl b/source/blender/gpu/shaders/gpu_shader_icon_vert.glsl index 8250a0181b9..c17e09611bb 100644 --- a/source/blender/gpu/shaders/gpu_shader_icon_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_icon_vert.glsl @@ -7,6 +7,13 @@ * does not need any vertex input (producing less call to immBegin/End) */ +/* TODO(fclem): Replace with gpu_glsl_cpp_stubs.hh include. */ +#define GLSL_CPP_STUBS + +#include "infos/gpu_shader_icon_info.hh" + +USE_CREATE_INFO(gpu_shader_icon) + void main() { vec2 uv; -- 2.30.2 From 10dabf236a8bb708409e9a24bd84912925dbb162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Tue, 24 Sep 2024 23:28:41 +0200 Subject: [PATCH 42/90] Update GPU_SHADER_INTERFACE_INFO usage --- .../infos/eevee_depth_of_field_info.hh | 5 +- .../infos/eevee_lightprobe_sphere_info.hh | 4 +- .../infos/eevee_lightprobe_volume_info.hh | 7 ++- .../shaders/infos/eevee_lookdev_info.hh | 2 +- .../shaders/infos/eevee_material_info.hh | 16 +++--- .../shaders/infos/eevee_shadow_info.hh | 9 ++-- .../shaders/infos/eevee_velocity_info.hh | 2 +- .../gpencil/shaders/infos/gpencil_info.hh | 8 +-- .../image/shaders/infos/engine_image_info.hh | 4 +- .../shaders/infos/overlay_armature_info.hh | 26 +++++----- .../shaders/infos/overlay_edit_mode_info.hh | 49 ++++++++++--------- .../shaders/infos/overlay_extra_info.hh | 21 ++++---- .../shaders/infos/overlay_grid_info.hh | 2 +- .../shaders/infos/overlay_outline_info.hh | 10 ++-- .../shaders/infos/overlay_paint_info.hh | 10 ++-- .../infos/overlay_sculpt_curves_info.hh | 4 +- .../shaders/infos/overlay_sculpt_info.hh | 2 +- .../infos/overlay_viewer_attribute_info.hh | 2 +- .../shaders/infos/overlay_volume_info.hh | 4 +- .../shaders/infos/overlay_wireframe_info.hh | 4 +- .../select/shaders/infos/select_id_info.hh | 2 +- .../workbench_effect_antialiasing_info.hh | 2 +- .../shaders/infos/workbench_prepass_info.hh | 2 +- .../shaders/infos/workbench_volume_info.hh | 2 +- .../draw/intern/shaders/draw_debug_info.hh | 4 +- .../intern/shaders/draw_fullscreen_info.hh | 2 +- .../draw/intern/shaders/draw_view_info.hh | 2 +- .../gpu/metal/kernels/depth_2d_update_info.hh | 2 +- .../gpu_shader_fullscreen_blit_info.hh | 2 +- .../infos/gpu_shader_2D_area_borders_info.hh | 2 +- .../infos/gpu_shader_2D_nodelink_info.hh | 2 +- .../infos/gpu_shader_2D_widget_info.hh | 4 +- .../infos/gpu_shader_3D_polyline_info.hh | 4 +- .../infos/gpu_shader_gpencil_stroke_info.hh | 4 +- .../infos/gpu_shader_keyframe_shape_info.hh | 2 +- ...u_shader_line_dashed_uniform_color_info.hh | 2 +- .../infos/gpu_shader_sequencer_info.hh | 4 +- .../infos/gpu_shader_simple_lighting_info.hh | 2 +- .../gpu/shaders/infos/gpu_shader_text_info.hh | 2 +- 39 files changed, 121 insertions(+), 118 deletions(-) diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_depth_of_field_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_depth_of_field_info.hh index 1ebf21e44bb..7369d9eda0c 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_depth_of_field_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_depth_of_field_info.hh @@ -192,7 +192,7 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_filter) /** \name Scatter * \{ */ -GPU_SHADER_INTERFACE_INFO(eevee_depth_of_field_scatter_flat_iface, "interp_flat") +GPU_SHADER_NAMED_INTERFACE_INFO(eevee_depth_of_field_scatter_flat_iface, interp_flat) /** Colors, weights, and Circle of confusion radii for the 4 pixels to scatter. */ .flat(Type::VEC4, "color_and_coc1") .flat(Type::VEC4, "color_and_coc2") @@ -200,7 +200,8 @@ GPU_SHADER_INTERFACE_INFO(eevee_depth_of_field_scatter_flat_iface, "interp_flat" .flat(Type::VEC4, "color_and_coc4") /** Scaling factor for the bokeh distance. */ .flat(Type::FLOAT, "distance_scale"); -GPU_SHADER_INTERFACE_INFO(eevee_depth_of_field_scatter_noperspective_iface, "interp_noperspective") +GPU_SHADER_NAMED_INTERFACE_INFO(eevee_depth_of_field_scatter_noperspective_iface, + interp_noperspective) /** Sprite pixel position with origin at sprite center. In pixels. */ .no_perspective(Type::VEC2, "rect_uv1") .no_perspective(Type::VEC2, "rect_uv2") diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_sphere_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_sphere_info.hh index c54e42d0166..4e4cc3835a3 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_sphere_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_sphere_info.hh @@ -78,7 +78,7 @@ GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_convolve) .compute_source("eevee_lightprobe_sphere_convolve_comp.glsl") .do_static_compilation(true); -GPU_SHADER_INTERFACE_INFO(eevee_display_lightprobe_sphere_iface, "") +GPU_SHADER_INTERFACE_INFO(eevee_display_lightprobe_sphere_iface) .smooth(Type::VEC3, "P") .smooth(Type::VEC2, "lP") .flat(Type::INT, "probe_index"); @@ -92,7 +92,7 @@ GPU_SHADER_CREATE_INFO(eevee_display_lightprobe_sphere) .fragment_out(0, Type::VEC4, "out_color") .do_static_compilation(true); -GPU_SHADER_INTERFACE_INFO(eevee_display_lightprobe_planar_iface, "") +GPU_SHADER_INTERFACE_INFO(eevee_display_lightprobe_planar_iface) .flat(Type::VEC3, "probe_normal") .flat(Type::INT, "probe_index"); diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_volume_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_volume_info.hh index 948ffffaee3..7efac6e2b8d 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_volume_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_volume_info.hh @@ -9,7 +9,7 @@ /** \name Display * \{ */ -GPU_SHADER_INTERFACE_INFO(eevee_debug_surfel_iface, "") +GPU_SHADER_INTERFACE_INFO(eevee_debug_surfel_iface) .smooth(Type::VEC3, "P") .flat(Type::INT, "surfel_index"); @@ -24,8 +24,7 @@ GPU_SHADER_CREATE_INFO(eevee_debug_surfels) .push_constant(Type::INT, "debug_mode") .do_static_compilation(true); -GPU_SHADER_INTERFACE_INFO(eevee_debug_irradiance_grid_iface, "") - .smooth(Type::VEC4, "interp_color"); +GPU_SHADER_INTERFACE_INFO(eevee_debug_irradiance_grid_iface).smooth(Type::VEC4, "interp_color"); GPU_SHADER_CREATE_INFO(eevee_debug_irradiance_grid) .additional_info("eevee_shared", "draw_view") @@ -39,7 +38,7 @@ GPU_SHADER_CREATE_INFO(eevee_debug_irradiance_grid) .fragment_source("eevee_debug_irradiance_grid_frag.glsl") .do_static_compilation(true); -GPU_SHADER_INTERFACE_INFO(eevee_display_lightprobe_volume_iface, "") +GPU_SHADER_INTERFACE_INFO(eevee_display_lightprobe_volume_iface) .smooth(Type::VEC2, "lP") .flat(Type::IVEC3, "cell"); diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lookdev_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lookdev_info.hh index 04055507428..d56bf371eb5 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lookdev_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lookdev_info.hh @@ -5,7 +5,7 @@ #include "eevee_defines.hh" #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(eevee_lookdev_display_iface, "") +GPU_SHADER_INTERFACE_INFO(eevee_lookdev_display_iface) .smooth(Type::VEC2, "uv_coord") .flat(Type::UINT, "sphere_id"); diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh index 6850ef64f99..61a8209771b 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh @@ -26,7 +26,7 @@ GPU_SHADER_CREATE_INFO(eevee_utility_texture) .define("EEVEE_UTILITY_TX") .sampler(RBUFS_UTILITY_TEX_SLOT, ImageType::FLOAT_2D_ARRAY, "utility_tx"); -GPU_SHADER_INTERFACE_INFO(eevee_clip_plane_iface, "clip_interp") +GPU_SHADER_NAMED_INTERFACE_INFO(eevee_clip_plane_iface, clip_interp) .smooth(Type::FLOAT, "clip_distance"); GPU_SHADER_CREATE_INFO(eevee_clip_plane) @@ -41,7 +41,7 @@ GPU_SHADER_CREATE_INFO(eevee_clip_plane) * \{ */ /* Common interface */ -GPU_SHADER_INTERFACE_INFO(eevee_surf_iface, "interp") +GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_iface, interp) /* World Position. */ .smooth(Type::VEC3, "P") /* World Normal. */ @@ -59,10 +59,10 @@ GPU_SHADER_CREATE_INFO(eevee_geom_mesh) "draw_resource_id_varying", "draw_view"); -GPU_SHADER_INTERFACE_INFO(eevee_surf_point_cloud_iface, "point_cloud_interp") +GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_point_cloud_iface, point_cloud_interp) .smooth(Type::FLOAT, "radius") .smooth(Type::VEC3, "position"); -GPU_SHADER_INTERFACE_INFO(eevee_surf_point_cloud_flat_iface, "point_cloud_interp_flat") +GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_point_cloud_flat_iface, point_cloud_interp_flat) .flat(Type::INT, "id"); GPU_SHADER_CREATE_INFO(eevee_geom_point_cloud) @@ -101,14 +101,14 @@ GPU_SHADER_CREATE_INFO(eevee_geom_gpencil) "draw_resource_id_varying", "draw_resource_id_new"); -GPU_SHADER_INTERFACE_INFO(eevee_surf_curve_iface, "curve_interp") +GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_curve_iface, curve_interp) .smooth(Type::VEC2, "barycentric_coords") .smooth(Type::VEC3, "tangent") .smooth(Type::VEC3, "binormal") .smooth(Type::FLOAT, "time") .smooth(Type::FLOAT, "time_width") .smooth(Type::FLOAT, "thickness"); -GPU_SHADER_INTERFACE_INFO(eevee_surf_curve_flat_iface, "curve_interp_flat") +GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_curve_flat_iface, curve_interp_flat) .flat(Type::INT, "strand_id"); GPU_SHADER_CREATE_INFO(eevee_geom_curves) @@ -251,10 +251,10 @@ GPU_SHADER_CREATE_INFO(eevee_renderpass_clear) "eevee_shared") .do_static_compilation(true); -GPU_SHADER_INTERFACE_INFO(eevee_surf_shadow_atomic_iface, "shadow_iface") +GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_shadow_atomic_iface, shadow_iface) .flat(Type::INT, "shadow_view_id"); -GPU_SHADER_INTERFACE_INFO(eevee_surf_shadow_clipping_iface, "shadow_clip") +GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_shadow_clipping_iface, shadow_clip) .smooth(Type::VEC3, "position") .smooth(Type::VEC3, "vector"); diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_shadow_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_shadow_info.hh index efaeb4d722e..c6f84bfb9a9 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_shadow_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_shadow_info.hh @@ -82,10 +82,10 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_tag_usage_surfels) "eevee_surfel_common") .compute_source("eevee_shadow_tag_usage_surfels_comp.glsl"); -GPU_SHADER_INTERFACE_INFO(eevee_shadow_tag_transparent_iface, "interp") +GPU_SHADER_NAMED_INTERFACE_INFO(eevee_shadow_tag_transparent_iface, interp) .smooth(Type::VEC3, "P") .smooth(Type::VEC3, "vP"); -GPU_SHADER_INTERFACE_INFO(eevee_shadow_tag_transparent_flat_iface, "interp_flat") +GPU_SHADER_NAMED_INTERFACE_INFO(eevee_shadow_tag_transparent_flat_iface, interp_flat) .flat(Type::VEC3, "ls_aabb_min") .flat(Type::VEC3, "ls_aabb_max"); @@ -244,9 +244,10 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_page_tile_clear) #endif /* Interface for passing precalculated values in accumulation vertex to frag. */ -GPU_SHADER_INTERFACE_INFO(eevee_shadow_page_tile_store_noperspective_iface, "interp_noperspective") +GPU_SHADER_NAMED_INTERFACE_INFO(eevee_shadow_page_tile_store_noperspective_iface, + interp_noperspective) .no_perspective(Type::VEC2, "out_texel_xy"); -GPU_SHADER_INTERFACE_INFO(eevee_shadow_page_tile_store_flat_iface, "interp_flat") +GPU_SHADER_NAMED_INTERFACE_INFO(eevee_shadow_page_tile_store_flat_iface, interp_flat) .flat(PAGE_Z_TYPE, "out_page_z"); #undef PAGE_Z_TYPE diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_velocity_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_velocity_info.hh index ae8937e301d..4a2f8a15c05 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_velocity_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_velocity_info.hh @@ -14,7 +14,7 @@ /* Pass world space deltas to the fragment shader. * This is to make sure that the resulting motion vectors are valid even with displacement. */ -GPU_SHADER_INTERFACE_INFO(eevee_velocity_surface_iface, "motion") +GPU_SHADER_NAMED_INTERFACE_INFO(eevee_velocity_surface_iface, motion) .smooth(Type::VEC3, "prev") .smooth(Type::VEC3, "next"); 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 f3231e79e50..d82d11ccf7d 100644 --- a/source/blender/draw/engines/gpencil/shaders/infos/gpencil_info.hh +++ b/source/blender/draw/engines/gpencil/shaders/infos/gpencil_info.hh @@ -10,17 +10,17 @@ /** \name GPencil Object rendering * \{ */ -GPU_SHADER_INTERFACE_INFO(gpencil_geometry_iface, "gp_interp") +GPU_SHADER_NAMED_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"); -GPU_SHADER_INTERFACE_INFO(gpencil_geometry_flat_iface, "gp_interp_flat") +GPU_SHADER_NAMED_INTERFACE_INFO(gpencil_geometry_flat_iface, gp_interp_flat) .flat(Type::VEC2, "aspect") .flat(Type::VEC4, "sspos") .flat(Type::UINT, "mat_flag") .flat(Type::FLOAT, "depth"); -GPU_SHADER_INTERFACE_INFO(gpencil_geometry_noperspective_iface, "gp_interp_noperspective") +GPU_SHADER_NAMED_INTERFACE_INFO(gpencil_geometry_noperspective_iface, gp_interp_noperspective) .no_perspective(Type::VEC2, "thickness") .no_perspective(Type::FLOAT, "hardness"); @@ -97,7 +97,7 @@ GPU_SHADER_CREATE_INFO(gpencil_depth_merge) /** \name Anti-Aliasing * \{ */ -GPU_SHADER_INTERFACE_INFO(gpencil_antialiasing_iface, "") +GPU_SHADER_INTERFACE_INFO(gpencil_antialiasing_iface) .smooth(Type::VEC2, "uvs") .smooth(Type::VEC2, "pixcoord") .smooth(Type::VEC4, "offset[3]"); diff --git a/source/blender/draw/engines/image/shaders/infos/engine_image_info.hh b/source/blender/draw/engines/image/shaders/infos/engine_image_info.hh index 16b80a8a453..f94f271da78 100644 --- a/source/blender/draw/engines/image/shaders/infos/engine_image_info.hh +++ b/source/blender/draw/engines/image/shaders/infos/engine_image_info.hh @@ -4,7 +4,7 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(image_engine_color_iface, "").smooth(Type::VEC2, "uv_screen"); +GPU_SHADER_INTERFACE_INFO(image_engine_color_iface).smooth(Type::VEC2, "uv_screen"); GPU_SHADER_CREATE_INFO(image_engine_color_shader) .vertex_in(0, Type::IVEC2, "pos") @@ -22,7 +22,7 @@ GPU_SHADER_CREATE_INFO(image_engine_color_shader) .additional_info("draw_modelmat") .do_static_compilation(true); -GPU_SHADER_INTERFACE_INFO(image_engine_depth_iface, "").smooth(Type::VEC2, "uv_image"); +GPU_SHADER_INTERFACE_INFO(image_engine_depth_iface).smooth(Type::VEC2, "uv_image"); GPU_SHADER_CREATE_INFO(image_engine_depth_shader) .vertex_in(0, Type::IVEC2, "pos") diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_armature_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_armature_info.hh index 591c33a07d6..31c3cc1b109 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_armature_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_armature_info.hh @@ -8,7 +8,7 @@ GPU_SHADER_CREATE_INFO(overlay_frag_output) .fragment_out(0, Type::VEC4, "fragColor") .fragment_out(1, Type::VEC4, "lineOutput"); -GPU_SHADER_INTERFACE_INFO(overlay_armature_wire_iface, "") +GPU_SHADER_INTERFACE_INFO(overlay_armature_wire_iface) .flat(Type::VEC4, "finalColor") .flat(Type::VEC2, "edgeStart") .no_perspective(Type::VEC2, "edgePos"); @@ -35,7 +35,7 @@ GPU_SHADER_CREATE_INFO(overlay_armature_sphere_outline_clipped) .do_static_compilation(true) .additional_info("overlay_armature_sphere_outline", "drw_clipped"); -GPU_SHADER_INTERFACE_INFO(overlay_armature_sphere_solid_iface, "") +GPU_SHADER_INTERFACE_INFO(overlay_armature_sphere_solid_iface) .flat(Type::VEC3, "finalStateColor") .flat(Type::VEC3, "finalBoneColor") .flat(Type::MAT4, "sphereMatrix") @@ -64,15 +64,15 @@ GPU_SHADER_CREATE_INFO(overlay_armature_sphere_solid_clipped) /** \name Armature Shapes * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_outline_iface, "geom_in") +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_armature_shape_outline_iface, geom_in) .smooth(Type::VEC4, "pPos") .smooth(Type::VEC3, "vPos") .smooth(Type::VEC2, "ssPos") .smooth(Type::VEC4, "vColSize"); -GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_outline_flat_iface, "geom_flat_in") +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_armature_shape_outline_flat_iface, geom_flat_in) .flat(Type::INT, "inverted"); -GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_outline_no_geom_iface, "") +GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_outline_no_geom_iface) .flat(Type::VEC4, "finalColor") .flat(Type::VEC2, "edgeStart") .no_perspective(Type::VEC2, "edgePos"); @@ -124,7 +124,7 @@ GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_clipped_no_geom) .do_static_compilation(true) .additional_info("overlay_armature_shape_outline_no_geom", "drw_clipped"); -GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_solid_iface, "") +GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_solid_iface) .smooth(Type::VEC4, "finalColor") .flat(Type::INT, "inverted"); @@ -144,21 +144,21 @@ GPU_SHADER_CREATE_INFO(overlay_armature_shape_solid_clipped) .do_static_compilation(true) .additional_info("overlay_armature_shape_solid", "drw_clipped"); -GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_wire_next_iface, "") +GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_wire_next_iface) .flat(Type::VEC4, "finalColor") .flat(Type::FLOAT, "wire_width") .no_perspective(Type::FLOAT, "edgeCoord"); -GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_wire_iface, "geometry_in") +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_armature_shape_wire_iface, geometry_in) .flat(Type::VEC4, "finalColor") .flat(Type::FLOAT, "wire_width"); -GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_wire_geom_iface, "geometry_out") +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_armature_shape_wire_geom_iface, geometry_out) .flat(Type::VEC4, "finalColor") .flat(Type::FLOAT, "wire_width"); -GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_wire_geom_noperspective_iface, - "geometry_noperspective_out") +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_armature_shape_wire_geom_noperspective_iface, + geometry_noperspective_out) .no_perspective(Type::FLOAT, "edgeCoord"); GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire) @@ -238,7 +238,7 @@ GPU_SHADER_CREATE_INFO(overlay_armature_envelope_outline_clipped) .do_static_compilation(true) .additional_info("overlay_armature_envelope_outline", "drw_clipped"); -GPU_SHADER_INTERFACE_INFO(overlay_armature_envelope_solid_iface, "") +GPU_SHADER_INTERFACE_INFO(overlay_armature_envelope_solid_iface) .flat(Type::VEC3, "finalStateColor") .flat(Type::VEC3, "finalBoneColor") .smooth(Type::VEC3, "normalView"); @@ -269,7 +269,7 @@ GPU_SHADER_CREATE_INFO(overlay_armature_envelope_solid_clipped) /** \name Armature Stick * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_armature_stick_iface, "") +GPU_SHADER_INTERFACE_INFO(overlay_armature_stick_iface) .no_perspective(Type::FLOAT, "colorFac") .flat(Type::VEC4, "finalWireColor") .flat(Type::VEC4, "finalInnerColor"); diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh index cae4916f9f5..82f39ec5f3f 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh @@ -4,9 +4,9 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(overlay_edit_flat_color_iface, "").flat(Type::VEC4, "finalColor"); -GPU_SHADER_INTERFACE_INFO(overlay_edit_smooth_color_iface, "").smooth(Type::VEC4, "finalColor"); -GPU_SHADER_INTERFACE_INFO(overlay_edit_nopersp_color_iface, "") +GPU_SHADER_INTERFACE_INFO(overlay_edit_flat_color_iface).flat(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_edit_smooth_color_iface).smooth(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_edit_nopersp_color_iface) .no_perspective(Type::VEC4, "finalColor"); /* -------------------------------------------------------------------- */ @@ -53,7 +53,7 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_depth_clipped) .do_static_compilation(true) .additional_info("overlay_edit_mesh_depth", "drw_clipped"); -GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_vert_iface, "") +GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_vert_iface) .smooth(Type::VEC4, "finalColor") .smooth(Type::FLOAT, "vertexCrease"); @@ -84,17 +84,17 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_vert_next) "draw_resource_handle_new", "overlay_edit_mesh_common"); -GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_edge_iface, "geometry_in") +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_mesh_edge_iface, geometry_in) .smooth(Type::VEC4, "finalColor_") .smooth(Type::VEC4, "finalColorOuter_") .smooth(Type::UINT, "selectOverride_"); -GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_edge_geom_iface, "geometry_out") +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_mesh_edge_geom_iface, geometry_out) .smooth(Type::VEC4, "finalColor"); -GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_edge_geom_flat_iface, "geometry_flat_out") +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_mesh_edge_geom_flat_iface, geometry_flat_out) .flat(Type::VEC4, "finalColorOuter"); -GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_edge_geom_noperspective_iface, - "geometry_noperspective_out") +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_mesh_edge_geom_noperspective_iface, + geometry_noperspective_out) .no_perspective(Type::FLOAT, "edgeCoord"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge) @@ -239,7 +239,7 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_normal) .fragment_source("overlay_varying_color.glsl") .additional_info("draw_modelmat_instanced_attr", "draw_globals"); -GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_analysis_iface, "").smooth(Type::VEC4, "weightColor"); +GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_analysis_iface).smooth(Type::VEC4, "weightColor"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_analysis) .do_static_compilation(true) @@ -315,17 +315,18 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_skin_root_clipped) /** \name Edit UV * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_edit_uv_iface, "geom_in").smooth(Type::FLOAT, "selectionFac"); -GPU_SHADER_INTERFACE_INFO(overlay_edit_uv_flat_iface, "geom_flat_in") +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_uv_iface, geom_in) + .smooth(Type::FLOAT, "selectionFac"); +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_uv_flat_iface, geom_flat_in) .flat(Type::VEC2, "stippleStart"); -GPU_SHADER_INTERFACE_INFO(overlay_edit_uv_noperspective_iface, "geom_noperspective_in") +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_uv_noperspective_iface, geom_noperspective_in) .no_perspective(Type::VEC2, "stipplePos"); -GPU_SHADER_INTERFACE_INFO(overlay_edit_uv_geom_iface, "geom_out") +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_uv_geom_iface, geom_out) .smooth(Type::FLOAT, "selectionFac"); -GPU_SHADER_INTERFACE_INFO(overlay_edit_uv_geom_flat_iface, "geom_flat_out") +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_uv_geom_flat_iface, geom_flat_out) .flat(Type::VEC2, "stippleStart"); -GPU_SHADER_INTERFACE_INFO(overlay_edit_uv_geom_noperspective_iface, "geom_noperspective_out") +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_uv_geom_noperspective_iface, geom_noperspective_out) .no_perspective(Type::FLOAT, "edgeCoord") .no_perspective(Type::VEC2, "stipplePos"); @@ -369,7 +370,7 @@ GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges_select) .define("USE_EDGE_SELECT") .additional_info("overlay_edit_uv_edges"); -GPU_SHADER_INTERFACE_INFO(overlay_edit_uv_next_iface, "") +GPU_SHADER_INTERFACE_INFO(overlay_edit_uv_next_iface) .smooth(Type::FLOAT, "selectionFac") .flat(Type::VEC2, "stippleStart") .no_perspective(Type::FLOAT, "edgeCoord") @@ -418,7 +419,7 @@ GPU_SHADER_CREATE_INFO(overlay_edit_uv_face_dots) .fragment_source("overlay_varying_color.glsl") .additional_info("draw_mesh", "draw_globals"); -GPU_SHADER_INTERFACE_INFO(overlay_edit_uv_vert_iface, "") +GPU_SHADER_INTERFACE_INFO(overlay_edit_uv_vert_iface) .smooth(Type::VEC4, "fillColor") .smooth(Type::VEC4, "outlineColor") .smooth(Type::VEC4, "radii"); @@ -445,7 +446,7 @@ GPU_SHADER_CREATE_INFO(overlay_edit_uv_tiled_image_borders) .fragment_source("overlay_uniform_color_frag.glsl") .additional_info("draw_mesh"); -GPU_SHADER_INTERFACE_INFO(edit_uv_image_iface, "").smooth(Type::VEC2, "uvs"); +GPU_SHADER_INTERFACE_INFO(edit_uv_image_iface).smooth(Type::VEC2, "uvs"); GPU_SHADER_CREATE_INFO(overlay_edit_uv_stencil_image) .do_static_compilation(true) @@ -507,7 +508,7 @@ GPU_SHADER_CREATE_INFO(overlay_edit_uv_stretching_angle) /** \name Edit Curve * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_edit_curve_handle_iface, "vert").flat(Type::UINT, "flag"); +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_curve_handle_iface, vert).flat(Type::UINT, "flag"); GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle) .do_static_compilation(true) @@ -635,7 +636,7 @@ GPU_SHADER_CREATE_INFO(overlay_edit_curve_normals) /** \name Edit Curves * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_edit_curves_handle_iface, "") +GPU_SHADER_INTERFACE_INFO(overlay_edit_curves_handle_iface) .smooth(Type::VEC4, "finalColor") .smooth(Type::VEC4, "leftColor"); @@ -832,11 +833,11 @@ GPU_SHADER_CREATE_INFO(overlay_depth_mesh_conservative) "gpu_index_load", "draw_resource_handle_new"); -GPU_SHADER_INTERFACE_INFO(overlay_depth_only_gpencil_flat_iface, "gp_interp_flat") +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_depth_only_gpencil_flat_iface, gp_interp_flat) .flat(Type::VEC2, "aspect") .flat(Type::VEC4, "sspos"); -GPU_SHADER_INTERFACE_INFO(overlay_depth_only_gpencil_noperspective_iface, - "gp_interp_noperspective") +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_depth_only_gpencil_noperspective_iface, + gp_interp_noperspective) .no_perspective(Type::VEC2, "thickness") .no_perspective(Type::FLOAT, "hardness"); diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_extra_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_extra_info.hh index dfbba926343..234e1a27083 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_extra_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_extra_info.hh @@ -8,7 +8,7 @@ /** \name Extra shapes * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_extra_iface, "") +GPU_SHADER_INTERFACE_INFO(overlay_extra_iface) .no_perspective(Type::VEC2, "edgePos") .flat(Type::VEC2, "edgeStart") .flat(Type::VEC4, "finalColor"); @@ -47,7 +47,7 @@ GPU_SHADER_CREATE_INFO(overlay_extra_select_clipped) /** \name Irradiance Grid * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_extra_grid_iface, "").flat(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_extra_grid_iface).flat(Type::VEC4, "finalColor"); GPU_SHADER_CREATE_INFO(overlay_extra_grid) .do_static_compilation(true) @@ -92,7 +92,7 @@ GPU_SHADER_CREATE_INFO(overlay_extra_groundline_clipped) /** \name Extra wires * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_extra_wire_iface, "") +GPU_SHADER_INTERFACE_INFO(overlay_extra_wire_iface) .no_perspective(Type::VEC2, "stipple_coord") .flat(Type::VEC2, "stipple_start") .flat(Type::VEC4, "finalColor"); @@ -138,7 +138,7 @@ GPU_SHADER_CREATE_INFO(overlay_extra_wire_clipped) /** \name Extra points * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_extra_point_iface, "") +GPU_SHADER_INTERFACE_INFO(overlay_extra_point_iface) .flat(Type::VEC4, "radii") .flat(Type::VEC4, "fillColor") .flat(Type::VEC4, "outlineColor"); @@ -159,7 +159,7 @@ GPU_SHADER_CREATE_INFO(overlay_extra_point_clipped) .do_static_compilation(true) .additional_info("overlay_extra_point", "drw_clipped"); -GPU_SHADER_INTERFACE_INFO(overlay_extra_loose_point_iface, "").smooth(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_extra_loose_point_iface).smooth(Type::VEC4, "finalColor"); GPU_SHADER_CREATE_INFO(overlay_extra_loose_point) .do_static_compilation(true) @@ -182,8 +182,9 @@ GPU_SHADER_CREATE_INFO(overlay_extra_loose_point_clipped) /** \name Motion Path * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_motion_path_line_iface, "interp").smooth(Type::VEC4, "color"); -GPU_SHADER_INTERFACE_INFO(overlay_motion_path_line_flat_iface, "interp_flat") +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_motion_path_line_iface, interp) + .smooth(Type::VEC4, "color"); +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_motion_path_line_flat_iface, interp_flat) .flat(Type::VEC2, "ss_pos"); GPU_SHADER_CREATE_INFO(overlay_motion_path_line) @@ -245,7 +246,7 @@ GPU_SHADER_CREATE_INFO(overlay_motion_path_line_clipped_no_geom) .do_static_compilation(true) .additional_info("overlay_motion_path_line_no_geom", "drw_clipped"); -GPU_SHADER_INTERFACE_INFO(overlay_motion_path_point_iface, "").flat(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_motion_path_point_iface).flat(Type::VEC4, "finalColor"); GPU_SHADER_CREATE_INFO(overlay_motion_path_point) .do_static_compilation(true) @@ -273,7 +274,7 @@ GPU_SHADER_CREATE_INFO(overlay_motion_path_point_clipped) /** \name Image Empty * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_image_iface, "").smooth(Type::VEC2, "uvs"); +GPU_SHADER_INTERFACE_INFO(overlay_image_iface).smooth(Type::VEC2, "uvs"); GPU_SHADER_CREATE_INFO(overlay_image) .do_static_compilation(true) @@ -324,7 +325,7 @@ GPU_SHADER_CREATE_INFO(overlay_gpencil_canvas_clipped) /** \name Particle * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_particle_iface, "").flat(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_particle_iface).flat(Type::VEC4, "finalColor"); GPU_SHADER_CREATE_INFO(overlay_particle) .sampler(0, ImageType::FLOAT_1D, "weightTex") diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_grid_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_grid_info.hh index ad85f5ceccb..1497bf1ffaa 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_grid_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_grid_info.hh @@ -5,7 +5,7 @@ #include "gpu_shader_create_info.hh" /* We use the normalized local position to avoid precision loss during interpolation. */ -GPU_SHADER_INTERFACE_INFO(overlay_grid_iface, "").smooth(Type::VEC3, "local_pos"); +GPU_SHADER_INTERFACE_INFO(overlay_grid_iface).smooth(Type::VEC3, "local_pos"); GPU_SHADER_CREATE_INFO(overlay_grid) .do_static_compilation(true) diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_outline_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_outline_info.hh index f064727b569..b57f2899653 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_outline_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_outline_info.hh @@ -8,7 +8,7 @@ /** \name Outline Pre-pass * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_outline_prepass_iface, "interp").flat(Type::UINT, "ob_id"); +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_iface, interp).flat(Type::UINT, "ob_id"); GPU_SHADER_CREATE_INFO(overlay_outline_prepass) .push_constant(Type::BOOL, "isTransform") @@ -29,7 +29,7 @@ GPU_SHADER_CREATE_INFO(overlay_outline_prepass_mesh_clipped) .do_static_compilation(true) .additional_info("overlay_outline_prepass_mesh", "drw_clipped"); -GPU_SHADER_INTERFACE_INFO(overlay_outline_prepass_wire_iface, "vert").flat(Type::VEC3, "pos"); +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_wire_iface, vert).flat(Type::VEC3, "pos"); GPU_SHADER_CREATE_INFO(overlay_outline_prepass_curves) .do_static_compilation(true) @@ -81,11 +81,11 @@ GPU_SHADER_CREATE_INFO(overlay_outline_prepass_wire_clipped) .do_static_compilation(true) .additional_info("overlay_outline_prepass_wire", "drw_clipped"); -GPU_SHADER_INTERFACE_INFO(overlay_outline_prepass_gpencil_flat_iface, "gp_interp_flat") +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_gpencil_flat_iface, gp_interp_flat) .flat(Type::VEC2, "aspect") .flat(Type::VEC4, "sspos"); -GPU_SHADER_INTERFACE_INFO(overlay_outline_prepass_gpencil_noperspective_iface, - "gp_interp_noperspective") +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_gpencil_noperspective_iface, + gp_interp_noperspective) .no_perspective(Type::VEC2, "thickness") .no_perspective(Type::FLOAT, "hardness"); diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_paint_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_paint_info.hh index 37d882c44ba..1700a2fe0b2 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_paint_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_paint_info.hh @@ -33,7 +33,7 @@ GPU_SHADER_CREATE_INFO(overlay_paint_face_clipped) * Used for vertex selection mode in Weight and Vertex Paint. * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_overlay_paint_point_iface, "").smooth(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_overlay_paint_point_iface).smooth(Type::VEC4, "finalColor"); GPU_SHADER_CREATE_INFO(overlay_paint_point) .do_static_compilation(true) @@ -58,7 +58,7 @@ GPU_SHADER_CREATE_INFO(overlay_paint_point_clipped) * Used in Texture Paint mode for the Stencil Image Masking. * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_paint_texture_iface, "").smooth(Type::VEC2, "uv_interp"); +GPU_SHADER_INTERFACE_INFO(overlay_paint_texture_iface).smooth(Type::VEC2, "uv_interp"); GPU_SHADER_CREATE_INFO(overlay_paint_texture) .do_static_compilation(true) @@ -88,7 +88,7 @@ GPU_SHADER_CREATE_INFO(overlay_paint_texture_clipped) * It should be used to draw a Vertex Paint overlay. But it is currently unreachable. * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_paint_vertcol_iface, "").smooth(Type::VEC3, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_paint_vertcol_iface).smooth(Type::VEC3, "finalColor"); GPU_SHADER_CREATE_INFO(overlay_paint_vertcol) .do_static_compilation(true) @@ -116,7 +116,7 @@ GPU_SHADER_CREATE_INFO(overlay_paint_vertcol_clipped) * `overlay paint weight` is for wireframe display mode. * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_paint_weight_iface, "") +GPU_SHADER_INTERFACE_INFO(overlay_paint_weight_iface) .smooth(Type::VEC2, "weight_interp") /* (weight, alert) */ .smooth(Type::FLOAT, "color_fac"); @@ -159,7 +159,7 @@ GPU_SHADER_CREATE_INFO(overlay_paint_weight_fake_shading_clipped) * paint modes. * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_paint_wire_iface, "").flat(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_paint_wire_iface).flat(Type::VEC4, "finalColor"); GPU_SHADER_CREATE_INFO(overlay_paint_wire) .do_static_compilation(true) diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_curves_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_curves_info.hh index 55758b3c410..c355748b72a 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_curves_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_curves_info.hh @@ -4,7 +4,7 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(overlay_sculpt_curves_selection_iface, "") +GPU_SHADER_INTERFACE_INFO(overlay_sculpt_curves_selection_iface) .smooth(Type::FLOAT, "mask_weight"); GPU_SHADER_CREATE_INFO(overlay_sculpt_curves_selection) @@ -22,7 +22,7 @@ GPU_SHADER_CREATE_INFO(overlay_sculpt_curves_selection_clipped) .do_static_compilation(true) .additional_info("overlay_sculpt_curves_selection", "drw_clipped"); -GPU_SHADER_INTERFACE_INFO(overlay_sculpt_curves_cage_iface, "") +GPU_SHADER_INTERFACE_INFO(overlay_sculpt_curves_cage_iface) .no_perspective(Type::VEC2, "edgePos") .flat(Type::VEC2, "edgeStart") .smooth(Type::VEC4, "finalColor"); diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_info.hh index 4767563265d..8c48c07dbc5 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_info.hh @@ -4,7 +4,7 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(overlay_sculpt_mask_iface, "") +GPU_SHADER_INTERFACE_INFO(overlay_sculpt_mask_iface) .flat(Type::VEC3, "faceset_color") .smooth(Type::FLOAT, "mask_color") .smooth(Type::VEC4, "finalColor"); diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_viewer_attribute_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_viewer_attribute_info.hh index 14b45ab1953..7216a8add28 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_viewer_attribute_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_viewer_attribute_info.hh @@ -4,7 +4,7 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(overlay_viewer_attribute_iface, "").smooth(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_viewer_attribute_iface).smooth(Type::VEC4, "finalColor"); GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_common).push_constant(Type::FLOAT, "opacity"); diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_volume_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_volume_info.hh index f368ce00318..b3f1000034f 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_volume_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_volume_info.hh @@ -8,7 +8,7 @@ /** \name Volume Velocity * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_volume_velocity_iface, "").smooth(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_volume_velocity_iface).smooth(Type::VEC4, "finalColor"); GPU_SHADER_CREATE_INFO(overlay_volume_velocity) .sampler(0, ImageType::FLOAT_3D, "velocityX") @@ -54,7 +54,7 @@ GPU_SHADER_CREATE_INFO(overlay_volume_velocity_needle) /** \name Volume Grid-Lines * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_volume_gridlines_iface, "").flat(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_volume_gridlines_iface).flat(Type::VEC4, "finalColor"); GPU_SHADER_CREATE_INFO(overlay_volume_gridlines) .push_constant(Type::FLOAT, "slicePosition") diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_wireframe_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_wireframe_info.hh index 62732a05730..648e0967f07 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_wireframe_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_wireframe_info.hh @@ -4,7 +4,7 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(overlay_wireframe_iface, "") +GPU_SHADER_INTERFACE_INFO(overlay_wireframe_iface) .smooth(Type::VEC4, "finalColor") .flat(Type::VEC2, "edgeStart") .no_perspective(Type::VEC2, "edgePos"); @@ -50,7 +50,7 @@ GPU_SHADER_CREATE_INFO(overlay_wireframe_curve) "draw_object_infos_new", "draw_globals"); -GPU_SHADER_INTERFACE_INFO(overlay_wireframe_points_iface, "") +GPU_SHADER_INTERFACE_INFO(overlay_wireframe_points_iface) .flat(Type::VEC4, "finalColor") .flat(Type::VEC4, "finalColorInner"); diff --git a/source/blender/draw/engines/select/shaders/infos/select_id_info.hh b/source/blender/draw/engines/select/shaders/infos/select_id_info.hh index c90167d9727..b3fc907e509 100644 --- a/source/blender/draw/engines/select/shaders/infos/select_id_info.hh +++ b/source/blender/draw/engines/select/shaders/infos/select_id_info.hh @@ -9,7 +9,7 @@ /** \name Select ID for Edit Mesh Selection * \{ */ -GPU_SHADER_INTERFACE_INFO(select_id_iface, "").flat(Type::INT, "select_id"); +GPU_SHADER_INTERFACE_INFO(select_id_iface).flat(Type::INT, "select_id"); GPU_SHADER_CREATE_INFO(select_id_flat) .push_constant(Type::FLOAT, "sizeVertex") diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_antialiasing_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_antialiasing_info.hh index 54cf7d85535..345f766e302 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_antialiasing_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_antialiasing_info.hh @@ -22,7 +22,7 @@ GPU_SHADER_CREATE_INFO(workbench_taa) /** \name SMAA * \{ */ -GPU_SHADER_INTERFACE_INFO(workbench_smaa_iface, "") +GPU_SHADER_INTERFACE_INFO(workbench_smaa_iface) .smooth(Type::VEC2, "uvs") .smooth(Type::VEC2, "pixcoord") .smooth(Type::VEC4, "offset[3]"); diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_prepass_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_prepass_info.hh index c4408a37264..a70462c27bf 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_prepass_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_prepass_info.hh @@ -50,7 +50,7 @@ GPU_SHADER_CREATE_INFO(workbench_lighting_matcap) /** \name Material Interface * \{ */ -GPU_SHADER_INTERFACE_INFO(workbench_material_iface, "") +GPU_SHADER_INTERFACE_INFO(workbench_material_iface) .smooth(Type::VEC3, "normal_interp") .smooth(Type::VEC3, "color_interp") .smooth(Type::FLOAT, "alpha_interp") diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_volume_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_volume_info.hh index bf367c9828b..a383f2734be 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_volume_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_volume_info.hh @@ -85,7 +85,7 @@ GPU_SHADER_CREATE_INFO(workbench_volume_closest).define("USE_CLOSEST"); /** \name Slice variation * \{ */ -GPU_SHADER_INTERFACE_INFO(workbench_volume_iface, "").smooth(Type::VEC3, "localPos"); +GPU_SHADER_INTERFACE_INFO(workbench_volume_iface).smooth(Type::VEC3, "localPos"); GPU_SHADER_CREATE_INFO(workbench_volume_slice) .define("VOLUME_SLICE") diff --git a/source/blender/draw/intern/shaders/draw_debug_info.hh b/source/blender/draw/intern/shaders/draw_debug_info.hh index 64684c770f1..0121365d957 100644 --- a/source/blender/draw/intern/shaders/draw_debug_info.hh +++ b/source/blender/draw/intern/shaders/draw_debug_info.hh @@ -16,7 +16,7 @@ GPU_SHADER_CREATE_INFO(draw_debug_print) .typedef_source("draw_shader_shared.hh") .storage_buf(DRW_DEBUG_PRINT_SLOT, Qualifier::READ_WRITE, "uint", "drw_debug_print_buf[]"); -GPU_SHADER_INTERFACE_INFO(draw_debug_print_display_iface, "").flat(Type::UINT, "char_index"); +GPU_SHADER_INTERFACE_INFO(draw_debug_print_display_iface).flat(Type::UINT, "char_index"); GPU_SHADER_CREATE_INFO(draw_debug_print_display) .do_static_compilation(true) @@ -44,7 +44,7 @@ GPU_SHADER_CREATE_INFO(draw_debug_draw) "DRWDebugVert", "drw_debug_verts_buf[]"); -GPU_SHADER_INTERFACE_INFO(draw_debug_draw_display_iface, "interp").flat(Type::VEC4, "color"); +GPU_SHADER_NAMED_INTERFACE_INFO(draw_debug_draw_display_iface, interp).flat(Type::VEC4, "color"); GPU_SHADER_CREATE_INFO(draw_debug_draw_display) .do_static_compilation(true) diff --git a/source/blender/draw/intern/shaders/draw_fullscreen_info.hh b/source/blender/draw/intern/shaders/draw_fullscreen_info.hh index a78192b568e..09d92f5194d 100644 --- a/source/blender/draw/intern/shaders/draw_fullscreen_info.hh +++ b/source/blender/draw/intern/shaders/draw_fullscreen_info.hh @@ -4,7 +4,7 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(fullscreen_iface, "").smooth(Type::VEC4, "uvcoordsvar"); +GPU_SHADER_INTERFACE_INFO(fullscreen_iface).smooth(Type::VEC4, "uvcoordsvar"); GPU_SHADER_CREATE_INFO(draw_fullscreen) .vertex_out(fullscreen_iface) diff --git a/source/blender/draw/intern/shaders/draw_view_info.hh b/source/blender/draw/intern/shaders/draw_view_info.hh index ac9a5e5c696..feca38ac8a5 100644 --- a/source/blender/draw/intern/shaders/draw_view_info.hh +++ b/source/blender/draw/intern/shaders/draw_view_info.hh @@ -20,7 +20,7 @@ GPU_SHADER_CREATE_INFO(draw_resource_id).define("DYNAMIC_RESOURCE_ID"); * Used if the resource index needs to be passed to the fragment shader. * IMPORTANT: Vertex and Geometry shaders need to use PASS_RESOURCE_ID in main(). */ -GPU_SHADER_INTERFACE_INFO(draw_resource_id_iface, "drw_ResourceID_iface") +GPU_SHADER_NAMED_INTERFACE_INFO(draw_resource_id_iface, drw_ResourceID_iface) .flat(Type::INT, "resource_index"); GPU_SHADER_CREATE_INFO(draw_resource_id_varying) diff --git a/source/blender/gpu/metal/kernels/depth_2d_update_info.hh b/source/blender/gpu/metal/kernels/depth_2d_update_info.hh index 48c46a24e2c..e17284fb33e 100644 --- a/source/blender/gpu/metal/kernels/depth_2d_update_info.hh +++ b/source/blender/gpu/metal/kernels/depth_2d_update_info.hh @@ -8,7 +8,7 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(depth_2d_update_iface, "").smooth(Type::VEC2, "texCoord_interp"); +GPU_SHADER_INTERFACE_INFO(depth_2d_update_iface).smooth(Type::VEC2, "texCoord_interp"); GPU_SHADER_CREATE_INFO(depth_2d_update_info_base) .vertex_in(0, Type::VEC2, "pos") diff --git a/source/blender/gpu/metal/kernels/gpu_shader_fullscreen_blit_info.hh b/source/blender/gpu/metal/kernels/gpu_shader_fullscreen_blit_info.hh index b2ce0bf34e8..fd8ba987adf 100644 --- a/source/blender/gpu/metal/kernels/gpu_shader_fullscreen_blit_info.hh +++ b/source/blender/gpu/metal/kernels/gpu_shader_fullscreen_blit_info.hh @@ -8,7 +8,7 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(fullscreen_blit_iface, "").smooth(Type::VEC4, "uvcoordsvar"); +GPU_SHADER_INTERFACE_INFO(fullscreen_blit_iface).smooth(Type::VEC4, "uvcoordsvar"); GPU_SHADER_CREATE_INFO(fullscreen_blit) .vertex_in(0, Type::VEC2, "pos") diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_area_borders_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_area_borders_info.hh index 2e8c30ba2d2..cf8d9890a3a 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_area_borders_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_area_borders_info.hh @@ -8,7 +8,7 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(smooth_uv_iface, "").smooth(Type::VEC2, "uv"); +GPU_SHADER_INTERFACE_INFO(smooth_uv_iface).smooth(Type::VEC2, "uv"); GPU_SHADER_CREATE_INFO(gpu_shader_2D_area_borders) .vertex_in(0, Type::VEC2, "pos") diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_nodelink_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_nodelink_info.hh index 4b434d4edc2..b9b0eb9f9a4 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_nodelink_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_nodelink_info.hh @@ -8,7 +8,7 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(nodelink_iface, "") +GPU_SHADER_INTERFACE_INFO(nodelink_iface) .smooth(Type::VEC4, "finalColor") .smooth(Type::VEC2, "lineUV") .flat(Type::FLOAT, "lineLength") diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_widget_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_widget_info.hh index b7cd0419807..bf5bd6d8d9f 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_widget_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_widget_info.hh @@ -9,7 +9,7 @@ #include "gpu_interface_info.hh" #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(gpu_widget_iface, "") +GPU_SHADER_INTERFACE_INFO(gpu_widget_iface) .flat(Type::FLOAT, "discardFac") .flat(Type::FLOAT, "lineWidth") .flat(Type::VEC2, "outRectSize") @@ -49,7 +49,7 @@ GPU_SHADER_CREATE_INFO(gpu_shader_2D_widget_base_inst) .push_constant(Type::VEC4, "parameters", (MAX_PARAM * MAX_INSTANCE)) .additional_info("gpu_shader_2D_widget_shared"); -GPU_SHADER_INTERFACE_INFO(gpu_widget_shadow_iface, "") +GPU_SHADER_INTERFACE_INFO(gpu_widget_shadow_iface) .smooth(Type::FLOAT, "shadowFalloff") .smooth(Type::FLOAT, "innerMask"); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_3D_polyline_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_3D_polyline_info.hh index 4e80ccfde2f..bd219140ce0 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_3D_polyline_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_3D_polyline_info.hh @@ -9,11 +9,11 @@ #include "gpu_interface_info.hh" #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(gpu_shader_3D_polyline_iface, "interp") +GPU_SHADER_NAMED_INTERFACE_INFO(gpu_shader_3D_polyline_iface, interp) .smooth(Type::VEC4, "final_color") .smooth(Type::FLOAT, "clip"); -GPU_SHADER_INTERFACE_INFO(gpu_shader_3D_polyline_noperspective_iface, "interp_noperspective") +GPU_SHADER_NAMED_INTERFACE_INFO(gpu_shader_3D_polyline_noperspective_iface, interp_noperspective) .no_perspective(Type::FLOAT, "smoothline"); GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline) diff --git a/source/blender/gpu/shaders/infos/gpu_shader_gpencil_stroke_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_gpencil_stroke_info.hh index 9e922b857f6..74d8954e2b7 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_gpencil_stroke_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_gpencil_stroke_info.hh @@ -8,10 +8,10 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(gpencil_stroke_vert_iface, "geometry_in") +GPU_SHADER_NAMED_INTERFACE_INFO(gpencil_stroke_vert_iface, geometry_in) .smooth(Type::VEC4, "finalColor") .smooth(Type::FLOAT, "finalThickness"); -GPU_SHADER_INTERFACE_INFO(gpencil_stroke_geom_iface, "geometry_out") +GPU_SHADER_NAMED_INTERFACE_INFO(gpencil_stroke_geom_iface, geometry_out) .smooth(Type::VEC4, "mColor") .smooth(Type::VEC2, "mTexCoord"); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_keyframe_shape_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_keyframe_shape_info.hh index 96280efab44..ccb188d5e83 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_keyframe_shape_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_keyframe_shape_info.hh @@ -8,7 +8,7 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(keyframe_shape_iface, "") +GPU_SHADER_INTERFACE_INFO(keyframe_shape_iface) .flat(Type::VEC4, "finalColor") .flat(Type::VEC4, "finalOutlineColor") .flat(Type::VEC4, "radii") diff --git a/source/blender/gpu/shaders/infos/gpu_shader_line_dashed_uniform_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_line_dashed_uniform_color_info.hh index 4909e36e1cc..0d4535f0146 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_line_dashed_uniform_color_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_line_dashed_uniform_color_info.hh @@ -10,7 +10,7 @@ #include "gpu_shader_create_info.hh" /* We leverage hardware interpolation to compute distance along the line. */ -GPU_SHADER_INTERFACE_INFO(gpu_shader_line_dashed_interface, "") +GPU_SHADER_INTERFACE_INFO(gpu_shader_line_dashed_interface) .no_perspective(Type::VEC2, "stipple_start") /* In screen space */ .flat(Type::VEC2, "stipple_pos"); /* In screen space */ diff --git a/source/blender/gpu/shaders/infos/gpu_shader_sequencer_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_sequencer_info.hh index ae3f5616123..f18b1807f61 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_sequencer_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_sequencer_info.hh @@ -9,7 +9,7 @@ #include "gpu_interface_info.hh" #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(gpu_seq_strip_iface, "") +GPU_SHADER_INTERFACE_INFO(gpu_seq_strip_iface) .no_perspective(Type::VEC2, "co_interp") .flat(Type::UINT, "strip_id"); @@ -24,7 +24,7 @@ GPU_SHADER_CREATE_INFO(gpu_shader_sequencer_strips) .fragment_source("gpu_shader_sequencer_strips_frag.glsl") .do_static_compilation(true); -GPU_SHADER_INTERFACE_INFO(gpu_seq_thumb_iface, "") +GPU_SHADER_INTERFACE_INFO(gpu_seq_thumb_iface) .no_perspective(Type::VEC2, "pos_interp") .no_perspective(Type::VEC2, "texCoord_interp") .flat(Type::UINT, "thumb_id"); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_simple_lighting_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_simple_lighting_info.hh index 403f4f79ab1..2bc349f4b23 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_simple_lighting_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_simple_lighting_info.hh @@ -8,7 +8,7 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(smooth_normal_iface, "").smooth(Type::VEC3, "normal"); +GPU_SHADER_INTERFACE_INFO(smooth_normal_iface).smooth(Type::VEC3, "normal"); GPU_SHADER_CREATE_INFO(gpu_shader_simple_lighting) .vertex_in(0, Type::VEC3, "pos") diff --git a/source/blender/gpu/shaders/infos/gpu_shader_text_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_text_info.hh index b12d5000c87..cb2b8636f9e 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_text_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_text_info.hh @@ -8,7 +8,7 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(text_iface, "") +GPU_SHADER_INTERFACE_INFO(text_iface) .flat(Type::VEC4, "color_flat") .no_perspective(Type::VEC2, "texCoord_interp") .flat(Type::INT, "glyph_offset") -- 2.30.2 From 5554ffd998defdb3d0ff32d1949110eca61408d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Tue, 24 Sep 2024 23:28:55 +0200 Subject: [PATCH 43/90] Fix macros and make it compile --- .../gpu/intern/gpu_shader_create_info.cc | 11 ++++- .../gpu/intern/gpu_shader_create_info.hh | 43 +++++++++---------- 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/source/blender/gpu/intern/gpu_shader_create_info.cc b/source/blender/gpu/intern/gpu_shader_create_info.cc index 7e7e71348d3..7ad3156282a 100644 --- a/source/blender/gpu/intern/gpu_shader_create_info.cc +++ b/source/blender/gpu/intern/gpu_shader_create_info.cc @@ -24,6 +24,7 @@ #include "gpu_shader_create_info_private.hh" #include "gpu_shader_dependency_private.hh" +#undef GPU_SHADER_NAMED_INTERFACE_INFO #undef GPU_SHADER_INTERFACE_INFO #undef GPU_SHADER_CREATE_INFO @@ -446,8 +447,14 @@ void gpu_shader_create_info_init() g_create_infos = new CreateInfoDictionnary(); g_interfaces = new InterfaceDictionnary(); -#define GPU_SHADER_INTERFACE_INFO(_interface, _inst_name) \ - StageInterfaceInfo *ptr_##_interface = new StageInterfaceInfo(#_interface, _inst_name); \ +#define GPU_SHADER_NAMED_INTERFACE_INFO(_interface, _inst_name) \ + StageInterfaceInfo *ptr_##_interface = new StageInterfaceInfo(#_interface, #_inst_name); \ + StageInterfaceInfo &_interface = *ptr_##_interface; \ + g_interfaces->add_new(#_interface, ptr_##_interface); \ + _interface + +#define GPU_SHADER_INTERFACE_INFO(_interface) \ + StageInterfaceInfo *ptr_##_interface = new StageInterfaceInfo(#_interface); \ StageInterfaceInfo &_interface = *ptr_##_interface; \ g_interfaces->add_new(#_interface, ptr_##_interface); \ _interface diff --git a/source/blender/gpu/intern/gpu_shader_create_info.hh b/source/blender/gpu/intern/gpu_shader_create_info.hh index a2aad59b0f5..c09edd927e3 100644 --- a/source/blender/gpu/intern/gpu_shader_create_info.hh +++ b/source/blender/gpu/intern/gpu_shader_create_info.hh @@ -39,6 +39,7 @@ namespace blender::gpu::shader { #if defined(GLSL_CPP_STUBS) +# error # define GPU_SHADER_NAMED_INTERFACE_INFO(_interface, _inst_name) \ namespace _interface { \ struct { @@ -74,54 +75,52 @@ namespace blender::gpu::shader { #endif #ifndef GLSL_CPP_STUBS -# define SMOOTH(type, name) .smooth(type, name) -# define FLAT(type, name) .flat(type, name) -# define NO_PERSPECTIVE(type, name) .no_perspective(type, name) +# define SMOOTH(type, name) .smooth(Type::type, #name) +# define FLAT(type, name) .flat(Type::type, #name) +# define NO_PERSPECTIVE(type, name) .no_perspective(Type::type, #name) /* LOCAL_GROUP_SIZE(int size_x, int size_y = -1, int size_z = -1) */ # define LOCAL_GROUP_SIZE(...) .local_group_size(__VA_ARGS__) -# define VERTEX_IN(slot, type, name) .vertex_in(slot, Type::##type, #name) +# define VERTEX_IN(slot, type, name) .vertex_in(slot, Type::type, #name) # define VERTEX_OUT(stage_interface) .vertex_out(stage_interface) /* TO REMOVE. */ # define GEOMETRY_LAYOUT(...) .geometry_layout(__VA_ARGS__) # define GEOMETRY_OUT(stage_interface) .geometry_out(stage_interface) -# define SUBPASS_IN(slot, type, name, rog) .subpass_in(slot, Type::##type, #name, rog) +# define SUBPASS_IN(slot, type, name, rog) .subpass_in(slot, Type::type, #name, rog) -# define FRAGMENT_OUT(slot, type, name) .fragment_out(slot, Type::##type, #name) -# define FRAGMENT_OUT_DUAL(slot, type, name, blend) \ - .fragment_out(slot, Type::##type, #name, blend) +# define FRAGMENT_OUT(slot, type, name) .fragment_out(slot, Type::type, #name) +# define FRAGMENT_OUT_DUAL(slot, type, name, blend) .fragment_out(slot, Type::type, #name, blend) # define FRAGMENT_OUT_ROG(slot, type, name, rog) \ - .fragment_out(slot, Type::##type, #name, DualBlend::NONE, rog) + .fragment_out(slot, Type::type, #name, DualBlend::NONE, rog) # define EARLY_FRAGMENT_TEST(enable) .early_fragment_test(enable) # define DEPTH_WRITE(value) .depth_write(value) # define SPECIALIZATION_CONSTANT(type, name, default_value) \ - .specialization_constant(Type::##type, #name, default_value) + .specialization_constant(Type::type, #name, default_value) -# define PUSH_CONSTANT(type, name) .push_constant(Type::##type, #name) -# define PUSH_CONSTANT_ARRAY(type, name, array_size) \ - .push_constant(Type::##type, #name, array_size) +# define PUSH_CONSTANT(type, name) .push_constant(Type::type, #name) +# define PUSH_CONSTANT_ARRAY(type, name, array_size) .push_constant(Type::type, #name, array_size) -# define UNIFORM_BUF(slot, type_name, name, freq) .uniform_buf(slot, #type_name, #name) +# define UNIFORM_BUF(slot, type_name, name) .uniform_buf(slot, #type_name, #name) # define UNIFORM_BUF_FREQ(slot, type_name, name, freq) \ - .uniform_buf(slot, #type_name, #name, Frequency::##freq) + .uniform_buf(slot, #type_name, #name, Frequency::freq) # define STORAGE_BUF(slot, qualifiers, type_name, name) \ - .storage_buf(slot, Qualifier::##qualifiers, #type_name, #name, freq) + .storage_buf(slot, Qualifier::qualifiers, #type_name, #name, freq) # define STORAGE_BUF_FREQ(slot, qualifiers, type_name, name, freq) \ - .storage_buf(slot, Qualifier::##qualifiers, #type_name, #name, Frequency::##freq) + .storage_buf(slot, Qualifier::qualifiers, #type_name, #name, Frequency::freq) -# define SAMPLER(slot, type, name) .sampler(slot, ImageType::##type, #name) +# define SAMPLER(slot, type, name) .sampler(slot, ImageType::type, #name) # define SAMPLER_FREQ(slot, type, name, freq) \ - .sampler(slot, ImageType::##type, #name, Frequency::##freq) + .sampler(slot, ImageType::type, #name, Frequency::freq) # define IMAGE(slot, format, qualifiers, type, name) \ - .image(slot, format, Qualifier::##qualifiers, ImageType::##type, #name) + .image(slot, format, Qualifier::qualifiers, ImageType::type, #name) # define IMAGE_FREQ(slot, format, qualifiers, type, name, freq) \ - .image(slot, format, Qualifier::##qualifiers, ImageType::##type, #name, Frequency::##freq) + .image(slot, format, Qualifier::qualifiers, ImageType::type, #name, Frequency::freq) # define BUILTINS(builtin) .builtins(builtin) @@ -211,7 +210,7 @@ namespace blender::gpu::shader { # define PUSH_CONSTANT(type, name) const type name = {}; # define PUSH_CONSTANT_ARRAY(type, name, array_size) const type name[array_size] = {}; -# define UNIFORM_BUF(slot, type_name, name, freq) const type_name name; +# define UNIFORM_BUF(slot, type_name, name) const type_name name; # define UNIFORM_BUF_FREQ(slot, type_name, name, freq) const type_name name; # define STORAGE_BUF(slot, qualifiers, type_name, name) qualifiers type_name name; -- 2.30.2 From 360970121df60a2f9052cf4e6e734fc4dfb3e0d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Wed, 25 Sep 2024 12:29:36 +0200 Subject: [PATCH 44/90] Use namespaces for different interfaces --- .../gpu/intern/gpu_shader_create_info.hh | 33 ++++++++++++++++--- .../gpu/shaders/gpu_shader_icon_frag.glsl | 7 ++++ .../gpu/shaders/gpu_shader_icon_vert.glsl | 2 +- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/source/blender/gpu/intern/gpu_shader_create_info.hh b/source/blender/gpu/intern/gpu_shader_create_info.hh index c09edd927e3..4b7068418b2 100644 --- a/source/blender/gpu/intern/gpu_shader_create_info.hh +++ b/source/blender/gpu/intern/gpu_shader_create_info.hh @@ -54,7 +54,18 @@ namespace blender::gpu::shader { # define GPU_SHADER_CREATE_INFO(_info) namespace _info { # define GPU_SHADER_CREATE_END() } -# define USE_CREATE_INFO(_info) using namespace _info; +# define VERTEX_SHADER_CREATE_INFO(_info) \ + using namespace gl_VertexShader; \ + using namespace _info::gl_VertexShader; \ + using namespace _info; +# define FRAGMENT_SHADER_CREATE_INFO(_info) \ + using namespace gl_FragmentShader; \ + using namespace _info::gl_FragmentShader; \ + using namespace _info; +# define COMPUTE_SHADER_CREATE_INFO(_info) \ + using namespace gl_ComputeShader; \ + using namespace _info::gl_ComputeShader; \ + using namespace _info; #elif !defined(GPU_SHADER_CREATE_INFO) /* Helps intellisense / auto-completion inside info files. */ @@ -190,7 +201,10 @@ namespace blender::gpu::shader { /* LOCAL_GROUP_SIZE(int size_x, int size_y = -1, int size_z = -1) */ # define LOCAL_GROUP_SIZE(...) -# define VERTEX_IN(slot, type, name) const type name = {}; +# define VERTEX_IN(slot, type, name) \ + namespace gl_VertexShader { \ + const type name = {}; \ + } # define VERTEX_OUT(stage_interface) using namespace stage_interface; /* TO REMOVE. */ # define GEOMETRY_LAYOUT(...) @@ -198,9 +212,18 @@ namespace blender::gpu::shader { # define SUBPASS_IN(slot, type, name, rog) const type name = {}; -# define FRAGMENT_OUT(slot, type, name) type name; -# define FRAGMENT_OUT_DUAL(slot, type, name, blend) type name; -# define FRAGMENT_OUT_ROG(slot, type, name, rog) type name; +# define FRAGMENT_OUT(slot, type, name) \ + namespace gl_FragmentShader { \ + type name; \ + } +# define FRAGMENT_OUT_DUAL(slot, type, name, blend) \ + namespace gl_FragmentShader { \ + type name; \ + } +# define FRAGMENT_OUT_ROG(slot, type, name, rog) \ + namespace gl_FragmentShader { \ + type name; \ + } # define EARLY_FRAGMENT_TEST(enable) # define DEPTH_WRITE(value) diff --git a/source/blender/gpu/shaders/gpu_shader_icon_frag.glsl b/source/blender/gpu/shaders/gpu_shader_icon_frag.glsl index 1a5c80c8341..3e96598ebe6 100644 --- a/source/blender/gpu/shaders/gpu_shader_icon_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_icon_frag.glsl @@ -10,6 +10,13 @@ * the rounded corner, and the rectangle sides. */ +/* TODO(fclem): Replace with gpu_glsl_cpp_stubs.hh include. */ +#define GLSL_CPP_STUBS + +#include "infos/gpu_shader_icon_info.hh" + +FRAGMENT_SHADER_CREATE_INFO(gpu_shader_icon) + void main() { /* Sample texture with LOD BIAS. Used instead of custom LOD bias in GPU_SAMPLER_CUSTOM_ICON. */ diff --git a/source/blender/gpu/shaders/gpu_shader_icon_vert.glsl b/source/blender/gpu/shaders/gpu_shader_icon_vert.glsl index c17e09611bb..3f64ab85a46 100644 --- a/source/blender/gpu/shaders/gpu_shader_icon_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_icon_vert.glsl @@ -12,7 +12,7 @@ #include "infos/gpu_shader_icon_info.hh" -USE_CREATE_INFO(gpu_shader_icon) +VERTEX_SHADER_CREATE_INFO(gpu_shader_icon) void main() { -- 2.30.2 From 69027ddbd99a8d42ca3016780ae374b631fff643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Thu, 26 Sep 2024 17:53:05 +0200 Subject: [PATCH 45/90] Unroll variadic additional_infos --- .../infos/eevee_ambient_occlusion_info.hh | 12 +- .../shaders/infos/eevee_deferred_info.hh | 92 +++--- .../infos/eevee_depth_of_field_info.hh | 47 ++-- .../shaders/infos/eevee_film_info.hh | 9 +- .../shaders/infos/eevee_hiz_info.hh | 4 +- .../shaders/infos/eevee_light_culling_info.hh | 18 +- .../infos/eevee_lightprobe_sphere_info.hh | 23 +- .../infos/eevee_lightprobe_volume_info.hh | 64 +++-- .../shaders/infos/eevee_material_info.hh | 155 +++++----- .../shaders/infos/eevee_motion_blur_info.hh | 8 +- .../shaders/infos/eevee_shadow_info.hh | 47 ++-- .../shaders/infos/eevee_subsurface_info.hh | 9 +- .../shaders/infos/eevee_tracing_info.hh | 116 ++++---- .../shaders/infos/eevee_volume_info.hh | 12 +- .../gpencil/shaders/infos/gpencil_vfx_info.hh | 24 +- .../infos/overlay_antialiasing_info.hh | 3 +- .../shaders/infos/overlay_armature_info.hh | 96 +++++-- .../shaders/infos/overlay_background_info.hh | 3 +- .../shaders/infos/overlay_edit_mode_info.hh | 264 +++++++++++------- .../shaders/infos/overlay_extra_info.hh | 104 ++++--- .../shaders/infos/overlay_facing_info.hh | 6 +- .../shaders/infos/overlay_grid_info.hh | 3 +- .../shaders/infos/overlay_outline_info.hh | 63 +++-- .../shaders/infos/overlay_paint_info.hh | 9 +- .../infos/overlay_sculpt_curves_info.hh | 13 +- .../shaders/infos/overlay_sculpt_info.hh | 7 +- .../infos/overlay_viewer_attribute_info.hh | 25 +- .../shaders/infos/overlay_volume_info.hh | 18 +- .../shaders/infos/overlay_wireframe_info.hh | 43 +-- .../shaders/infos/workbench_composite_info.hh | 3 +- .../shaders/infos/workbench_prepass_info.hh | 15 +- .../shaders/infos/workbench_shadow_info.hh | 3 +- .../shaders/infos/workbench_volume_info.hh | 10 +- .../draw/intern/shaders/draw_view_info.hh | 37 ++- 34 files changed, 823 insertions(+), 542 deletions(-) diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_ambient_occlusion_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_ambient_occlusion_info.hh index 59f5d9222ed..f64dc5c3bbd 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_ambient_occlusion_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_ambient_occlusion_info.hh @@ -15,10 +15,10 @@ GPU_SHADER_CREATE_INFO(eevee_ambient_occlusion_pass) .push_constant(Type::INT, "out_ao_img_layer_index") .specialization_constant(Type::INT, "ao_slice_count", 2) .specialization_constant(Type::INT, "ao_step_count", 8) - .additional_info("draw_view", - "eevee_shared", - "eevee_hiz_data", - "eevee_sampling_data", - "eevee_utility_texture", - "eevee_global_ubo") + .additional_info("draw_view") + .additional_info("eevee_shared") + .additional_info("eevee_hiz_data") + .additional_info("eevee_sampling_data") + .additional_info("eevee_utility_texture") + .additional_info("eevee_global_ubo") .do_static_compilation(true); diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_deferred_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_deferred_info.hh index 9588e6f5b3b..b1647c786a0 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_deferred_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_deferred_info.hh @@ -26,13 +26,13 @@ GPU_SHADER_CREATE_INFO(eevee_deferred_thickness_amend) /* Early fragment test is needed to discard fragment that do not need this processing. */ .early_fragment_test(true) .fragment_source("eevee_deferred_thickness_amend_frag.glsl") - .additional_info("draw_view", - "draw_fullscreen", - "eevee_sampling_data", - "eevee_shared", - "eevee_light_data", - "eevee_shadow_data", - "eevee_hiz_data"); + .additional_info("draw_view") + .additional_info("draw_fullscreen") + .additional_info("eevee_sampling_data") + .additional_info("eevee_shared") + .additional_info("eevee_light_data") + .additional_info("eevee_shadow_data") + .additional_info("eevee_hiz_data"); /** \} */ @@ -44,7 +44,8 @@ GPU_SHADER_CREATE_INFO(eevee_gbuffer_data) GPU_SHADER_CREATE_INFO(eevee_deferred_tile_classify) .fragment_source("eevee_deferred_tile_classify_frag.glsl") - .additional_info("eevee_shared", "draw_fullscreen") + .additional_info("eevee_shared") + .additional_info("draw_fullscreen") .subpass_in(1, Type::UINT, "in_gbuffer_header", DEFERRED_GBUFFER_ROG_ID) .typedef_source("draw_shader_shared.hh") .push_constant(Type::INT, "current_bit") @@ -70,17 +71,17 @@ GPU_SHADER_CREATE_INFO(eevee_deferred_light) .define("SPECIALIZED_SHADOW_PARAMS") .specialization_constant(Type::INT, "shadow_ray_count", 1) .specialization_constant(Type::INT, "shadow_ray_step_count", 6) - .additional_info("eevee_shared", - "eevee_gbuffer_data", - "eevee_utility_texture", - "eevee_sampling_data", - "eevee_light_data", - "eevee_shadow_data", - "eevee_hiz_data", - "eevee_lightprobe_data", - "eevee_render_pass_out", - "draw_fullscreen", - "draw_view"); + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data") + .additional_info("eevee_utility_texture") + .additional_info("eevee_sampling_data") + .additional_info("eevee_light_data") + .additional_info("eevee_shadow_data") + .additional_info("eevee_hiz_data") + .additional_info("eevee_lightprobe_data") + .additional_info("eevee_render_pass_out") + .additional_info("draw_fullscreen") + .additional_info("draw_view"); GPU_SHADER_CREATE_INFO(eevee_deferred_light_single) .additional_info("eevee_deferred_light") @@ -109,10 +110,10 @@ GPU_SHADER_CREATE_INFO(eevee_deferred_combine) .sampler(7, ImageType::FLOAT_2D, "indirect_radiance_3_tx") .image(5, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "radiance_feedback_img") .fragment_out(0, Type::VEC4, "out_combined") - .additional_info("eevee_shared", - "eevee_gbuffer_data", - "eevee_render_pass_out", - "draw_fullscreen") + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data") + .additional_info("eevee_render_pass_out") + .additional_info("draw_fullscreen") .fragment_source("eevee_deferred_combine_frag.glsl") /* NOTE: Both light IDs have a valid specialized assignment of '-1' so only when default is * present will we instead dynamically look-up ID from the uniform buffer. */ @@ -129,16 +130,16 @@ GPU_SHADER_CREATE_INFO(eevee_deferred_capture_eval) /* Inputs. */ .fragment_out(0, Type::VEC4, "out_radiance") .define("LIGHT_CLOSURE_EVAL_COUNT", "1") - .additional_info("eevee_shared", - "eevee_gbuffer_data", - "eevee_utility_texture", - "eevee_sampling_data", - "eevee_light_data", - "eevee_shadow_data", - "eevee_hiz_data", - "eevee_volume_probe_data", - "draw_view", - "draw_fullscreen") + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data") + .additional_info("eevee_utility_texture") + .additional_info("eevee_sampling_data") + .additional_info("eevee_light_data") + .additional_info("eevee_shadow_data") + .additional_info("eevee_hiz_data") + .additional_info("eevee_volume_probe_data") + .additional_info("draw_view") + .additional_info("draw_fullscreen") .fragment_source("eevee_deferred_capture_frag.glsl") .do_static_compilation(true); @@ -149,16 +150,16 @@ GPU_SHADER_CREATE_INFO(eevee_deferred_planar_eval) .fragment_out(0, Type::VEC4, "out_radiance") .define("SPHERE_PROBE") .define("LIGHT_CLOSURE_EVAL_COUNT", "1") - .additional_info("eevee_shared", - "eevee_gbuffer_data", - "eevee_utility_texture", - "eevee_sampling_data", - "eevee_light_data", - "eevee_lightprobe_data", - "eevee_shadow_data", - "eevee_hiz_data", - "draw_view", - "draw_fullscreen") + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data") + .additional_info("eevee_utility_texture") + .additional_info("eevee_sampling_data") + .additional_info("eevee_light_data") + .additional_info("eevee_lightprobe_data") + .additional_info("eevee_shadow_data") + .additional_info("eevee_hiz_data") + .additional_info("draw_view") + .additional_info("draw_fullscreen") .fragment_source("eevee_deferred_planar_frag.glsl") .do_static_compilation(true); @@ -176,6 +177,9 @@ GPU_SHADER_CREATE_INFO(eevee_debug_gbuffer) .fragment_out(0, Type::VEC4, "out_color_mul", DualBlend::SRC_1) .push_constant(Type::INT, "debug_mode") .fragment_source("eevee_debug_gbuffer_frag.glsl") - .additional_info("draw_view", "draw_fullscreen", "eevee_shared", "eevee_gbuffer_data"); + .additional_info("draw_view") + .additional_info("draw_fullscreen") + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data"); /** \} */ diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_depth_of_field_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_depth_of_field_info.hh index 7369d9eda0c..dc4cbece636 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_depth_of_field_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_depth_of_field_info.hh @@ -12,7 +12,8 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_bokeh_lut) .do_static_compilation(true) .local_group_size(DOF_BOKEH_LUT_SIZE, DOF_BOKEH_LUT_SIZE) - .additional_info("eevee_shared", "draw_view") + .additional_info("eevee_shared") + .additional_info("draw_view") .uniform_buf(6, "DepthOfFieldData", "dof_buf") .image(0, GPU_RG16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_gather_lut_img") .image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_scatter_lut_img") @@ -22,7 +23,8 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_bokeh_lut) GPU_SHADER_CREATE_INFO(eevee_depth_of_field_setup) .do_static_compilation(true) .local_group_size(DOF_DEFAULT_GROUP_SIZE, DOF_DEFAULT_GROUP_SIZE) - .additional_info("eevee_shared", "draw_view") + .additional_info("eevee_shared") + .additional_info("draw_view") .uniform_buf(6, "DepthOfFieldData", "dof_buf") .sampler(0, ImageType::FLOAT_2D, "color_tx") .sampler(1, ImageType::DEPTH_2D, "depth_tx") @@ -33,7 +35,9 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_setup) GPU_SHADER_CREATE_INFO(eevee_depth_of_field_stabilize) .do_static_compilation(true) .local_group_size(DOF_STABILIZE_GROUP_SIZE, DOF_STABILIZE_GROUP_SIZE) - .additional_info("eevee_shared", "draw_view", "eevee_velocity_camera") + .additional_info("eevee_shared") + .additional_info("draw_view") + .additional_info("eevee_velocity_camera") .uniform_buf(6, "DepthOfFieldData", "dof_buf") .sampler(0, ImageType::FLOAT_2D, "coc_tx") .sampler(1, ImageType::FLOAT_2D, "color_tx") @@ -49,7 +53,8 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_stabilize) GPU_SHADER_CREATE_INFO(eevee_depth_of_field_downsample) .do_static_compilation(true) .local_group_size(DOF_DEFAULT_GROUP_SIZE, DOF_DEFAULT_GROUP_SIZE) - .additional_info("eevee_shared", "draw_view") + .additional_info("eevee_shared") + .additional_info("draw_view") .sampler(0, ImageType::FLOAT_2D, "color_tx") .sampler(1, ImageType::FLOAT_2D, "coc_tx") .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img") @@ -58,7 +63,8 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_downsample) GPU_SHADER_CREATE_INFO(eevee_depth_of_field_reduce) .do_static_compilation(true) .local_group_size(DOF_REDUCE_GROUP_SIZE, DOF_REDUCE_GROUP_SIZE) - .additional_info("eevee_shared", "draw_view") + .additional_info("eevee_shared") + .additional_info("draw_view") .uniform_buf(6, "DepthOfFieldData", "dof_buf") .sampler(0, ImageType::FLOAT_2D, "downsample_tx") .storage_buf(0, Qualifier::WRITE, "ScatterRect", "scatter_fg_list_buf[]") @@ -84,14 +90,17 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_reduce) GPU_SHADER_CREATE_INFO(eevee_depth_of_field_tiles_flatten) .do_static_compilation(true) .local_group_size(DOF_TILES_FLATTEN_GROUP_SIZE, DOF_TILES_FLATTEN_GROUP_SIZE) - .additional_info("eevee_shared", "draw_view") + .additional_info("eevee_shared") + .additional_info("draw_view") .sampler(0, ImageType::FLOAT_2D, "coc_tx") .image(2, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_tiles_fg_img") .image(3, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_tiles_bg_img") .compute_source("eevee_depth_of_field_tiles_flatten_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_depth_of_field_tiles_dilate) - .additional_info("eevee_shared", "draw_view", "eevee_depth_of_field_tiles_common") + .additional_info("eevee_shared") + .additional_info("draw_view") + .additional_info("eevee_depth_of_field_tiles_common") .local_group_size(DOF_TILES_DILATE_GROUP_SIZE, DOF_TILES_DILATE_GROUP_SIZE) .image(2, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_tiles_fg_img") .image(3, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_tiles_bg_img") @@ -135,7 +144,7 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_background).define("DOF_FOREGROUND_P GPU_SHADER_CREATE_INFO(eevee_depth_of_field_foreground).define("DOF_FOREGROUND_PASS", "true"); #define EEVEE_DOF_FINAL_VARIATION(name, ...) \ - GPU_SHADER_CREATE_INFO(name).additional_info(__VA_ARGS__).do_static_compilation(true); + GPU_SHADER_CREATE_INFO(name).additional_info("__VA_ARGS__").do_static_compilation(true); #define EEVEE_DOF_LUT_VARIATIONS(prefix, ...) \ EEVEE_DOF_FINAL_VARIATION(prefix##_lut, "eevee_depth_of_field_lut", __VA_ARGS__) \ @@ -152,10 +161,10 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_foreground).define("DOF_FOREGROUND_P * \{ */ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_gather_common) - .additional_info("eevee_shared", - "draw_view", - "eevee_depth_of_field_tiles_common", - "eevee_sampling_data") + .additional_info("eevee_shared") + .additional_info("draw_view") + .additional_info("eevee_depth_of_field_tiles_common") + .additional_info("eevee_sampling_data") .uniform_buf(6, "DepthOfFieldData", "dof_buf") .local_group_size(DOF_GATHER_GROUP_SIZE, DOF_GATHER_GROUP_SIZE) .sampler(0, ImageType::FLOAT_2D, "color_tx") @@ -174,7 +183,8 @@ EEVEE_DOF_GROUND_VARIATIONS(eevee_depth_of_field_gather, "eevee_depth_of_field_g GPU_SHADER_CREATE_INFO(eevee_depth_of_field_hole_fill) .do_static_compilation(true) .compute_source("eevee_depth_of_field_hole_fill_comp.glsl") - .additional_info("eevee_depth_of_field_gather_common", "eevee_depth_of_field_no_lut"); + .additional_info("eevee_depth_of_field_gather_common") + .additional_info("eevee_depth_of_field_no_lut"); GPU_SHADER_CREATE_INFO(eevee_depth_of_field_filter) .do_static_compilation(true) @@ -210,7 +220,8 @@ GPU_SHADER_NAMED_INTERFACE_INFO(eevee_depth_of_field_scatter_noperspective_iface GPU_SHADER_CREATE_INFO(eevee_depth_of_field_scatter) .do_static_compilation(true) - .additional_info("eevee_shared", "draw_view") + .additional_info("eevee_shared") + .additional_info("draw_view") .sampler(0, ImageType::FLOAT_2D, "occlusion_tx") .sampler(1, ImageType::FLOAT_2D, "bokeh_lut_tx") .uniform_buf(6, "DepthOfFieldData", "dof_buf") @@ -232,10 +243,10 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_resolve) .define("DOF_RESOLVE_PASS", "true") .local_group_size(DOF_RESOLVE_GROUP_SIZE, DOF_RESOLVE_GROUP_SIZE) .specialization_constant(Type::BOOL, "do_debug_color", false) - .additional_info("eevee_shared", - "draw_view", - "eevee_depth_of_field_tiles_common", - "eevee_sampling_data") + .additional_info("eevee_shared") + .additional_info("draw_view") + .additional_info("eevee_depth_of_field_tiles_common") + .additional_info("eevee_sampling_data") .uniform_buf(6, "DepthOfFieldData", "dof_buf") .sampler(0, ImageType::DEPTH_2D, "depth_tx") .sampler(1, ImageType::FLOAT_2D, "color_tx") diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_film_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_film_info.hh index ff50517b566..fda797d9833 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_film_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_film_info.hh @@ -42,7 +42,8 @@ GPU_SHADER_CREATE_INFO(eevee_film_frag) .do_static_compilation(true) .fragment_out(0, Type::VEC4, "out_color") .fragment_source("eevee_film_frag.glsl") - .additional_info("draw_fullscreen", "eevee_film") + .additional_info("draw_fullscreen") + .additional_info("eevee_film") .depth_write(DepthWrite::ANY); GPU_SHADER_CREATE_INFO(eevee_film_comp) @@ -58,7 +59,8 @@ GPU_SHADER_CREATE_INFO(eevee_film_cryptomatte_post) .push_constant(Type::INT, "cryptomatte_samples_per_layer") .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE) .compute_source("eevee_film_cryptomatte_post_comp.glsl") - .additional_info("eevee_global_ubo", "eevee_shared"); + .additional_info("eevee_global_ubo") + .additional_info("eevee_shared"); GPU_SHADER_CREATE_INFO(eevee_film_copy_frag) .do_static_compilation(true) @@ -71,7 +73,8 @@ GPU_SHADER_CREATE_INFO(eevee_film_copy_frag) .fragment_out(0, Type::VEC4, "out_color") .fragment_source("eevee_film_copy_frag.glsl") .define("FILM_COPY") - .additional_info("draw_fullscreen", "eevee_film_base"); + .additional_info("draw_fullscreen") + .additional_info("eevee_film_base"); /* The combined pass is stored into its own 2D texture with a format of GPU_RGBA16F. */ GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_combined) diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_hiz_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_hiz_info.hh index 697cd5ce0ad..8cf9d74d78a 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_hiz_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_hiz_info.hh @@ -39,4 +39,6 @@ GPU_SHADER_CREATE_INFO(eevee_hiz_debug) .fragment_out(0, Type::VEC4, "out_debug_color_add", DualBlend::SRC_0) .fragment_out(0, Type::VEC4, "out_debug_color_mul", DualBlend::SRC_1) .fragment_source("eevee_hiz_debug_frag.glsl") - .additional_info("eevee_shared", "eevee_hiz_data", "draw_fullscreen"); + .additional_info("eevee_shared") + .additional_info("eevee_hiz_data") + .additional_info("draw_fullscreen"); diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_light_culling_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_light_culling_info.hh index 31b14c05ca2..f2170dc6e76 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_light_culling_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_light_culling_info.hh @@ -23,7 +23,9 @@ GPU_SHADER_CREATE_INFO(eevee_light_data) GPU_SHADER_CREATE_INFO(eevee_light_culling_select) .do_static_compilation(true) - .additional_info("eevee_shared", "draw_view", "draw_view_culling") + .additional_info("eevee_shared") + .additional_info("draw_view") + .additional_info("draw_view_culling") .local_group_size(CULLING_SELECT_GROUP_SIZE) .storage_buf(0, Qualifier::READ_WRITE, "LightCullingData", "light_cull_buf") .storage_buf(1, Qualifier::READ, "LightData", "in_light_buf[]") @@ -35,7 +37,8 @@ GPU_SHADER_CREATE_INFO(eevee_light_culling_select) GPU_SHADER_CREATE_INFO(eevee_light_culling_sort) .do_static_compilation(true) - .additional_info("eevee_shared", "draw_view") + .additional_info("eevee_shared") + .additional_info("draw_view") .storage_buf(0, Qualifier::READ, "LightCullingData", "light_cull_buf") .storage_buf(1, Qualifier::READ, "LightData", "in_light_buf[]") .storage_buf(2, Qualifier::WRITE, "LightData", "out_light_buf[]") @@ -46,7 +49,8 @@ GPU_SHADER_CREATE_INFO(eevee_light_culling_sort) GPU_SHADER_CREATE_INFO(eevee_light_culling_zbin) .do_static_compilation(true) - .additional_info("eevee_shared", "draw_view") + .additional_info("eevee_shared") + .additional_info("draw_view") .local_group_size(CULLING_ZBIN_GROUP_SIZE) .storage_buf(0, Qualifier::READ, "LightCullingData", "light_cull_buf") .storage_buf(1, Qualifier::READ, "LightData", "light_buf[]") @@ -55,7 +59,9 @@ GPU_SHADER_CREATE_INFO(eevee_light_culling_zbin) GPU_SHADER_CREATE_INFO(eevee_light_culling_tile) .do_static_compilation(true) - .additional_info("eevee_shared", "draw_view", "draw_view_culling") + .additional_info("eevee_shared") + .additional_info("draw_view") + .additional_info("draw_view_culling") .local_group_size(CULLING_TILE_GROUP_SIZE) .storage_buf(0, Qualifier::READ, "LightCullingData", "light_cull_buf") .storage_buf(1, Qualifier::READ, "LightData", "light_buf[]") @@ -64,7 +70,9 @@ GPU_SHADER_CREATE_INFO(eevee_light_culling_tile) GPU_SHADER_CREATE_INFO(eevee_light_shadow_setup) .do_static_compilation(true) - .additional_info("eevee_shared", "eevee_sampling_data", "eevee_global_ubo") + .additional_info("eevee_shared") + .additional_info("eevee_sampling_data") + .additional_info("eevee_global_ubo") .local_group_size(CULLING_SELECT_GROUP_SIZE) .storage_buf(0, Qualifier::READ, "LightCullingData", "light_cull_buf") .storage_buf(1, Qualifier::READ_WRITE, "LightData", "light_buf[]") diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_sphere_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_sphere_info.hh index 4e4cc3835a3..cc7db1ccb89 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_sphere_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_sphere_info.hh @@ -30,7 +30,8 @@ GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_remap) .storage_buf(1, Qualifier::WRITE, "SphereProbeSunLight", "out_sun[]") .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "atlas_img") .compute_source("eevee_lightprobe_sphere_remap_comp.glsl") - .additional_info("eevee_shared", "eevee_global_ubo") + .additional_info("eevee_shared") + .additional_info("eevee_global_ubo") .do_static_compilation(true); GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_irradiance) @@ -58,10 +59,10 @@ GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_select) "SphereProbeData", "lightprobe_sphere_buf[SPHERE_PROBE_MAX]") .push_constant(Type::INT, "lightprobe_sphere_count") - .additional_info("eevee_shared", - "eevee_sampling_data", - "eevee_global_ubo", - "eevee_volume_probe_data") + .additional_info("eevee_shared") + .additional_info("eevee_sampling_data") + .additional_info("eevee_global_ubo") + .additional_info("eevee_volume_probe_data") .compute_source("eevee_lightprobe_sphere_select_comp.glsl") .do_static_compilation(true); @@ -84,7 +85,9 @@ GPU_SHADER_INTERFACE_INFO(eevee_display_lightprobe_sphere_iface) .flat(Type::INT, "probe_index"); GPU_SHADER_CREATE_INFO(eevee_display_lightprobe_sphere) - .additional_info("eevee_shared", "draw_view", "eevee_lightprobe_sphere_data") + .additional_info("eevee_shared") + .additional_info("draw_view") + .additional_info("eevee_lightprobe_sphere_data") .storage_buf(0, Qualifier::READ, "SphereProbeDisplayData", "display_data_buf[]") .vertex_source("eevee_display_lightprobe_sphere_vert.glsl") .vertex_out(eevee_display_lightprobe_sphere_iface) @@ -98,10 +101,10 @@ GPU_SHADER_INTERFACE_INFO(eevee_display_lightprobe_planar_iface) GPU_SHADER_CREATE_INFO(eevee_display_lightprobe_planar) .push_constant(Type::IVEC4, "world_coord_packed") - .additional_info("eevee_shared", - "draw_view", - "eevee_lightprobe_planar_data", - "eevee_lightprobe_sphere_data") + .additional_info("eevee_shared") + .additional_info("draw_view") + .additional_info("eevee_lightprobe_planar_data") + .additional_info("eevee_lightprobe_sphere_data") .storage_buf(0, Qualifier::READ, "PlanarProbeDisplayData", "display_data_buf[]") .vertex_source("eevee_display_lightprobe_planar_vert.glsl") .vertex_out(eevee_display_lightprobe_planar_iface) diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_volume_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_volume_info.hh index 7efac6e2b8d..9efe18ed10c 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_volume_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_volume_info.hh @@ -14,7 +14,8 @@ GPU_SHADER_INTERFACE_INFO(eevee_debug_surfel_iface) .flat(Type::INT, "surfel_index"); GPU_SHADER_CREATE_INFO(eevee_debug_surfels) - .additional_info("eevee_shared", "draw_view") + .additional_info("eevee_shared") + .additional_info("draw_view") .vertex_source("eevee_debug_surfels_vert.glsl") .vertex_out(eevee_debug_surfel_iface) .fragment_source("eevee_debug_surfels_frag.glsl") @@ -27,7 +28,8 @@ GPU_SHADER_CREATE_INFO(eevee_debug_surfels) GPU_SHADER_INTERFACE_INFO(eevee_debug_irradiance_grid_iface).smooth(Type::VEC4, "interp_color"); GPU_SHADER_CREATE_INFO(eevee_debug_irradiance_grid) - .additional_info("eevee_shared", "draw_view") + .additional_info("eevee_shared") + .additional_info("draw_view") .fragment_out(0, Type::VEC4, "out_color") .vertex_out(eevee_debug_irradiance_grid_iface) .sampler(0, ImageType::FLOAT_3D, "debug_data_tx") @@ -43,7 +45,8 @@ GPU_SHADER_INTERFACE_INFO(eevee_display_lightprobe_volume_iface) .flat(Type::IVEC3, "cell"); GPU_SHADER_CREATE_INFO(eevee_display_lightprobe_volume) - .additional_info("eevee_shared", "draw_view") + .additional_info("eevee_shared") + .additional_info("draw_view") .vertex_source("eevee_display_lightprobe_volume_vert.glsl") .vertex_out(eevee_display_lightprobe_volume_iface) .fragment_source("eevee_display_lightprobe_volume_frag.glsl") @@ -74,20 +77,22 @@ GPU_SHADER_CREATE_INFO(eevee_surfel_light) .define("LIGHT_ITER_FORCE_NO_CULLING") .define("LIGHT_CLOSURE_EVAL_COUNT", "1") .local_group_size(SURFEL_GROUP_SIZE) - .additional_info("eevee_shared", - "draw_view", - "eevee_global_ubo", - "eevee_utility_texture", - "eevee_surfel_common", - "eevee_light_data", - "eevee_shadow_data") + .additional_info("eevee_shared") + .additional_info("draw_view") + .additional_info("eevee_global_ubo") + .additional_info("eevee_utility_texture") + .additional_info("eevee_surfel_common") + .additional_info("eevee_light_data") + .additional_info("eevee_shadow_data") .compute_source("eevee_surfel_light_comp.glsl") .do_static_compilation(true); GPU_SHADER_CREATE_INFO(eevee_surfel_cluster_build) .local_group_size(SURFEL_GROUP_SIZE) .builtins(BuiltinBits::TEXTURE_ATOMIC) - .additional_info("eevee_shared", "eevee_surfel_common", "draw_view") + .additional_info("eevee_shared") + .additional_info("eevee_surfel_common") + .additional_info("draw_view") .image(0, GPU_R32I, Qualifier::READ_WRITE, ImageType::INT_3D_ATOMIC, "cluster_list_img") .compute_source("eevee_surfel_cluster_build_comp.glsl") .do_static_compilation(true); @@ -95,7 +100,9 @@ GPU_SHADER_CREATE_INFO(eevee_surfel_cluster_build) GPU_SHADER_CREATE_INFO(eevee_surfel_list_build) .local_group_size(SURFEL_GROUP_SIZE) .builtins(BuiltinBits::TEXTURE_ATOMIC) - .additional_info("eevee_shared", "eevee_surfel_common", "draw_view") + .additional_info("eevee_shared") + .additional_info("eevee_surfel_common") + .additional_info("draw_view") .storage_buf(0, Qualifier::READ_WRITE, "int", "list_start_buf[]") .storage_buf(6, Qualifier::READ_WRITE, "SurfelListInfoData", "list_info_buf") .compute_source("eevee_surfel_list_build_comp.glsl") @@ -103,7 +110,9 @@ GPU_SHADER_CREATE_INFO(eevee_surfel_list_build) GPU_SHADER_CREATE_INFO(eevee_surfel_list_sort) .local_group_size(SURFEL_LIST_GROUP_SIZE) - .additional_info("eevee_shared", "eevee_surfel_common", "draw_view") + .additional_info("eevee_shared") + .additional_info("eevee_surfel_common") + .additional_info("draw_view") .storage_buf(0, Qualifier::READ_WRITE, "int", "list_start_buf[]") .storage_buf(6, Qualifier::READ, "SurfelListInfoData", "list_info_buf") .compute_source("eevee_surfel_list_sort_comp.glsl") @@ -111,10 +120,10 @@ GPU_SHADER_CREATE_INFO(eevee_surfel_list_sort) GPU_SHADER_CREATE_INFO(eevee_surfel_ray) .local_group_size(SURFEL_GROUP_SIZE) - .additional_info("eevee_shared", - "eevee_surfel_common", - "eevee_lightprobe_sphere_data", - "draw_view") + .additional_info("eevee_shared") + .additional_info("eevee_surfel_common") + .additional_info("eevee_lightprobe_sphere_data") + .additional_info("draw_view") .push_constant(Type::INT, "radiance_src") .push_constant(Type::INT, "radiance_dst") .compute_source("eevee_surfel_ray_comp.glsl") @@ -134,10 +143,10 @@ GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_ray) .local_group_size(IRRADIANCE_GRID_GROUP_SIZE, IRRADIANCE_GRID_GROUP_SIZE, IRRADIANCE_GRID_GROUP_SIZE) - .additional_info("eevee_shared", - "eevee_surfel_common", - "eevee_lightprobe_sphere_data", - "draw_view") + .additional_info("eevee_shared") + .additional_info("eevee_surfel_common") + .additional_info("eevee_lightprobe_sphere_data") + .additional_info("draw_view") .push_constant(Type::INT, "radiance_src") .storage_buf(0, Qualifier::READ, "int", "list_start_buf[]") .storage_buf(6, Qualifier::READ, "SurfelListInfoData", "list_info_buf") @@ -154,7 +163,9 @@ GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_offset) .local_group_size(IRRADIANCE_GRID_GROUP_SIZE, IRRADIANCE_GRID_GROUP_SIZE, IRRADIANCE_GRID_GROUP_SIZE) - .additional_info("eevee_shared", "eevee_surfel_common", "draw_view") + .additional_info("eevee_shared") + .additional_info("eevee_surfel_common") + .additional_info("draw_view") .storage_buf(0, Qualifier::READ, "int", "list_start_buf[]") .storage_buf(6, Qualifier::READ, "SurfelListInfoData", "list_info_buf") .image(0, GPU_R32I, Qualifier::READ, ImageType::INT_3D_ATOMIC, "cluster_list_img") @@ -173,7 +184,8 @@ GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_world) IRRADIANCE_GRID_BRICK_SIZE, IRRADIANCE_GRID_BRICK_SIZE) .define("IRRADIANCE_GRID_UPLOAD") - .additional_info("eevee_shared", "eevee_global_ubo") + .additional_info("eevee_shared") + .additional_info("eevee_global_ubo") .push_constant(Type::INT, "grid_index") .storage_buf(0, Qualifier::READ, "uint", "bricks_infos_buf[]") .storage_buf(1, Qualifier::READ, "SphereProbeHarmonic", "harmonic_buf") @@ -187,7 +199,8 @@ GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_load) IRRADIANCE_GRID_BRICK_SIZE, IRRADIANCE_GRID_BRICK_SIZE) .define("IRRADIANCE_GRID_UPLOAD") - .additional_info("eevee_shared", "eevee_global_ubo") + .additional_info("eevee_shared") + .additional_info("eevee_global_ubo") .push_constant(Type::MAT4, "grid_local_to_world") .push_constant(Type::INT, "grid_index") .push_constant(Type::INT, "grid_start_index") @@ -222,7 +235,8 @@ GPU_SHADER_CREATE_INFO(eevee_volume_probe_data) .define("IRRADIANCE_GRID_SAMPLING"); GPU_SHADER_CREATE_INFO(eevee_lightprobe_data) - .additional_info("eevee_lightprobe_sphere_data", "eevee_volume_probe_data"); + .additional_info("eevee_lightprobe_sphere_data") + .additional_info("eevee_volume_probe_data"); GPU_SHADER_CREATE_INFO(eevee_lightprobe_planar_data) .define("SPHERE_PROBE") diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh index 61a8209771b..85dc0a39702 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh @@ -54,10 +54,10 @@ GPU_SHADER_CREATE_INFO(eevee_geom_mesh) .vertex_in(1, Type::VEC3, "nor") .vertex_source("eevee_geom_mesh_vert.glsl") .vertex_out(eevee_surf_iface) - .additional_info("draw_modelmat_new", - "draw_object_infos_new", - "draw_resource_id_varying", - "draw_view"); + .additional_info("draw_modelmat_new") + .additional_info("draw_object_infos_new") + .additional_info("draw_resource_id_varying") + .additional_info("draw_view"); GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_point_cloud_iface, point_cloud_interp) .smooth(Type::FLOAT, "radius") @@ -72,11 +72,11 @@ GPU_SHADER_CREATE_INFO(eevee_geom_point_cloud) .vertex_out(eevee_surf_iface) .vertex_out(eevee_surf_point_cloud_iface) .vertex_out(eevee_surf_point_cloud_flat_iface) - .additional_info("draw_pointcloud_new", - "draw_modelmat_new", - "draw_object_infos_new", - "draw_resource_id_varying", - "draw_view"); + .additional_info("draw_pointcloud_new") + .additional_info("draw_modelmat_new") + .additional_info("draw_object_infos_new") + .additional_info("draw_resource_id_varying") + .additional_info("draw_view"); GPU_SHADER_CREATE_INFO(eevee_geom_volume) .additional_info("eevee_shared") @@ -84,22 +84,22 @@ GPU_SHADER_CREATE_INFO(eevee_geom_volume) .vertex_in(0, Type::VEC3, "pos") .vertex_out(eevee_surf_iface) .vertex_source("eevee_geom_volume_vert.glsl") - .additional_info("draw_modelmat_new", - "draw_object_infos_new", - "draw_resource_id_varying", - "draw_volume_infos", - "draw_view"); + .additional_info("draw_modelmat_new") + .additional_info("draw_object_infos_new") + .additional_info("draw_resource_id_varying") + .additional_info("draw_volume_infos") + .additional_info("draw_view"); GPU_SHADER_CREATE_INFO(eevee_geom_gpencil) .additional_info("eevee_shared") .define("MAT_GEOM_GPENCIL") .vertex_source("eevee_geom_gpencil_vert.glsl") .vertex_out(eevee_surf_iface) - .additional_info("draw_gpencil_new", - "draw_modelmat_new", - "draw_object_infos_new", - "draw_resource_id_varying", - "draw_resource_id_new"); + .additional_info("draw_gpencil_new") + .additional_info("draw_modelmat_new") + .additional_info("draw_object_infos_new") + .additional_info("draw_resource_id_varying") + .additional_info("draw_resource_id_new"); GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_curve_iface, curve_interp) .smooth(Type::VEC2, "barycentric_coords") @@ -118,12 +118,12 @@ GPU_SHADER_CREATE_INFO(eevee_geom_curves) .vertex_out(eevee_surf_iface) .vertex_out(eevee_surf_curve_iface) .vertex_out(eevee_surf_curve_flat_iface) - .additional_info("draw_modelmat_new", - "draw_object_infos_new", - "draw_resource_id_varying", - "draw_view", - "draw_hair_new", - "draw_curves_infos"); + .additional_info("draw_modelmat_new") + .additional_info("draw_object_infos_new") + .additional_info("draw_resource_id_varying") + .additional_info("draw_view") + .additional_info("draw_hair_new") + .additional_info("draw_curves_infos"); GPU_SHADER_CREATE_INFO(eevee_geom_world) .additional_info("eevee_shared") @@ -131,10 +131,10 @@ GPU_SHADER_CREATE_INFO(eevee_geom_world) .builtins(BuiltinBits::VERTEX_ID) .vertex_source("eevee_geom_world_vert.glsl") .vertex_out(eevee_surf_iface) - .additional_info("draw_modelmat_new", - "draw_object_infos_new", /* Unused, but allow debug compilation. */ - "draw_resource_id_varying", - "draw_view"); + .additional_info("draw_modelmat_new") + .additional_info("draw_object_infos_new") /* Unused, but allow debug compilation. */ + .additional_info("draw_resource_id_varying") + .additional_info("draw_view"); /** \} */ @@ -172,13 +172,13 @@ GPU_SHADER_CREATE_INFO(eevee_surf_deferred_base) * limitation of the number of images we can bind on a single shader. */ .image_array_out(GBUF_CLOSURE_SLOT, Qualifier::WRITE, GPU_RGB10_A2, "out_gbuf_closure_img") .image_array_out(GBUF_NORMAL_SLOT, Qualifier::WRITE, GPU_RG16, "out_gbuf_normal_img") - .additional_info("eevee_global_ubo", - "eevee_utility_texture", - /* Added at runtime because of test shaders not having `node_tree`. */ - // "eevee_render_pass_out", - // "eevee_cryptomatte_out", - "eevee_sampling_data", - "eevee_hiz_data"); + /* Added at runtime because of test shaders not having `node_tree`. */ + // .additional_info("eevee_render_pass_out") + // .additional_info("eevee_cryptomatte_out") + .additional_info("eevee_global_ubo") + .additional_info("eevee_utility_texture") + .additional_info("eevee_sampling_data") + .additional_info("eevee_hiz_data"); GPU_SHADER_CREATE_INFO(eevee_surf_deferred) .fragment_source("eevee_surf_deferred_frag.glsl") @@ -186,10 +186,10 @@ GPU_SHADER_CREATE_INFO(eevee_surf_deferred) GPU_SHADER_CREATE_INFO(eevee_surf_deferred_hybrid) .fragment_source("eevee_surf_hybrid_frag.glsl") - .additional_info("eevee_surf_deferred_base", - "eevee_light_data", - "eevee_lightprobe_data", - "eevee_shadow_data"); + .additional_info("eevee_surf_deferred_base") + .additional_info("eevee_light_data") + .additional_info("eevee_lightprobe_data") + .additional_info("eevee_shadow_data"); GPU_SHADER_CREATE_INFO(eevee_surf_forward) .define("MAT_FORWARD") @@ -199,18 +199,17 @@ GPU_SHADER_CREATE_INFO(eevee_surf_forward) .fragment_out(0, Type::VEC4, "out_radiance", DualBlend::SRC_0) .fragment_out(0, Type::VEC4, "out_transmittance", DualBlend::SRC_1) .fragment_source("eevee_surf_forward_frag.glsl") - .additional_info("eevee_global_ubo", - "eevee_light_data", - "eevee_lightprobe_data", - "eevee_utility_texture", - "eevee_sampling_data", - "eevee_shadow_data", - "eevee_hiz_data", - "eevee_volume_lib" - /* Optionally added depending on the material. */ - // "eevee_render_pass_out", - // "eevee_cryptomatte_out", - ); + /* Optionally added depending on the material. */ + // .additional_info("eevee_render_pass_out") + // .additional_info("eevee_cryptomatte_out") + .additional_info("eevee_global_ubo") + .additional_info("eevee_light_data") + .additional_info("eevee_lightprobe_data") + .additional_info("eevee_utility_texture") + .additional_info("eevee_sampling_data") + .additional_info("eevee_shadow_data") + .additional_info("eevee_hiz_data") + .additional_info("eevee_volume_lib"); GPU_SHADER_CREATE_INFO(eevee_surf_capture) .define("MAT_CAPTURE") @@ -218,12 +217,15 @@ GPU_SHADER_CREATE_INFO(eevee_surf_capture) .storage_buf(CAPTURE_BUF_SLOT, Qualifier::READ_WRITE, "CaptureInfoData", "capture_info_buf") .push_constant(Type::BOOL, "is_double_sided") .fragment_source("eevee_surf_capture_frag.glsl") - .additional_info("eevee_global_ubo", "eevee_utility_texture"); + .additional_info("eevee_global_ubo") + .additional_info("eevee_utility_texture"); GPU_SHADER_CREATE_INFO(eevee_surf_depth) .define("MAT_DEPTH") .fragment_source("eevee_surf_depth_frag.glsl") - .additional_info("eevee_global_ubo", "eevee_sampling_data", "eevee_utility_texture"); + .additional_info("eevee_global_ubo") + .additional_info("eevee_sampling_data") + .additional_info("eevee_utility_texture"); GPU_SHADER_CREATE_INFO(eevee_surf_world) .push_constant(Type::FLOAT, "world_opacity_fade") @@ -232,23 +234,23 @@ GPU_SHADER_CREATE_INFO(eevee_surf_world) .early_fragment_test(true) .fragment_out(0, Type::VEC4, "out_background") .fragment_source("eevee_surf_world_frag.glsl") - .additional_info("eevee_global_ubo", - "eevee_lightprobe_sphere_data", - "eevee_volume_probe_data", - "eevee_sampling_data", - /* Optionally added depending on the material. */ - // "eevee_render_pass_out", - // "eevee_cryptomatte_out", - "eevee_utility_texture"); + .additional_info("eevee_global_ubo") + .additional_info("eevee_lightprobe_sphere_data") + .additional_info("eevee_volume_probe_data") + .additional_info("eevee_sampling_data") + /* Optionally added depending on the material. */ + // .additional_info("eevee_render_pass_out") + // .additional_info("eevee_cryptomatte_out") + .additional_info("eevee_utility_texture"); GPU_SHADER_CREATE_INFO(eevee_renderpass_clear) .fragment_out(0, Type::VEC4, "out_background") .fragment_source("eevee_renderpass_clear_frag.glsl") - .additional_info("draw_fullscreen", - "eevee_global_ubo", - "eevee_render_pass_out", - "eevee_cryptomatte_out", - "eevee_shared") + .additional_info("draw_fullscreen") + .additional_info("eevee_global_ubo") + .additional_info("eevee_render_pass_out") + .additional_info("eevee_cryptomatte_out") + .additional_info("eevee_shared") .do_static_compilation(true); GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_shadow_atomic_iface, shadow_iface) @@ -268,7 +270,9 @@ GPU_SHADER_CREATE_INFO(eevee_surf_shadow) "ShadowRenderView", "render_view_buf[SHADOW_VIEW_MAX]") .fragment_source("eevee_surf_shadow_frag.glsl") - .additional_info("eevee_global_ubo", "eevee_utility_texture", "eevee_sampling_data"); + .additional_info("eevee_global_ubo") + .additional_info("eevee_utility_texture") + .additional_info("eevee_sampling_data"); GPU_SHADER_CREATE_INFO(eevee_surf_shadow_atomic) .additional_info("eevee_surf_shadow") @@ -339,12 +343,12 @@ GPU_SHADER_CREATE_INFO(eevee_surf_volume) ImageType::UINT_3D_ATOMIC, "occupancy_img") .fragment_source("eevee_surf_volume_frag.glsl") - .additional_info("draw_modelmat_new_common", - "draw_view", - "eevee_shared", - "eevee_global_ubo", - "eevee_sampling_data", - "eevee_utility_texture"); + .additional_info("draw_modelmat_new_common") + .additional_info("draw_view") + .additional_info("eevee_shared") + .additional_info("eevee_global_ubo") + .additional_info("eevee_sampling_data") + .additional_info("eevee_utility_texture"); GPU_SHADER_CREATE_INFO(eevee_surf_occupancy) .define("MAT_OCCUPANCY") @@ -364,7 +368,8 @@ GPU_SHADER_CREATE_INFO(eevee_surf_occupancy) ImageType::UINT_3D_ATOMIC, "occupancy_img") .fragment_source("eevee_surf_occupancy_frag.glsl") - .additional_info("eevee_global_ubo", "eevee_sampling_data"); + .additional_info("eevee_global_ubo") + .additional_info("eevee_sampling_data"); /** \} */ diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_motion_blur_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_motion_blur_info.hh index 883a57814cb..e5f53a5bdaa 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_motion_blur_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_motion_blur_info.hh @@ -7,7 +7,9 @@ GPU_SHADER_CREATE_INFO(eevee_motion_blur_tiles_flatten) .local_group_size(MOTION_BLUR_GROUP_SIZE, MOTION_BLUR_GROUP_SIZE) - .additional_info("eevee_shared", "draw_view", "eevee_velocity_camera") + .additional_info("eevee_shared") + .additional_info("draw_view") + .additional_info("eevee_velocity_camera") .uniform_buf(6, "MotionBlurData", "motion_blur_buf") .sampler(0, ImageType::DEPTH_2D, "depth_tx") .image(1, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_tiles_img") @@ -36,7 +38,9 @@ GPU_SHADER_CREATE_INFO(eevee_motion_blur_tiles_dilate) GPU_SHADER_CREATE_INFO(eevee_motion_blur_gather) .do_static_compilation(true) .local_group_size(MOTION_BLUR_GROUP_SIZE, MOTION_BLUR_GROUP_SIZE) - .additional_info("eevee_shared", "draw_view", "eevee_sampling_data") + .additional_info("eevee_shared") + .additional_info("draw_view") + .additional_info("eevee_sampling_data") .uniform_buf(6, "MotionBlurData", "motion_blur_buf") .sampler(0, ImageType::DEPTH_2D, "depth_tx") .sampler(1, ImageType::FLOAT_2D, "velocity_tx") diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_shadow_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_shadow_info.hh index c6f84bfb9a9..4d3826daca6 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_shadow_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_shadow_info.hh @@ -55,7 +55,9 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_tag_update) .storage_buf(1, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") .storage_buf(5, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .storage_buf(6, Qualifier::READ, "uint", "resource_ids_buf[]") - .additional_info("eevee_shared", "draw_view", "draw_view_culling") + .additional_info("eevee_shared") + .additional_info("draw_view") + .additional_info("draw_view_culling") .compute_source("eevee_shadow_tag_update_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_shadow_tag_usage_opaque) @@ -74,12 +76,12 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_tag_usage_surfels) .storage_buf(6, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") .storage_buf(7, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") .push_constant(Type::INT, "directional_level") - .additional_info("eevee_shared", - "draw_view", - "draw_view_culling", - "eevee_light_data", - "eevee_global_ubo", - "eevee_surfel_common") + .additional_info("eevee_shared") + .additional_info("draw_view") + .additional_info("draw_view_culling") + .additional_info("eevee_light_data") + .additional_info("eevee_global_ubo") + .additional_info("eevee_surfel_common") .compute_source("eevee_shadow_tag_usage_surfels_comp.glsl"); GPU_SHADER_NAMED_INTERFACE_INFO(eevee_shadow_tag_transparent_iface, interp) @@ -99,13 +101,13 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_tag_usage_transparent) .push_constant(Type::INT, "fb_lod") .vertex_out(eevee_shadow_tag_transparent_iface) .vertex_out(eevee_shadow_tag_transparent_flat_iface) - .additional_info("eevee_shared", - "draw_resource_id_varying", - "draw_view", - "draw_view_culling", - "draw_modelmat_new", - "eevee_hiz_data", - "eevee_light_data") + .additional_info("eevee_shared") + .additional_info("draw_resource_id_varying") + .additional_info("draw_view") + .additional_info("draw_view_culling") + .additional_info("draw_modelmat_new") + .additional_info("eevee_hiz_data") + .additional_info("eevee_light_data") .vertex_source("eevee_shadow_tag_usage_vert.glsl") .fragment_source("eevee_shadow_tag_usage_frag.glsl"); @@ -114,13 +116,13 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_tag_usage_volume) .local_group_size(VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE) .storage_buf(4, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") .storage_buf(5, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") - .additional_info("eevee_volume_properties_data", - "eevee_shared", - "draw_view", - "draw_view_culling", - "eevee_hiz_data", - "eevee_light_data", - "eevee_sampling_data") + .additional_info("eevee_volume_properties_data") + .additional_info("eevee_shared") + .additional_info("draw_view") + .additional_info("draw_view_culling") + .additional_info("eevee_hiz_data") + .additional_info("eevee_light_data") + .additional_info("eevee_sampling_data") .compute_source("eevee_shadow_tag_usage_volume_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_shadow_page_mask) @@ -208,7 +210,8 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_tilemap_amend) .storage_buf(LIGHT_BUF_SLOT, Qualifier::READ_WRITE, "LightData", "light_buf[]") /* The call bind_resources(lights) also uses LIGHT_ZBIN_BUF_SLOT and LIGHT_TILE_BUF_SLOT. */ .storage_buf(4, Qualifier::READ, "ShadowTileMapData", "tilemaps_buf[]") - .additional_info("eevee_shared", "draw_view") + .additional_info("eevee_shared") + .additional_info("draw_view") .compute_source("eevee_shadow_tilemap_amend_comp.glsl"); /* AtomicMin clear implementation. */ diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_subsurface_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_subsurface_info.hh index acf011bbac7..a6ea8f6b4e6 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_subsurface_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_subsurface_info.hh @@ -9,7 +9,9 @@ GPU_SHADER_CREATE_INFO(eevee_subsurface_setup) .do_static_compilation(true) .local_group_size(SUBSURFACE_GROUP_SIZE, SUBSURFACE_GROUP_SIZE) .typedef_source("draw_shader_shared.hh") - .additional_info("draw_view", "eevee_shared", "eevee_gbuffer_data") + .additional_info("draw_view") + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data") .sampler(2, ImageType::DEPTH_2D, "depth_tx") .image(0, DEFERRED_RADIANCE_FORMAT, Qualifier::READ, ImageType::UINT_2D, "direct_light_img") .image(1, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "indirect_light_img") @@ -22,7 +24,10 @@ GPU_SHADER_CREATE_INFO(eevee_subsurface_setup) GPU_SHADER_CREATE_INFO(eevee_subsurface_convolve) .do_static_compilation(true) .local_group_size(SUBSURFACE_GROUP_SIZE, SUBSURFACE_GROUP_SIZE) - .additional_info("draw_view", "eevee_shared", "eevee_gbuffer_data", "eevee_global_ubo") + .additional_info("draw_view") + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data") + .additional_info("eevee_global_ubo") .sampler(2, ImageType::FLOAT_2D, "radiance_tx") .sampler(3, ImageType::DEPTH_2D, "depth_tx") .sampler(4, ImageType::UINT_2D, "object_id_tx") diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_tracing_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_tracing_info.hh index bc892fed142..ff8f1a26084 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_tracing_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_tracing_info.hh @@ -17,7 +17,9 @@ GPU_SHADER_CREATE_INFO(eevee_ray_tile_classify) .do_static_compilation(true) .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared", "eevee_gbuffer_data", "eevee_global_ubo") + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data") + .additional_info("eevee_global_ubo") .typedef_source("draw_shader_shared.hh") .image_out(0, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_raytrace_denoise_img") .image_out(1, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_raytrace_tracing_img") @@ -28,7 +30,8 @@ GPU_SHADER_CREATE_INFO(eevee_ray_tile_classify) GPU_SHADER_CREATE_INFO(eevee_ray_tile_compact) .do_static_compilation(true) .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared", "eevee_global_ubo") + .additional_info("eevee_shared") + .additional_info("eevee_global_ubo") .typedef_source("draw_shader_shared.hh") .image_in(0, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_raytrace_denoise_img") .image_in(1, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_raytrace_tracing_img") @@ -43,12 +46,12 @@ GPU_SHADER_CREATE_INFO(eevee_ray_tile_compact) GPU_SHADER_CREATE_INFO(eevee_ray_generate) .do_static_compilation(true) .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared", - "eevee_gbuffer_data", - "eevee_global_ubo", - "eevee_sampling_data", - "draw_view", - "eevee_utility_texture") + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data") + .additional_info("eevee_global_ubo") + .additional_info("eevee_sampling_data") + .additional_info("draw_view") + .additional_info("eevee_utility_texture") .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_ray_data_img") .storage_buf(4, Qualifier::READ, "uint", "tiles_coord_buf[]") .specialization_constant(Type::INT, "closure_index", 0) @@ -57,12 +60,12 @@ GPU_SHADER_CREATE_INFO(eevee_ray_generate) GPU_SHADER_CREATE_INFO(eevee_ray_trace_fallback) .do_static_compilation(true) .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared", - "eevee_gbuffer_data", - "eevee_global_ubo", - "draw_view", - "eevee_sampling_data", - "eevee_lightprobe_data") + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data") + .additional_info("eevee_global_ubo") + .additional_info("draw_view") + .additional_info("eevee_sampling_data") + .additional_info("eevee_lightprobe_data") .image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "ray_data_img") .image(1, RAYTRACE_RAYTIME_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_time_img") .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_radiance_img") @@ -75,13 +78,13 @@ GPU_SHADER_CREATE_INFO(eevee_ray_trace_planar) .do_static_compilation(true) .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) .define("PLANAR_PROBES") - .additional_info("eevee_shared", - "eevee_global_ubo", - "eevee_sampling_data", - "eevee_gbuffer_data", - "draw_view", - "eevee_lightprobe_data", - "eevee_lightprobe_planar_data") + .additional_info("eevee_shared") + .additional_info("eevee_global_ubo") + .additional_info("eevee_sampling_data") + .additional_info("eevee_gbuffer_data") + .additional_info("draw_view") + .additional_info("eevee_lightprobe_data") + .additional_info("eevee_lightprobe_planar_data") .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "ray_data_img") .image(1, RAYTRACE_RAYTIME_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_time_img") .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_radiance_img") @@ -93,13 +96,13 @@ GPU_SHADER_CREATE_INFO(eevee_ray_trace_planar) GPU_SHADER_CREATE_INFO(eevee_ray_trace_screen) .do_static_compilation(true) .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared", - "eevee_global_ubo", - "eevee_sampling_data", - "eevee_gbuffer_data", - "draw_view", - "eevee_hiz_data", - "eevee_lightprobe_data") + .additional_info("eevee_shared") + .additional_info("eevee_global_ubo") + .additional_info("eevee_sampling_data") + .additional_info("eevee_gbuffer_data") + .additional_info("draw_view") + .additional_info("eevee_hiz_data") + .additional_info("eevee_lightprobe_data") .image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "ray_data_img") .image(1, RAYTRACE_RAYTIME_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_time_img") .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_radiance_img") @@ -119,12 +122,12 @@ GPU_SHADER_CREATE_INFO(eevee_ray_trace_screen) GPU_SHADER_CREATE_INFO(eevee_ray_denoise_spatial) .do_static_compilation(true) .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared", - "eevee_gbuffer_data", - "eevee_global_ubo", - "eevee_sampling_data", - "draw_view", - "eevee_utility_texture") + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data") + .additional_info("eevee_global_ubo") + .additional_info("eevee_sampling_data") + .additional_info("draw_view") + .additional_info("eevee_utility_texture") .sampler(3, ImageType::DEPTH_2D, "depth_tx") .image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "ray_data_img") .image(1, RAYTRACE_RAYTIME_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "ray_time_img") @@ -144,7 +147,9 @@ GPU_SHADER_CREATE_INFO(eevee_ray_denoise_spatial) GPU_SHADER_CREATE_INFO(eevee_ray_denoise_temporal) .do_static_compilation(true) .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared", "eevee_global_ubo", "draw_view") + .additional_info("eevee_shared") + .additional_info("eevee_global_ubo") + .additional_info("draw_view") .sampler(0, ImageType::FLOAT_2D, "radiance_history_tx") .sampler(1, ImageType::FLOAT_2D, "variance_history_tx") .sampler(2, ImageType::UINT_2D_ARRAY, "tilemask_history_tx") @@ -164,11 +169,11 @@ GPU_SHADER_CREATE_INFO(eevee_ray_denoise_temporal) GPU_SHADER_CREATE_INFO(eevee_ray_denoise_bilateral) .do_static_compilation(true) .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared", - "eevee_gbuffer_data", - "eevee_global_ubo", - "eevee_sampling_data", - "draw_view") + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data") + .additional_info("eevee_global_ubo") + .additional_info("eevee_sampling_data") + .additional_info("draw_view") .sampler(1, ImageType::DEPTH_2D, "depth_tx") .image(1, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "in_radiance_img") .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_radiance_img") @@ -181,7 +186,10 @@ GPU_SHADER_CREATE_INFO(eevee_ray_denoise_bilateral) GPU_SHADER_CREATE_INFO(eevee_horizon_setup) .do_static_compilation(true) .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared", "eevee_gbuffer_data", "eevee_global_ubo", "draw_view") + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data") + .additional_info("eevee_global_ubo") + .additional_info("draw_view") .sampler(0, ImageType::DEPTH_2D, "depth_tx") .sampler(1, ImageType::FLOAT_2D, "in_radiance_tx") .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_radiance_img") @@ -191,13 +199,13 @@ GPU_SHADER_CREATE_INFO(eevee_horizon_setup) GPU_SHADER_CREATE_INFO(eevee_horizon_scan) .do_static_compilation(true) .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared", - "eevee_gbuffer_data", - "eevee_global_ubo", - "eevee_sampling_data", - "eevee_utility_texture", - "eevee_hiz_data", - "draw_view") + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data") + .additional_info("eevee_global_ubo") + .additional_info("eevee_sampling_data") + .additional_info("eevee_utility_texture") + .additional_info("eevee_hiz_data") + .additional_info("draw_view") .specialization_constant(Type::INT, "fast_gi_slice_count", 2) .specialization_constant(Type::INT, "fast_gi_step_count", 8) .specialization_constant(Type::BOOL, "fast_gi_ao_only", false) @@ -232,12 +240,12 @@ GPU_SHADER_CREATE_INFO(eevee_horizon_denoise) GPU_SHADER_CREATE_INFO(eevee_horizon_resolve) .do_static_compilation(true) .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared", - "eevee_gbuffer_data", - "eevee_global_ubo", - "eevee_sampling_data", - "eevee_lightprobe_data", - "draw_view") + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data") + .additional_info("eevee_global_ubo") + .additional_info("eevee_sampling_data") + .additional_info("eevee_lightprobe_data") + .additional_info("draw_view") .sampler(1, ImageType::DEPTH_2D, "depth_tx") .sampler(2, ImageType::FLOAT_2D, "horizon_radiance_0_tx") .sampler(3, ImageType::FLOAT_2D, "horizon_radiance_1_tx") diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_volume_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_volume_info.hh index e3d55fc6cec..ea7c2c6908d 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_volume_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_volume_info.hh @@ -8,7 +8,9 @@ /* Used for shaders that need the final accumulated volume transmittance and scattering. */ GPU_SHADER_CREATE_INFO(eevee_volume_lib) - .additional_info("eevee_shared", "eevee_global_ubo", "draw_view") + .additional_info("eevee_shared") + .additional_info("eevee_global_ubo") + .additional_info("draw_view") .sampler(VOLUME_SCATTERING_TEX_SLOT, ImageType::FLOAT_3D, "volume_scattering_tx") .sampler(VOLUME_TRANSMITTANCE_TEX_SLOT, ImageType::FLOAT_3D, "volume_transmittance_tx"); @@ -65,7 +67,9 @@ GPU_SHADER_CREATE_INFO(eevee_volume_scatter_with_lights) .do_static_compilation(true); GPU_SHADER_CREATE_INFO(eevee_volume_occupancy_convert) - .additional_info("eevee_shared", "eevee_global_ubo", "draw_fullscreen") + .additional_info("eevee_shared") + .additional_info("eevee_global_ubo") + .additional_info("draw_fullscreen") .builtins(BuiltinBits::TEXTURE_ATOMIC) .image(VOLUME_HIT_DEPTH_SLOT, GPU_R32F, Qualifier::READ, ImageType::FLOAT_3D, "hit_depth_img") .image(VOLUME_HIT_COUNT_SLOT, @@ -82,7 +86,9 @@ GPU_SHADER_CREATE_INFO(eevee_volume_occupancy_convert) .do_static_compilation(true); GPU_SHADER_CREATE_INFO(eevee_volume_integration) - .additional_info("eevee_shared", "eevee_global_ubo", "draw_view") + .additional_info("eevee_shared") + .additional_info("eevee_global_ubo") + .additional_info("draw_view") .additional_info("eevee_sampling_data") .compute_source("eevee_volume_integration_comp.glsl") .local_group_size(VOLUME_INTEGRATION_GROUP_SIZE, VOLUME_INTEGRATION_GROUP_SIZE, 1) diff --git a/source/blender/draw/engines/gpencil/shaders/infos/gpencil_vfx_info.hh b/source/blender/draw/engines/gpencil/shaders/infos/gpencil_vfx_info.hh index bdfa7228e1e..72a74ab5ecc 100644 --- a/source/blender/draw/engines/gpencil/shaders/infos/gpencil_vfx_info.hh +++ b/source/blender/draw/engines/gpencil/shaders/infos/gpencil_vfx_info.hh @@ -17,7 +17,8 @@ GPU_SHADER_CREATE_INFO(gpencil_fx_composite) .do_static_compilation(true) .define("COMPOSITE") .push_constant(Type::BOOL, "isFirstPass") - .additional_info("gpencil_fx_common", "draw_fullscreen"); + .additional_info("gpencil_fx_common") + .additional_info("draw_fullscreen"); GPU_SHADER_CREATE_INFO(gpencil_fx_colorize) .do_static_compilation(true) @@ -26,14 +27,16 @@ GPU_SHADER_CREATE_INFO(gpencil_fx_colorize) .push_constant(Type::VEC3, "highColor") .push_constant(Type::FLOAT, "factor") .push_constant(Type::INT, "mode") - .additional_info("gpencil_fx_common", "draw_fullscreen"); + .additional_info("gpencil_fx_common") + .additional_info("draw_fullscreen"); GPU_SHADER_CREATE_INFO(gpencil_fx_blur) .do_static_compilation(true) .define("BLUR") .push_constant(Type::VEC2, "offset") .push_constant(Type::INT, "sampCount") - .additional_info("gpencil_fx_common", "draw_fullscreen"); + .additional_info("gpencil_fx_common") + .additional_info("draw_fullscreen"); GPU_SHADER_CREATE_INFO(gpencil_fx_transform) .do_static_compilation(true) @@ -45,7 +48,8 @@ GPU_SHADER_CREATE_INFO(gpencil_fx_transform) .push_constant(Type::VEC2, "swirlCenter") .push_constant(Type::FLOAT, "swirlAngle") .push_constant(Type::FLOAT, "swirlRadius") - .additional_info("gpencil_fx_common", "draw_fullscreen"); + .additional_info("gpencil_fx_common") + .additional_info("draw_fullscreen"); GPU_SHADER_CREATE_INFO(gpencil_fx_glow) .do_static_compilation(true) @@ -57,7 +61,8 @@ GPU_SHADER_CREATE_INFO(gpencil_fx_glow) .push_constant(Type::BOOL, "firstPass") .push_constant(Type::BOOL, "glowUnder") .push_constant(Type::INT, "blendMode") - .additional_info("gpencil_fx_common", "draw_fullscreen"); + .additional_info("gpencil_fx_common") + .additional_info("draw_fullscreen"); GPU_SHADER_CREATE_INFO(gpencil_fx_rim) .do_static_compilation(true) @@ -69,7 +74,8 @@ GPU_SHADER_CREATE_INFO(gpencil_fx_rim) .push_constant(Type::INT, "sampCount") .push_constant(Type::INT, "blendMode") .push_constant(Type::BOOL, "isFirstPass") - .additional_info("gpencil_fx_common", "draw_fullscreen"); + .additional_info("gpencil_fx_common") + .additional_info("draw_fullscreen"); GPU_SHADER_CREATE_INFO(gpencil_fx_shadow) .do_static_compilation(true) @@ -84,7 +90,8 @@ GPU_SHADER_CREATE_INFO(gpencil_fx_shadow) .push_constant(Type::FLOAT, "wavePhase") .push_constant(Type::INT, "sampCount") .push_constant(Type::BOOL, "isFirstPass") - .additional_info("gpencil_fx_common", "draw_fullscreen"); + .additional_info("gpencil_fx_common") + .additional_info("draw_fullscreen"); GPU_SHADER_CREATE_INFO(gpencil_fx_pixelize) .do_static_compilation(true) @@ -93,4 +100,5 @@ GPU_SHADER_CREATE_INFO(gpencil_fx_pixelize) .push_constant(Type::VEC2, "targetPixelOffset") .push_constant(Type::VEC2, "accumOffset") .push_constant(Type::INT, "sampCount") - .additional_info("gpencil_fx_common", "draw_fullscreen"); + .additional_info("gpencil_fx_common") + .additional_info("draw_fullscreen"); diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_antialiasing_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_antialiasing_info.hh index 2baa3d9ef27..feb06145300 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_antialiasing_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_antialiasing_info.hh @@ -12,7 +12,8 @@ GPU_SHADER_CREATE_INFO(overlay_antialiasing) .push_constant(Type::BOOL, "doSmoothLines") .fragment_out(0, Type::VEC4, "fragColor") .fragment_source("overlay_antialiasing_frag.glsl") - .additional_info("draw_fullscreen", "draw_globals"); + .additional_info("draw_fullscreen") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_xray_fade) .do_static_compilation(true) diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_armature_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_armature_info.hh index 31c3cc1b109..93daa6bd487 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_armature_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_armature_info.hh @@ -29,11 +29,14 @@ GPU_SHADER_CREATE_INFO(overlay_armature_sphere_outline) .vertex_out(overlay_armature_wire_iface) .vertex_source("overlay_armature_sphere_outline_vert.glsl") .fragment_source("overlay_armature_wire_frag.glsl") - .additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals"); + .additional_info("overlay_frag_output") + .additional_info("overlay_armature_common") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_armature_sphere_outline_clipped) .do_static_compilation(true) - .additional_info("overlay_armature_sphere_outline", "drw_clipped"); + .additional_info("overlay_armature_sphere_outline") + .additional_info("drw_clipped"); GPU_SHADER_INTERFACE_INFO(overlay_armature_sphere_solid_iface) .flat(Type::VEC3, "finalStateColor") @@ -51,12 +54,15 @@ GPU_SHADER_CREATE_INFO(overlay_armature_sphere_solid) .vertex_out(overlay_armature_sphere_solid_iface) .vertex_source("overlay_armature_sphere_solid_vert.glsl") .fragment_source("overlay_armature_sphere_solid_frag.glsl") - .additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals") + .additional_info("overlay_frag_output") + .additional_info("overlay_armature_common") + .additional_info("draw_globals") .depth_write(DepthWrite::ANY); GPU_SHADER_CREATE_INFO(overlay_armature_sphere_solid_clipped) .do_static_compilation(true) - .additional_info("overlay_armature_sphere_solid", "drw_clipped"); + .additional_info("overlay_armature_sphere_solid") + .additional_info("drw_clipped"); /** \} */ @@ -89,7 +95,9 @@ GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline) .vertex_source("overlay_armature_shape_outline_vert.glsl") .geometry_source("overlay_armature_shape_outline_geom.glsl") .fragment_source("overlay_armature_wire_frag.glsl") - .additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals"); + .additional_info("overlay_frag_output") + .additional_info("overlay_armature_common") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_no_geom) .metal_backend_only(true) @@ -100,7 +108,9 @@ GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_no_geom) .vertex_out(overlay_armature_shape_outline_no_geom_iface) .vertex_source("overlay_armature_shape_outline_vert_no_geom.glsl") .fragment_source("overlay_armature_wire_frag.glsl") - .additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals"); + .additional_info("overlay_frag_output") + .additional_info("overlay_armature_common") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_next) .do_static_compilation(true) @@ -110,19 +120,21 @@ GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_next) .vertex_out(overlay_armature_shape_outline_no_geom_iface) .vertex_source("overlay_armature_shape_outline_next_vert.glsl") .fragment_source("overlay_armature_wire_frag.glsl") - .additional_info("overlay_frag_output", - "overlay_armature_common", - "gpu_index_load", - "draw_globals"); + .additional_info("overlay_frag_output") + .additional_info("overlay_armature_common") + .additional_info("gpu_index_load") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_clipped) .do_static_compilation(true) - .additional_info("overlay_armature_shape_outline", "drw_clipped"); + .additional_info("overlay_armature_shape_outline") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_clipped_no_geom) .metal_backend_only(true) .do_static_compilation(true) - .additional_info("overlay_armature_shape_outline_no_geom", "drw_clipped"); + .additional_info("overlay_armature_shape_outline_no_geom") + .additional_info("drw_clipped"); GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_solid_iface) .smooth(Type::VEC4, "finalColor") @@ -138,11 +150,14 @@ GPU_SHADER_CREATE_INFO(overlay_armature_shape_solid) .vertex_out(overlay_armature_shape_solid_iface) .vertex_source("overlay_armature_shape_solid_vert.glsl") .fragment_source("overlay_armature_shape_solid_frag.glsl") - .additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals"); + .additional_info("overlay_frag_output") + .additional_info("overlay_armature_common") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_armature_shape_solid_clipped) .do_static_compilation(true) - .additional_info("overlay_armature_shape_solid", "drw_clipped"); + .additional_info("overlay_armature_shape_solid") + .additional_info("drw_clipped"); GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_wire_next_iface) .flat(Type::VEC4, "finalColor") @@ -175,11 +190,14 @@ GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire) .geometry_source("overlay_armature_shape_wire_geom.glsl") .fragment_source("overlay_armature_shape_wire_frag.glsl") .typedef_source("overlay_shader_shared.h") - .additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals"); + .additional_info("overlay_frag_output") + .additional_info("overlay_armature_common") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire_clipped) .do_static_compilation(true) - .additional_info("overlay_armature_shape_wire", "drw_clipped"); + .additional_info("overlay_armature_shape_wire") + .additional_info("drw_clipped"); #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire_no_geom) @@ -192,7 +210,9 @@ GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire_no_geom) .vertex_source("overlay_armature_shape_wire_vert_no_geom.glsl") .fragment_source("overlay_armature_wire_frag.glsl") .typedef_source("overlay_shader_shared.h") - .additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals"); + .additional_info("overlay_frag_output") + .additional_info("overlay_armature_common") + .additional_info("draw_globals"); #endif GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire_next) @@ -207,10 +227,10 @@ GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire_next) .vertex_source("overlay_armature_shape_wire_next_vert.glsl") .fragment_source("overlay_armature_shape_wire_frag.glsl") .typedef_source("overlay_shader_shared.h") - .additional_info("overlay_frag_output", - "overlay_armature_common", - "gpu_index_load", - "draw_globals"); + .additional_info("overlay_frag_output") + .additional_info("overlay_armature_common") + .additional_info("gpu_index_load") + .additional_info("draw_globals"); /** \} */ @@ -232,11 +252,14 @@ GPU_SHADER_CREATE_INFO(overlay_armature_envelope_outline) .vertex_out(overlay_armature_wire_iface) .vertex_source("overlay_armature_envelope_outline_vert.glsl") .fragment_source("overlay_armature_wire_frag.glsl") - .additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals"); + .additional_info("overlay_frag_output") + .additional_info("overlay_armature_common") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_armature_envelope_outline_clipped) .do_static_compilation(true) - .additional_info("overlay_armature_envelope_outline", "drw_clipped"); + .additional_info("overlay_armature_envelope_outline") + .additional_info("drw_clipped"); GPU_SHADER_INTERFACE_INFO(overlay_armature_envelope_solid_iface) .flat(Type::VEC3, "finalStateColor") @@ -257,11 +280,13 @@ GPU_SHADER_CREATE_INFO(overlay_armature_envelope_solid) .push_constant(Type::BOOL, "isDistance") .vertex_source("overlay_armature_envelope_solid_vert.glsl") .fragment_source("overlay_armature_envelope_solid_frag.glsl") - .additional_info("overlay_frag_output", "overlay_armature_common"); + .additional_info("overlay_frag_output") + .additional_info("overlay_armature_common"); GPU_SHADER_CREATE_INFO(overlay_armature_envelope_solid_clipped) .do_static_compilation(true) - .additional_info("overlay_armature_envelope_solid", "drw_clipped"); + .additional_info("overlay_armature_envelope_solid") + .additional_info("drw_clipped"); /** \} */ @@ -292,11 +317,14 @@ GPU_SHADER_CREATE_INFO(overlay_armature_stick) .vertex_out(overlay_armature_stick_iface) .vertex_source("overlay_armature_stick_vert.glsl") .fragment_source("overlay_armature_stick_frag.glsl") - .additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals"); + .additional_info("overlay_frag_output") + .additional_info("overlay_armature_common") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_armature_stick_clipped) .do_static_compilation(true) - .additional_info("overlay_armature_stick", "drw_clipped"); + .additional_info("overlay_armature_stick") + .additional_info("drw_clipped"); /** \} */ @@ -314,11 +342,14 @@ GPU_SHADER_CREATE_INFO(overlay_armature_dof) .vertex_out(overlay_armature_wire_iface) .vertex_source("overlay_armature_dof_vert.glsl") .fragment_source("overlay_armature_dof_solid_frag.glsl") - .additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals"); + .additional_info("overlay_frag_output") + .additional_info("overlay_armature_common") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_armature_dof_clipped) .do_static_compilation(true) - .additional_info("overlay_armature_dof", "drw_clipped"); + .additional_info("overlay_armature_dof") + .additional_info("drw_clipped"); /** \} */ @@ -335,10 +366,13 @@ GPU_SHADER_CREATE_INFO(overlay_armature_wire) .vertex_out(overlay_armature_wire_iface) .vertex_source("overlay_armature_wire_vert.glsl") .fragment_source("overlay_armature_wire_frag.glsl") - .additional_info("overlay_frag_output", "draw_mesh", "draw_globals"); + .additional_info("overlay_frag_output") + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_armature_wire_clipped) .do_static_compilation(true) - .additional_info("overlay_armature_wire", "drw_clipped"); + .additional_info("overlay_armature_wire") + .additional_info("drw_clipped"); /** \} */ diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_background_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_background_info.hh index 44774e24ebc..ab179baf277 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_background_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_background_info.hh @@ -13,7 +13,8 @@ GPU_SHADER_CREATE_INFO(overlay_background) .push_constant(Type::VEC4, "colorOverride") .fragment_source("overlay_background_frag.glsl") .fragment_out(0, Type::VEC4, "fragColor") - .additional_info("draw_fullscreen", "draw_globals"); + .additional_info("draw_fullscreen") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_clipbound) .do_static_compilation(true) diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh index 82f39ec5f3f..f6ab857a1ae 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh @@ -51,7 +51,8 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_depth) GPU_SHADER_CREATE_INFO(overlay_edit_mesh_depth_clipped) .do_static_compilation(true) - .additional_info("overlay_edit_mesh_depth", "drw_clipped"); + .additional_info("overlay_edit_mesh_depth") + .additional_info("drw_clipped"); GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_vert_iface) .smooth(Type::VEC4, "finalColor") @@ -67,7 +68,8 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_vert) .vertex_source("overlay_edit_mesh_vert.glsl") .vertex_out(overlay_edit_mesh_vert_iface) .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_modelmat", "overlay_edit_mesh_common"); + .additional_info("draw_modelmat") + .additional_info("overlay_edit_mesh_common"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_vert_next) .do_static_compilation(true) @@ -79,10 +81,10 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_vert_next) .vertex_source("overlay_edit_mesh_vertex_vert.glsl") .vertex_out(overlay_edit_mesh_vert_iface) .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_view", - "draw_modelmat_new", - "draw_resource_handle_new", - "overlay_edit_mesh_common"); + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new") + .additional_info("overlay_edit_mesh_common"); GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_mesh_edge_iface, geometry_in) .smooth(Type::VEC4, "finalColor_") @@ -112,7 +114,8 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge) .geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) .geometry_source("overlay_edit_mesh_geom.glsl") .fragment_source("overlay_edit_mesh_frag.glsl") - .additional_info("draw_modelmat", "overlay_edit_mesh_common"); + .additional_info("draw_modelmat") + .additional_info("overlay_edit_mesh_common"); /* The Non-Geometry shader variant passes directly to fragment. */ #ifdef WITH_METAL_BACKEND @@ -128,7 +131,8 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_no_geom) .vertex_out(overlay_edit_mesh_edge_geom_flat_iface) .vertex_out(overlay_edit_mesh_edge_geom_noperspective_iface) .fragment_source("overlay_edit_mesh_frag.glsl") - .additional_info("draw_modelmat", "overlay_edit_mesh_common_no_geom"); + .additional_info("draw_modelmat") + .additional_info("overlay_edit_mesh_common_no_geom"); #endif /* Vertex Pull version for overlay next. */ @@ -148,11 +152,11 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_next) .vertex_out(overlay_edit_mesh_edge_geom_noperspective_iface) .vertex_source("overlay_edit_mesh_edge_vert.glsl") .fragment_source("overlay_edit_mesh_frag.glsl") - .additional_info("draw_view", - "draw_modelmat_new", - "draw_resource_handle_new", - "gpu_index_load", - "overlay_edit_mesh_common"); + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new") + .additional_info("gpu_index_load") + .additional_info("overlay_edit_mesh_common"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_flat) .do_static_compilation(true) @@ -175,7 +179,8 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_face) .vertex_source("overlay_edit_mesh_vert.glsl") .vertex_out(overlay_edit_flat_color_iface) .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_modelmat", "overlay_edit_mesh_common"); + .additional_info("draw_modelmat") + .additional_info("overlay_edit_mesh_common"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_face_next) .do_static_compilation(true) @@ -186,10 +191,10 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_face_next) .vertex_source("overlay_edit_mesh_face_vert.glsl") .vertex_out(overlay_edit_flat_color_iface) .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_view", - "draw_modelmat_new", - "draw_resource_handle_new", - "overlay_edit_mesh_common"); + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new") + .additional_info("overlay_edit_mesh_common"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_facedot) .do_static_compilation(true) @@ -201,7 +206,8 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_facedot) .vertex_source("overlay_edit_mesh_vert.glsl") .vertex_out(overlay_edit_flat_color_iface) .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_modelmat", "overlay_edit_mesh_common"); + .additional_info("draw_modelmat") + .additional_info("overlay_edit_mesh_common"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_facedot_next) .do_static_compilation(true) @@ -213,10 +219,10 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_facedot_next) .vertex_source("overlay_edit_mesh_facedot_vert.glsl") .vertex_out(overlay_edit_flat_color_iface) .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_view", - "draw_modelmat_new", - "draw_resource_handle_new", - "overlay_edit_mesh_common"); + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new") + .additional_info("overlay_edit_mesh_common"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_normal) .do_static_compilation(true) @@ -237,7 +243,8 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_normal) .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_edit_mesh_normal_vert.glsl") .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_modelmat_instanced_attr", "draw_globals"); + .additional_info("draw_modelmat_instanced_attr") + .additional_info("draw_globals"); GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_analysis_iface).smooth(Type::VEC4, "weightColor"); @@ -261,53 +268,64 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_skin_root) .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_edit_mesh_skin_root_vert.glsl") .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_modelmat_instanced_attr", "draw_globals"); + .additional_info("draw_modelmat_instanced_attr") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_vert_clipped) .do_static_compilation(true) - .additional_info("overlay_edit_mesh_vert", "drw_clipped"); + .additional_info("overlay_edit_mesh_vert") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_clipped) .do_static_compilation(true) - .additional_info("overlay_edit_mesh_edge", "drw_clipped"); + .additional_info("overlay_edit_mesh_edge") + .additional_info("drw_clipped"); #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_clipped_no_geom) .metal_backend_only(true) .do_static_compilation(true) - .additional_info("overlay_edit_mesh_edge_no_geom", "drw_clipped"); + .additional_info("overlay_edit_mesh_edge_no_geom") + .additional_info("drw_clipped"); #endif GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_flat_clipped) .do_static_compilation(true) - .additional_info("overlay_edit_mesh_edge_flat", "drw_clipped"); + .additional_info("overlay_edit_mesh_edge_flat") + .additional_info("drw_clipped"); #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_flat_clipped_no_geom) .metal_backend_only(true) .do_static_compilation(true) - .additional_info("overlay_edit_mesh_edge_flat_no_geom", "drw_clipped"); + .additional_info("overlay_edit_mesh_edge_flat_no_geom") + .additional_info("drw_clipped"); #endif GPU_SHADER_CREATE_INFO(overlay_edit_mesh_face_clipped) .do_static_compilation(true) - .additional_info("overlay_edit_mesh_face", "drw_clipped"); + .additional_info("overlay_edit_mesh_face") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_facedot_clipped) .do_static_compilation(true) - .additional_info("overlay_edit_mesh_facedot", "drw_clipped"); + .additional_info("overlay_edit_mesh_facedot") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_normal_clipped) .do_static_compilation(true) - .additional_info("overlay_edit_mesh_normal", "drw_clipped"); + .additional_info("overlay_edit_mesh_normal") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_analysis_clipped) .do_static_compilation(true) - .additional_info("overlay_edit_mesh_analysis", "drw_clipped"); + .additional_info("overlay_edit_mesh_analysis") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_skin_root_clipped) .do_static_compilation(true) - .additional_info("overlay_edit_mesh_skin_root", "drw_clipped"); + .additional_info("overlay_edit_mesh_skin_root") + .additional_info("drw_clipped"); /** \} */ @@ -339,7 +357,8 @@ GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges_common) .push_constant(Type::FLOAT, "dashLength") .fragment_out(0, Type::VEC4, "fragColor") .fragment_source("overlay_edit_uv_edges_frag.glsl") - .additional_info("draw_mesh", "draw_globals"); + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges) .additional_info("overlay_edit_uv_edges_common") @@ -391,11 +410,11 @@ GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges_next) .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_edit_uv_edges_next_vert.glsl") .fragment_source("overlay_edit_uv_edges_next_frag.glsl") - .additional_info("draw_view", - "draw_modelmat_new", - "draw_resource_handle_new", - "gpu_index_load", - "draw_globals"); + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new") + .additional_info("gpu_index_load") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_uv_faces) .do_static_compilation(true) @@ -406,7 +425,8 @@ GPU_SHADER_CREATE_INFO(overlay_edit_uv_faces) .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_edit_uv_faces_vert.glsl") .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_mesh", "draw_globals"); + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_uv_face_dots) .do_static_compilation(true) @@ -417,7 +437,8 @@ GPU_SHADER_CREATE_INFO(overlay_edit_uv_face_dots) .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_edit_uv_face_dots_vert.glsl") .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_mesh", "draw_globals"); + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_INTERFACE_INFO(overlay_edit_uv_vert_iface) .smooth(Type::VEC4, "fillColor") @@ -435,7 +456,8 @@ GPU_SHADER_CREATE_INFO(overlay_edit_uv_verts) .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_edit_uv_verts_vert.glsl") .fragment_source("overlay_edit_uv_verts_frag.glsl") - .additional_info("draw_mesh", "draw_globals"); + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_uv_tiled_image_borders) .do_static_compilation(true) @@ -493,14 +515,18 @@ GPU_SHADER_CREATE_INFO(overlay_edit_uv_stretching_area) .do_static_compilation(true) .vertex_in(1, Type::FLOAT, "ratio") .push_constant(Type::FLOAT, "totalAreaRatio") - .additional_info("overlay_edit_uv_stretching", "draw_mesh", "draw_globals"); + .additional_info("overlay_edit_uv_stretching") + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_uv_stretching_angle) .do_static_compilation(true) .define("STRETCH_ANGLE") .vertex_in(1, Type::VEC2, "uv_angles") .vertex_in(2, Type::FLOAT, "angle") - .additional_info("overlay_edit_uv_stretching", "draw_mesh", "draw_globals"); + .additional_info("overlay_edit_uv_stretching") + .additional_info("draw_mesh") + .additional_info("draw_globals"); /** \} */ @@ -524,7 +550,8 @@ GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle) .vertex_source("overlay_edit_curve_handle_vert.glsl") .geometry_source("overlay_edit_curve_handle_geom.glsl") .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_mesh", "draw_globals"); + .additional_info("draw_mesh") + .additional_info("draw_globals"); #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_no_geom) @@ -541,7 +568,8 @@ GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_no_geom) .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_edit_curve_handle_vert_no_geom.glsl") .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_mesh", "draw_globals"); + .additional_info("draw_mesh") + .additional_info("draw_globals"); #endif GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_next) @@ -557,21 +585,23 @@ GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_next) .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_edit_curve_handle_next_vert.glsl") .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_view", - "draw_modelmat_new", - "draw_resource_handle_new", - "gpu_index_load", - "draw_globals"); + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new") + .additional_info("gpu_index_load") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_clipped) .do_static_compilation(true) - .additional_info("overlay_edit_curve_handle", "drw_clipped"); + .additional_info("overlay_edit_curve_handle") + .additional_info("drw_clipped"); #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_clipped_no_geom) .metal_backend_only(true) .do_static_compilation(true) - .additional_info("overlay_edit_curve_handle_no_geom", "drw_clipped"); + .additional_info("overlay_edit_curve_handle_no_geom") + .additional_info("drw_clipped"); #endif GPU_SHADER_CREATE_INFO(overlay_edit_curve_point) @@ -585,11 +615,13 @@ GPU_SHADER_CREATE_INFO(overlay_edit_curve_point) .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_edit_curve_point_vert.glsl") .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_mesh", "draw_globals"); + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_curve_point_clipped) .do_static_compilation(true) - .additional_info("overlay_edit_curve_point", "drw_clipped"); + .additional_info("overlay_edit_curve_point") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_edit_curve_wire) .do_static_compilation(true) @@ -602,11 +634,14 @@ GPU_SHADER_CREATE_INFO(overlay_edit_curve_wire) .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_edit_curve_wire_vert.glsl") .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_modelmat", "draw_resource_id_uniform", "draw_globals"); + .additional_info("draw_modelmat") + .additional_info("draw_resource_id_uniform") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_curve_wire_clipped) .do_static_compilation(true) - .additional_info("overlay_edit_curve_wire", "drw_clipped"); + .additional_info("overlay_edit_curve_wire") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_edit_curve_normals) .do_static_compilation(true) @@ -624,11 +659,11 @@ GPU_SHADER_CREATE_INFO(overlay_edit_curve_normals) .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_edit_curve_wire_next_vert.glsl") .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_view", - "draw_modelmat_new", - "draw_resource_handle_new", - "gpu_index_load", - "draw_globals"); + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new") + .additional_info("gpu_index_load") + .additional_info("draw_globals"); /** \} */ @@ -651,11 +686,13 @@ GPU_SHADER_CREATE_INFO(overlay_edit_curves_handle) .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_edit_curves_handle_vert.glsl") .fragment_source("overlay_edit_curves_handle_frag.glsl") - .additional_info("draw_mesh", "draw_globals"); + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_curves_handle_clipped) .do_static_compilation(true) - .additional_info("overlay_edit_curves_handle", "drw_clipped"); + .additional_info("overlay_edit_curves_handle") + .additional_info("drw_clipped"); /** \} */ @@ -671,11 +708,13 @@ GPU_SHADER_CREATE_INFO(overlay_edit_lattice_point) .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_edit_lattice_point_vert.glsl") .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_mesh", "draw_globals"); + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_lattice_point_clipped) .do_static_compilation(true) - .additional_info("overlay_edit_lattice_point", "drw_clipped"); + .additional_info("overlay_edit_lattice_point") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_edit_lattice_wire) .do_static_compilation(true) @@ -686,11 +725,13 @@ GPU_SHADER_CREATE_INFO(overlay_edit_lattice_wire) .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_edit_lattice_wire_vert.glsl") .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_mesh", "draw_globals"); + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_lattice_wire_clipped) .do_static_compilation(true) - .additional_info("overlay_edit_lattice_wire", "drw_clipped"); + .additional_info("overlay_edit_lattice_wire") + .additional_info("drw_clipped"); /** \} */ @@ -709,11 +750,13 @@ GPU_SHADER_CREATE_INFO(overlay_edit_particle_strand) .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_edit_particle_strand_vert.glsl") .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_mesh", "draw_globals"); + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_particle_strand_clipped) .do_static_compilation(true) - .additional_info("overlay_edit_particle_strand", "drw_clipped"); + .additional_info("overlay_edit_particle_strand") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_edit_particle_point) .do_static_compilation(true) @@ -726,11 +769,13 @@ GPU_SHADER_CREATE_INFO(overlay_edit_particle_point) .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_edit_particle_point_vert.glsl") .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_mesh", "draw_globals"); + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_particle_point_clipped) .do_static_compilation(true) - .additional_info("overlay_edit_particle_point", "drw_clipped"); + .additional_info("overlay_edit_particle_point") + .additional_info("drw_clipped"); /** \} */ @@ -754,7 +799,8 @@ GPU_SHADER_CREATE_INFO(overlay_edit_gpencil) .sampler(0, ImageType::FLOAT_1D, "weightTex") .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_edit_gpencil_vert.glsl") - .additional_info("draw_mesh", "draw_globals"); + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_wire) .do_static_compilation(true) @@ -764,7 +810,8 @@ GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_wire) GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_wire_clipped) .do_static_compilation(true) - .additional_info("overlay_edit_gpencil_wire", "drw_clipped"); + .additional_info("overlay_edit_gpencil_wire") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_point) .do_static_compilation(true) @@ -775,7 +822,8 @@ GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_point) GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_point_clipped) .do_static_compilation(true) - .additional_info("overlay_edit_gpencil_point", "drw_clipped"); + .additional_info("overlay_edit_gpencil_point") + .additional_info("drw_clipped"); /* TODO(fclem): Refactor this to take list of point instead of drawing 1 point per drawcall. */ GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_guide_point) @@ -789,11 +837,13 @@ GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_guide_point) .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_edit_gpencil_guide_vert.glsl") .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_mesh", "draw_globals"); + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_guide_point_clipped) .do_static_compilation(true) - .additional_info("overlay_edit_gpencil_guide_point", "drw_clipped"); + .additional_info("overlay_edit_gpencil_guide_point") + .additional_info("drw_clipped"); /** \} */ @@ -812,14 +862,18 @@ GPU_SHADER_CREATE_INFO(overlay_depth_only) GPU_SHADER_CREATE_INFO(overlay_depth_only_clipped) .do_static_compilation(true) - .additional_info("overlay_depth_only", "drw_clipped"); + .additional_info("overlay_depth_only") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_depth_mesh) .do_static_compilation(true) .vertex_in(0, Type::VEC3, "pos") .vertex_source("basic_depth_vert.glsl") .fragment_source("overlay_depth_only_frag.glsl") - .additional_info("draw_globals", "draw_view", "draw_modelmat_new", "draw_resource_handle_new"); + .additional_info("draw_globals") + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new"); GPU_SHADER_CREATE_INFO(overlay_depth_mesh_conservative) .do_static_compilation(true) @@ -827,11 +881,11 @@ GPU_SHADER_CREATE_INFO(overlay_depth_mesh_conservative) .push_constant(Type::IVEC2, "gpu_attr_0") .vertex_source("overlay_depth_only_mesh_conservative_vert.glsl") .fragment_source("overlay_depth_only_frag.glsl") - .additional_info("draw_globals", - "draw_view", - "draw_modelmat_new", - "gpu_index_load", - "draw_resource_handle_new"); + .additional_info("draw_globals") + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("gpu_index_load") + .additional_info("draw_resource_handle_new"); GPU_SHADER_NAMED_INTERFACE_INFO(overlay_depth_only_gpencil_flat_iface, gp_interp_flat) .flat(Type::VEC2, "aspect") @@ -851,32 +905,32 @@ GPU_SHADER_CREATE_INFO(overlay_depth_gpencil) .depth_write(DepthWrite::ANY) .push_constant(Type::BOOL, "gpStrokeOrder3d") /* TODO(fclem): Move to a GPencil object UBO. */ .push_constant(Type::VEC4, "gpDepthPlane") /* TODO(fclem): Move to a GPencil object UBO. */ - .additional_info("draw_view", - "draw_modelmat_new", - "draw_resource_handle_new", - "draw_globals", - "draw_gpencil_new", - "draw_object_infos_new"); + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new") + .additional_info("draw_globals") + .additional_info("draw_gpencil_new") + .additional_info("draw_object_infos_new"); GPU_SHADER_CREATE_INFO(overlay_depth_pointcloud) .do_static_compilation(true) .vertex_source("basic_depth_pointcloud_vert.glsl") .fragment_source("overlay_depth_only_frag.glsl") - .additional_info("draw_pointcloud_new", - "draw_globals", - "draw_view", - "draw_modelmat_new", - "draw_resource_handle_new"); + .additional_info("draw_pointcloud_new") + .additional_info("draw_globals") + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new"); GPU_SHADER_CREATE_INFO(overlay_depth_curves) .do_static_compilation(true) .vertex_source("basic_depth_curves_vert.glsl") .fragment_source("overlay_depth_only_frag.glsl") - .additional_info("draw_hair_new", - "draw_globals", - "draw_view", - "draw_modelmat_new", - "draw_resource_handle_new"); + .additional_info("draw_hair_new") + .additional_info("draw_globals") + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new"); /** \} */ @@ -903,10 +957,12 @@ GPU_SHADER_CREATE_INFO(overlay_uniform_color_pointcloud) GPU_SHADER_CREATE_INFO(overlay_uniform_color_clipped) .do_static_compilation(true) - .additional_info("overlay_uniform_color", "drw_clipped"); + .additional_info("overlay_uniform_color") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_uniform_color_pointcloud_clipped) .do_static_compilation(true) - .additional_info("overlay_uniform_color_pointcloud", "drw_clipped"); + .additional_info("overlay_uniform_color_pointcloud") + .additional_info("drw_clipped"); /** \} */ diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_extra_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_extra_info.hh index 234e1a27083..bc7269ed9ea 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_extra_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_extra_info.hh @@ -26,7 +26,8 @@ GPU_SHADER_CREATE_INFO(overlay_extra) .fragment_out(1, Type::VEC4, "lineOutput") .vertex_source("overlay_extra_vert.glsl") .fragment_source("overlay_extra_frag.glsl") - .additional_info("draw_view", "draw_globals"); + .additional_info("draw_view") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_extra_select) .do_static_compilation(true) @@ -35,11 +36,13 @@ GPU_SHADER_CREATE_INFO(overlay_extra_select) GPU_SHADER_CREATE_INFO(overlay_extra_clipped) .do_static_compilation(true) - .additional_info("overlay_extra", "drw_clipped"); + .additional_info("overlay_extra") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_extra_select_clipped) .do_static_compilation(true) - .additional_info("overlay_extra_select", "drw_clipped"); + .additional_info("overlay_extra_select") + .additional_info("drw_clipped"); /** \} */ @@ -58,11 +61,13 @@ GPU_SHADER_CREATE_INFO(overlay_extra_grid) .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_extra_lightprobe_grid_vert.glsl") .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_view", "draw_globals"); + .additional_info("draw_view") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_extra_grid_clipped) .do_static_compilation(true) - .additional_info("overlay_extra_grid", "drw_clipped"); + .additional_info("overlay_extra_grid") + .additional_info("drw_clipped"); /** \} */ @@ -80,11 +85,13 @@ GPU_SHADER_CREATE_INFO(overlay_extra_groundline) .fragment_out(1, Type::VEC4, "lineOutput") .vertex_source("overlay_extra_groundline_vert.glsl") .fragment_source("overlay_extra_frag.glsl") - .additional_info("draw_view", "draw_globals"); + .additional_info("draw_view") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_extra_groundline_clipped) .do_static_compilation(true) - .additional_info("overlay_extra_groundline", "drw_clipped"); + .additional_info("overlay_extra_groundline") + .additional_info("drw_clipped"); /** \} */ @@ -108,7 +115,8 @@ GPU_SHADER_CREATE_INFO(overlay_extra_wire) .fragment_out(1, Type::VEC4, "lineOutput") .vertex_source("overlay_extra_wire_vert.glsl") .fragment_source("overlay_extra_wire_frag.glsl") - .additional_info("draw_modelmat", "draw_globals"); + .additional_info("draw_modelmat") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_extra_wire_select) .do_static_compilation(true) @@ -122,15 +130,18 @@ GPU_SHADER_CREATE_INFO(overlay_extra_wire_object) GPU_SHADER_CREATE_INFO(overlay_extra_wire_select_clipped) .do_static_compilation(true) - .additional_info("overlay_extra_wire_select", "drw_clipped"); + .additional_info("overlay_extra_wire_select") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_extra_wire_object_clipped) .do_static_compilation(true) - .additional_info("overlay_extra_wire_object", "drw_clipped"); + .additional_info("overlay_extra_wire_object") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_extra_wire_clipped) .do_static_compilation(true) - .additional_info("overlay_extra_wire", "drw_clipped"); + .additional_info("overlay_extra_wire") + .additional_info("drw_clipped"); /** \} */ @@ -153,11 +164,13 @@ GPU_SHADER_CREATE_INFO(overlay_extra_point) .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_extra_point_vert.glsl") .fragment_source("overlay_point_varying_color_varying_outline_aa_frag.glsl") - .additional_info("draw_modelmat", "draw_globals"); + .additional_info("draw_modelmat") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_extra_point_clipped) .do_static_compilation(true) - .additional_info("overlay_extra_point", "drw_clipped"); + .additional_info("overlay_extra_point") + .additional_info("drw_clipped"); GPU_SHADER_INTERFACE_INFO(overlay_extra_loose_point_iface).smooth(Type::VEC4, "finalColor"); @@ -170,11 +183,13 @@ GPU_SHADER_CREATE_INFO(overlay_extra_loose_point) .fragment_out(1, Type::VEC4, "lineOutput") .vertex_source("overlay_extra_loose_point_vert.glsl") .fragment_source("overlay_extra_loose_point_frag.glsl") - .additional_info("draw_modelmat", "draw_globals"); + .additional_info("draw_modelmat") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_extra_loose_point_clipped) .do_static_compilation(true) - .additional_info("overlay_extra_loose_point", "drw_clipped"); + .additional_info("overlay_extra_loose_point") + .additional_info("drw_clipped"); /** \} */ @@ -204,7 +219,8 @@ GPU_SHADER_CREATE_INFO(overlay_motion_path_line) .vertex_source("overlay_motion_path_line_vert.glsl") .geometry_source("overlay_motion_path_line_geom.glsl") .fragment_source("overlay_motion_path_line_frag.glsl") - .additional_info("draw_view", "draw_globals"); + .additional_info("draw_view") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_motion_path_line_no_geom) .metal_backend_only(true) @@ -219,7 +235,8 @@ GPU_SHADER_CREATE_INFO(overlay_motion_path_line_no_geom) .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_motion_path_line_vert_no_geom.glsl") .fragment_source("overlay_motion_path_line_frag.glsl") - .additional_info("draw_view", "draw_globals"); + .additional_info("draw_view") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_motion_path_line_next) .do_static_compilation(true) @@ -235,16 +252,20 @@ GPU_SHADER_CREATE_INFO(overlay_motion_path_line_next) .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_motion_path_line_next_vert.glsl") .fragment_source("overlay_motion_path_line_frag.glsl") - .additional_info("draw_view", "gpu_index_load", "draw_globals"); + .additional_info("draw_view") + .additional_info("gpu_index_load") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_motion_path_line_clipped) .do_static_compilation(true) - .additional_info("overlay_motion_path_line", "drw_clipped"); + .additional_info("overlay_motion_path_line") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_motion_path_line_clipped_no_geom) .metal_backend_only(true) .do_static_compilation(true) - .additional_info("overlay_motion_path_line_no_geom", "drw_clipped"); + .additional_info("overlay_motion_path_line_no_geom") + .additional_info("drw_clipped"); GPU_SHADER_INTERFACE_INFO(overlay_motion_path_point_iface).flat(Type::VEC4, "finalColor"); @@ -262,11 +283,13 @@ GPU_SHADER_CREATE_INFO(overlay_motion_path_point) .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_motion_path_point_vert.glsl") .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_view", "draw_globals"); + .additional_info("draw_view") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_motion_path_point_clipped) .do_static_compilation(true) - .additional_info("overlay_motion_path_point", "drw_clipped"); + .additional_info("overlay_motion_path_point") + .additional_info("drw_clipped"); /** \} */ @@ -293,7 +316,8 @@ GPU_SHADER_CREATE_INFO(overlay_image) GPU_SHADER_CREATE_INFO(overlay_image_clipped) .do_static_compilation(true) - .additional_info("overlay_image", "drw_clipped"); + .additional_info("overlay_image") + .additional_info("drw_clipped"); /** \} */ @@ -313,11 +337,13 @@ GPU_SHADER_CREATE_INFO(overlay_gpencil_canvas) .fragment_out(1, Type::VEC4, "lineOutput") .vertex_source("overlay_edit_gpencil_canvas_vert.glsl") .fragment_source("overlay_extra_frag.glsl") - .additional_info("draw_mesh", "draw_globals"); + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_gpencil_canvas_clipped) .do_static_compilation(true) - .additional_info("overlay_gpencil_canvas", "drw_clipped"); + .additional_info("overlay_gpencil_canvas") + .additional_info("drw_clipped"); /** \} */ @@ -345,11 +371,13 @@ GPU_SHADER_CREATE_INFO(overlay_particle_dot) .fragment_out(0, Type::VEC4, "fragColor") .fragment_out(1, Type::VEC4, "lineOutput") .fragment_source("overlay_particle_frag.glsl") - .additional_info("overlay_particle", "draw_mesh"); + .additional_info("overlay_particle") + .additional_info("draw_mesh"); GPU_SHADER_CREATE_INFO(overlay_particle_dot_clipped) .do_static_compilation(true) - .additional_info("overlay_particle_dot", "drw_clipped"); + .additional_info("overlay_particle_dot") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_particle_shape) .do_static_compilation(true) @@ -358,7 +386,9 @@ GPU_SHADER_CREATE_INFO(overlay_particle_shape) .vertex_in(4, Type::INT, "vclass") .fragment_out(0, Type::VEC4, "fragColor") .fragment_source("overlay_varying_color.glsl") - .additional_info("overlay_particle", "draw_modelmat", "draw_resource_id_uniform"); + .additional_info("overlay_particle") + .additional_info("draw_modelmat") + .additional_info("draw_resource_id_uniform"); GPU_SHADER_CREATE_INFO(overlay_particle_shape_next) .do_static_compilation(true) @@ -373,7 +403,10 @@ GPU_SHADER_CREATE_INFO(overlay_particle_shape_next) .fragment_out(1, Type::VEC4, "lineOutput") .vertex_source("overlay_particle_shape_vert.glsl") .fragment_source("overlay_particle_shape_frag.glsl") - .additional_info("draw_view", "draw_modelmat_new", "draw_resource_handle_new", "draw_globals"); + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_particle_hair_next) .do_static_compilation(true) @@ -388,14 +421,15 @@ GPU_SHADER_CREATE_INFO(overlay_particle_hair_next) .fragment_out(1, Type::VEC4, "lineOutput") .vertex_source("overlay_particle_hair_vert.glsl") .fragment_source("overlay_particle_shape_frag.glsl") - .additional_info("draw_view", - "draw_modelmat_new", - "draw_object_infos_new", - "draw_resource_handle_new", - "draw_globals"); + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_object_infos_new") + .additional_info("draw_resource_handle_new") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_particle_shape_clipped) .do_static_compilation(true) - .additional_info("overlay_particle_shape", "drw_clipped"); + .additional_info("overlay_particle_shape") + .additional_info("drw_clipped"); /** \} */ diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_facing_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_facing_info.hh index 075b82017e8..a37d8d764ea 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_facing_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_facing_info.hh @@ -10,8 +10,10 @@ GPU_SHADER_CREATE_INFO(overlay_facing) .vertex_source("overlay_facing_vert.glsl") .fragment_source("overlay_facing_frag.glsl") .fragment_out(0, Type::VEC4, "fragColor") - .additional_info("draw_mesh", "draw_globals"); + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_facing_clipped) .do_static_compilation(true) - .additional_info("overlay_facing", "drw_clipped"); + .additional_info("overlay_facing") + .additional_info("drw_clipped"); diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_grid_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_grid_info.hh index 1497bf1ffaa..2424f7298f2 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_grid_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_grid_info.hh @@ -19,7 +19,8 @@ GPU_SHADER_CREATE_INFO(overlay_grid) .push_constant(Type::INT, "grid_flag") .vertex_source("overlay_grid_vert.glsl") .fragment_source("overlay_grid_frag.glsl") - .additional_info("draw_view", "draw_globals"); + .additional_info("draw_view") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_grid_background) .do_static_compilation(true) diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_outline_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_outline_info.hh index b57f2899653..3ef4afbed4b 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_outline_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_outline_info.hh @@ -22,31 +22,37 @@ GPU_SHADER_CREATE_INFO(overlay_outline_prepass_mesh) .do_static_compilation(true) .vertex_in(0, Type::VEC3, "pos") .vertex_source("overlay_outline_prepass_vert.glsl") - .additional_info("draw_mesh", "draw_resource_handle", "overlay_outline_prepass") + .additional_info("draw_mesh") + .additional_info("draw_resource_handle") + .additional_info("overlay_outline_prepass") .additional_info("draw_object_infos"); GPU_SHADER_CREATE_INFO(overlay_outline_prepass_mesh_clipped) .do_static_compilation(true) - .additional_info("overlay_outline_prepass_mesh", "drw_clipped"); + .additional_info("overlay_outline_prepass_mesh") + .additional_info("drw_clipped"); GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_wire_iface, vert).flat(Type::VEC3, "pos"); GPU_SHADER_CREATE_INFO(overlay_outline_prepass_curves) .do_static_compilation(true) .vertex_source("overlay_outline_prepass_curves_vert.glsl") - .additional_info("draw_hair", "draw_resource_handle", "overlay_outline_prepass") + .additional_info("draw_hair") + .additional_info("draw_resource_handle") + .additional_info("overlay_outline_prepass") .additional_info("draw_object_infos"); GPU_SHADER_CREATE_INFO(overlay_outline_prepass_curves_clipped) .do_static_compilation(true) - .additional_info("overlay_outline_prepass_curves", "drw_clipped"); + .additional_info("overlay_outline_prepass_curves") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_outline_prepass_wire) .do_static_compilation(true) - .additional_info("overlay_outline_prepass", - "draw_object_infos", - "draw_mesh", - "draw_resource_handle") + .additional_info("overlay_outline_prepass") + .additional_info("draw_object_infos") + .additional_info("draw_mesh") + .additional_info("draw_resource_handle") .vertex_in(0, Type::VEC3, "pos") .define("USE_GEOM") .vertex_out(overlay_outline_prepass_wire_iface) @@ -57,12 +63,12 @@ GPU_SHADER_CREATE_INFO(overlay_outline_prepass_wire) GPU_SHADER_CREATE_INFO(overlay_outline_prepass_wire_next) .do_static_compilation(true) - .additional_info("overlay_outline_prepass", - "draw_view", - "draw_mesh_new", - "draw_object_infos_new", - "draw_resource_handle_new", - "gpu_index_load") + .additional_info("overlay_outline_prepass") + .additional_info("draw_view") + .additional_info("draw_mesh_new") + .additional_info("draw_object_infos_new") + .additional_info("draw_resource_handle_new") + .additional_info("gpu_index_load") .storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY) .push_constant(Type::IVEC2, "gpu_attr_0") .vertex_source("overlay_outline_prepass_wire_vert.glsl"); @@ -71,15 +77,16 @@ GPU_SHADER_CREATE_INFO(overlay_outline_prepass_wire_no_geom) .metal_backend_only(true) .do_static_compilation(true) .vertex_in(0, Type::VEC3, "pos") - .additional_info("overlay_outline_prepass", - "draw_object_infos", - "draw_mesh", - "draw_resource_handle") + .additional_info("overlay_outline_prepass") + .additional_info("draw_object_infos") + .additional_info("draw_mesh") + .additional_info("draw_resource_handle") .vertex_source("overlay_outline_prepass_vert_no_geom.glsl"); GPU_SHADER_CREATE_INFO(overlay_outline_prepass_wire_clipped) .do_static_compilation(true) - .additional_info("overlay_outline_prepass_wire", "drw_clipped"); + .additional_info("overlay_outline_prepass_wire") + .additional_info("drw_clipped"); GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_gpencil_flat_iface, gp_interp_flat) .flat(Type::VEC2, "aspect") @@ -102,21 +109,27 @@ GPU_SHADER_CREATE_INFO(overlay_outline_prepass_gpencil) .fragment_out(0, Type::UINT, "out_object_id") .fragment_source("overlay_outline_prepass_gpencil_frag.glsl") .depth_write(DepthWrite::ANY) - .additional_info("draw_gpencil", "draw_resource_handle", "draw_globals"); + .additional_info("draw_gpencil") + .additional_info("draw_resource_handle") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_outline_prepass_gpencil_clipped) .do_static_compilation(true) - .additional_info("overlay_outline_prepass_gpencil", "drw_clipped"); + .additional_info("overlay_outline_prepass_gpencil") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_outline_prepass_pointcloud) .do_static_compilation(true) .vertex_source("overlay_outline_prepass_pointcloud_vert.glsl") - .additional_info("draw_pointcloud", "draw_resource_handle", "overlay_outline_prepass") + .additional_info("draw_pointcloud") + .additional_info("draw_resource_handle") + .additional_info("overlay_outline_prepass") .additional_info("draw_object_infos"); GPU_SHADER_CREATE_INFO(overlay_outline_prepass_pointcloud_clipped) .do_static_compilation(true) - .additional_info("overlay_outline_prepass_pointcloud", "drw_clipped"); + .additional_info("overlay_outline_prepass_pointcloud") + .additional_info("drw_clipped"); /** \} */ @@ -136,6 +149,8 @@ GPU_SHADER_CREATE_INFO(overlay_outline_detect) .fragment_out(0, Type::VEC4, "fragColor") .fragment_out(1, Type::VEC4, "lineOutput") .fragment_source("overlay_outline_detect_frag.glsl") - .additional_info("draw_fullscreen", "draw_view", "draw_globals"); + .additional_info("draw_fullscreen") + .additional_info("draw_view") + .additional_info("draw_globals"); /** \} */ diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_paint_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_paint_info.hh index 1700a2fe0b2..aa82105c6ef 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_paint_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_paint_info.hh @@ -43,7 +43,8 @@ GPU_SHADER_CREATE_INFO(overlay_paint_point) .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_paint_point_vert.glsl") .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_modelmat", "draw_globals"); + .additional_info("draw_modelmat") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_paint_point_clipped) .additional_info("overlay_paint_point") @@ -132,7 +133,8 @@ GPU_SHADER_CREATE_INFO(overlay_paint_weight) .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_paint_weight_vert.glsl") .fragment_source("overlay_paint_weight_frag.glsl") - .additional_info("draw_modelmat", "draw_globals"); + .additional_info("draw_modelmat") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_paint_weight_fake_shading) .additional_info("overlay_paint_weight") @@ -170,7 +172,8 @@ GPU_SHADER_CREATE_INFO(overlay_paint_wire) .fragment_out(0, Type::VEC4, "fragColor") .vertex_source("overlay_paint_wire_vert.glsl") .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_modelmat", "draw_globals"); + .additional_info("draw_modelmat") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_paint_wire_clipped) .additional_info("overlay_paint_vertcol") diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_curves_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_curves_info.hh index c355748b72a..75d79357c93 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_curves_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_curves_info.hh @@ -16,11 +16,13 @@ GPU_SHADER_CREATE_INFO(overlay_sculpt_curves_selection) .vertex_source("overlay_sculpt_curves_selection_vert.glsl") .fragment_source("overlay_sculpt_curves_selection_frag.glsl") .fragment_out(0, Type::VEC4, "out_color") - .additional_info("draw_hair", "draw_globals"); + .additional_info("draw_hair") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_sculpt_curves_selection_clipped) .do_static_compilation(true) - .additional_info("overlay_sculpt_curves_selection", "drw_clipped"); + .additional_info("overlay_sculpt_curves_selection") + .additional_info("drw_clipped"); GPU_SHADER_INTERFACE_INFO(overlay_sculpt_curves_cage_iface) .no_perspective(Type::VEC2, "edgePos") @@ -37,8 +39,11 @@ GPU_SHADER_CREATE_INFO(overlay_sculpt_curves_cage) .push_constant(Type::FLOAT, "opacity") .vertex_source("overlay_sculpt_curves_cage_vert.glsl") .fragment_source("overlay_extra_frag.glsl") - .additional_info("draw_modelmat", "draw_view", "draw_globals"); + .additional_info("draw_modelmat") + .additional_info("draw_view") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_sculpt_curves_cage_clipped) .do_static_compilation(true) - .additional_info("overlay_sculpt_curves_cage", "drw_clipped"); + .additional_info("overlay_sculpt_curves_cage") + .additional_info("drw_clipped"); diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_info.hh index 8c48c07dbc5..8a8b266779e 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_info.hh @@ -20,8 +20,11 @@ GPU_SHADER_CREATE_INFO(overlay_sculpt_mask) .vertex_source("overlay_sculpt_mask_vert.glsl") .fragment_source("overlay_sculpt_mask_frag.glsl") .fragment_out(0, Type::VEC4, "fragColor") - .additional_info("draw_mesh", "draw_object_infos", "draw_globals"); + .additional_info("draw_mesh") + .additional_info("draw_object_infos") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_sculpt_mask_clipped) .do_static_compilation(true) - .additional_info("overlay_sculpt_mask", "drw_clipped"); + .additional_info("overlay_sculpt_mask") + .additional_info("drw_clipped"); diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_viewer_attribute_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_viewer_attribute_info.hh index 7216a8add28..a9d4771523f 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_viewer_attribute_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_viewer_attribute_info.hh @@ -17,11 +17,13 @@ GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_mesh) .vertex_in(0, Type::VEC3, "pos") .vertex_in(1, Type::VEC4, "attribute_value") .vertex_out(overlay_viewer_attribute_iface) - .additional_info("overlay_viewer_attribute_common", "draw_mesh"); + .additional_info("overlay_viewer_attribute_common") + .additional_info("draw_mesh"); GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_mesh_clipped) .do_static_compilation(true) - .additional_info("overlay_viewer_attribute_mesh", "drw_clipped"); + .additional_info("overlay_viewer_attribute_mesh") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_pointcloud) .do_static_compilation(true) @@ -31,11 +33,13 @@ GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_pointcloud) .fragment_out(1, Type::VEC4, "lineOutput") .sampler(3, ImageType::FLOAT_BUFFER, "attribute_tx") .vertex_out(overlay_viewer_attribute_iface) - .additional_info("overlay_viewer_attribute_common", "draw_pointcloud"); + .additional_info("overlay_viewer_attribute_common") + .additional_info("draw_pointcloud"); GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_pointcloud_clipped) .do_static_compilation(true) - .additional_info("overlay_viewer_attribute_pointcloud", "drw_clipped"); + .additional_info("overlay_viewer_attribute_pointcloud") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_curve) .do_static_compilation(true) @@ -46,11 +50,14 @@ GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_curve) .vertex_in(0, Type::VEC3, "pos") .vertex_in(1, Type::VEC4, "attribute_value") .vertex_out(overlay_viewer_attribute_iface) - .additional_info("overlay_viewer_attribute_common", "draw_modelmat", "draw_resource_id"); + .additional_info("overlay_viewer_attribute_common") + .additional_info("draw_modelmat") + .additional_info("draw_resource_id"); GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_curve_clipped) .do_static_compilation(true) - .additional_info("overlay_viewer_attribute_curve", "drw_clipped"); + .additional_info("overlay_viewer_attribute_curve") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_curves) .do_static_compilation(true) @@ -61,8 +68,10 @@ GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_curves) .sampler(0, ImageType::FLOAT_BUFFER, "color_tx") .push_constant(Type::BOOL, "is_point_domain") .vertex_out(overlay_viewer_attribute_iface) - .additional_info("overlay_viewer_attribute_common", "draw_hair"); + .additional_info("overlay_viewer_attribute_common") + .additional_info("draw_hair"); GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_curves_clipped) .do_static_compilation(true) - .additional_info("overlay_viewer_attribute_curves", "drw_clipped"); + .additional_info("overlay_viewer_attribute_curves") + .additional_info("drw_clipped"); diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_volume_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_volume_info.hh index b3f1000034f..aec5ec31523 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_volume_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_volume_info.hh @@ -33,7 +33,8 @@ GPU_SHADER_CREATE_INFO(overlay_volume_velocity) GPU_SHADER_CREATE_INFO(overlay_volume_velocity_streamline) .do_static_compilation(true) - .additional_info("draw_volume", "overlay_volume_velocity"); + .additional_info("draw_volume") + .additional_info("overlay_volume_velocity"); GPU_SHADER_CREATE_INFO(overlay_volume_velocity_mac) .do_static_compilation(true) @@ -41,12 +42,14 @@ GPU_SHADER_CREATE_INFO(overlay_volume_velocity_mac) .push_constant(Type::BOOL, "drawMACX") .push_constant(Type::BOOL, "drawMACY") .push_constant(Type::BOOL, "drawMACZ") - .additional_info("draw_volume", "overlay_volume_velocity"); + .additional_info("draw_volume") + .additional_info("overlay_volume_velocity"); GPU_SHADER_CREATE_INFO(overlay_volume_velocity_needle) .do_static_compilation(true) .define("USE_NEEDLE") - .additional_info("draw_volume", "overlay_volume_velocity"); + .additional_info("draw_volume") + .additional_info("overlay_volume_velocity"); /** \} */ @@ -75,13 +78,15 @@ GPU_SHADER_CREATE_INFO(overlay_volume_gridlines) GPU_SHADER_CREATE_INFO(overlay_volume_gridlines_flat) .do_static_compilation(true) - .additional_info("draw_volume", "overlay_volume_gridlines"); + .additional_info("draw_volume") + .additional_info("overlay_volume_gridlines"); GPU_SHADER_CREATE_INFO(overlay_volume_gridlines_flags) .do_static_compilation(true) .define("SHOW_FLAGS") .sampler(0, ImageType::UINT_3D, "flagTexture") - .additional_info("draw_volume", "overlay_volume_gridlines"); + .additional_info("draw_volume") + .additional_info("overlay_volume_gridlines"); GPU_SHADER_CREATE_INFO(overlay_volume_gridlines_range) .do_static_compilation(true) @@ -92,6 +97,7 @@ GPU_SHADER_CREATE_INFO(overlay_volume_gridlines_range) .push_constant(Type::INT, "cellFilter") .sampler(0, ImageType::UINT_3D, "flagTexture") .sampler(1, ImageType::FLOAT_3D, "fieldTexture") - .additional_info("draw_volume", "overlay_volume_gridlines"); + .additional_info("draw_volume") + .additional_info("overlay_volume_gridlines"); /** \} */ diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_wireframe_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_wireframe_info.hh index 648e0967f07..861c6b4b783 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_wireframe_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_wireframe_info.hh @@ -29,7 +29,9 @@ GPU_SHADER_CREATE_INFO(overlay_wireframe) .fragment_out(0, Type::VEC4, "fragColor") .fragment_out(1, Type::VEC4, "lineOutput") .depth_write(DepthWrite::ANY) - .additional_info("draw_mesh", "draw_object_infos", "draw_globals"); + .additional_info("draw_mesh") + .additional_info("draw_object_infos") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_wireframe_curve) .do_static_compilation(true) @@ -44,11 +46,11 @@ GPU_SHADER_CREATE_INFO(overlay_wireframe_curve) .fragment_source("overlay_wireframe_frag.glsl") .fragment_out(0, Type::VEC4, "fragColor") .fragment_out(1, Type::VEC4, "lineOutput") - .additional_info("draw_view", - "draw_modelmat_new", - "draw_resource_handle_new", - "draw_object_infos_new", - "draw_globals"); + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new") + .additional_info("draw_object_infos_new") + .additional_info("draw_globals"); GPU_SHADER_INTERFACE_INFO(overlay_wireframe_points_iface) .flat(Type::VEC4, "finalColor") @@ -66,15 +68,16 @@ GPU_SHADER_CREATE_INFO(overlay_wireframe_points) .fragment_source("overlay_wireframe_frag.glsl") .fragment_out(0, Type::VEC4, "fragColor") .fragment_out(1, Type::VEC4, "lineOutput") - .additional_info("draw_view", - "draw_modelmat_new", - "draw_resource_handle_new", - "draw_object_infos_new", - "draw_globals"); + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new") + .additional_info("draw_object_infos_new") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_wireframe_clipped) .do_static_compilation(true) - .additional_info("overlay_wireframe", "drw_clipped"); + .additional_info("overlay_wireframe") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_wireframe_custom_depth) .do_static_compilation(true) @@ -83,7 +86,8 @@ GPU_SHADER_CREATE_INFO(overlay_wireframe_custom_depth) GPU_SHADER_CREATE_INFO(overlay_wireframe_custom_depth_clipped) .do_static_compilation(true) - .additional_info("overlay_wireframe_custom_depth", "drw_clipped"); + .additional_info("overlay_wireframe_custom_depth") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_wireframe_select) .do_static_compilation(true) @@ -92,7 +96,8 @@ GPU_SHADER_CREATE_INFO(overlay_wireframe_select) GPU_SHADER_CREATE_INFO(overlay_wireframe_select_clipped) .do_static_compilation(true) - .additional_info("overlay_wireframe_select", "drw_clipped"); + .additional_info("overlay_wireframe_select") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_wireframe_uv) .do_static_compilation(true) @@ -109,8 +114,8 @@ GPU_SHADER_CREATE_INFO(overlay_wireframe_uv) /* Note: Reuse edit mode shader as it is mostly the same. */ .vertex_source("overlay_edit_uv_edges_next_vert.glsl") .fragment_source("overlay_edit_uv_edges_next_frag.glsl") - .additional_info("draw_view", - "draw_modelmat_new", - "draw_resource_handle_new", - "gpu_index_load", - "draw_globals"); + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new") + .additional_info("gpu_index_load") + .additional_info("draw_globals"); diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh index d44c29abf1a..25cf6a908ed 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh @@ -18,7 +18,8 @@ GPU_SHADER_CREATE_INFO(workbench_composite) .push_constant(Type::BOOL, "forceShadowing") .fragment_out(0, Type::VEC4, "fragColor") .fragment_source("workbench_composite_frag.glsl") - .additional_info("draw_fullscreen", "draw_view"); + .additional_info("draw_fullscreen") + .additional_info("draw_view"); /* Lighting */ diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_prepass_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_prepass_info.hh index a70462c27bf..af0baa6b80c 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_prepass_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_prepass_info.hh @@ -15,22 +15,23 @@ GPU_SHADER_CREATE_INFO(workbench_mesh) .vertex_in(2, Type::VEC4, "ac") .vertex_in(3, Type::VEC2, "au") .vertex_source("workbench_prepass_vert.glsl") - .additional_info("draw_modelmat_new_with_custom_id", "draw_resource_handle_new"); + .additional_info("draw_modelmat_new_with_custom_id") + .additional_info("draw_resource_handle_new"); GPU_SHADER_CREATE_INFO(workbench_curves) .sampler(WB_CURVES_COLOR_SLOT, ImageType::FLOAT_BUFFER, "ac", Frequency::BATCH) .sampler(WB_CURVES_UV_SLOT, ImageType::FLOAT_BUFFER, "au", Frequency::BATCH) .push_constant(Type::INT, "emitter_object_id") .vertex_source("workbench_prepass_hair_vert.glsl") - .additional_info("draw_modelmat_new_with_custom_id", - "draw_resource_handle_new", - "draw_hair_new"); + .additional_info("draw_modelmat_new_with_custom_id") + .additional_info("draw_resource_handle_new") + .additional_info("draw_hair_new"); GPU_SHADER_CREATE_INFO(workbench_pointcloud) .vertex_source("workbench_prepass_pointcloud_vert.glsl") - .additional_info("draw_modelmat_new_with_custom_id", - "draw_resource_handle_new", - "draw_pointcloud_new"); + .additional_info("draw_modelmat_new_with_custom_id") + .additional_info("draw_resource_handle_new") + .additional_info("draw_pointcloud_new"); /** \} */ diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh index 7494bb46c73..cda00ee5ae4 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh @@ -33,7 +33,8 @@ GPU_SHADER_CREATE_INFO(workbench_shadow_visibility_compute_common) .push_constant(Type::VEC3, "shadow_direction") .typedef_source("workbench_shader_shared.h") .compute_source("workbench_shadow_visibility_comp.glsl") - .additional_info("draw_view", "draw_view_culling"); + .additional_info("draw_view") + .additional_info("draw_view_culling"); GPU_SHADER_CREATE_INFO(workbench_shadow_visibility_compute_dynamic_pass_type) .additional_info("workbench_shadow_visibility_compute_common") diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_volume_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_volume_info.hh index a383f2734be..710881b52e6 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_volume_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_volume_info.hh @@ -24,7 +24,9 @@ GPU_SHADER_CREATE_INFO(workbench_volume_common) GPU_SHADER_CREATE_INFO(workbench_volume) .define("WORKBENCH_NEXT") .sampler(6, ImageType::UINT_2D, "stencil_tx") - .additional_info("workbench_volume_common", "draw_object_infos_new", "draw_view"); + .additional_info("workbench_volume_common") + .additional_info("draw_object_infos_new") + .additional_info("draw_view"); /** \} */ /* -------------------------------------------------------------------- */ @@ -45,10 +47,12 @@ GPU_SHADER_CREATE_INFO(workbench_volume_object_common) .additional_info("draw_resource_id_varying"); GPU_SHADER_CREATE_INFO(workbench_volume_smoke) - .additional_info("workbench_volume_smoke_common", "draw_modelmat_new"); + .additional_info("workbench_volume_smoke_common") + .additional_info("draw_modelmat_new"); GPU_SHADER_CREATE_INFO(workbench_volume_object) - .additional_info("workbench_volume_object_common", "draw_volume_new"); + .additional_info("workbench_volume_object_common") + .additional_info("draw_volume_new"); /** \} */ diff --git a/source/blender/draw/intern/shaders/draw_view_info.hh b/source/blender/draw/intern/shaders/draw_view_info.hh index feca38ac8a5..8c28ab55bcf 100644 --- a/source/blender/draw/intern/shaders/draw_view_info.hh +++ b/source/blender/draw/intern/shaders/draw_view_info.hh @@ -105,9 +105,13 @@ GPU_SHADER_CREATE_INFO(draw_globals) /** \name Geometry Type * \{ */ -GPU_SHADER_CREATE_INFO(draw_mesh).additional_info("draw_modelmat", "draw_resource_id"); +GPU_SHADER_CREATE_INFO(draw_mesh) + .additional_info("draw_modelmat") + .additional_info("draw_resource_id"); -GPU_SHADER_CREATE_INFO(draw_mesh_new).additional_info("draw_modelmat_new", "draw_resource_id"); +GPU_SHADER_CREATE_INFO(draw_mesh_new) + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_id"); GPU_SHADER_CREATE_INFO(draw_hair) .define("HAIR_SHADER") @@ -122,7 +126,8 @@ GPU_SHADER_CREATE_INFO(draw_hair) .push_constant(Type::BOOL, "hairCloseTip") .push_constant(Type::INT, "hairStrandOffset") .push_constant(Type::MAT4, "hairDupliMatrix") - .additional_info("draw_modelmat", "draw_resource_id"); + .additional_info("draw_modelmat") + .additional_info("draw_resource_id"); GPU_SHADER_CREATE_INFO(draw_hair_new) .define("HAIR_SHADER") @@ -142,17 +147,21 @@ GPU_SHADER_CREATE_INFO(draw_pointcloud) .sampler(0, ImageType::FLOAT_BUFFER, "ptcloud_pos_rad_tx", Frequency::BATCH) .define("POINTCLOUD_SHADER") .define("DRW_POINTCLOUD_INFO") - .additional_info("draw_modelmat_instanced_attr", "draw_resource_id_uniform"); + .additional_info("draw_modelmat_instanced_attr") + .additional_info("draw_resource_id_uniform"); GPU_SHADER_CREATE_INFO(draw_pointcloud_new) .sampler(0, ImageType::FLOAT_BUFFER, "ptcloud_pos_rad_tx", Frequency::BATCH) .define("POINTCLOUD_SHADER") .define("DRW_POINTCLOUD_INFO"); -GPU_SHADER_CREATE_INFO(draw_volume).additional_info("draw_modelmat", "draw_resource_id_uniform"); +GPU_SHADER_CREATE_INFO(draw_volume) + .additional_info("draw_modelmat") + .additional_info("draw_resource_id_uniform"); GPU_SHADER_CREATE_INFO(draw_volume_new) - .additional_info("draw_modelmat_new", "draw_resource_handle_new"); + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new"); GPU_SHADER_CREATE_INFO(draw_gpencil) .typedef_source("gpencil_shader_shared.h") @@ -165,7 +174,8 @@ GPU_SHADER_CREATE_INFO(draw_gpencil) .define("gpThicknessIsScreenSpace", "(gpThicknessWorldScale < 0.0)") /* Per Layer */ .push_constant(Type::FLOAT, "gpThicknessOffset") - .additional_info("draw_modelmat", "draw_object_infos"); + .additional_info("draw_modelmat") + .additional_info("draw_object_infos"); GPU_SHADER_CREATE_INFO(draw_gpencil_new) .typedef_source("gpencil_shader_shared.h") @@ -178,7 +188,9 @@ GPU_SHADER_CREATE_INFO(draw_gpencil_new) .define("gpThicknessIsScreenSpace", "(gpThicknessWorldScale < 0.0)") /* Per Layer */ .push_constant(Type::FLOAT, "gpThicknessOffset") - .additional_info("draw_resource_id_varying", "draw_view", "draw_object_infos_new"); + .additional_info("draw_resource_id_varying") + .additional_info("draw_view") + .additional_info("draw_object_infos_new"); /** \} */ @@ -215,7 +227,8 @@ GPU_SHADER_CREATE_INFO(draw_visibility_compute) .push_constant(Type::INT, "view_len") .push_constant(Type::INT, "visibility_word_per_draw") .compute_source("draw_visibility_comp.glsl") - .additional_info("draw_view", "draw_view_culling"); + .additional_info("draw_view") + .additional_info("draw_view_culling"); GPU_SHADER_CREATE_INFO(draw_command_generate) .do_static_compilation(true) @@ -288,9 +301,11 @@ GPU_SHADER_CREATE_INFO(draw_modelmat_new_common) .define("ModelMatrix", "drw_ModelMatrix"); GPU_SHADER_CREATE_INFO(draw_modelmat_new) - .additional_info("draw_modelmat_new_common", "draw_resource_id_new"); + .additional_info("draw_modelmat_new_common") + .additional_info("draw_resource_id_new"); GPU_SHADER_CREATE_INFO(draw_modelmat_new_with_custom_id) - .additional_info("draw_modelmat_new_common", "draw_resource_with_custom_id_new"); + .additional_info("draw_modelmat_new_common") + .additional_info("draw_resource_with_custom_id_new"); /** \} */ -- 2.30.2 From c7052aca5869f17ded74e04e97ee09963c24ce72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Thu, 26 Sep 2024 17:54:26 +0200 Subject: [PATCH 46/90] Fix ambiguous namespace error --- .../blender/gpu/intern/gpu_shader_create_info.hh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/source/blender/gpu/intern/gpu_shader_create_info.hh b/source/blender/gpu/intern/gpu_shader_create_info.hh index 4b7068418b2..27117eabc42 100644 --- a/source/blender/gpu/intern/gpu_shader_create_info.hh +++ b/source/blender/gpu/intern/gpu_shader_create_info.hh @@ -51,19 +51,26 @@ namespace blender::gpu::shader { # define GPU_SHADER_INTERFACE_INFO(_interface, _inst_name) namespace _interface { # define GPU_SHADER_INTERFACE_END() } -# define GPU_SHADER_CREATE_INFO(_info) namespace _info { +# define GPU_SHADER_CREATE_INFO(_info) \ + namespace _info { \ + namespace gl_VertexShader { \ + } \ + namespace gl_FragmentShader { \ + } \ + namespace gl_ComputeShader { \ + } # define GPU_SHADER_CREATE_END() } # define VERTEX_SHADER_CREATE_INFO(_info) \ - using namespace gl_VertexShader; \ + using namespace ::gl_VertexShader; \ using namespace _info::gl_VertexShader; \ using namespace _info; # define FRAGMENT_SHADER_CREATE_INFO(_info) \ - using namespace gl_FragmentShader; \ + using namespace ::gl_FragmentShader; \ using namespace _info::gl_FragmentShader; \ using namespace _info; # define COMPUTE_SHADER_CREATE_INFO(_info) \ - using namespace gl_ComputeShader; \ + using namespace ::gl_ComputeShader; \ using namespace _info::gl_ComputeShader; \ using namespace _info; -- 2.30.2 From 2888380ffe42520eaa7d37da63f1f5f06fd1fe6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Thu, 26 Sep 2024 17:58:20 +0200 Subject: [PATCH 47/90] Add all infos to the stub file --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 87 ++++++++++++++++++- .../gpu/shaders/gpu_shader_icon_frag.glsl | 5 +- .../gpu/shaders/gpu_shader_icon_vert.glsl | 5 +- 3 files changed, 88 insertions(+), 9 deletions(-) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index ddebc382bb3..6c9895654b2 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -771,5 +771,90 @@ void groupMemoryBarrier() {} #include "select_shader_shared.hh" #include "workbench_shader_shared.h" -/* TODO(fclem): Include all create infos here so that they don't need to be individually included +/* Include all create infos here so that they don't need to be individually included * inside shaders. */ +/* TODO(fclem): Enable the ones ported to the macro Create infos. */ +// #include "draw_debug_info.hh" +// #include "draw_fullscreen_info.hh" +// #include "draw_hair_refine_info.hh" +// #include "draw_object_infos_info.hh" +// #include "draw_view_info.hh" +// #include "infos/basic_depth_info.hh" +// #include "infos/eevee_ambient_occlusion_info.hh" +// #include "infos/eevee_deferred_info.hh" +// #include "infos/eevee_depth_of_field_info.hh" +// #include "infos/eevee_film_info.hh" +// #include "infos/eevee_hiz_info.hh" +// #include "infos/eevee_light_culling_info.hh" +// #include "infos/eevee_lightprobe_sphere_info.hh" +// #include "infos/eevee_lightprobe_volume_info.hh" +// #include "infos/eevee_lookdev_info.hh" +// #include "infos/eevee_lut_info.hh" +// #include "infos/eevee_material_info.hh" +// #include "infos/eevee_motion_blur_info.hh" +// #include "infos/eevee_shadow_info.hh" +// #include "infos/eevee_subsurface_info.hh" +// #include "infos/eevee_tracing_info.hh" +// #include "infos/eevee_velocity_info.hh" +// #include "infos/eevee_volume_info.hh" +// #include "infos/engine_image_info.hh" +// #include "infos/gpencil_info.hh" +// #include "infos/gpencil_vfx_info.hh" +// #include "infos/gpu_clip_planes_info.hh" +// #include "infos/gpu_index_load_info.hh" +// #include "infos/gpu_shader_2D_area_borders_info.hh" +// #include "infos/gpu_shader_2D_checker_info.hh" +// #include "infos/gpu_shader_2D_diag_stripes_info.hh" +// #include "infos/gpu_shader_2D_image_desaturate_color_info.hh" +// #include "infos/gpu_shader_2D_image_info.hh" +// #include "infos/gpu_shader_2D_image_overlays_merge_info.hh" +// #include "infos/gpu_shader_2D_image_overlays_stereo_merge_info.hh" +// #include "infos/gpu_shader_2D_image_rect_color_info.hh" +// #include "infos/gpu_shader_2D_image_shuffle_color_info.hh" +// #include "infos/gpu_shader_2D_nodelink_info.hh" +// #include "infos/gpu_shader_2D_point_uniform_size_uniform_color_aa_info.hh" +// #include "infos/gpu_shader_2D_point_uniform_size_uniform_color_outline_aa_info.hh" +// #include "infos/gpu_shader_2D_point_varying_size_varying_color_info.hh" +// #include "infos/gpu_shader_2D_widget_info.hh" +// #include "infos/gpu_shader_3D_depth_only_info.hh" +// #include "infos/gpu_shader_3D_flat_color_info.hh" +// #include "infos/gpu_shader_3D_image_info.hh" +// #include "infos/gpu_shader_3D_point_info.hh" +// #include "infos/gpu_shader_3D_polyline_info.hh" +// #include "infos/gpu_shader_3D_smooth_color_info.hh" +// #include "infos/gpu_shader_3D_uniform_color_info.hh" +// #include "infos/gpu_shader_gpencil_stroke_info.hh" +#include "infos/gpu_shader_icon_info.hh" +// #include "infos/gpu_shader_index_info.hh" +// #include "infos/gpu_shader_instance_varying_color_varying_size_info.hh" +// #include "infos/gpu_shader_keyframe_shape_info.hh" +// #include "infos/gpu_shader_line_dashed_uniform_color_info.hh" +// #include "infos/gpu_shader_print_info.hh" +// #include "infos/gpu_shader_sequencer_info.hh" +// #include "infos/gpu_shader_simple_lighting_info.hh" +// #include "infos/gpu_shader_text_info.hh" +// #include "infos/gpu_srgb_to_framebuffer_space_info.hh" +// #include "infos/overlay_antialiasing_info.hh" +// #include "infos/overlay_armature_info.hh" +// #include "infos/overlay_background_info.hh" +// #include "infos/overlay_edit_mode_info.hh" +// #include "infos/overlay_extra_info.hh" +// #include "infos/overlay_facing_info.hh" +// #include "infos/overlay_grid_info.hh" +// #include "infos/overlay_outline_info.hh" +// #include "infos/overlay_paint_info.hh" +// #include "infos/overlay_sculpt_curves_info.hh" +// #include "infos/overlay_sculpt_info.hh" +// #include "infos/overlay_viewer_attribute_info.hh" +// #include "infos/overlay_volume_info.hh" +// #include "infos/overlay_wireframe_info.hh" +// #include "infos/select_id_info.hh" +// #include "infos/workbench_composite_info.hh" +// #include "infos/workbench_depth_info.hh" +// #include "infos/workbench_effect_antialiasing_info.hh" +// #include "infos/workbench_effect_dof_info.hh" +// #include "infos/workbench_effect_outline_info.hh" +// #include "infos/workbench_prepass_info.hh" +// #include "infos/workbench_shadow_info.hh" +// #include "infos/workbench_transparent_resolve_info.hh" +// #include "infos/workbench_volume_info.hh" diff --git a/source/blender/gpu/shaders/gpu_shader_icon_frag.glsl b/source/blender/gpu/shaders/gpu_shader_icon_frag.glsl index 3e96598ebe6..ebdd5247698 100644 --- a/source/blender/gpu/shaders/gpu_shader_icon_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_icon_frag.glsl @@ -10,10 +10,7 @@ * the rounded corner, and the rectangle sides. */ -/* TODO(fclem): Replace with gpu_glsl_cpp_stubs.hh include. */ -#define GLSL_CPP_STUBS - -#include "infos/gpu_shader_icon_info.hh" +#include "gpu_glsl_cpp_stubs.hh" FRAGMENT_SHADER_CREATE_INFO(gpu_shader_icon) diff --git a/source/blender/gpu/shaders/gpu_shader_icon_vert.glsl b/source/blender/gpu/shaders/gpu_shader_icon_vert.glsl index 3f64ab85a46..537fcba28e9 100644 --- a/source/blender/gpu/shaders/gpu_shader_icon_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_icon_vert.glsl @@ -7,10 +7,7 @@ * does not need any vertex input (producing less call to immBegin/End) */ -/* TODO(fclem): Replace with gpu_glsl_cpp_stubs.hh include. */ -#define GLSL_CPP_STUBS - -#include "infos/gpu_shader_icon_info.hh" +#include "gpu_glsl_cpp_stubs.hh" VERTEX_SHADER_CREATE_INFO(gpu_shader_icon) -- 2.30.2 From af3454742ebc24b77f18d8214dd63f6aaea6eea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Thu, 26 Sep 2024 18:39:32 +0200 Subject: [PATCH 48/90] Fix compilation --- .../eevee_next/shaders/infos/eevee_depth_of_field_info.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_depth_of_field_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_depth_of_field_info.hh index dc4cbece636..3d1644bfe12 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_depth_of_field_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_depth_of_field_info.hh @@ -144,7 +144,7 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_background).define("DOF_FOREGROUND_P GPU_SHADER_CREATE_INFO(eevee_depth_of_field_foreground).define("DOF_FOREGROUND_PASS", "true"); #define EEVEE_DOF_FINAL_VARIATION(name, ...) \ - GPU_SHADER_CREATE_INFO(name).additional_info("__VA_ARGS__").do_static_compilation(true); + GPU_SHADER_CREATE_INFO(name).additional_info(__VA_ARGS__).do_static_compilation(true); #define EEVEE_DOF_LUT_VARIATIONS(prefix, ...) \ EEVEE_DOF_FINAL_VARIATION(prefix##_lut, "eevee_depth_of_field_lut", __VA_ARGS__) \ -- 2.30.2 From 6e3c1b27c8f70b371e7b6d8605d391f3dce84bb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Thu, 26 Sep 2024 21:27:57 +0200 Subject: [PATCH 49/90] Add macros for each create info type and SHADER_LIBRARY_CREATE_INFO --- source/blender/gpu/intern/gpu_shader_create_info.hh | 1 + source/blender/gpu/shaders/metal/mtl_shader_defines.msl | 5 +++++ source/blender/gpu/shaders/opengl/glsl_shader_defines.glsl | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/source/blender/gpu/intern/gpu_shader_create_info.hh b/source/blender/gpu/intern/gpu_shader_create_info.hh index 27117eabc42..73734e59112 100644 --- a/source/blender/gpu/intern/gpu_shader_create_info.hh +++ b/source/blender/gpu/intern/gpu_shader_create_info.hh @@ -61,6 +61,7 @@ namespace blender::gpu::shader { } # define GPU_SHADER_CREATE_END() } +# define SHADER_LIBRARY_CREATE_INFO(_info) using namespace _info; # define VERTEX_SHADER_CREATE_INFO(_info) \ using namespace ::gl_VertexShader; \ using namespace _info::gl_VertexShader; \ diff --git a/source/blender/gpu/shaders/metal/mtl_shader_defines.msl b/source/blender/gpu/shaders/metal/mtl_shader_defines.msl index 961fb63ad30..f4d1d400ba3 100644 --- a/source/blender/gpu/shaders/metal/mtl_shader_defines.msl +++ b/source/blender/gpu/shaders/metal/mtl_shader_defines.msl @@ -2549,3 +2549,8 @@ mat3x4 MAT3x4(mat2 m) #define bool3_array(...) { __VA_ARGS__ } #define bool4_array(...) { __VA_ARGS__ } /* clang-format on */ + +#define SHADER_LIBRARY_CREATE_INFO(a) +#define VERTEX_SHADER_CREATE_INFO(a) +#define FRAGMENT_SHADER_CREATE_INFO(a) +#define COMPUTE_SHADER_CREATE_INFO(a) diff --git a/source/blender/gpu/shaders/opengl/glsl_shader_defines.glsl b/source/blender/gpu/shaders/opengl/glsl_shader_defines.glsl index 9f10b4ba88d..e6f377a4cee 100644 --- a/source/blender/gpu/shaders/opengl/glsl_shader_defines.glsl +++ b/source/blender/gpu/shaders/opengl/glsl_shader_defines.glsl @@ -121,3 +121,8 @@ bool is_zero(vec4 A) #define bool2_array bool2[] #define bool3_array bool3[] #define bool4_array bool4[] + +#define SHADER_LIBRARY_CREATE_INFO(a) +#define VERTEX_SHADER_CREATE_INFO(a) +#define FRAGMENT_SHADER_CREATE_INFO(a) +#define COMPUTE_SHADER_CREATE_INFO(a) -- 2.30.2 From 6f6493ba3e5a5cf130810dcbf67778b63afbe16a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Thu, 26 Sep 2024 21:28:17 +0200 Subject: [PATCH 50/90] Make eevee_shader_shared work with GLSL_CPP_STUBS --- .../engines/eevee_next/eevee_shader_shared.hh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/source/blender/draw/engines/eevee_next/eevee_shader_shared.hh b/source/blender/draw/engines/eevee_next/eevee_shader_shared.hh index 7ec33874e62..89707cec234 100644 --- a/source/blender/draw/engines/eevee_next/eevee_shader_shared.hh +++ b/source/blender/draw/engines/eevee_next/eevee_shader_shared.hh @@ -8,7 +8,14 @@ * language. */ -#ifndef USE_GPU_SHADER_CREATE_INFO +/* __cplusplus is true when compiling with MSL, so ensure we are not inside a shader. */ +#if defined(GPU_SHADER) || defined(GLSL_CPP_STUBS) +# define IS_CPP 0 +#else +# define IS_CPP 1 +#endif + +#if IS_CPP # pragma once # include "BLI_math_bits.h" @@ -34,13 +41,6 @@ constexpr GPUSamplerState no_filter = GPUSamplerState::default_sampler(); constexpr GPUSamplerState with_filter = {GPU_SAMPLER_FILTERING_LINEAR}; #endif -/* __cplusplus is true when compiling with MSL, so ensure we are not inside a shader. */ -#ifdef GPU_SHADER -# define IS_CPP 0 -#else -# define IS_CPP 1 -#endif - /** WORKAROUND(@fclem): This is because this file is included before common_math_lib.glsl. */ #ifndef M_PI # define EEVEE_PI -- 2.30.2 From 5b2a56ca039dfeea2ea978136507f1d3333dddb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Fri, 27 Sep 2024 20:27:56 +0200 Subject: [PATCH 51/90] Fix defines --- source/blender/gpu/intern/gpu_shader_create_info.hh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/gpu/intern/gpu_shader_create_info.hh b/source/blender/gpu/intern/gpu_shader_create_info.hh index 73734e59112..b51d6014376 100644 --- a/source/blender/gpu/intern/gpu_shader_create_info.hh +++ b/source/blender/gpu/intern/gpu_shader_create_info.hh @@ -148,8 +148,8 @@ namespace blender::gpu::shader { # define FRAGMENT_SOURCE(filename) .fragment_source(filename) # define COMPUTE_SOURCE(filename) .compute_source(filename) -# define DEFINE(name) .define(#name) -# define DEFINE_VALUE(name, value) .define(#name, #value) +# define DEFINE(name) .define(name) +# define DEFINE_VALUE(name, value) .define(name, value) # define DO_STATIC_COMPILATION() .do_static_compilation(true) # define AUTO_RESOURCE_LOCATION() .auto_resource_location(true) -- 2.30.2 From c1adba5683f33cc49b27d017855a65af9a7fb250 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Fri, 27 Sep 2024 21:16:41 +0200 Subject: [PATCH 52/90] Fix macro --- source/blender/gpu/intern/gpu_shader_create_info.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/gpu/intern/gpu_shader_create_info.hh b/source/blender/gpu/intern/gpu_shader_create_info.hh index b51d6014376..661a9da750e 100644 --- a/source/blender/gpu/intern/gpu_shader_create_info.hh +++ b/source/blender/gpu/intern/gpu_shader_create_info.hh @@ -128,7 +128,7 @@ namespace blender::gpu::shader { .uniform_buf(slot, #type_name, #name, Frequency::freq) # define STORAGE_BUF(slot, qualifiers, type_name, name) \ - .storage_buf(slot, Qualifier::qualifiers, #type_name, #name, freq) + .storage_buf(slot, Qualifier::qualifiers, #type_name, #name) # define STORAGE_BUF_FREQ(slot, qualifiers, type_name, name, freq) \ .storage_buf(slot, Qualifier::qualifiers, #type_name, #name, Frequency::freq) -- 2.30.2 From 4f6865f6bde9a6770ea71077103db3c3503090b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 01:09:12 +0200 Subject: [PATCH 53/90] Fix macros --- source/blender/gpu/intern/gpu_shader_create_info.hh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/blender/gpu/intern/gpu_shader_create_info.hh b/source/blender/gpu/intern/gpu_shader_create_info.hh index 661a9da750e..e56200e8922 100644 --- a/source/blender/gpu/intern/gpu_shader_create_info.hh +++ b/source/blender/gpu/intern/gpu_shader_create_info.hh @@ -110,7 +110,8 @@ namespace blender::gpu::shader { # define SUBPASS_IN(slot, type, name, rog) .subpass_in(slot, Type::type, #name, rog) # define FRAGMENT_OUT(slot, type, name) .fragment_out(slot, Type::type, #name) -# define FRAGMENT_OUT_DUAL(slot, type, name, blend) .fragment_out(slot, Type::type, #name, blend) +# define FRAGMENT_OUT_DUAL(slot, type, name, blend) \ + .fragment_out(slot, Type::type, #name, DualBlend::blend) # define FRAGMENT_OUT_ROG(slot, type, name, rog) \ .fragment_out(slot, Type::type, #name, DualBlend::NONE, rog) @@ -157,7 +158,7 @@ namespace blender::gpu::shader { /* TO REMOVE. */ # define METAL_BACKEND_ONLY() .metal_backend_only(true) -# define ADDITIONAL_INFO(info_name) .additional_info(info_name) +# define ADDITIONAL_INFO(info_name) .additional_info(#info_name) # define TYPEDEF_SOURCE(filename) .typedef_source(filename) # define MTL_MAX_TOTAL_THREADS_PER_THREADGROUP(value) \ -- 2.30.2 From 44ca8e3367bde1f1f53a8b123feb53a1a399be40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 11:40:28 +0200 Subject: [PATCH 54/90] Fix missing samplerBuffer types --- source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index 6c9895654b2..3ddd0dc2a1d 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -403,12 +403,15 @@ TEX_TEMPLATE DataVec textureLod(T, FltCoord, double) {} #undef TEX_TEMPLATE +using samplerBuffer = SamplerBase; using sampler1D = SamplerBase; using sampler2D = SamplerBase; using sampler3D = SamplerBase; +using isamplerBuffer = SamplerBase; using isampler1D = SamplerBase; using isampler2D = SamplerBase; using isampler3D = SamplerBase; +using usamplerBuffer = SamplerBase; using usampler1D = SamplerBase; using usampler2D = SamplerBase; using usampler3D = SamplerBase; -- 2.30.2 From da1badea7df0687ac8c3acd5d9905c09ed4fa708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 11:40:48 +0200 Subject: [PATCH 55/90] Add stubs for uppercase types --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index 3ddd0dc2a1d..4d65934b800 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -286,6 +286,26 @@ using bvec2 = bool2; using bvec3 = bool3; using bvec4 = bool4; +using FLOAT = float; +using VEC2 = float2; +using VEC3 = float3; +using VEC4 = float4; + +using INT = int; +using IVEC2 = int2; +using IVEC3 = int3; +using IVEC4 = int4; + +using UINT = uint; +using UVEC2 = uint2; +using UVEC3 = uint3; +using UVEC4 = uint4; + +using BOOL = bool; +using BVEC2 = bool2; +using BVEC3 = bool3; +using BVEC4 = bool4; + /** \} */ /* -------------------------------------------------------------------- */ -- 2.30.2 From 0011036cba32f54502c01458df618863a14646fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 11:41:09 +0200 Subject: [PATCH 56/90] Fix macros --- source/blender/gpu/intern/gpu_shader_create_info.hh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/blender/gpu/intern/gpu_shader_create_info.hh b/source/blender/gpu/intern/gpu_shader_create_info.hh index e56200e8922..9c45403b24d 100644 --- a/source/blender/gpu/intern/gpu_shader_create_info.hh +++ b/source/blender/gpu/intern/gpu_shader_create_info.hh @@ -129,9 +129,9 @@ namespace blender::gpu::shader { .uniform_buf(slot, #type_name, #name, Frequency::freq) # define STORAGE_BUF(slot, qualifiers, type_name, name) \ - .storage_buf(slot, Qualifier::qualifiers, #type_name, #name) + .storage_buf(slot, Qualifier::qualifiers, STRINGIFY(type_name), #name) # define STORAGE_BUF_FREQ(slot, qualifiers, type_name, name, freq) \ - .storage_buf(slot, Qualifier::qualifiers, #type_name, #name, Frequency::freq) + .storage_buf(slot, Qualifier::qualifiers, STRINGIFY(type_name), #name, Frequency::freq) # define SAMPLER(slot, type, name) .sampler(slot, ImageType::type, #name) # define SAMPLER_FREQ(slot, type, name, freq) \ @@ -242,11 +242,11 @@ namespace blender::gpu::shader { # define PUSH_CONSTANT(type, name) const type name = {}; # define PUSH_CONSTANT_ARRAY(type, name, array_size) const type name[array_size] = {}; -# define UNIFORM_BUF(slot, type_name, name) const type_name name; -# define UNIFORM_BUF_FREQ(slot, type_name, name, freq) const type_name name; +# define UNIFORM_BUF(slot, type_name, name) const type_name name = {}; +# define UNIFORM_BUF_FREQ(slot, type_name, name, freq) const type_name name = {}; -# define STORAGE_BUF(slot, qualifiers, type_name, name) qualifiers type_name name; -# define STORAGE_BUF_FREQ(slot, qualifiers, type_name, name, freq) qualifiers type_name name; +# define STORAGE_BUF(slot, qualifiers, type_name, name) qualifiers type_name name = {}; +# define STORAGE_BUF_FREQ(slot, qualifiers, type_name, name, freq) qualifiers type_name name = {}; # define SAMPLER(slot, type, name) _##type(sampler) name; # define SAMPLER_FREQ(slot, type, name, freq) _##type(sampler) name; -- 2.30.2 From 06abbd972bb2487b66ca7131c2405e2b66835bf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 11:42:19 +0200 Subject: [PATCH 57/90] Mass rename --- .../infos/compositor_alpha_crop_info.hh | 15 +- .../infos/compositor_bilateral_blur_info.hh | 17 +- .../infos/compositor_bokeh_blur_info.hh | 19 +- ...ompositor_bokeh_blur_variable_size_info.hh | 21 +- .../infos/compositor_bokeh_image_info.hh | 19 +- .../shaders/infos/compositor_box_mask_info.hh | 49 +- .../infos/compositor_compute_preview_info.hh | 11 +- .../shaders/infos/compositor_convert_info.hh | 99 +- .../infos/compositor_cryptomatte_info.hh | 39 +- .../shaders/infos/compositor_defocus_info.hh | 55 +- .../compositor_deriche_gaussian_blur_info.hh | 36 +- .../infos/compositor_despeckle_info.hh | 17 +- .../infos/compositor_directional_blur_info.hh | 23 +- .../shaders/infos/compositor_displace_info.hh | 17 +- .../infos/compositor_double_edge_mask_info.hh | 36 +- .../infos/compositor_edge_filter_info.hh | 15 +- .../infos/compositor_ellipse_mask_info.hh | 49 +- .../shaders/infos/compositor_filter_info.hh | 15 +- .../shaders/infos/compositor_flip_info.hh | 15 +- .../shaders/infos/compositor_glare_info.hh | 176 +- .../shaders/infos/compositor_id_mask_info.hh | 13 +- .../infos/compositor_image_crop_info.hh | 13 +- .../shaders/infos/compositor_inpaint_info.hh | 47 +- .../infos/compositor_jump_flooding_info.hh | 13 +- .../shaders/infos/compositor_keying_info.hh | 89 +- .../infos/compositor_keying_screen_info.hh | 17 +- .../shaders/infos/compositor_kuwahara_info.hh | 101 +- .../shaders/infos/compositor_map_uv_info.hh | 25 +- .../compositor_morphological_blur_info.hh | 23 +- ...tor_morphological_distance_feather_info.hh | 27 +- .../compositor_morphological_distance_info.hh | 29 +- ...r_morphological_distance_threshold_info.hh | 17 +- .../compositor_morphological_step_info.hh | 29 +- .../infos/compositor_motion_blur_info.hh | 36 +- .../infos/compositor_movie_distortion_info.hh | 13 +- .../infos/compositor_normalize_info.hh | 15 +- .../compositor_parallel_reduction_info.hh | 273 +-- .../shaders/infos/compositor_pixelate_info.hh | 13 +- .../infos/compositor_plane_deform_info.hh | 56 +- .../compositor_premultiply_alpha_info.hh | 11 +- ...mpositor_projector_lens_distortion_info.hh | 13 +- .../infos/compositor_read_input_info.hh | 45 +- .../compositor_realize_on_domain_info.hh | 61 +- .../infos/compositor_scale_variable_info.hh | 15 +- .../compositor_screen_lens_distortion_info.hh | 25 +- .../shaders/infos/compositor_smaa_info.hh | 90 +- .../shaders/infos/compositor_split_info.hh | 27 +- .../compositor_summed_area_table_info.hh | 78 +- .../infos/compositor_sun_beams_info.hh | 15 +- .../infos/compositor_symmetric_blur_info.hh | 17 +- ...sitor_symmetric_blur_variable_size_info.hh | 19 +- ...ompositor_symmetric_separable_blur_info.hh | 36 +- ...etric_separable_blur_variable_size_info.hh | 34 +- .../compositor_tone_map_photoreceptor_info.hh | 23 +- .../infos/compositor_tone_map_simple_info.hh | 17 +- ...compositor_van_vliet_gaussian_blur_info.hh | 54 +- .../infos/compositor_write_output_info.hh | 36 +- .../infos/compositor_z_combine_info.hh | 57 +- .../basic/shaders/infos/basic_depth_info.hh | 40 +- .../infos/eevee_ambient_occlusion_info.hh | 33 +- .../shaders/infos/eevee_deferred_info.hh | 275 +-- .../infos/eevee_depth_of_field_info.hh | 360 ++-- .../shaders/infos/eevee_film_info.hh | 195 ++- .../shaders/infos/eevee_hiz_info.hh | 61 +- .../shaders/infos/eevee_light_culling_info.hh | 128 +- .../infos/eevee_lightprobe_sphere_info.hh | 169 +- .../infos/eevee_lightprobe_volume_info.hh | 387 +++-- .../shaders/infos/eevee_lookdev_info.hh | 28 +- .../shaders/infos/eevee_lut_info.hh | 15 +- .../shaders/infos/eevee_material_info.hh | 537 +++--- .../shaders/infos/eevee_motion_blur_info.hh | 77 +- .../shaders/infos/eevee_shadow_info.hh | 476 +++--- .../shaders/infos/eevee_subsurface_info.hh | 61 +- .../shaders/infos/eevee_tracing_info.hh | 456 ++--- .../shaders/infos/eevee_velocity_info.hh | 53 +- .../shaders/infos/eevee_volume_info.hh | 164 +- .../gpencil/shaders/infos/gpencil_info.hh | 216 +-- .../gpencil/shaders/infos/gpencil_vfx_info.hh | 171 +- .../image/shaders/infos/engine_image_info.hh | 56 +- .../infos/overlay_antialiasing_info.hh | 34 +- .../shaders/infos/overlay_armature_info.hh | 553 +++--- .../shaders/infos/overlay_background_info.hh | 36 +- .../shaders/infos/overlay_edit_mode_info.hh | 1487 +++++++++-------- .../shaders/infos/overlay_extra_info.hh | 631 +++---- .../shaders/infos/overlay_facing_info.hh | 22 +- .../shaders/infos/overlay_grid_info.hh | 63 +- .../shaders/infos/overlay_outline_info.hh | 230 +-- .../shaders/infos/overlay_paint_info.hh | 211 +-- .../infos/overlay_sculpt_curves_info.hh | 70 +- .../shaders/infos/overlay_sculpt_info.hh | 41 +- .../infos/overlay_viewer_attribute_info.hh | 120 +- .../shaders/infos/overlay_volume_info.hh | 148 +- .../shaders/infos/overlay_wireframe_info.hh | 199 +-- .../select/shaders/infos/select_id_info.hh | 92 +- .../shaders/infos/workbench_composite_info.hh | 55 +- .../shaders/infos/workbench_depth_info.hh | 29 +- .../workbench_effect_antialiasing_info.hh | 82 +- .../infos/workbench_effect_dof_info.hh | 88 +- .../infos/workbench_effect_outline_info.hh | 15 +- .../shaders/infos/workbench_prepass_info.hh | 150 +- .../shaders/infos/workbench_shadow_info.hh | 72 +- .../workbench_transparent_resolve_info.hh | 13 +- .../shaders/infos/workbench_volume_info.hh | 111 +- .../gpu/shaders/infos/gpu_clip_planes_info.hh | 7 +- .../gpu/shaders/infos/gpu_index_load_info.hh | 12 +- .../infos/gpu_shader_2D_area_borders_info.hh | 27 +- .../infos/gpu_shader_2D_checker_info.hh | 19 +- .../infos/gpu_shader_2D_diag_stripes_info.hh | 21 +- ...u_shader_2D_image_desaturate_color_info.hh | 11 +- .../shaders/infos/gpu_shader_2D_image_info.hh | 15 +- ...gpu_shader_2D_image_overlays_merge_info.hh | 48 +- ...der_2D_image_overlays_stereo_merge_info.hh | 21 +- .../gpu_shader_2D_image_rect_color_info.hh | 21 +- .../gpu_shader_2D_image_shuffle_color_info.hh | 11 +- .../infos/gpu_shader_2D_nodelink_info.hh | 93 +- ...oint_uniform_size_uniform_color_aa_info.hh | 21 +- ...form_size_uniform_color_outline_aa_info.hh | 23 +- ...D_point_varying_size_varying_color_info.hh | 19 +- .../infos/gpu_shader_2D_widget_info.hh | 84 +- .../infos/gpu_shader_3D_depth_only_info.hh | 20 +- .../infos/gpu_shader_3D_flat_color_info.hh | 26 +- .../shaders/infos/gpu_shader_3D_image_info.hh | 31 +- .../shaders/infos/gpu_shader_3D_point_info.hh | 47 +- .../infos/gpu_shader_3D_polyline_info.hh | 154 +- .../infos/gpu_shader_3D_smooth_color_info.hh | 26 +- .../infos/gpu_shader_3D_uniform_color_info.hh | 47 +- .../infos/gpu_shader_gpencil_stroke_info.hh | 57 +- .../gpu/shaders/infos/gpu_shader_icon_info.hh | 2 +- .../shaders/infos/gpu_shader_index_info.hh | 39 +- ...nstance_varying_color_varying_size_info.hh | 23 +- .../infos/gpu_shader_keyframe_shape_info.hh | 40 +- ...u_shader_line_dashed_uniform_color_info.hh | 45 +- .../shaders/infos/gpu_shader_print_info.hh | 8 +- .../infos/gpu_shader_sequencer_info.hh | 52 +- .../infos/gpu_shader_simple_lighting_info.hh | 27 +- .../gpu/shaders/infos/gpu_shader_test_info.hh | 194 ++- .../gpu/shaders/infos/gpu_shader_text_info.hh | 42 +- .../gpu_srgb_to_framebuffer_space_info.hh | 5 +- 138 files changed, 6460 insertions(+), 5653 deletions(-) diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_alpha_crop_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_alpha_crop_info.hh index 3f45bfbed23..c52918574fc 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_alpha_crop_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_alpha_crop_info.hh @@ -5,10 +5,11 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_alpha_crop) - .local_group_size(16, 16) - .push_constant(Type::IVEC2, "lower_bound") - .push_constant(Type::IVEC2, "upper_bound") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_alpha_crop.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(IVEC2, lower_bound) +PUSH_CONSTANT(IVEC2, upper_bound) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_alpha_crop.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bilateral_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bilateral_blur_info.hh index 48eea13b7da..4494e4140c6 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bilateral_blur_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bilateral_blur_info.hh @@ -5,11 +5,12 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_bilateral_blur) - .local_group_size(16, 16) - .push_constant(Type::INT, "radius") - .push_constant(Type::FLOAT, "threshold") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "determinator_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_bilateral_blur.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, radius) +PUSH_CONSTANT(FLOAT, threshold) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, determinator_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_bilateral_blur.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_blur_info.hh index 0c5a20fea97..32653f00828 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_blur_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_blur_info.hh @@ -5,12 +5,13 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_bokeh_blur) - .local_group_size(16, 16) - .push_constant(Type::INT, "radius") - .push_constant(Type::BOOL, "extend_bounds") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "weights_tx") - .sampler(2, ImageType::FLOAT_2D, "mask_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_bokeh_blur.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, radius) +PUSH_CONSTANT(BOOL, extend_bounds) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, weights_tx) +SAMPLER(2, FLOAT_2D, mask_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_bokeh_blur.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_blur_variable_size_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_blur_variable_size_info.hh index 68c51b1911c..75cd0d0ac45 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_blur_variable_size_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_blur_variable_size_info.hh @@ -5,13 +5,14 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_bokeh_blur_variable_size) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "base_size") - .push_constant(Type::INT, "search_radius") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "weights_tx") - .sampler(2, ImageType::FLOAT_2D, "size_tx") - .sampler(3, ImageType::FLOAT_2D, "mask_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_bokeh_blur_variable_size.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, base_size) +PUSH_CONSTANT(INT, search_radius) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, weights_tx) +SAMPLER(2, FLOAT_2D, size_tx) +SAMPLER(3, FLOAT_2D, mask_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_bokeh_blur_variable_size.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_image_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_image_info.hh index 79f480256f1..9b47779bee7 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_image_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_image_info.hh @@ -5,12 +5,13 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_bokeh_image) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "exterior_angle") - .push_constant(Type::FLOAT, "rotation") - .push_constant(Type::FLOAT, "roundness") - .push_constant(Type::FLOAT, "catadioptric") - .push_constant(Type::FLOAT, "lens_shift") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_bokeh_image.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, exterior_angle) +PUSH_CONSTANT(FLOAT, rotation) +PUSH_CONSTANT(FLOAT, roundness) +PUSH_CONSTANT(FLOAT, catadioptric) +PUSH_CONSTANT(FLOAT, lens_shift) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_bokeh_image.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_box_mask_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_box_mask_info.hh index 068ca5286e3..7f105617489 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_box_mask_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_box_mask_info.hh @@ -5,33 +5,38 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_box_mask_shared) - .local_group_size(16, 16) - .push_constant(Type::IVEC2, "domain_size") - .push_constant(Type::VEC2, "location") - .push_constant(Type::VEC2, "size") - .push_constant(Type::FLOAT, "cos_angle") - .push_constant(Type::FLOAT, "sin_angle") - .sampler(0, ImageType::FLOAT_2D, "base_mask_tx") - .sampler(1, ImageType::FLOAT_2D, "mask_value_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_mask_img") - .compute_source("compositor_box_mask.glsl"); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(IVEC2, domain_size) +PUSH_CONSTANT(VEC2, location) +PUSH_CONSTANT(VEC2, size) +PUSH_CONSTANT(FLOAT, cos_angle) +PUSH_CONSTANT(FLOAT, sin_angle) +SAMPLER(0, FLOAT_2D, base_mask_tx) +SAMPLER(1, FLOAT_2D, mask_value_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_mask_img) +COMPUTE_SOURCE("compositor_box_mask.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_box_mask_add) - .additional_info("compositor_box_mask_shared") - .define("CMP_NODE_MASKTYPE_ADD") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_box_mask_shared) +DEFINE("CMP_NODE_MASKTYPE_ADD") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_box_mask_subtract) - .additional_info("compositor_box_mask_shared") - .define("CMP_NODE_MASKTYPE_SUBTRACT") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_box_mask_shared) +DEFINE("CMP_NODE_MASKTYPE_SUBTRACT") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_box_mask_multiply) - .additional_info("compositor_box_mask_shared") - .define("CMP_NODE_MASKTYPE_MULTIPLY") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_box_mask_shared) +DEFINE("CMP_NODE_MASKTYPE_MULTIPLY") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_box_mask_not) - .additional_info("compositor_box_mask_shared") - .define("CMP_NODE_MASKTYPE_NOT") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_box_mask_shared) +DEFINE("CMP_NODE_MASKTYPE_NOT") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_compute_preview_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_compute_preview_info.hh index 7c542b9fbb2..671f9c43a90 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_compute_preview_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_compute_preview_info.hh @@ -5,8 +5,9 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_compute_preview) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "preview_img") - .compute_source("compositor_compute_preview.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, preview_img) +COMPUTE_SOURCE("compositor_compute_preview.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_convert_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_convert_info.hh index 0fd680bdc9e..d42fb8e3731 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_convert_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_convert_info.hh @@ -5,67 +5,78 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_convert_shared) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .typedef_source("gpu_shader_compositor_type_conversion.glsl") - .compute_source("compositor_convert.glsl"); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +TYPEDEF_SOURCE("gpu_shader_compositor_type_conversion.glsl") +COMPUTE_SOURCE("compositor_convert.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float_to_float) - .additional_info("compositor_convert_shared") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("CONVERT_EXPRESSION(value)", "value") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_convert_shared) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("CONVERT_EXPRESSION(value)", "value") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float_to_vector) - .additional_info("compositor_convert_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("CONVERT_EXPRESSION(value)", "vec4(vec3_from_float(value.x), 1.0)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_convert_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(vec3_from_float(value.x), 1.0)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float_to_color) - .additional_info("compositor_convert_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("CONVERT_EXPRESSION(value)", "vec4_from_float(value.x)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_convert_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4_from_float(value.x)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_color_to_float) - .additional_info("compositor_convert_shared") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("CONVERT_EXPRESSION(value)", "vec4(float_from_vec4(value), vec3(0.0))") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_convert_shared) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(float_from_vec4(value), vec3(0.0))") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_color_to_vector) - .additional_info("compositor_convert_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("CONVERT_EXPRESSION(value)", "value") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_convert_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("CONVERT_EXPRESSION(value)", "value") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_color_to_color) - .additional_info("compositor_convert_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("CONVERT_EXPRESSION(value)", "value") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_convert_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("CONVERT_EXPRESSION(value)", "value") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_vector_to_float) - .additional_info("compositor_convert_shared") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("CONVERT_EXPRESSION(value)", "vec4(float_from_vec3(value.xyz), vec3(0.0))") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_convert_shared) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(float_from_vec3(value.xyz), vec3(0.0))") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_vector_to_vector) - .additional_info("compositor_convert_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("CONVERT_EXPRESSION(value)", "value") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_convert_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("CONVERT_EXPRESSION(value)", "value") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_vector_to_color) - .additional_info("compositor_convert_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("CONVERT_EXPRESSION(value)", "vec4_from_vec3(value.xyz)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_convert_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4_from_vec3(value.xyz)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_color_to_alpha) - .additional_info("compositor_convert_shared") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("CONVERT_EXPRESSION(value)", "vec4(value.a)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_convert_shared) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(value.a)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_cryptomatte_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_cryptomatte_info.hh index 1b68a89843d..2bccba46eb3 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_cryptomatte_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_cryptomatte_info.hh @@ -5,25 +5,28 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_cryptomatte_pick) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "first_layer_tx") - .image(0, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_cryptomatte_pick.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, first_layer_tx) +IMAGE(0, GPU_RGBA32F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_cryptomatte_pick.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_cryptomatte_matte) - .local_group_size(16, 16) - .push_constant(Type::INT, "identifiers_count") - .push_constant(Type::FLOAT, "identifiers", 32) - .sampler(0, ImageType::FLOAT_2D, "layer_tx") - .image(0, GPU_R16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "matte_img") - .compute_source("compositor_cryptomatte_matte.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, identifiers_count) +PUSH_CONSTANT_ARRAY(FLOAT, identifiers, 32) +SAMPLER(0, FLOAT_2D, layer_tx) +IMAGE(0, GPU_R16F, READ_WRITE, FLOAT_2D, matte_img) +COMPUTE_SOURCE("compositor_cryptomatte_matte.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_cryptomatte_image) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "matte_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_cryptomatte_image.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, matte_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_cryptomatte_image.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_defocus_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_defocus_info.hh index 6f92172a59b..36565e25a88 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_defocus_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_defocus_info.hh @@ -5,33 +5,36 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_defocus_radius_from_scale) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "scale") - .push_constant(Type::FLOAT, "max_radius") - .sampler(0, ImageType::FLOAT_2D, "radius_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "radius_img") - .compute_source("compositor_defocus_radius_from_scale.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, scale) +PUSH_CONSTANT(FLOAT, max_radius) +SAMPLER(0, FLOAT_2D, radius_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, radius_img) +COMPUTE_SOURCE("compositor_defocus_radius_from_scale.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_defocus_radius_from_depth) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "f_stop") - .push_constant(Type::FLOAT, "max_radius") - .push_constant(Type::FLOAT, "focal_length") - .push_constant(Type::FLOAT, "pixels_per_meter") - .push_constant(Type::FLOAT, "distance_to_image_of_focus") - .sampler(0, ImageType::FLOAT_2D, "depth_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "radius_img") - .compute_source("compositor_defocus_radius_from_depth.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, f_stop) +PUSH_CONSTANT(FLOAT, max_radius) +PUSH_CONSTANT(FLOAT, focal_length) +PUSH_CONSTANT(FLOAT, pixels_per_meter) +PUSH_CONSTANT(FLOAT, distance_to_image_of_focus) +SAMPLER(0, FLOAT_2D, depth_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, radius_img) +COMPUTE_SOURCE("compositor_defocus_radius_from_depth.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_defocus_blur) - .local_group_size(16, 16) - .push_constant(Type::BOOL, "gamma_correct") - .push_constant(Type::INT, "search_radius") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "weights_tx") - .sampler(2, ImageType::FLOAT_2D, "radius_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_defocus_blur.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(BOOL, gamma_correct) +PUSH_CONSTANT(INT, search_radius) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, weights_tx) +SAMPLER(2, FLOAT_2D, radius_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_defocus_blur.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_deriche_gaussian_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_deriche_gaussian_blur_info.hh index e792aeb0fe4..502703d5dfd 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_deriche_gaussian_blur_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_deriche_gaussian_blur_info.hh @@ -5,22 +5,24 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_deriche_gaussian_blur) - .local_group_size(128, 2) - .push_constant(Type::VEC4, "causal_feedforward_coefficients") - .push_constant(Type::VEC4, "non_causal_feedforward_coefficients") - .push_constant(Type::VEC4, "feedback_coefficients") - .push_constant(Type::FLOAT, "causal_boundary_coefficient") - .push_constant(Type::FLOAT, "non_causal_boundary_coefficient") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "causal_output_img") - .image(1, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "non_causal_output_img") - .compute_source("compositor_deriche_gaussian_blur.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(128, 2) +PUSH_CONSTANT(VEC4, causal_feedforward_coefficients) +PUSH_CONSTANT(VEC4, non_causal_feedforward_coefficients) +PUSH_CONSTANT(VEC4, feedback_coefficients) +PUSH_CONSTANT(FLOAT, causal_boundary_coefficient) +PUSH_CONSTANT(FLOAT, non_causal_boundary_coefficient) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, causal_output_img) +IMAGE(1, GPU_RGBA16F, WRITE, FLOAT_2D, non_causal_output_img) +COMPUTE_SOURCE("compositor_deriche_gaussian_blur.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_deriche_gaussian_blur_sum) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "causal_input_tx") - .sampler(1, ImageType::FLOAT_2D, "non_causal_input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_deriche_gaussian_blur_sum.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, causal_input_tx) +SAMPLER(1, FLOAT_2D, non_causal_input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_deriche_gaussian_blur_sum.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_despeckle_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_despeckle_info.hh index f94bfaa7ea0..156af295157 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_despeckle_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_despeckle_info.hh @@ -5,11 +5,12 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_despeckle) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "threshold") - .push_constant(Type::FLOAT, "neighbor_threshold") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "factor_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_despeckle.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, threshold) +PUSH_CONSTANT(FLOAT, neighbor_threshold) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, factor_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_despeckle.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_directional_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_directional_blur_info.hh index a1058a4e762..bd0d7a2969c 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_directional_blur_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_directional_blur_info.hh @@ -5,14 +5,15 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_directional_blur) - .local_group_size(16, 16) - .push_constant(Type::INT, "iterations") - .push_constant(Type::VEC2, "origin") - .push_constant(Type::VEC2, "translation") - .push_constant(Type::FLOAT, "rotation_sin") - .push_constant(Type::FLOAT, "rotation_cos") - .push_constant(Type::FLOAT, "scale") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_directional_blur.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, iterations) +PUSH_CONSTANT(VEC2, origin) +PUSH_CONSTANT(VEC2, translation) +PUSH_CONSTANT(FLOAT, rotation_sin) +PUSH_CONSTANT(FLOAT, rotation_cos) +PUSH_CONSTANT(FLOAT, scale) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_directional_blur.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_displace_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_displace_info.hh index 4baf9ced1e5..bc0a7ca33bd 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_displace_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_displace_info.hh @@ -5,11 +5,12 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_displace) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "displacement_tx") - .sampler(2, ImageType::FLOAT_2D, "x_scale_tx") - .sampler(3, ImageType::FLOAT_2D, "y_scale_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_displace.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, displacement_tx) +SAMPLER(2, FLOAT_2D, x_scale_tx) +SAMPLER(3, FLOAT_2D, y_scale_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_displace.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_double_edge_mask_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_double_edge_mask_info.hh index 049a6502d5a..b27df720c24 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_double_edge_mask_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_double_edge_mask_info.hh @@ -5,22 +5,24 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_double_edge_mask_compute_boundary) - .local_group_size(16, 16) - .push_constant(Type::BOOL, "include_all_inner_edges") - .push_constant(Type::BOOL, "include_edges_of_image") - .sampler(0, ImageType::FLOAT_2D, "inner_mask_tx") - .sampler(1, ImageType::FLOAT_2D, "outer_mask_tx") - .image(0, GPU_RG16I, Qualifier::WRITE, ImageType::INT_2D, "inner_boundary_img") - .image(1, GPU_RG16I, Qualifier::WRITE, ImageType::INT_2D, "outer_boundary_img") - .compute_source("compositor_double_edge_mask_compute_boundary.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(BOOL, include_all_inner_edges) +PUSH_CONSTANT(BOOL, include_edges_of_image) +SAMPLER(0, FLOAT_2D, inner_mask_tx) +SAMPLER(1, FLOAT_2D, outer_mask_tx) +IMAGE(0, GPU_RG16I, WRITE, INT_2D, inner_boundary_img) +IMAGE(1, GPU_RG16I, WRITE, INT_2D, outer_boundary_img) +COMPUTE_SOURCE("compositor_double_edge_mask_compute_boundary.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_double_edge_mask_compute_gradient) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "inner_mask_tx") - .sampler(1, ImageType::FLOAT_2D, "outer_mask_tx") - .sampler(2, ImageType::INT_2D, "flooded_inner_boundary_tx") - .sampler(3, ImageType::INT_2D, "flooded_outer_boundary_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_double_edge_mask_compute_gradient.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, inner_mask_tx) +SAMPLER(1, FLOAT_2D, outer_mask_tx) +SAMPLER(2, INT_2D, flooded_inner_boundary_tx) +SAMPLER(3, INT_2D, flooded_outer_boundary_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_double_edge_mask_compute_gradient.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_edge_filter_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_edge_filter_info.hh index c524a87c051..2e159f72358 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_edge_filter_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_edge_filter_info.hh @@ -5,10 +5,11 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_edge_filter) - .local_group_size(16, 16) - .push_constant(Type::MAT4, "ukernel") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "factor_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_edge_filter.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(MAT4, ukernel) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, factor_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_edge_filter.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_ellipse_mask_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_ellipse_mask_info.hh index 08776540640..8247ad833ba 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_ellipse_mask_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_ellipse_mask_info.hh @@ -5,33 +5,38 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_ellipse_mask_shared) - .local_group_size(16, 16) - .push_constant(Type::IVEC2, "domain_size") - .push_constant(Type::VEC2, "location") - .push_constant(Type::VEC2, "radius") - .push_constant(Type::FLOAT, "cos_angle") - .push_constant(Type::FLOAT, "sin_angle") - .sampler(0, ImageType::FLOAT_2D, "base_mask_tx") - .sampler(1, ImageType::FLOAT_2D, "mask_value_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_mask_img") - .compute_source("compositor_ellipse_mask.glsl"); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(IVEC2, domain_size) +PUSH_CONSTANT(VEC2, location) +PUSH_CONSTANT(VEC2, radius) +PUSH_CONSTANT(FLOAT, cos_angle) +PUSH_CONSTANT(FLOAT, sin_angle) +SAMPLER(0, FLOAT_2D, base_mask_tx) +SAMPLER(1, FLOAT_2D, mask_value_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_mask_img) +COMPUTE_SOURCE("compositor_ellipse_mask.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_ellipse_mask_add) - .additional_info("compositor_ellipse_mask_shared") - .define("CMP_NODE_MASKTYPE_ADD") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_ellipse_mask_shared) +DEFINE("CMP_NODE_MASKTYPE_ADD") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_ellipse_mask_subtract) - .additional_info("compositor_ellipse_mask_shared") - .define("CMP_NODE_MASKTYPE_SUBTRACT") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_ellipse_mask_shared) +DEFINE("CMP_NODE_MASKTYPE_SUBTRACT") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_ellipse_mask_multiply) - .additional_info("compositor_ellipse_mask_shared") - .define("CMP_NODE_MASKTYPE_MULTIPLY") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_ellipse_mask_shared) +DEFINE("CMP_NODE_MASKTYPE_MULTIPLY") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_ellipse_mask_not) - .additional_info("compositor_ellipse_mask_shared") - .define("CMP_NODE_MASKTYPE_NOT") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_ellipse_mask_shared) +DEFINE("CMP_NODE_MASKTYPE_NOT") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_filter_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_filter_info.hh index 55d9784a75a..685596edcd2 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_filter_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_filter_info.hh @@ -5,10 +5,11 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_filter) - .local_group_size(16, 16) - .push_constant(Type::MAT4, "ukernel") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "factor_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_filter.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(MAT4, ukernel) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, factor_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_filter.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_flip_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_flip_info.hh index 914600e26c1..9fba416e3af 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_flip_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_flip_info.hh @@ -5,10 +5,11 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_flip) - .local_group_size(16, 16) - .push_constant(Type::BOOL, "flip_x") - .push_constant(Type::BOOL, "flip_y") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_flip.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(BOOL, flip_x) +PUSH_CONSTANT(BOOL, flip_y) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_flip.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_glare_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_glare_info.hh index 1b1db807bf4..dae0ecaac31 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_glare_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_glare_info.hh @@ -9,126 +9,140 @@ * ------- */ GPU_SHADER_CREATE_INFO(compositor_glare_highlights) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "threshold") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_glare_highlights.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, threshold) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_glare_highlights.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_glare_mix) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "mix_factor") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "glare_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_glare_mix.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, mix_factor) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, glare_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_glare_mix.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* ------------ * Ghost Glare. * ------------ */ GPU_SHADER_CREATE_INFO(compositor_glare_ghost_base) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "small_ghost_tx") - .sampler(1, ImageType::FLOAT_2D, "big_ghost_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "combined_ghost_img") - .compute_source("compositor_glare_ghost_base.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, small_ghost_tx) +SAMPLER(1, FLOAT_2D, big_ghost_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, combined_ghost_img) +COMPUTE_SOURCE("compositor_glare_ghost_base.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_glare_ghost_accumulate) - .local_group_size(16, 16) - .push_constant(Type::VEC4, "scales") - .push_constant(Type::VEC4, "color_modulators", 4) - .sampler(0, ImageType::FLOAT_2D, "input_ghost_tx") - .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "accumulated_ghost_img") - .compute_source("compositor_glare_ghost_accumulate.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(VEC4, scales) +PUSH_CONSTANT_ARRAY(VEC4, color_modulators, 4) +SAMPLER(0, FLOAT_2D, input_ghost_tx) +IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, accumulated_ghost_img) +COMPUTE_SOURCE("compositor_glare_ghost_accumulate.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* ----------- * Simple Star * ----------- */ GPU_SHADER_CREATE_INFO(compositor_glare_simple_star_horizontal_pass) - .local_group_size(16) - .push_constant(Type::INT, "iterations") - .push_constant(Type::FLOAT, "fade_factor") - .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "horizontal_img") - .compute_source("compositor_glare_simple_star_horizontal_pass.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16) +PUSH_CONSTANT(INT, iterations) +PUSH_CONSTANT(FLOAT, fade_factor) +IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, horizontal_img) +COMPUTE_SOURCE("compositor_glare_simple_star_horizontal_pass.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_glare_simple_star_vertical_pass) - .local_group_size(16) - .push_constant(Type::INT, "iterations") - .push_constant(Type::FLOAT, "fade_factor") - .sampler(0, ImageType::FLOAT_2D, "horizontal_tx") - .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "vertical_img") - .compute_source("compositor_glare_simple_star_vertical_pass.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16) +PUSH_CONSTANT(INT, iterations) +PUSH_CONSTANT(FLOAT, fade_factor) +SAMPLER(0, FLOAT_2D, horizontal_tx) +IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, vertical_img) +COMPUTE_SOURCE("compositor_glare_simple_star_vertical_pass.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_glare_simple_star_diagonal_pass) - .local_group_size(16) - .push_constant(Type::INT, "iterations") - .push_constant(Type::FLOAT, "fade_factor") - .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "diagonal_img") - .compute_source("compositor_glare_simple_star_diagonal_pass.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16) +PUSH_CONSTANT(INT, iterations) +PUSH_CONSTANT(FLOAT, fade_factor) +IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, diagonal_img) +COMPUTE_SOURCE("compositor_glare_simple_star_diagonal_pass.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_glare_simple_star_anti_diagonal_pass) - .local_group_size(16) - .push_constant(Type::INT, "iterations") - .push_constant(Type::FLOAT, "fade_factor") - .sampler(0, ImageType::FLOAT_2D, "diagonal_tx") - .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "anti_diagonal_img") - .compute_source("compositor_glare_simple_star_anti_diagonal_pass.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16) +PUSH_CONSTANT(INT, iterations) +PUSH_CONSTANT(FLOAT, fade_factor) +SAMPLER(0, FLOAT_2D, diagonal_tx) +IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, anti_diagonal_img) +COMPUTE_SOURCE("compositor_glare_simple_star_anti_diagonal_pass.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* ------- * Streaks * ------- */ GPU_SHADER_CREATE_INFO(compositor_glare_streaks_filter) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "color_modulator") - .push_constant(Type::VEC3, "fade_factors") - .push_constant(Type::VEC2, "streak_vector") - .sampler(0, ImageType::FLOAT_2D, "input_streak_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_streak_img") - .compute_source("compositor_glare_streaks_filter.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, color_modulator) +PUSH_CONSTANT(VEC3, fade_factors) +PUSH_CONSTANT(VEC2, streak_vector) +SAMPLER(0, FLOAT_2D, input_streak_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_streak_img) +COMPUTE_SOURCE("compositor_glare_streaks_filter.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_glare_streaks_accumulate) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "attenuation_factor") - .sampler(0, ImageType::FLOAT_2D, "streak_tx") - .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "accumulated_streaks_img") - .compute_source("compositor_glare_streaks_accumulate.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, attenuation_factor) +SAMPLER(0, FLOAT_2D, streak_tx) +IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, accumulated_streaks_img) +COMPUTE_SOURCE("compositor_glare_streaks_accumulate.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* ----- * Bloom * ----- */ GPU_SHADER_CREATE_INFO(compositor_glare_bloom_downsample_shared) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_glare_bloom_downsample.glsl"); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_glare_bloom_downsample.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_glare_bloom_downsample_simple_average) - .define("SIMPLE_AVERAGE") - .additional_info("compositor_glare_bloom_downsample_shared") - .do_static_compilation(true); +DEFINE("SIMPLE_AVERAGE") +ADDITIONAL_INFO(compositor_glare_bloom_downsample_shared) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_glare_bloom_downsample_karis_average) - .define("KARIS_AVERAGE") - .additional_info("compositor_glare_bloom_downsample_shared") - .do_static_compilation(true); +DEFINE("KARIS_AVERAGE") +ADDITIONAL_INFO(compositor_glare_bloom_downsample_shared) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_glare_bloom_upsample) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_glare_bloom_upsample.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_glare_bloom_upsample.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_id_mask_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_id_mask_info.hh index dbdd28d7a84..c72d1f038e6 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_id_mask_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_id_mask_info.hh @@ -5,9 +5,10 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_id_mask) - .local_group_size(16, 16) - .push_constant(Type::INT, "index") - .sampler(0, ImageType::FLOAT_2D, "input_mask_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_mask_img") - .compute_source("compositor_id_mask.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, index) +SAMPLER(0, FLOAT_2D, input_mask_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_mask_img) +COMPUTE_SOURCE("compositor_id_mask.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_image_crop_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_image_crop_info.hh index bcbd1278ed7..6a2a013ee0a 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_image_crop_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_image_crop_info.hh @@ -5,9 +5,10 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_image_crop) - .local_group_size(16, 16) - .push_constant(Type::IVEC2, "lower_bound") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_image_crop.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(IVEC2, lower_bound) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_image_crop.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_inpaint_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_inpaint_info.hh index bb2719992fb..5ffc3867837 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_inpaint_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_inpaint_info.hh @@ -5,29 +5,32 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_inpaint_compute_boundary) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RG16I, Qualifier::WRITE, ImageType::INT_2D, "boundary_img") - .compute_source("compositor_inpaint_compute_boundary.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RG16I, WRITE, INT_2D, boundary_img) +COMPUTE_SOURCE("compositor_inpaint_compute_boundary.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_inpaint_fill_region) - .local_group_size(16, 16) - .push_constant(Type::INT, "max_distance") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::INT_2D, "flooded_boundary_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "filled_region_img") - .image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "distance_to_boundary_img") - .image(2, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "smoothing_radius_img") - .compute_source("compositor_inpaint_fill_region.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, max_distance) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, INT_2D, flooded_boundary_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, filled_region_img) +IMAGE(1, GPU_R16F, WRITE, FLOAT_2D, distance_to_boundary_img) +IMAGE(2, GPU_R16F, WRITE, FLOAT_2D, smoothing_radius_img) +COMPUTE_SOURCE("compositor_inpaint_fill_region.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_inpaint_compute_region) - .local_group_size(16, 16) - .push_constant(Type::INT, "max_distance") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "inpainted_region_tx") - .sampler(2, ImageType::FLOAT_2D, "distance_to_boundary_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_inpaint_compute_region.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, max_distance) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, inpainted_region_tx) +SAMPLER(2, FLOAT_2D, distance_to_boundary_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_inpaint_compute_region.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_jump_flooding_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_jump_flooding_info.hh index 90648beac22..536ad38ef19 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_jump_flooding_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_jump_flooding_info.hh @@ -5,9 +5,10 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_jump_flooding) - .local_group_size(16, 16) - .push_constant(Type::INT, "step_size") - .sampler(0, ImageType::INT_2D, "input_tx") - .image(0, GPU_RG16I, Qualifier::WRITE, ImageType::INT_2D, "output_img") - .compute_source("compositor_jump_flooding.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, step_size) +SAMPLER(0, INT_2D, input_tx) +IMAGE(0, GPU_RG16I, WRITE, INT_2D, output_img) +COMPUTE_SOURCE("compositor_jump_flooding.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_keying_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_keying_info.hh index 479c4ee94bd..748c3a321a2 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_keying_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_keying_info.hh @@ -5,53 +5,58 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_keying_extract_chroma) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_keying_extract_chroma.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_keying_extract_chroma.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_keying_replace_chroma) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "new_chroma_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_keying_replace_chroma.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, new_chroma_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_keying_replace_chroma.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_keying_compute_matte) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "key_balance") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "key_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_keying_compute_matte.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, key_balance) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, key_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_keying_compute_matte.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_keying_tweak_matte) - .local_group_size(16, 16) - .push_constant(Type::BOOL, "compute_edges") - .push_constant(Type::BOOL, "apply_core_matte") - .push_constant(Type::BOOL, "apply_garbage_matte") - .push_constant(Type::INT, "edge_search_radius") - .push_constant(Type::FLOAT, "edge_tolerance") - .push_constant(Type::FLOAT, "black_level") - .push_constant(Type::FLOAT, "white_level") - .sampler(0, ImageType::FLOAT_2D, "input_matte_tx") - .sampler(1, ImageType::FLOAT_2D, "garbage_matte_tx") - .sampler(2, ImageType::FLOAT_2D, "core_matte_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_matte_img") - .image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_edges_img") - .compute_source("compositor_keying_tweak_matte.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(BOOL, compute_edges) +PUSH_CONSTANT(BOOL, apply_core_matte) +PUSH_CONSTANT(BOOL, apply_garbage_matte) +PUSH_CONSTANT(INT, edge_search_radius) +PUSH_CONSTANT(FLOAT, edge_tolerance) +PUSH_CONSTANT(FLOAT, black_level) +PUSH_CONSTANT(FLOAT, white_level) +SAMPLER(0, FLOAT_2D, input_matte_tx) +SAMPLER(1, FLOAT_2D, garbage_matte_tx) +SAMPLER(2, FLOAT_2D, core_matte_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_matte_img) +IMAGE(1, GPU_R16F, WRITE, FLOAT_2D, output_edges_img) +COMPUTE_SOURCE("compositor_keying_tweak_matte.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_keying_compute_image) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "despill_factor") - .push_constant(Type::FLOAT, "despill_balance") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "matte_tx") - .sampler(2, ImageType::FLOAT_2D, "key_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_keying_compute_image.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, despill_factor) +PUSH_CONSTANT(FLOAT, despill_balance) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, matte_tx) +SAMPLER(2, FLOAT_2D, key_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_keying_compute_image.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_keying_screen_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_keying_screen_info.hh index ee1fd91e865..547a2719106 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_keying_screen_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_keying_screen_info.hh @@ -5,11 +5,12 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_keying_screen) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "smoothness") - .push_constant(Type::INT, "number_of_markers") - .storage_buf(0, Qualifier::READ, "vec2", "marker_positions[]") - .storage_buf(1, Qualifier::READ, "vec4", "marker_colors[]") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_keying_screen.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, smoothness) +PUSH_CONSTANT(INT, number_of_markers) +STORAGE_BUF(0, READ, vec2, marker_positions[]) +STORAGE_BUF(1, READ, vec4, marker_colors[]) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_keying_screen.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_kuwahara_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_kuwahara_info.hh index 9aa88260774..d4100fd57e4 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_kuwahara_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_kuwahara_info.hh @@ -5,68 +5,79 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_kuwahara_classic_shared) - .local_group_size(16, 16) - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_kuwahara_classic.glsl"); +LOCAL_GROUP_SIZE(16, 16) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_kuwahara_classic.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_kuwahara_classic_convolution_shared) - .additional_info("compositor_kuwahara_classic_shared") - .sampler(0, ImageType::FLOAT_2D, "input_tx"); +ADDITIONAL_INFO(compositor_kuwahara_classic_shared) +SAMPLER(0, FLOAT_2D, input_tx) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_kuwahara_classic_convolution_constant_size) - .additional_info("compositor_kuwahara_classic_convolution_shared") - .push_constant(Type::INT, "size") - .define("CONSTANT_SIZE") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_kuwahara_classic_convolution_shared) +PUSH_CONSTANT(INT, size) +DEFINE("CONSTANT_SIZE") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_kuwahara_classic_convolution_variable_size) - .additional_info("compositor_kuwahara_classic_convolution_shared") - .sampler(1, ImageType::FLOAT_2D, "size_tx") - .define("VARIABLE_SIZE") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_kuwahara_classic_convolution_shared) +SAMPLER(1, FLOAT_2D, size_tx) +DEFINE("VARIABLE_SIZE") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_kuwahara_classic_summed_area_table_shared) - .additional_info("compositor_kuwahara_classic_shared") - .define("SUMMED_AREA_TABLE") - .sampler(0, ImageType::FLOAT_2D, "table_tx") - .sampler(1, ImageType::FLOAT_2D, "squared_table_tx"); +ADDITIONAL_INFO(compositor_kuwahara_classic_shared) +DEFINE("SUMMED_AREA_TABLE") +SAMPLER(0, FLOAT_2D, table_tx) +SAMPLER(1, FLOAT_2D, squared_table_tx) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_kuwahara_classic_summed_area_table_constant_size) - .additional_info("compositor_kuwahara_classic_summed_area_table_shared") - .push_constant(Type::INT, "size") - .define("CONSTANT_SIZE") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_kuwahara_classic_summed_area_table_shared) +PUSH_CONSTANT(INT, size) +DEFINE("CONSTANT_SIZE") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_kuwahara_classic_summed_area_table_variable_size) - .additional_info("compositor_kuwahara_classic_summed_area_table_shared") - .sampler(2, ImageType::FLOAT_2D, "size_tx") - .define("VARIABLE_SIZE") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_kuwahara_classic_summed_area_table_shared) +SAMPLER(2, FLOAT_2D, size_tx) +DEFINE("VARIABLE_SIZE") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_kuwahara_anisotropic_compute_structure_tensor) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "structure_tensor_img") - .compute_source("compositor_kuwahara_anisotropic_compute_structure_tensor.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, structure_tensor_img) +COMPUTE_SOURCE("compositor_kuwahara_anisotropic_compute_structure_tensor.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_kuwahara_anisotropic_shared) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "eccentricity") - .push_constant(Type::FLOAT, "sharpness") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "structure_tensor_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_kuwahara_anisotropic.glsl"); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, eccentricity) +PUSH_CONSTANT(FLOAT, sharpness) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, structure_tensor_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_kuwahara_anisotropic.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_kuwahara_anisotropic_constant_size) - .additional_info("compositor_kuwahara_anisotropic_shared") - .define("CONSTANT_SIZE") - .push_constant(Type::FLOAT, "size") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_kuwahara_anisotropic_shared) +DEFINE("CONSTANT_SIZE") +PUSH_CONSTANT(FLOAT, size) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_kuwahara_anisotropic_variable_size) - .additional_info("compositor_kuwahara_anisotropic_shared") - .define("VARIABLE_SIZE") - .sampler(2, ImageType::FLOAT_2D, "size_tx") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_kuwahara_anisotropic_shared) +DEFINE("VARIABLE_SIZE") +SAMPLER(2, FLOAT_2D, size_tx) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_map_uv_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_map_uv_info.hh index 73d87a020df..bbdd122cc26 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_map_uv_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_map_uv_info.hh @@ -5,18 +5,21 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_map_uv_shared) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "uv_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img"); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, uv_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_map_uv_anisotropic) - .additional_info("compositor_map_uv_shared") - .push_constant(Type::FLOAT, "gradient_attenuation_factor") - .compute_source("compositor_map_uv_anisotropic.glsl") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_map_uv_shared) +PUSH_CONSTANT(FLOAT, gradient_attenuation_factor) +COMPUTE_SOURCE("compositor_map_uv_anisotropic.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_map_uv_nearest_neighbour) - .additional_info("compositor_map_uv_shared") - .compute_source("compositor_map_uv_nearest_neighbour.glsl") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_map_uv_shared) +COMPUTE_SOURCE("compositor_map_uv_nearest_neighbour.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_blur_info.hh index 0a6098b1e32..6d0035aa02a 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_blur_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_blur_info.hh @@ -5,17 +5,20 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_morphological_blur_shared) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_R16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "blurred_input_img") - .compute_source("compositor_morphological_blur.glsl"); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_R16F, READ_WRITE, FLOAT_2D, blurred_input_img) +COMPUTE_SOURCE("compositor_morphological_blur.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_morphological_blur_dilate) - .additional_info("compositor_morphological_blur_shared") - .define("OPERATOR(x, y)", "max(x, y)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_morphological_blur_shared) +DEFINE_VALUE("OPERATOR(x, y)", "max(x, y)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_morphological_blur_erode) - .additional_info("compositor_morphological_blur_shared") - .define("OPERATOR(x, y)", "min(x, y)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_morphological_blur_shared) +DEFINE_VALUE("OPERATOR(x, y)", "min(x, y)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_feather_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_feather_info.hh index bc777cbd9af..d45c808f6fb 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_feather_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_feather_info.hh @@ -5,19 +5,22 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_morphological_distance_feather_shared) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_1D, "weights_tx") - .sampler(2, ImageType::FLOAT_1D, "falloffs_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_morphological_distance_feather.glsl"); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_1D, weights_tx) +SAMPLER(2, FLOAT_1D, falloffs_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_morphological_distance_feather.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_morphological_distance_feather_dilate) - .additional_info("compositor_morphological_distance_feather_shared") - .define("FUNCTION(x)", "x") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_morphological_distance_feather_shared) +DEFINE_VALUE("FUNCTION(x)", "x") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_morphological_distance_feather_erode) - .additional_info("compositor_morphological_distance_feather_shared") - .define("FUNCTION(x)", "1.0 - x") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_morphological_distance_feather_shared) +DEFINE_VALUE("FUNCTION(x)", "1.0 - x") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_info.hh index 8eca47d6012..11aefeef699 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_info.hh @@ -5,20 +5,23 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_morphological_distance_shared) - .local_group_size(16, 16) - .push_constant(Type::INT, "radius") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_morphological_distance.glsl"); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, radius) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_morphological_distance.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_morphological_distance_dilate) - .additional_info("compositor_morphological_distance_shared") - .define("OPERATOR(a, b)", "max(a, b)") - .define("LIMIT", "FLT_MIN") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_morphological_distance_shared) +DEFINE_VALUE("OPERATOR(a, b)", "max(a, b)") +DEFINE_VALUE("LIMIT", "FLT_MIN") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_morphological_distance_erode) - .additional_info("compositor_morphological_distance_shared") - .define("OPERATOR(a, b)", "min(a, b)") - .define("LIMIT", "FLT_MAX") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_morphological_distance_shared) +DEFINE_VALUE("OPERATOR(a, b)", "min(a, b)") +DEFINE_VALUE("LIMIT", "FLT_MAX") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_threshold_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_threshold_info.hh index cd5bad139a4..7d7d710f26e 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_threshold_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_threshold_info.hh @@ -5,11 +5,12 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_morphological_distance_threshold) - .local_group_size(16, 16) - .push_constant(Type::INT, "radius") - .push_constant(Type::INT, "distance") - .push_constant(Type::FLOAT, "inset") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_morphological_distance_threshold.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, radius) +PUSH_CONSTANT(INT, distance) +PUSH_CONSTANT(FLOAT, inset) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_morphological_distance_threshold.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_step_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_step_info.hh index 0d58f27b757..0b3fc35d23b 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_step_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_step_info.hh @@ -5,20 +5,23 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_morphological_step_shared) - .local_group_size(16, 16) - .push_constant(Type::INT, "radius") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_morphological_step.glsl"); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, radius) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_morphological_step.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_morphological_step_dilate) - .additional_info("compositor_morphological_step_shared") - .define("OPERATOR(a, b)", "max(a, b)") - .define("LIMIT", "FLT_MIN") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_morphological_step_shared) +DEFINE_VALUE("OPERATOR(a, b)", "max(a, b)") +DEFINE_VALUE("LIMIT", "FLT_MIN") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_morphological_step_erode) - .additional_info("compositor_morphological_step_shared") - .define("OPERATOR(a, b)", "min(a, b)") - .define("LIMIT", "FLT_MAX") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_morphological_step_shared) +DEFINE_VALUE("OPERATOR(a, b)", "min(a, b)") +DEFINE_VALUE("LIMIT", "FLT_MAX") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_motion_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_motion_blur_info.hh index 446090c63a2..8f3fe0a8529 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_motion_blur_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_motion_blur_info.hh @@ -5,22 +5,24 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_motion_blur_max_velocity_dilate) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "shutter_speed") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .storage_buf(0, Qualifier::READ_WRITE, "uint", "tile_indirection_buf[]") - .compute_source("compositor_motion_blur_max_velocity_dilate.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, shutter_speed) +SAMPLER(0, FLOAT_2D, input_tx) +STORAGE_BUF(0, READ_WRITE, uint, tile_indirection_buf[]) +COMPUTE_SOURCE("compositor_motion_blur_max_velocity_dilate.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_motion_blur) - .local_group_size(16, 16) - .push_constant(Type::INT, "samples_count") - .push_constant(Type::FLOAT, "shutter_speed") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "depth_tx") - .sampler(2, ImageType::FLOAT_2D, "velocity_tx") - .sampler(3, ImageType::FLOAT_2D, "max_velocity_tx") - .storage_buf(0, Qualifier::READ, "uint", "tile_indirection_buf[]") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_motion_blur.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, samples_count) +PUSH_CONSTANT(FLOAT, shutter_speed) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, depth_tx) +SAMPLER(2, FLOAT_2D, velocity_tx) +SAMPLER(3, FLOAT_2D, max_velocity_tx) +STORAGE_BUF(0, READ, uint, tile_indirection_buf[]) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_motion_blur.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_movie_distortion_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_movie_distortion_info.hh index a18504ba48f..3469a8b7823 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_movie_distortion_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_movie_distortion_info.hh @@ -5,9 +5,10 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_movie_distortion) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "distortion_grid_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_movie_distortion.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, distortion_grid_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_movie_distortion.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_normalize_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_normalize_info.hh index 284f8dbfaca..21ad46b0953 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_normalize_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_normalize_info.hh @@ -5,10 +5,11 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_normalize) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "minimum") - .push_constant(Type::FLOAT, "scale") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_normalize.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, minimum) +PUSH_CONSTANT(FLOAT, scale) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_normalize.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_parallel_reduction_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_parallel_reduction_info.hh index b0859269a99..34cecf19ca7 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_parallel_reduction_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_parallel_reduction_info.hh @@ -5,189 +5,210 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_parallel_reduction_shared) - .local_group_size(16, 16) - .push_constant(Type::BOOL, "is_initial_reduction") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .compute_source("compositor_parallel_reduction.glsl"); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(BOOL, is_initial_reduction) +SAMPLER(0, FLOAT_2D, input_tx) +COMPUTE_SOURCE("compositor_parallel_reduction.glsl") +GPU_SHADER_CREATE_END() /* -------------------------------------------------------------------- * Sum Reductions. */ GPU_SHADER_CREATE_INFO(compositor_sum_shared) - .additional_info("compositor_parallel_reduction_shared") - .define("REDUCE(lhs, rhs)", "lhs + rhs"); +ADDITIONAL_INFO(compositor_parallel_reduction_shared) +DEFINE_VALUE("REDUCE(lhs, rhs)", "lhs + rhs") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_sum_float_shared) - .additional_info("compositor_sum_shared") - .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("TYPE", "float") - .define("IDENTITY", "0.0") - .define("LOAD(value)", "value.x"); +ADDITIONAL_INFO(compositor_sum_shared) +IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("TYPE", "float") +DEFINE_VALUE("IDENTITY", "0.0") +DEFINE_VALUE("LOAD(value)", "value.x") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_sum_red) - .additional_info("compositor_sum_float_shared") - .define("INITIALIZE(value)", "value.r") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_sum_float_shared) +DEFINE_VALUE("INITIALIZE(value)", "value.r") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_sum_green) - .additional_info("compositor_sum_float_shared") - .define("INITIALIZE(value)", "value.g") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_sum_float_shared) +DEFINE_VALUE("INITIALIZE(value)", "value.g") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_sum_blue) - .additional_info("compositor_sum_float_shared") - .define("INITIALIZE(value)", "value.b") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_sum_float_shared) +DEFINE_VALUE("INITIALIZE(value)", "value.b") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_sum_luminance) - .additional_info("compositor_sum_float_shared") - .push_constant(Type::VEC3, "luminance_coefficients") - .define("INITIALIZE(value)", "dot(value.rgb, luminance_coefficients)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_sum_float_shared) +PUSH_CONSTANT(VEC3, luminance_coefficients) +DEFINE_VALUE("INITIALIZE(value)", "dot(value.rgb, luminance_coefficients)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_sum_log_luminance) - .additional_info("compositor_sum_float_shared") - .push_constant(Type::VEC3, "luminance_coefficients") - .define("INITIALIZE(value)", "log(max(dot(value.rgb, luminance_coefficients), 1e-5))") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_sum_float_shared) +PUSH_CONSTANT(VEC3, luminance_coefficients) +DEFINE_VALUE("INITIALIZE(value)", "log(max(dot(value.rgb, luminance_coefficients), 1e-5))") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_sum_color) - .additional_info("compositor_sum_shared") - .image(0, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("TYPE", "vec4") - .define("IDENTITY", "vec4(0.0)") - .define("INITIALIZE(value)", "value") - .define("LOAD(value)", "value") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_sum_shared) +IMAGE(0, GPU_RGBA32F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("TYPE", "vec4") +DEFINE_VALUE("IDENTITY", "vec4(0.0)") +DEFINE_VALUE("INITIALIZE(value)", "value") +DEFINE_VALUE("LOAD(value)", "value") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* -------------------------------------------------------------------- * Sum Of Squared Difference Reductions. */ GPU_SHADER_CREATE_INFO(compositor_sum_squared_difference_float_shared) - .additional_info("compositor_parallel_reduction_shared") - .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .push_constant(Type::FLOAT, "subtrahend") - .define("TYPE", "float") - .define("IDENTITY", "0.0") - .define("LOAD(value)", "value.x") - .define("REDUCE(lhs, rhs)", "lhs + rhs"); +ADDITIONAL_INFO(compositor_parallel_reduction_shared) +IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, output_img) +PUSH_CONSTANT(FLOAT, subtrahend) +DEFINE_VALUE("TYPE", "float") +DEFINE_VALUE("IDENTITY", "0.0") +DEFINE_VALUE("LOAD(value)", "value.x") +DEFINE_VALUE("REDUCE(lhs, rhs)", "lhs + rhs") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_sum_red_squared_difference) - .additional_info("compositor_sum_squared_difference_float_shared") - .define("INITIALIZE(value)", "pow(value.r - subtrahend, 2.0)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_sum_squared_difference_float_shared) +DEFINE_VALUE("INITIALIZE(value)", "pow(value.r - subtrahend, 2.0)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_sum_green_squared_difference) - .additional_info("compositor_sum_squared_difference_float_shared") - .define("INITIALIZE(value)", "pow(value.g - subtrahend, 2.0)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_sum_squared_difference_float_shared) +DEFINE_VALUE("INITIALIZE(value)", "pow(value.g - subtrahend, 2.0)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_sum_blue_squared_difference) - .additional_info("compositor_sum_squared_difference_float_shared") - .define("INITIALIZE(value)", "pow(value.b - subtrahend, 2.0)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_sum_squared_difference_float_shared) +DEFINE_VALUE("INITIALIZE(value)", "pow(value.b - subtrahend, 2.0)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_sum_luminance_squared_difference) - .additional_info("compositor_sum_squared_difference_float_shared") - .push_constant(Type::VEC3, "luminance_coefficients") - .define("INITIALIZE(value)", "pow(dot(value.rgb, luminance_coefficients) - subtrahend, 2.0)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_sum_squared_difference_float_shared) +PUSH_CONSTANT(VEC3, luminance_coefficients) +DEFINE_VALUE("INITIALIZE(value)", "pow(dot(value.rgb, luminance_coefficients) - subtrahend, 2.0)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* -------------------------------------------------------------------- * Maximum Reductions. */ GPU_SHADER_CREATE_INFO(compositor_maximum_luminance) - .additional_info("compositor_parallel_reduction_shared") - .typedef_source("common_math_lib.glsl") - .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .push_constant(Type::VEC3, "luminance_coefficients") - .define("TYPE", "float") - .define("IDENTITY", "FLT_MIN") - .define("INITIALIZE(value)", "dot(value.rgb, luminance_coefficients)") - .define("LOAD(value)", "value.x") - .define("REDUCE(lhs, rhs)", "max(lhs, rhs)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_parallel_reduction_shared) +TYPEDEF_SOURCE("common_math_lib.glsl") +IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, output_img) +PUSH_CONSTANT(VEC3, luminance_coefficients) +DEFINE_VALUE("TYPE", "float") +DEFINE_VALUE("IDENTITY", "FLT_MIN") +DEFINE_VALUE("INITIALIZE(value)", "dot(value.rgb, luminance_coefficients)") +DEFINE_VALUE("LOAD(value)", "value.x") +DEFINE_VALUE("REDUCE(lhs, rhs)", "max(lhs, rhs)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_maximum_float) - .additional_info("compositor_parallel_reduction_shared") - .typedef_source("common_math_lib.glsl") - .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("TYPE", "float") - .define("IDENTITY", "FLT_MIN") - .define("INITIALIZE(value)", "value.x") - .define("LOAD(value)", "value.x") - .define("REDUCE(lhs, rhs)", "max(rhs, lhs)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_parallel_reduction_shared) +TYPEDEF_SOURCE("common_math_lib.glsl") +IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("TYPE", "float") +DEFINE_VALUE("IDENTITY", "FLT_MIN") +DEFINE_VALUE("INITIALIZE(value)", "value.x") +DEFINE_VALUE("LOAD(value)", "value.x") +DEFINE_VALUE("REDUCE(lhs, rhs)", "max(rhs, lhs)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_maximum_float_in_range) - .additional_info("compositor_parallel_reduction_shared") - .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .push_constant(Type::FLOAT, "lower_bound") - .push_constant(Type::FLOAT, "upper_bound") - .define("TYPE", "float") - .define("IDENTITY", "lower_bound") - .define("INITIALIZE(v)", "((v.x <= upper_bound) && (v.x >= lower_bound)) ? v.x : lower_bound") - .define("LOAD(value)", "value.x") - .define("REDUCE(lhs, rhs)", "((rhs > lhs) && (rhs <= upper_bound)) ? rhs : lhs") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_parallel_reduction_shared) +IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, output_img) +PUSH_CONSTANT(FLOAT, lower_bound) +PUSH_CONSTANT(FLOAT, upper_bound) +DEFINE_VALUE("TYPE", "float") +DEFINE_VALUE("IDENTITY", "lower_bound") +DEFINE_VALUE("INITIALIZE(v)", "((v.x <= upper_bound) && (v.x >= lower_bound)) ? v.x : lower_bound") +DEFINE_VALUE("LOAD(value)", "value.x") +DEFINE_VALUE("REDUCE(lhs, rhs)", "((rhs > lhs) && (rhs <= upper_bound)) ? rhs : lhs") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* -------------------------------------------------------------------- * Minimum Reductions. */ GPU_SHADER_CREATE_INFO(compositor_minimum_luminance) - .additional_info("compositor_parallel_reduction_shared") - .typedef_source("common_math_lib.glsl") - .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .push_constant(Type::VEC3, "luminance_coefficients") - .define("TYPE", "float") - .define("IDENTITY", "FLT_MAX") - .define("INITIALIZE(value)", "dot(value.rgb, luminance_coefficients)") - .define("LOAD(value)", "value.x") - .define("REDUCE(lhs, rhs)", "min(lhs, rhs)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_parallel_reduction_shared) +TYPEDEF_SOURCE("common_math_lib.glsl") +IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, output_img) +PUSH_CONSTANT(VEC3, luminance_coefficients) +DEFINE_VALUE("TYPE", "float") +DEFINE_VALUE("IDENTITY", "FLT_MAX") +DEFINE_VALUE("INITIALIZE(value)", "dot(value.rgb, luminance_coefficients)") +DEFINE_VALUE("LOAD(value)", "value.x") +DEFINE_VALUE("REDUCE(lhs, rhs)", "min(lhs, rhs)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_minimum_float) - .additional_info("compositor_parallel_reduction_shared") - .typedef_source("common_math_lib.glsl") - .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("TYPE", "float") - .define("IDENTITY", "FLT_MAX") - .define("INITIALIZE(value)", "value.x") - .define("LOAD(value)", "value.x") - .define("REDUCE(lhs, rhs)", "min(rhs, lhs)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_parallel_reduction_shared) +TYPEDEF_SOURCE("common_math_lib.glsl") +IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("TYPE", "float") +DEFINE_VALUE("IDENTITY", "FLT_MAX") +DEFINE_VALUE("INITIALIZE(value)", "value.x") +DEFINE_VALUE("LOAD(value)", "value.x") +DEFINE_VALUE("REDUCE(lhs, rhs)", "min(rhs, lhs)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_minimum_float_in_range) - .additional_info("compositor_parallel_reduction_shared") - .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .push_constant(Type::FLOAT, "lower_bound") - .push_constant(Type::FLOAT, "upper_bound") - .define("TYPE", "float") - .define("IDENTITY", "upper_bound") - .define("INITIALIZE(v)", "((v.x <= upper_bound) && (v.x >= lower_bound)) ? v.x : upper_bound") - .define("LOAD(value)", "value.x") - .define("REDUCE(lhs, rhs)", "((rhs < lhs) && (rhs >= lower_bound)) ? rhs : lhs") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_parallel_reduction_shared) +IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, output_img) +PUSH_CONSTANT(FLOAT, lower_bound) +PUSH_CONSTANT(FLOAT, upper_bound) +DEFINE_VALUE("TYPE", "float") +DEFINE_VALUE("IDENTITY", "upper_bound") +DEFINE_VALUE("INITIALIZE(v)", "((v.x <= upper_bound) && (v.x >= lower_bound)) ? v.x : upper_bound") +DEFINE_VALUE("LOAD(value)", "value.x") +DEFINE_VALUE("REDUCE(lhs, rhs)", "((rhs < lhs) && (rhs >= lower_bound)) ? rhs : lhs") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* -------------------------------------------------------------------- * Velocity Reductions. */ GPU_SHADER_CREATE_INFO(compositor_max_velocity) - .local_group_size(32, 32) - .push_constant(Type::BOOL, "is_initial_reduction") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("TYPE", "vec4") - .define("IDENTITY", "vec4(0.0)") - .define("INITIALIZE(value)", "value") - .define("LOAD(value)", "value") - .define("REDUCE(lhs, rhs)", - "vec4(dot(lhs.xy, lhs.xy) > dot(rhs.xy, rhs.xy) ? lhs.xy : rhs.xy," - " dot(lhs.zw, lhs.zw) > dot(rhs.zw, rhs.zw) ? lhs.zw : rhs.zw)") - .compute_source("compositor_parallel_reduction.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(32, 32) +PUSH_CONSTANT(BOOL, is_initial_reduction) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("TYPE", "vec4") +DEFINE_VALUE("IDENTITY", "vec4(0.0)") +DEFINE_VALUE("INITIALIZE(value)", "value") +DEFINE_VALUE("LOAD(value)", "value") +DEFINE_VALUE("REDUCE(lhs, rhs)", + "vec4(dot(lhs.xy, lhs.xy) > dot(rhs.xy, rhs.xy) ? lhs.xy : rhs.xy," + " dot(lhs.zw, lhs.zw) > dot(rhs.zw, rhs.zw) ? lhs.zw : rhs.zw)") +COMPUTE_SOURCE("compositor_parallel_reduction.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_pixelate_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_pixelate_info.hh index 47cc6cf4661..8df1a5ec50f 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_pixelate_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_pixelate_info.hh @@ -5,9 +5,10 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_pixelate) - .local_group_size(16, 16) - .push_constant(Type::INT, "pixel_size") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_pixelate.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, pixel_size) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_pixelate.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_plane_deform_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_plane_deform_info.hh index 445896c8b06..1aacbc11796 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_plane_deform_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_plane_deform_info.hh @@ -5,35 +5,39 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_plane_deform_mask) - .local_group_size(16, 16) - .push_constant(Type::MAT4, "homography_matrix") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "mask_img") - .compute_source("compositor_plane_deform_mask.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(MAT4, homography_matrix) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, mask_img) +COMPUTE_SOURCE("compositor_plane_deform_mask.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_plane_deform) - .local_group_size(16, 16) - .push_constant(Type::MAT4, "homography_matrix") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "mask_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_plane_deform.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(MAT4, homography_matrix) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, mask_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_plane_deform.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_plane_deform_motion_blur_mask) - .local_group_size(16, 16) - .push_constant(Type::INT, "number_of_motion_blur_samples") - .uniform_buf(0, "mat4", "homography_matrices[64]") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "mask_img") - .compute_source("compositor_plane_deform_motion_blur_mask.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, number_of_motion_blur_samples) +UNIFORM_BUF(0, mat4, homography_matrices[64]) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, mask_img) +COMPUTE_SOURCE("compositor_plane_deform_motion_blur_mask.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_plane_deform_motion_blur) - .local_group_size(16, 16) - .push_constant(Type::INT, "number_of_motion_blur_samples") - .uniform_buf(0, "mat4", "homography_matrices[64]") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "mask_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_plane_deform_motion_blur.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, number_of_motion_blur_samples) +UNIFORM_BUF(0, mat4, homography_matrices[64]) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, mask_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_plane_deform_motion_blur.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_premultiply_alpha_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_premultiply_alpha_info.hh index c698750269b..1baf1334b5b 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_premultiply_alpha_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_premultiply_alpha_info.hh @@ -5,8 +5,9 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_premultiply_alpha) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_premultiply_alpha.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_premultiply_alpha.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_projector_lens_distortion_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_projector_lens_distortion_info.hh index 1acd02baa42..5425065fbac 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_projector_lens_distortion_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_projector_lens_distortion_info.hh @@ -5,9 +5,10 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_projector_lens_distortion) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "dispersion") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_projector_lens_distortion.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, dispersion) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_projector_lens_distortion.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_read_input_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_read_input_info.hh index a8e80ebb948..0aa1be33ff8 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_read_input_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_read_input_info.hh @@ -5,31 +5,36 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_read_input_shared) - .local_group_size(16, 16) - .push_constant(Type::IVEC2, "lower_bound") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .compute_source("compositor_read_input.glsl"); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(IVEC2, lower_bound) +SAMPLER(0, FLOAT_2D, input_tx) +COMPUTE_SOURCE("compositor_read_input.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_read_input_float) - .additional_info("compositor_read_input_shared") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("READ_EXPRESSION(input_color)", "vec4(input_color.r, vec3(0.0))") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_read_input_shared) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("READ_EXPRESSION(input_color)", "vec4(input_color.r, vec3(0.0))") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_read_input_vector) - .additional_info("compositor_read_input_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("READ_EXPRESSION(input_color)", "input_color") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_read_input_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("READ_EXPRESSION(input_color)", "input_color") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_read_input_color) - .additional_info("compositor_read_input_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("READ_EXPRESSION(input_color)", "input_color") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_read_input_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("READ_EXPRESSION(input_color)", "input_color") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_read_input_alpha) - .additional_info("compositor_read_input_shared") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("READ_EXPRESSION(input_color)", "vec4(input_color.a, vec3(0.0))") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_read_input_shared) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("READ_EXPRESSION(input_color)", "vec4(input_color.a, vec3(0.0))") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_realize_on_domain_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_realize_on_domain_info.hh index b870d438ad3..725ba946b2f 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_realize_on_domain_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_realize_on_domain_info.hh @@ -5,45 +5,54 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_shared) - .local_group_size(16, 16) - .push_constant(Type::MAT4, "inverse_transformation") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .compute_source("compositor_realize_on_domain.glsl"); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(MAT4, inverse_transformation) +SAMPLER(0, FLOAT_2D, input_tx) +COMPUTE_SOURCE("compositor_realize_on_domain.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_standard_shared) - .additional_info("compositor_realize_on_domain_shared") - .define("SAMPLER_FUNCTION", "texture"); +ADDITIONAL_INFO(compositor_realize_on_domain_shared) +DEFINE_VALUE("SAMPLER_FUNCTION", "texture") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_bicubic_shared) - .additional_info("compositor_realize_on_domain_shared") - .define("SAMPLER_FUNCTION", "texture_bicubic"); +ADDITIONAL_INFO(compositor_realize_on_domain_shared) +DEFINE_VALUE("SAMPLER_FUNCTION", "texture_bicubic") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_color) - .additional_info("compositor_realize_on_domain_standard_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "domain_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_realize_on_domain_standard_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, domain_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_vector) - .additional_info("compositor_realize_on_domain_standard_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "domain_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_realize_on_domain_standard_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, domain_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_float) - .additional_info("compositor_realize_on_domain_standard_shared") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "domain_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_realize_on_domain_standard_shared) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, domain_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_bicubic_color) - .additional_info("compositor_realize_on_domain_bicubic_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "domain_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_realize_on_domain_bicubic_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, domain_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_bicubic_vector) - .additional_info("compositor_realize_on_domain_bicubic_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "domain_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_realize_on_domain_bicubic_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, domain_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_bicubic_float) - .additional_info("compositor_realize_on_domain_bicubic_shared") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "domain_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_realize_on_domain_bicubic_shared) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, domain_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_scale_variable_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_scale_variable_info.hh index 327ded2efab..24d316a2f05 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_scale_variable_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_scale_variable_info.hh @@ -5,10 +5,11 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_scale_variable) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "x_scale_tx") - .sampler(2, ImageType::FLOAT_2D, "y_scale_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_scale_variable.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, x_scale_tx) +SAMPLER(2, FLOAT_2D, y_scale_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_scale_variable.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_screen_lens_distortion_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_screen_lens_distortion_info.hh index e3b03f1e724..742bb2facbd 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_screen_lens_distortion_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_screen_lens_distortion_info.hh @@ -5,18 +5,21 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_screen_lens_distortion_shared) - .local_group_size(16, 16) - .push_constant(Type::VEC3, "chromatic_distortion") - .push_constant(Type::FLOAT, "scale") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_screen_lens_distortion.glsl"); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(VEC3, chromatic_distortion) +PUSH_CONSTANT(FLOAT, scale) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_screen_lens_distortion.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_screen_lens_distortion) - .additional_info("compositor_screen_lens_distortion_shared") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_screen_lens_distortion_shared) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_screen_lens_distortion_jitter) - .additional_info("compositor_screen_lens_distortion_shared") - .define("JITTER") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_screen_lens_distortion_shared) +DEFINE("JITTER") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_smaa_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_smaa_info.hh index 6b12ae4dfff..03169ab921a 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_smaa_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_smaa_info.hh @@ -5,55 +5,61 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_smaa_edge_detection) - .local_group_size(16, 16) - .define("SMAA_GLSL_3") - .define("SMAA_RT_METRICS", - "vec4(1.0 / vec2(textureSize(input_tx, 0)), vec2(textureSize(input_tx, 0)))") - .define("SMAA_LUMA_WEIGHT", "vec4(luminance_coefficients, 0.0)") - .define("SMAA_THRESHOLD", "smaa_threshold") - .define("SMAA_LOCAL_CONTRAST_ADAPTATION_FACTOR", "smaa_local_contrast_adaptation_factor") - .push_constant(Type::VEC3, "luminance_coefficients") - .push_constant(Type::FLOAT, "smaa_threshold") - .push_constant(Type::FLOAT, "smaa_local_contrast_adaptation_factor") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "edges_img") - .compute_source("compositor_smaa_edge_detection.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +DEFINE("SMAA_GLSL_3") +DEFINE_VALUE("SMAA_RT_METRICS", + "vec4(1.0 / vec2(textureSize(input_tx, 0)), vec2(textureSize(input_tx, 0)))") +DEFINE_VALUE("SMAA_LUMA_WEIGHT", "vec4(luminance_coefficients, 0.0)") +DEFINE_VALUE("SMAA_THRESHOLD", "smaa_threshold") +DEFINE_VALUE("SMAA_LOCAL_CONTRAST_ADAPTATION_FACTOR", "smaa_local_contrast_adaptation_factor") +PUSH_CONSTANT(VEC3, luminance_coefficients) +PUSH_CONSTANT(FLOAT, smaa_threshold) +PUSH_CONSTANT(FLOAT, smaa_local_contrast_adaptation_factor) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, edges_img) +COMPUTE_SOURCE("compositor_smaa_edge_detection.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_smaa_blending_weight_calculation) - .local_group_size(16, 16) - .define("SMAA_GLSL_3") - .define("SMAA_RT_METRICS", - "vec4(1.0 / vec2(textureSize(edges_tx, 0)), vec2(textureSize(edges_tx, 0)))") - .define("SMAA_CORNER_ROUNDING", "smaa_corner_rounding") - .push_constant(Type::INT, "smaa_corner_rounding") - .sampler(0, ImageType::FLOAT_2D, "edges_tx") - .sampler(1, ImageType::FLOAT_2D, "area_tx") - .sampler(2, ImageType::FLOAT_2D, "search_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "weights_img") - .compute_source("compositor_smaa_blending_weight_calculation.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +DEFINE("SMAA_GLSL_3") +DEFINE_VALUE("SMAA_RT_METRICS", + "vec4(1.0 / vec2(textureSize(edges_tx, 0)), vec2(textureSize(edges_tx, 0)))") +DEFINE_VALUE("SMAA_CORNER_ROUNDING", "smaa_corner_rounding") +PUSH_CONSTANT(INT, smaa_corner_rounding) +SAMPLER(0, FLOAT_2D, edges_tx) +SAMPLER(1, FLOAT_2D, area_tx) +SAMPLER(2, FLOAT_2D, search_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, weights_img) +COMPUTE_SOURCE("compositor_smaa_blending_weight_calculation.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_smaa_neighborhood_blending_shared) - .local_group_size(16, 16) - .define("SMAA_GLSL_3") - .define("SMAA_RT_METRICS", - "vec4(1.0 / vec2(textureSize(input_tx, 0)), vec2(textureSize(input_tx, 0)))") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "weights_tx") - .compute_source("compositor_smaa_neighborhood_blending.glsl"); +LOCAL_GROUP_SIZE(16, 16) +DEFINE("SMAA_GLSL_3") +DEFINE_VALUE("SMAA_RT_METRICS", + "vec4(1.0 / vec2(textureSize(input_tx, 0)), vec2(textureSize(input_tx, 0)))") +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, weights_tx) +COMPUTE_SOURCE("compositor_smaa_neighborhood_blending.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_smaa_neighborhood_blending_float4) - .additional_info("compositor_smaa_neighborhood_blending_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_smaa_neighborhood_blending_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_smaa_neighborhood_blending_float2) - .additional_info("compositor_smaa_neighborhood_blending_shared") - .image(0, GPU_RG16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_smaa_neighborhood_blending_shared) +IMAGE(0, GPU_RG16F, WRITE, FLOAT_2D, output_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_smaa_neighborhood_blending_float) - .additional_info("compositor_smaa_neighborhood_blending_shared") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_smaa_neighborhood_blending_shared) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_split_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_split_info.hh index 0529a8469f2..863e2244ac0 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_split_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_split_info.hh @@ -5,19 +5,22 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_split_shared) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "split_ratio") - .sampler(0, ImageType::FLOAT_2D, "first_image_tx") - .sampler(1, ImageType::FLOAT_2D, "second_image_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_split.glsl"); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, split_ratio) +SAMPLER(0, FLOAT_2D, first_image_tx) +SAMPLER(1, FLOAT_2D, second_image_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_split.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_split_horizontal) - .additional_info("compositor_split_shared") - .define("SPLIT_HORIZONTAL") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_split_shared) +DEFINE("SPLIT_HORIZONTAL") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_split_vertical) - .additional_info("compositor_split_shared") - .define("SPLIT_VERTICAL") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_split_shared) +DEFINE("SPLIT_VERTICAL") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_summed_area_table_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_summed_area_table_info.hh index 497fd2ea86d..56937b24e26 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_summed_area_table_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_summed_area_table_info.hh @@ -5,52 +5,60 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_summed_area_table_compute_incomplete_prologues_shared) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "incomplete_x_prologues_img") - .image(1, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "incomplete_y_prologues_img") - .compute_source("compositor_summed_area_table_compute_incomplete_prologues.glsl"); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA32F, WRITE, FLOAT_2D, incomplete_x_prologues_img) +IMAGE(1, GPU_RGBA32F, WRITE, FLOAT_2D, incomplete_y_prologues_img) +COMPUTE_SOURCE("compositor_summed_area_table_compute_incomplete_prologues.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_summed_area_table_compute_incomplete_prologues_identity) - .additional_info("compositor_summed_area_table_compute_incomplete_prologues_shared") - .define("OPERATION(value)", "value") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_summed_area_table_compute_incomplete_prologues_shared) +DEFINE_VALUE("OPERATION(value)", "value") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_summed_area_table_compute_incomplete_prologues_square) - .additional_info("compositor_summed_area_table_compute_incomplete_prologues_shared") - .define("OPERATION(value)", "value * value") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_summed_area_table_compute_incomplete_prologues_shared) +DEFINE_VALUE("OPERATION(value)", "value * value") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_summed_area_table_compute_complete_x_prologues) - .local_group_size(16) - .sampler(0, ImageType::FLOAT_2D, "incomplete_x_prologues_tx") - .image(0, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "complete_x_prologues_img") - .image(1, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "complete_x_prologues_sum_img") - .compute_source("compositor_summed_area_table_compute_complete_x_prologues.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16) +SAMPLER(0, FLOAT_2D, incomplete_x_prologues_tx) +IMAGE(0, GPU_RGBA32F, WRITE, FLOAT_2D, complete_x_prologues_img) +IMAGE(1, GPU_RGBA32F, WRITE, FLOAT_2D, complete_x_prologues_sum_img) +COMPUTE_SOURCE("compositor_summed_area_table_compute_complete_x_prologues.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_summed_area_table_compute_complete_y_prologues) - .local_group_size(16) - .sampler(0, ImageType::FLOAT_2D, "incomplete_y_prologues_tx") - .sampler(1, ImageType::FLOAT_2D, "complete_x_prologues_sum_tx") - .image(0, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "complete_y_prologues_img") - .compute_source("compositor_summed_area_table_compute_complete_y_prologues.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16) +SAMPLER(0, FLOAT_2D, incomplete_y_prologues_tx) +SAMPLER(1, FLOAT_2D, complete_x_prologues_sum_tx) +IMAGE(0, GPU_RGBA32F, WRITE, FLOAT_2D, complete_y_prologues_img) +COMPUTE_SOURCE("compositor_summed_area_table_compute_complete_y_prologues.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_summed_area_table_compute_complete_blocks_shared) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "complete_x_prologues_tx") - .sampler(2, ImageType::FLOAT_2D, "complete_y_prologues_tx") - .image(0, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_summed_area_table_compute_complete_blocks.glsl"); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, complete_x_prologues_tx) +SAMPLER(2, FLOAT_2D, complete_y_prologues_tx) +IMAGE(0, GPU_RGBA32F, READ_WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_summed_area_table_compute_complete_blocks.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_summed_area_table_compute_complete_blocks_identity) - .additional_info("compositor_summed_area_table_compute_complete_blocks_shared") - .define("OPERATION(value)", "value") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_summed_area_table_compute_complete_blocks_shared) +DEFINE_VALUE("OPERATION(value)", "value") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_summed_area_table_compute_complete_blocks_square) - .additional_info("compositor_summed_area_table_compute_complete_blocks_shared") - .define("OPERATION(value)", "value * value") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_summed_area_table_compute_complete_blocks_shared) +DEFINE_VALUE("OPERATION(value)", "value * value") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_sun_beams_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_sun_beams_info.hh index f6203e4a39f..227ec2d2639 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_sun_beams_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_sun_beams_info.hh @@ -5,10 +5,11 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_sun_beams) - .local_group_size(16, 16) - .push_constant(Type::VEC2, "source") - .push_constant(Type::INT, "max_steps") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_sun_beams.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(VEC2, source) +PUSH_CONSTANT(INT, max_steps) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_sun_beams.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_blur_info.hh index 8719e6277b1..08babaaeb74 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_blur_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_blur_info.hh @@ -5,11 +5,12 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_symmetric_blur) - .local_group_size(16, 16) - .push_constant(Type::BOOL, "extend_bounds") - .push_constant(Type::BOOL, "gamma_correct") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "weights_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_symmetric_blur.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(BOOL, extend_bounds) +PUSH_CONSTANT(BOOL, gamma_correct) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, weights_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_symmetric_blur.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_blur_variable_size_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_blur_variable_size_info.hh index 76ea55d2851..af5e6626c2b 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_blur_variable_size_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_blur_variable_size_info.hh @@ -5,12 +5,13 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_symmetric_blur_variable_size) - .local_group_size(16, 16) - .push_constant(Type::BOOL, "extend_bounds") - .push_constant(Type::BOOL, "gamma_correct") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "weights_tx") - .sampler(2, ImageType::FLOAT_2D, "size_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_symmetric_blur_variable_size.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(BOOL, extend_bounds) +PUSH_CONSTANT(BOOL, gamma_correct) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, weights_tx) +SAMPLER(2, FLOAT_2D, size_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_symmetric_blur_variable_size.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_separable_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_separable_blur_info.hh index 7a11dfad94b..7f112c6a349 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_separable_blur_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_separable_blur_info.hh @@ -5,25 +5,29 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_symmetric_separable_blur_shared) - .local_group_size(16, 16) - .push_constant(Type::BOOL, "extend_bounds") - .push_constant(Type::BOOL, "gamma_correct_input") - .push_constant(Type::BOOL, "gamma_uncorrect_output") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_1D, "weights_tx") - .compute_source("compositor_symmetric_separable_blur.glsl"); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(BOOL, extend_bounds) +PUSH_CONSTANT(BOOL, gamma_correct_input) +PUSH_CONSTANT(BOOL, gamma_uncorrect_output) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_1D, weights_tx) +COMPUTE_SOURCE("compositor_symmetric_separable_blur.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_symmetric_separable_blur_float) - .additional_info("compositor_symmetric_separable_blur_shared") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_symmetric_separable_blur_shared) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_symmetric_separable_blur_float2) - .additional_info("compositor_symmetric_separable_blur_shared") - .image(0, GPU_RG16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_symmetric_separable_blur_shared) +IMAGE(0, GPU_RG16F, WRITE, FLOAT_2D, output_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_symmetric_separable_blur_float4) - .additional_info("compositor_symmetric_separable_blur_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_symmetric_separable_blur_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_separable_blur_variable_size_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_separable_blur_variable_size_info.hh index 1528c111b0e..162bfe51762 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_separable_blur_variable_size_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_separable_blur_variable_size_info.hh @@ -5,24 +5,28 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_symmetric_separable_blur_variable_size_shared) - .local_group_size(16, 16) - .push_constant(Type::BOOL, "is_vertical_pass") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_1D, "weights_tx") - .sampler(2, ImageType::FLOAT_2D, "radius_tx") - .compute_source("compositor_symmetric_separable_blur_variable_size.glsl"); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(BOOL, is_vertical_pass) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_1D, weights_tx) +SAMPLER(2, FLOAT_2D, radius_tx) +COMPUTE_SOURCE("compositor_symmetric_separable_blur_variable_size.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_symmetric_separable_blur_variable_size_float) - .additional_info("compositor_symmetric_separable_blur_variable_size_shared") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_symmetric_separable_blur_variable_size_shared) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_symmetric_separable_blur_variable_size_float2) - .additional_info("compositor_symmetric_separable_blur_variable_size_shared") - .image(0, GPU_RG16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_symmetric_separable_blur_variable_size_shared) +IMAGE(0, GPU_RG16F, WRITE, FLOAT_2D, output_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_symmetric_separable_blur_variable_size_float4) - .additional_info("compositor_symmetric_separable_blur_variable_size_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_symmetric_separable_blur_variable_size_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_photoreceptor_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_photoreceptor_info.hh index fa8bf78bf2e..6a7668e6bc5 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_photoreceptor_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_photoreceptor_info.hh @@ -5,14 +5,15 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_tone_map_photoreceptor) - .local_group_size(16, 16) - .push_constant(Type::VEC4, "global_adaptation_level") - .push_constant(Type::FLOAT, "contrast") - .push_constant(Type::FLOAT, "intensity") - .push_constant(Type::FLOAT, "chromatic_adaptation") - .push_constant(Type::FLOAT, "light_adaptation") - .push_constant(Type::VEC3, "luminance_coefficients") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_tone_map_photoreceptor.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(VEC4, global_adaptation_level) +PUSH_CONSTANT(FLOAT, contrast) +PUSH_CONSTANT(FLOAT, intensity) +PUSH_CONSTANT(FLOAT, chromatic_adaptation) +PUSH_CONSTANT(FLOAT, light_adaptation) +PUSH_CONSTANT(VEC3, luminance_coefficients) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_tone_map_photoreceptor.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_simple_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_simple_info.hh index d5c56e22073..2dfde065581 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_simple_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_simple_info.hh @@ -5,11 +5,12 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_tone_map_simple) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "luminance_scale") - .push_constant(Type::FLOAT, "luminance_scale_blend_factor") - .push_constant(Type::FLOAT, "inverse_gamma") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_tone_map_simple.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, luminance_scale) +PUSH_CONSTANT(FLOAT, luminance_scale_blend_factor) +PUSH_CONSTANT(FLOAT, inverse_gamma) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_tone_map_simple.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_van_vliet_gaussian_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_van_vliet_gaussian_blur_info.hh index 9c5737257d7..243aeacc83a 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_van_vliet_gaussian_blur_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_van_vliet_gaussian_blur_info.hh @@ -5,31 +5,33 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_van_vliet_gaussian_blur) - .local_group_size(64, 4) - .push_constant(Type::VEC2, "first_feedback_coefficients") - .push_constant(Type::VEC2, "first_causal_feedforward_coefficients") - .push_constant(Type::VEC2, "first_non_causal_feedforward_coefficients") - .push_constant(Type::VEC2, "second_feedback_coefficients") - .push_constant(Type::VEC2, "second_causal_feedforward_coefficients") - .push_constant(Type::VEC2, "second_non_causal_feedforward_coefficients") - .push_constant(Type::FLOAT, "first_causal_boundary_coefficient") - .push_constant(Type::FLOAT, "first_non_causal_boundary_coefficient") - .push_constant(Type::FLOAT, "second_causal_boundary_coefficient") - .push_constant(Type::FLOAT, "second_non_causal_boundary_coefficient") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "first_causal_output_img") - .image(1, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "first_non_causal_output_img") - .image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "second_causal_output_img") - .image(3, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "second_non_causal_output_img") - .compute_source("compositor_van_vliet_gaussian_blur.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(64, 4) +PUSH_CONSTANT(VEC2, first_feedback_coefficients) +PUSH_CONSTANT(VEC2, first_causal_feedforward_coefficients) +PUSH_CONSTANT(VEC2, first_non_causal_feedforward_coefficients) +PUSH_CONSTANT(VEC2, second_feedback_coefficients) +PUSH_CONSTANT(VEC2, second_causal_feedforward_coefficients) +PUSH_CONSTANT(VEC2, second_non_causal_feedforward_coefficients) +PUSH_CONSTANT(FLOAT, first_causal_boundary_coefficient) +PUSH_CONSTANT(FLOAT, first_non_causal_boundary_coefficient) +PUSH_CONSTANT(FLOAT, second_causal_boundary_coefficient) +PUSH_CONSTANT(FLOAT, second_non_causal_boundary_coefficient) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, first_causal_output_img) +IMAGE(1, GPU_RGBA16F, WRITE, FLOAT_2D, first_non_causal_output_img) +IMAGE(2, GPU_RGBA16F, WRITE, FLOAT_2D, second_causal_output_img) +IMAGE(3, GPU_RGBA16F, WRITE, FLOAT_2D, second_non_causal_output_img) +COMPUTE_SOURCE("compositor_van_vliet_gaussian_blur.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_van_vliet_gaussian_blur_sum) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "first_causal_input_tx") - .sampler(1, ImageType::FLOAT_2D, "first_non_causal_input_tx") - .sampler(2, ImageType::FLOAT_2D, "second_causal_input_tx") - .sampler(3, ImageType::FLOAT_2D, "second_non_causal_input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_van_vliet_gaussian_blur_sum.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, first_causal_input_tx) +SAMPLER(1, FLOAT_2D, first_non_causal_input_tx) +SAMPLER(2, FLOAT_2D, second_causal_input_tx) +SAMPLER(3, FLOAT_2D, second_non_causal_input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_van_vliet_gaussian_blur_sum.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_write_output_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_write_output_info.hh index cf4b32d5a8e..ae9064cf0bf 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_write_output_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_write_output_info.hh @@ -5,25 +5,29 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_write_output_shared) - .local_group_size(16, 16) - .push_constant(Type::IVEC2, "lower_bound") - .push_constant(Type::IVEC2, "upper_bound") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_write_output.glsl"); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(IVEC2, lower_bound) +PUSH_CONSTANT(IVEC2, upper_bound) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_write_output.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_write_output) - .additional_info("compositor_write_output_shared") - .define("DIRECT_OUTPUT") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_write_output_shared) +DEFINE("DIRECT_OUTPUT") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_write_output_opaque) - .additional_info("compositor_write_output_shared") - .define("OPAQUE_OUTPUT") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_write_output_shared) +DEFINE("OPAQUE_OUTPUT") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_write_output_alpha) - .additional_info("compositor_write_output_shared") - .sampler(1, ImageType::FLOAT_2D, "alpha_tx") - .define("ALPHA_OUTPUT") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_write_output_shared) +SAMPLER(1, FLOAT_2D, alpha_tx) +DEFINE("ALPHA_OUTPUT") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_z_combine_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_z_combine_info.hh index 31043c7d354..925f01b945a 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_z_combine_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_z_combine_info.hh @@ -5,34 +5,37 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_z_combine_simple) - .local_group_size(16, 16) - .push_constant(Type::BOOL, "use_alpha") - .sampler(0, ImageType::FLOAT_2D, "first_tx") - .sampler(1, ImageType::FLOAT_2D, "first_z_tx") - .sampler(2, ImageType::FLOAT_2D, "second_tx") - .sampler(3, ImageType::FLOAT_2D, "second_z_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "combined_img") - .image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "combined_z_img") - .compute_source("compositor_z_combine_simple.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(BOOL, use_alpha) +SAMPLER(0, FLOAT_2D, first_tx) +SAMPLER(1, FLOAT_2D, first_z_tx) +SAMPLER(2, FLOAT_2D, second_tx) +SAMPLER(3, FLOAT_2D, second_z_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, combined_img) +IMAGE(1, GPU_R16F, WRITE, FLOAT_2D, combined_z_img) +COMPUTE_SOURCE("compositor_z_combine_simple.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_z_combine_compute_mask) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "first_z_tx") - .sampler(1, ImageType::FLOAT_2D, "second_z_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "mask_img") - .compute_source("compositor_z_combine_compute_mask.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, first_z_tx) +SAMPLER(1, FLOAT_2D, second_z_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, mask_img) +COMPUTE_SOURCE("compositor_z_combine_compute_mask.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_z_combine_from_mask) - .local_group_size(16, 16) - .push_constant(Type::BOOL, "use_alpha") - .sampler(0, ImageType::FLOAT_2D, "first_tx") - .sampler(1, ImageType::FLOAT_2D, "first_z_tx") - .sampler(2, ImageType::FLOAT_2D, "second_tx") - .sampler(3, ImageType::FLOAT_2D, "second_z_tx") - .sampler(4, ImageType::FLOAT_2D, "mask_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "combined_img") - .image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "combined_z_img") - .compute_source("compositor_z_combine_from_mask.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(BOOL, use_alpha) +SAMPLER(0, FLOAT_2D, first_tx) +SAMPLER(1, FLOAT_2D, first_z_tx) +SAMPLER(2, FLOAT_2D, second_tx) +SAMPLER(3, FLOAT_2D, second_z_tx) +SAMPLER(4, FLOAT_2D, mask_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, combined_img) +IMAGE(1, GPU_R16F, WRITE, FLOAT_2D, combined_z_img) +COMPUTE_SOURCE("compositor_z_combine_from_mask.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/basic/shaders/infos/basic_depth_info.hh b/source/blender/draw/engines/basic/shaders/infos/basic_depth_info.hh index a9f3f6b90c3..30c848f2f5f 100644 --- a/source/blender/draw/engines/basic/shaders/infos/basic_depth_info.hh +++ b/source/blender/draw/engines/basic/shaders/infos/basic_depth_info.hh @@ -11,8 +11,9 @@ * \{ */ GPU_SHADER_CREATE_INFO(basic_conservative) - .geometry_layout(PrimitiveIn::TRIANGLES, PrimitiveOut::TRIANGLE_STRIP, 3) - .geometry_source("basic_conservative_depth_geom.glsl"); +GEOMETRY_LAYOUT(PrimitiveIn::TRIANGLES, PrimitiveOut::TRIANGLE_STRIP, 3) +GEOMETRY_SOURCE("basic_conservative_depth_geom.glsl") +GPU_SHADER_CREATE_END() /** \} */ @@ -21,28 +22,33 @@ GPU_SHADER_CREATE_INFO(basic_conservative) * \{ */ GPU_SHADER_CREATE_INFO(basic_mesh) - .vertex_in(0, Type::VEC3, "pos") - .vertex_source("basic_depth_vert.glsl") - .additional_info("draw_mesh"); +VERTEX_IN(0, VEC3, pos) +VERTEX_SOURCE("basic_depth_vert.glsl") +ADDITIONAL_INFO(draw_mesh) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(basic_pointcloud) - .vertex_source("basic_depth_pointcloud_vert.glsl") - .additional_info("draw_pointcloud"); +VERTEX_SOURCE("basic_depth_pointcloud_vert.glsl") +ADDITIONAL_INFO(draw_pointcloud) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(basic_curves) - .vertex_source("basic_depth_curves_vert.glsl") - .additional_info("draw_hair"); +VERTEX_SOURCE("basic_depth_curves_vert.glsl") +ADDITIONAL_INFO(draw_hair) +GPU_SHADER_CREATE_END() /* Geometry-shader alternative paths. */ GPU_SHADER_CREATE_INFO(basic_mesh_conservative_no_geom) - .vertex_in(0, Type::VEC3, "pos") - .vertex_source("basic_depth_vert_conservative_no_geom.glsl") - .additional_info("draw_mesh"); +VERTEX_IN(0, VEC3, pos) +VERTEX_SOURCE("basic_depth_vert_conservative_no_geom.glsl") +ADDITIONAL_INFO(draw_mesh) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(basic_pointcloud_conservative_no_geom) - .define("CONSERVATIVE_RASTER") - .vertex_source("basic_depth_pointcloud_vert.glsl") - .additional_info("draw_pointcloud"); +DEFINE("CONSERVATIVE_RASTER") +VERTEX_SOURCE("basic_depth_pointcloud_vert.glsl") +ADDITIONAL_INFO(draw_pointcloud) +GPU_SHADER_CREATE_END() /** \} */ @@ -73,7 +79,9 @@ GPU_SHADER_CREATE_INFO(basic_pointcloud_conservative_no_geom) /** \name Depth shader types. * \{ */ -GPU_SHADER_CREATE_INFO(basic_depth).fragment_source("basic_depth_frag.glsl"); +GPU_SHADER_CREATE_INFO(basic_depth) +FRAGMENT_SOURCE("basic_depth_frag.glsl") +GPU_SHADER_CREATE_END() BASIC_OBTYPE_VARIATIONS(basic_depth, "basic_depth", "draw_globals"); diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_ambient_occlusion_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_ambient_occlusion_info.hh index f64dc5c3bbd..7150b22a7b8 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_ambient_occlusion_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_ambient_occlusion_info.hh @@ -6,19 +6,20 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(eevee_ambient_occlusion_pass) - .define("HORIZON_OCCLUSION") - .compute_source("eevee_ambient_occlusion_pass_comp.glsl") - .local_group_size(AMBIENT_OCCLUSION_PASS_TILE_SIZE, AMBIENT_OCCLUSION_PASS_TILE_SIZE) - .image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D_ARRAY, "in_normal_img") - .push_constant(Type::INT, "in_normal_img_layer_index") - .image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_ao_img") - .push_constant(Type::INT, "out_ao_img_layer_index") - .specialization_constant(Type::INT, "ao_slice_count", 2) - .specialization_constant(Type::INT, "ao_step_count", 8) - .additional_info("draw_view") - .additional_info("eevee_shared") - .additional_info("eevee_hiz_data") - .additional_info("eevee_sampling_data") - .additional_info("eevee_utility_texture") - .additional_info("eevee_global_ubo") - .do_static_compilation(true); +DEFINE("HORIZON_OCCLUSION") +COMPUTE_SOURCE("eevee_ambient_occlusion_pass_comp.glsl") +LOCAL_GROUP_SIZE(AMBIENT_OCCLUSION_PASS_TILE_SIZE, AMBIENT_OCCLUSION_PASS_TILE_SIZE) +IMAGE(0, GPU_RGBA16F, READ, FLOAT_2D_ARRAY, in_normal_img) +PUSH_CONSTANT(INT, in_normal_img_layer_index) +IMAGE(1, GPU_R16F, WRITE, FLOAT_2D_ARRAY, out_ao_img) +PUSH_CONSTANT(INT, out_ao_img_layer_index) +SPECIALIZATION_CONSTANT(INT, ao_slice_count, 2) +SPECIALIZATION_CONSTANT(INT, ao_step_count, 8) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_hiz_data) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_utility_texture) +ADDITIONAL_INFO(eevee_global_ubo) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_deferred_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_deferred_info.hh index b1647c786a0..48a7e3eb4e7 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_deferred_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_deferred_info.hh @@ -19,149 +19,159 @@ * \{ */ GPU_SHADER_CREATE_INFO(eevee_deferred_thickness_amend) - .do_static_compilation(true) - .define("GBUFFER_LOAD") - .sampler(0, ImageType::UINT_2D, "gbuf_header_tx") - .image(0, GPU_RG16, Qualifier::READ_WRITE, ImageType::FLOAT_2D_ARRAY, "gbuf_normal_img") - /* Early fragment test is needed to discard fragment that do not need this processing. */ - .early_fragment_test(true) - .fragment_source("eevee_deferred_thickness_amend_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_fullscreen") - .additional_info("eevee_sampling_data") - .additional_info("eevee_shared") - .additional_info("eevee_light_data") - .additional_info("eevee_shadow_data") - .additional_info("eevee_hiz_data"); +DO_STATIC_COMPILATION() +DEFINE("GBUFFER_LOAD") +SAMPLER(0, UINT_2D, gbuf_header_tx) +IMAGE(0, GPU_RG16, READ_WRITE, FLOAT_2D_ARRAY, gbuf_normal_img) +/* Early fragment test is needed to discard fragment that do not need this processing. */ +EARLY_FRAGMENT_TEST(true) +FRAGMENT_SOURCE("eevee_deferred_thickness_amend_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_fullscreen) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_light_data) +ADDITIONAL_INFO(eevee_shadow_data) +ADDITIONAL_INFO(eevee_hiz_data) +GPU_SHADER_CREATE_END() /** \} */ GPU_SHADER_CREATE_INFO(eevee_gbuffer_data) - .define("GBUFFER_LOAD") - .sampler(12, ImageType::UINT_2D, "gbuf_header_tx") - .sampler(13, ImageType::FLOAT_2D_ARRAY, "gbuf_closure_tx") - .sampler(14, ImageType::FLOAT_2D_ARRAY, "gbuf_normal_tx"); +DEFINE("GBUFFER_LOAD") +SAMPLER(12, UINT_2D, gbuf_header_tx) +SAMPLER(13, FLOAT_2D_ARRAY, gbuf_closure_tx) +SAMPLER(14, FLOAT_2D_ARRAY, gbuf_normal_tx) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_deferred_tile_classify) - .fragment_source("eevee_deferred_tile_classify_frag.glsl") - .additional_info("eevee_shared") - .additional_info("draw_fullscreen") - .subpass_in(1, Type::UINT, "in_gbuffer_header", DEFERRED_GBUFFER_ROG_ID) - .typedef_source("draw_shader_shared.hh") - .push_constant(Type::INT, "current_bit") - .do_static_compilation(true); +FRAGMENT_SOURCE("eevee_deferred_tile_classify_frag.glsl") +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_fullscreen) +SUBPASS_IN(1, UINT, in_gbuffer_header, DEFERRED_GBUFFER_ROG_ID) +TYPEDEF_SOURCE("draw_shader_shared.hh") +PUSH_CONSTANT(INT, current_bit) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_deferred_light) - .fragment_source("eevee_deferred_light_frag.glsl") - /* Early fragment test is needed to avoid processing background fragments. */ - .early_fragment_test(true) - .fragment_out(0, Type::VEC4, "out_combined") - /* Chaining to next pass. */ - .uimage_out(2, DEFERRED_RADIANCE_FORMAT, "direct_radiance_1_img") - .uimage_out(3, DEFERRED_RADIANCE_FORMAT, "direct_radiance_2_img") - .uimage_out(4, DEFERRED_RADIANCE_FORMAT, "direct_radiance_3_img") - /* Optimized out if use_split_indirect is false. */ - .image_out(5, RAYTRACE_RADIANCE_FORMAT, "indirect_radiance_1_img") - .image_out(6, RAYTRACE_RADIANCE_FORMAT, "indirect_radiance_2_img") - .image_out(7, RAYTRACE_RADIANCE_FORMAT, "indirect_radiance_3_img") - .specialization_constant(Type::BOOL, "use_split_indirect", false) - .specialization_constant(Type::BOOL, "use_lightprobe_eval", false) - .specialization_constant(Type::BOOL, "use_transmission", false) - .specialization_constant(Type::INT, "render_pass_shadow_id", -1) - .define("SPECIALIZED_SHADOW_PARAMS") - .specialization_constant(Type::INT, "shadow_ray_count", 1) - .specialization_constant(Type::INT, "shadow_ray_step_count", 6) - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data") - .additional_info("eevee_utility_texture") - .additional_info("eevee_sampling_data") - .additional_info("eevee_light_data") - .additional_info("eevee_shadow_data") - .additional_info("eevee_hiz_data") - .additional_info("eevee_lightprobe_data") - .additional_info("eevee_render_pass_out") - .additional_info("draw_fullscreen") - .additional_info("draw_view"); +FRAGMENT_SOURCE("eevee_deferred_light_frag.glsl") +/* Early fragment test is needed to avoid processing background fragments. */ +EARLY_FRAGMENT_TEST(true) +FRAGMENT_OUT(0, VEC4, out_combined) +/* Chaining to next pass. */ +IMAGE_FREQ(2, DEFERRED_RADIANCE_FORMAT, WRITE, UINT_2D, direct_radiance_1_img, PASS) +IMAGE_FREQ(3, DEFERRED_RADIANCE_FORMAT, WRITE, UINT_2D, direct_radiance_2_img, PASS) +IMAGE_FREQ(4, DEFERRED_RADIANCE_FORMAT, WRITE, UINT_2D, direct_radiance_3_img, PASS) +/* Optimized out if use_split_indirect is false. */ +IMAGE_FREQ(5, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, indirect_radiance_1_img, PASS) +IMAGE_FREQ(6, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, indirect_radiance_2_img, PASS) +IMAGE_FREQ(7, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, indirect_radiance_3_img, PASS) +SPECIALIZATION_CONSTANT(BOOL, use_split_indirect, false) +SPECIALIZATION_CONSTANT(BOOL, use_lightprobe_eval, false) +SPECIALIZATION_CONSTANT(BOOL, use_transmission, false) +SPECIALIZATION_CONSTANT(INT, render_pass_shadow_id, -1) +DEFINE("SPECIALIZED_SHADOW_PARAMS") +SPECIALIZATION_CONSTANT(INT, shadow_ray_count, 1) +SPECIALIZATION_CONSTANT(INT, shadow_ray_step_count, 6) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(eevee_utility_texture) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_light_data) +ADDITIONAL_INFO(eevee_shadow_data) +ADDITIONAL_INFO(eevee_hiz_data) +ADDITIONAL_INFO(eevee_lightprobe_data) +ADDITIONAL_INFO(eevee_render_pass_out) +ADDITIONAL_INFO(draw_fullscreen) +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_deferred_light_single) - .additional_info("eevee_deferred_light") - .define("LIGHT_CLOSURE_EVAL_COUNT", "1") - .do_static_compilation(true); +ADDITIONAL_INFO(eevee_deferred_light) +DEFINE_VALUE("LIGHT_CLOSURE_EVAL_COUNT", "1") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_deferred_light_double) - .additional_info("eevee_deferred_light") - .define("LIGHT_CLOSURE_EVAL_COUNT", "2") - .do_static_compilation(true); +ADDITIONAL_INFO(eevee_deferred_light) +DEFINE_VALUE("LIGHT_CLOSURE_EVAL_COUNT", "2") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_deferred_light_triple) - .additional_info("eevee_deferred_light") - .define("LIGHT_CLOSURE_EVAL_COUNT", "3") - .do_static_compilation(true); +ADDITIONAL_INFO(eevee_deferred_light) +DEFINE_VALUE("LIGHT_CLOSURE_EVAL_COUNT", "3") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_deferred_combine) - /* Early fragment test is needed to avoid processing fragments background fragments. */ - .early_fragment_test(true) - /* Inputs. */ - .sampler(2, ImageType::UINT_2D, "direct_radiance_1_tx") - .sampler(3, ImageType::UINT_2D, "direct_radiance_2_tx") - .sampler(4, ImageType::UINT_2D, "direct_radiance_3_tx") - .sampler(5, ImageType::FLOAT_2D, "indirect_radiance_1_tx") - .sampler(6, ImageType::FLOAT_2D, "indirect_radiance_2_tx") - .sampler(7, ImageType::FLOAT_2D, "indirect_radiance_3_tx") - .image(5, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "radiance_feedback_img") - .fragment_out(0, Type::VEC4, "out_combined") - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data") - .additional_info("eevee_render_pass_out") - .additional_info("draw_fullscreen") - .fragment_source("eevee_deferred_combine_frag.glsl") - /* NOTE: Both light IDs have a valid specialized assignment of '-1' so only when default is - * present will we instead dynamically look-up ID from the uniform buffer. */ - .specialization_constant(Type::BOOL, "render_pass_diffuse_light_enabled", true) - .specialization_constant(Type::BOOL, "render_pass_specular_light_enabled", true) - .specialization_constant(Type::BOOL, "render_pass_normal_enabled", true) - .specialization_constant(Type::BOOL, "use_radiance_feedback", false) - .specialization_constant(Type::BOOL, "use_split_radiance", false) - .do_static_compilation(true); +/* Early fragment test is needed to avoid processing fragments background fragments. */ +EARLY_FRAGMENT_TEST(true) +/* Inputs. */ +SAMPLER(2, UINT_2D, direct_radiance_1_tx) +SAMPLER(3, UINT_2D, direct_radiance_2_tx) +SAMPLER(4, UINT_2D, direct_radiance_3_tx) +SAMPLER(5, FLOAT_2D, indirect_radiance_1_tx) +SAMPLER(6, FLOAT_2D, indirect_radiance_2_tx) +SAMPLER(7, FLOAT_2D, indirect_radiance_3_tx) +IMAGE(5, GPU_RGBA16F, READ_WRITE, FLOAT_2D, radiance_feedback_img) +FRAGMENT_OUT(0, VEC4, out_combined) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(eevee_render_pass_out) +ADDITIONAL_INFO(draw_fullscreen) +FRAGMENT_SOURCE("eevee_deferred_combine_frag.glsl") +/* NOTE: Both light IDs have a valid specialized assignment of '-1' so only when default is + * present will we instead dynamically look-up ID from the uniform buffer. */ +SPECIALIZATION_CONSTANT(BOOL, render_pass_diffuse_light_enabled, true) +SPECIALIZATION_CONSTANT(BOOL, render_pass_specular_light_enabled, true) +SPECIALIZATION_CONSTANT(BOOL, render_pass_normal_enabled, true) +SPECIALIZATION_CONSTANT(BOOL, use_radiance_feedback, false) +SPECIALIZATION_CONSTANT(BOOL, use_split_radiance, false) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_deferred_capture_eval) - /* Early fragment test is needed to avoid processing fragments without correct GBuffer data. */ - .early_fragment_test(true) - /* Inputs. */ - .fragment_out(0, Type::VEC4, "out_radiance") - .define("LIGHT_CLOSURE_EVAL_COUNT", "1") - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data") - .additional_info("eevee_utility_texture") - .additional_info("eevee_sampling_data") - .additional_info("eevee_light_data") - .additional_info("eevee_shadow_data") - .additional_info("eevee_hiz_data") - .additional_info("eevee_volume_probe_data") - .additional_info("draw_view") - .additional_info("draw_fullscreen") - .fragment_source("eevee_deferred_capture_frag.glsl") - .do_static_compilation(true); +/* Early fragment test is needed to avoid processing fragments without correct GBuffer data. */ +EARLY_FRAGMENT_TEST(true) +/* Inputs. */ +FRAGMENT_OUT(0, VEC4, out_radiance) +DEFINE_VALUE("LIGHT_CLOSURE_EVAL_COUNT", "1") +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(eevee_utility_texture) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_light_data) +ADDITIONAL_INFO(eevee_shadow_data) +ADDITIONAL_INFO(eevee_hiz_data) +ADDITIONAL_INFO(eevee_volume_probe_data) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_fullscreen) +FRAGMENT_SOURCE("eevee_deferred_capture_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_deferred_planar_eval) - /* Early fragment test is needed to avoid processing fragments without correct GBuffer data. */ - .early_fragment_test(true) - /* Inputs. */ - .fragment_out(0, Type::VEC4, "out_radiance") - .define("SPHERE_PROBE") - .define("LIGHT_CLOSURE_EVAL_COUNT", "1") - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data") - .additional_info("eevee_utility_texture") - .additional_info("eevee_sampling_data") - .additional_info("eevee_light_data") - .additional_info("eevee_lightprobe_data") - .additional_info("eevee_shadow_data") - .additional_info("eevee_hiz_data") - .additional_info("draw_view") - .additional_info("draw_fullscreen") - .fragment_source("eevee_deferred_planar_frag.glsl") - .do_static_compilation(true); +/* Early fragment test is needed to avoid processing fragments without correct GBuffer data. */ +EARLY_FRAGMENT_TEST(true) +/* Inputs. */ +FRAGMENT_OUT(0, VEC4, out_radiance) +DEFINE("SPHERE_PROBE") +DEFINE_VALUE("LIGHT_CLOSURE_EVAL_COUNT", "1") +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(eevee_utility_texture) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_light_data) +ADDITIONAL_INFO(eevee_lightprobe_data) +ADDITIONAL_INFO(eevee_shadow_data) +ADDITIONAL_INFO(eevee_hiz_data) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_fullscreen) +FRAGMENT_SOURCE("eevee_deferred_planar_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() #undef image_array_out #undef image_out @@ -172,14 +182,15 @@ GPU_SHADER_CREATE_INFO(eevee_deferred_planar_eval) * \{ */ GPU_SHADER_CREATE_INFO(eevee_debug_gbuffer) - .do_static_compilation(true) - .fragment_out(0, Type::VEC4, "out_color_add", DualBlend::SRC_0) - .fragment_out(0, Type::VEC4, "out_color_mul", DualBlend::SRC_1) - .push_constant(Type::INT, "debug_mode") - .fragment_source("eevee_debug_gbuffer_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_fullscreen") - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data"); +DO_STATIC_COMPILATION() +FRAGMENT_OUT_DUAL(0, VEC4, out_color_add, SRC_0) +FRAGMENT_OUT_DUAL(0, VEC4, out_color_mul, SRC_1) +PUSH_CONSTANT(INT, debug_mode) +FRAGMENT_SOURCE("eevee_debug_gbuffer_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_fullscreen) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_depth_of_field_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_depth_of_field_info.hh index 3d1644bfe12..858b8ff75f2 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_depth_of_field_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_depth_of_field_info.hh @@ -10,76 +10,81 @@ * \{ */ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_bokeh_lut) - .do_static_compilation(true) - .local_group_size(DOF_BOKEH_LUT_SIZE, DOF_BOKEH_LUT_SIZE) - .additional_info("eevee_shared") - .additional_info("draw_view") - .uniform_buf(6, "DepthOfFieldData", "dof_buf") - .image(0, GPU_RG16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_gather_lut_img") - .image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_scatter_lut_img") - .image(2, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_resolve_lut_img") - .compute_source("eevee_depth_of_field_bokeh_lut_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(DOF_BOKEH_LUT_SIZE, DOF_BOKEH_LUT_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +UNIFORM_BUF(6, DepthOfFieldData, dof_buf) +IMAGE(0, GPU_RG16F, WRITE, FLOAT_2D, out_gather_lut_img) +IMAGE(1, GPU_R16F, WRITE, FLOAT_2D, out_scatter_lut_img) +IMAGE(2, GPU_R16F, WRITE, FLOAT_2D, out_resolve_lut_img) +COMPUTE_SOURCE("eevee_depth_of_field_bokeh_lut_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_depth_of_field_setup) - .do_static_compilation(true) - .local_group_size(DOF_DEFAULT_GROUP_SIZE, DOF_DEFAULT_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("draw_view") - .uniform_buf(6, "DepthOfFieldData", "dof_buf") - .sampler(0, ImageType::FLOAT_2D, "color_tx") - .sampler(1, ImageType::DEPTH_2D, "depth_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img") - .image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_coc_img") - .compute_source("eevee_depth_of_field_setup_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(DOF_DEFAULT_GROUP_SIZE, DOF_DEFAULT_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +UNIFORM_BUF(6, DepthOfFieldData, dof_buf) +SAMPLER(0, FLOAT_2D, color_tx) +SAMPLER(1, DEPTH_2D, depth_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_img) +IMAGE(1, GPU_R16F, WRITE, FLOAT_2D, out_coc_img) +COMPUTE_SOURCE("eevee_depth_of_field_setup_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_depth_of_field_stabilize) - .do_static_compilation(true) - .local_group_size(DOF_STABILIZE_GROUP_SIZE, DOF_STABILIZE_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("draw_view") - .additional_info("eevee_velocity_camera") - .uniform_buf(6, "DepthOfFieldData", "dof_buf") - .sampler(0, ImageType::FLOAT_2D, "coc_tx") - .sampler(1, ImageType::FLOAT_2D, "color_tx") - .sampler(2, ImageType::FLOAT_2D, "velocity_tx") - .sampler(3, ImageType::FLOAT_2D, "in_history_tx") - .sampler(4, ImageType::DEPTH_2D, "depth_tx") - .push_constant(Type::BOOL, "u_use_history") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img") - .image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_coc_img") - .image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_history_img") - .compute_source("eevee_depth_of_field_stabilize_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(DOF_STABILIZE_GROUP_SIZE, DOF_STABILIZE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_velocity_camera) +UNIFORM_BUF(6, DepthOfFieldData, dof_buf) +SAMPLER(0, FLOAT_2D, coc_tx) +SAMPLER(1, FLOAT_2D, color_tx) +SAMPLER(2, FLOAT_2D, velocity_tx) +SAMPLER(3, FLOAT_2D, in_history_tx) +SAMPLER(4, DEPTH_2D, depth_tx) +PUSH_CONSTANT(BOOL, u_use_history) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_img) +IMAGE(1, GPU_R16F, WRITE, FLOAT_2D, out_coc_img) +IMAGE(2, GPU_RGBA16F, WRITE, FLOAT_2D, out_history_img) +COMPUTE_SOURCE("eevee_depth_of_field_stabilize_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_depth_of_field_downsample) - .do_static_compilation(true) - .local_group_size(DOF_DEFAULT_GROUP_SIZE, DOF_DEFAULT_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("draw_view") - .sampler(0, ImageType::FLOAT_2D, "color_tx") - .sampler(1, ImageType::FLOAT_2D, "coc_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img") - .compute_source("eevee_depth_of_field_downsample_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(DOF_DEFAULT_GROUP_SIZE, DOF_DEFAULT_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +SAMPLER(0, FLOAT_2D, color_tx) +SAMPLER(1, FLOAT_2D, coc_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_img) +COMPUTE_SOURCE("eevee_depth_of_field_downsample_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_depth_of_field_reduce) - .do_static_compilation(true) - .local_group_size(DOF_REDUCE_GROUP_SIZE, DOF_REDUCE_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("draw_view") - .uniform_buf(6, "DepthOfFieldData", "dof_buf") - .sampler(0, ImageType::FLOAT_2D, "downsample_tx") - .storage_buf(0, Qualifier::WRITE, "ScatterRect", "scatter_fg_list_buf[]") - .storage_buf(1, Qualifier::WRITE, "ScatterRect", "scatter_bg_list_buf[]") - .storage_buf(2, Qualifier::READ_WRITE, "DrawCommand", "scatter_fg_indirect_buf") - .storage_buf(3, Qualifier::READ_WRITE, "DrawCommand", "scatter_bg_indirect_buf") - .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "inout_color_lod0_img") - .image(1, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_lod1_img") - .image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_lod2_img") - .image(3, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_lod3_img") - .image(4, GPU_R16F, Qualifier::READ, ImageType::FLOAT_2D, "in_coc_lod0_img") - .image(5, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_coc_lod1_img") - .image(6, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_coc_lod2_img") - .image(7, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_coc_lod3_img") - .compute_source("eevee_depth_of_field_reduce_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(DOF_REDUCE_GROUP_SIZE, DOF_REDUCE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +UNIFORM_BUF(6, DepthOfFieldData, dof_buf) +SAMPLER(0, FLOAT_2D, downsample_tx) +STORAGE_BUF(0, WRITE, ScatterRect, scatter_fg_list_buf[]) +STORAGE_BUF(1, WRITE, ScatterRect, scatter_bg_list_buf[]) +STORAGE_BUF(2, READ_WRITE, DrawCommand, scatter_fg_indirect_buf) +STORAGE_BUF(3, READ_WRITE, DrawCommand, scatter_bg_indirect_buf) +IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, inout_color_lod0_img) +IMAGE(1, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_lod1_img) +IMAGE(2, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_lod2_img) +IMAGE(3, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_lod3_img) +IMAGE(4, GPU_R16F, READ, FLOAT_2D, in_coc_lod0_img) +IMAGE(5, GPU_R16F, WRITE, FLOAT_2D, out_coc_lod1_img) +IMAGE(6, GPU_R16F, WRITE, FLOAT_2D, out_coc_lod2_img) +IMAGE(7, GPU_R16F, WRITE, FLOAT_2D, out_coc_lod3_img) +COMPUTE_SOURCE("eevee_depth_of_field_reduce_comp.glsl") +GPU_SHADER_CREATE_END() /** \} */ @@ -88,39 +93,44 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_reduce) * \{ */ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_tiles_flatten) - .do_static_compilation(true) - .local_group_size(DOF_TILES_FLATTEN_GROUP_SIZE, DOF_TILES_FLATTEN_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("draw_view") - .sampler(0, ImageType::FLOAT_2D, "coc_tx") - .image(2, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_tiles_fg_img") - .image(3, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_tiles_bg_img") - .compute_source("eevee_depth_of_field_tiles_flatten_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(DOF_TILES_FLATTEN_GROUP_SIZE, DOF_TILES_FLATTEN_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +SAMPLER(0, FLOAT_2D, coc_tx) +IMAGE(2, GPU_R11F_G11F_B10F, WRITE, FLOAT_2D, out_tiles_fg_img) +IMAGE(3, GPU_R11F_G11F_B10F, WRITE, FLOAT_2D, out_tiles_bg_img) +COMPUTE_SOURCE("eevee_depth_of_field_tiles_flatten_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_depth_of_field_tiles_dilate) - .additional_info("eevee_shared") - .additional_info("draw_view") - .additional_info("eevee_depth_of_field_tiles_common") - .local_group_size(DOF_TILES_DILATE_GROUP_SIZE, DOF_TILES_DILATE_GROUP_SIZE) - .image(2, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_tiles_fg_img") - .image(3, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_tiles_bg_img") - .push_constant(Type::INT, "ring_count") - .push_constant(Type::INT, "ring_width_multiplier") - .compute_source("eevee_depth_of_field_tiles_dilate_comp.glsl"); +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_depth_of_field_tiles_common) +LOCAL_GROUP_SIZE(DOF_TILES_DILATE_GROUP_SIZE, DOF_TILES_DILATE_GROUP_SIZE) +IMAGE(2, GPU_R11F_G11F_B10F, WRITE, FLOAT_2D, out_tiles_fg_img) +IMAGE(3, GPU_R11F_G11F_B10F, WRITE, FLOAT_2D, out_tiles_bg_img) +PUSH_CONSTANT(INT, ring_count) +PUSH_CONSTANT(INT, ring_width_multiplier) +COMPUTE_SOURCE("eevee_depth_of_field_tiles_dilate_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_depth_of_field_tiles_dilate_minabs) - .do_static_compilation(true) - .define("DILATE_MODE_MIN_MAX", "false") - .additional_info("eevee_depth_of_field_tiles_dilate"); +DO_STATIC_COMPILATION() +DEFINE_VALUE("DILATE_MODE_MIN_MAX", "false") +ADDITIONAL_INFO(eevee_depth_of_field_tiles_dilate) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_depth_of_field_tiles_dilate_minmax) - .do_static_compilation(true) - .define("DILATE_MODE_MIN_MAX", "true") - .additional_info("eevee_depth_of_field_tiles_dilate"); +DO_STATIC_COMPILATION() +DEFINE_VALUE("DILATE_MODE_MIN_MAX", "true") +ADDITIONAL_INFO(eevee_depth_of_field_tiles_dilate) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_depth_of_field_tiles_common) - .image(0, GPU_R11F_G11F_B10F, Qualifier::READ, ImageType::FLOAT_2D, "in_tiles_fg_img") - .image(1, GPU_R11F_G11F_B10F, Qualifier::READ, ImageType::FLOAT_2D, "in_tiles_bg_img"); +IMAGE(0, GPU_R11F_G11F_B10F, READ, FLOAT_2D, in_tiles_fg_img) +IMAGE(1, GPU_R11F_G11F_B10F, READ, FLOAT_2D, in_tiles_bg_img) +GPU_SHADER_CREATE_END() /** \} */ @@ -129,19 +139,25 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_tiles_common) * \{ */ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_no_lut) - .define("DOF_BOKEH_TEXTURE", "false") - /** - * WORKAROUND(@fclem): This is to keep the code as is for now. The bokeh_lut_tx is referenced - * even if not used after optimization. But we don't want to include it in the create infos. - */ - .define("bokeh_lut_tx", "color_tx"); +DEFINE_VALUE("DOF_BOKEH_TEXTURE", "false") +/** + * WORKAROUND(@fclem): This is to keep the code as is for now. The bokeh_lut_tx is referenced + * even if not used after optimization. But we don't want to include it in the create infos. + */ +DEFINE_VALUE("bokeh_lut_tx", "color_tx") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_depth_of_field_lut) - .define("DOF_BOKEH_TEXTURE", "true") - .sampler(5, ImageType::FLOAT_2D, "bokeh_lut_tx"); +DEFINE_VALUE("DOF_BOKEH_TEXTURE", "true") +SAMPLER(5, FLOAT_2D, bokeh_lut_tx) +GPU_SHADER_CREATE_END() -GPU_SHADER_CREATE_INFO(eevee_depth_of_field_background).define("DOF_FOREGROUND_PASS", "false"); -GPU_SHADER_CREATE_INFO(eevee_depth_of_field_foreground).define("DOF_FOREGROUND_PASS", "true"); +GPU_SHADER_CREATE_INFO(eevee_depth_of_field_background) +DEFINE_VALUE("DOF_FOREGROUND_PASS", "false") +GPU_SHADER_CREATE_END() +GPU_SHADER_CREATE_INFO(eevee_depth_of_field_foreground) +DEFINE_VALUE("DOF_FOREGROUND_PASS", "true") +GPU_SHADER_CREATE_END() #define EEVEE_DOF_FINAL_VARIATION(name, ...) \ GPU_SHADER_CREATE_INFO(name).additional_info(__VA_ARGS__).do_static_compilation(true); @@ -161,40 +177,46 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_foreground).define("DOF_FOREGROUND_P * \{ */ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_gather_common) - .additional_info("eevee_shared") - .additional_info("draw_view") - .additional_info("eevee_depth_of_field_tiles_common") - .additional_info("eevee_sampling_data") - .uniform_buf(6, "DepthOfFieldData", "dof_buf") - .local_group_size(DOF_GATHER_GROUP_SIZE, DOF_GATHER_GROUP_SIZE) - .sampler(0, ImageType::FLOAT_2D, "color_tx") - .sampler(1, ImageType::FLOAT_2D, "color_bilinear_tx") - .sampler(2, ImageType::FLOAT_2D, "coc_tx") - .image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img") - .image(3, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_weight_img"); +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_depth_of_field_tiles_common) +ADDITIONAL_INFO(eevee_sampling_data) +UNIFORM_BUF(6, DepthOfFieldData, dof_buf) +LOCAL_GROUP_SIZE(DOF_GATHER_GROUP_SIZE, DOF_GATHER_GROUP_SIZE) +SAMPLER(0, FLOAT_2D, color_tx) +SAMPLER(1, FLOAT_2D, color_bilinear_tx) +SAMPLER(2, FLOAT_2D, coc_tx) +IMAGE(2, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_img) +IMAGE(3, GPU_R16F, WRITE, FLOAT_2D, out_weight_img) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_depth_of_field_gather) - .image(4, GPU_RG16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_occlusion_img") - .compute_source("eevee_depth_of_field_gather_comp.glsl") - .additional_info("eevee_depth_of_field_gather_common"); +IMAGE(4, GPU_RG16F, WRITE, FLOAT_2D, out_occlusion_img) +COMPUTE_SOURCE("eevee_depth_of_field_gather_comp.glsl") +ADDITIONAL_INFO(eevee_depth_of_field_gather_common) +GPU_SHADER_CREATE_END() EEVEE_DOF_GROUND_VARIATIONS(eevee_depth_of_field_gather, "eevee_depth_of_field_gather") GPU_SHADER_CREATE_INFO(eevee_depth_of_field_hole_fill) - .do_static_compilation(true) - .compute_source("eevee_depth_of_field_hole_fill_comp.glsl") - .additional_info("eevee_depth_of_field_gather_common") - .additional_info("eevee_depth_of_field_no_lut"); +DO_STATIC_COMPILATION() +COMPUTE_SOURCE("eevee_depth_of_field_hole_fill_comp.glsl") +ADDITIONAL_INFO(eevee_depth_of_field_gather_common) +ADDITIONAL_INFO(eevee_depth_of_field_no_lut) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_depth_of_field_filter) - .do_static_compilation(true) - .local_group_size(DOF_FILTER_GROUP_SIZE, DOF_FILTER_GROUP_SIZE) - .additional_info("eevee_shared") - .sampler(0, ImageType::FLOAT_2D, "color_tx") - .sampler(1, ImageType::FLOAT_2D, "weight_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img") - .image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_weight_img") - .compute_source("eevee_depth_of_field_filter_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(DOF_FILTER_GROUP_SIZE, DOF_FILTER_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +SAMPLER(0, FLOAT_2D, color_tx) +SAMPLER(1, FLOAT_2D, weight_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_img) +IMAGE(1, GPU_R16F, WRITE, FLOAT_2D, out_weight_img) +COMPUTE_SOURCE( + "eevee_depth_of_field_" + "filter_comp.glsl") +GPU_SHADER_CREATE_END() /** \} */ @@ -203,35 +225,38 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_filter) * \{ */ GPU_SHADER_NAMED_INTERFACE_INFO(eevee_depth_of_field_scatter_flat_iface, interp_flat) - /** Colors, weights, and Circle of confusion radii for the 4 pixels to scatter. */ - .flat(Type::VEC4, "color_and_coc1") - .flat(Type::VEC4, "color_and_coc2") - .flat(Type::VEC4, "color_and_coc3") - .flat(Type::VEC4, "color_and_coc4") - /** Scaling factor for the bokeh distance. */ - .flat(Type::FLOAT, "distance_scale"); +/** Colors, weights, and Circle of confusion radii for the 4 pixels to scatter. */ +FLAT(VEC4, color_and_coc1) +FLAT(VEC4, color_and_coc2) +FLAT(VEC4, color_and_coc3) +FLAT(VEC4, color_and_coc4) +/** Scaling factor for the bokeh distance. */ +FLAT(FLOAT, distance_scale) +GPU_SHADER_INTERFACE_END() GPU_SHADER_NAMED_INTERFACE_INFO(eevee_depth_of_field_scatter_noperspective_iface, interp_noperspective) - /** Sprite pixel position with origin at sprite center. In pixels. */ - .no_perspective(Type::VEC2, "rect_uv1") - .no_perspective(Type::VEC2, "rect_uv2") - .no_perspective(Type::VEC2, "rect_uv3") - .no_perspective(Type::VEC2, "rect_uv4"); +/** Sprite pixel position with origin at sprite center. In pixels. */ +NO_PERSPECTIVE(VEC2, rect_uv1) +NO_PERSPECTIVE(VEC2, rect_uv2) +NO_PERSPECTIVE(VEC2, rect_uv3) +NO_PERSPECTIVE(VEC2, rect_uv4) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(eevee_depth_of_field_scatter) - .do_static_compilation(true) - .additional_info("eevee_shared") - .additional_info("draw_view") - .sampler(0, ImageType::FLOAT_2D, "occlusion_tx") - .sampler(1, ImageType::FLOAT_2D, "bokeh_lut_tx") - .uniform_buf(6, "DepthOfFieldData", "dof_buf") - .storage_buf(0, Qualifier::READ, "ScatterRect", "scatter_list_buf[]") - .fragment_out(0, Type::VEC4, "out_color") - .push_constant(Type::BOOL, "use_bokeh_lut") - .vertex_out(eevee_depth_of_field_scatter_flat_iface) - .vertex_out(eevee_depth_of_field_scatter_noperspective_iface) - .vertex_source("eevee_depth_of_field_scatter_vert.glsl") - .fragment_source("eevee_depth_of_field_scatter_frag.glsl"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +SAMPLER(0, FLOAT_2D, occlusion_tx) +SAMPLER(1, FLOAT_2D, bokeh_lut_tx) +UNIFORM_BUF(6, DepthOfFieldData, dof_buf) +STORAGE_BUF(0, READ, ScatterRect, scatter_list_buf[]) +FRAGMENT_OUT(0, VEC4, out_color) +PUSH_CONSTANT(BOOL, use_bokeh_lut) +VERTEX_OUT(eevee_depth_of_field_scatter_flat_iface) +VERTEX_OUT(eevee_depth_of_field_scatter_noperspective_iface) +VERTEX_SOURCE("eevee_depth_of_field_scatter_vert.glsl") +FRAGMENT_SOURCE("eevee_depth_of_field_scatter_frag.glsl") +GPU_SHADER_CREATE_END() /** \} */ @@ -240,25 +265,26 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_scatter) * \{ */ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_resolve) - .define("DOF_RESOLVE_PASS", "true") - .local_group_size(DOF_RESOLVE_GROUP_SIZE, DOF_RESOLVE_GROUP_SIZE) - .specialization_constant(Type::BOOL, "do_debug_color", false) - .additional_info("eevee_shared") - .additional_info("draw_view") - .additional_info("eevee_depth_of_field_tiles_common") - .additional_info("eevee_sampling_data") - .uniform_buf(6, "DepthOfFieldData", "dof_buf") - .sampler(0, ImageType::DEPTH_2D, "depth_tx") - .sampler(1, ImageType::FLOAT_2D, "color_tx") - .sampler(2, ImageType::FLOAT_2D, "color_bg_tx") - .sampler(3, ImageType::FLOAT_2D, "color_fg_tx") - .sampler(4, ImageType::FLOAT_2D, "color_hole_fill_tx") - .sampler(7, ImageType::FLOAT_2D, "weight_bg_tx") - .sampler(8, ImageType::FLOAT_2D, "weight_fg_tx") - .sampler(9, ImageType::FLOAT_2D, "weight_hole_fill_tx") - .sampler(10, ImageType::FLOAT_2D, "stable_color_tx") - .image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img") - .compute_source("eevee_depth_of_field_resolve_comp.glsl"); +DEFINE_VALUE("DOF_RESOLVE_PASS", "true") +LOCAL_GROUP_SIZE(DOF_RESOLVE_GROUP_SIZE, DOF_RESOLVE_GROUP_SIZE) +SPECIALIZATION_CONSTANT(BOOL, do_debug_color, false) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_depth_of_field_tiles_common) +ADDITIONAL_INFO(eevee_sampling_data) +UNIFORM_BUF(6, DepthOfFieldData, dof_buf) +SAMPLER(0, DEPTH_2D, depth_tx) +SAMPLER(1, FLOAT_2D, color_tx) +SAMPLER(2, FLOAT_2D, color_bg_tx) +SAMPLER(3, FLOAT_2D, color_fg_tx) +SAMPLER(4, FLOAT_2D, color_hole_fill_tx) +SAMPLER(7, FLOAT_2D, weight_bg_tx) +SAMPLER(8, FLOAT_2D, weight_fg_tx) +SAMPLER(9, FLOAT_2D, weight_hole_fill_tx) +SAMPLER(10, FLOAT_2D, stable_color_tx) +IMAGE(2, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_img) +COMPUTE_SOURCE("eevee_depth_of_field_resolve_comp.glsl") +GPU_SHADER_CREATE_END() EEVEE_DOF_LUT_VARIATIONS(eevee_depth_of_field_resolve, "eevee_depth_of_field_resolve") diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_film_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_film_info.hh index fda797d9833..091e80993a0 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_film_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_film_info.hh @@ -6,120 +6,131 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(eevee_film_base) - .sampler(0, ImageType::DEPTH_2D, "depth_tx") - .sampler(1, ImageType::FLOAT_2D, "combined_tx") - .sampler(2, ImageType::FLOAT_2D, "vector_tx") - .sampler(3, ImageType::FLOAT_2D_ARRAY, "rp_color_tx") - .sampler(4, ImageType::FLOAT_2D_ARRAY, "rp_value_tx") - /* Color History for TAA needs to be sampler to leverage bilinear sampling. */ - .sampler(5, ImageType::FLOAT_2D, "in_combined_tx") - .sampler(6, ImageType::FLOAT_2D, "cryptomatte_tx") - .image(0, GPU_R32F, Qualifier::READ, ImageType::FLOAT_2D_ARRAY, "in_weight_img") - .image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_weight_img") - .specialization_constant(Type::UINT, "enabled_categories", 0) - .specialization_constant(Type::INT, "samples_len", 0) - .specialization_constant(Type::BOOL, "use_reprojection", false) - .specialization_constant(Type::INT, "scaling_factor", 1) - .specialization_constant(Type::INT, "combined_id", 0) - .specialization_constant(Type::INT, "display_id", -1) - .specialization_constant(Type::INT, "normal_id", -1) - .additional_info("eevee_shared") - .additional_info("eevee_global_ubo") - .additional_info("eevee_velocity_camera") - .additional_info("draw_view"); +SAMPLER(0, DEPTH_2D, depth_tx) +SAMPLER(1, FLOAT_2D, combined_tx) +SAMPLER(2, FLOAT_2D, vector_tx) +SAMPLER(3, FLOAT_2D_ARRAY, rp_color_tx) +SAMPLER(4, FLOAT_2D_ARRAY, rp_value_tx) +/* Color History for TAA needs to be sampler to leverage bilinear sampling. */ +SAMPLER(5, FLOAT_2D, in_combined_tx) +SAMPLER(6, FLOAT_2D, cryptomatte_tx) +IMAGE(0, GPU_R32F, READ, FLOAT_2D_ARRAY, in_weight_img) +IMAGE(1, GPU_R32F, WRITE, FLOAT_2D_ARRAY, out_weight_img) +SPECIALIZATION_CONSTANT(UINT, enabled_categories, 0) +SPECIALIZATION_CONSTANT(INT, samples_len, 0) +SPECIALIZATION_CONSTANT(BOOL, use_reprojection, false) +SPECIALIZATION_CONSTANT(INT, scaling_factor, 1) +SPECIALIZATION_CONSTANT(INT, combined_id, 0) +SPECIALIZATION_CONSTANT(INT, display_id, -1) +SPECIALIZATION_CONSTANT(INT, normal_id, -1) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_velocity_camera) +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_film) - /* Color History for TAA needs to be sampler to leverage bilinear sampling. */ - //.image(2, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "in_combined_img") - .image(3, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_combined_img") - .image(4, GPU_R32F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "depth_img") - .image(5, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D_ARRAY, "color_accum_img") - .image(6, GPU_R16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D_ARRAY, "value_accum_img") - .image(7, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_2D_ARRAY, "cryptomatte_img") - .additional_info("eevee_film_base"); +/* Color History for TAA needs to be sampler to leverage bilinear sampling. */ +// IMAGE(2, GPU_RGBA16F, READ, FLOAT_2D, in_combined_img) +IMAGE(3, GPU_RGBA16F, WRITE, FLOAT_2D, out_combined_img) +IMAGE(4, GPU_R32F, READ_WRITE, FLOAT_2D, depth_img) +IMAGE(5, GPU_RGBA16F, READ_WRITE, FLOAT_2D_ARRAY, color_accum_img) +IMAGE(6, GPU_R16F, READ_WRITE, FLOAT_2D_ARRAY, value_accum_img) +IMAGE(7, GPU_RGBA32F, READ_WRITE, FLOAT_2D_ARRAY, cryptomatte_img) +ADDITIONAL_INFO(eevee_film_base) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_film_frag) - .do_static_compilation(true) - .fragment_out(0, Type::VEC4, "out_color") - .fragment_source("eevee_film_frag.glsl") - .additional_info("draw_fullscreen") - .additional_info("eevee_film") - .depth_write(DepthWrite::ANY); +DO_STATIC_COMPILATION() +FRAGMENT_OUT(0, VEC4, out_color) +FRAGMENT_SOURCE("eevee_film_frag.glsl") +ADDITIONAL_INFO(draw_fullscreen) +ADDITIONAL_INFO(eevee_film) +DEPTH_WRITE(DepthWrite::ANY) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_film_comp) - .do_static_compilation(true) - .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE) - .compute_source("eevee_film_comp.glsl") - .additional_info("eevee_film"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) +COMPUTE_SOURCE("eevee_film_comp.glsl") +ADDITIONAL_INFO(eevee_film) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_film_cryptomatte_post) - .do_static_compilation(true) - .image(0, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_2D_ARRAY, "cryptomatte_img") - .push_constant(Type::INT, "cryptomatte_layer_len") - .push_constant(Type::INT, "cryptomatte_samples_per_layer") - .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE) - .compute_source("eevee_film_cryptomatte_post_comp.glsl") - .additional_info("eevee_global_ubo") - .additional_info("eevee_shared"); +DO_STATIC_COMPILATION() +IMAGE(0, GPU_RGBA32F, READ_WRITE, FLOAT_2D_ARRAY, cryptomatte_img) +PUSH_CONSTANT(INT, cryptomatte_layer_len) +PUSH_CONSTANT(INT, cryptomatte_samples_per_layer) +LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) +COMPUTE_SOURCE("eevee_film_cryptomatte_post_comp.glsl") +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_shared) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_film_copy_frag) - .do_static_compilation(true) - .image(3, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "out_combined_img") - .image(4, GPU_R32F, Qualifier::READ, ImageType::FLOAT_2D, "depth_img") - .image(5, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D_ARRAY, "color_accum_img") - .image(6, GPU_R16F, Qualifier::READ, ImageType::FLOAT_2D_ARRAY, "value_accum_img") - .image(7, GPU_RGBA32F, Qualifier::READ, ImageType::FLOAT_2D_ARRAY, "cryptomatte_img") - .depth_write(DepthWrite::ANY) - .fragment_out(0, Type::VEC4, "out_color") - .fragment_source("eevee_film_copy_frag.glsl") - .define("FILM_COPY") - .additional_info("draw_fullscreen") - .additional_info("eevee_film_base"); +DO_STATIC_COMPILATION() +IMAGE(3, GPU_RGBA16F, READ, FLOAT_2D, out_combined_img) +IMAGE(4, GPU_R32F, READ, FLOAT_2D, depth_img) +IMAGE(5, GPU_RGBA16F, READ, FLOAT_2D_ARRAY, color_accum_img) +IMAGE(6, GPU_R16F, READ, FLOAT_2D_ARRAY, value_accum_img) +IMAGE(7, GPU_RGBA32F, READ, FLOAT_2D_ARRAY, cryptomatte_img) +DEPTH_WRITE(DepthWrite::ANY) +FRAGMENT_OUT(0, VEC4, out_color) +FRAGMENT_SOURCE("eevee_film_copy_frag.glsl") +DEFINE("FILM_COPY") +ADDITIONAL_INFO(draw_fullscreen) +ADDITIONAL_INFO(eevee_film_base) +GPU_SHADER_CREATE_END() /* The combined pass is stored into its own 2D texture with a format of GPU_RGBA16F. */ GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_combined) - .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE) - .push_constant(Type::IVEC2, "offset") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("eevee_film_pass_convert_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) +PUSH_CONSTANT(IVEC2, offset) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("eevee_film_pass_convert_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* The depth pass is stored into its own 2D texture with a format of GPU_R32F. */ GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_depth) - .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE) - .push_constant(Type::IVEC2, "offset") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("eevee_film_pass_convert_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) +PUSH_CONSTANT(IVEC2, offset) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("eevee_film_pass_convert_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* Value passes are stored in a slice of a 2D texture array with a format of GPU_R16F. */ GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_value) - .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE) - .push_constant(Type::IVEC2, "offset") - .define("IS_ARRAY_INPUT") - .sampler(0, ImageType::FLOAT_2D_ARRAY, "input_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("eevee_film_pass_convert_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) +PUSH_CONSTANT(IVEC2, offset) +DEFINE("IS_ARRAY_INPUT") +SAMPLER(0, FLOAT_2D_ARRAY, input_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("eevee_film_pass_convert_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* Color passes are stored in a slice of a 2D texture array with a format of GPU_RGBA16F. */ GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_color) - .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE) - .push_constant(Type::IVEC2, "offset") - .define("IS_ARRAY_INPUT") - .sampler(0, ImageType::FLOAT_2D_ARRAY, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("eevee_film_pass_convert_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) +PUSH_CONSTANT(IVEC2, offset) +DEFINE("IS_ARRAY_INPUT") +SAMPLER(0, FLOAT_2D_ARRAY, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("eevee_film_pass_convert_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* Cryptomatte passes are stored in a slice of a 2D texture array with a format of GPU_RGBA32F. */ GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_cryptomatte) - .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE) - .push_constant(Type::IVEC2, "offset") - .define("IS_ARRAY_INPUT") - .sampler(0, ImageType::FLOAT_2D_ARRAY, "input_tx") - .image(0, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("eevee_film_pass_convert_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) +PUSH_CONSTANT(IVEC2, offset) +DEFINE("IS_ARRAY_INPUT") +SAMPLER(0, FLOAT_2D_ARRAY, input_tx) +IMAGE(0, GPU_RGBA32F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("eevee_film_pass_convert_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_hiz_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_hiz_info.hh index 8cf9d74d78a..751b2f20631 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_hiz_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_hiz_info.hh @@ -6,39 +6,44 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(eevee_hiz_data) - .sampler(HIZ_TEX_SLOT, ImageType::FLOAT_2D, "hiz_tx") - .additional_info("eevee_global_ubo"); +SAMPLER(HIZ_TEX_SLOT, FLOAT_2D, hiz_tx) +ADDITIONAL_INFO(eevee_global_ubo) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_hiz_update_base) - .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE) - .storage_buf(0, Qualifier::READ_WRITE, "uint", "finished_tile_counter") - .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_mip_0") - .image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_mip_1") - .image(2, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_mip_2") - .image(3, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_mip_3") - .image(4, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_mip_4") - .image(5, GPU_R32F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "out_mip_5") - .image(6, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_mip_6") - .specialization_constant(Type::BOOL, "update_mip_0", true) - .compute_source("eevee_hiz_update_comp.glsl"); +LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) +STORAGE_BUF(0, READ_WRITE, uint, finished_tile_counter) +IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, out_mip_0) +IMAGE(1, GPU_R32F, WRITE, FLOAT_2D, out_mip_1) +IMAGE(2, GPU_R32F, WRITE, FLOAT_2D, out_mip_2) +IMAGE(3, GPU_R32F, WRITE, FLOAT_2D, out_mip_3) +IMAGE(4, GPU_R32F, WRITE, FLOAT_2D, out_mip_4) +IMAGE(5, GPU_R32F, READ_WRITE, FLOAT_2D, out_mip_5) +IMAGE(6, GPU_R32F, WRITE, FLOAT_2D, out_mip_6) +SPECIALIZATION_CONSTANT(BOOL, update_mip_0, true) +COMPUTE_SOURCE("eevee_hiz_update_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_hiz_update) - .do_static_compilation(true) - .sampler(0, ImageType::DEPTH_2D, "depth_tx") - .additional_info("eevee_hiz_update_base"); +DO_STATIC_COMPILATION() +SAMPLER(0, DEPTH_2D, depth_tx) +ADDITIONAL_INFO(eevee_hiz_update_base) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_hiz_update_layer) - .do_static_compilation(true) - .define("HIZ_LAYER") - .sampler(1, ImageType::DEPTH_2D_ARRAY, "depth_layered_tx") - .push_constant(Type::INT, "layer_id") - .additional_info("eevee_hiz_update_base"); +DO_STATIC_COMPILATION() +DEFINE("HIZ_LAYER") +SAMPLER(1, DEPTH_2D_ARRAY, depth_layered_tx) +PUSH_CONSTANT(INT, layer_id) +ADDITIONAL_INFO(eevee_hiz_update_base) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_hiz_debug) - .do_static_compilation(true) - .fragment_out(0, Type::VEC4, "out_debug_color_add", DualBlend::SRC_0) - .fragment_out(0, Type::VEC4, "out_debug_color_mul", DualBlend::SRC_1) - .fragment_source("eevee_hiz_debug_frag.glsl") - .additional_info("eevee_shared") - .additional_info("eevee_hiz_data") - .additional_info("draw_fullscreen"); +DO_STATIC_COMPILATION() +FRAGMENT_OUT_DUAL(0, VEC4, out_debug_color_add, SRC_0) +FRAGMENT_OUT_DUAL(0, VEC4, out_debug_color_mul, SRC_1) +FRAGMENT_SOURCE("eevee_hiz_debug_frag.glsl") +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_hiz_data) +ADDITIONAL_INFO(draw_fullscreen) +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_light_culling_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_light_culling_info.hh index f2170dc6e76..14d884da5f3 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_light_culling_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_light_culling_info.hh @@ -10,10 +10,11 @@ * \{ */ GPU_SHADER_CREATE_INFO(eevee_light_data) - .storage_buf(LIGHT_CULL_BUF_SLOT, Qualifier::READ, "LightCullingData", "light_cull_buf") - .storage_buf(LIGHT_BUF_SLOT, Qualifier::READ, "LightData", "light_buf[]") - .storage_buf(LIGHT_ZBIN_BUF_SLOT, Qualifier::READ, "uint", "light_zbin_buf[]") - .storage_buf(LIGHT_TILE_BUF_SLOT, Qualifier::READ, "uint", "light_tile_buf[]"); +STORAGE_BUF(LIGHT_CULL_BUF_SLOT, READ, LightCullingData, light_cull_buf) +STORAGE_BUF(LIGHT_BUF_SLOT, READ, LightData, light_buf[]) +STORAGE_BUF(LIGHT_ZBIN_BUF_SLOT, READ, uint, light_zbin_buf[]) +STORAGE_BUF(LIGHT_TILE_BUF_SLOT, READ, uint, light_tile_buf[]) +GPU_SHADER_CREATE_END() /** \} */ @@ -22,63 +23,68 @@ GPU_SHADER_CREATE_INFO(eevee_light_data) * \{ */ GPU_SHADER_CREATE_INFO(eevee_light_culling_select) - .do_static_compilation(true) - .additional_info("eevee_shared") - .additional_info("draw_view") - .additional_info("draw_view_culling") - .local_group_size(CULLING_SELECT_GROUP_SIZE) - .storage_buf(0, Qualifier::READ_WRITE, "LightCullingData", "light_cull_buf") - .storage_buf(1, Qualifier::READ, "LightData", "in_light_buf[]") - .storage_buf(2, Qualifier::WRITE, "LightData", "out_light_buf[]") - .storage_buf(3, Qualifier::WRITE, "float", "out_zdist_buf[]") - .storage_buf(4, Qualifier::WRITE, "uint", "out_key_buf[]") - .uniform_buf(0, "LightData", "sunlight_buf") - .compute_source("eevee_light_culling_select_comp.glsl"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_view_culling) +LOCAL_GROUP_SIZE(CULLING_SELECT_GROUP_SIZE) +STORAGE_BUF(0, READ_WRITE, LightCullingData, light_cull_buf) +STORAGE_BUF(1, READ, LightData, in_light_buf[]) +STORAGE_BUF(2, WRITE, LightData, out_light_buf[]) +STORAGE_BUF(3, WRITE, float, out_zdist_buf[]) +STORAGE_BUF(4, WRITE, uint, out_key_buf[]) +UNIFORM_BUF(0, LightData, sunlight_buf) +COMPUTE_SOURCE("eevee_light_culling_select_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_light_culling_sort) - .do_static_compilation(true) - .additional_info("eevee_shared") - .additional_info("draw_view") - .storage_buf(0, Qualifier::READ, "LightCullingData", "light_cull_buf") - .storage_buf(1, Qualifier::READ, "LightData", "in_light_buf[]") - .storage_buf(2, Qualifier::WRITE, "LightData", "out_light_buf[]") - .storage_buf(3, Qualifier::READ, "float", "in_zdist_buf[]") - .storage_buf(4, Qualifier::READ, "uint", "in_key_buf[]") - .local_group_size(CULLING_SORT_GROUP_SIZE) - .compute_source("eevee_light_culling_sort_comp.glsl"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +STORAGE_BUF(0, READ, LightCullingData, light_cull_buf) +STORAGE_BUF(1, READ, LightData, in_light_buf[]) +STORAGE_BUF(2, WRITE, LightData, out_light_buf[]) +STORAGE_BUF(3, READ, float, in_zdist_buf[]) +STORAGE_BUF(4, READ, uint, in_key_buf[]) +LOCAL_GROUP_SIZE(CULLING_SORT_GROUP_SIZE) +COMPUTE_SOURCE("eevee_light_culling_sort_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_light_culling_zbin) - .do_static_compilation(true) - .additional_info("eevee_shared") - .additional_info("draw_view") - .local_group_size(CULLING_ZBIN_GROUP_SIZE) - .storage_buf(0, Qualifier::READ, "LightCullingData", "light_cull_buf") - .storage_buf(1, Qualifier::READ, "LightData", "light_buf[]") - .storage_buf(2, Qualifier::WRITE, "uint", "out_zbin_buf[]") - .compute_source("eevee_light_culling_zbin_comp.glsl"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +LOCAL_GROUP_SIZE(CULLING_ZBIN_GROUP_SIZE) +STORAGE_BUF(0, READ, LightCullingData, light_cull_buf) +STORAGE_BUF(1, READ, LightData, light_buf[]) +STORAGE_BUF(2, WRITE, uint, out_zbin_buf[]) +COMPUTE_SOURCE("eevee_light_culling_zbin_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_light_culling_tile) - .do_static_compilation(true) - .additional_info("eevee_shared") - .additional_info("draw_view") - .additional_info("draw_view_culling") - .local_group_size(CULLING_TILE_GROUP_SIZE) - .storage_buf(0, Qualifier::READ, "LightCullingData", "light_cull_buf") - .storage_buf(1, Qualifier::READ, "LightData", "light_buf[]") - .storage_buf(2, Qualifier::WRITE, "uint", "out_light_tile_buf[]") - .compute_source("eevee_light_culling_tile_comp.glsl"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_view_culling) +LOCAL_GROUP_SIZE(CULLING_TILE_GROUP_SIZE) +STORAGE_BUF(0, READ, LightCullingData, light_cull_buf) +STORAGE_BUF(1, READ, LightData, light_buf[]) +STORAGE_BUF(2, WRITE, uint, out_light_tile_buf[]) +COMPUTE_SOURCE("eevee_light_culling_tile_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_light_shadow_setup) - .do_static_compilation(true) - .additional_info("eevee_shared") - .additional_info("eevee_sampling_data") - .additional_info("eevee_global_ubo") - .local_group_size(CULLING_SELECT_GROUP_SIZE) - .storage_buf(0, Qualifier::READ, "LightCullingData", "light_cull_buf") - .storage_buf(1, Qualifier::READ_WRITE, "LightData", "light_buf[]") - .storage_buf(2, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(3, Qualifier::READ_WRITE, "ShadowTileMapClip", "tilemaps_clip_buf[]") - .compute_source("eevee_light_shadow_setup_comp.glsl"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_global_ubo) +LOCAL_GROUP_SIZE(CULLING_SELECT_GROUP_SIZE) +STORAGE_BUF(0, READ, LightCullingData, light_cull_buf) +STORAGE_BUF(1, READ_WRITE, LightData, light_buf[]) +STORAGE_BUF(2, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) +STORAGE_BUF(3, READ_WRITE, ShadowTileMapClip, tilemaps_clip_buf[]) +COMPUTE_SOURCE("eevee_light_shadow_setup_comp.glsl") +GPU_SHADER_CREATE_END() /** \} */ @@ -87,11 +93,15 @@ GPU_SHADER_CREATE_INFO(eevee_light_shadow_setup) * \{ */ GPU_SHADER_CREATE_INFO(eevee_light_culling_debug) - .do_static_compilation(true) - .fragment_out(0, Type::VEC4, "out_debug_color_add", DualBlend::SRC_0) - .fragment_out(0, Type::VEC4, "out_debug_color_mul", DualBlend::SRC_1) - .fragment_source("eevee_light_culling_debug_frag.glsl") - .additional_info( - "eevee_shared", "draw_view", "draw_fullscreen", "eevee_light_data", "eevee_hiz_data"); +DO_STATIC_COMPILATION() +FRAGMENT_OUT_DUAL(0, VEC4, out_debug_color_add, SRC_0) +FRAGMENT_OUT_DUAL(0, VEC4, out_debug_color_mul, SRC_1) +FRAGMENT_SOURCE("eevee_light_culling_debug_frag.glsl") +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_fullscreen) +ADDITIONAL_INFO(eevee_light_data) +ADDITIONAL_INFO(eevee_hiz_data) +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_sphere_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_sphere_info.hh index cc7db1ccb89..d046954a462 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_sphere_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_sphere_info.hh @@ -10,106 +10,111 @@ * \{ */ GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_data) - .define("SPHERE_PROBE") - .uniform_buf(SPHERE_PROBE_BUF_SLOT, - "SphereProbeData", - "lightprobe_sphere_buf[SPHERE_PROBE_MAX]") - .sampler(SPHERE_PROBE_TEX_SLOT, ImageType::FLOAT_2D_ARRAY, "lightprobe_spheres_tx"); +DEFINE("SPHERE_PROBE") +UNIFORM_BUF(SPHERE_PROBE_BUF_SLOT, SphereProbeData, lightprobe_sphere_buf[SPHERE_PROBE_MAX]) +SAMPLER(SPHERE_PROBE_TEX_SLOT, FLOAT_2D_ARRAY, lightprobe_spheres_tx) +GPU_SHADER_CREATE_END() /* Sample cubemap and remap into an octahedral texture. */ GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_remap) - .local_group_size(SPHERE_PROBE_REMAP_GROUP_SIZE, SPHERE_PROBE_REMAP_GROUP_SIZE) - .specialization_constant(Type::BOOL, "extract_sh", true) - .specialization_constant(Type::BOOL, "extract_sun", true) - .push_constant(Type::IVEC4, "probe_coord_packed") - .push_constant(Type::IVEC4, "write_coord_packed") - .push_constant(Type::IVEC4, "world_coord_packed") - .sampler(0, ImageType::FLOAT_CUBE, "cubemap_tx") - .sampler(1, ImageType::FLOAT_2D_ARRAY, "atlas_tx") - .storage_buf(0, Qualifier::WRITE, "SphereProbeHarmonic", "out_sh[]") - .storage_buf(1, Qualifier::WRITE, "SphereProbeSunLight", "out_sun[]") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "atlas_img") - .compute_source("eevee_lightprobe_sphere_remap_comp.glsl") - .additional_info("eevee_shared") - .additional_info("eevee_global_ubo") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(SPHERE_PROBE_REMAP_GROUP_SIZE, SPHERE_PROBE_REMAP_GROUP_SIZE) +SPECIALIZATION_CONSTANT(BOOL, extract_sh, true) +SPECIALIZATION_CONSTANT(BOOL, extract_sun, true) +PUSH_CONSTANT(IVEC4, probe_coord_packed) +PUSH_CONSTANT(IVEC4, write_coord_packed) +PUSH_CONSTANT(IVEC4, world_coord_packed) +SAMPLER(0, FLOAT_CUBE, cubemap_tx) +SAMPLER(1, FLOAT_2D_ARRAY, atlas_tx) +STORAGE_BUF(0, WRITE, SphereProbeHarmonic, out_sh[]) +STORAGE_BUF(1, WRITE, SphereProbeSunLight, out_sun[]) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D_ARRAY, atlas_img) +COMPUTE_SOURCE("eevee_lightprobe_sphere_remap_comp.glsl") +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_global_ubo) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_irradiance) - .local_group_size(SPHERE_PROBE_SH_GROUP_SIZE) - .push_constant(Type::IVEC3, "probe_remap_dispatch_size") - .storage_buf(0, Qualifier::READ, "SphereProbeHarmonic", "in_sh[]") - .storage_buf(1, Qualifier::WRITE, "SphereProbeHarmonic", "out_sh") - .additional_info("eevee_shared") - .do_static_compilation(true) - .compute_source("eevee_lightprobe_sphere_irradiance_comp.glsl"); +LOCAL_GROUP_SIZE(SPHERE_PROBE_SH_GROUP_SIZE) +PUSH_CONSTANT(IVEC3, probe_remap_dispatch_size) +STORAGE_BUF(0, READ, SphereProbeHarmonic, in_sh[]) +STORAGE_BUF(1, WRITE, SphereProbeHarmonic, out_sh) +ADDITIONAL_INFO(eevee_shared) +DO_STATIC_COMPILATION() +COMPUTE_SOURCE("eevee_lightprobe_sphere_irradiance_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_sunlight) - .local_group_size(SPHERE_PROBE_SH_GROUP_SIZE) - .push_constant(Type::IVEC3, "probe_remap_dispatch_size") - .storage_buf(0, Qualifier::READ, "SphereProbeSunLight", "in_sun[]") - .storage_buf(1, Qualifier::WRITE, "LightData", "sunlight_buf") - .additional_info("eevee_shared") - .do_static_compilation(true) - .compute_source("eevee_lightprobe_sphere_sunlight_comp.glsl"); +LOCAL_GROUP_SIZE(SPHERE_PROBE_SH_GROUP_SIZE) +PUSH_CONSTANT(IVEC3, probe_remap_dispatch_size) +STORAGE_BUF(0, READ, SphereProbeSunLight, in_sun[]) +STORAGE_BUF(1, WRITE, LightData, sunlight_buf) +ADDITIONAL_INFO(eevee_shared) +DO_STATIC_COMPILATION() +COMPUTE_SOURCE("eevee_lightprobe_sphere_sunlight_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_select) - .local_group_size(SPHERE_PROBE_SELECT_GROUP_SIZE) - .storage_buf(0, - Qualifier::READ_WRITE, - "SphereProbeData", - "lightprobe_sphere_buf[SPHERE_PROBE_MAX]") - .push_constant(Type::INT, "lightprobe_sphere_count") - .additional_info("eevee_shared") - .additional_info("eevee_sampling_data") - .additional_info("eevee_global_ubo") - .additional_info("eevee_volume_probe_data") - .compute_source("eevee_lightprobe_sphere_select_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(SPHERE_PROBE_SELECT_GROUP_SIZE) +STORAGE_BUF(0, READ_WRITE, SphereProbeData, lightprobe_sphere_buf[SPHERE_PROBE_MAX]) +PUSH_CONSTANT(INT, lightprobe_sphere_count) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_volume_probe_data) +COMPUTE_SOURCE("eevee_lightprobe_sphere_select_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_convolve) - .local_group_size(SPHERE_PROBE_GROUP_SIZE, SPHERE_PROBE_GROUP_SIZE) - .additional_info("eevee_shared") - .push_constant(Type::IVEC4, "probe_coord_packed") - .push_constant(Type::IVEC4, "write_coord_packed") - .push_constant(Type::IVEC4, "read_coord_packed") - .push_constant(Type::INT, "read_lod") - .sampler(0, ImageType::FLOAT_CUBE, "cubemap_tx") - .sampler(1, ImageType::FLOAT_2D_ARRAY, "in_atlas_mip_tx") - .image(1, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_atlas_mip_img") - .compute_source("eevee_lightprobe_sphere_convolve_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(SPHERE_PROBE_GROUP_SIZE, SPHERE_PROBE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +PUSH_CONSTANT(IVEC4, probe_coord_packed) +PUSH_CONSTANT(IVEC4, write_coord_packed) +PUSH_CONSTANT(IVEC4, read_coord_packed) +PUSH_CONSTANT(INT, read_lod) +SAMPLER(0, FLOAT_CUBE, cubemap_tx) +SAMPLER(1, FLOAT_2D_ARRAY, in_atlas_mip_tx) +IMAGE(1, GPU_RGBA16F, WRITE, FLOAT_2D_ARRAY, out_atlas_mip_img) +COMPUTE_SOURCE("eevee_lightprobe_sphere_convolve_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(eevee_display_lightprobe_sphere_iface) - .smooth(Type::VEC3, "P") - .smooth(Type::VEC2, "lP") - .flat(Type::INT, "probe_index"); +SMOOTH(VEC3, P) +SMOOTH(VEC2, lP) +FLAT(INT, probe_index) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(eevee_display_lightprobe_sphere) - .additional_info("eevee_shared") - .additional_info("draw_view") - .additional_info("eevee_lightprobe_sphere_data") - .storage_buf(0, Qualifier::READ, "SphereProbeDisplayData", "display_data_buf[]") - .vertex_source("eevee_display_lightprobe_sphere_vert.glsl") - .vertex_out(eevee_display_lightprobe_sphere_iface) - .fragment_source("eevee_display_lightprobe_sphere_frag.glsl") - .fragment_out(0, Type::VEC4, "out_color") - .do_static_compilation(true); +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_lightprobe_sphere_data) +STORAGE_BUF(0, READ, SphereProbeDisplayData, display_data_buf[]) +VERTEX_SOURCE("eevee_display_lightprobe_sphere_vert.glsl") +VERTEX_OUT(eevee_display_lightprobe_sphere_iface) +FRAGMENT_SOURCE("eevee_display_lightprobe_sphere_frag.glsl") +FRAGMENT_OUT(0, VEC4, out_color) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(eevee_display_lightprobe_planar_iface) - .flat(Type::VEC3, "probe_normal") - .flat(Type::INT, "probe_index"); +FLAT(VEC3, probe_normal) +FLAT(INT, probe_index) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(eevee_display_lightprobe_planar) - .push_constant(Type::IVEC4, "world_coord_packed") - .additional_info("eevee_shared") - .additional_info("draw_view") - .additional_info("eevee_lightprobe_planar_data") - .additional_info("eevee_lightprobe_sphere_data") - .storage_buf(0, Qualifier::READ, "PlanarProbeDisplayData", "display_data_buf[]") - .vertex_source("eevee_display_lightprobe_planar_vert.glsl") - .vertex_out(eevee_display_lightprobe_planar_iface) - .fragment_source("eevee_display_lightprobe_planar_frag.glsl") - .fragment_out(0, Type::VEC4, "out_color") - .do_static_compilation(true); +PUSH_CONSTANT(IVEC4, world_coord_packed) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_lightprobe_planar_data) +ADDITIONAL_INFO(eevee_lightprobe_sphere_data) +STORAGE_BUF(0, READ, PlanarProbeDisplayData, display_data_buf[]) +VERTEX_SOURCE("eevee_display_lightprobe_planar_vert.glsl") +VERTEX_OUT(eevee_display_lightprobe_planar_iface) +FRAGMENT_SOURCE("eevee_display_lightprobe_planar_frag.glsl") +FRAGMENT_OUT(0, VEC4, out_color) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_volume_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_volume_info.hh index 9efe18ed10c..3221e6a465c 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_volume_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_volume_info.hh @@ -10,58 +10,65 @@ * \{ */ GPU_SHADER_INTERFACE_INFO(eevee_debug_surfel_iface) - .smooth(Type::VEC3, "P") - .flat(Type::INT, "surfel_index"); +SMOOTH(VEC3, P) +FLAT(INT, surfel_index) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(eevee_debug_surfels) - .additional_info("eevee_shared") - .additional_info("draw_view") - .vertex_source("eevee_debug_surfels_vert.glsl") - .vertex_out(eevee_debug_surfel_iface) - .fragment_source("eevee_debug_surfels_frag.glsl") - .fragment_out(0, Type::VEC4, "out_color") - .storage_buf(0, Qualifier::READ, "Surfel", "surfels_buf[]") - .push_constant(Type::FLOAT, "debug_surfel_radius") - .push_constant(Type::INT, "debug_mode") - .do_static_compilation(true); +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +VERTEX_SOURCE("eevee_debug_surfels_vert.glsl") +VERTEX_OUT(eevee_debug_surfel_iface) +FRAGMENT_SOURCE("eevee_debug_surfels_frag.glsl") +FRAGMENT_OUT(0, VEC4, out_color) +STORAGE_BUF(0, READ, Surfel, surfels_buf[]) +PUSH_CONSTANT(FLOAT, debug_surfel_radius) +PUSH_CONSTANT(INT, debug_mode) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() -GPU_SHADER_INTERFACE_INFO(eevee_debug_irradiance_grid_iface).smooth(Type::VEC4, "interp_color"); +GPU_SHADER_INTERFACE_INFO(eevee_debug_irradiance_grid_iface) +SMOOTH(VEC4, interp_color) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(eevee_debug_irradiance_grid) - .additional_info("eevee_shared") - .additional_info("draw_view") - .fragment_out(0, Type::VEC4, "out_color") - .vertex_out(eevee_debug_irradiance_grid_iface) - .sampler(0, ImageType::FLOAT_3D, "debug_data_tx") - .push_constant(Type::MAT4, "grid_mat") - .push_constant(Type::INT, "debug_mode") - .push_constant(Type::FLOAT, "debug_value") - .vertex_source("eevee_debug_irradiance_grid_vert.glsl") - .fragment_source("eevee_debug_irradiance_grid_frag.glsl") - .do_static_compilation(true); +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +FRAGMENT_OUT(0, VEC4, out_color) +VERTEX_OUT(eevee_debug_irradiance_grid_iface) +SAMPLER(0, FLOAT_3D, debug_data_tx) +PUSH_CONSTANT(MAT4, grid_mat) +PUSH_CONSTANT(INT, debug_mode) +PUSH_CONSTANT(FLOAT, debug_value) +VERTEX_SOURCE("eevee_debug_irradiance_grid_vert.glsl") +FRAGMENT_SOURCE("eevee_debug_irradiance_grid_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(eevee_display_lightprobe_volume_iface) - .smooth(Type::VEC2, "lP") - .flat(Type::IVEC3, "cell"); +SMOOTH(VEC2, lP) +FLAT(IVEC3, cell) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(eevee_display_lightprobe_volume) - .additional_info("eevee_shared") - .additional_info("draw_view") - .vertex_source("eevee_display_lightprobe_volume_vert.glsl") - .vertex_out(eevee_display_lightprobe_volume_iface) - .fragment_source("eevee_display_lightprobe_volume_frag.glsl") - .fragment_out(0, Type::VEC4, "out_color") - .push_constant(Type::FLOAT, "sphere_radius") - .push_constant(Type::IVEC3, "grid_resolution") - .push_constant(Type::MAT4, "grid_to_world") - .push_constant(Type::MAT4, "world_to_grid") - .push_constant(Type::BOOL, "display_validity") - .sampler(0, ImageType::FLOAT_3D, "irradiance_a_tx") - .sampler(1, ImageType::FLOAT_3D, "irradiance_b_tx") - .sampler(2, ImageType::FLOAT_3D, "irradiance_c_tx") - .sampler(3, ImageType::FLOAT_3D, "irradiance_d_tx") - .sampler(4, ImageType::FLOAT_3D, "validity_tx") - .do_static_compilation(true); +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +VERTEX_SOURCE("eevee_display_lightprobe_volume_vert.glsl") +VERTEX_OUT(eevee_display_lightprobe_volume_iface) +FRAGMENT_SOURCE("eevee_display_lightprobe_volume_frag.glsl") +FRAGMENT_OUT(0, VEC4, out_color) +PUSH_CONSTANT(FLOAT, sphere_radius) +PUSH_CONSTANT(IVEC3, grid_resolution) +PUSH_CONSTANT(MAT4, grid_to_world) +PUSH_CONSTANT(MAT4, world_to_grid) +PUSH_CONSTANT(BOOL, display_validity) +SAMPLER(0, FLOAT_3D, irradiance_a_tx) +SAMPLER(1, FLOAT_3D, irradiance_b_tx) +SAMPLER(2, FLOAT_3D, irradiance_c_tx) +SAMPLER(3, FLOAT_3D, irradiance_d_tx) +SAMPLER(4, FLOAT_3D, validity_tx) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /** \} */ @@ -70,108 +77,117 @@ GPU_SHADER_CREATE_INFO(eevee_display_lightprobe_volume) * \{ */ GPU_SHADER_CREATE_INFO(eevee_surfel_common) - .storage_buf(SURFEL_BUF_SLOT, Qualifier::READ_WRITE, "Surfel", "surfel_buf[]") - .storage_buf(CAPTURE_BUF_SLOT, Qualifier::READ, "CaptureInfoData", "capture_info_buf"); +STORAGE_BUF(SURFEL_BUF_SLOT, READ_WRITE, Surfel, surfel_buf[]) +STORAGE_BUF(CAPTURE_BUF_SLOT, READ, CaptureInfoData, capture_info_buf) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surfel_light) - .define("LIGHT_ITER_FORCE_NO_CULLING") - .define("LIGHT_CLOSURE_EVAL_COUNT", "1") - .local_group_size(SURFEL_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("draw_view") - .additional_info("eevee_global_ubo") - .additional_info("eevee_utility_texture") - .additional_info("eevee_surfel_common") - .additional_info("eevee_light_data") - .additional_info("eevee_shadow_data") - .compute_source("eevee_surfel_light_comp.glsl") - .do_static_compilation(true); +DEFINE("LIGHT_ITER_FORCE_NO_CULLING") +DEFINE_VALUE("LIGHT_CLOSURE_EVAL_COUNT", "1") +LOCAL_GROUP_SIZE(SURFEL_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_utility_texture) +ADDITIONAL_INFO(eevee_surfel_common) +ADDITIONAL_INFO(eevee_light_data) +ADDITIONAL_INFO(eevee_shadow_data) +COMPUTE_SOURCE("eevee_surfel_light_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surfel_cluster_build) - .local_group_size(SURFEL_GROUP_SIZE) - .builtins(BuiltinBits::TEXTURE_ATOMIC) - .additional_info("eevee_shared") - .additional_info("eevee_surfel_common") - .additional_info("draw_view") - .image(0, GPU_R32I, Qualifier::READ_WRITE, ImageType::INT_3D_ATOMIC, "cluster_list_img") - .compute_source("eevee_surfel_cluster_build_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(SURFEL_GROUP_SIZE) +BUILTINS(BuiltinBits::TEXTURE_ATOMIC) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_surfel_common) +ADDITIONAL_INFO(draw_view) +IMAGE(0, GPU_R32I, READ_WRITE, INT_3D_ATOMIC, cluster_list_img) +COMPUTE_SOURCE("eevee_surfel_cluster_build_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surfel_list_build) - .local_group_size(SURFEL_GROUP_SIZE) - .builtins(BuiltinBits::TEXTURE_ATOMIC) - .additional_info("eevee_shared") - .additional_info("eevee_surfel_common") - .additional_info("draw_view") - .storage_buf(0, Qualifier::READ_WRITE, "int", "list_start_buf[]") - .storage_buf(6, Qualifier::READ_WRITE, "SurfelListInfoData", "list_info_buf") - .compute_source("eevee_surfel_list_build_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(SURFEL_GROUP_SIZE) +BUILTINS(BuiltinBits::TEXTURE_ATOMIC) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_surfel_common) +ADDITIONAL_INFO(draw_view) +STORAGE_BUF(0, READ_WRITE, int, list_start_buf[]) +STORAGE_BUF(6, READ_WRITE, SurfelListInfoData, list_info_buf) +COMPUTE_SOURCE("eevee_surfel_list_build_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surfel_list_sort) - .local_group_size(SURFEL_LIST_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_surfel_common") - .additional_info("draw_view") - .storage_buf(0, Qualifier::READ_WRITE, "int", "list_start_buf[]") - .storage_buf(6, Qualifier::READ, "SurfelListInfoData", "list_info_buf") - .compute_source("eevee_surfel_list_sort_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(SURFEL_LIST_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_surfel_common) +ADDITIONAL_INFO(draw_view) +STORAGE_BUF(0, READ_WRITE, int, list_start_buf[]) +STORAGE_BUF(6, READ, SurfelListInfoData, list_info_buf) +COMPUTE_SOURCE("eevee_surfel_list_sort_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surfel_ray) - .local_group_size(SURFEL_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_surfel_common") - .additional_info("eevee_lightprobe_sphere_data") - .additional_info("draw_view") - .push_constant(Type::INT, "radiance_src") - .push_constant(Type::INT, "radiance_dst") - .compute_source("eevee_surfel_ray_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(SURFEL_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_surfel_common) +ADDITIONAL_INFO(eevee_lightprobe_sphere_data) +ADDITIONAL_INFO(draw_view) +PUSH_CONSTANT(INT, radiance_src) +PUSH_CONSTANT(INT, radiance_dst) +COMPUTE_SOURCE("eevee_surfel_ray_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_bounds) - .do_static_compilation(true) - .local_group_size(IRRADIANCE_BOUNDS_GROUP_SIZE) - .storage_buf(0, Qualifier::READ_WRITE, "CaptureInfoData", "capture_info_buf") - .storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") - .push_constant(Type::INT, "resource_len") - .typedef_source("draw_shader_shared.hh") - .additional_info("eevee_shared") - .compute_source("eevee_lightprobe_volume_bounds_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(IRRADIANCE_BOUNDS_GROUP_SIZE) +STORAGE_BUF(0, READ_WRITE, CaptureInfoData, capture_info_buf) +STORAGE_BUF(1, READ, ObjectBounds, bounds_buf[]) +PUSH_CONSTANT(INT, resource_len) +TYPEDEF_SOURCE("draw_shader_shared.hh") +ADDITIONAL_INFO(eevee_shared) +COMPUTE_SOURCE("eevee_lightprobe_volume_bounds_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_ray) - .local_group_size(IRRADIANCE_GRID_GROUP_SIZE, - IRRADIANCE_GRID_GROUP_SIZE, - IRRADIANCE_GRID_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_surfel_common") - .additional_info("eevee_lightprobe_sphere_data") - .additional_info("draw_view") - .push_constant(Type::INT, "radiance_src") - .storage_buf(0, Qualifier::READ, "int", "list_start_buf[]") - .storage_buf(6, Qualifier::READ, "SurfelListInfoData", "list_info_buf") - .image(0, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "irradiance_L0_img") - .image(1, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "irradiance_L1_a_img") - .image(2, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "irradiance_L1_b_img") - .image(3, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "irradiance_L1_c_img") - .image(4, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_3D, "virtual_offset_img") - .image(5, GPU_R32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "validity_img") - .compute_source("eevee_lightprobe_volume_ray_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(IRRADIANCE_GRID_GROUP_SIZE, + IRRADIANCE_GRID_GROUP_SIZE, + IRRADIANCE_GRID_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_surfel_common) +ADDITIONAL_INFO(eevee_lightprobe_sphere_data) +ADDITIONAL_INFO(draw_view) +PUSH_CONSTANT(INT, radiance_src) +STORAGE_BUF(0, READ, int, list_start_buf[]) +STORAGE_BUF(6, READ, SurfelListInfoData, list_info_buf) +IMAGE(0, GPU_RGBA32F, READ_WRITE, FLOAT_3D, irradiance_L0_img) +IMAGE(1, GPU_RGBA32F, READ_WRITE, FLOAT_3D, irradiance_L1_a_img) +IMAGE(2, GPU_RGBA32F, READ_WRITE, FLOAT_3D, irradiance_L1_b_img) +IMAGE(3, GPU_RGBA32F, READ_WRITE, FLOAT_3D, irradiance_L1_c_img) +IMAGE(4, GPU_RGBA16F, READ, FLOAT_3D, virtual_offset_img) +IMAGE(5, GPU_R32F, READ_WRITE, FLOAT_3D, validity_img) +COMPUTE_SOURCE("eevee_lightprobe_volume_ray_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_offset) - .local_group_size(IRRADIANCE_GRID_GROUP_SIZE, - IRRADIANCE_GRID_GROUP_SIZE, - IRRADIANCE_GRID_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_surfel_common") - .additional_info("draw_view") - .storage_buf(0, Qualifier::READ, "int", "list_start_buf[]") - .storage_buf(6, Qualifier::READ, "SurfelListInfoData", "list_info_buf") - .image(0, GPU_R32I, Qualifier::READ, ImageType::INT_3D_ATOMIC, "cluster_list_img") - .image(1, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "virtual_offset_img") - .compute_source("eevee_lightprobe_volume_offset_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(IRRADIANCE_GRID_GROUP_SIZE, + IRRADIANCE_GRID_GROUP_SIZE, + IRRADIANCE_GRID_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_surfel_common) +ADDITIONAL_INFO(draw_view) +STORAGE_BUF(0, READ, int, list_start_buf[]) +STORAGE_BUF(6, READ, SurfelListInfoData, list_info_buf) +IMAGE(0, GPU_R32I, READ, INT_3D_ATOMIC, cluster_list_img) +IMAGE(1, GPU_RGBA16F, READ_WRITE, FLOAT_3D, virtual_offset_img) +COMPUTE_SOURCE("eevee_lightprobe_volume_offset_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /** \} */ @@ -180,68 +196,71 @@ GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_offset) * \{ */ GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_world) - .local_group_size(IRRADIANCE_GRID_BRICK_SIZE, - IRRADIANCE_GRID_BRICK_SIZE, - IRRADIANCE_GRID_BRICK_SIZE) - .define("IRRADIANCE_GRID_UPLOAD") - .additional_info("eevee_shared") - .additional_info("eevee_global_ubo") - .push_constant(Type::INT, "grid_index") - .storage_buf(0, Qualifier::READ, "uint", "bricks_infos_buf[]") - .storage_buf(1, Qualifier::READ, "SphereProbeHarmonic", "harmonic_buf") - .uniform_buf(0, "VolumeProbeData", "grids_infos_buf[IRRADIANCE_GRID_MAX]") - .image(0, VOLUME_PROBE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_3D, "irradiance_atlas_img") - .compute_source("eevee_lightprobe_volume_world_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(IRRADIANCE_GRID_BRICK_SIZE, + IRRADIANCE_GRID_BRICK_SIZE, + IRRADIANCE_GRID_BRICK_SIZE) +DEFINE("IRRADIANCE_GRID_UPLOAD") +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_global_ubo) +PUSH_CONSTANT(INT, grid_index) +STORAGE_BUF(0, READ, uint, bricks_infos_buf[]) +STORAGE_BUF(1, READ, SphereProbeHarmonic, harmonic_buf) +UNIFORM_BUF(0, VolumeProbeData, grids_infos_buf[IRRADIANCE_GRID_MAX]) +IMAGE(0, VOLUME_PROBE_FORMAT, WRITE, FLOAT_3D, irradiance_atlas_img) +COMPUTE_SOURCE("eevee_lightprobe_volume_world_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_load) - .local_group_size(IRRADIANCE_GRID_BRICK_SIZE, - IRRADIANCE_GRID_BRICK_SIZE, - IRRADIANCE_GRID_BRICK_SIZE) - .define("IRRADIANCE_GRID_UPLOAD") - .additional_info("eevee_shared") - .additional_info("eevee_global_ubo") - .push_constant(Type::MAT4, "grid_local_to_world") - .push_constant(Type::INT, "grid_index") - .push_constant(Type::INT, "grid_start_index") - .push_constant(Type::FLOAT, "validity_threshold") - .push_constant(Type::FLOAT, "dilation_threshold") - .push_constant(Type::FLOAT, "dilation_radius") - .push_constant(Type::FLOAT, "grid_intensity_factor") - .uniform_buf(0, "VolumeProbeData", "grids_infos_buf[IRRADIANCE_GRID_MAX]") - .storage_buf(0, Qualifier::READ, "uint", "bricks_infos_buf[]") - .sampler(0, ImageType::FLOAT_3D, "irradiance_a_tx") - .sampler(1, ImageType::FLOAT_3D, "irradiance_b_tx") - .sampler(2, ImageType::FLOAT_3D, "irradiance_c_tx") - .sampler(3, ImageType::FLOAT_3D, "irradiance_d_tx") - .sampler(4, ImageType::FLOAT_3D, "visibility_a_tx") - .sampler(5, ImageType::FLOAT_3D, "visibility_b_tx") - .sampler(6, ImageType::FLOAT_3D, "visibility_c_tx") - .sampler(7, ImageType::FLOAT_3D, "visibility_d_tx") - .sampler(8, ImageType::FLOAT_3D, "irradiance_atlas_tx") - .sampler(9, ImageType::FLOAT_3D, "validity_tx") - .image(0, VOLUME_PROBE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_3D, "irradiance_atlas_img") - .compute_source("eevee_lightprobe_volume_load_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(IRRADIANCE_GRID_BRICK_SIZE, + IRRADIANCE_GRID_BRICK_SIZE, + IRRADIANCE_GRID_BRICK_SIZE) +DEFINE("IRRADIANCE_GRID_UPLOAD") +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_global_ubo) +PUSH_CONSTANT(MAT4, grid_local_to_world) +PUSH_CONSTANT(INT, grid_index) +PUSH_CONSTANT(INT, grid_start_index) +PUSH_CONSTANT(FLOAT, validity_threshold) +PUSH_CONSTANT(FLOAT, dilation_threshold) +PUSH_CONSTANT(FLOAT, dilation_radius) +PUSH_CONSTANT(FLOAT, grid_intensity_factor) +UNIFORM_BUF(0, VolumeProbeData, grids_infos_buf[IRRADIANCE_GRID_MAX]) +STORAGE_BUF(0, READ, uint, bricks_infos_buf[]) +SAMPLER(0, FLOAT_3D, irradiance_a_tx) +SAMPLER(1, FLOAT_3D, irradiance_b_tx) +SAMPLER(2, FLOAT_3D, irradiance_c_tx) +SAMPLER(3, FLOAT_3D, irradiance_d_tx) +SAMPLER(4, FLOAT_3D, visibility_a_tx) +SAMPLER(5, FLOAT_3D, visibility_b_tx) +SAMPLER(6, FLOAT_3D, visibility_c_tx) +SAMPLER(7, FLOAT_3D, visibility_d_tx) +SAMPLER(8, FLOAT_3D, irradiance_atlas_tx) +SAMPLER(9, FLOAT_3D, validity_tx) +IMAGE(0, VOLUME_PROBE_FORMAT, WRITE, FLOAT_3D, irradiance_atlas_img) +COMPUTE_SOURCE("eevee_lightprobe_volume_load_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_volume_probe_data) - .uniform_buf(IRRADIANCE_GRID_BUF_SLOT, - "VolumeProbeData", - "grids_infos_buf[IRRADIANCE_GRID_MAX]") - /* NOTE: Use uint instead of IrradianceBrickPacked because Metal needs to know the exact type. - */ - .storage_buf(IRRADIANCE_BRICK_BUF_SLOT, Qualifier::READ, "uint", "bricks_infos_buf[]") - .sampler(VOLUME_PROBE_TEX_SLOT, ImageType::FLOAT_3D, "irradiance_atlas_tx") - .define("IRRADIANCE_GRID_SAMPLING"); +UNIFORM_BUF(IRRADIANCE_GRID_BUF_SLOT, VolumeProbeData, grids_infos_buf[IRRADIANCE_GRID_MAX]) +/* NOTE: Use uint instead of IrradianceBrickPacked because Metal needs to know the exact type. + */ +STORAGE_BUF(IRRADIANCE_BRICK_BUF_SLOT, READ, uint, bricks_infos_buf[]) +SAMPLER(VOLUME_PROBE_TEX_SLOT, FLOAT_3D, irradiance_atlas_tx) +DEFINE("IRRADIANCE_GRID_SAMPLING") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_lightprobe_data) - .additional_info("eevee_lightprobe_sphere_data") - .additional_info("eevee_volume_probe_data"); +ADDITIONAL_INFO(eevee_lightprobe_sphere_data) +ADDITIONAL_INFO(eevee_volume_probe_data) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_lightprobe_planar_data) - .define("SPHERE_PROBE") - .uniform_buf(PLANAR_PROBE_BUF_SLOT, "PlanarProbeData", "probe_planar_buf[PLANAR_PROBE_MAX]") - .sampler(PLANAR_PROBE_RADIANCE_TEX_SLOT, ImageType::FLOAT_2D_ARRAY, "planar_radiance_tx") - .sampler(PLANAR_PROBE_DEPTH_TEX_SLOT, ImageType::DEPTH_2D_ARRAY, "planar_depth_tx"); +DEFINE("SPHERE_PROBE") +UNIFORM_BUF(PLANAR_PROBE_BUF_SLOT, PlanarProbeData, probe_planar_buf[PLANAR_PROBE_MAX]) +SAMPLER(PLANAR_PROBE_RADIANCE_TEX_SLOT, FLOAT_2D_ARRAY, planar_radiance_tx) +SAMPLER(PLANAR_PROBE_DEPTH_TEX_SLOT, DEPTH_2D_ARRAY, planar_depth_tx) +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lookdev_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lookdev_info.hh index d56bf371eb5..d56e6fb841d 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lookdev_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lookdev_info.hh @@ -6,18 +6,20 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_INTERFACE_INFO(eevee_lookdev_display_iface) - .smooth(Type::VEC2, "uv_coord") - .flat(Type::UINT, "sphere_id"); +SMOOTH(VEC2, uv_coord) +FLAT(UINT, sphere_id) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(eevee_lookdev_display) - .vertex_source("eevee_lookdev_display_vert.glsl") - .vertex_out(eevee_lookdev_display_iface) - .push_constant(Type::VEC2, "viewportSize") - .push_constant(Type::VEC2, "invertedViewportSize") - .push_constant(Type::IVEC2, "anchor") - .sampler(0, ImageType::FLOAT_2D, "metallic_tx") - .sampler(1, ImageType::FLOAT_2D, "diffuse_tx") - .fragment_out(0, Type::VEC4, "out_color") - .fragment_source("eevee_lookdev_display_frag.glsl") - .depth_write(DepthWrite::ANY) - .do_static_compilation(true); +VERTEX_SOURCE("eevee_lookdev_display_vert.glsl") +VERTEX_OUT(eevee_lookdev_display_iface) +PUSH_CONSTANT(VEC2, viewportSize) +PUSH_CONSTANT(VEC2, invertedViewportSize) +PUSH_CONSTANT(IVEC2, anchor) +SAMPLER(0, FLOAT_2D, metallic_tx) +SAMPLER(1, FLOAT_2D, diffuse_tx) +FRAGMENT_OUT(0, VEC4, out_color) +FRAGMENT_SOURCE("eevee_lookdev_display_frag.glsl") +DEPTH_WRITE(DepthWrite::ANY) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lut_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lut_info.hh index 421f1fd65e4..16c838a1ace 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lut_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lut_info.hh @@ -5,10 +5,11 @@ #include "eevee_defines.hh" GPU_SHADER_CREATE_INFO(eevee_lut) - .local_group_size(LUT_WORKGROUP_SIZE, LUT_WORKGROUP_SIZE, 1) - .push_constant(Type::INT, "table_type") - .push_constant(Type::IVEC3, "table_extent") - .image(0, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "table_img") - .additional_info("eevee_shared") - .compute_source("eevee_lut_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(LUT_WORKGROUP_SIZE, LUT_WORKGROUP_SIZE, 1) +PUSH_CONSTANT(INT, table_type) +PUSH_CONSTANT(IVEC3, table_extent) +IMAGE(0, GPU_RGBA32F, READ_WRITE, FLOAT_3D, table_img) +ADDITIONAL_INFO(eevee_shared) +COMPUTE_SOURCE("eevee_lut_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh index 85dc0a39702..cf19c30def4 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh @@ -11,28 +11,34 @@ /* TODO(@fclem): This is a bit out of place at the moment. */ GPU_SHADER_CREATE_INFO(eevee_shared) - .typedef_source("eevee_defines.hh") - .typedef_source("eevee_shader_shared.hh"); +TYPEDEF_SOURCE("eevee_defines.hh") +TYPEDEF_SOURCE("eevee_shader_shared.hh") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_global_ubo) - .uniform_buf(UNIFORM_BUF_SLOT, "UniformData", "uniform_buf"); +UNIFORM_BUF(UNIFORM_BUF_SLOT, UniformData, uniform_buf) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_sampling_data) - .define("EEVEE_SAMPLING_DATA") - .additional_info("eevee_shared") - .storage_buf(SAMPLING_BUF_SLOT, Qualifier::READ, "SamplingData", "sampling_buf"); +DEFINE("EEVEE_SAMPLING_DATA") +ADDITIONAL_INFO(eevee_shared) +STORAGE_BUF(SAMPLING_BUF_SLOT, READ, SamplingData, sampling_buf) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_utility_texture) - .define("EEVEE_UTILITY_TX") - .sampler(RBUFS_UTILITY_TEX_SLOT, ImageType::FLOAT_2D_ARRAY, "utility_tx"); +DEFINE("EEVEE_UTILITY_TX") +SAMPLER(RBUFS_UTILITY_TEX_SLOT, FLOAT_2D_ARRAY, utility_tx) +GPU_SHADER_CREATE_END() GPU_SHADER_NAMED_INTERFACE_INFO(eevee_clip_plane_iface, clip_interp) - .smooth(Type::FLOAT, "clip_distance"); +SMOOTH(FLOAT, clip_distance) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(eevee_clip_plane) - .vertex_out(eevee_clip_plane_iface) - .uniform_buf(CLIP_PLANE_BUF, "ClipPlaneData", "clip_plane") - .define("MAT_CLIP_PLANE"); +VERTEX_OUT(eevee_clip_plane_iface) +UNIFORM_BUF(CLIP_PLANE_BUF, ClipPlaneData, clip_plane) +DEFINE("MAT_CLIP_PLANE") +GPU_SHADER_CREATE_END() /** \} */ @@ -42,99 +48,110 @@ GPU_SHADER_CREATE_INFO(eevee_clip_plane) /* Common interface */ GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_iface, interp) - /* World Position. */ - .smooth(Type::VEC3, "P") - /* World Normal. */ - .smooth(Type::VEC3, "N"); +/* World Position. */ +SMOOTH(VEC3, P) +/* World Normal. */ +SMOOTH(VEC3, N) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(eevee_geom_mesh) - .additional_info("eevee_shared") - .define("MAT_GEOM_MESH") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC3, "nor") - .vertex_source("eevee_geom_mesh_vert.glsl") - .vertex_out(eevee_surf_iface) - .additional_info("draw_modelmat_new") - .additional_info("draw_object_infos_new") - .additional_info("draw_resource_id_varying") - .additional_info("draw_view"); +ADDITIONAL_INFO(eevee_shared) +DEFINE("MAT_GEOM_MESH") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC3, nor) +VERTEX_SOURCE("eevee_geom_mesh_vert.glsl") +VERTEX_OUT(eevee_surf_iface) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_object_infos_new) +ADDITIONAL_INFO(draw_resource_id_varying) +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_point_cloud_iface, point_cloud_interp) - .smooth(Type::FLOAT, "radius") - .smooth(Type::VEC3, "position"); +SMOOTH(FLOAT, radius) +SMOOTH(VEC3, position) +GPU_SHADER_INTERFACE_END() GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_point_cloud_flat_iface, point_cloud_interp_flat) - .flat(Type::INT, "id"); +FLAT(INT, id) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(eevee_geom_point_cloud) - .additional_info("eevee_shared") - .define("MAT_GEOM_POINT_CLOUD") - .vertex_source("eevee_geom_point_cloud_vert.glsl") - .vertex_out(eevee_surf_iface) - .vertex_out(eevee_surf_point_cloud_iface) - .vertex_out(eevee_surf_point_cloud_flat_iface) - .additional_info("draw_pointcloud_new") - .additional_info("draw_modelmat_new") - .additional_info("draw_object_infos_new") - .additional_info("draw_resource_id_varying") - .additional_info("draw_view"); +ADDITIONAL_INFO(eevee_shared) +DEFINE("MAT_GEOM_POINT_CLOUD") +VERTEX_SOURCE("eevee_geom_point_cloud_vert.glsl") +VERTEX_OUT(eevee_surf_iface) +VERTEX_OUT(eevee_surf_point_cloud_iface) +VERTEX_OUT(eevee_surf_point_cloud_flat_iface) +ADDITIONAL_INFO(draw_pointcloud_new) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_object_infos_new) +ADDITIONAL_INFO(draw_resource_id_varying) +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_geom_volume) - .additional_info("eevee_shared") - .define("MAT_GEOM_VOLUME") - .vertex_in(0, Type::VEC3, "pos") - .vertex_out(eevee_surf_iface) - .vertex_source("eevee_geom_volume_vert.glsl") - .additional_info("draw_modelmat_new") - .additional_info("draw_object_infos_new") - .additional_info("draw_resource_id_varying") - .additional_info("draw_volume_infos") - .additional_info("draw_view"); +ADDITIONAL_INFO(eevee_shared) +DEFINE("MAT_GEOM_VOLUME") +VERTEX_IN(0, VEC3, pos) +VERTEX_OUT(eevee_surf_iface) +VERTEX_SOURCE("eevee_geom_volume_vert.glsl") +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_object_infos_new) +ADDITIONAL_INFO(draw_resource_id_varying) +ADDITIONAL_INFO(draw_volume_infos) +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_geom_gpencil) - .additional_info("eevee_shared") - .define("MAT_GEOM_GPENCIL") - .vertex_source("eevee_geom_gpencil_vert.glsl") - .vertex_out(eevee_surf_iface) - .additional_info("draw_gpencil_new") - .additional_info("draw_modelmat_new") - .additional_info("draw_object_infos_new") - .additional_info("draw_resource_id_varying") - .additional_info("draw_resource_id_new"); +ADDITIONAL_INFO(eevee_shared) +DEFINE("MAT_GEOM_GPENCIL") +VERTEX_SOURCE("eevee_geom_gpencil_vert.glsl") +VERTEX_OUT(eevee_surf_iface) +ADDITIONAL_INFO(draw_gpencil_new) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_object_infos_new) +ADDITIONAL_INFO(draw_resource_id_varying) +ADDITIONAL_INFO(draw_resource_id_new) +GPU_SHADER_CREATE_END() GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_curve_iface, curve_interp) - .smooth(Type::VEC2, "barycentric_coords") - .smooth(Type::VEC3, "tangent") - .smooth(Type::VEC3, "binormal") - .smooth(Type::FLOAT, "time") - .smooth(Type::FLOAT, "time_width") - .smooth(Type::FLOAT, "thickness"); +SMOOTH(VEC2, barycentric_coords) +SMOOTH(VEC3, tangent) +SMOOTH(VEC3, binormal) +SMOOTH(FLOAT, time) +SMOOTH(FLOAT, time_width) +SMOOTH(FLOAT, thickness) +GPU_SHADER_INTERFACE_END() GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_curve_flat_iface, curve_interp_flat) - .flat(Type::INT, "strand_id"); +FLAT(INT, strand_id) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(eevee_geom_curves) - .additional_info("eevee_shared") - .define("MAT_GEOM_CURVES") - .vertex_source("eevee_geom_curves_vert.glsl") - .vertex_out(eevee_surf_iface) - .vertex_out(eevee_surf_curve_iface) - .vertex_out(eevee_surf_curve_flat_iface) - .additional_info("draw_modelmat_new") - .additional_info("draw_object_infos_new") - .additional_info("draw_resource_id_varying") - .additional_info("draw_view") - .additional_info("draw_hair_new") - .additional_info("draw_curves_infos"); +ADDITIONAL_INFO(eevee_shared) +DEFINE("MAT_GEOM_CURVES") +VERTEX_SOURCE("eevee_geom_curves_vert.glsl") +VERTEX_OUT(eevee_surf_iface) +VERTEX_OUT(eevee_surf_curve_iface) +VERTEX_OUT(eevee_surf_curve_flat_iface) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_object_infos_new) +ADDITIONAL_INFO(draw_resource_id_varying) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_hair_new) +ADDITIONAL_INFO(draw_curves_infos) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_geom_world) - .additional_info("eevee_shared") - .define("MAT_GEOM_WORLD") - .builtins(BuiltinBits::VERTEX_ID) - .vertex_source("eevee_geom_world_vert.glsl") - .vertex_out(eevee_surf_iface) - .additional_info("draw_modelmat_new") - .additional_info("draw_object_infos_new") /* Unused, but allow debug compilation. */ - .additional_info("draw_resource_id_varying") - .additional_info("draw_view"); +ADDITIONAL_INFO(eevee_shared) +DEFINE("MAT_GEOM_WORLD") +BUILTINS(BuiltinBits::VERTEX_ID) +VERTEX_SOURCE("eevee_geom_world_vert.glsl") +VERTEX_OUT(eevee_surf_iface) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_object_infos_new) /* Unused, but allow debug compilation. */ +ADDITIONAL_INFO(draw_resource_id_varying) +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() /** \} */ @@ -148,156 +165,161 @@ GPU_SHADER_CREATE_INFO(eevee_geom_world) image(slot, format, qualifier, ImageType::FLOAT_2D_ARRAY, name, Frequency::PASS) GPU_SHADER_CREATE_INFO(eevee_render_pass_out) - .define("MAT_RENDER_PASS_SUPPORT") - .additional_info("eevee_global_ubo") - .image_array_out(RBUFS_COLOR_SLOT, Qualifier::WRITE, GPU_RGBA16F, "rp_color_img") - .image_array_out(RBUFS_VALUE_SLOT, Qualifier::WRITE, GPU_R16F, "rp_value_img"); +DEFINE("MAT_RENDER_PASS_SUPPORT") +ADDITIONAL_INFO(eevee_global_ubo) +IMAGE_FREQ(RBUFS_COLOR_SLOT, GPU_RGBA16F, WRITE, FLOAT_2D, rp_color_img, PASS) +IMAGE_FREQ(RBUFS_VALUE_SLOT, GPU_R16F, WRITE, FLOAT_2D, rp_value_img, PASS) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_cryptomatte_out) - .storage_buf(CRYPTOMATTE_BUF_SLOT, Qualifier::READ, "vec2", "cryptomatte_object_buf[]") - .image_out(RBUFS_CRYPTOMATTE_SLOT, Qualifier::WRITE, GPU_RGBA32F, "rp_cryptomatte_img"); +STORAGE_BUF(CRYPTOMATTE_BUF_SLOT, READ, vec2, cryptomatte_object_buf[]) +IMAGE_FREQ(RBUFS_CRYPTOMATTE_SLOT, GPU_RGBA32F, WRITE, FLOAT_2D, rp_cryptomatte_img, PASS) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surf_deferred_base) - .define("MAT_DEFERRED") - .define("GBUFFER_WRITE") - /* NOTE: This removes the possibility of using gl_FragDepth. */ - .early_fragment_test(true) - /* Direct output. (Emissive, Holdout) */ - .fragment_out(0, Type::VEC4, "out_radiance") - .fragment_out(1, Type::UINT, "out_gbuf_header", DualBlend::NONE, DEFERRED_GBUFFER_ROG_ID) - .fragment_out(2, Type::VEC2, "out_gbuf_normal") - .fragment_out(3, Type::VEC4, "out_gbuf_closure1") - .fragment_out(4, Type::VEC4, "out_gbuf_closure2") - /* Everything is stored inside a two layered target, one for each format. This is to fit the - * limitation of the number of images we can bind on a single shader. */ - .image_array_out(GBUF_CLOSURE_SLOT, Qualifier::WRITE, GPU_RGB10_A2, "out_gbuf_closure_img") - .image_array_out(GBUF_NORMAL_SLOT, Qualifier::WRITE, GPU_RG16, "out_gbuf_normal_img") - /* Added at runtime because of test shaders not having `node_tree`. */ - // .additional_info("eevee_render_pass_out") - // .additional_info("eevee_cryptomatte_out") - .additional_info("eevee_global_ubo") - .additional_info("eevee_utility_texture") - .additional_info("eevee_sampling_data") - .additional_info("eevee_hiz_data"); +DEFINE("MAT_DEFERRED") +DEFINE("GBUFFER_WRITE") +/* NOTE: This removes the possibility of using gl_FragDepth. */ +EARLY_FRAGMENT_TEST(true) +/* Direct output. (Emissive, Holdout) */ +FRAGMENT_OUT(0, VEC4, out_radiance) +FRAGMENT_OUT_ROG(1, UINT, out_gbuf_header, DEFERRED_GBUFFER_ROG_ID) +FRAGMENT_OUT(2, VEC2, out_gbuf_normal) +FRAGMENT_OUT(3, VEC4, out_gbuf_closure1) +FRAGMENT_OUT(4, VEC4, out_gbuf_closure2) +/* Everything is stored inside a two layered target, one for each format. This is to fit the + * limitation of the number of images we can bind on a single shader. */ +IMAGE_FREQ(GBUF_CLOSURE_SLOT, GPU_RGB10_A2, WRITE, FLOAT_2D, out_gbuf_closure_img, PASS) +IMAGE_FREQ(GBUF_NORMAL_SLOT, GPU_RG16, WRITE, FLOAT_2D, out_gbuf_normal_img, PASS) +/* Added at runtime because of test shaders not having `node_tree`. */ +// ADDITIONAL_INFO(eevee_render_pass_out) +// ADDITIONAL_INFO(eevee_cryptomatte_out) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_utility_texture) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_hiz_data) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surf_deferred) - .fragment_source("eevee_surf_deferred_frag.glsl") - .additional_info("eevee_surf_deferred_base"); +FRAGMENT_SOURCE("eevee_surf_deferred_frag.glsl") +ADDITIONAL_INFO(eevee_surf_deferred_base) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surf_deferred_hybrid) - .fragment_source("eevee_surf_hybrid_frag.glsl") - .additional_info("eevee_surf_deferred_base") - .additional_info("eevee_light_data") - .additional_info("eevee_lightprobe_data") - .additional_info("eevee_shadow_data"); +FRAGMENT_SOURCE("eevee_surf_hybrid_frag.glsl") +ADDITIONAL_INFO(eevee_surf_deferred_base) +ADDITIONAL_INFO(eevee_light_data) +ADDITIONAL_INFO(eevee_lightprobe_data) +ADDITIONAL_INFO(eevee_shadow_data) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surf_forward) - .define("MAT_FORWARD") - /* Early fragment test is needed for render passes support for forward surfaces. */ - /* NOTE: This removes the possibility of using gl_FragDepth. */ - .early_fragment_test(true) - .fragment_out(0, Type::VEC4, "out_radiance", DualBlend::SRC_0) - .fragment_out(0, Type::VEC4, "out_transmittance", DualBlend::SRC_1) - .fragment_source("eevee_surf_forward_frag.glsl") - /* Optionally added depending on the material. */ - // .additional_info("eevee_render_pass_out") - // .additional_info("eevee_cryptomatte_out") - .additional_info("eevee_global_ubo") - .additional_info("eevee_light_data") - .additional_info("eevee_lightprobe_data") - .additional_info("eevee_utility_texture") - .additional_info("eevee_sampling_data") - .additional_info("eevee_shadow_data") - .additional_info("eevee_hiz_data") - .additional_info("eevee_volume_lib"); +DEFINE("MAT_FORWARD") +/* Early fragment test is needed for render passes support for forward surfaces. */ +/* NOTE: This removes the possibility of using gl_FragDepth. */ +EARLY_FRAGMENT_TEST(true) +FRAGMENT_OUT_DUAL(0, VEC4, out_radiance, SRC_0) +FRAGMENT_OUT_DUAL(0, VEC4, out_transmittance, SRC_1) +FRAGMENT_SOURCE("eevee_surf_forward_frag.glsl") +/* Optionally added depending on the material. */ +// ADDITIONAL_INFO(eevee_render_pass_out) +// ADDITIONAL_INFO(eevee_cryptomatte_out) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_light_data) +ADDITIONAL_INFO(eevee_lightprobe_data) +ADDITIONAL_INFO(eevee_utility_texture) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_shadow_data) +ADDITIONAL_INFO(eevee_hiz_data) +ADDITIONAL_INFO(eevee_volume_lib) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surf_capture) - .define("MAT_CAPTURE") - .storage_buf(SURFEL_BUF_SLOT, Qualifier::WRITE, "Surfel", "surfel_buf[]") - .storage_buf(CAPTURE_BUF_SLOT, Qualifier::READ_WRITE, "CaptureInfoData", "capture_info_buf") - .push_constant(Type::BOOL, "is_double_sided") - .fragment_source("eevee_surf_capture_frag.glsl") - .additional_info("eevee_global_ubo") - .additional_info("eevee_utility_texture"); +DEFINE("MAT_CAPTURE") +STORAGE_BUF(SURFEL_BUF_SLOT, WRITE, Surfel, surfel_buf[]) +STORAGE_BUF(CAPTURE_BUF_SLOT, READ_WRITE, CaptureInfoData, capture_info_buf) +PUSH_CONSTANT(BOOL, is_double_sided) +FRAGMENT_SOURCE("eevee_surf_capture_frag.glsl") +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_utility_texture) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surf_depth) - .define("MAT_DEPTH") - .fragment_source("eevee_surf_depth_frag.glsl") - .additional_info("eevee_global_ubo") - .additional_info("eevee_sampling_data") - .additional_info("eevee_utility_texture"); +DEFINE("MAT_DEPTH") +FRAGMENT_SOURCE("eevee_surf_depth_frag.glsl") +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_utility_texture) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surf_world) - .push_constant(Type::FLOAT, "world_opacity_fade") - .push_constant(Type::FLOAT, "world_background_blur") - .push_constant(Type::IVEC4, "world_coord_packed") - .early_fragment_test(true) - .fragment_out(0, Type::VEC4, "out_background") - .fragment_source("eevee_surf_world_frag.glsl") - .additional_info("eevee_global_ubo") - .additional_info("eevee_lightprobe_sphere_data") - .additional_info("eevee_volume_probe_data") - .additional_info("eevee_sampling_data") - /* Optionally added depending on the material. */ - // .additional_info("eevee_render_pass_out") - // .additional_info("eevee_cryptomatte_out") - .additional_info("eevee_utility_texture"); +PUSH_CONSTANT(FLOAT, world_opacity_fade) +PUSH_CONSTANT(FLOAT, world_background_blur) +PUSH_CONSTANT(IVEC4, world_coord_packed) +EARLY_FRAGMENT_TEST(true) +FRAGMENT_OUT(0, VEC4, out_background) +FRAGMENT_SOURCE("eevee_surf_world_frag.glsl") +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_lightprobe_sphere_data) +ADDITIONAL_INFO(eevee_volume_probe_data) +ADDITIONAL_INFO(eevee_sampling_data) +/* Optionally added depending on the material. */ +// ADDITIONAL_INFO(eevee_render_pass_out) +// ADDITIONAL_INFO(eevee_cryptomatte_out) +ADDITIONAL_INFO(eevee_utility_texture) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_renderpass_clear) - .fragment_out(0, Type::VEC4, "out_background") - .fragment_source("eevee_renderpass_clear_frag.glsl") - .additional_info("draw_fullscreen") - .additional_info("eevee_global_ubo") - .additional_info("eevee_render_pass_out") - .additional_info("eevee_cryptomatte_out") - .additional_info("eevee_shared") - .do_static_compilation(true); +FRAGMENT_OUT(0, VEC4, out_background) +FRAGMENT_SOURCE("eevee_renderpass_clear_frag.glsl") +ADDITIONAL_INFO(draw_fullscreen) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_render_pass_out) +ADDITIONAL_INFO(eevee_cryptomatte_out) +ADDITIONAL_INFO(eevee_shared) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_shadow_atomic_iface, shadow_iface) - .flat(Type::INT, "shadow_view_id"); +FLAT(INT, shadow_view_id) +GPU_SHADER_INTERFACE_END() GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_shadow_clipping_iface, shadow_clip) - .smooth(Type::VEC3, "position") - .smooth(Type::VEC3, "vector"); +SMOOTH(VEC3, position) +SMOOTH(VEC3, vector) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(eevee_surf_shadow) - .define("DRW_VIEW_LEN", STRINGIFY(SHADOW_VIEW_MAX)) - .define("MAT_SHADOW") - .builtins(BuiltinBits::VIEWPORT_INDEX) - .vertex_out(eevee_surf_shadow_clipping_iface) - .storage_buf(SHADOW_RENDER_VIEW_BUF_SLOT, - Qualifier::READ, - "ShadowRenderView", - "render_view_buf[SHADOW_VIEW_MAX]") - .fragment_source("eevee_surf_shadow_frag.glsl") - .additional_info("eevee_global_ubo") - .additional_info("eevee_utility_texture") - .additional_info("eevee_sampling_data"); +DEFINE_VALUE("DRW_VIEW_LEN", STRINGIFY(SHADOW_VIEW_MAX)) +DEFINE("MAT_SHADOW") +BUILTINS(BuiltinBits::VIEWPORT_INDEX) +VERTEX_OUT(eevee_surf_shadow_clipping_iface) +STORAGE_BUF(SHADOW_RENDER_VIEW_BUF_SLOT, READ, ShadowRenderView, render_view_buf[SHADOW_VIEW_MAX]) +FRAGMENT_SOURCE("eevee_surf_shadow_frag.glsl") +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_utility_texture) +ADDITIONAL_INFO(eevee_sampling_data) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surf_shadow_atomic) - .additional_info("eevee_surf_shadow") - .define("SHADOW_UPDATE_ATOMIC_RASTER") - .builtins(BuiltinBits::TEXTURE_ATOMIC) - .vertex_out(eevee_surf_shadow_atomic_iface) - .storage_buf(SHADOW_RENDER_MAP_BUF_SLOT, - Qualifier::READ, - "uint", - "render_map_buf[SHADOW_RENDER_MAP_SIZE]") - .image(SHADOW_ATLAS_IMG_SLOT, - GPU_R32UI, - Qualifier::READ_WRITE, - ImageType::UINT_2D_ARRAY_ATOMIC, - "shadow_atlas_img"); +ADDITIONAL_INFO(eevee_surf_shadow) +DEFINE("SHADOW_UPDATE_ATOMIC_RASTER") +BUILTINS(BuiltinBits::TEXTURE_ATOMIC) +VERTEX_OUT(eevee_surf_shadow_atomic_iface) +STORAGE_BUF(SHADOW_RENDER_MAP_BUF_SLOT, READ, uint, render_map_buf[SHADOW_RENDER_MAP_SIZE]) +IMAGE(SHADOW_ATLAS_IMG_SLOT, GPU_R32UI, READ_WRITE, UINT_2D_ARRAY_ATOMIC, shadow_atlas_img) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surf_shadow_tbdr) - .additional_info("eevee_surf_shadow") - .define("SHADOW_UPDATE_TBDR") - .builtins(BuiltinBits::LAYER) - /* Use greater depth write to avoid loosing the early Z depth test but ensure correct fragment - * ordering after slope bias. */ - .depth_write(DepthWrite::GREATER) - /* F32 color attachment for on-tile depth accumulation without atomics. */ - .fragment_out(0, Type::FLOAT, "out_depth", DualBlend::NONE, SHADOW_ROG_ID); +ADDITIONAL_INFO(eevee_surf_shadow) +DEFINE("SHADOW_UPDATE_TBDR") +BUILTINS(BuiltinBits::LAYER) +/* Use greater depth write to avoid loosing the early Z depth test but ensure correct fragment + * ordering after slope bias. */ +DEPTH_WRITE(DepthWrite::GREATER) +/* F32 color attachment for on-tile depth accumulation without atomics. */ +FRAGMENT_OUT_ROG(0, FLOAT, out_depth, SHADOW_ROG_ID) +GPU_SHADER_CREATE_END() #undef image_out #undef image_array_out @@ -309,67 +331,39 @@ GPU_SHADER_CREATE_INFO(eevee_surf_shadow_tbdr) * \{ */ GPU_SHADER_CREATE_INFO(eevee_surf_volume) - .define("MAT_VOLUME") - /* Only the front fragments have to be invoked. */ - .early_fragment_test(true) - .image(VOLUME_PROP_SCATTERING_IMG_SLOT, - GPU_R11F_G11F_B10F, - Qualifier::READ_WRITE, - ImageType::FLOAT_3D, - "out_scattering_img") - .image(VOLUME_PROP_EXTINCTION_IMG_SLOT, - GPU_R11F_G11F_B10F, - Qualifier::READ_WRITE, - ImageType::FLOAT_3D, - "out_extinction_img") - .image(VOLUME_PROP_EMISSION_IMG_SLOT, - GPU_R11F_G11F_B10F, - Qualifier::READ_WRITE, - ImageType::FLOAT_3D, - "out_emissive_img") - .image(VOLUME_PROP_PHASE_IMG_SLOT, - GPU_R16F, - Qualifier::READ_WRITE, - ImageType::FLOAT_3D, - "out_phase_img") - .image(VOLUME_PROP_PHASE_WEIGHT_IMG_SLOT, - GPU_R16F, - Qualifier::READ_WRITE, - ImageType::FLOAT_3D, - "out_phase_weight_img") - .image(VOLUME_OCCUPANCY_SLOT, - GPU_R32UI, - Qualifier::READ, - ImageType::UINT_3D_ATOMIC, - "occupancy_img") - .fragment_source("eevee_surf_volume_frag.glsl") - .additional_info("draw_modelmat_new_common") - .additional_info("draw_view") - .additional_info("eevee_shared") - .additional_info("eevee_global_ubo") - .additional_info("eevee_sampling_data") - .additional_info("eevee_utility_texture"); +DEFINE("MAT_VOLUME") +/* Only the front fragments have to be invoked. */ +EARLY_FRAGMENT_TEST(true) +IMAGE( + VOLUME_PROP_SCATTERING_IMG_SLOT, GPU_R11F_G11F_B10F, READ_WRITE, FLOAT_3D, out_scattering_img) +IMAGE( + VOLUME_PROP_EXTINCTION_IMG_SLOT, GPU_R11F_G11F_B10F, READ_WRITE, FLOAT_3D, out_extinction_img) +IMAGE(VOLUME_PROP_EMISSION_IMG_SLOT, GPU_R11F_G11F_B10F, READ_WRITE, FLOAT_3D, out_emissive_img) +IMAGE(VOLUME_PROP_PHASE_IMG_SLOT, GPU_R16F, READ_WRITE, FLOAT_3D, out_phase_img) +IMAGE(VOLUME_PROP_PHASE_WEIGHT_IMG_SLOT, GPU_R16F, READ_WRITE, FLOAT_3D, out_phase_weight_img) +IMAGE(VOLUME_OCCUPANCY_SLOT, GPU_R32UI, READ, UINT_3D_ATOMIC, occupancy_img) +FRAGMENT_SOURCE("eevee_surf_volume_frag.glsl") +ADDITIONAL_INFO(draw_modelmat_new_common) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_utility_texture) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surf_occupancy) - .define("MAT_OCCUPANCY") - /* All fragments need to be invoked even if we write to the depth buffer. */ - .early_fragment_test(false) - .builtins(BuiltinBits::TEXTURE_ATOMIC) - .push_constant(Type::BOOL, "use_fast_method") - .image(VOLUME_HIT_DEPTH_SLOT, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_3D, "hit_depth_img") - .image(VOLUME_HIT_COUNT_SLOT, - GPU_R32UI, - Qualifier::READ_WRITE, - ImageType::UINT_2D_ATOMIC, - "hit_count_img") - .image(VOLUME_OCCUPANCY_SLOT, - GPU_R32UI, - Qualifier::READ_WRITE, - ImageType::UINT_3D_ATOMIC, - "occupancy_img") - .fragment_source("eevee_surf_occupancy_frag.glsl") - .additional_info("eevee_global_ubo") - .additional_info("eevee_sampling_data"); +DEFINE("MAT_OCCUPANCY") +/* All fragments need to be invoked even if we write to the depth buffer. */ +EARLY_FRAGMENT_TEST(false) +BUILTINS(BuiltinBits::TEXTURE_ATOMIC) +PUSH_CONSTANT(BOOL, use_fast_method) +IMAGE(VOLUME_HIT_DEPTH_SLOT, GPU_R32F, WRITE, FLOAT_3D, hit_depth_img) +IMAGE(VOLUME_HIT_COUNT_SLOT, GPU_R32UI, READ_WRITE, UINT_2D_ATOMIC, hit_count_img) +IMAGE(VOLUME_OCCUPANCY_SLOT, GPU_R32UI, READ_WRITE, UINT_3D_ATOMIC, occupancy_img) +FRAGMENT_SOURCE("eevee_surf_occupancy_frag.glsl") +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_sampling_data) +GPU_SHADER_CREATE_END() /** \} */ @@ -383,9 +377,10 @@ GPU_SHADER_CREATE_INFO(eevee_surf_occupancy) /* Stub functions defined by the material evaluation. */ GPU_SHADER_CREATE_INFO(eevee_material_stub) - .define("EEVEE_MATERIAL_STUBS") - /* Dummy uniform buffer to detect overlap with material node-tree. */ - .uniform_buf(0, "int", "node_tree"); +DEFINE("EEVEE_MATERIAL_STUBS") +/* Dummy uniform buffer to detect overlap with material node-tree. */ +UNIFORM_BUF(0, int, node_tree) +GPU_SHADER_CREATE_END() # define EEVEE_MAT_FINAL_VARIATION(name, ...) \ GPU_SHADER_CREATE_INFO(name).additional_info(__VA_ARGS__).do_static_compilation(true); diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_motion_blur_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_motion_blur_info.hh index e5f53a5bdaa..abccab4170c 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_motion_blur_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_motion_blur_info.hh @@ -6,47 +6,52 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(eevee_motion_blur_tiles_flatten) - .local_group_size(MOTION_BLUR_GROUP_SIZE, MOTION_BLUR_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("draw_view") - .additional_info("eevee_velocity_camera") - .uniform_buf(6, "MotionBlurData", "motion_blur_buf") - .sampler(0, ImageType::DEPTH_2D, "depth_tx") - .image(1, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_tiles_img") - .compute_source("eevee_motion_blur_flatten_comp.glsl"); +LOCAL_GROUP_SIZE(MOTION_BLUR_GROUP_SIZE, MOTION_BLUR_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_velocity_camera) +UNIFORM_BUF(6, MotionBlurData, motion_blur_buf) +SAMPLER(0, DEPTH_2D, depth_tx) +IMAGE(1, GPU_RGBA16F, WRITE, FLOAT_2D, out_tiles_img) +COMPUTE_SOURCE("eevee_motion_blur_flatten_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_motion_blur_tiles_flatten_rg) - .do_static_compilation(true) - .define("FLATTEN_RG") - .image(0, GPU_RG16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "velocity_img") - .additional_info("eevee_motion_blur_tiles_flatten"); +DO_STATIC_COMPILATION() +DEFINE("FLATTEN_RG") +IMAGE(0, GPU_RG16F, READ_WRITE, FLOAT_2D, velocity_img) +ADDITIONAL_INFO(eevee_motion_blur_tiles_flatten) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_motion_blur_tiles_flatten_rgba) - .do_static_compilation(true) - .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "velocity_img") - .additional_info("eevee_motion_blur_tiles_flatten"); +DO_STATIC_COMPILATION() +IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, velocity_img) +ADDITIONAL_INFO(eevee_motion_blur_tiles_flatten) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_motion_blur_tiles_dilate) - .do_static_compilation(true) - .local_group_size(MOTION_BLUR_GROUP_SIZE, MOTION_BLUR_GROUP_SIZE) - .additional_info("eevee_shared") - /* NOTE: See MotionBlurTileIndirection. */ - .storage_buf(0, Qualifier::READ_WRITE, "uint", "tile_indirection_buf[]") - .image(1, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "in_tiles_img") - .compute_source("eevee_motion_blur_dilate_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(MOTION_BLUR_GROUP_SIZE, MOTION_BLUR_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +/* NOTE: See MotionBlurTileIndirection. */ +STORAGE_BUF(0, READ_WRITE, uint, tile_indirection_buf[]) +IMAGE(1, GPU_RGBA16F, READ, FLOAT_2D, in_tiles_img) +COMPUTE_SOURCE("eevee_motion_blur_dilate_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_motion_blur_gather) - .do_static_compilation(true) - .local_group_size(MOTION_BLUR_GROUP_SIZE, MOTION_BLUR_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("draw_view") - .additional_info("eevee_sampling_data") - .uniform_buf(6, "MotionBlurData", "motion_blur_buf") - .sampler(0, ImageType::DEPTH_2D, "depth_tx") - .sampler(1, ImageType::FLOAT_2D, "velocity_tx") - .sampler(2, ImageType::FLOAT_2D, "in_color_tx") - /* NOTE: See MotionBlurTileIndirection. */ - .storage_buf(0, Qualifier::READ, "uint", "tile_indirection_buf[]") - .image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "in_tiles_img") - .image(1, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img") - .compute_source("eevee_motion_blur_gather_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(MOTION_BLUR_GROUP_SIZE, MOTION_BLUR_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_sampling_data) +UNIFORM_BUF(6, MotionBlurData, motion_blur_buf) +SAMPLER(0, DEPTH_2D, depth_tx) +SAMPLER(1, FLOAT_2D, velocity_tx) +SAMPLER(2, FLOAT_2D, in_color_tx) +/* NOTE: See MotionBlurTileIndirection. */ +STORAGE_BUF(0, READ, uint, tile_indirection_buf[]) +IMAGE(0, GPU_RGBA16F, READ, FLOAT_2D, in_tiles_img) +IMAGE(1, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_img) +COMPUTE_SOURCE("eevee_motion_blur_gather_comp.glsl") +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_shadow_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_shadow_info.hh index 4d3826daca6..8f002876f89 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_shadow_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_shadow_info.hh @@ -13,266 +13,284 @@ /* NOTE(Metal): As this is implemented using a fundamental data type, this needs to be specified * explicitly as uint for code generation, as the MSLShaderGenerator needs to be able to * distinguish between classes and fundamental types during code generation. */ -#define SHADOW_TILE_DATA_PACKED "uint" -#define SHADOW_PAGE_PACKED "uint" +#define SHADOW_TILE_DATA_PACKED uint +#define SHADOW_PAGE_PACKED uint GPU_SHADER_CREATE_INFO(eevee_shadow_clipmap_clear) - .do_static_compilation(true) - .local_group_size(SHADOW_CLIPMAP_GROUP_SIZE) - .storage_buf(0, Qualifier::WRITE, "ShadowTileMapClip", "tilemaps_clip_buf[]") - .push_constant(Type::INT, "tilemaps_clip_buf_len") - .additional_info("eevee_shared") - .compute_source("eevee_shadow_clipmap_clear_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(SHADOW_CLIPMAP_GROUP_SIZE) +STORAGE_BUF(0, WRITE, ShadowTileMapClip, tilemaps_clip_buf[]) +PUSH_CONSTANT(INT, tilemaps_clip_buf_len) +ADDITIONAL_INFO(eevee_shared) +COMPUTE_SOURCE("eevee_shadow_clipmap_clear_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_tilemap_bounds) - .do_static_compilation(true) - .local_group_size(SHADOW_BOUNDS_GROUP_SIZE) - .storage_buf(LIGHT_BUF_SLOT, Qualifier::READ_WRITE, "LightData", "light_buf[]") - .storage_buf(LIGHT_CULL_BUF_SLOT, Qualifier::READ, "LightCullingData", "light_cull_buf") - .storage_buf(4, Qualifier::READ, "uint", "casters_id_buf[]") - .storage_buf(5, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(6, Qualifier::READ, "ObjectBounds", "bounds_buf[]") - .storage_buf(7, Qualifier::READ_WRITE, "ShadowTileMapClip", "tilemaps_clip_buf[]") - .push_constant(Type::INT, "resource_len") - .typedef_source("draw_shader_shared.hh") - .additional_info("eevee_shared") - .compute_source("eevee_shadow_tilemap_bounds_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(SHADOW_BOUNDS_GROUP_SIZE) +STORAGE_BUF(LIGHT_BUF_SLOT, READ_WRITE, LightData, light_buf[]) +STORAGE_BUF(LIGHT_CULL_BUF_SLOT, READ, LightCullingData, light_cull_buf) +STORAGE_BUF(4, READ, uint, casters_id_buf[]) +STORAGE_BUF(5, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) +STORAGE_BUF(6, READ, ObjectBounds, bounds_buf[]) +STORAGE_BUF(7, READ_WRITE, ShadowTileMapClip, tilemaps_clip_buf[]) +PUSH_CONSTANT(INT, resource_len) +TYPEDEF_SOURCE("draw_shader_shared.hh") +ADDITIONAL_INFO(eevee_shared) +COMPUTE_SOURCE("eevee_shadow_tilemap_bounds_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_tilemap_init) - .do_static_compilation(true) - .local_group_size(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) - .storage_buf(0, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(1, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") - .storage_buf(2, Qualifier::READ_WRITE, "ShadowTileMapClip", "tilemaps_clip_buf[]") - .storage_buf(4, Qualifier::READ_WRITE, "uvec2", "pages_cached_buf[]") - .additional_info("eevee_shared") - .compute_source("eevee_shadow_tilemap_init_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) +STORAGE_BUF(0, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) +STORAGE_BUF(1, READ_WRITE, SHADOW_TILE_DATA_PACKED, tiles_buf[]) +STORAGE_BUF(2, READ_WRITE, ShadowTileMapClip, tilemaps_clip_buf[]) +STORAGE_BUF(4, READ_WRITE, uvec2, pages_cached_buf[]) +ADDITIONAL_INFO(eevee_shared) +COMPUTE_SOURCE("eevee_shadow_tilemap_init_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_tag_update) - .do_static_compilation(true) - .local_group_size(1, 1, 1) - .storage_buf(0, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(1, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") - .storage_buf(5, Qualifier::READ, "ObjectBounds", "bounds_buf[]") - .storage_buf(6, Qualifier::READ, "uint", "resource_ids_buf[]") - .additional_info("eevee_shared") - .additional_info("draw_view") - .additional_info("draw_view_culling") - .compute_source("eevee_shadow_tag_update_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(1, 1, 1) +STORAGE_BUF(0, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) +STORAGE_BUF(1, READ_WRITE, SHADOW_TILE_DATA_PACKED, tiles_buf[]) +STORAGE_BUF(5, READ, ObjectBounds, bounds_buf[]) +STORAGE_BUF(6, READ, uint, resource_ids_buf[]) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_view_culling) +COMPUTE_SOURCE("eevee_shadow_tag_update_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_tag_usage_opaque) - .do_static_compilation(true) - .local_group_size(SHADOW_DEPTH_SCAN_GROUP_SIZE, SHADOW_DEPTH_SCAN_GROUP_SIZE) - .storage_buf(5, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(6, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") - .push_constant(Type::IVEC2, "input_depth_extent") - .additional_info( - "eevee_shared", "draw_view", "draw_view_culling", "eevee_hiz_data", "eevee_light_data") - .compute_source("eevee_shadow_tag_usage_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(SHADOW_DEPTH_SCAN_GROUP_SIZE, SHADOW_DEPTH_SCAN_GROUP_SIZE) +STORAGE_BUF(5, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) +STORAGE_BUF(6, READ_WRITE, SHADOW_TILE_DATA_PACKED, tiles_buf[]) +PUSH_CONSTANT(IVEC2, input_depth_extent) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_view_culling) +ADDITIONAL_INFO(eevee_hiz_data) +ADDITIONAL_INFO(eevee_light_data) +COMPUTE_SOURCE("eevee_shadow_tag_usage_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_tag_usage_surfels) - .do_static_compilation(true) - .local_group_size(SURFEL_GROUP_SIZE) - .storage_buf(6, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(7, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") - .push_constant(Type::INT, "directional_level") - .additional_info("eevee_shared") - .additional_info("draw_view") - .additional_info("draw_view_culling") - .additional_info("eevee_light_data") - .additional_info("eevee_global_ubo") - .additional_info("eevee_surfel_common") - .compute_source("eevee_shadow_tag_usage_surfels_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(SURFEL_GROUP_SIZE) +STORAGE_BUF(6, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) +STORAGE_BUF(7, READ_WRITE, SHADOW_TILE_DATA_PACKED, tiles_buf[]) +PUSH_CONSTANT(INT, directional_level) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_view_culling) +ADDITIONAL_INFO(eevee_light_data) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_surfel_common) +COMPUTE_SOURCE("eevee_shadow_tag_usage_surfels_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_NAMED_INTERFACE_INFO(eevee_shadow_tag_transparent_iface, interp) - .smooth(Type::VEC3, "P") - .smooth(Type::VEC3, "vP"); +SMOOTH(VEC3, P) +SMOOTH(VEC3, vP) +GPU_SHADER_INTERFACE_END() GPU_SHADER_NAMED_INTERFACE_INFO(eevee_shadow_tag_transparent_flat_iface, interp_flat) - .flat(Type::VEC3, "ls_aabb_min") - .flat(Type::VEC3, "ls_aabb_max"); +FLAT(VEC3, ls_aabb_min) +FLAT(VEC3, ls_aabb_max) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_tag_usage_transparent) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .storage_buf(4, Qualifier::READ, "ObjectBounds", "bounds_buf[]") - .storage_buf(5, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(6, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") - .push_constant(Type::IVEC2, "fb_resolution") - .push_constant(Type::INT, "fb_lod") - .vertex_out(eevee_shadow_tag_transparent_iface) - .vertex_out(eevee_shadow_tag_transparent_flat_iface) - .additional_info("eevee_shared") - .additional_info("draw_resource_id_varying") - .additional_info("draw_view") - .additional_info("draw_view_culling") - .additional_info("draw_modelmat_new") - .additional_info("eevee_hiz_data") - .additional_info("eevee_light_data") - .vertex_source("eevee_shadow_tag_usage_vert.glsl") - .fragment_source("eevee_shadow_tag_usage_frag.glsl"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +STORAGE_BUF(4, READ, ObjectBounds, bounds_buf[]) +STORAGE_BUF(5, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) +STORAGE_BUF(6, READ_WRITE, SHADOW_TILE_DATA_PACKED, tiles_buf[]) +PUSH_CONSTANT(IVEC2, fb_resolution) +PUSH_CONSTANT(INT, fb_lod) +VERTEX_OUT(eevee_shadow_tag_transparent_iface) +VERTEX_OUT(eevee_shadow_tag_transparent_flat_iface) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_resource_id_varying) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_view_culling) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(eevee_hiz_data) +ADDITIONAL_INFO(eevee_light_data) +VERTEX_SOURCE("eevee_shadow_tag_usage_vert.glsl") +FRAGMENT_SOURCE("eevee_shadow_tag_usage_frag.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_tag_usage_volume) - .do_static_compilation(true) - .local_group_size(VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE) - .storage_buf(4, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(5, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") - .additional_info("eevee_volume_properties_data") - .additional_info("eevee_shared") - .additional_info("draw_view") - .additional_info("draw_view_culling") - .additional_info("eevee_hiz_data") - .additional_info("eevee_light_data") - .additional_info("eevee_sampling_data") - .compute_source("eevee_shadow_tag_usage_volume_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE) +STORAGE_BUF(4, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) +STORAGE_BUF(5, READ_WRITE, SHADOW_TILE_DATA_PACKED, tiles_buf[]) +ADDITIONAL_INFO(eevee_volume_properties_data) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_view_culling) +ADDITIONAL_INFO(eevee_hiz_data) +ADDITIONAL_INFO(eevee_light_data) +ADDITIONAL_INFO(eevee_sampling_data) +COMPUTE_SOURCE("eevee_shadow_tag_usage_volume_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_page_mask) - .do_static_compilation(true) - .local_group_size(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) - .push_constant(Type::INT, "max_view_per_tilemap") - .storage_buf(0, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(1, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") - .additional_info("eevee_shared") - .compute_source("eevee_shadow_page_mask_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) +PUSH_CONSTANT(INT, max_view_per_tilemap) +STORAGE_BUF(0, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) +STORAGE_BUF(1, READ_WRITE, SHADOW_TILE_DATA_PACKED, tiles_buf[]) +ADDITIONAL_INFO(eevee_shared) +COMPUTE_SOURCE("eevee_shadow_page_mask_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_page_free) - .do_static_compilation(true) - .local_group_size(SHADOW_TILEMAP_LOD0_LEN) - .storage_buf(0, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(1, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") - .storage_buf(2, Qualifier::READ_WRITE, "ShadowPagesInfoData", "pages_infos_buf") - .storage_buf(3, Qualifier::READ_WRITE, "uint", "pages_free_buf[]") - .storage_buf(4, Qualifier::READ_WRITE, "uvec2", "pages_cached_buf[]") - .additional_info("eevee_shared") - .compute_source("eevee_shadow_page_free_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(SHADOW_TILEMAP_LOD0_LEN) +STORAGE_BUF(0, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) +STORAGE_BUF(1, READ_WRITE, SHADOW_TILE_DATA_PACKED, tiles_buf[]) +STORAGE_BUF(2, READ_WRITE, ShadowPagesInfoData, pages_infos_buf) +STORAGE_BUF(3, READ_WRITE, uint, pages_free_buf[]) +STORAGE_BUF(4, READ_WRITE, uvec2, pages_cached_buf[]) +ADDITIONAL_INFO(eevee_shared) +COMPUTE_SOURCE("eevee_shadow_page_free_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_page_defrag) - .do_static_compilation(true) - .local_group_size(1) - .typedef_source("draw_shader_shared.hh") - .storage_buf(1, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") - .storage_buf(2, Qualifier::READ_WRITE, "ShadowPagesInfoData", "pages_infos_buf") - .storage_buf(3, Qualifier::READ_WRITE, "uint", "pages_free_buf[]") - .storage_buf(4, Qualifier::READ_WRITE, "uvec2", "pages_cached_buf[]") - .storage_buf(5, Qualifier::WRITE, "DispatchCommand", "clear_dispatch_buf") - .storage_buf(6, Qualifier::WRITE, "DrawCommand", "tile_draw_buf") - .storage_buf(7, Qualifier::READ_WRITE, "ShadowStatistics", "statistics_buf") - .additional_info("eevee_shared") - .compute_source("eevee_shadow_page_defrag_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(1) +TYPEDEF_SOURCE("draw_shader_shared.hh") +STORAGE_BUF(1, READ_WRITE, SHADOW_TILE_DATA_PACKED, tiles_buf[]) +STORAGE_BUF(2, READ_WRITE, ShadowPagesInfoData, pages_infos_buf) +STORAGE_BUF(3, READ_WRITE, uint, pages_free_buf[]) +STORAGE_BUF(4, READ_WRITE, uvec2, pages_cached_buf[]) +STORAGE_BUF(5, WRITE, DispatchCommand, clear_dispatch_buf) +STORAGE_BUF(6, WRITE, DrawCommand, tile_draw_buf) +STORAGE_BUF(7, READ_WRITE, ShadowStatistics, statistics_buf) +ADDITIONAL_INFO(eevee_shared) +COMPUTE_SOURCE("eevee_shadow_page_defrag_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_page_allocate) - .do_static_compilation(true) - .local_group_size(SHADOW_TILEMAP_LOD0_LEN) - .typedef_source("draw_shader_shared.hh") - .storage_buf(0, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(1, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") - .storage_buf(2, Qualifier::READ_WRITE, "ShadowPagesInfoData", "pages_infos_buf") - .storage_buf(3, Qualifier::READ_WRITE, "uint", "pages_free_buf[]") - .storage_buf(4, Qualifier::READ_WRITE, "uvec2", "pages_cached_buf[]") - .storage_buf(6, Qualifier::READ_WRITE, "ShadowStatistics", "statistics_buf") - .additional_info("eevee_shared") - .compute_source("eevee_shadow_page_allocate_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(SHADOW_TILEMAP_LOD0_LEN) +TYPEDEF_SOURCE("draw_shader_shared.hh") +STORAGE_BUF(0, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) +STORAGE_BUF(1, READ_WRITE, SHADOW_TILE_DATA_PACKED, tiles_buf[]) +STORAGE_BUF(2, READ_WRITE, ShadowPagesInfoData, pages_infos_buf) +STORAGE_BUF(3, READ_WRITE, uint, pages_free_buf[]) +STORAGE_BUF(4, READ_WRITE, uvec2, pages_cached_buf[]) +STORAGE_BUF(6, READ_WRITE, ShadowStatistics, statistics_buf) +ADDITIONAL_INFO(eevee_shared) +COMPUTE_SOURCE("eevee_shadow_page_allocate_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_tilemap_finalize) - .do_static_compilation(true) - .typedef_source("draw_shader_shared.hh") - .local_group_size(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) - .storage_buf(0, Qualifier::READ, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(1, Qualifier::READ, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") - .storage_buf(2, Qualifier::READ_WRITE, "ShadowPagesInfoData", "pages_infos_buf") - .storage_buf(3, Qualifier::READ_WRITE, "ShadowStatistics", "statistics_buf") - .storage_buf(4, Qualifier::WRITE, "ViewMatrices", "view_infos_buf[SHADOW_VIEW_MAX]") - .storage_buf(5, Qualifier::WRITE, "ShadowRenderView", "render_view_buf[SHADOW_VIEW_MAX]") - .storage_buf(6, Qualifier::READ, "ShadowTileMapClip", "tilemaps_clip_buf[]") - .image(0, GPU_R32UI, Qualifier::WRITE, ImageType::UINT_2D, "tilemaps_img") - .additional_info("eevee_shared") - .compute_source("eevee_shadow_tilemap_finalize_comp.glsl"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("draw_shader_shared.hh") +LOCAL_GROUP_SIZE(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) +STORAGE_BUF(0, READ, ShadowTileMapData, tilemaps_buf[]) +STORAGE_BUF(1, READ, SHADOW_TILE_DATA_PACKED, tiles_buf[]) +STORAGE_BUF(2, READ_WRITE, ShadowPagesInfoData, pages_infos_buf) +STORAGE_BUF(3, READ_WRITE, ShadowStatistics, statistics_buf) +STORAGE_BUF(4, WRITE, ViewMatrices, view_infos_buf[SHADOW_VIEW_MAX]) +STORAGE_BUF(5, WRITE, ShadowRenderView, render_view_buf[SHADOW_VIEW_MAX]) +STORAGE_BUF(6, READ, ShadowTileMapClip, tilemaps_clip_buf[]) +IMAGE(0, GPU_R32UI, WRITE, UINT_2D, tilemaps_img) +ADDITIONAL_INFO(eevee_shared) +COMPUTE_SOURCE("eevee_shadow_tilemap_finalize_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_tilemap_rendermap) - .do_static_compilation(true) - .typedef_source("draw_shader_shared.hh") - .local_group_size(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) - .storage_buf(0, Qualifier::READ_WRITE, "ShadowStatistics", "statistics_buf") - .storage_buf(1, Qualifier::READ, "ShadowRenderView", "render_view_buf[SHADOW_VIEW_MAX]") - .storage_buf(2, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") - .storage_buf(3, Qualifier::READ_WRITE, "DispatchCommand", "clear_dispatch_buf") - .storage_buf(4, Qualifier::READ_WRITE, "DrawCommand", "tile_draw_buf") - .storage_buf(5, Qualifier::WRITE, SHADOW_PAGE_PACKED, "dst_coord_buf[SHADOW_RENDER_MAP_SIZE]") - .storage_buf(6, Qualifier::WRITE, SHADOW_PAGE_PACKED, "src_coord_buf[SHADOW_RENDER_MAP_SIZE]") - .storage_buf(7, Qualifier::WRITE, SHADOW_PAGE_PACKED, "render_map_buf[SHADOW_RENDER_MAP_SIZE]") - .additional_info("eevee_shared") - .compute_source("eevee_shadow_tilemap_rendermap_comp.glsl"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("draw_shader_shared.hh") +LOCAL_GROUP_SIZE(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) +STORAGE_BUF(0, READ_WRITE, ShadowStatistics, statistics_buf) +STORAGE_BUF(1, READ, ShadowRenderView, render_view_buf[SHADOW_VIEW_MAX]) +STORAGE_BUF(2, READ_WRITE, SHADOW_TILE_DATA_PACKED, tiles_buf[]) +STORAGE_BUF(3, READ_WRITE, DispatchCommand, clear_dispatch_buf) +STORAGE_BUF(4, READ_WRITE, DrawCommand, tile_draw_buf) +STORAGE_BUF(5, WRITE, SHADOW_PAGE_PACKED, dst_coord_buf[SHADOW_RENDER_MAP_SIZE]) +STORAGE_BUF(6, WRITE, SHADOW_PAGE_PACKED, src_coord_buf[SHADOW_RENDER_MAP_SIZE]) +STORAGE_BUF(7, WRITE, SHADOW_PAGE_PACKED, render_map_buf[SHADOW_RENDER_MAP_SIZE]) +ADDITIONAL_INFO(eevee_shared) +COMPUTE_SOURCE("eevee_shadow_tilemap_rendermap_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_tilemap_amend) - .do_static_compilation(true) - .local_group_size(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) - .image(0, GPU_R32UI, Qualifier::READ_WRITE, ImageType::UINT_2D, "tilemaps_img") - .storage_buf(LIGHT_CULL_BUF_SLOT, Qualifier::READ, "LightCullingData", "light_cull_buf") - .storage_buf(LIGHT_BUF_SLOT, Qualifier::READ_WRITE, "LightData", "light_buf[]") - /* The call bind_resources(lights) also uses LIGHT_ZBIN_BUF_SLOT and LIGHT_TILE_BUF_SLOT. */ - .storage_buf(4, Qualifier::READ, "ShadowTileMapData", "tilemaps_buf[]") - .additional_info("eevee_shared") - .additional_info("draw_view") - .compute_source("eevee_shadow_tilemap_amend_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) +IMAGE(0, GPU_R32UI, READ_WRITE, UINT_2D, tilemaps_img) +STORAGE_BUF(LIGHT_CULL_BUF_SLOT, READ, LightCullingData, light_cull_buf) +STORAGE_BUF(LIGHT_BUF_SLOT, READ_WRITE, LightData, light_buf[]) +/* The call bind_resources(lights) also uses LIGHT_ZBIN_BUF_SLOT and LIGHT_TILE_BUF_SLOT. */ +STORAGE_BUF(4, READ, ShadowTileMapData, tilemaps_buf[]) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +COMPUTE_SOURCE("eevee_shadow_tilemap_amend_comp.glsl") +GPU_SHADER_CREATE_END() /* AtomicMin clear implementation. */ GPU_SHADER_CREATE_INFO(eevee_shadow_page_clear) - .do_static_compilation(true) - .local_group_size(SHADOW_PAGE_CLEAR_GROUP_SIZE, SHADOW_PAGE_CLEAR_GROUP_SIZE) - .storage_buf(2, Qualifier::READ, "ShadowPagesInfoData", "pages_infos_buf") - .storage_buf(6, Qualifier::READ, SHADOW_PAGE_PACKED, "dst_coord_buf[SHADOW_RENDER_MAP_SIZE]") - .additional_info("eevee_shared") - .compute_source("eevee_shadow_page_clear_comp.glsl") - .image(SHADOW_ATLAS_IMG_SLOT, - GPU_R32UI, - Qualifier::READ_WRITE, - ImageType::UINT_2D_ARRAY_ATOMIC, - "shadow_atlas_img"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(SHADOW_PAGE_CLEAR_GROUP_SIZE, SHADOW_PAGE_CLEAR_GROUP_SIZE) +STORAGE_BUF(2, READ, ShadowPagesInfoData, pages_infos_buf) +STORAGE_BUF(6, READ, SHADOW_PAGE_PACKED, dst_coord_buf[SHADOW_RENDER_MAP_SIZE]) +ADDITIONAL_INFO(eevee_shared) +COMPUTE_SOURCE("eevee_shadow_page_clear_comp.glsl") +IMAGE(SHADOW_ATLAS_IMG_SLOT, GPU_R32UI, READ_WRITE, UINT_2D_ARRAY_ATOMIC, shadow_atlas_img) +GPU_SHADER_CREATE_END() /* TBDR clear implementation. */ GPU_SHADER_CREATE_INFO(eevee_shadow_page_tile_clear) - .do_static_compilation(true) - .define("PASS_CLEAR") - .additional_info("eevee_shared") - .builtins(BuiltinBits::VIEWPORT_INDEX | BuiltinBits::LAYER) - .storage_buf(8, Qualifier::READ, SHADOW_PAGE_PACKED, "src_coord_buf[SHADOW_RENDER_MAP_SIZE]") - .vertex_source("eevee_shadow_page_tile_vert.glsl") - .fragment_source("eevee_shadow_page_tile_frag.glsl") - .fragment_out(0, Type::FLOAT, "out_tile_depth", DualBlend::NONE, SHADOW_ROG_ID); +DO_STATIC_COMPILATION() +DEFINE("PASS_CLEAR") +ADDITIONAL_INFO(eevee_shared) +BUILTINS(BuiltinBits::VIEWPORT_INDEX | BuiltinBits::LAYER) +STORAGE_BUF(8, READ, SHADOW_PAGE_PACKED, src_coord_buf[SHADOW_RENDER_MAP_SIZE]) +VERTEX_SOURCE("eevee_shadow_page_tile_vert.glsl") +FRAGMENT_SOURCE("eevee_shadow_page_tile_frag.glsl") +FRAGMENT_OUT_ROG(0, FLOAT, out_tile_depth, SHADOW_ROG_ID) +GPU_SHADER_CREATE_END() #ifdef APPLE /* Metal supports USHORT which saves a bit of performance here. */ -# define PAGE_Z_TYPE Type::USHORT +# define PAGE_Z_TYPE USHORT #else -# define PAGE_Z_TYPE Type::UINT +# define PAGE_Z_TYPE UINT #endif /* Interface for passing precalculated values in accumulation vertex to frag. */ GPU_SHADER_NAMED_INTERFACE_INFO(eevee_shadow_page_tile_store_noperspective_iface, interp_noperspective) - .no_perspective(Type::VEC2, "out_texel_xy"); +NO_PERSPECTIVE(VEC2, out_texel_xy) +GPU_SHADER_INTERFACE_END() + GPU_SHADER_NAMED_INTERFACE_INFO(eevee_shadow_page_tile_store_flat_iface, interp_flat) - .flat(PAGE_Z_TYPE, "out_page_z"); +FLAT(PAGE_Z_TYPE, out_page_z) +GPU_SHADER_INTERFACE_END() #undef PAGE_Z_TYPE /* 2nd tile pass to store shadow depths in atlas. */ GPU_SHADER_CREATE_INFO(eevee_shadow_page_tile_store) - .do_static_compilation(true) - .define("PASS_DEPTH_STORE") - .additional_info("eevee_shared") - .builtins(BuiltinBits::VIEWPORT_INDEX | BuiltinBits::LAYER) - .storage_buf(7, Qualifier::READ, SHADOW_PAGE_PACKED, "dst_coord_buf[SHADOW_RENDER_MAP_SIZE]") - .storage_buf(8, Qualifier::READ, SHADOW_PAGE_PACKED, "src_coord_buf[SHADOW_RENDER_MAP_SIZE]") - .subpass_in(0, Type::FLOAT, "in_tile_depth", SHADOW_ROG_ID) - .image(SHADOW_ATLAS_IMG_SLOT, - GPU_R32UI, - Qualifier::READ_WRITE, - ImageType::UINT_2D_ARRAY, - "shadow_atlas_img") - .vertex_out(eevee_shadow_page_tile_store_noperspective_iface) - .vertex_out(eevee_shadow_page_tile_store_flat_iface) - .vertex_source("eevee_shadow_page_tile_vert.glsl") - .fragment_source("eevee_shadow_page_tile_frag.glsl"); +DO_STATIC_COMPILATION() +DEFINE("PASS_DEPTH_STORE") +ADDITIONAL_INFO(eevee_shared) +BUILTINS(BuiltinBits::VIEWPORT_INDEX | BuiltinBits::LAYER) +STORAGE_BUF(7, READ, SHADOW_PAGE_PACKED, dst_coord_buf[SHADOW_RENDER_MAP_SIZE]) +STORAGE_BUF(8, READ, SHADOW_PAGE_PACKED, src_coord_buf[SHADOW_RENDER_MAP_SIZE]) +SUBPASS_IN(0, FLOAT, in_tile_depth, SHADOW_ROG_ID) +IMAGE(SHADOW_ATLAS_IMG_SLOT, GPU_R32UI, READ_WRITE, UINT_2D_ARRAY, shadow_atlas_img) +VERTEX_OUT(eevee_shadow_page_tile_store_noperspective_iface) +VERTEX_OUT(eevee_shadow_page_tile_store_flat_iface) +VERTEX_SOURCE("eevee_shadow_page_tile_vert.glsl") +FRAGMENT_SOURCE("eevee_shadow_page_tile_frag.glsl") +GPU_SHADER_CREATE_END() /** \} */ @@ -281,16 +299,18 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_page_tile_store) * \{ */ GPU_SHADER_CREATE_INFO(eevee_shadow_data) - /* SHADOW_READ_ATOMIC macro indicating shadow functions should use `usampler2DArrayAtomic` as - * the atlas type. */ - .define("SHADOW_READ_ATOMIC") - .builtins(BuiltinBits::TEXTURE_ATOMIC) - .sampler(SHADOW_ATLAS_TEX_SLOT, ImageType::UINT_2D_ARRAY_ATOMIC, "shadow_atlas_tx") - .sampler(SHADOW_TILEMAPS_TEX_SLOT, ImageType::UINT_2D, "shadow_tilemaps_tx"); +/* SHADOW_READ_ATOMIC macro indicating shadow functions should use `usampler2DArrayAtomic` as + * the atlas type. */ +DEFINE("SHADOW_READ_ATOMIC") +BUILTINS(BuiltinBits::TEXTURE_ATOMIC) +SAMPLER(SHADOW_ATLAS_TEX_SLOT, UINT_2D_ARRAY_ATOMIC, shadow_atlas_tx) +SAMPLER(SHADOW_TILEMAPS_TEX_SLOT, UINT_2D, shadow_tilemaps_tx) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_data_non_atomic) - .sampler(SHADOW_ATLAS_TEX_SLOT, ImageType::UINT_2D_ARRAY, "shadow_atlas_tx") - .sampler(SHADOW_TILEMAPS_TEX_SLOT, ImageType::UINT_2D, "shadow_tilemaps_tx"); +SAMPLER(SHADOW_ATLAS_TEX_SLOT, UINT_2D_ARRAY, shadow_atlas_tx) +SAMPLER(SHADOW_TILEMAPS_TEX_SLOT, UINT_2D, shadow_tilemaps_tx) +GPU_SHADER_CREATE_END() /** \} */ @@ -299,17 +319,21 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_data_non_atomic) * \{ */ GPU_SHADER_CREATE_INFO(eevee_shadow_debug) - .do_static_compilation(true) - .additional_info("eevee_shared") - .storage_buf(5, Qualifier::READ, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(6, Qualifier::READ, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") - .fragment_out(0, Type::VEC4, "out_color_add", DualBlend::SRC_0) - .fragment_out(0, Type::VEC4, "out_color_mul", DualBlend::SRC_1) - .push_constant(Type::INT, "debug_mode") - .push_constant(Type::INT, "debug_tilemap_index") - .depth_write(DepthWrite::ANY) - .fragment_source("eevee_shadow_debug_frag.glsl") - .additional_info( - "draw_fullscreen", "draw_view", "eevee_hiz_data", "eevee_light_data", "eevee_shadow_data"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(eevee_shared) +STORAGE_BUF(5, READ, ShadowTileMapData, tilemaps_buf[]) +STORAGE_BUF(6, READ, SHADOW_TILE_DATA_PACKED, tiles_buf[]) +FRAGMENT_OUT_DUAL(0, VEC4, out_color_add, SRC_0) +FRAGMENT_OUT_DUAL(0, VEC4, out_color_mul, SRC_1) +PUSH_CONSTANT(INT, debug_mode) +PUSH_CONSTANT(INT, debug_tilemap_index) +DEPTH_WRITE(DepthWrite::ANY) +FRAGMENT_SOURCE("eevee_shadow_debug_frag.glsl") +ADDITIONAL_INFO(draw_fullscreen) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_hiz_data) +ADDITIONAL_INFO(eevee_light_data) +ADDITIONAL_INFO(eevee_shadow_data) +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_subsurface_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_subsurface_info.hh index a6ea8f6b4e6..9cbf7912e55 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_subsurface_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_subsurface_info.hh @@ -6,37 +6,34 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(eevee_subsurface_setup) - .do_static_compilation(true) - .local_group_size(SUBSURFACE_GROUP_SIZE, SUBSURFACE_GROUP_SIZE) - .typedef_source("draw_shader_shared.hh") - .additional_info("draw_view") - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data") - .sampler(2, ImageType::DEPTH_2D, "depth_tx") - .image(0, DEFERRED_RADIANCE_FORMAT, Qualifier::READ, ImageType::UINT_2D, "direct_light_img") - .image(1, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "indirect_light_img") - .image(2, SUBSURFACE_OBJECT_ID_FORMAT, Qualifier::WRITE, ImageType::UINT_2D, "object_id_img") - .image(3, SUBSURFACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "radiance_img") - .storage_buf(0, Qualifier::WRITE, "uint", "convolve_tile_buf[]") - .storage_buf(1, Qualifier::READ_WRITE, "DispatchCommand", "convolve_dispatch_buf") - .compute_source("eevee_subsurface_setup_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(SUBSURFACE_GROUP_SIZE, SUBSURFACE_GROUP_SIZE) +TYPEDEF_SOURCE("draw_shader_shared.hh") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +SAMPLER(2, DEPTH_2D, depth_tx) +IMAGE(0, DEFERRED_RADIANCE_FORMAT, READ, UINT_2D, direct_light_img) +IMAGE(1, RAYTRACE_RADIANCE_FORMAT, READ, FLOAT_2D, indirect_light_img) +IMAGE(2, SUBSURFACE_OBJECT_ID_FORMAT, WRITE, UINT_2D, object_id_img) +IMAGE(3, SUBSURFACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, radiance_img) +STORAGE_BUF(0, WRITE, uint, convolve_tile_buf[]) +STORAGE_BUF(1, READ_WRITE, DispatchCommand, convolve_dispatch_buf) +COMPUTE_SOURCE("eevee_subsurface_setup_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_subsurface_convolve) - .do_static_compilation(true) - .local_group_size(SUBSURFACE_GROUP_SIZE, SUBSURFACE_GROUP_SIZE) - .additional_info("draw_view") - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data") - .additional_info("eevee_global_ubo") - .sampler(2, ImageType::FLOAT_2D, "radiance_tx") - .sampler(3, ImageType::DEPTH_2D, "depth_tx") - .sampler(4, ImageType::UINT_2D, "object_id_tx") - .storage_buf(0, Qualifier::READ, "uint", "tiles_coord_buf[]") - .image( - 0, DEFERRED_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::UINT_2D, "out_direct_light_img") - .image(1, - RAYTRACE_RADIANCE_FORMAT, - Qualifier::WRITE, - ImageType::FLOAT_2D, - "out_indirect_light_img") - .compute_source("eevee_subsurface_convolve_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(SUBSURFACE_GROUP_SIZE, SUBSURFACE_GROUP_SIZE) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(eevee_global_ubo) +SAMPLER(2, FLOAT_2D, radiance_tx) +SAMPLER(3, DEPTH_2D, depth_tx) +SAMPLER(4, UINT_2D, object_id_tx) +STORAGE_BUF(0, READ, uint, tiles_coord_buf[]) +IMAGE(0, DEFERRED_RADIANCE_FORMAT, WRITE, UINT_2D, out_direct_light_img) +IMAGE(1, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, out_indirect_light_img) +COMPUTE_SOURCE("eevee_subsurface_convolve_comp.glsl") +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_tracing_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_tracing_info.hh index ff8f1a26084..ff2a2acd6a7 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_tracing_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_tracing_info.hh @@ -15,250 +15,266 @@ image(slot, format, Qualifier::READ, type, name, Frequency::PASS) GPU_SHADER_CREATE_INFO(eevee_ray_tile_classify) - .do_static_compilation(true) - .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data") - .additional_info("eevee_global_ubo") - .typedef_source("draw_shader_shared.hh") - .image_out(0, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_raytrace_denoise_img") - .image_out(1, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_raytrace_tracing_img") - .image_out(2, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_horizon_denoise_img") - .image_out(3, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_horizon_tracing_img") - .compute_source("eevee_ray_tile_classify_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(eevee_global_ubo) +TYPEDEF_SOURCE("draw_shader_shared.hh") +IMAGE_FREQ(0, RAYTRACE_TILEMASK_FORMAT, WRITE, UINT_2D_ARRAY, tile_raytrace_denoise_img, PASS) +IMAGE_FREQ(1, RAYTRACE_TILEMASK_FORMAT, WRITE, UINT_2D_ARRAY, tile_raytrace_tracing_img, PASS) +IMAGE_FREQ(2, RAYTRACE_TILEMASK_FORMAT, WRITE, UINT_2D_ARRAY, tile_horizon_denoise_img, PASS) +IMAGE_FREQ(3, RAYTRACE_TILEMASK_FORMAT, WRITE, UINT_2D_ARRAY, tile_horizon_tracing_img, PASS) +COMPUTE_SOURCE("eevee_ray_tile_classify_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_ray_tile_compact) - .do_static_compilation(true) - .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_global_ubo") - .typedef_source("draw_shader_shared.hh") - .image_in(0, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_raytrace_denoise_img") - .image_in(1, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_raytrace_tracing_img") - .storage_buf(0, Qualifier::READ_WRITE, "DispatchCommand", "raytrace_tracing_dispatch_buf") - .storage_buf(1, Qualifier::READ_WRITE, "DispatchCommand", "raytrace_denoise_dispatch_buf") - .storage_buf(4, Qualifier::WRITE, "uint", "raytrace_tracing_tiles_buf[]") - .storage_buf(5, Qualifier::WRITE, "uint", "raytrace_denoise_tiles_buf[]") - .specialization_constant(Type::INT, "closure_index", 0) - .specialization_constant(Type::INT, "resolution_scale", 2) - .compute_source("eevee_ray_tile_compact_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_global_ubo) +TYPEDEF_SOURCE("draw_shader_shared.hh") +IMAGE_FREQ(0, RAYTRACE_TILEMASK_FORMAT, READ, UINT_2D_ARRAY, tile_raytrace_denoise_img, PASS) +IMAGE_FREQ(1, RAYTRACE_TILEMASK_FORMAT, READ, UINT_2D_ARRAY, tile_raytrace_tracing_img, PASS) +STORAGE_BUF(0, READ_WRITE, DispatchCommand, raytrace_tracing_dispatch_buf) +STORAGE_BUF(1, READ_WRITE, DispatchCommand, raytrace_denoise_dispatch_buf) +STORAGE_BUF(4, WRITE, uint, raytrace_tracing_tiles_buf[]) +STORAGE_BUF(5, WRITE, uint, raytrace_denoise_tiles_buf[]) +SPECIALIZATION_CONSTANT(INT, closure_index, 0) +SPECIALIZATION_CONSTANT(INT, resolution_scale, 2) +COMPUTE_SOURCE("eevee_ray_tile_compact_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_ray_generate) - .do_static_compilation(true) - .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data") - .additional_info("eevee_global_ubo") - .additional_info("eevee_sampling_data") - .additional_info("draw_view") - .additional_info("eevee_utility_texture") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_ray_data_img") - .storage_buf(4, Qualifier::READ, "uint", "tiles_coord_buf[]") - .specialization_constant(Type::INT, "closure_index", 0) - .compute_source("eevee_ray_generate_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_utility_texture) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, out_ray_data_img) +STORAGE_BUF(4, READ, uint, tiles_coord_buf[]) +SPECIALIZATION_CONSTANT(INT, closure_index, 0) +COMPUTE_SOURCE("eevee_ray_generate_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_ray_trace_fallback) - .do_static_compilation(true) - .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data") - .additional_info("eevee_global_ubo") - .additional_info("draw_view") - .additional_info("eevee_sampling_data") - .additional_info("eevee_lightprobe_data") - .image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "ray_data_img") - .image(1, RAYTRACE_RAYTIME_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_time_img") - .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_radiance_img") - .sampler(1, ImageType::DEPTH_2D, "depth_tx") - .storage_buf(5, Qualifier::READ, "uint", "tiles_coord_buf[]") - .specialization_constant(Type::INT, "closure_index", 0) - .compute_source("eevee_ray_trace_fallback_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_lightprobe_data) +IMAGE(0, GPU_RGBA16F, READ, FLOAT_2D, ray_data_img) +IMAGE(1, RAYTRACE_RAYTIME_FORMAT, WRITE, FLOAT_2D, ray_time_img) +IMAGE(2, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, ray_radiance_img) +SAMPLER(1, DEPTH_2D, depth_tx) +STORAGE_BUF(5, READ, uint, tiles_coord_buf[]) +SPECIALIZATION_CONSTANT(INT, closure_index, 0) +COMPUTE_SOURCE("eevee_ray_trace_fallback_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_ray_trace_planar) - .do_static_compilation(true) - .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .define("PLANAR_PROBES") - .additional_info("eevee_shared") - .additional_info("eevee_global_ubo") - .additional_info("eevee_sampling_data") - .additional_info("eevee_gbuffer_data") - .additional_info("draw_view") - .additional_info("eevee_lightprobe_data") - .additional_info("eevee_lightprobe_planar_data") - .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "ray_data_img") - .image(1, RAYTRACE_RAYTIME_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_time_img") - .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_radiance_img") - .sampler(2, ImageType::DEPTH_2D, "depth_tx") - .storage_buf(5, Qualifier::READ, "uint", "tiles_coord_buf[]") - .specialization_constant(Type::INT, "closure_index", 0) - .compute_source("eevee_ray_trace_planar_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) +DEFINE("PLANAR_PROBES") +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_lightprobe_data) +ADDITIONAL_INFO(eevee_lightprobe_planar_data) +IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, ray_data_img) +IMAGE(1, RAYTRACE_RAYTIME_FORMAT, WRITE, FLOAT_2D, ray_time_img) +IMAGE(2, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, ray_radiance_img) +SAMPLER(2, DEPTH_2D, depth_tx) +STORAGE_BUF(5, READ, uint, tiles_coord_buf[]) +SPECIALIZATION_CONSTANT(INT, closure_index, 0) +COMPUTE_SOURCE("eevee_ray_trace_planar_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_ray_trace_screen) - .do_static_compilation(true) - .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_global_ubo") - .additional_info("eevee_sampling_data") - .additional_info("eevee_gbuffer_data") - .additional_info("draw_view") - .additional_info("eevee_hiz_data") - .additional_info("eevee_lightprobe_data") - .image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "ray_data_img") - .image(1, RAYTRACE_RAYTIME_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_time_img") - .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_radiance_img") - .sampler(0, ImageType::DEPTH_2D, "depth_tx") - .sampler(1, ImageType::FLOAT_2D, "radiance_front_tx") - .sampler(2, ImageType::FLOAT_2D, "radiance_back_tx") - .sampler(4, ImageType::FLOAT_2D, "hiz_front_tx") - .sampler(5, ImageType::FLOAT_2D, "hiz_back_tx") - .storage_buf(5, Qualifier::READ, "uint", "tiles_coord_buf[]") - .compute_source("eevee_ray_trace_screen_comp.glsl") - /* Metal: Provide compiler with hint to tune per-thread resource allocation. */ - .mtl_max_total_threads_per_threadgroup(400) - .specialization_constant(Type::BOOL, "trace_refraction", true) - .specialization_constant(Type::INT, "closure_index", 0) - .compute_source("eevee_ray_trace_screen_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_hiz_data) +ADDITIONAL_INFO(eevee_lightprobe_data) +IMAGE(0, GPU_RGBA16F, READ, FLOAT_2D, ray_data_img) +IMAGE(1, RAYTRACE_RAYTIME_FORMAT, WRITE, FLOAT_2D, ray_time_img) +IMAGE(2, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, ray_radiance_img) +SAMPLER(0, DEPTH_2D, depth_tx) +SAMPLER(1, FLOAT_2D, radiance_front_tx) +SAMPLER(2, FLOAT_2D, radiance_back_tx) +SAMPLER(4, FLOAT_2D, hiz_front_tx) +SAMPLER(5, FLOAT_2D, hiz_back_tx) +STORAGE_BUF(5, READ, uint, tiles_coord_buf[]) +COMPUTE_SOURCE("eevee_ray_trace_screen_comp.glsl") +/* Metal: Provide compiler with hint to tune per-thread resource allocation. */ +MTL_MAX_TOTAL_THREADS_PER_THREADGROUP(400) +SPECIALIZATION_CONSTANT(BOOL, trace_refraction, true) +SPECIALIZATION_CONSTANT(INT, closure_index, 0) +COMPUTE_SOURCE("eevee_ray_trace_screen_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_ray_denoise_spatial) - .do_static_compilation(true) - .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data") - .additional_info("eevee_global_ubo") - .additional_info("eevee_sampling_data") - .additional_info("draw_view") - .additional_info("eevee_utility_texture") - .sampler(3, ImageType::DEPTH_2D, "depth_tx") - .image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "ray_data_img") - .image(1, RAYTRACE_RAYTIME_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "ray_time_img") - .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "ray_radiance_img") - .image(3, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_radiance_img") - .image(4, RAYTRACE_VARIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_variance_img") - .image(5, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_hit_depth_img") - .image(6, RAYTRACE_TILEMASK_FORMAT, Qualifier::READ, ImageType::UINT_2D_ARRAY, "tile_mask_img") - .storage_buf(4, Qualifier::READ, "uint", "tiles_coord_buf[]") - /* Metal: Provide compiler with hint to tune per-thread resource allocation. */ - .mtl_max_total_threads_per_threadgroup(316) - .specialization_constant(Type::INT, "raytrace_resolution_scale", 2) - .specialization_constant(Type::BOOL, "skip_denoise", false) - .specialization_constant(Type::INT, "closure_index", 0) - .compute_source("eevee_ray_denoise_spatial_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_utility_texture) +SAMPLER(3, DEPTH_2D, depth_tx) +IMAGE(0, GPU_RGBA16F, READ, FLOAT_2D, ray_data_img) +IMAGE(1, RAYTRACE_RAYTIME_FORMAT, READ, FLOAT_2D, ray_time_img) +IMAGE(2, RAYTRACE_RADIANCE_FORMAT, READ, FLOAT_2D, ray_radiance_img) +IMAGE(3, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, out_radiance_img) +IMAGE(4, RAYTRACE_VARIANCE_FORMAT, WRITE, FLOAT_2D, out_variance_img) +IMAGE(5, GPU_R32F, WRITE, FLOAT_2D, out_hit_depth_img) +IMAGE(6, RAYTRACE_TILEMASK_FORMAT, READ, UINT_2D_ARRAY, tile_mask_img) +STORAGE_BUF(4, READ, uint, tiles_coord_buf[]) +/* Metal: Provide compiler with hint to tune per-thread resource allocation. */ +MTL_MAX_TOTAL_THREADS_PER_THREADGROUP(316) +SPECIALIZATION_CONSTANT(INT, raytrace_resolution_scale, 2) +SPECIALIZATION_CONSTANT(BOOL, skip_denoise, false) +SPECIALIZATION_CONSTANT(INT, closure_index, 0) +COMPUTE_SOURCE("eevee_ray_denoise_spatial_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_ray_denoise_temporal) - .do_static_compilation(true) - .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_global_ubo") - .additional_info("draw_view") - .sampler(0, ImageType::FLOAT_2D, "radiance_history_tx") - .sampler(1, ImageType::FLOAT_2D, "variance_history_tx") - .sampler(2, ImageType::UINT_2D_ARRAY, "tilemask_history_tx") - .sampler(3, ImageType::DEPTH_2D, "depth_tx") - .image(0, GPU_R32F, Qualifier::READ, ImageType::FLOAT_2D, "hit_depth_img") - .image(1, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "in_radiance_img") - .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_radiance_img") - .image(3, RAYTRACE_VARIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "in_variance_img") - .image(4, RAYTRACE_VARIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_variance_img") - .storage_buf(4, Qualifier::READ, "uint", "tiles_coord_buf[]") - .compute_source("eevee_ray_denoise_temporal_comp.glsl") - /* Metal: Provide compiler with hint to tune per-thread resource allocation. */ - .mtl_max_total_threads_per_threadgroup(512) - .specialization_constant(Type::INT, "closure_index", 0) - .compute_source("eevee_ray_denoise_temporal_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(draw_view) +SAMPLER(0, FLOAT_2D, radiance_history_tx) +SAMPLER(1, FLOAT_2D, variance_history_tx) +SAMPLER(2, UINT_2D_ARRAY, tilemask_history_tx) +SAMPLER(3, DEPTH_2D, depth_tx) +IMAGE(0, GPU_R32F, READ, FLOAT_2D, hit_depth_img) +IMAGE(1, RAYTRACE_RADIANCE_FORMAT, READ, FLOAT_2D, in_radiance_img) +IMAGE(2, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, out_radiance_img) +IMAGE(3, RAYTRACE_VARIANCE_FORMAT, READ, FLOAT_2D, in_variance_img) +IMAGE(4, RAYTRACE_VARIANCE_FORMAT, WRITE, FLOAT_2D, out_variance_img) +STORAGE_BUF(4, READ, uint, tiles_coord_buf[]) +COMPUTE_SOURCE("eevee_ray_denoise_temporal_comp.glsl") +/* Metal: Provide compiler with hint to tune per-thread resource allocation. */ +MTL_MAX_TOTAL_THREADS_PER_THREADGROUP(512) +SPECIALIZATION_CONSTANT(INT, closure_index, 0) +COMPUTE_SOURCE("eevee_ray_denoise_temporal_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_ray_denoise_bilateral) - .do_static_compilation(true) - .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data") - .additional_info("eevee_global_ubo") - .additional_info("eevee_sampling_data") - .additional_info("draw_view") - .sampler(1, ImageType::DEPTH_2D, "depth_tx") - .image(1, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "in_radiance_img") - .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_radiance_img") - .image(3, RAYTRACE_VARIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "in_variance_img") - .image(6, RAYTRACE_TILEMASK_FORMAT, Qualifier::READ, ImageType::UINT_2D_ARRAY, "tile_mask_img") - .storage_buf(4, Qualifier::READ, "uint", "tiles_coord_buf[]") - .specialization_constant(Type::INT, "closure_index", 0) - .compute_source("eevee_ray_denoise_bilateral_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(draw_view) +SAMPLER(1, DEPTH_2D, depth_tx) +IMAGE(1, RAYTRACE_RADIANCE_FORMAT, READ, FLOAT_2D, in_radiance_img) +IMAGE(2, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, out_radiance_img) +IMAGE(3, RAYTRACE_VARIANCE_FORMAT, READ, FLOAT_2D, in_variance_img) +IMAGE(6, RAYTRACE_TILEMASK_FORMAT, READ, UINT_2D_ARRAY, tile_mask_img) +STORAGE_BUF(4, READ, uint, tiles_coord_buf[]) +SPECIALIZATION_CONSTANT(INT, closure_index, 0) +COMPUTE_SOURCE("eevee_ray_denoise_bilateral_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_horizon_setup) - .do_static_compilation(true) - .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data") - .additional_info("eevee_global_ubo") - .additional_info("draw_view") - .sampler(0, ImageType::DEPTH_2D, "depth_tx") - .sampler(1, ImageType::FLOAT_2D, "in_radiance_tx") - .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_radiance_img") - .image(3, GPU_RGB10_A2, Qualifier::WRITE, ImageType::FLOAT_2D, "out_normal_img") - .compute_source("eevee_horizon_setup_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(draw_view) +SAMPLER(0, DEPTH_2D, depth_tx) +SAMPLER(1, FLOAT_2D, in_radiance_tx) +IMAGE(2, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, out_radiance_img) +IMAGE(3, GPU_RGB10_A2, WRITE, FLOAT_2D, out_normal_img) +COMPUTE_SOURCE("eevee_horizon_setup_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_horizon_scan) - .do_static_compilation(true) - .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data") - .additional_info("eevee_global_ubo") - .additional_info("eevee_sampling_data") - .additional_info("eevee_utility_texture") - .additional_info("eevee_hiz_data") - .additional_info("draw_view") - .specialization_constant(Type::INT, "fast_gi_slice_count", 2) - .specialization_constant(Type::INT, "fast_gi_step_count", 8) - .specialization_constant(Type::BOOL, "fast_gi_ao_only", false) - .sampler(0, ImageType::FLOAT_2D, "screen_radiance_tx") - .sampler(1, ImageType::FLOAT_2D, "screen_normal_tx") - .image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "horizon_radiance_0_img") - .image(3, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "horizon_radiance_1_img") - .image(4, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "horizon_radiance_2_img") - .image(5, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "horizon_radiance_3_img") - .storage_buf(7, Qualifier::READ, "uint", "tiles_coord_buf[]") - /* Metal: Provide compiler with hint to tune per-thread resource allocation. */ - .mtl_max_total_threads_per_threadgroup(400) - .compute_source("eevee_horizon_scan_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_utility_texture) +ADDITIONAL_INFO(eevee_hiz_data) +ADDITIONAL_INFO(draw_view) +SPECIALIZATION_CONSTANT(INT, fast_gi_slice_count, 2) +SPECIALIZATION_CONSTANT(INT, fast_gi_step_count, 8) +SPECIALIZATION_CONSTANT(BOOL, fast_gi_ao_only, false) +SAMPLER(0, FLOAT_2D, screen_radiance_tx) +SAMPLER(1, FLOAT_2D, screen_normal_tx) +IMAGE(2, GPU_RGBA16F, WRITE, FLOAT_2D, horizon_radiance_0_img) +IMAGE(3, GPU_RGBA8, WRITE, FLOAT_2D, horizon_radiance_1_img) +IMAGE(4, GPU_RGBA8, WRITE, FLOAT_2D, horizon_radiance_2_img) +IMAGE(5, GPU_RGBA8, WRITE, FLOAT_2D, horizon_radiance_3_img) +STORAGE_BUF(7, READ, uint, tiles_coord_buf[]) +/* Metal: Provide compiler with hint to tune per-thread resource allocation. */ +MTL_MAX_TOTAL_THREADS_PER_THREADGROUP(400) +COMPUTE_SOURCE("eevee_horizon_scan_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_horizon_denoise) - .do_static_compilation(true) - .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info( - "eevee_shared", "eevee_global_ubo", "eevee_sampling_data", "eevee_hiz_data", "draw_view") - .sampler(2, ImageType::FLOAT_2D, "in_sh_0_tx") - .sampler(4, ImageType::FLOAT_2D, "in_sh_1_tx") - .sampler(5, ImageType::FLOAT_2D, "in_sh_2_tx") - .sampler(6, ImageType::FLOAT_2D, "in_sh_3_tx") - .sampler(7, ImageType::FLOAT_2D, "screen_normal_tx") - .image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_sh_0_img") - .image(3, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "out_sh_1_img") - .image(4, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "out_sh_2_img") - .image(5, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "out_sh_3_img") - .storage_buf(7, Qualifier::READ, "uint", "tiles_coord_buf[]") - .compute_source("eevee_horizon_denoise_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_hiz_data) +ADDITIONAL_INFO(draw_view) +SAMPLER(2, FLOAT_2D, in_sh_0_tx) +SAMPLER(4, FLOAT_2D, in_sh_1_tx) +SAMPLER(5, FLOAT_2D, in_sh_2_tx) +SAMPLER(6, FLOAT_2D, in_sh_3_tx) +SAMPLER(7, FLOAT_2D, screen_normal_tx) +IMAGE(2, GPU_RGBA16F, WRITE, FLOAT_2D, out_sh_0_img) +IMAGE(3, GPU_RGBA8, WRITE, FLOAT_2D, out_sh_1_img) +IMAGE(4, GPU_RGBA8, WRITE, FLOAT_2D, out_sh_2_img) +IMAGE(5, GPU_RGBA8, WRITE, FLOAT_2D, out_sh_3_img) +STORAGE_BUF(7, READ, uint, tiles_coord_buf[]) +COMPUTE_SOURCE("eevee_horizon_denoise_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_horizon_resolve) - .do_static_compilation(true) - .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data") - .additional_info("eevee_global_ubo") - .additional_info("eevee_sampling_data") - .additional_info("eevee_lightprobe_data") - .additional_info("draw_view") - .sampler(1, ImageType::DEPTH_2D, "depth_tx") - .sampler(2, ImageType::FLOAT_2D, "horizon_radiance_0_tx") - .sampler(3, ImageType::FLOAT_2D, "horizon_radiance_1_tx") - .sampler(4, ImageType::FLOAT_2D, "horizon_radiance_2_tx") - .sampler(5, ImageType::FLOAT_2D, "horizon_radiance_3_tx") - .sampler(8, ImageType::FLOAT_2D, "screen_normal_tx") - .image(3, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "closure0_img") - .image(4, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "closure1_img") - .image(5, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "closure2_img") - .storage_buf(7, Qualifier::READ, "uint", "tiles_coord_buf[]") - /* Metal: Provide compiler with hint to tune per-thread resource allocation. */ - .mtl_max_total_threads_per_threadgroup(400) - .compute_source("eevee_horizon_resolve_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_lightprobe_data) +ADDITIONAL_INFO(draw_view) +SAMPLER(1, DEPTH_2D, depth_tx) +SAMPLER(2, FLOAT_2D, horizon_radiance_0_tx) +SAMPLER(3, FLOAT_2D, horizon_radiance_1_tx) +SAMPLER(4, FLOAT_2D, horizon_radiance_2_tx) +SAMPLER(5, FLOAT_2D, horizon_radiance_3_tx) +SAMPLER(8, FLOAT_2D, screen_normal_tx) +IMAGE(3, RAYTRACE_RADIANCE_FORMAT, READ_WRITE, FLOAT_2D, closure0_img) +IMAGE(4, RAYTRACE_RADIANCE_FORMAT, READ_WRITE, FLOAT_2D, closure1_img) +IMAGE(5, RAYTRACE_RADIANCE_FORMAT, READ_WRITE, FLOAT_2D, closure2_img) +STORAGE_BUF(7, READ, uint, tiles_coord_buf[]) +/* Metal: Provide compiler with hint to tune per-thread resource allocation. */ +MTL_MAX_TOTAL_THREADS_PER_THREADGROUP(400) +COMPUTE_SOURCE("eevee_horizon_resolve_comp.glsl") +GPU_SHADER_CREATE_END() #undef image_out #undef image_in diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_velocity_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_velocity_info.hh index 4a2f8a15c05..5f2b608f25d 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_velocity_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_velocity_info.hh @@ -15,37 +15,38 @@ /* Pass world space deltas to the fragment shader. * This is to make sure that the resulting motion vectors are valid even with displacement. */ GPU_SHADER_NAMED_INTERFACE_INFO(eevee_velocity_surface_iface, motion) - .smooth(Type::VEC3, "prev") - .smooth(Type::VEC3, "next"); +SMOOTH(VEC3, prev) +SMOOTH(VEC3, next) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(eevee_velocity_camera) - .define("VELOCITY_CAMERA") - .uniform_buf(VELOCITY_CAMERA_PREV_BUF, "CameraData", "camera_prev") - .uniform_buf(VELOCITY_CAMERA_CURR_BUF, "CameraData", "camera_curr") - .uniform_buf(VELOCITY_CAMERA_NEXT_BUF, "CameraData", "camera_next"); +DEFINE("VELOCITY_CAMERA") +UNIFORM_BUF(VELOCITY_CAMERA_PREV_BUF, CameraData, camera_prev) +UNIFORM_BUF(VELOCITY_CAMERA_CURR_BUF, CameraData, camera_curr) +UNIFORM_BUF(VELOCITY_CAMERA_NEXT_BUF, CameraData, camera_next) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_velocity_geom) - .define("MAT_VELOCITY") - .storage_buf(VELOCITY_OBJ_PREV_BUF_SLOT, Qualifier::READ, "mat4", "velocity_obj_prev_buf[]") - .storage_buf(VELOCITY_OBJ_NEXT_BUF_SLOT, Qualifier::READ, "mat4", "velocity_obj_next_buf[]") - .storage_buf(VELOCITY_GEO_PREV_BUF_SLOT, Qualifier::READ, "vec4", "velocity_geo_prev_buf[]") - .storage_buf(VELOCITY_GEO_NEXT_BUF_SLOT, Qualifier::READ, "vec4", "velocity_geo_next_buf[]") - .storage_buf(VELOCITY_INDIRECTION_BUF_SLOT, - Qualifier::READ, - "VelocityIndex", - "velocity_indirection_buf[]") - .vertex_out(eevee_velocity_surface_iface) - .fragment_out(0, Type::VEC4, "out_velocity") - .additional_info("eevee_velocity_camera"); +DEFINE("MAT_VELOCITY") +STORAGE_BUF(VELOCITY_OBJ_PREV_BUF_SLOT, READ, mat4, velocity_obj_prev_buf[]) +STORAGE_BUF(VELOCITY_OBJ_NEXT_BUF_SLOT, READ, mat4, velocity_obj_next_buf[]) +STORAGE_BUF(VELOCITY_GEO_PREV_BUF_SLOT, READ, vec4, velocity_geo_prev_buf[]) +STORAGE_BUF(VELOCITY_GEO_NEXT_BUF_SLOT, READ, vec4, velocity_geo_next_buf[]) +STORAGE_BUF(VELOCITY_INDIRECTION_BUF_SLOT, READ, VelocityIndex, velocity_indirection_buf[]) +VERTEX_OUT(eevee_velocity_surface_iface) +FRAGMENT_OUT(0, VEC4, out_velocity) +ADDITIONAL_INFO(eevee_velocity_camera) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_vertex_copy) - .compute_source("eevee_vertex_copy_comp.glsl") - .local_group_size(VERTEX_COPY_GROUP_SIZE) - .storage_buf(0, Qualifier::READ, "float", "in_buf[]") - .storage_buf(1, Qualifier::WRITE, "vec4", "out_buf[]") - .push_constant(Type::INT, "start_offset") - .push_constant(Type::INT, "vertex_stride") - .push_constant(Type::INT, "vertex_count") - .do_static_compilation(true); +COMPUTE_SOURCE("eevee_vertex_copy_comp.glsl") +LOCAL_GROUP_SIZE(VERTEX_COPY_GROUP_SIZE) +STORAGE_BUF(0, READ, float, in_buf[]) +STORAGE_BUF(1, WRITE, vec4, out_buf[]) +PUSH_CONSTANT(INT, start_offset) +PUSH_CONSTANT(INT, vertex_stride) +PUSH_CONSTANT(INT, vertex_count) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_volume_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_volume_info.hh index ea7c2c6908d..d49d0a27267 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_volume_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_volume_info.hh @@ -8,106 +8,88 @@ /* Used for shaders that need the final accumulated volume transmittance and scattering. */ GPU_SHADER_CREATE_INFO(eevee_volume_lib) - .additional_info("eevee_shared") - .additional_info("eevee_global_ubo") - .additional_info("draw_view") - .sampler(VOLUME_SCATTERING_TEX_SLOT, ImageType::FLOAT_3D, "volume_scattering_tx") - .sampler(VOLUME_TRANSMITTANCE_TEX_SLOT, ImageType::FLOAT_3D, "volume_transmittance_tx"); +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(draw_view) +SAMPLER(VOLUME_SCATTERING_TEX_SLOT, FLOAT_3D, volume_scattering_tx) +SAMPLER(VOLUME_TRANSMITTANCE_TEX_SLOT, FLOAT_3D, volume_transmittance_tx) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_volume_properties_data) - .additional_info("eevee_global_ubo") - .image(VOLUME_PROP_SCATTERING_IMG_SLOT, - GPU_R11F_G11F_B10F, - Qualifier::READ, - ImageType::FLOAT_3D, - "in_scattering_img") - .image(VOLUME_PROP_EXTINCTION_IMG_SLOT, - GPU_R11F_G11F_B10F, - Qualifier::READ, - ImageType::FLOAT_3D, - "in_extinction_img") - .image(VOLUME_PROP_EMISSION_IMG_SLOT, - GPU_R11F_G11F_B10F, - Qualifier::READ, - ImageType::FLOAT_3D, - "in_emission_img") - .image( - VOLUME_PROP_PHASE_IMG_SLOT, GPU_R16F, Qualifier::READ, ImageType::FLOAT_3D, "in_phase_img") - .image(VOLUME_PROP_PHASE_WEIGHT_IMG_SLOT, - GPU_R16F, - Qualifier::READ, - ImageType::FLOAT_3D, - "in_phase_weight_img"); +ADDITIONAL_INFO(eevee_global_ubo) +IMAGE(VOLUME_PROP_SCATTERING_IMG_SLOT, GPU_R11F_G11F_B10F, READ, FLOAT_3D, in_scattering_img) +IMAGE(VOLUME_PROP_EXTINCTION_IMG_SLOT, GPU_R11F_G11F_B10F, READ, FLOAT_3D, in_extinction_img) +IMAGE(VOLUME_PROP_EMISSION_IMG_SLOT, GPU_R11F_G11F_B10F, READ, FLOAT_3D, in_emission_img) +IMAGE(VOLUME_PROP_PHASE_IMG_SLOT, GPU_R16F, READ, FLOAT_3D, in_phase_img) +IMAGE(VOLUME_PROP_PHASE_WEIGHT_IMG_SLOT, GPU_R16F, READ, FLOAT_3D, in_phase_weight_img) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_volume_scatter) - .local_group_size(VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_global_ubo") - .additional_info("draw_resource_id_varying") - .additional_info("draw_view") - .additional_info("eevee_light_data") - .additional_info("eevee_lightprobe_data") - .additional_info("eevee_shadow_data") - .additional_info("eevee_sampling_data") - .additional_info("eevee_utility_texture") - .additional_info("eevee_volume_properties_data") - .sampler(0, ImageType::FLOAT_3D, "scattering_history_tx") - .sampler(1, ImageType::FLOAT_3D, "extinction_history_tx") - .image(5, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_3D, "out_scattering_img") - .image(6, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_3D, "out_extinction_img") - .compute_source("eevee_volume_scatter_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(draw_resource_id_varying) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_light_data) +ADDITIONAL_INFO(eevee_lightprobe_data) +ADDITIONAL_INFO(eevee_shadow_data) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_utility_texture) +ADDITIONAL_INFO(eevee_volume_properties_data) +SAMPLER(0, FLOAT_3D, scattering_history_tx) +SAMPLER(1, FLOAT_3D, extinction_history_tx) +IMAGE(5, GPU_R11F_G11F_B10F, WRITE, FLOAT_3D, out_scattering_img) +IMAGE(6, GPU_R11F_G11F_B10F, WRITE, FLOAT_3D, out_extinction_img) +COMPUTE_SOURCE("eevee_volume_scatter_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_volume_scatter_with_lights) - .additional_info("eevee_volume_scatter") - .define("VOLUME_LIGHTING") - .define("VOLUME_IRRADIANCE") - .define("VOLUME_SHADOW") - .sampler(9, ImageType::FLOAT_3D, "extinction_tx") - .do_static_compilation(true); +ADDITIONAL_INFO(eevee_volume_scatter) +DEFINE("VOLUME_LIGHTING") +DEFINE("VOLUME_IRRADIANCE") +DEFINE("VOLUME_SHADOW") +SAMPLER(9, FLOAT_3D, extinction_tx) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_volume_occupancy_convert) - .additional_info("eevee_shared") - .additional_info("eevee_global_ubo") - .additional_info("draw_fullscreen") - .builtins(BuiltinBits::TEXTURE_ATOMIC) - .image(VOLUME_HIT_DEPTH_SLOT, GPU_R32F, Qualifier::READ, ImageType::FLOAT_3D, "hit_depth_img") - .image(VOLUME_HIT_COUNT_SLOT, - GPU_R32UI, - Qualifier::READ_WRITE, - ImageType::UINT_2D, - "hit_count_img") - .image(VOLUME_OCCUPANCY_SLOT, - GPU_R32UI, - Qualifier::READ_WRITE, - ImageType::UINT_3D_ATOMIC, - "occupancy_img") - .fragment_source("eevee_occupancy_convert_frag.glsl") - .do_static_compilation(true); +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(draw_fullscreen) +BUILTINS(BuiltinBits::TEXTURE_ATOMIC) +IMAGE(VOLUME_HIT_DEPTH_SLOT, GPU_R32F, READ, FLOAT_3D, hit_depth_img) +IMAGE(VOLUME_HIT_COUNT_SLOT, GPU_R32UI, READ_WRITE, UINT_2D, hit_count_img) +IMAGE(VOLUME_OCCUPANCY_SLOT, GPU_R32UI, READ_WRITE, UINT_3D_ATOMIC, occupancy_img) +FRAGMENT_SOURCE("eevee_occupancy_convert_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_volume_integration) - .additional_info("eevee_shared") - .additional_info("eevee_global_ubo") - .additional_info("draw_view") - .additional_info("eevee_sampling_data") - .compute_source("eevee_volume_integration_comp.glsl") - .local_group_size(VOLUME_INTEGRATION_GROUP_SIZE, VOLUME_INTEGRATION_GROUP_SIZE, 1) - /* Inputs. */ - .sampler(0, ImageType::FLOAT_3D, "in_scattering_tx") - .sampler(1, ImageType::FLOAT_3D, "in_extinction_tx") - /* Outputs. */ - .image(0, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_3D, "out_scattering_img") - .image(1, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_3D, "out_transmittance_img") - .do_static_compilation(true); +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_sampling_data) +COMPUTE_SOURCE("eevee_volume_integration_comp.glsl") +LOCAL_GROUP_SIZE(VOLUME_INTEGRATION_GROUP_SIZE, VOLUME_INTEGRATION_GROUP_SIZE, 1) +/* Inputs. */ +SAMPLER(0, FLOAT_3D, in_scattering_tx) +SAMPLER(1, FLOAT_3D, in_extinction_tx) +/* Outputs. */ +IMAGE(0, GPU_R11F_G11F_B10F, WRITE, FLOAT_3D, out_scattering_img) +IMAGE(1, GPU_R11F_G11F_B10F, WRITE, FLOAT_3D, out_transmittance_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_volume_resolve) - .additional_info("eevee_shared") - .additional_info("eevee_volume_lib") - .additional_info("draw_fullscreen") - .additional_info("eevee_render_pass_out") - .additional_info("eevee_hiz_data") - .fragment_source("eevee_volume_resolve_frag.glsl") - .fragment_out(0, Type::VEC4, "out_radiance", DualBlend::SRC_0) - .fragment_out(0, Type::VEC4, "out_transmittance", DualBlend::SRC_1) - /** TODO(Miguel Pozo): Volume RenderPasses. */ - .do_static_compilation(true); +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_volume_lib) +ADDITIONAL_INFO(draw_fullscreen) +ADDITIONAL_INFO(eevee_render_pass_out) +ADDITIONAL_INFO(eevee_hiz_data) +FRAGMENT_SOURCE("eevee_volume_resolve_frag.glsl") +FRAGMENT_OUT_DUAL(0, VEC4, out_radiance, SRC_0) +FRAGMENT_OUT_DUAL(0, VEC4, out_transmittance, SRC_1) +/** TODO(Miguel Pozo): Volume RenderPasses. */ +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() 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 d82d11ccf7d..49daebc258d 100644 --- a/source/blender/draw/engines/gpencil/shaders/infos/gpencil_info.hh +++ b/source/blender/draw/engines/gpencil/shaders/infos/gpencil_info.hh @@ -11,48 +11,52 @@ * \{ */ GPU_SHADER_NAMED_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"); +SMOOTH(VEC4, color_mul) +SMOOTH(VEC4, color_add) +SMOOTH(VEC3, pos) +SMOOTH(VEC2, uv) +GPU_SHADER_INTERFACE_END() GPU_SHADER_NAMED_INTERFACE_INFO(gpencil_geometry_flat_iface, gp_interp_flat) - .flat(Type::VEC2, "aspect") - .flat(Type::VEC4, "sspos") - .flat(Type::UINT, "mat_flag") - .flat(Type::FLOAT, "depth"); +FLAT(VEC2, aspect) +FLAT(VEC4, sspos) +FLAT(UINT, mat_flag) +FLAT(FLOAT, depth) +GPU_SHADER_INTERFACE_END() GPU_SHADER_NAMED_INTERFACE_INFO(gpencil_geometry_noperspective_iface, gp_interp_noperspective) - .no_perspective(Type::VEC2, "thickness") - .no_perspective(Type::FLOAT, "hardness"); +NO_PERSPECTIVE(VEC2, thickness) +NO_PERSPECTIVE(FLOAT, hardness) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(gpencil_geometry) - .do_static_compilation(true) - .define("GP_LIGHT") - .typedef_source("gpencil_defines.h") - .sampler(2, ImageType::FLOAT_2D, "gpFillTexture") - .sampler(3, ImageType::FLOAT_2D, "gpStrokeTexture") - .sampler(4, ImageType::DEPTH_2D, "gpSceneDepthTexture") - .sampler(5, ImageType::FLOAT_2D, "gpMaskTexture") - .uniform_buf(4, "gpMaterial", "gp_materials[GPENCIL_MATERIAL_BUFFER_LEN]", Frequency::BATCH) - .uniform_buf(3, "gpLight", "gp_lights[GPENCIL_LIGHT_BUFFER_LEN]", Frequency::BATCH) - .push_constant(Type::VEC2, "viewportSize") - /* 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_out(gpencil_geometry_flat_iface) - .vertex_out(gpencil_geometry_noperspective_iface) - .vertex_source("gpencil_vert.glsl") - .fragment_source("gpencil_frag.glsl") - .depth_write(DepthWrite::ANY) - .additional_info("draw_gpencil"); +DO_STATIC_COMPILATION() +DEFINE("GP_LIGHT") +TYPEDEF_SOURCE("gpencil_defines.h") +SAMPLER(2, FLOAT_2D, gpFillTexture) +SAMPLER(3, FLOAT_2D, gpStrokeTexture) +SAMPLER(4, DEPTH_2D, gpSceneDepthTexture) +SAMPLER(5, FLOAT_2D, gpMaskTexture) +UNIFORM_BUF_FREQ(4, gpMaterial, gp_materials[GPENCIL_MATERIAL_BUFFER_LEN], BATCH) +UNIFORM_BUF_FREQ(3, gpLight, gp_lights[GPENCIL_LIGHT_BUFFER_LEN], BATCH) +PUSH_CONSTANT(VEC2, viewportSize) +/* Per Object */ +PUSH_CONSTANT(VEC3, gpNormal) +PUSH_CONSTANT(BOOL, gpStrokeOrder3d) +PUSH_CONSTANT(INT, gpMaterialOffset) +/* Per Layer */ +PUSH_CONSTANT(FLOAT, gpVertexColorOpacity) +PUSH_CONSTANT(VEC4, gpLayerTint) +PUSH_CONSTANT(FLOAT, gpLayerOpacity) +PUSH_CONSTANT(FLOAT, gpStrokeIndexOffset) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, revealColor) +VERTEX_OUT(gpencil_geometry_iface) +VERTEX_OUT(gpencil_geometry_flat_iface) +VERTEX_OUT(gpencil_geometry_noperspective_iface) +VERTEX_SOURCE("gpencil_vert.glsl") +FRAGMENT_SOURCE("gpencil_frag.glsl") +DEPTH_WRITE(DepthWrite::ANY) +ADDITIONAL_INFO(draw_gpencil) +GPU_SHADER_CREATE_END() /** \} */ @@ -61,35 +65,38 @@ GPU_SHADER_CREATE_INFO(gpencil_geometry) * \{ */ GPU_SHADER_CREATE_INFO(gpencil_layer_blend) - .do_static_compilation(true) - .sampler(0, ImageType::FLOAT_2D, "colorBuf") - .sampler(1, ImageType::FLOAT_2D, "revealBuf") - .sampler(2, ImageType::FLOAT_2D, "maskBuf") - .push_constant(Type::INT, "blendMode") - .push_constant(Type::FLOAT, "blendOpacity") - /* Reminder: This is considered SRC color in blend equations. - * Same operation on all buffers. */ - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "fragRevealage") - .fragment_source("gpencil_layer_blend_frag.glsl") - .additional_info("draw_fullscreen"); +DO_STATIC_COMPILATION() +SAMPLER(0, FLOAT_2D, colorBuf) +SAMPLER(1, FLOAT_2D, revealBuf) +SAMPLER(2, FLOAT_2D, maskBuf) +PUSH_CONSTANT(INT, blendMode) +PUSH_CONSTANT(FLOAT, blendOpacity) +/* Reminder: This is considered SRC color in blend equations. + * Same operation on all buffers. */ +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, fragRevealage) +FRAGMENT_SOURCE("gpencil_layer_blend_frag.glsl") +ADDITIONAL_INFO(draw_fullscreen) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpencil_mask_invert) - .do_static_compilation(true) - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "fragRevealage") - .fragment_source("gpencil_mask_invert_frag.glsl") - .additional_info("draw_fullscreen"); +DO_STATIC_COMPILATION() +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, fragRevealage) +FRAGMENT_SOURCE("gpencil_mask_invert_frag.glsl") +ADDITIONAL_INFO(draw_fullscreen) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpencil_depth_merge) - .do_static_compilation(true) - .push_constant(Type::VEC4, "gpModelMatrix", 4) - .push_constant(Type::BOOL, "strokeOrder3d") - .sampler(0, ImageType::DEPTH_2D, "depthBuf") - .vertex_source("gpencil_depth_merge_vert.glsl") - .fragment_source("gpencil_depth_merge_frag.glsl") - .depth_write(DepthWrite::ANY) - .additional_info("draw_view"); +DO_STATIC_COMPILATION() +PUSH_CONSTANT_ARRAY(VEC4, gpModelMatrix, 4) +PUSH_CONSTANT(BOOL, strokeOrder3d) +SAMPLER(0, DEPTH_2D, depthBuf) +VERTEX_SOURCE("gpencil_depth_merge_vert.glsl") +FRAGMENT_SOURCE("gpencil_depth_merge_frag.glsl") +DEPTH_WRITE(DepthWrite::ANY) +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() /** \} */ @@ -98,52 +105,57 @@ GPU_SHADER_CREATE_INFO(gpencil_depth_merge) * \{ */ GPU_SHADER_INTERFACE_INFO(gpencil_antialiasing_iface) - .smooth(Type::VEC2, "uvs") - .smooth(Type::VEC2, "pixcoord") - .smooth(Type::VEC4, "offset[3]"); +SMOOTH(VEC2, uvs) +SMOOTH(VEC2, pixcoord) +SMOOTH(VEC4, offset[3]) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(gpencil_antialiasing) - .define("SMAA_GLSL_3") - .define("SMAA_RT_METRICS", "viewportMetrics") - .define("SMAA_PRESET_HIGH") - .define("SMAA_LUMA_WEIGHT", "float4(lumaWeight, lumaWeight, lumaWeight, 0.0)") - .define("SMAA_NO_DISCARD") - .vertex_out(gpencil_antialiasing_iface) - .push_constant(Type::VEC4, "viewportMetrics") - .push_constant(Type::FLOAT, "lumaWeight") - .vertex_source("gpencil_antialiasing_vert.glsl") - .fragment_source("gpencil_antialiasing_frag.glsl"); +DEFINE("SMAA_GLSL_3") +DEFINE_VALUE("SMAA_RT_METRICS", "viewportMetrics") +DEFINE("SMAA_PRESET_HIGH") +DEFINE_VALUE("SMAA_LUMA_WEIGHT", "float4(lumaWeight, lumaWeight, lumaWeight, 0.0)") +DEFINE("SMAA_NO_DISCARD") +VERTEX_OUT(gpencil_antialiasing_iface) +PUSH_CONSTANT(VEC4, viewportMetrics) +PUSH_CONSTANT(FLOAT, lumaWeight) +VERTEX_SOURCE("gpencil_antialiasing_vert.glsl") +FRAGMENT_SOURCE("gpencil_antialiasing_frag.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpencil_antialiasing_stage_0) - .define("SMAA_STAGE", "0") - .sampler(0, ImageType::FLOAT_2D, "colorTex") - .sampler(1, ImageType::FLOAT_2D, "revealTex") - .fragment_out(0, Type::VEC2, "out_edges") - .additional_info("gpencil_antialiasing") - .do_static_compilation(true); +DEFINE_VALUE("SMAA_STAGE", "0") +SAMPLER(0, FLOAT_2D, colorTex) +SAMPLER(1, FLOAT_2D, revealTex) +FRAGMENT_OUT(0, VEC2, out_edges) +ADDITIONAL_INFO(gpencil_antialiasing) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpencil_antialiasing_stage_1) - .define("SMAA_STAGE", "1") - .sampler(0, ImageType::FLOAT_2D, "edgesTex") - .sampler(1, ImageType::FLOAT_2D, "areaTex") - .sampler(2, ImageType::FLOAT_2D, "searchTex") - .fragment_out(0, Type::VEC4, "out_weights") - .additional_info("gpencil_antialiasing") - .do_static_compilation(true); +DEFINE_VALUE("SMAA_STAGE", "1") +SAMPLER(0, FLOAT_2D, edgesTex) +SAMPLER(1, FLOAT_2D, areaTex) +SAMPLER(2, FLOAT_2D, searchTex) +FRAGMENT_OUT(0, VEC4, out_weights) +ADDITIONAL_INFO(gpencil_antialiasing) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpencil_antialiasing_stage_2) - .define("SMAA_STAGE", "2") - .sampler(0, ImageType::FLOAT_2D, "colorTex") - .sampler(1, ImageType::FLOAT_2D, "revealTex") - .sampler(2, ImageType::FLOAT_2D, "blendTex") - .push_constant(Type::FLOAT, "mixFactor") - .push_constant(Type::FLOAT, "taaAccumulatedWeight") - .push_constant(Type::BOOL, "doAntiAliasing") - .push_constant(Type::BOOL, "onlyAlpha") - /* Reminder: Blending func is `fragRevealage * DST + fragColor`. */ - .fragment_out(0, Type::VEC4, "out_color", DualBlend::SRC_0) - .fragment_out(0, Type::VEC4, "out_reveal", DualBlend::SRC_1) - .additional_info("gpencil_antialiasing") - .do_static_compilation(true); +DEFINE_VALUE("SMAA_STAGE", "2") +SAMPLER(0, FLOAT_2D, colorTex) +SAMPLER(1, FLOAT_2D, revealTex) +SAMPLER(2, FLOAT_2D, blendTex) +PUSH_CONSTANT(FLOAT, mixFactor) +PUSH_CONSTANT(FLOAT, taaAccumulatedWeight) +PUSH_CONSTANT(BOOL, doAntiAliasing) +PUSH_CONSTANT(BOOL, onlyAlpha) +/* Reminder: Blending func is `fragRevealage * DST + fragColor`. */ +FRAGMENT_OUT_DUAL(0, VEC4, out_color, SRC_0) +FRAGMENT_OUT_DUAL(0, VEC4, out_reveal, SRC_1) +ADDITIONAL_INFO(gpencil_antialiasing) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/gpencil/shaders/infos/gpencil_vfx_info.hh b/source/blender/draw/engines/gpencil/shaders/infos/gpencil_vfx_info.hh index 72a74ab5ecc..5bf7d6bbbfd 100644 --- a/source/blender/draw/engines/gpencil/shaders/infos/gpencil_vfx_info.hh +++ b/source/blender/draw/engines/gpencil/shaders/infos/gpencil_vfx_info.hh @@ -5,100 +5,109 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpencil_fx_common) - .sampler(0, ImageType::FLOAT_2D, "colorBuf") - .sampler(1, ImageType::FLOAT_2D, "revealBuf") - /* Reminder: This is considered SRC color in blend equations. - * Same operation on all buffers. */ - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "fragRevealage") - .fragment_source("gpencil_vfx_frag.glsl"); +SAMPLER(0, FLOAT_2D, colorBuf) +SAMPLER(1, FLOAT_2D, revealBuf) +/* Reminder: This is considered SRC color in blend equations. + * Same operation on all buffers. */ +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, fragRevealage) +FRAGMENT_SOURCE("gpencil_vfx_frag.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpencil_fx_composite) - .do_static_compilation(true) - .define("COMPOSITE") - .push_constant(Type::BOOL, "isFirstPass") - .additional_info("gpencil_fx_common") - .additional_info("draw_fullscreen"); +DO_STATIC_COMPILATION() +DEFINE("COMPOSITE") +PUSH_CONSTANT(BOOL, isFirstPass) +ADDITIONAL_INFO(gpencil_fx_common) +ADDITIONAL_INFO(draw_fullscreen) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpencil_fx_colorize) - .do_static_compilation(true) - .define("COLORIZE") - .push_constant(Type::VEC3, "lowColor") - .push_constant(Type::VEC3, "highColor") - .push_constant(Type::FLOAT, "factor") - .push_constant(Type::INT, "mode") - .additional_info("gpencil_fx_common") - .additional_info("draw_fullscreen"); +DO_STATIC_COMPILATION() +DEFINE("COLORIZE") +PUSH_CONSTANT(VEC3, lowColor) +PUSH_CONSTANT(VEC3, highColor) +PUSH_CONSTANT(FLOAT, factor) +PUSH_CONSTANT(INT, mode) +ADDITIONAL_INFO(gpencil_fx_common) +ADDITIONAL_INFO(draw_fullscreen) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpencil_fx_blur) - .do_static_compilation(true) - .define("BLUR") - .push_constant(Type::VEC2, "offset") - .push_constant(Type::INT, "sampCount") - .additional_info("gpencil_fx_common") - .additional_info("draw_fullscreen"); +DO_STATIC_COMPILATION() +DEFINE("BLUR") +PUSH_CONSTANT(VEC2, offset) +PUSH_CONSTANT(INT, sampCount) +ADDITIONAL_INFO(gpencil_fx_common) +ADDITIONAL_INFO(draw_fullscreen) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpencil_fx_transform) - .do_static_compilation(true) - .define("TRANSFORM") - .push_constant(Type::VEC2, "axisFlip") - .push_constant(Type::VEC2, "waveDir") - .push_constant(Type::VEC2, "waveOffset") - .push_constant(Type::FLOAT, "wavePhase") - .push_constant(Type::VEC2, "swirlCenter") - .push_constant(Type::FLOAT, "swirlAngle") - .push_constant(Type::FLOAT, "swirlRadius") - .additional_info("gpencil_fx_common") - .additional_info("draw_fullscreen"); +DO_STATIC_COMPILATION() +DEFINE("TRANSFORM") +PUSH_CONSTANT(VEC2, axisFlip) +PUSH_CONSTANT(VEC2, waveDir) +PUSH_CONSTANT(VEC2, waveOffset) +PUSH_CONSTANT(FLOAT, wavePhase) +PUSH_CONSTANT(VEC2, swirlCenter) +PUSH_CONSTANT(FLOAT, swirlAngle) +PUSH_CONSTANT(FLOAT, swirlRadius) +ADDITIONAL_INFO(gpencil_fx_common) +ADDITIONAL_INFO(draw_fullscreen) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpencil_fx_glow) - .do_static_compilation(true) - .define("GLOW") - .push_constant(Type::VEC4, "glowColor") - .push_constant(Type::VEC2, "offset") - .push_constant(Type::INT, "sampCount") - .push_constant(Type::VEC4, "threshold") - .push_constant(Type::BOOL, "firstPass") - .push_constant(Type::BOOL, "glowUnder") - .push_constant(Type::INT, "blendMode") - .additional_info("gpencil_fx_common") - .additional_info("draw_fullscreen"); +DO_STATIC_COMPILATION() +DEFINE("GLOW") +PUSH_CONSTANT(VEC4, glowColor) +PUSH_CONSTANT(VEC2, offset) +PUSH_CONSTANT(INT, sampCount) +PUSH_CONSTANT(VEC4, threshold) +PUSH_CONSTANT(BOOL, firstPass) +PUSH_CONSTANT(BOOL, glowUnder) +PUSH_CONSTANT(INT, blendMode) +ADDITIONAL_INFO(gpencil_fx_common) +ADDITIONAL_INFO(draw_fullscreen) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpencil_fx_rim) - .do_static_compilation(true) - .define("RIM") - .push_constant(Type::VEC2, "blurDir") - .push_constant(Type::VEC2, "uvOffset") - .push_constant(Type::VEC3, "rimColor") - .push_constant(Type::VEC3, "maskColor") - .push_constant(Type::INT, "sampCount") - .push_constant(Type::INT, "blendMode") - .push_constant(Type::BOOL, "isFirstPass") - .additional_info("gpencil_fx_common") - .additional_info("draw_fullscreen"); +DO_STATIC_COMPILATION() +DEFINE("RIM") +PUSH_CONSTANT(VEC2, blurDir) +PUSH_CONSTANT(VEC2, uvOffset) +PUSH_CONSTANT(VEC3, rimColor) +PUSH_CONSTANT(VEC3, maskColor) +PUSH_CONSTANT(INT, sampCount) +PUSH_CONSTANT(INT, blendMode) +PUSH_CONSTANT(BOOL, isFirstPass) +ADDITIONAL_INFO(gpencil_fx_common) +ADDITIONAL_INFO(draw_fullscreen) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpencil_fx_shadow) - .do_static_compilation(true) - .define("SHADOW") - .push_constant(Type::VEC4, "shadowColor") - .push_constant(Type::VEC2, "uvRotX") - .push_constant(Type::VEC2, "uvRotY") - .push_constant(Type::VEC2, "uvOffset") - .push_constant(Type::VEC2, "blurDir") - .push_constant(Type::VEC2, "waveDir") - .push_constant(Type::VEC2, "waveOffset") - .push_constant(Type::FLOAT, "wavePhase") - .push_constant(Type::INT, "sampCount") - .push_constant(Type::BOOL, "isFirstPass") - .additional_info("gpencil_fx_common") - .additional_info("draw_fullscreen"); +DO_STATIC_COMPILATION() +DEFINE("SHADOW") +PUSH_CONSTANT(VEC4, shadowColor) +PUSH_CONSTANT(VEC2, uvRotX) +PUSH_CONSTANT(VEC2, uvRotY) +PUSH_CONSTANT(VEC2, uvOffset) +PUSH_CONSTANT(VEC2, blurDir) +PUSH_CONSTANT(VEC2, waveDir) +PUSH_CONSTANT(VEC2, waveOffset) +PUSH_CONSTANT(FLOAT, wavePhase) +PUSH_CONSTANT(INT, sampCount) +PUSH_CONSTANT(BOOL, isFirstPass) +ADDITIONAL_INFO(gpencil_fx_common) +ADDITIONAL_INFO(draw_fullscreen) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpencil_fx_pixelize) - .do_static_compilation(true) - .define("PIXELIZE") - .push_constant(Type::VEC2, "targetPixelSize") - .push_constant(Type::VEC2, "targetPixelOffset") - .push_constant(Type::VEC2, "accumOffset") - .push_constant(Type::INT, "sampCount") - .additional_info("gpencil_fx_common") - .additional_info("draw_fullscreen"); +DO_STATIC_COMPILATION() +DEFINE("PIXELIZE") +PUSH_CONSTANT(VEC2, targetPixelSize) +PUSH_CONSTANT(VEC2, targetPixelOffset) +PUSH_CONSTANT(VEC2, accumOffset) +PUSH_CONSTANT(INT, sampCount) +ADDITIONAL_INFO(gpencil_fx_common) +ADDITIONAL_INFO(draw_fullscreen) +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/image/shaders/infos/engine_image_info.hh b/source/blender/draw/engines/image/shaders/infos/engine_image_info.hh index f94f271da78..65b054c1515 100644 --- a/source/blender/draw/engines/image/shaders/infos/engine_image_info.hh +++ b/source/blender/draw/engines/image/shaders/infos/engine_image_info.hh @@ -4,33 +4,39 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(image_engine_color_iface).smooth(Type::VEC2, "uv_screen"); +GPU_SHADER_INTERFACE_INFO(image_engine_color_iface) +SMOOTH(VEC2, uv_screen) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(image_engine_color_shader) - .vertex_in(0, Type::IVEC2, "pos") - .vertex_out(image_engine_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::VEC4, "shuffle") - .push_constant(Type::VEC2, "farNearDistances") - .push_constant(Type::IVEC2, "offset") - .push_constant(Type::INT, "drawFlags") - .push_constant(Type::BOOL, "imgPremultiplied") - .sampler(0, ImageType::FLOAT_2D, "imageTexture") - .sampler(1, ImageType::DEPTH_2D, "depth_texture") - .vertex_source("image_engine_color_vert.glsl") - .fragment_source("image_engine_color_frag.glsl") - .additional_info("draw_modelmat") - .do_static_compilation(true); +VERTEX_IN(0, IVEC2, pos) +VERTEX_OUT(image_engine_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(VEC4, shuffle) +PUSH_CONSTANT(VEC2, farNearDistances) +PUSH_CONSTANT(IVEC2, offset) +PUSH_CONSTANT(INT, drawFlags) +PUSH_CONSTANT(BOOL, imgPremultiplied) +SAMPLER(0, FLOAT_2D, imageTexture) +SAMPLER(1, DEPTH_2D, depth_texture) +VERTEX_SOURCE("image_engine_color_vert.glsl") +FRAGMENT_SOURCE("image_engine_color_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() -GPU_SHADER_INTERFACE_INFO(image_engine_depth_iface).smooth(Type::VEC2, "uv_image"); +GPU_SHADER_INTERFACE_INFO(image_engine_depth_iface) +SMOOTH(VEC2, uv_image) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(image_engine_depth_shader) - .vertex_in(0, Type::IVEC2, "pos") - .vertex_in(1, Type::VEC2, "uv") - .vertex_out(image_engine_depth_iface) - .push_constant(Type::VEC4, "min_max_uv") - .vertex_source("image_engine_depth_vert.glsl") - .fragment_source("image_engine_depth_frag.glsl") - .additional_info("draw_modelmat") - .depth_write(DepthWrite::ANY) - .do_static_compilation(true); +VERTEX_IN(0, IVEC2, pos) +VERTEX_IN(1, VEC2, uv) +VERTEX_OUT(image_engine_depth_iface) +PUSH_CONSTANT(VEC4, min_max_uv) +VERTEX_SOURCE("image_engine_depth_vert.glsl") +FRAGMENT_SOURCE("image_engine_depth_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +DEPTH_WRITE(DepthWrite::ANY) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_antialiasing_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_antialiasing_info.hh index feb06145300..11004b510ba 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_antialiasing_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_antialiasing_info.hh @@ -5,21 +5,23 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(overlay_antialiasing) - .do_static_compilation(true) - .sampler(0, ImageType::DEPTH_2D, "depthTex") - .sampler(1, ImageType::FLOAT_2D, "colorTex") - .sampler(2, ImageType::FLOAT_2D, "lineTex") - .push_constant(Type::BOOL, "doSmoothLines") - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_source("overlay_antialiasing_frag.glsl") - .additional_info("draw_fullscreen") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +SAMPLER(0, DEPTH_2D, depthTex) +SAMPLER(1, FLOAT_2D, colorTex) +SAMPLER(2, FLOAT_2D, lineTex) +PUSH_CONSTANT(BOOL, doSmoothLines) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_SOURCE("overlay_antialiasing_frag.glsl") +ADDITIONAL_INFO(draw_fullscreen) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_xray_fade) - .do_static_compilation(true) - .sampler(0, ImageType::DEPTH_2D, "depthTex") - .sampler(1, ImageType::DEPTH_2D, "xrayDepthTex") - .push_constant(Type::FLOAT, "opacity") - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_source("overlay_xray_fade_frag.glsl") - .additional_info("draw_fullscreen"); +DO_STATIC_COMPILATION() +SAMPLER(0, DEPTH_2D, depthTex) +SAMPLER(1, DEPTH_2D, xrayDepthTex) +PUSH_CONSTANT(FLOAT, opacity) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_SOURCE("overlay_xray_fade_frag.glsl") +ADDITIONAL_INFO(draw_fullscreen) +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_armature_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_armature_info.hh index 93daa6bd487..b45d1d6c249 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_armature_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_armature_info.hh @@ -5,64 +5,72 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(overlay_frag_output) - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "lineOutput"); +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, lineOutput) +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(overlay_armature_wire_iface) - .flat(Type::VEC4, "finalColor") - .flat(Type::VEC2, "edgeStart") - .no_perspective(Type::VEC2, "edgePos"); +FLAT(VEC4, finalColor) +FLAT(VEC2, edgeStart) +NO_PERSPECTIVE(VEC2, edgePos) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_armature_common) - .push_constant(Type::FLOAT, "alpha") - .additional_info("draw_view"); +PUSH_CONSTANT(FLOAT, alpha) +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() /* -------------------------------------------------------------------- */ /** \name Armature Sphere * \{ */ GPU_SHADER_CREATE_INFO(overlay_armature_sphere_outline) - .do_static_compilation(true) - .vertex_in(0, Type::VEC2, "pos") - /* Per instance. */ - .vertex_in(1, Type::MAT4, "inst_obmat") - .vertex_out(overlay_armature_wire_iface) - .vertex_source("overlay_armature_sphere_outline_vert.glsl") - .fragment_source("overlay_armature_wire_frag.glsl") - .additional_info("overlay_frag_output") - .additional_info("overlay_armature_common") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC2, pos) +/* Per instance. */ +VERTEX_IN(1, MAT4, inst_obmat) +VERTEX_OUT(overlay_armature_wire_iface) +VERTEX_SOURCE("overlay_armature_sphere_outline_vert.glsl") +FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl") +ADDITIONAL_INFO(overlay_frag_output) +ADDITIONAL_INFO(overlay_armature_common) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_armature_sphere_outline_clipped) - .do_static_compilation(true) - .additional_info("overlay_armature_sphere_outline") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_armature_sphere_outline) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(overlay_armature_sphere_solid_iface) - .flat(Type::VEC3, "finalStateColor") - .flat(Type::VEC3, "finalBoneColor") - .flat(Type::MAT4, "sphereMatrix") - .smooth(Type::VEC3, "viewPosition"); +FLAT(VEC3, finalStateColor) +FLAT(VEC3, finalBoneColor) +FLAT(MAT4, sphereMatrix) +SMOOTH(VEC3, viewPosition) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_armature_sphere_solid) - .do_static_compilation(true) - .vertex_in(0, Type::VEC2, "pos") - /* Per instance. */ - .vertex_in(1, Type::VEC4, "color") - .vertex_in(2, Type::MAT4, "inst_obmat") - .depth_write(DepthWrite::GREATER) - .vertex_out(overlay_armature_sphere_solid_iface) - .vertex_source("overlay_armature_sphere_solid_vert.glsl") - .fragment_source("overlay_armature_sphere_solid_frag.glsl") - .additional_info("overlay_frag_output") - .additional_info("overlay_armature_common") - .additional_info("draw_globals") - .depth_write(DepthWrite::ANY); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC2, pos) +/* Per instance. */ +VERTEX_IN(1, VEC4, color) +VERTEX_IN(2, MAT4, inst_obmat) +DEPTH_WRITE(DepthWrite::GREATER) +VERTEX_OUT(overlay_armature_sphere_solid_iface) +VERTEX_SOURCE("overlay_armature_sphere_solid_vert.glsl") +FRAGMENT_SOURCE("overlay_armature_sphere_solid_frag.glsl") +ADDITIONAL_INFO(overlay_frag_output) +ADDITIONAL_INFO(overlay_armature_common) +ADDITIONAL_INFO(draw_globals) +DEPTH_WRITE(DepthWrite::ANY) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_armature_sphere_solid_clipped) - .do_static_compilation(true) - .additional_info("overlay_armature_sphere_solid") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_armature_sphere_solid) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -71,166 +79,185 @@ GPU_SHADER_CREATE_INFO(overlay_armature_sphere_solid_clipped) * \{ */ GPU_SHADER_NAMED_INTERFACE_INFO(overlay_armature_shape_outline_iface, geom_in) - .smooth(Type::VEC4, "pPos") - .smooth(Type::VEC3, "vPos") - .smooth(Type::VEC2, "ssPos") - .smooth(Type::VEC4, "vColSize"); +SMOOTH(VEC4, pPos) +SMOOTH(VEC3, vPos) +SMOOTH(VEC2, ssPos) +SMOOTH(VEC4, vColSize) +GPU_SHADER_INTERFACE_END() GPU_SHADER_NAMED_INTERFACE_INFO(overlay_armature_shape_outline_flat_iface, geom_flat_in) - .flat(Type::INT, "inverted"); +FLAT(INT, inverted) +GPU_SHADER_INTERFACE_END() GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_outline_no_geom_iface) - .flat(Type::VEC4, "finalColor") - .flat(Type::VEC2, "edgeStart") - .no_perspective(Type::VEC2, "edgePos"); +FLAT(VEC4, finalColor) +FLAT(VEC2, edgeStart) +NO_PERSPECTIVE(VEC2, edgePos) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - /* Per instance. */ - .vertex_in(3, Type::MAT4, "inst_obmat") - .vertex_out(overlay_armature_shape_outline_iface) - .vertex_out(overlay_armature_shape_outline_flat_iface) - .geometry_layout(PrimitiveIn::LINES_ADJACENCY, PrimitiveOut::LINE_STRIP, 2) - .geometry_out(overlay_armature_wire_iface) - .vertex_source("overlay_armature_shape_outline_vert.glsl") - .geometry_source("overlay_armature_shape_outline_geom.glsl") - .fragment_source("overlay_armature_wire_frag.glsl") - .additional_info("overlay_frag_output") - .additional_info("overlay_armature_common") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +/* Per instance. */ +VERTEX_IN(3, MAT4, inst_obmat) +VERTEX_OUT(overlay_armature_shape_outline_iface) +VERTEX_OUT(overlay_armature_shape_outline_flat_iface) +GEOMETRY_LAYOUT(PrimitiveIn::LINES_ADJACENCY, PrimitiveOut::LINE_STRIP, 2) +GEOMETRY_OUT(overlay_armature_wire_iface) +VERTEX_SOURCE("overlay_armature_shape_outline_vert.glsl") +GEOMETRY_SOURCE("overlay_armature_shape_outline_geom.glsl") +FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl") +ADDITIONAL_INFO(overlay_frag_output) +ADDITIONAL_INFO(overlay_armature_common) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - /* Per instance. */ - .vertex_in(3, Type::MAT4, "inst_obmat") - .vertex_out(overlay_armature_shape_outline_no_geom_iface) - .vertex_source("overlay_armature_shape_outline_vert_no_geom.glsl") - .fragment_source("overlay_armature_wire_frag.glsl") - .additional_info("overlay_frag_output") - .additional_info("overlay_armature_common") - .additional_info("draw_globals"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +/* Per instance. */ +VERTEX_IN(3, MAT4, inst_obmat) +VERTEX_OUT(overlay_armature_shape_outline_no_geom_iface) +VERTEX_SOURCE("overlay_armature_shape_outline_vert_no_geom.glsl") +FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl") +ADDITIONAL_INFO(overlay_frag_output) +ADDITIONAL_INFO(overlay_armature_common) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_next) - .do_static_compilation(true) - .storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY) - .storage_buf(1, Qualifier::READ, "mat4", "data_buf[]") - .push_constant(Type::IVEC2, "gpu_attr_0") - .vertex_out(overlay_armature_shape_outline_no_geom_iface) - .vertex_source("overlay_armature_shape_outline_next_vert.glsl") - .fragment_source("overlay_armature_wire_frag.glsl") - .additional_info("overlay_frag_output") - .additional_info("overlay_armature_common") - .additional_info("gpu_index_load") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY) +STORAGE_BUF(1, READ, mat4, data_buf[]) +PUSH_CONSTANT(IVEC2, gpu_attr_0) +VERTEX_OUT(overlay_armature_shape_outline_no_geom_iface) +VERTEX_SOURCE("overlay_armature_shape_outline_next_vert.glsl") +FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl") +ADDITIONAL_INFO(overlay_frag_output) +ADDITIONAL_INFO(overlay_armature_common) +ADDITIONAL_INFO(gpu_index_load) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_clipped) - .do_static_compilation(true) - .additional_info("overlay_armature_shape_outline") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_armature_shape_outline) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_clipped_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .additional_info("overlay_armature_shape_outline_no_geom") - .additional_info("drw_clipped"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_armature_shape_outline_no_geom) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_solid_iface) - .smooth(Type::VEC4, "finalColor") - .flat(Type::INT, "inverted"); +SMOOTH(VEC4, finalColor) +FLAT(INT, inverted) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_armature_shape_solid) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC3, "nor") - /* Per instance. */ - .vertex_in(2, Type::MAT4, "inst_obmat") - .depth_write(DepthWrite::GREATER) - .vertex_out(overlay_armature_shape_solid_iface) - .vertex_source("overlay_armature_shape_solid_vert.glsl") - .fragment_source("overlay_armature_shape_solid_frag.glsl") - .additional_info("overlay_frag_output") - .additional_info("overlay_armature_common") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC3, nor) +/* Per instance. */ +VERTEX_IN(2, MAT4, inst_obmat) +DEPTH_WRITE(DepthWrite::GREATER) +VERTEX_OUT(overlay_armature_shape_solid_iface) +VERTEX_SOURCE("overlay_armature_shape_solid_vert.glsl") +FRAGMENT_SOURCE("overlay_armature_shape_solid_frag.glsl") +ADDITIONAL_INFO(overlay_frag_output) +ADDITIONAL_INFO(overlay_armature_common) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_armature_shape_solid_clipped) - .do_static_compilation(true) - .additional_info("overlay_armature_shape_solid") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_armature_shape_solid) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_wire_next_iface) - .flat(Type::VEC4, "finalColor") - .flat(Type::FLOAT, "wire_width") - .no_perspective(Type::FLOAT, "edgeCoord"); +FLAT(VEC4, finalColor) +FLAT(FLOAT, wire_width) +NO_PERSPECTIVE(FLOAT, edgeCoord) +GPU_SHADER_INTERFACE_END() GPU_SHADER_NAMED_INTERFACE_INFO(overlay_armature_shape_wire_iface, geometry_in) - .flat(Type::VEC4, "finalColor") - .flat(Type::FLOAT, "wire_width"); +FLAT(VEC4, finalColor) +FLAT(FLOAT, wire_width) +GPU_SHADER_INTERFACE_END() GPU_SHADER_NAMED_INTERFACE_INFO(overlay_armature_shape_wire_geom_iface, geometry_out) - .flat(Type::VEC4, "finalColor") - .flat(Type::FLOAT, "wire_width"); +FLAT(VEC4, finalColor) +FLAT(FLOAT, wire_width) +GPU_SHADER_INTERFACE_END() GPU_SHADER_NAMED_INTERFACE_INFO(overlay_armature_shape_wire_geom_noperspective_iface, geometry_noperspective_out) - .no_perspective(Type::FLOAT, "edgeCoord"); +NO_PERSPECTIVE(FLOAT, edgeCoord) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire) - .do_static_compilation(true) - .push_constant(Type::BOOL, "do_smooth_wire") - .vertex_in(0, Type::VEC3, "pos") - /* Per instance. */ - .vertex_in(2, Type::MAT4, "inst_obmat") - .vertex_out(overlay_armature_shape_wire_iface) - .vertex_source("overlay_armature_shape_wire_vert.glsl") - .geometry_out(overlay_armature_shape_wire_geom_iface) - .geometry_out(overlay_armature_shape_wire_geom_noperspective_iface) - .geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) - .geometry_source("overlay_armature_shape_wire_geom.glsl") - .fragment_source("overlay_armature_shape_wire_frag.glsl") - .typedef_source("overlay_shader_shared.h") - .additional_info("overlay_frag_output") - .additional_info("overlay_armature_common") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +PUSH_CONSTANT(BOOL, do_smooth_wire) +VERTEX_IN(0, VEC3, pos) +/* Per instance. */ +VERTEX_IN(2, MAT4, inst_obmat) +VERTEX_OUT(overlay_armature_shape_wire_iface) +VERTEX_SOURCE("overlay_armature_shape_wire_vert.glsl") +GEOMETRY_OUT(overlay_armature_shape_wire_geom_iface) +GEOMETRY_OUT(overlay_armature_shape_wire_geom_noperspective_iface) +GEOMETRY_LAYOUT(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) +GEOMETRY_SOURCE("overlay_armature_shape_wire_geom.glsl") +FRAGMENT_SOURCE("overlay_armature_shape_wire_frag.glsl") +TYPEDEF_SOURCE("overlay_shader_shared.h") +ADDITIONAL_INFO(overlay_frag_output) +ADDITIONAL_INFO(overlay_armature_common) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire_clipped) - .do_static_compilation(true) - .additional_info("overlay_armature_shape_wire") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_armature_shape_wire) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .push_constant(Type::BOOL, "do_smooth_wire") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(2, Type::MAT4, "inst_obmat") - .vertex_out(overlay_armature_wire_iface) - .vertex_source("overlay_armature_shape_wire_vert_no_geom.glsl") - .fragment_source("overlay_armature_wire_frag.glsl") - .typedef_source("overlay_shader_shared.h") - .additional_info("overlay_frag_output") - .additional_info("overlay_armature_common") - .additional_info("draw_globals"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +PUSH_CONSTANT(BOOL, do_smooth_wire) +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(2, MAT4, inst_obmat) +VERTEX_OUT(overlay_armature_wire_iface) +VERTEX_SOURCE("overlay_armature_shape_wire_vert_no_geom.glsl") +FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl") +TYPEDEF_SOURCE("overlay_shader_shared.h") +ADDITIONAL_INFO(overlay_frag_output) +ADDITIONAL_INFO(overlay_armature_common) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() #endif GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire_next) - .do_static_compilation(true) - .define("NO_GEOM") - .push_constant(Type::BOOL, "do_smooth_wire") - .storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY) - .storage_buf(1, Qualifier::READ, "mat4", "data_buf[]") - .push_constant(Type::IVEC2, "gpu_attr_0") - .define("inst_obmat", "data_buf[gl_InstanceID]") - .vertex_out(overlay_armature_shape_wire_next_iface) - .vertex_source("overlay_armature_shape_wire_next_vert.glsl") - .fragment_source("overlay_armature_shape_wire_frag.glsl") - .typedef_source("overlay_shader_shared.h") - .additional_info("overlay_frag_output") - .additional_info("overlay_armature_common") - .additional_info("gpu_index_load") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +DEFINE("NO_GEOM") +PUSH_CONSTANT(BOOL, do_smooth_wire) +STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY) +STORAGE_BUF(1, READ, mat4, data_buf[]) +PUSH_CONSTANT(IVEC2, gpu_attr_0) +DEFINE_VALUE("inst_obmat", "data_buf[gl_InstanceID]") +VERTEX_OUT(overlay_armature_shape_wire_next_iface) +VERTEX_SOURCE("overlay_armature_shape_wire_next_vert.glsl") +FRAGMENT_SOURCE("overlay_armature_shape_wire_frag.glsl") +TYPEDEF_SOURCE("overlay_shader_shared.h") +ADDITIONAL_INFO(overlay_frag_output) +ADDITIONAL_INFO(overlay_armature_common) +ADDITIONAL_INFO(gpu_index_load) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() /** \} */ @@ -239,54 +266,59 @@ GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire_next) * \{ */ GPU_SHADER_CREATE_INFO(overlay_armature_envelope_outline) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - .vertex_in(0, Type::VEC2, "pos0") - .vertex_in(1, Type::VEC2, "pos1") - .vertex_in(2, Type::VEC2, "pos2") - /* Per instance. */ - .vertex_in(3, Type::VEC4, "headSphere") - .vertex_in(4, Type::VEC4, "tailSphere") - .vertex_in(5, Type::VEC4, "outlineColorSize") - .vertex_in(6, Type::VEC3, "xAxis") - .vertex_out(overlay_armature_wire_iface) - .vertex_source("overlay_armature_envelope_outline_vert.glsl") - .fragment_source("overlay_armature_wire_frag.glsl") - .additional_info("overlay_frag_output") - .additional_info("overlay_armature_common") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +VERTEX_IN(0, VEC2, pos0) +VERTEX_IN(1, VEC2, pos1) +VERTEX_IN(2, VEC2, pos2) +/* Per instance. */ +VERTEX_IN(3, VEC4, headSphere) +VERTEX_IN(4, VEC4, tailSphere) +VERTEX_IN(5, VEC4, outlineColorSize) +VERTEX_IN(6, VEC3, xAxis) +VERTEX_OUT(overlay_armature_wire_iface) +VERTEX_SOURCE("overlay_armature_envelope_outline_vert.glsl") +FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl") +ADDITIONAL_INFO(overlay_frag_output) +ADDITIONAL_INFO(overlay_armature_common) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_armature_envelope_outline_clipped) - .do_static_compilation(true) - .additional_info("overlay_armature_envelope_outline") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_armature_envelope_outline) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(overlay_armature_envelope_solid_iface) - .flat(Type::VEC3, "finalStateColor") - .flat(Type::VEC3, "finalBoneColor") - .smooth(Type::VEC3, "normalView"); +FLAT(VEC3, finalStateColor) +FLAT(VEC3, finalBoneColor) +SMOOTH(VEC3, normalView) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_armature_envelope_solid) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - .vertex_in(0, Type::VEC3, "pos") - /* Per instance. Assumed to be in world coordinate already. */ - .vertex_in(1, Type::VEC4, "headSphere") - .vertex_in(2, Type::VEC4, "tailSphere") - .vertex_in(3, Type::VEC3, "xAxis") - .vertex_in(4, Type::VEC3, "stateColor") - .vertex_in(5, Type::VEC3, "boneColor") - .vertex_out(overlay_armature_envelope_solid_iface) - .push_constant(Type::BOOL, "isDistance") - .vertex_source("overlay_armature_envelope_solid_vert.glsl") - .fragment_source("overlay_armature_envelope_solid_frag.glsl") - .additional_info("overlay_frag_output") - .additional_info("overlay_armature_common"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +VERTEX_IN(0, VEC3, pos) +/* Per instance. Assumed to be in world coordinate already. */ +VERTEX_IN(1, VEC4, headSphere) +VERTEX_IN(2, VEC4, tailSphere) +VERTEX_IN(3, VEC3, xAxis) +VERTEX_IN(4, VEC3, stateColor) +VERTEX_IN(5, VEC3, boneColor) +VERTEX_OUT(overlay_armature_envelope_solid_iface) +PUSH_CONSTANT(BOOL, isDistance) +VERTEX_SOURCE("overlay_armature_envelope_solid_vert.glsl") +FRAGMENT_SOURCE("overlay_armature_envelope_solid_frag.glsl") +ADDITIONAL_INFO(overlay_frag_output) +ADDITIONAL_INFO(overlay_armature_common) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_armature_envelope_solid_clipped) - .do_static_compilation(true) - .additional_info("overlay_armature_envelope_solid") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_armature_envelope_solid) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -295,36 +327,39 @@ GPU_SHADER_CREATE_INFO(overlay_armature_envelope_solid_clipped) * \{ */ GPU_SHADER_INTERFACE_INFO(overlay_armature_stick_iface) - .no_perspective(Type::FLOAT, "colorFac") - .flat(Type::VEC4, "finalWireColor") - .flat(Type::VEC4, "finalInnerColor"); +NO_PERSPECTIVE(FLOAT, colorFac) +FLAT(VEC4, finalWireColor) +FLAT(VEC4, finalInnerColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_armature_stick) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - /* Bone aligned screen space. */ - .vertex_in(0, Type::VEC2, "pos") - .vertex_in(1, Type::UINT, "flag") - /* Per instance. Assumed to be in world coordinate already. */ - .vertex_in(2, Type::VEC3, "boneStart") - .vertex_in(3, Type::VEC3, "boneEnd") - /* alpha encode if we do wire. If 0.0 we don't. */ - .vertex_in(4, Type::VEC4, "wireColor") - .vertex_in(5, Type::VEC4, "boneColor") - .vertex_in(6, Type::VEC4, "headColor") - .vertex_in(7, Type::VEC4, "tailColor") - .define("do_wire", "(wireColor.a > 0.0)") - .vertex_out(overlay_armature_stick_iface) - .vertex_source("overlay_armature_stick_vert.glsl") - .fragment_source("overlay_armature_stick_frag.glsl") - .additional_info("overlay_frag_output") - .additional_info("overlay_armature_common") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +/* Bone aligned screen space. */ +VERTEX_IN(0, VEC2, pos) +VERTEX_IN(1, UINT, flag) +/* Per instance. Assumed to be in world coordinate already. */ +VERTEX_IN(2, VEC3, boneStart) +VERTEX_IN(3, VEC3, boneEnd) +/* alpha encode if we do wire. If 0.0 we don't. */ +VERTEX_IN(4, VEC4, wireColor) +VERTEX_IN(5, VEC4, boneColor) +VERTEX_IN(6, VEC4, headColor) +VERTEX_IN(7, VEC4, tailColor) +DEFINE_VALUE("do_wire", "(wireColor.a > 0.0)") +VERTEX_OUT(overlay_armature_stick_iface) +VERTEX_SOURCE("overlay_armature_stick_vert.glsl") +FRAGMENT_SOURCE("overlay_armature_stick_frag.glsl") +ADDITIONAL_INFO(overlay_frag_output) +ADDITIONAL_INFO(overlay_armature_common) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_armature_stick_clipped) - .do_static_compilation(true) - .additional_info("overlay_armature_stick") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_armature_stick) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -333,23 +368,25 @@ GPU_SHADER_CREATE_INFO(overlay_armature_stick_clipped) * \{ */ GPU_SHADER_CREATE_INFO(overlay_armature_dof) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - .vertex_in(0, Type::VEC2, "pos") - /* Per instance. Assumed to be in world coordinate already. */ - .vertex_in(1, Type::VEC4, "color") - .vertex_in(2, Type::MAT4, "inst_obmat") - .vertex_out(overlay_armature_wire_iface) - .vertex_source("overlay_armature_dof_vert.glsl") - .fragment_source("overlay_armature_dof_solid_frag.glsl") - .additional_info("overlay_frag_output") - .additional_info("overlay_armature_common") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +VERTEX_IN(0, VEC2, pos) +/* Per instance. Assumed to be in world coordinate already. */ +VERTEX_IN(1, VEC4, color) +VERTEX_IN(2, MAT4, inst_obmat) +VERTEX_OUT(overlay_armature_wire_iface) +VERTEX_SOURCE("overlay_armature_dof_vert.glsl") +FRAGMENT_SOURCE("overlay_armature_dof_solid_frag.glsl") +ADDITIONAL_INFO(overlay_frag_output) +ADDITIONAL_INFO(overlay_armature_common) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_armature_dof_clipped) - .do_static_compilation(true) - .additional_info("overlay_armature_dof") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_armature_dof) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -358,21 +395,23 @@ GPU_SHADER_CREATE_INFO(overlay_armature_dof_clipped) * \{ */ GPU_SHADER_CREATE_INFO(overlay_armature_wire) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC4, "color") - .push_constant(Type::FLOAT, "alpha") - .vertex_out(overlay_armature_wire_iface) - .vertex_source("overlay_armature_wire_vert.glsl") - .fragment_source("overlay_armature_wire_frag.glsl") - .additional_info("overlay_frag_output") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC4, color) +PUSH_CONSTANT(FLOAT, alpha) +VERTEX_OUT(overlay_armature_wire_iface) +VERTEX_SOURCE("overlay_armature_wire_vert.glsl") +FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl") +ADDITIONAL_INFO(overlay_frag_output) +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_armature_wire_clipped) - .do_static_compilation(true) - .additional_info("overlay_armature_wire") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_armature_wire) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_background_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_background_info.hh index ab179baf277..d5f15e27f8b 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_background_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_background_info.hh @@ -5,22 +5,24 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(overlay_background) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - .sampler(0, ImageType::FLOAT_2D, "colorBuffer") - .sampler(1, ImageType::DEPTH_2D, "depthBuffer") - .push_constant(Type::INT, "bgType") - .push_constant(Type::VEC4, "colorOverride") - .fragment_source("overlay_background_frag.glsl") - .fragment_out(0, Type::VEC4, "fragColor") - .additional_info("draw_fullscreen") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +SAMPLER(0, FLOAT_2D, colorBuffer) +SAMPLER(1, DEPTH_2D, depthBuffer) +PUSH_CONSTANT(INT, bgType) +PUSH_CONSTANT(VEC4, colorOverride) +FRAGMENT_SOURCE("overlay_background_frag.glsl") +FRAGMENT_OUT(0, VEC4, fragColor) +ADDITIONAL_INFO(draw_fullscreen) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_clipbound) - .do_static_compilation(true) - .push_constant(Type::VEC4, "ucolor") - .push_constant(Type::VEC3, "boundbox", 8) - .vertex_source("overlay_clipbound_vert.glsl") - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_source("overlay_uniform_color_frag.glsl") - .additional_info("draw_view"); +DO_STATIC_COMPILATION() +PUSH_CONSTANT(VEC4, ucolor) +PUSH_CONSTANT_ARRAY(VEC3, boundbox, 8) +VERTEX_SOURCE("overlay_clipbound_vert.glsl") +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_SOURCE("overlay_uniform_color_frag.glsl") +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh index f6ab857a1ae..bf2765c5cc7 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh @@ -4,328 +4,368 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(overlay_edit_flat_color_iface).flat(Type::VEC4, "finalColor"); -GPU_SHADER_INTERFACE_INFO(overlay_edit_smooth_color_iface).smooth(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_edit_flat_color_iface) +FLAT(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() +GPU_SHADER_INTERFACE_INFO(overlay_edit_smooth_color_iface) +SMOOTH(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_INTERFACE_INFO(overlay_edit_nopersp_color_iface) - .no_perspective(Type::VEC4, "finalColor"); +NO_PERSPECTIVE(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() /* -------------------------------------------------------------------- */ /** \name Edit Mesh * \{ */ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_common) - .define("blender_srgb_to_framebuffer_space(a)", "a") - .sampler(0, ImageType::DEPTH_2D, "depthTex") - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::BOOL, "wireShading") - .push_constant(Type::BOOL, "selectFace") - .push_constant(Type::BOOL, "selectEdge") - .push_constant(Type::FLOAT, "alpha") - .push_constant(Type::FLOAT, "retopologyOffset") - .push_constant(Type::IVEC4, "dataMask") - .additional_info("draw_globals"); +DEFINE_VALUE("blender_srgb_to_framebuffer_space(a)", "a") +SAMPLER(0, DEPTH_2D, depthTex) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(BOOL, wireShading) +PUSH_CONSTANT(BOOL, selectFace) +PUSH_CONSTANT(BOOL, selectEdge) +PUSH_CONSTANT(FLOAT, alpha) +PUSH_CONSTANT(FLOAT, retopologyOffset) +PUSH_CONSTANT(IVEC4, dataMask) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_edit_mesh_common_no_geom) - .metal_backend_only(true) - .define("blender_srgb_to_framebuffer_space(a)", "a") - .sampler(0, ImageType::DEPTH_2D, "depthTex") - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::BOOL, "wireShading") - .push_constant(Type::BOOL, "selectFace") - .push_constant(Type::BOOL, "selectEdge") - .push_constant(Type::FLOAT, "alpha") - .push_constant(Type::FLOAT, "retopologyOffset") - .push_constant(Type::IVEC4, "dataMask") - .vertex_source("overlay_edit_mesh_vert_no_geom.glsl") - .additional_info("draw_globals"); +METAL_BACKEND_ONLY() +DEFINE_VALUE("blender_srgb_to_framebuffer_space(a)", "a") +SAMPLER(0, DEPTH_2D, depthTex) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(BOOL, wireShading) +PUSH_CONSTANT(BOOL, selectFace) +PUSH_CONSTANT(BOOL, selectEdge) +PUSH_CONSTANT(FLOAT, alpha) +PUSH_CONSTANT(FLOAT, retopologyOffset) +PUSH_CONSTANT(IVEC4, dataMask) +VERTEX_SOURCE("overlay_edit_mesh_vert_no_geom.glsl") +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() #endif GPU_SHADER_CREATE_INFO(overlay_edit_mesh_depth) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .push_constant(Type::FLOAT, "retopologyOffset") - .vertex_source("overlay_edit_mesh_depth_vert.glsl") - .fragment_source("overlay_depth_only_frag.glsl") - .additional_info("draw_mesh"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +PUSH_CONSTANT(FLOAT, retopologyOffset) +VERTEX_SOURCE("overlay_edit_mesh_depth_vert.glsl") +FRAGMENT_SOURCE("overlay_depth_only_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_depth_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_mesh_depth") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_mesh_depth) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_vert_iface) - .smooth(Type::VEC4, "finalColor") - .smooth(Type::FLOAT, "vertexCrease"); +SMOOTH(VEC4, finalColor) +SMOOTH(FLOAT, vertexCrease) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_vert) - .do_static_compilation(true) - .builtins(BuiltinBits::POINT_SIZE) - .define("VERT") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::UVEC4, "data") - .vertex_in(2, Type::VEC3, "vnor") - .vertex_source("overlay_edit_mesh_vert.glsl") - .vertex_out(overlay_edit_mesh_vert_iface) - .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_modelmat") - .additional_info("overlay_edit_mesh_common"); +DO_STATIC_COMPILATION() +BUILTINS(BuiltinBits::POINT_SIZE) +DEFINE("VERT") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, UVEC4, data) +VERTEX_IN(2, VEC3, vnor) +VERTEX_SOURCE("overlay_edit_mesh_vert.glsl") +VERTEX_OUT(overlay_edit_mesh_vert_iface) +FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(overlay_edit_mesh_common) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_vert_next) - .do_static_compilation(true) - .builtins(BuiltinBits::POINT_SIZE) - .define("VERT") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::UVEC4, "data") - .vertex_in(2, Type::VEC3, "vnor") - .vertex_source("overlay_edit_mesh_vertex_vert.glsl") - .vertex_out(overlay_edit_mesh_vert_iface) - .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new") - .additional_info("overlay_edit_mesh_common"); +DO_STATIC_COMPILATION() +BUILTINS(BuiltinBits::POINT_SIZE) +DEFINE("VERT") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, UVEC4, data) +VERTEX_IN(2, VEC3, vnor) +VERTEX_SOURCE("overlay_edit_mesh_vertex_vert.glsl") +VERTEX_OUT(overlay_edit_mesh_vert_iface) +FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(overlay_edit_mesh_common) +GPU_SHADER_CREATE_END() GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_mesh_edge_iface, geometry_in) - .smooth(Type::VEC4, "finalColor_") - .smooth(Type::VEC4, "finalColorOuter_") - .smooth(Type::UINT, "selectOverride_"); +SMOOTH(VEC4, finalColor_) +SMOOTH(VEC4, finalColorOuter_) +SMOOTH(UINT, selectOverride_) +GPU_SHADER_INTERFACE_END() GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_mesh_edge_geom_iface, geometry_out) - .smooth(Type::VEC4, "finalColor"); +SMOOTH(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_mesh_edge_geom_flat_iface, geometry_flat_out) - .flat(Type::VEC4, "finalColorOuter"); +FLAT(VEC4, finalColorOuter) +GPU_SHADER_INTERFACE_END() GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_mesh_edge_geom_noperspective_iface, geometry_noperspective_out) - .no_perspective(Type::FLOAT, "edgeCoord"); +NO_PERSPECTIVE(FLOAT, edgeCoord) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge) - .do_static_compilation(true) - .define("EDGE") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::UVEC4, "data") - .vertex_in(2, Type::VEC3, "vnor") - .push_constant(Type::BOOL, "do_smooth_wire") - .vertex_source("overlay_edit_mesh_vert.glsl") - .vertex_out(overlay_edit_mesh_edge_iface) - .geometry_out(overlay_edit_mesh_edge_geom_iface) - .geometry_out(overlay_edit_mesh_edge_geom_flat_iface) - .geometry_out(overlay_edit_mesh_edge_geom_noperspective_iface) - .geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) - .geometry_source("overlay_edit_mesh_geom.glsl") - .fragment_source("overlay_edit_mesh_frag.glsl") - .additional_info("draw_modelmat") - .additional_info("overlay_edit_mesh_common"); +DO_STATIC_COMPILATION() +DEFINE("EDGE") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, UVEC4, data) +VERTEX_IN(2, VEC3, vnor) +PUSH_CONSTANT(BOOL, do_smooth_wire) +VERTEX_SOURCE("overlay_edit_mesh_vert.glsl") +VERTEX_OUT(overlay_edit_mesh_edge_iface) +GEOMETRY_OUT(overlay_edit_mesh_edge_geom_iface) +GEOMETRY_OUT(overlay_edit_mesh_edge_geom_flat_iface) +GEOMETRY_OUT(overlay_edit_mesh_edge_geom_noperspective_iface) +GEOMETRY_LAYOUT(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) +GEOMETRY_SOURCE("overlay_edit_mesh_geom.glsl") +FRAGMENT_SOURCE("overlay_edit_mesh_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(overlay_edit_mesh_common) +GPU_SHADER_CREATE_END() /* The Non-Geometry shader variant passes directly to fragment. */ #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .define("EDGE") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::UCHAR4, "data") - .vertex_in(2, Type::VEC3_101010I2, "vnor") - .push_constant(Type::BOOL, "do_smooth_wire") - .vertex_out(overlay_edit_mesh_edge_geom_iface) - .vertex_out(overlay_edit_mesh_edge_geom_flat_iface) - .vertex_out(overlay_edit_mesh_edge_geom_noperspective_iface) - .fragment_source("overlay_edit_mesh_frag.glsl") - .additional_info("draw_modelmat") - .additional_info("overlay_edit_mesh_common_no_geom"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +DEFINE("EDGE") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, UCHAR4, data) +VERTEX_IN(2, VEC3_101010I2, vnor) +PUSH_CONSTANT(BOOL, do_smooth_wire) +VERTEX_OUT(overlay_edit_mesh_edge_geom_iface) +VERTEX_OUT(overlay_edit_mesh_edge_geom_flat_iface) +VERTEX_OUT(overlay_edit_mesh_edge_geom_noperspective_iface) +FRAGMENT_SOURCE("overlay_edit_mesh_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(overlay_edit_mesh_common_no_geom) +GPU_SHADER_CREATE_END() #endif /* Vertex Pull version for overlay next. */ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_next) - .do_static_compilation(true) - .define("EDGE") - .storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY) - .storage_buf(1, Qualifier::READ, "uint", "vnor[]", Frequency::GEOMETRY) - .storage_buf(2, Qualifier::READ, "uint", "data[]", Frequency::GEOMETRY) - .push_constant(Type::IVEC2, "gpu_attr_0") - .push_constant(Type::IVEC2, "gpu_attr_1") - .push_constant(Type::IVEC2, "gpu_attr_2") - .push_constant(Type::BOOL, "do_smooth_wire") - .push_constant(Type::BOOL, "use_vertex_selection") - .vertex_out(overlay_edit_mesh_edge_geom_iface) - .vertex_out(overlay_edit_mesh_edge_geom_flat_iface) - .vertex_out(overlay_edit_mesh_edge_geom_noperspective_iface) - .vertex_source("overlay_edit_mesh_edge_vert.glsl") - .fragment_source("overlay_edit_mesh_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new") - .additional_info("gpu_index_load") - .additional_info("overlay_edit_mesh_common"); +DO_STATIC_COMPILATION() +DEFINE("EDGE") +STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY) +STORAGE_BUF_FREQ(1, READ, uint, vnor[], GEOMETRY) +STORAGE_BUF_FREQ(2, READ, uint, data[], GEOMETRY) +PUSH_CONSTANT(IVEC2, gpu_attr_0) +PUSH_CONSTANT(IVEC2, gpu_attr_1) +PUSH_CONSTANT(IVEC2, gpu_attr_2) +PUSH_CONSTANT(BOOL, do_smooth_wire) +PUSH_CONSTANT(BOOL, use_vertex_selection) +VERTEX_OUT(overlay_edit_mesh_edge_geom_iface) +VERTEX_OUT(overlay_edit_mesh_edge_geom_flat_iface) +VERTEX_OUT(overlay_edit_mesh_edge_geom_noperspective_iface) +VERTEX_SOURCE("overlay_edit_mesh_edge_vert.glsl") +FRAGMENT_SOURCE("overlay_edit_mesh_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(gpu_index_load) +ADDITIONAL_INFO(overlay_edit_mesh_common) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_flat) - .do_static_compilation(true) - .define("FLAT") - .additional_info("overlay_edit_mesh_edge"); +DO_STATIC_COMPILATION() +DEFINE("FLAT") +ADDITIONAL_INFO(overlay_edit_mesh_edge) +GPU_SHADER_CREATE_END() #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_flat_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .define("FLAT") - .additional_info("overlay_edit_mesh_edge_no_geom"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +DEFINE("FLAT") +ADDITIONAL_INFO(overlay_edit_mesh_edge_no_geom) +GPU_SHADER_CREATE_END() #endif GPU_SHADER_CREATE_INFO(overlay_edit_mesh_face) - .do_static_compilation(true) - .define("FACE") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::UVEC4, "data") - .vertex_source("overlay_edit_mesh_vert.glsl") - .vertex_out(overlay_edit_flat_color_iface) - .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_modelmat") - .additional_info("overlay_edit_mesh_common"); +DO_STATIC_COMPILATION() +DEFINE("FACE") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, UVEC4, data) +VERTEX_SOURCE("overlay_edit_mesh_vert.glsl") +VERTEX_OUT(overlay_edit_flat_color_iface) +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(overlay_edit_mesh_common) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_face_next) - .do_static_compilation(true) - .define("FACE") - .define("vnor", "vec3(0.0)") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::UVEC4, "data") - .vertex_source("overlay_edit_mesh_face_vert.glsl") - .vertex_out(overlay_edit_flat_color_iface) - .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new") - .additional_info("overlay_edit_mesh_common"); +DO_STATIC_COMPILATION() +DEFINE("FACE") +DEFINE_VALUE("vnor", "vec3(0.0)") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, UVEC4, data) +VERTEX_SOURCE("overlay_edit_mesh_face_vert.glsl") +VERTEX_OUT(overlay_edit_flat_color_iface) +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(overlay_edit_mesh_common) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_facedot) - .do_static_compilation(true) - .define("FACEDOT") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::UVEC4, "data") - .vertex_in(2, Type::VEC4, "norAndFlag") - .define("vnor", "norAndFlag.xyz") - .vertex_source("overlay_edit_mesh_vert.glsl") - .vertex_out(overlay_edit_flat_color_iface) - .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_modelmat") - .additional_info("overlay_edit_mesh_common"); +DO_STATIC_COMPILATION() +DEFINE("FACEDOT") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, UVEC4, data) +VERTEX_IN(2, VEC4, norAndFlag) +DEFINE_VALUE("vnor", "norAndFlag.xyz") +VERTEX_SOURCE("overlay_edit_mesh_vert.glsl") +VERTEX_OUT(overlay_edit_flat_color_iface) +FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(overlay_edit_mesh_common) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_facedot_next) - .do_static_compilation(true) - .define("FACEDOT") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::UVEC4, "data") - .vertex_in(2, Type::VEC4, "norAndFlag") - .define("vnor", "norAndFlag.xyz") - .vertex_source("overlay_edit_mesh_facedot_vert.glsl") - .vertex_out(overlay_edit_flat_color_iface) - .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new") - .additional_info("overlay_edit_mesh_common"); +DO_STATIC_COMPILATION() +DEFINE("FACEDOT") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, UVEC4, data) +VERTEX_IN(2, VEC4, norAndFlag) +DEFINE_VALUE("vnor", "norAndFlag.xyz") +VERTEX_SOURCE("overlay_edit_mesh_facedot_vert.glsl") +VERTEX_OUT(overlay_edit_flat_color_iface) +FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(overlay_edit_mesh_common) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_normal) - .do_static_compilation(true) - .define("WORKAROUND_INDEX_LOAD_INCLUDE") - /* WORKAROUND: Needed to support OpenSubdiv vertex format. Should be removed. */ - .push_constant(Type::IVEC2, "gpu_attr_0") - .push_constant(Type::IVEC2, "gpu_attr_1") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC4, "lnor") - .vertex_in(2, Type::VEC4, "vnor") - .vertex_in(3, Type::VEC4, "norAndFlag") - .sampler(0, ImageType::DEPTH_2D, "depthTex") - .push_constant(Type::FLOAT, "normalSize") - .push_constant(Type::FLOAT, "normalScreenSize") - .push_constant(Type::FLOAT, "alpha") - .push_constant(Type::BOOL, "isConstantScreenSizeNormals") - .vertex_out(overlay_edit_flat_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_mesh_normal_vert.glsl") - .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_modelmat_instanced_attr") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +DEFINE("WORKAROUND_INDEX_LOAD_INCLUDE") +/* WORKAROUND: Needed to support OpenSubdiv vertex format. Should be removed. */ +PUSH_CONSTANT(IVEC2, gpu_attr_0) +PUSH_CONSTANT(IVEC2, gpu_attr_1) +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC4, lnor) +VERTEX_IN(2, VEC4, vnor) +VERTEX_IN(3, VEC4, norAndFlag) +SAMPLER(0, DEPTH_2D, depthTex) +PUSH_CONSTANT(FLOAT, normalSize) +PUSH_CONSTANT(FLOAT, normalScreenSize) +PUSH_CONSTANT(FLOAT, alpha) +PUSH_CONSTANT(BOOL, isConstantScreenSizeNormals) +VERTEX_OUT(overlay_edit_flat_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_mesh_normal_vert.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(draw_modelmat_instanced_attr) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() -GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_analysis_iface).smooth(Type::VEC4, "weightColor"); +GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_analysis_iface) +SMOOTH(VEC4, weightColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_analysis) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::FLOAT, "weight") - .sampler(0, ImageType::FLOAT_1D, "weightTex") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_out(overlay_edit_mesh_analysis_iface) - .vertex_source("overlay_edit_mesh_analysis_vert.glsl") - .fragment_source("overlay_edit_mesh_analysis_frag.glsl") - .additional_info("draw_modelmat"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, FLOAT, weight) +SAMPLER(0, FLOAT_1D, weightTex) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_OUT(overlay_edit_mesh_analysis_iface) +VERTEX_SOURCE("overlay_edit_mesh_analysis_vert.glsl") +FRAGMENT_SOURCE("overlay_edit_mesh_analysis_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_skin_root) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::FLOAT, "size") - .vertex_in(2, Type::VEC3, "local_pos") - .vertex_out(overlay_edit_flat_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_mesh_skin_root_vert.glsl") - .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_modelmat_instanced_attr") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, FLOAT, size) +VERTEX_IN(2, VEC3, local_pos) +VERTEX_OUT(overlay_edit_flat_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_mesh_skin_root_vert.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(draw_modelmat_instanced_attr) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_vert_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_mesh_vert") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_mesh_vert) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_mesh_edge") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_mesh_edge) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_clipped_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .additional_info("overlay_edit_mesh_edge_no_geom") - .additional_info("drw_clipped"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_mesh_edge_no_geom) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() #endif GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_flat_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_mesh_edge_flat") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_mesh_edge_flat) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_flat_clipped_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .additional_info("overlay_edit_mesh_edge_flat_no_geom") - .additional_info("drw_clipped"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_mesh_edge_flat_no_geom) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() #endif GPU_SHADER_CREATE_INFO(overlay_edit_mesh_face_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_mesh_face") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_mesh_face) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_facedot_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_mesh_facedot") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_mesh_facedot) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_normal_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_mesh_normal") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_mesh_normal) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_analysis_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_mesh_analysis") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_mesh_analysis) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_skin_root_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_mesh_skin_root") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_mesh_skin_root) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -334,166 +374,187 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_skin_root_clipped) * \{ */ GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_uv_iface, geom_in) - .smooth(Type::FLOAT, "selectionFac"); +SMOOTH(FLOAT, selectionFac) +GPU_SHADER_INTERFACE_END() GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_uv_flat_iface, geom_flat_in) - .flat(Type::VEC2, "stippleStart"); +FLAT(VEC2, stippleStart) +GPU_SHADER_INTERFACE_END() GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_uv_noperspective_iface, geom_noperspective_in) - .no_perspective(Type::VEC2, "stipplePos"); +NO_PERSPECTIVE(VEC2, stipplePos) +GPU_SHADER_INTERFACE_END() GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_uv_geom_iface, geom_out) - .smooth(Type::FLOAT, "selectionFac"); +SMOOTH(FLOAT, selectionFac) +GPU_SHADER_INTERFACE_END() GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_uv_geom_flat_iface, geom_flat_out) - .flat(Type::VEC2, "stippleStart"); +FLAT(VEC2, stippleStart) +GPU_SHADER_INTERFACE_END() GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_uv_geom_noperspective_iface, geom_noperspective_out) - .no_perspective(Type::FLOAT, "edgeCoord") - .no_perspective(Type::VEC2, "stipplePos"); +NO_PERSPECTIVE(FLOAT, edgeCoord) +NO_PERSPECTIVE(VEC2, stipplePos) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges_common) - .vertex_in(0, Type::VEC2, "au") - .vertex_in(1, Type::INT, "flag") - .push_constant(Type::INT, "lineStyle") - .push_constant(Type::BOOL, "doSmoothWire") - .push_constant(Type::FLOAT, "alpha") - .push_constant(Type::FLOAT, "dashLength") - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_source("overlay_edit_uv_edges_frag.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +VERTEX_IN(0, VEC2, au) +VERTEX_IN(1, INT, flag) +PUSH_CONSTANT(INT, lineStyle) +PUSH_CONSTANT(BOOL, doSmoothWire) +PUSH_CONSTANT(FLOAT, alpha) +PUSH_CONSTANT(FLOAT, dashLength) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_SOURCE("overlay_edit_uv_edges_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges) - .additional_info("overlay_edit_uv_edges_common") - .do_static_compilation(true) - .vertex_out(overlay_edit_uv_iface) - .vertex_out(overlay_edit_uv_flat_iface) - .vertex_out(overlay_edit_uv_noperspective_iface) - .geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) - .geometry_out(overlay_edit_uv_geom_iface) - .geometry_out(overlay_edit_uv_geom_flat_iface) - .geometry_out(overlay_edit_uv_geom_noperspective_iface) - .vertex_source("overlay_edit_uv_edges_vert.glsl") - .geometry_source("overlay_edit_uv_edges_geom.glsl"); +ADDITIONAL_INFO(overlay_edit_uv_edges_common) +DO_STATIC_COMPILATION() +VERTEX_OUT(overlay_edit_uv_iface) +VERTEX_OUT(overlay_edit_uv_flat_iface) +VERTEX_OUT(overlay_edit_uv_noperspective_iface) +GEOMETRY_LAYOUT(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) +GEOMETRY_OUT(overlay_edit_uv_geom_iface) +GEOMETRY_OUT(overlay_edit_uv_geom_flat_iface) +GEOMETRY_OUT(overlay_edit_uv_geom_noperspective_iface) +VERTEX_SOURCE("overlay_edit_uv_edges_vert.glsl") +GEOMETRY_SOURCE("overlay_edit_uv_edges_geom.glsl") +GPU_SHADER_CREATE_END() #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges_no_geom) - .metal_backend_only(true) - .additional_info("overlay_edit_uv_edges_common") - .do_static_compilation(true) - .vertex_out(overlay_edit_uv_geom_iface) - .vertex_out(overlay_edit_uv_geom_flat_iface) - .vertex_out(overlay_edit_uv_geom_noperspective_iface) - .vertex_source("overlay_edit_uv_edges_vert_no_geom.glsl"); +METAL_BACKEND_ONLY() +ADDITIONAL_INFO(overlay_edit_uv_edges_common) +DO_STATIC_COMPILATION() +VERTEX_OUT(overlay_edit_uv_geom_iface) +VERTEX_OUT(overlay_edit_uv_geom_flat_iface) +VERTEX_OUT(overlay_edit_uv_geom_noperspective_iface) +VERTEX_SOURCE("overlay_edit_uv_edges_vert_no_geom.glsl") +GPU_SHADER_CREATE_END() #endif GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges_select) - .do_static_compilation(true) - .define("USE_EDGE_SELECT") - .additional_info("overlay_edit_uv_edges"); +DO_STATIC_COMPILATION() +DEFINE("USE_EDGE_SELECT") +ADDITIONAL_INFO(overlay_edit_uv_edges) +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(overlay_edit_uv_next_iface) - .smooth(Type::FLOAT, "selectionFac") - .flat(Type::VEC2, "stippleStart") - .no_perspective(Type::FLOAT, "edgeCoord") - .no_perspective(Type::VEC2, "stipplePos"); +SMOOTH(FLOAT, selectionFac) +FLAT(VEC2, stippleStart) +NO_PERSPECTIVE(FLOAT, edgeCoord) +NO_PERSPECTIVE(VEC2, stipplePos) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges_next) - .do_static_compilation(true) - .storage_buf(0, Qualifier::READ, "float", "au[]", Frequency::GEOMETRY) - .storage_buf(1, Qualifier::READ, "uint", "data[]", Frequency::GEOMETRY) - .push_constant(Type::IVEC2, "gpu_attr_0") - .push_constant(Type::IVEC2, "gpu_attr_1") - .push_constant(Type::INT, "lineStyle") - .push_constant(Type::BOOL, "doSmoothWire") - .push_constant(Type::FLOAT, "alpha") - .push_constant(Type::FLOAT, "dashLength") - .specialization_constant(Type::BOOL, "use_edge_select", false) - .vertex_out(overlay_edit_uv_next_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_uv_edges_next_vert.glsl") - .fragment_source("overlay_edit_uv_edges_next_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new") - .additional_info("gpu_index_load") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +STORAGE_BUF_FREQ(0, READ, float, au[], GEOMETRY) +STORAGE_BUF_FREQ(1, READ, uint, data[], GEOMETRY) +PUSH_CONSTANT(IVEC2, gpu_attr_0) +PUSH_CONSTANT(IVEC2, gpu_attr_1) +PUSH_CONSTANT(INT, lineStyle) +PUSH_CONSTANT(BOOL, doSmoothWire) +PUSH_CONSTANT(FLOAT, alpha) +PUSH_CONSTANT(FLOAT, dashLength) +SPECIALIZATION_CONSTANT(BOOL, use_edge_select, false) +VERTEX_OUT(overlay_edit_uv_next_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_uv_edges_next_vert.glsl") +FRAGMENT_SOURCE("overlay_edit_uv_edges_next_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(gpu_index_load) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_uv_faces) - .do_static_compilation(true) - .vertex_in(0, Type::VEC2, "au") - .vertex_in(1, Type::UINT, "flag") - .push_constant(Type::FLOAT, "uvOpacity") - .vertex_out(overlay_edit_flat_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_uv_faces_vert.glsl") - .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC2, au) +VERTEX_IN(1, UINT, flag) +PUSH_CONSTANT(FLOAT, uvOpacity) +VERTEX_OUT(overlay_edit_flat_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_uv_faces_vert.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_uv_face_dots) - .do_static_compilation(true) - .vertex_in(0, Type::VEC2, "au") - .vertex_in(1, Type::UINT, "flag") - .push_constant(Type::FLOAT, "pointSize") - .vertex_out(overlay_edit_flat_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_uv_face_dots_vert.glsl") - .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC2, au) +VERTEX_IN(1, UINT, flag) +PUSH_CONSTANT(FLOAT, pointSize) +VERTEX_OUT(overlay_edit_flat_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_uv_face_dots_vert.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(overlay_edit_uv_vert_iface) - .smooth(Type::VEC4, "fillColor") - .smooth(Type::VEC4, "outlineColor") - .smooth(Type::VEC4, "radii"); +SMOOTH(VEC4, fillColor) +SMOOTH(VEC4, outlineColor) +SMOOTH(VEC4, radii) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_edit_uv_verts) - .do_static_compilation(true) - .vertex_in(0, Type::VEC2, "au") - .vertex_in(1, Type::UINT, "flag") - .push_constant(Type::FLOAT, "pointSize") - .push_constant(Type::FLOAT, "outlineWidth") - .push_constant(Type::VEC4, "color") - .vertex_out(overlay_edit_uv_vert_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_uv_verts_vert.glsl") - .fragment_source("overlay_edit_uv_verts_frag.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC2, au) +VERTEX_IN(1, UINT, flag) +PUSH_CONSTANT(FLOAT, pointSize) +PUSH_CONSTANT(FLOAT, outlineWidth) +PUSH_CONSTANT(VEC4, color) +VERTEX_OUT(overlay_edit_uv_vert_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_uv_verts_vert.glsl") +FRAGMENT_SOURCE("overlay_edit_uv_verts_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_uv_tiled_image_borders) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .push_constant(Type::VEC4, "ucolor") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_uv_tiled_image_borders_vert.glsl") - .fragment_source("overlay_uniform_color_frag.glsl") - .additional_info("draw_mesh"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +PUSH_CONSTANT(VEC4, ucolor) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_uv_tiled_image_borders_vert.glsl") +FRAGMENT_SOURCE("overlay_uniform_color_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +GPU_SHADER_CREATE_END() -GPU_SHADER_INTERFACE_INFO(edit_uv_image_iface).smooth(Type::VEC2, "uvs"); +GPU_SHADER_INTERFACE_INFO(edit_uv_image_iface) +SMOOTH(VEC2, uvs) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_edit_uv_stencil_image) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_out(edit_uv_image_iface) - .vertex_source("overlay_edit_uv_image_vert.glsl") - .sampler(0, ImageType::FLOAT_2D, "imgTexture") - .push_constant(Type::BOOL, "imgPremultiplied") - .push_constant(Type::BOOL, "imgAlphaBlend") - .push_constant(Type::VEC4, "ucolor") - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_source("overlay_image_frag.glsl") - .additional_info("draw_mesh"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_OUT(edit_uv_image_iface) +VERTEX_SOURCE("overlay_edit_uv_image_vert.glsl") +SAMPLER(0, FLOAT_2D, imgTexture) +PUSH_CONSTANT(BOOL, imgPremultiplied) +PUSH_CONSTANT(BOOL, imgAlphaBlend) +PUSH_CONSTANT(VEC4, ucolor) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_SOURCE("overlay_image_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_uv_mask_image) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_out(edit_uv_image_iface) - .sampler(0, ImageType::FLOAT_2D, "imgTexture") - .push_constant(Type::VEC4, "color") - .push_constant(Type::FLOAT, "opacity") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_uv_image_vert.glsl") - .fragment_source("overlay_edit_uv_image_mask_frag.glsl") - .additional_info("draw_mesh"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_OUT(edit_uv_image_iface) +SAMPLER(0, FLOAT_2D, imgTexture) +PUSH_CONSTANT(VEC4, color) +PUSH_CONSTANT(FLOAT, opacity) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_uv_image_vert.glsl") +FRAGMENT_SOURCE("overlay_edit_uv_image_mask_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +GPU_SHADER_CREATE_END() /** \} */ @@ -502,31 +563,34 @@ GPU_SHADER_CREATE_INFO(overlay_edit_uv_mask_image) * \{ */ GPU_SHADER_CREATE_INFO(overlay_edit_uv_stretching) - .vertex_in(0, Type::VEC2, "pos") - .push_constant(Type::VEC2, "aspect") - .push_constant(Type::FLOAT, "stretch_opacity") - .vertex_out(overlay_edit_nopersp_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_uv_stretching_vert.glsl") - .fragment_source("overlay_varying_color.glsl") - .push_constant(Type::FLOAT, "totalAreaRatio"); +VERTEX_IN(0, VEC2, pos) +PUSH_CONSTANT(VEC2, aspect) +PUSH_CONSTANT(FLOAT, stretch_opacity) +VERTEX_OUT(overlay_edit_nopersp_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_uv_stretching_vert.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +PUSH_CONSTANT(FLOAT, totalAreaRatio) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_uv_stretching_area) - .do_static_compilation(true) - .vertex_in(1, Type::FLOAT, "ratio") - .push_constant(Type::FLOAT, "totalAreaRatio") - .additional_info("overlay_edit_uv_stretching") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(1, FLOAT, ratio) +PUSH_CONSTANT(FLOAT, totalAreaRatio) +ADDITIONAL_INFO(overlay_edit_uv_stretching) +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_uv_stretching_angle) - .do_static_compilation(true) - .define("STRETCH_ANGLE") - .vertex_in(1, Type::VEC2, "uv_angles") - .vertex_in(2, Type::FLOAT, "angle") - .additional_info("overlay_edit_uv_stretching") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +DEFINE("STRETCH_ANGLE") +VERTEX_IN(1, VEC2, uv_angles) +VERTEX_IN(2, FLOAT, angle) +ADDITIONAL_INFO(overlay_edit_uv_stretching) +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() /** \} */ @@ -534,136 +598,148 @@ GPU_SHADER_CREATE_INFO(overlay_edit_uv_stretching_angle) /** \name Edit Curve * \{ */ -GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_curve_handle_iface, vert).flat(Type::UINT, "flag"); +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_curve_handle_iface, vert) +FLAT(UINT, flag) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::UINT, "data") - .vertex_out(overlay_edit_curve_handle_iface) - .geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 10) - .geometry_out(overlay_edit_smooth_color_iface) - .push_constant(Type::BOOL, "showCurveHandles") - .push_constant(Type::INT, "curveHandleDisplay") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_curve_handle_vert.glsl") - .geometry_source("overlay_edit_curve_handle_geom.glsl") - .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, UINT, data) +VERTEX_OUT(overlay_edit_curve_handle_iface) +GEOMETRY_LAYOUT(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 10) +GEOMETRY_OUT(overlay_edit_smooth_color_iface) +PUSH_CONSTANT(BOOL, showCurveHandles) +PUSH_CONSTANT(INT, curveHandleDisplay) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_curve_handle_vert.glsl") +GEOMETRY_SOURCE("overlay_edit_curve_handle_geom.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - /* NOTE: Color already in Linear space. Which is what we want. */ - .define("srgbTarget", "false") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::UINT, "data") - .vertex_out(overlay_edit_smooth_color_iface) - .push_constant(Type::BOOL, "showCurveHandles") - .push_constant(Type::INT, "curveHandleDisplay") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_curve_handle_vert_no_geom.glsl") - .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +/* NOTE: Color already in Linear space. Which is what we want. */ +DEFINE_VALUE("srgbTarget", "false") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, UINT, data) +VERTEX_OUT(overlay_edit_smooth_color_iface) +PUSH_CONSTANT(BOOL, showCurveHandles) +PUSH_CONSTANT(INT, curveHandleDisplay) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_curve_handle_vert_no_geom.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() #endif GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_next) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - .storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY) - .storage_buf(1, Qualifier::READ, "uint", "data[]", Frequency::GEOMETRY) - .push_constant(Type::IVEC2, "gpu_attr_0") - .push_constant(Type::IVEC2, "gpu_attr_1") - .vertex_out(overlay_edit_smooth_color_iface) - .push_constant(Type::BOOL, "showCurveHandles") - .push_constant(Type::INT, "curveHandleDisplay") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_curve_handle_next_vert.glsl") - .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new") - .additional_info("gpu_index_load") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY) +STORAGE_BUF_FREQ(1, READ, uint, data[], GEOMETRY) +PUSH_CONSTANT(IVEC2, gpu_attr_0) +PUSH_CONSTANT(IVEC2, gpu_attr_1) +VERTEX_OUT(overlay_edit_smooth_color_iface) +PUSH_CONSTANT(BOOL, showCurveHandles) +PUSH_CONSTANT(INT, curveHandleDisplay) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_curve_handle_next_vert.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(gpu_index_load) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_curve_handle") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_curve_handle) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_clipped_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .additional_info("overlay_edit_curve_handle_no_geom") - .additional_info("drw_clipped"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_curve_handle_no_geom) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() #endif GPU_SHADER_CREATE_INFO(overlay_edit_curve_point) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::UINT, "data") - .vertex_out(overlay_edit_flat_color_iface) - .push_constant(Type::BOOL, "showCurveHandles") - .push_constant(Type::INT, "curveHandleDisplay") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_curve_point_vert.glsl") - .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, UINT, data) +VERTEX_OUT(overlay_edit_flat_color_iface) +PUSH_CONSTANT(BOOL, showCurveHandles) +PUSH_CONSTANT(INT, curveHandleDisplay) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_curve_point_vert.glsl") +FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_curve_point_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_curve_point") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_curve_point) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_curve_wire) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC3, "nor") - .vertex_in(2, Type::VEC3, "tan") - .vertex_in(3, Type::FLOAT, "rad") - .push_constant(Type::FLOAT, "normalSize") - .vertex_out(overlay_edit_flat_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_curve_wire_vert.glsl") - .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_modelmat") - .additional_info("draw_resource_id_uniform") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC3, nor) +VERTEX_IN(2, VEC3, tan) +VERTEX_IN(3, FLOAT, rad) +PUSH_CONSTANT(FLOAT, normalSize) +VERTEX_OUT(overlay_edit_flat_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_curve_wire_vert.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(draw_resource_id_uniform) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_curve_wire_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_curve_wire") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_curve_wire) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_curve_normals) - .do_static_compilation(true) - .storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY) - .storage_buf(1, Qualifier::READ, "float", "rad[]", Frequency::GEOMETRY) - .storage_buf(2, Qualifier::READ, "uint", "nor[]", Frequency::GEOMETRY) - .storage_buf(3, Qualifier::READ, "uint", "tan[]", Frequency::GEOMETRY) - .push_constant(Type::IVEC2, "gpu_attr_0") - .push_constant(Type::IVEC2, "gpu_attr_1") - .push_constant(Type::IVEC2, "gpu_attr_2") - .push_constant(Type::IVEC2, "gpu_attr_3") - .push_constant(Type::FLOAT, "normalSize") - .push_constant(Type::BOOL, "use_hq_normals") - .vertex_out(overlay_edit_flat_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_curve_wire_next_vert.glsl") - .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new") - .additional_info("gpu_index_load") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY) +STORAGE_BUF_FREQ(1, READ, float, rad[], GEOMETRY) +STORAGE_BUF_FREQ(2, READ, uint, nor[], GEOMETRY) +STORAGE_BUF_FREQ(3, READ, uint, tan[], GEOMETRY) +PUSH_CONSTANT(IVEC2, gpu_attr_0) +PUSH_CONSTANT(IVEC2, gpu_attr_1) +PUSH_CONSTANT(IVEC2, gpu_attr_2) +PUSH_CONSTANT(IVEC2, gpu_attr_3) +PUSH_CONSTANT(FLOAT, normalSize) +PUSH_CONSTANT(BOOL, use_hq_normals) +VERTEX_OUT(overlay_edit_flat_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_curve_wire_next_vert.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(gpu_index_load) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() /** \} */ @@ -672,27 +748,30 @@ GPU_SHADER_CREATE_INFO(overlay_edit_curve_normals) * \{ */ GPU_SHADER_INTERFACE_INFO(overlay_edit_curves_handle_iface) - .smooth(Type::VEC4, "finalColor") - .smooth(Type::VEC4, "leftColor"); +SMOOTH(VEC4, finalColor) +SMOOTH(VEC4, leftColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_edit_curves_handle) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::UINT, "data") - .vertex_in(2, Type::FLOAT, "selection") - .vertex_out(overlay_edit_curves_handle_iface) - .uniform_buf(0, "int", "curvesInfoBlock[4]") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_curves_handle_vert.glsl") - .fragment_source("overlay_edit_curves_handle_frag.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, UINT, data) +VERTEX_IN(2, FLOAT, selection) +VERTEX_OUT(overlay_edit_curves_handle_iface) +UNIFORM_BUF(0, int, curvesInfoBlock[4]) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_curves_handle_vert.glsl") +FRAGMENT_SOURCE("overlay_edit_curves_handle_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_curves_handle_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_curves_handle") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_curves_handle) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -701,37 +780,41 @@ GPU_SHADER_CREATE_INFO(overlay_edit_curves_handle_clipped) * \{ */ GPU_SHADER_CREATE_INFO(overlay_edit_lattice_point) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::UINT, "data") - .vertex_out(overlay_edit_flat_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_lattice_point_vert.glsl") - .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, UINT, data) +VERTEX_OUT(overlay_edit_flat_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_lattice_point_vert.glsl") +FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_lattice_point_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_lattice_point") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_lattice_point) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_lattice_wire) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::FLOAT, "weight") - .sampler(0, ImageType::FLOAT_1D, "weightTex") - .vertex_out(overlay_edit_smooth_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_lattice_wire_vert.glsl") - .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, FLOAT, weight) +SAMPLER(0, FLOAT_1D, weightTex) +VERTEX_OUT(overlay_edit_smooth_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_lattice_wire_vert.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_lattice_wire_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_lattice_wire") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_lattice_wire) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -740,42 +823,46 @@ GPU_SHADER_CREATE_INFO(overlay_edit_lattice_wire_clipped) * \{ */ GPU_SHADER_CREATE_INFO(overlay_edit_particle_strand) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::FLOAT, "selection") - .sampler(0, ImageType::FLOAT_1D, "weightTex") - .push_constant(Type::BOOL, "useWeight") - .push_constant(Type::BOOL, "useGreasePencil") - .vertex_out(overlay_edit_smooth_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_particle_strand_vert.glsl") - .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, FLOAT, selection) +SAMPLER(0, FLOAT_1D, weightTex) +PUSH_CONSTANT(BOOL, useWeight) +PUSH_CONSTANT(BOOL, useGreasePencil) +VERTEX_OUT(overlay_edit_smooth_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_particle_strand_vert.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_particle_strand_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_particle_strand") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_particle_strand) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_particle_point) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::FLOAT, "selection") - .vertex_out(overlay_edit_flat_color_iface) - .sampler(0, ImageType::FLOAT_1D, "weightTex") - .push_constant(Type::BOOL, "useWeight") - .push_constant(Type::BOOL, "useGreasePencil") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_particle_point_vert.glsl") - .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, FLOAT, selection) +VERTEX_OUT(overlay_edit_flat_color_iface) +SAMPLER(0, FLOAT_1D, weightTex) +PUSH_CONSTANT(BOOL, useWeight) +PUSH_CONSTANT(BOOL, useGreasePencil) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_particle_point_vert.glsl") +FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_particle_point_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_particle_point") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_particle_point) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -784,66 +871,73 @@ GPU_SHADER_CREATE_INFO(overlay_edit_particle_point_clipped) * \{ */ GPU_SHADER_CREATE_INFO(overlay_edit_gpencil) - .typedef_source("overlay_shader_shared.h") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::INT, "ma") - .vertex_in(2, Type::UINT, "vflag") - .vertex_in(3, Type::FLOAT, "weight") - .push_constant(Type::FLOAT, "normalSize") - .push_constant(Type::BOOL, "doMultiframe") - .push_constant(Type::BOOL, "doStrokeEndpoints") - .push_constant(Type::BOOL, "hideSelect") - .push_constant(Type::BOOL, "doWeightColor") - .push_constant(Type::FLOAT, "gpEditOpacity") - .push_constant(Type::VEC4, "gpEditColor") - .sampler(0, ImageType::FLOAT_1D, "weightTex") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_gpencil_vert.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +TYPEDEF_SOURCE("overlay_shader_shared.h") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, INT, ma) +VERTEX_IN(2, UINT, vflag) +VERTEX_IN(3, FLOAT, weight) +PUSH_CONSTANT(FLOAT, normalSize) +PUSH_CONSTANT(BOOL, doMultiframe) +PUSH_CONSTANT(BOOL, doStrokeEndpoints) +PUSH_CONSTANT(BOOL, hideSelect) +PUSH_CONSTANT(BOOL, doWeightColor) +PUSH_CONSTANT(FLOAT, gpEditOpacity) +PUSH_CONSTANT(VEC4, gpEditColor) +SAMPLER(0, FLOAT_1D, weightTex) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_gpencil_vert.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_wire) - .do_static_compilation(true) - .vertex_out(overlay_edit_smooth_color_iface) - .fragment_source("overlay_varying_color.glsl") - .additional_info("overlay_edit_gpencil"); +DO_STATIC_COMPILATION() +VERTEX_OUT(overlay_edit_smooth_color_iface) +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(overlay_edit_gpencil) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_wire_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_gpencil_wire") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_gpencil_wire) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_point) - .do_static_compilation(true) - .define("USE_POINTS") - .vertex_out(overlay_edit_flat_color_iface) - .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("overlay_edit_gpencil"); +DO_STATIC_COMPILATION() +DEFINE("USE_POINTS") +VERTEX_OUT(overlay_edit_flat_color_iface) +FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") +ADDITIONAL_INFO(overlay_edit_gpencil) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_point_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_gpencil_point") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_gpencil_point) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /* TODO(fclem): Refactor this to take list of point instead of drawing 1 point per drawcall. */ GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_guide_point) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::UINT, "data") - .vertex_out(overlay_edit_flat_color_iface) - .push_constant(Type::VEC3, "pPosition") - .push_constant(Type::FLOAT, "pSize") - .push_constant(Type::VEC4, "pColor") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_gpencil_guide_vert.glsl") - .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, UINT, data) +VERTEX_OUT(overlay_edit_flat_color_iface) +PUSH_CONSTANT(VEC3, pPosition) +PUSH_CONSTANT(FLOAT, pSize) +PUSH_CONSTANT(VEC4, pColor) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_gpencil_guide_vert.glsl") +FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_guide_point_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_gpencil_guide_point") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_gpencil_guide_point) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -854,83 +948,92 @@ GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_guide_point_clipped) * \{ */ GPU_SHADER_CREATE_INFO(overlay_depth_only) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_source("overlay_depth_only_vert.glsl") - .fragment_source("overlay_depth_only_frag.glsl") - .additional_info("draw_mesh"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_SOURCE("overlay_depth_only_vert.glsl") +FRAGMENT_SOURCE("overlay_depth_only_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_depth_only_clipped) - .do_static_compilation(true) - .additional_info("overlay_depth_only") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_depth_only) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_depth_mesh) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_source("basic_depth_vert.glsl") - .fragment_source("overlay_depth_only_frag.glsl") - .additional_info("draw_globals") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_SOURCE("basic_depth_vert.glsl") +FRAGMENT_SOURCE("overlay_depth_only_frag.glsl") +ADDITIONAL_INFO(draw_globals) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_depth_mesh_conservative) - .do_static_compilation(true) - .storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY) - .push_constant(Type::IVEC2, "gpu_attr_0") - .vertex_source("overlay_depth_only_mesh_conservative_vert.glsl") - .fragment_source("overlay_depth_only_frag.glsl") - .additional_info("draw_globals") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("gpu_index_load") - .additional_info("draw_resource_handle_new"); +DO_STATIC_COMPILATION() +STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY) +PUSH_CONSTANT(IVEC2, gpu_attr_0) +VERTEX_SOURCE("overlay_depth_only_mesh_conservative_vert.glsl") +FRAGMENT_SOURCE("overlay_depth_only_frag.glsl") +ADDITIONAL_INFO(draw_globals) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(gpu_index_load) +ADDITIONAL_INFO(draw_resource_handle_new) +GPU_SHADER_CREATE_END() GPU_SHADER_NAMED_INTERFACE_INFO(overlay_depth_only_gpencil_flat_iface, gp_interp_flat) - .flat(Type::VEC2, "aspect") - .flat(Type::VEC4, "sspos"); +FLAT(VEC2, aspect) +FLAT(VEC4, sspos) +GPU_SHADER_INTERFACE_END() GPU_SHADER_NAMED_INTERFACE_INFO(overlay_depth_only_gpencil_noperspective_iface, gp_interp_noperspective) - .no_perspective(Type::VEC2, "thickness") - .no_perspective(Type::FLOAT, "hardness"); +NO_PERSPECTIVE(VEC2, thickness) +NO_PERSPECTIVE(FLOAT, hardness) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_depth_gpencil) - .do_static_compilation(true) - .typedef_source("gpencil_shader_shared.h") - .vertex_out(overlay_depth_only_gpencil_flat_iface) - .vertex_out(overlay_depth_only_gpencil_noperspective_iface) - .vertex_source("overlay_depth_only_gpencil_vert.glsl") - .fragment_source("overlay_depth_only_gpencil_frag.glsl") - .depth_write(DepthWrite::ANY) - .push_constant(Type::BOOL, "gpStrokeOrder3d") /* TODO(fclem): Move to a GPencil object UBO. */ - .push_constant(Type::VEC4, "gpDepthPlane") /* TODO(fclem): Move to a GPencil object UBO. */ - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new") - .additional_info("draw_globals") - .additional_info("draw_gpencil_new") - .additional_info("draw_object_infos_new"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("gpencil_shader_shared.h") +VERTEX_OUT(overlay_depth_only_gpencil_flat_iface) +VERTEX_OUT(overlay_depth_only_gpencil_noperspective_iface) +VERTEX_SOURCE("overlay_depth_only_gpencil_vert.glsl") +FRAGMENT_SOURCE("overlay_depth_only_gpencil_frag.glsl") +DEPTH_WRITE(DepthWrite::ANY) +PUSH_CONSTANT(BOOL, gpStrokeOrder3d) /* TODO(fclem): Move to a GPencil object UBO. */ +PUSH_CONSTANT(VEC4, gpDepthPlane) /* TODO(fclem): Move to a GPencil object UBO. */ +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(draw_globals) +ADDITIONAL_INFO(draw_gpencil_new) +ADDITIONAL_INFO(draw_object_infos_new) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_depth_pointcloud) - .do_static_compilation(true) - .vertex_source("basic_depth_pointcloud_vert.glsl") - .fragment_source("overlay_depth_only_frag.glsl") - .additional_info("draw_pointcloud_new") - .additional_info("draw_globals") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new"); +DO_STATIC_COMPILATION() +VERTEX_SOURCE("basic_depth_pointcloud_vert.glsl") +FRAGMENT_SOURCE("overlay_depth_only_frag.glsl") +ADDITIONAL_INFO(draw_pointcloud_new) +ADDITIONAL_INFO(draw_globals) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_depth_curves) - .do_static_compilation(true) - .vertex_source("basic_depth_curves_vert.glsl") - .fragment_source("overlay_depth_only_frag.glsl") - .additional_info("draw_hair_new") - .additional_info("draw_globals") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new"); +DO_STATIC_COMPILATION() +VERTEX_SOURCE("basic_depth_curves_vert.glsl") +FRAGMENT_SOURCE("overlay_depth_only_frag.glsl") +ADDITIONAL_INFO(draw_hair_new) +ADDITIONAL_INFO(draw_globals) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +GPU_SHADER_CREATE_END() /** \} */ @@ -939,30 +1042,34 @@ GPU_SHADER_CREATE_INFO(overlay_depth_curves) * \{ */ GPU_SHADER_CREATE_INFO(overlay_uniform_color) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .push_constant(Type::VEC4, "ucolor") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_depth_only_vert.glsl") - .fragment_source("overlay_uniform_color_frag.glsl") - .additional_info("draw_mesh"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +PUSH_CONSTANT(VEC4, ucolor) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_depth_only_vert.glsl") +FRAGMENT_SOURCE("overlay_uniform_color_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_uniform_color_pointcloud) - .do_static_compilation(true) - .push_constant(Type::VEC4, "ucolor") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_pointcloud_only_vert.glsl") - .fragment_source("overlay_uniform_color_frag.glsl") - .additional_info("draw_pointcloud"); +DO_STATIC_COMPILATION() +PUSH_CONSTANT(VEC4, ucolor) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_pointcloud_only_vert.glsl") +FRAGMENT_SOURCE("overlay_uniform_color_frag.glsl") +ADDITIONAL_INFO(draw_pointcloud) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_uniform_color_clipped) - .do_static_compilation(true) - .additional_info("overlay_uniform_color") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_uniform_color) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_uniform_color_pointcloud_clipped) - .do_static_compilation(true) - .additional_info("overlay_uniform_color_pointcloud") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_uniform_color_pointcloud) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_extra_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_extra_info.hh index bc7269ed9ea..10fc6e4c416 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_extra_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_extra_info.hh @@ -9,40 +9,45 @@ * \{ */ GPU_SHADER_INTERFACE_INFO(overlay_extra_iface) - .no_perspective(Type::VEC2, "edgePos") - .flat(Type::VEC2, "edgeStart") - .flat(Type::VEC4, "finalColor"); +NO_PERSPECTIVE(VEC2, edgePos) +FLAT(VEC2, edgeStart) +FLAT(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_extra) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::INT, "vclass") - /* Instance attributes. */ - .vertex_in(2, Type::VEC4, "color") - .vertex_in(3, Type::MAT4, "inst_obmat") - .vertex_out(overlay_extra_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "lineOutput") - .vertex_source("overlay_extra_vert.glsl") - .fragment_source("overlay_extra_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, INT, vclass) +/* Instance attributes. */ +VERTEX_IN(2, VEC4, color) +VERTEX_IN(3, MAT4, inst_obmat) +VERTEX_OUT(overlay_extra_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, lineOutput) +VERTEX_SOURCE("overlay_extra_vert.glsl") +FRAGMENT_SOURCE("overlay_extra_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_extra_select) - .do_static_compilation(true) - .define("SELECT_EDGES") - .additional_info("overlay_extra"); +DO_STATIC_COMPILATION() +DEFINE("SELECT_EDGES") +ADDITIONAL_INFO(overlay_extra) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_extra_clipped) - .do_static_compilation(true) - .additional_info("overlay_extra") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_extra) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_extra_select_clipped) - .do_static_compilation(true) - .additional_info("overlay_extra_select") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_extra_select) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -50,24 +55,28 @@ GPU_SHADER_CREATE_INFO(overlay_extra_select_clipped) /** \name Irradiance Grid * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_extra_grid_iface).flat(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_extra_grid_iface) +FLAT(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_extra_grid) - .do_static_compilation(true) - .sampler(0, ImageType::DEPTH_2D, "depthBuffer") - .push_constant(Type::MAT4, "gridModelMatrix") - .push_constant(Type::BOOL, "isTransform") - .vertex_out(overlay_extra_grid_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_extra_lightprobe_grid_vert.glsl") - .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +SAMPLER(0, DEPTH_2D, depthBuffer) +PUSH_CONSTANT(MAT4, gridModelMatrix) +PUSH_CONSTANT(BOOL, isTransform) +VERTEX_OUT(overlay_extra_grid_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_extra_lightprobe_grid_vert.glsl") +FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_extra_grid_clipped) - .do_static_compilation(true) - .additional_info("overlay_extra_grid") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_extra_grid) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -76,22 +85,24 @@ GPU_SHADER_CREATE_INFO(overlay_extra_grid_clipped) * \{ */ GPU_SHADER_CREATE_INFO(overlay_extra_groundline) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - /* Instance attributes. */ - .vertex_in(1, Type::VEC3, "inst_pos") - .vertex_out(overlay_extra_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "lineOutput") - .vertex_source("overlay_extra_groundline_vert.glsl") - .fragment_source("overlay_extra_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +/* Instance attributes. */ +VERTEX_IN(1, VEC3, inst_pos) +VERTEX_OUT(overlay_extra_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, lineOutput) +VERTEX_SOURCE("overlay_extra_groundline_vert.glsl") +FRAGMENT_SOURCE("overlay_extra_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_extra_groundline_clipped) - .do_static_compilation(true) - .additional_info("overlay_extra_groundline") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_extra_groundline) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -100,48 +111,55 @@ GPU_SHADER_CREATE_INFO(overlay_extra_groundline_clipped) * \{ */ GPU_SHADER_INTERFACE_INFO(overlay_extra_wire_iface) - .no_perspective(Type::VEC2, "stipple_coord") - .flat(Type::VEC2, "stipple_start") - .flat(Type::VEC4, "finalColor"); +NO_PERSPECTIVE(VEC2, stipple_coord) +FLAT(VEC2, stipple_start) +FLAT(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_extra_wire) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC4, "color") - /* If colorid is equal to 0 (i.e: Not specified) use color attribute and stippling. */ - .vertex_in(2, Type::INT, "colorid") - .vertex_out(overlay_extra_wire_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "lineOutput") - .vertex_source("overlay_extra_wire_vert.glsl") - .fragment_source("overlay_extra_wire_frag.glsl") - .additional_info("draw_modelmat") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC4, color) +/* If colorid is equal to 0 (i.e: Not specified) use color attribute and stippling. */ +VERTEX_IN(2, INT, colorid) +VERTEX_OUT(overlay_extra_wire_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, lineOutput) +VERTEX_SOURCE("overlay_extra_wire_vert.glsl") +FRAGMENT_SOURCE("overlay_extra_wire_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_extra_wire_select) - .do_static_compilation(true) - .define("SELECT_EDGES") - .additional_info("overlay_extra_wire"); +DO_STATIC_COMPILATION() +DEFINE("SELECT_EDGES") +ADDITIONAL_INFO(overlay_extra_wire) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_extra_wire_object) - .do_static_compilation(true) - .define("OBJECT_WIRE") - .additional_info("overlay_extra_wire"); +DO_STATIC_COMPILATION() +DEFINE("OBJECT_WIRE") +ADDITIONAL_INFO(overlay_extra_wire) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_extra_wire_select_clipped) - .do_static_compilation(true) - .additional_info("overlay_extra_wire_select") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_extra_wire_select) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_extra_wire_object_clipped) - .do_static_compilation(true) - .additional_info("overlay_extra_wire_object") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_extra_wire_object) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_extra_wire_clipped) - .do_static_compilation(true) - .additional_info("overlay_extra_wire") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_extra_wire) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -150,46 +168,53 @@ GPU_SHADER_CREATE_INFO(overlay_extra_wire_clipped) * \{ */ GPU_SHADER_INTERFACE_INFO(overlay_extra_point_iface) - .flat(Type::VEC4, "radii") - .flat(Type::VEC4, "fillColor") - .flat(Type::VEC4, "outlineColor"); +FLAT(VEC4, radii) +FLAT(VEC4, fillColor) +FLAT(VEC4, outlineColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_extra_point) - .do_static_compilation(true) - /* TODO(fclem): Move the vertex shader to Overlay engine and remove this bypass. */ - .define("blender_srgb_to_framebuffer_space(a)", "a") - .vertex_in(0, Type::VEC3, "pos") - .push_constant(Type::VEC4, "ucolor") - .vertex_out(overlay_extra_point_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_extra_point_vert.glsl") - .fragment_source("overlay_point_varying_color_varying_outline_aa_frag.glsl") - .additional_info("draw_modelmat") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +/* TODO(fclem): Move the vertex shader to Overlay engine and remove this bypass. */ +DEFINE_VALUE("blender_srgb_to_framebuffer_space(a)", "a") +VERTEX_IN(0, VEC3, pos) +PUSH_CONSTANT(VEC4, ucolor) +VERTEX_OUT(overlay_extra_point_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_extra_point_vert.glsl") +FRAGMENT_SOURCE("overlay_point_varying_color_varying_outline_aa_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_extra_point_clipped) - .do_static_compilation(true) - .additional_info("overlay_extra_point") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_extra_point) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() -GPU_SHADER_INTERFACE_INFO(overlay_extra_loose_point_iface).smooth(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_extra_loose_point_iface) +SMOOTH(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_extra_loose_point) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC4, "vertex_color") - .vertex_out(overlay_extra_loose_point_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "lineOutput") - .vertex_source("overlay_extra_loose_point_vert.glsl") - .fragment_source("overlay_extra_loose_point_frag.glsl") - .additional_info("draw_modelmat") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC4, vertex_color) +VERTEX_OUT(overlay_extra_loose_point_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, lineOutput) +VERTEX_SOURCE("overlay_extra_loose_point_vert.glsl") +FRAGMENT_SOURCE("overlay_extra_loose_point_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_extra_loose_point_clipped) - .do_static_compilation(true) - .additional_info("overlay_extra_loose_point") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_extra_loose_point) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -198,98 +223,109 @@ GPU_SHADER_CREATE_INFO(overlay_extra_loose_point_clipped) * \{ */ GPU_SHADER_NAMED_INTERFACE_INFO(overlay_motion_path_line_iface, interp) - .smooth(Type::VEC4, "color"); +SMOOTH(VEC4, color) +GPU_SHADER_INTERFACE_END() GPU_SHADER_NAMED_INTERFACE_INFO(overlay_motion_path_line_flat_iface, interp_flat) - .flat(Type::VEC2, "ss_pos"); +FLAT(VEC2, ss_pos) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_motion_path_line) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .push_constant(Type::IVEC4, "mpathLineSettings") - .push_constant(Type::BOOL, "selected") - .push_constant(Type::VEC3, "customColorPre") - .push_constant(Type::VEC3, "customColorPost") - .push_constant(Type::INT, "lineThickness") /* In pixels. */ - .push_constant(Type::MAT4, "camera_space_matrix") - .vertex_out(overlay_motion_path_line_iface) - .vertex_out(overlay_motion_path_line_flat_iface) - .geometry_out(overlay_motion_path_line_iface) - .geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_motion_path_line_vert.glsl") - .geometry_source("overlay_motion_path_line_geom.glsl") - .fragment_source("overlay_motion_path_line_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +PUSH_CONSTANT(IVEC4, mpathLineSettings) +PUSH_CONSTANT(BOOL, selected) +PUSH_CONSTANT(VEC3, customColorPre) +PUSH_CONSTANT(VEC3, customColorPost) +PUSH_CONSTANT(INT, lineThickness) /* In pixels. */ +PUSH_CONSTANT(MAT4, camera_space_matrix) +VERTEX_OUT(overlay_motion_path_line_iface) +VERTEX_OUT(overlay_motion_path_line_flat_iface) +GEOMETRY_OUT(overlay_motion_path_line_iface) +GEOMETRY_LAYOUT(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_motion_path_line_vert.glsl") +GEOMETRY_SOURCE("overlay_motion_path_line_geom.glsl") +FRAGMENT_SOURCE("overlay_motion_path_line_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_motion_path_line_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .push_constant(Type::IVEC4, "mpathLineSettings") - .push_constant(Type::BOOL, "selected") - .push_constant(Type::VEC3, "customColorPre") - .push_constant(Type::VEC3, "customColorPost") - .push_constant(Type::INT, "lineThickness") /* In pixels. */ - .vertex_out(overlay_motion_path_line_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_motion_path_line_vert_no_geom.glsl") - .fragment_source("overlay_motion_path_line_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_globals"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +PUSH_CONSTANT(IVEC4, mpathLineSettings) +PUSH_CONSTANT(BOOL, selected) +PUSH_CONSTANT(VEC3, customColorPre) +PUSH_CONSTANT(VEC3, customColorPost) +PUSH_CONSTANT(INT, lineThickness) /* In pixels. */ +VERTEX_OUT(overlay_motion_path_line_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_motion_path_line_vert_no_geom.glsl") +FRAGMENT_SOURCE("overlay_motion_path_line_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_motion_path_line_next) - .do_static_compilation(true) - .storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY) - .push_constant(Type::IVEC2, "gpu_attr_0") - .push_constant(Type::IVEC4, "mpathLineSettings") - .push_constant(Type::BOOL, "selected") - .push_constant(Type::VEC3, "customColorPre") - .push_constant(Type::VEC3, "customColorPost") - .push_constant(Type::INT, "lineThickness") /* In pixels. */ - .push_constant(Type::MAT4, "camera_space_matrix") - .vertex_out(overlay_motion_path_line_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_motion_path_line_next_vert.glsl") - .fragment_source("overlay_motion_path_line_frag.glsl") - .additional_info("draw_view") - .additional_info("gpu_index_load") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY) +PUSH_CONSTANT(IVEC2, gpu_attr_0) +PUSH_CONSTANT(IVEC4, mpathLineSettings) +PUSH_CONSTANT(BOOL, selected) +PUSH_CONSTANT(VEC3, customColorPre) +PUSH_CONSTANT(VEC3, customColorPost) +PUSH_CONSTANT(INT, lineThickness) /* In pixels. */ +PUSH_CONSTANT(MAT4, camera_space_matrix) +VERTEX_OUT(overlay_motion_path_line_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_motion_path_line_next_vert.glsl") +FRAGMENT_SOURCE("overlay_motion_path_line_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(gpu_index_load) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_motion_path_line_clipped) - .do_static_compilation(true) - .additional_info("overlay_motion_path_line") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_motion_path_line) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_motion_path_line_clipped_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .additional_info("overlay_motion_path_line_no_geom") - .additional_info("drw_clipped"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_motion_path_line_no_geom) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() -GPU_SHADER_INTERFACE_INFO(overlay_motion_path_point_iface).flat(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_motion_path_point_iface) +FLAT(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_motion_path_point) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::INT, "flag") - .push_constant(Type::IVEC4, "mpathPointSettings") - .push_constant(Type::BOOL, "showKeyFrames") - .push_constant(Type::VEC3, "customColorPre") - .push_constant(Type::VEC3, "customColorPost") - .push_constant(Type::MAT4, "camera_space_matrix") - .vertex_out(overlay_motion_path_point_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_motion_path_point_vert.glsl") - .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, INT, flag) +PUSH_CONSTANT(IVEC4, mpathPointSettings) +PUSH_CONSTANT(BOOL, showKeyFrames) +PUSH_CONSTANT(VEC3, customColorPre) +PUSH_CONSTANT(VEC3, customColorPost) +PUSH_CONSTANT(MAT4, camera_space_matrix) +VERTEX_OUT(overlay_motion_path_point_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_motion_path_point_vert.glsl") +FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_motion_path_point_clipped) - .do_static_compilation(true) - .additional_info("overlay_motion_path_point") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_motion_path_point) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -297,27 +333,31 @@ GPU_SHADER_CREATE_INFO(overlay_motion_path_point_clipped) /** \name Image Empty * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_image_iface).smooth(Type::VEC2, "uvs"); +GPU_SHADER_INTERFACE_INFO(overlay_image_iface) +SMOOTH(VEC2, uvs) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_image) - .do_static_compilation(true) - .push_constant(Type::BOOL, "depthSet") - .push_constant(Type::BOOL, "isCameraBackground") - .push_constant(Type::BOOL, "imgPremultiplied") - .push_constant(Type::BOOL, "imgAlphaBlend") - .push_constant(Type::VEC4, "ucolor") - .vertex_in(0, Type::VEC3, "pos") - .vertex_out(overlay_image_iface) - .sampler(0, ImageType::FLOAT_2D, "imgTexture") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_image_vert.glsl") - .fragment_source("overlay_image_frag.glsl") - .additional_info("draw_mesh"); +DO_STATIC_COMPILATION() +PUSH_CONSTANT(BOOL, depthSet) +PUSH_CONSTANT(BOOL, isCameraBackground) +PUSH_CONSTANT(BOOL, imgPremultiplied) +PUSH_CONSTANT(BOOL, imgAlphaBlend) +PUSH_CONSTANT(VEC4, ucolor) +VERTEX_IN(0, VEC3, pos) +VERTEX_OUT(overlay_image_iface) +SAMPLER(0, FLOAT_2D, imgTexture) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_image_vert.glsl") +FRAGMENT_SOURCE("overlay_image_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_image_clipped) - .do_static_compilation(true) - .additional_info("overlay_image") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_image) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -326,24 +366,26 @@ GPU_SHADER_CREATE_INFO(overlay_image_clipped) * \{ */ GPU_SHADER_CREATE_INFO(overlay_gpencil_canvas) - .do_static_compilation(true) - .vertex_out(overlay_extra_iface) - .push_constant(Type::VEC4, "color") - .push_constant(Type::VEC3, "xAxis") - .push_constant(Type::VEC3, "yAxis") - .push_constant(Type::VEC3, "origin") - .push_constant(Type::INT, "halfLineCount") - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "lineOutput") - .vertex_source("overlay_edit_gpencil_canvas_vert.glsl") - .fragment_source("overlay_extra_frag.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_OUT(overlay_extra_iface) +PUSH_CONSTANT(VEC4, color) +PUSH_CONSTANT(VEC3, xAxis) +PUSH_CONSTANT(VEC3, yAxis) +PUSH_CONSTANT(VEC3, origin) +PUSH_CONSTANT(INT, halfLineCount) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, lineOutput) +VERTEX_SOURCE("overlay_edit_gpencil_canvas_vert.glsl") +FRAGMENT_SOURCE("overlay_extra_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_gpencil_canvas_clipped) - .do_static_compilation(true) - .additional_info("overlay_gpencil_canvas") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_gpencil_canvas) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -351,85 +393,94 @@ GPU_SHADER_CREATE_INFO(overlay_gpencil_canvas_clipped) /** \name Particle * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_particle_iface).flat(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_particle_iface) +FLAT(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_particle) - .sampler(0, ImageType::FLOAT_1D, "weightTex") - .push_constant(Type::VEC4, "ucolor") /* Draw-size packed in alpha. */ - .vertex_in(0, Type::VEC3, "part_pos") - .vertex_in(1, Type::VEC4, "part_rot") - .vertex_in(2, Type::FLOAT, "part_val") - .vertex_out(overlay_particle_iface) - .vertex_source("overlay_particle_vert.glsl") - .additional_info("draw_globals"); +SAMPLER(0, FLOAT_1D, weightTex) +PUSH_CONSTANT(VEC4, ucolor) /* Draw-size packed in alpha. */ +VERTEX_IN(0, VEC3, part_pos) +VERTEX_IN(1, VEC4, part_rot) +VERTEX_IN(2, FLOAT, part_val) +VERTEX_OUT(overlay_particle_iface) +VERTEX_SOURCE("overlay_particle_vert.glsl") +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_particle_dot) - .do_static_compilation(true) - .define("USE_DOTS") - .define("vclass", "0") - .define("pos", "vec3(0.0)") - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "lineOutput") - .fragment_source("overlay_particle_frag.glsl") - .additional_info("overlay_particle") - .additional_info("draw_mesh"); +DO_STATIC_COMPILATION() +DEFINE("USE_DOTS") +DEFINE_VALUE("vclass", "0") +DEFINE_VALUE("pos", "vec3(0.0)") +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, lineOutput) +FRAGMENT_SOURCE("overlay_particle_frag.glsl") +ADDITIONAL_INFO(overlay_particle) +ADDITIONAL_INFO(draw_mesh) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_particle_dot_clipped) - .do_static_compilation(true) - .additional_info("overlay_particle_dot") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_particle_dot) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_particle_shape) - .do_static_compilation(true) - /* Instantiated Attrs. */ - .vertex_in(3, Type::VEC3, "pos") - .vertex_in(4, Type::INT, "vclass") - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_source("overlay_varying_color.glsl") - .additional_info("overlay_particle") - .additional_info("draw_modelmat") - .additional_info("draw_resource_id_uniform"); +DO_STATIC_COMPILATION() +/* Instantiated Attrs. */ +VERTEX_IN(3, VEC3, pos) +VERTEX_IN(4, INT, vclass) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(overlay_particle) +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(draw_resource_id_uniform) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_particle_shape_next) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - .sampler(0, ImageType::FLOAT_1D, "weightTex") - .push_constant(Type::VEC4, "ucolor") /* Draw-size packed in alpha. */ - .push_constant(Type::INT, "shape_type") - /* Use first attribute to only bind one buffer. */ - .storage_buf(0, Qualifier::READ, "ParticlePointData", "part_pos[]", Frequency::GEOMETRY) - .vertex_out(overlay_extra_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "lineOutput") - .vertex_source("overlay_particle_shape_vert.glsl") - .fragment_source("overlay_particle_shape_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +SAMPLER(0, FLOAT_1D, weightTex) +PUSH_CONSTANT(VEC4, ucolor) /* Draw-size packed in alpha. */ +PUSH_CONSTANT(INT, shape_type) +/* Use first attribute to only bind one buffer. */ +STORAGE_BUF_FREQ(0, READ, ParticlePointData, part_pos[], GEOMETRY) +VERTEX_OUT(overlay_extra_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, lineOutput) +VERTEX_SOURCE("overlay_particle_shape_vert.glsl") +FRAGMENT_SOURCE("overlay_particle_shape_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_particle_hair_next) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC3, "nor") - .push_constant(Type::INT, "colorType") - .push_constant(Type::BOOL, "isTransform") - .push_constant(Type::BOOL, "useColoring") - .vertex_out(overlay_extra_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "lineOutput") - .vertex_source("overlay_particle_hair_vert.glsl") - .fragment_source("overlay_particle_shape_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_object_infos_new") - .additional_info("draw_resource_handle_new") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC3, nor) +PUSH_CONSTANT(INT, colorType) +PUSH_CONSTANT(BOOL, isTransform) +PUSH_CONSTANT(BOOL, useColoring) +VERTEX_OUT(overlay_extra_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, lineOutput) +VERTEX_SOURCE("overlay_particle_hair_vert.glsl") +FRAGMENT_SOURCE("overlay_particle_shape_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_object_infos_new) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_particle_shape_clipped) - .do_static_compilation(true) - .additional_info("overlay_particle_shape") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_particle_shape) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_facing_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_facing_info.hh index a37d8d764ea..1b9188727df 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_facing_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_facing_info.hh @@ -5,15 +5,17 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(overlay_facing) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_source("overlay_facing_vert.glsl") - .fragment_source("overlay_facing_frag.glsl") - .fragment_out(0, Type::VEC4, "fragColor") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_SOURCE("overlay_facing_vert.glsl") +FRAGMENT_SOURCE("overlay_facing_frag.glsl") +FRAGMENT_OUT(0, VEC4, fragColor) +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_facing_clipped) - .do_static_compilation(true) - .additional_info("overlay_facing") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_facing) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_grid_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_grid_info.hh index 2424f7298f2..47b34ee010a 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_grid_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_grid_info.hh @@ -5,38 +5,43 @@ #include "gpu_shader_create_info.hh" /* We use the normalized local position to avoid precision loss during interpolation. */ -GPU_SHADER_INTERFACE_INFO(overlay_grid_iface).smooth(Type::VEC3, "local_pos"); +GPU_SHADER_INTERFACE_INFO(overlay_grid_iface) +SMOOTH(VEC3, local_pos) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_grid) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - .vertex_in(0, Type::VEC3, "pos") - .vertex_out(overlay_grid_iface) - .fragment_out(0, Type::VEC4, "out_color") - .sampler(0, ImageType::DEPTH_2D, "depth_tx") - .uniform_buf(3, "OVERLAY_GridData", "grid_buf") - .push_constant(Type::VEC3, "plane_axes") - .push_constant(Type::INT, "grid_flag") - .vertex_source("overlay_grid_vert.glsl") - .fragment_source("overlay_grid_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +VERTEX_IN(0, VEC3, pos) +VERTEX_OUT(overlay_grid_iface) +FRAGMENT_OUT(0, VEC4, out_color) +SAMPLER(0, DEPTH_2D, depth_tx) +UNIFORM_BUF(3, OVERLAY_GridData, grid_buf) +PUSH_CONSTANT(VEC3, plane_axes) +PUSH_CONSTANT(INT, grid_flag) +VERTEX_SOURCE("overlay_grid_vert.glsl") +FRAGMENT_SOURCE("overlay_grid_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_grid_background) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .sampler(0, ImageType::DEPTH_2D, "depthBuffer") - .push_constant(Type::VEC4, "ucolor") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_uv_tiled_image_borders_vert.glsl") - .fragment_source("overlay_grid_background_frag.glsl") - .additional_info("draw_modelmat"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +SAMPLER(0, DEPTH_2D, depthBuffer) +PUSH_CONSTANT(VEC4, ucolor) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_uv_tiled_image_borders_vert.glsl") +FRAGMENT_SOURCE("overlay_grid_background_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_grid_image) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .push_constant(Type::VEC4, "ucolor") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_uv_tiled_image_borders_vert.glsl") - .fragment_source("overlay_uniform_color_frag.glsl") - .additional_info("draw_modelmat"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +PUSH_CONSTANT(VEC4, ucolor) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_uv_tiled_image_borders_vert.glsl") +FRAGMENT_SOURCE("overlay_uniform_color_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_outline_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_outline_info.hh index 3ef4afbed4b..7334c7af217 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_outline_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_outline_info.hh @@ -8,128 +8,147 @@ /** \name Outline Pre-pass * \{ */ -GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_iface, interp).flat(Type::UINT, "ob_id"); +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_iface, interp) +FLAT(UINT, ob_id) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_outline_prepass) - .push_constant(Type::BOOL, "isTransform") - .vertex_out(overlay_outline_prepass_iface) - /* Using uint because 16bit uint can contain more ids than int. */ - .fragment_out(0, Type::UINT, "out_object_id") - .fragment_source("overlay_outline_prepass_frag.glsl") - .additional_info("draw_globals"); +PUSH_CONSTANT(BOOL, isTransform) +VERTEX_OUT(overlay_outline_prepass_iface) +/* Using uint because 16bit uint can contain more ids than int. */ +FRAGMENT_OUT(0, UINT, out_object_id) +FRAGMENT_SOURCE("overlay_outline_prepass_frag.glsl") +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_outline_prepass_mesh) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_source("overlay_outline_prepass_vert.glsl") - .additional_info("draw_mesh") - .additional_info("draw_resource_handle") - .additional_info("overlay_outline_prepass") - .additional_info("draw_object_infos"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_SOURCE("overlay_outline_prepass_vert.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_resource_handle) +ADDITIONAL_INFO(overlay_outline_prepass) +ADDITIONAL_INFO(draw_object_infos) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_outline_prepass_mesh_clipped) - .do_static_compilation(true) - .additional_info("overlay_outline_prepass_mesh") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_outline_prepass_mesh) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() -GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_wire_iface, vert).flat(Type::VEC3, "pos"); +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_wire_iface, vert) +FLAT(VEC3, pos) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_outline_prepass_curves) - .do_static_compilation(true) - .vertex_source("overlay_outline_prepass_curves_vert.glsl") - .additional_info("draw_hair") - .additional_info("draw_resource_handle") - .additional_info("overlay_outline_prepass") - .additional_info("draw_object_infos"); +DO_STATIC_COMPILATION() +VERTEX_SOURCE("overlay_outline_prepass_curves_vert.glsl") +ADDITIONAL_INFO(draw_hair) +ADDITIONAL_INFO(draw_resource_handle) +ADDITIONAL_INFO(overlay_outline_prepass) +ADDITIONAL_INFO(draw_object_infos) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_outline_prepass_curves_clipped) - .do_static_compilation(true) - .additional_info("overlay_outline_prepass_curves") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_outline_prepass_curves) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_outline_prepass_wire) - .do_static_compilation(true) - .additional_info("overlay_outline_prepass") - .additional_info("draw_object_infos") - .additional_info("draw_mesh") - .additional_info("draw_resource_handle") - .vertex_in(0, Type::VEC3, "pos") - .define("USE_GEOM") - .vertex_out(overlay_outline_prepass_wire_iface) - .geometry_layout(PrimitiveIn::LINES_ADJACENCY, PrimitiveOut::LINE_STRIP, 2) - .geometry_out(overlay_outline_prepass_iface) - .vertex_source("overlay_outline_prepass_vert.glsl") - .geometry_source("overlay_outline_prepass_geom.glsl"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_outline_prepass) +ADDITIONAL_INFO(draw_object_infos) +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_resource_handle) +VERTEX_IN(0, VEC3, pos) +DEFINE("USE_GEOM") +VERTEX_OUT(overlay_outline_prepass_wire_iface) +GEOMETRY_LAYOUT(PrimitiveIn::LINES_ADJACENCY, PrimitiveOut::LINE_STRIP, 2) +GEOMETRY_OUT(overlay_outline_prepass_iface) +VERTEX_SOURCE("overlay_outline_prepass_vert.glsl") +GEOMETRY_SOURCE("overlay_outline_prepass_geom.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_outline_prepass_wire_next) - .do_static_compilation(true) - .additional_info("overlay_outline_prepass") - .additional_info("draw_view") - .additional_info("draw_mesh_new") - .additional_info("draw_object_infos_new") - .additional_info("draw_resource_handle_new") - .additional_info("gpu_index_load") - .storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY) - .push_constant(Type::IVEC2, "gpu_attr_0") - .vertex_source("overlay_outline_prepass_wire_vert.glsl"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_outline_prepass) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_mesh_new) +ADDITIONAL_INFO(draw_object_infos_new) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(gpu_index_load) +STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY) +PUSH_CONSTANT(IVEC2, gpu_attr_0) +VERTEX_SOURCE("overlay_outline_prepass_wire_vert.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_outline_prepass_wire_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .additional_info("overlay_outline_prepass") - .additional_info("draw_object_infos") - .additional_info("draw_mesh") - .additional_info("draw_resource_handle") - .vertex_source("overlay_outline_prepass_vert_no_geom.glsl"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +ADDITIONAL_INFO(overlay_outline_prepass) +ADDITIONAL_INFO(draw_object_infos) +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_resource_handle) +VERTEX_SOURCE("overlay_outline_prepass_vert_no_geom.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_outline_prepass_wire_clipped) - .do_static_compilation(true) - .additional_info("overlay_outline_prepass_wire") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_outline_prepass_wire) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_gpencil_flat_iface, gp_interp_flat) - .flat(Type::VEC2, "aspect") - .flat(Type::VEC4, "sspos"); +FLAT(VEC2, aspect) +FLAT(VEC4, sspos) +GPU_SHADER_INTERFACE_END() GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_gpencil_noperspective_iface, gp_interp_noperspective) - .no_perspective(Type::VEC2, "thickness") - .no_perspective(Type::FLOAT, "hardness"); +NO_PERSPECTIVE(VEC2, thickness) +NO_PERSPECTIVE(FLOAT, hardness) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_outline_prepass_gpencil) - .do_static_compilation(true) - .push_constant(Type::BOOL, "isTransform") - .vertex_out(overlay_outline_prepass_iface) - .vertex_out(overlay_outline_prepass_gpencil_flat_iface) - .vertex_out(overlay_outline_prepass_gpencil_noperspective_iface) - .vertex_source("overlay_outline_prepass_gpencil_vert.glsl") - .push_constant(Type::BOOL, "gpStrokeOrder3d") /* TODO(fclem): Move to a GPencil object UBO. */ - .push_constant(Type::VEC4, "gpDepthPlane") /* TODO(fclem): Move to a GPencil object UBO. */ - /* Using uint because 16bit uint can contain more ids than int. */ - .fragment_out(0, Type::UINT, "out_object_id") - .fragment_source("overlay_outline_prepass_gpencil_frag.glsl") - .depth_write(DepthWrite::ANY) - .additional_info("draw_gpencil") - .additional_info("draw_resource_handle") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +PUSH_CONSTANT(BOOL, isTransform) +VERTEX_OUT(overlay_outline_prepass_iface) +VERTEX_OUT(overlay_outline_prepass_gpencil_flat_iface) +VERTEX_OUT(overlay_outline_prepass_gpencil_noperspective_iface) +VERTEX_SOURCE("overlay_outline_prepass_gpencil_vert.glsl") +PUSH_CONSTANT(BOOL, gpStrokeOrder3d) /* TODO(fclem): Move to a GPencil object UBO. */ +PUSH_CONSTANT(VEC4, gpDepthPlane) /* TODO(fclem): Move to a GPencil object UBO. */ +/* Using uint because 16bit uint can contain more ids than int. */ +FRAGMENT_OUT(0, UINT, out_object_id) +FRAGMENT_SOURCE("overlay_outline_prepass_gpencil_frag.glsl") +DEPTH_WRITE(DepthWrite::ANY) +ADDITIONAL_INFO(draw_gpencil) +ADDITIONAL_INFO(draw_resource_handle) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_outline_prepass_gpencil_clipped) - .do_static_compilation(true) - .additional_info("overlay_outline_prepass_gpencil") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_outline_prepass_gpencil) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_outline_prepass_pointcloud) - .do_static_compilation(true) - .vertex_source("overlay_outline_prepass_pointcloud_vert.glsl") - .additional_info("draw_pointcloud") - .additional_info("draw_resource_handle") - .additional_info("overlay_outline_prepass") - .additional_info("draw_object_infos"); +DO_STATIC_COMPILATION() +VERTEX_SOURCE("overlay_outline_prepass_pointcloud_vert.glsl") +ADDITIONAL_INFO(draw_pointcloud) +ADDITIONAL_INFO(draw_resource_handle) +ADDITIONAL_INFO(overlay_outline_prepass) +ADDITIONAL_INFO(draw_object_infos) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_outline_prepass_pointcloud_clipped) - .do_static_compilation(true) - .additional_info("overlay_outline_prepass_pointcloud") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_outline_prepass_pointcloud) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -138,19 +157,20 @@ GPU_SHADER_CREATE_INFO(overlay_outline_prepass_pointcloud_clipped) * \{ */ GPU_SHADER_CREATE_INFO(overlay_outline_detect) - .do_static_compilation(true) - .push_constant(Type::FLOAT, "alphaOcclu") - .push_constant(Type::BOOL, "isXrayWires") - .push_constant(Type::BOOL, "doAntiAliasing") - .push_constant(Type::BOOL, "doThickOutlines") - .sampler(0, ImageType::UINT_2D, "outlineId") - .sampler(1, ImageType::DEPTH_2D, "outlineDepth") - .sampler(2, ImageType::DEPTH_2D, "sceneDepth") - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "lineOutput") - .fragment_source("overlay_outline_detect_frag.glsl") - .additional_info("draw_fullscreen") - .additional_info("draw_view") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +PUSH_CONSTANT(FLOAT, alphaOcclu) +PUSH_CONSTANT(BOOL, isXrayWires) +PUSH_CONSTANT(BOOL, doAntiAliasing) +PUSH_CONSTANT(BOOL, doThickOutlines) +SAMPLER(0, UINT_2D, outlineId) +SAMPLER(1, DEPTH_2D, outlineDepth) +SAMPLER(2, DEPTH_2D, sceneDepth) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, lineOutput) +FRAGMENT_SOURCE("overlay_outline_detect_frag.glsl") +ADDITIONAL_INFO(draw_fullscreen) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_paint_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_paint_info.hh index aa82105c6ef..22c1ad5cd5b 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_paint_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_paint_info.hh @@ -11,19 +11,21 @@ * \{ */ GPU_SHADER_CREATE_INFO(overlay_paint_face) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC4, "nor") /* Select flag on the 4th component. */ - .push_constant(Type::VEC4, "ucolor") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_paint_face_vert.glsl") - .fragment_source("overlay_uniform_color_frag.glsl") - .additional_info("draw_modelmat"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC4, nor) /* Select flag on the 4th component. */ +PUSH_CONSTANT(VEC4, ucolor) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_paint_face_vert.glsl") +FRAGMENT_SOURCE("overlay_uniform_color_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_paint_face_clipped) - .additional_info("overlay_paint_face") - .additional_info("drw_clipped") - .do_static_compilation(true); +ADDITIONAL_INFO(overlay_paint_face) +ADDITIONAL_INFO(drw_clipped) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /** \} */ @@ -33,23 +35,27 @@ GPU_SHADER_CREATE_INFO(overlay_paint_face_clipped) * Used for vertex selection mode in Weight and Vertex Paint. * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_overlay_paint_point_iface).smooth(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_overlay_paint_point_iface) +SMOOTH(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_paint_point) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC4, "nor") /* Select flag on the 4th component. */ - .vertex_out(overlay_overlay_paint_point_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_paint_point_vert.glsl") - .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_modelmat") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC4, nor) /* Select flag on the 4th component. */ +VERTEX_OUT(overlay_overlay_paint_point_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_paint_point_vert.glsl") +FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_paint_point_clipped) - .additional_info("overlay_paint_point") - .additional_info("drw_clipped") - .do_static_compilation(true); +ADDITIONAL_INFO(overlay_paint_point) +ADDITIONAL_INFO(drw_clipped) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /** \} */ @@ -59,27 +65,31 @@ GPU_SHADER_CREATE_INFO(overlay_paint_point_clipped) * Used in Texture Paint mode for the Stencil Image Masking. * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_paint_texture_iface).smooth(Type::VEC2, "uv_interp"); +GPU_SHADER_INTERFACE_INFO(overlay_paint_texture_iface) +SMOOTH(VEC2, uv_interp) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_paint_texture) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC2, "mu") /* Masking uv map. */ - .vertex_out(overlay_paint_texture_iface) - .sampler(0, ImageType::FLOAT_2D, "maskImage") - .push_constant(Type::VEC3, "maskColor") - .push_constant(Type::FLOAT, "opacity") /* `1.0` by default. */ - .push_constant(Type::BOOL, "maskInvertStencil") - .push_constant(Type::BOOL, "maskImagePremultiplied") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_paint_texture_vert.glsl") - .fragment_source("overlay_paint_texture_frag.glsl") - .additional_info("draw_modelmat"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC2, mu) /* Masking uv map. */ +VERTEX_OUT(overlay_paint_texture_iface) +SAMPLER(0, FLOAT_2D, maskImage) +PUSH_CONSTANT(VEC3, maskColor) +PUSH_CONSTANT(FLOAT, opacity) /* `1.0` by default. */ +PUSH_CONSTANT(BOOL, maskInvertStencil) +PUSH_CONSTANT(BOOL, maskImagePremultiplied) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_paint_texture_vert.glsl") +FRAGMENT_SOURCE("overlay_paint_texture_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_paint_texture_clipped) - .additional_info("overlay_paint_texture") - .additional_info("drw_clipped") - .do_static_compilation(true); +ADDITIONAL_INFO(overlay_paint_texture) +ADDITIONAL_INFO(drw_clipped) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /** \} */ @@ -89,24 +99,28 @@ GPU_SHADER_CREATE_INFO(overlay_paint_texture_clipped) * It should be used to draw a Vertex Paint overlay. But it is currently unreachable. * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_paint_vertcol_iface).smooth(Type::VEC3, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_paint_vertcol_iface) +SMOOTH(VEC3, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_paint_vertcol) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC3, "ac") /* Active color. */ - .vertex_out(overlay_paint_vertcol_iface) - .push_constant(Type::FLOAT, "opacity") /* `1.0` by default. */ - .push_constant(Type::BOOL, "useAlphaBlend") /* `false` by default. */ - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_paint_vertcol_vert.glsl") - .fragment_source("overlay_paint_vertcol_frag.glsl") - .additional_info("draw_modelmat"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC3, ac) /* Active color. */ +VERTEX_OUT(overlay_paint_vertcol_iface) +PUSH_CONSTANT(FLOAT, opacity) /* `1.0` by default. */ +PUSH_CONSTANT(BOOL, useAlphaBlend) /* `false` by default. */ +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_paint_vertcol_vert.glsl") +FRAGMENT_SOURCE("overlay_paint_vertcol_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_paint_vertcol_clipped) - .additional_info("overlay_paint_vertcol") - .additional_info("drw_clipped") - .do_static_compilation(true); +ADDITIONAL_INFO(overlay_paint_vertcol) +ADDITIONAL_INFO(drw_clipped) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /** \} */ @@ -118,39 +132,44 @@ GPU_SHADER_CREATE_INFO(overlay_paint_vertcol_clipped) * \{ */ GPU_SHADER_INTERFACE_INFO(overlay_paint_weight_iface) - .smooth(Type::VEC2, "weight_interp") /* (weight, alert) */ - .smooth(Type::FLOAT, "color_fac"); +SMOOTH(VEC2, weight_interp) /* (weight, alert) */ +SMOOTH(FLOAT, color_fac) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_paint_weight) - .do_static_compilation(true) - .vertex_in(0, Type::FLOAT, "weight") - .vertex_in(1, Type::VEC3, "pos") - .vertex_in(2, Type::VEC3, "nor") - .vertex_out(overlay_paint_weight_iface) - .sampler(0, ImageType::FLOAT_1D, "colorramp") - .push_constant(Type::FLOAT, "opacity") /* `1.0` by default. */ - .push_constant(Type::BOOL, "drawContours") /* `false` by default. */ - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_paint_weight_vert.glsl") - .fragment_source("overlay_paint_weight_frag.glsl") - .additional_info("draw_modelmat") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, FLOAT, weight) +VERTEX_IN(1, VEC3, pos) +VERTEX_IN(2, VEC3, nor) +VERTEX_OUT(overlay_paint_weight_iface) +SAMPLER(0, FLOAT_1D, colorramp) +PUSH_CONSTANT(FLOAT, opacity) /* `1.0` by default. */ +PUSH_CONSTANT(BOOL, drawContours) /* `false` by default. */ +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_paint_weight_vert.glsl") +FRAGMENT_SOURCE("overlay_paint_weight_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_paint_weight_fake_shading) - .additional_info("overlay_paint_weight") - .define("FAKE_SHADING") - .push_constant(Type::VEC3, "light_dir") - .do_static_compilation(true); +ADDITIONAL_INFO(overlay_paint_weight) +DEFINE("FAKE_SHADING") +PUSH_CONSTANT(VEC3, light_dir) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_paint_weight_clipped) - .additional_info("overlay_paint_weight") - .additional_info("drw_clipped") - .do_static_compilation(true); +ADDITIONAL_INFO(overlay_paint_weight) +ADDITIONAL_INFO(drw_clipped) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_paint_weight_fake_shading_clipped) - .additional_info("overlay_paint_weight_fake_shading") - .additional_info("drw_clipped") - .do_static_compilation(true); +ADDITIONAL_INFO(overlay_paint_weight_fake_shading) +ADDITIONAL_INFO(drw_clipped) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /** \} */ @@ -161,23 +180,27 @@ GPU_SHADER_CREATE_INFO(overlay_paint_weight_fake_shading_clipped) * paint modes. * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_paint_wire_iface).flat(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_paint_wire_iface) +FLAT(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_paint_wire) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC4, "nor") /* flag stored in w */ - .vertex_out(overlay_paint_wire_iface) - .push_constant(Type::BOOL, "useSelect") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_paint_wire_vert.glsl") - .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_modelmat") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC4, nor) /* flag stored in w */ +VERTEX_OUT(overlay_paint_wire_iface) +PUSH_CONSTANT(BOOL, useSelect) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_paint_wire_vert.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_paint_wire_clipped) - .additional_info("overlay_paint_vertcol") - .additional_info("drw_clipped") - .do_static_compilation(true); +ADDITIONAL_INFO(overlay_paint_vertcol) +ADDITIONAL_INFO(drw_clipped) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_curves_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_curves_info.hh index 75d79357c93..4dba29d13af 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_curves_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_curves_info.hh @@ -5,45 +5,51 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_INTERFACE_INFO(overlay_sculpt_curves_selection_iface) - .smooth(Type::FLOAT, "mask_weight"); +SMOOTH(FLOAT, mask_weight) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_sculpt_curves_selection) - .do_static_compilation(true) - .push_constant(Type::BOOL, "is_point_domain") - .push_constant(Type::FLOAT, "selection_opacity") - .sampler(1, ImageType::FLOAT_BUFFER, "selection_tx") - .vertex_out(overlay_sculpt_curves_selection_iface) - .vertex_source("overlay_sculpt_curves_selection_vert.glsl") - .fragment_source("overlay_sculpt_curves_selection_frag.glsl") - .fragment_out(0, Type::VEC4, "out_color") - .additional_info("draw_hair") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +PUSH_CONSTANT(BOOL, is_point_domain) +PUSH_CONSTANT(FLOAT, selection_opacity) +SAMPLER(1, FLOAT_BUFFER, selection_tx) +VERTEX_OUT(overlay_sculpt_curves_selection_iface) +VERTEX_SOURCE("overlay_sculpt_curves_selection_vert.glsl") +FRAGMENT_SOURCE("overlay_sculpt_curves_selection_frag.glsl") +FRAGMENT_OUT(0, VEC4, out_color) +ADDITIONAL_INFO(draw_hair) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_sculpt_curves_selection_clipped) - .do_static_compilation(true) - .additional_info("overlay_sculpt_curves_selection") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_sculpt_curves_selection) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(overlay_sculpt_curves_cage_iface) - .no_perspective(Type::VEC2, "edgePos") - .flat(Type::VEC2, "edgeStart") - .smooth(Type::VEC4, "finalColor"); +NO_PERSPECTIVE(VEC2, edgePos) +FLAT(VEC2, edgeStart) +SMOOTH(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_sculpt_curves_cage) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::FLOAT, "selection") - .vertex_out(overlay_sculpt_curves_cage_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "lineOutput") - .push_constant(Type::FLOAT, "opacity") - .vertex_source("overlay_sculpt_curves_cage_vert.glsl") - .fragment_source("overlay_extra_frag.glsl") - .additional_info("draw_modelmat") - .additional_info("draw_view") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, FLOAT, selection) +VERTEX_OUT(overlay_sculpt_curves_cage_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, lineOutput) +PUSH_CONSTANT(FLOAT, opacity) +VERTEX_SOURCE("overlay_sculpt_curves_cage_vert.glsl") +FRAGMENT_SOURCE("overlay_extra_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_sculpt_curves_cage_clipped) - .do_static_compilation(true) - .additional_info("overlay_sculpt_curves_cage") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_sculpt_curves_cage) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_info.hh index 8a8b266779e..28f737c2cc6 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_info.hh @@ -5,26 +5,29 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_INTERFACE_INFO(overlay_sculpt_mask_iface) - .flat(Type::VEC3, "faceset_color") - .smooth(Type::FLOAT, "mask_color") - .smooth(Type::VEC4, "finalColor"); +FLAT(VEC3, faceset_color) +SMOOTH(FLOAT, mask_color) +SMOOTH(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_sculpt_mask) - .do_static_compilation(true) - .push_constant(Type::FLOAT, "maskOpacity") - .push_constant(Type::FLOAT, "faceSetsOpacity") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC3, "fset") - .vertex_in(2, Type::FLOAT, "msk") - .vertex_out(overlay_sculpt_mask_iface) - .vertex_source("overlay_sculpt_mask_vert.glsl") - .fragment_source("overlay_sculpt_mask_frag.glsl") - .fragment_out(0, Type::VEC4, "fragColor") - .additional_info("draw_mesh") - .additional_info("draw_object_infos") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +PUSH_CONSTANT(FLOAT, maskOpacity) +PUSH_CONSTANT(FLOAT, faceSetsOpacity) +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC3, fset) +VERTEX_IN(2, FLOAT, msk) +VERTEX_OUT(overlay_sculpt_mask_iface) +VERTEX_SOURCE("overlay_sculpt_mask_vert.glsl") +FRAGMENT_SOURCE("overlay_sculpt_mask_frag.glsl") +FRAGMENT_OUT(0, VEC4, fragColor) +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_object_infos) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_sculpt_mask_clipped) - .do_static_compilation(true) - .additional_info("overlay_sculpt_mask") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_sculpt_mask) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_viewer_attribute_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_viewer_attribute_info.hh index a9d4771523f..dde4663d503 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_viewer_attribute_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_viewer_attribute_info.hh @@ -4,74 +4,86 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(overlay_viewer_attribute_iface).smooth(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_viewer_attribute_iface) +SMOOTH(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() -GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_common).push_constant(Type::FLOAT, "opacity"); +GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_common) +PUSH_CONSTANT(FLOAT, opacity) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_mesh) - .do_static_compilation(true) - .vertex_source("overlay_viewer_attribute_mesh_vert.glsl") - .fragment_source("overlay_viewer_attribute_frag.glsl") - .fragment_out(0, Type::VEC4, "out_color") - .fragment_out(1, Type::VEC4, "lineOutput") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC4, "attribute_value") - .vertex_out(overlay_viewer_attribute_iface) - .additional_info("overlay_viewer_attribute_common") - .additional_info("draw_mesh"); +DO_STATIC_COMPILATION() +VERTEX_SOURCE("overlay_viewer_attribute_mesh_vert.glsl") +FRAGMENT_SOURCE("overlay_viewer_attribute_frag.glsl") +FRAGMENT_OUT(0, VEC4, out_color) +FRAGMENT_OUT(1, VEC4, lineOutput) +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC4, attribute_value) +VERTEX_OUT(overlay_viewer_attribute_iface) +ADDITIONAL_INFO(overlay_viewer_attribute_common) +ADDITIONAL_INFO(draw_mesh) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_mesh_clipped) - .do_static_compilation(true) - .additional_info("overlay_viewer_attribute_mesh") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_viewer_attribute_mesh) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_pointcloud) - .do_static_compilation(true) - .vertex_source("overlay_viewer_attribute_pointcloud_vert.glsl") - .fragment_source("overlay_viewer_attribute_frag.glsl") - .fragment_out(0, Type::VEC4, "out_color") - .fragment_out(1, Type::VEC4, "lineOutput") - .sampler(3, ImageType::FLOAT_BUFFER, "attribute_tx") - .vertex_out(overlay_viewer_attribute_iface) - .additional_info("overlay_viewer_attribute_common") - .additional_info("draw_pointcloud"); +DO_STATIC_COMPILATION() +VERTEX_SOURCE("overlay_viewer_attribute_pointcloud_vert.glsl") +FRAGMENT_SOURCE("overlay_viewer_attribute_frag.glsl") +FRAGMENT_OUT(0, VEC4, out_color) +FRAGMENT_OUT(1, VEC4, lineOutput) +SAMPLER(3, FLOAT_BUFFER, attribute_tx) +VERTEX_OUT(overlay_viewer_attribute_iface) +ADDITIONAL_INFO(overlay_viewer_attribute_common) +ADDITIONAL_INFO(draw_pointcloud) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_pointcloud_clipped) - .do_static_compilation(true) - .additional_info("overlay_viewer_attribute_pointcloud") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_viewer_attribute_pointcloud) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_curve) - .do_static_compilation(true) - .vertex_source("overlay_viewer_attribute_curve_vert.glsl") - .fragment_source("overlay_viewer_attribute_frag.glsl") - .fragment_out(0, Type::VEC4, "out_color") - .fragment_out(1, Type::VEC4, "lineOutput") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC4, "attribute_value") - .vertex_out(overlay_viewer_attribute_iface) - .additional_info("overlay_viewer_attribute_common") - .additional_info("draw_modelmat") - .additional_info("draw_resource_id"); +DO_STATIC_COMPILATION() +VERTEX_SOURCE("overlay_viewer_attribute_curve_vert.glsl") +FRAGMENT_SOURCE("overlay_viewer_attribute_frag.glsl") +FRAGMENT_OUT(0, VEC4, out_color) +FRAGMENT_OUT(1, VEC4, lineOutput) +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC4, attribute_value) +VERTEX_OUT(overlay_viewer_attribute_iface) +ADDITIONAL_INFO(overlay_viewer_attribute_common) +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(draw_resource_id) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_curve_clipped) - .do_static_compilation(true) - .additional_info("overlay_viewer_attribute_curve") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_viewer_attribute_curve) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_curves) - .do_static_compilation(true) - .vertex_source("overlay_viewer_attribute_curves_vert.glsl") - .fragment_source("overlay_viewer_attribute_frag.glsl") - .fragment_out(0, Type::VEC4, "out_color") - .fragment_out(1, Type::VEC4, "lineOutput") - .sampler(0, ImageType::FLOAT_BUFFER, "color_tx") - .push_constant(Type::BOOL, "is_point_domain") - .vertex_out(overlay_viewer_attribute_iface) - .additional_info("overlay_viewer_attribute_common") - .additional_info("draw_hair"); +DO_STATIC_COMPILATION() +VERTEX_SOURCE("overlay_viewer_attribute_curves_vert.glsl") +FRAGMENT_SOURCE("overlay_viewer_attribute_frag.glsl") +FRAGMENT_OUT(0, VEC4, out_color) +FRAGMENT_OUT(1, VEC4, lineOutput) +SAMPLER(0, FLOAT_BUFFER, color_tx) +PUSH_CONSTANT(BOOL, is_point_domain) +VERTEX_OUT(overlay_viewer_attribute_iface) +ADDITIONAL_INFO(overlay_viewer_attribute_common) +ADDITIONAL_INFO(draw_hair) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_curves_clipped) - .do_static_compilation(true) - .additional_info("overlay_viewer_attribute_curves") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_viewer_attribute_curves) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_volume_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_volume_info.hh index aec5ec31523..2bd30a709ed 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_volume_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_volume_info.hh @@ -8,48 +8,54 @@ /** \name Volume Velocity * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_volume_velocity_iface).smooth(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_volume_velocity_iface) +SMOOTH(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_volume_velocity) - .sampler(0, ImageType::FLOAT_3D, "velocityX") - .sampler(1, ImageType::FLOAT_3D, "velocityY") - .sampler(2, ImageType::FLOAT_3D, "velocityZ") - .push_constant(Type::FLOAT, "displaySize") - .push_constant(Type::FLOAT, "slicePosition") - .push_constant(Type::INT, "sliceAxis") - .push_constant(Type::BOOL, "scaleWithMagnitude") - .push_constant(Type::BOOL, "isCellCentered") - /* FluidDomainSettings.cell_size */ - .push_constant(Type::VEC3, "cellSize") - /* FluidDomainSettings.p0 */ - .push_constant(Type::VEC3, "domainOriginOffset") - /* FluidDomainSettings.res_min */ - .push_constant(Type::IVEC3, "adaptiveCellOffset") - .push_constant(Type::INT, "in_select_id") - .vertex_out(overlay_volume_velocity_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_volume_velocity_vert.glsl") - .fragment_source("overlay_varying_color.glsl"); +SAMPLER(0, FLOAT_3D, velocityX) +SAMPLER(1, FLOAT_3D, velocityY) +SAMPLER(2, FLOAT_3D, velocityZ) +PUSH_CONSTANT(FLOAT, displaySize) +PUSH_CONSTANT(FLOAT, slicePosition) +PUSH_CONSTANT(INT, sliceAxis) +PUSH_CONSTANT(BOOL, scaleWithMagnitude) +PUSH_CONSTANT(BOOL, isCellCentered) +/* FluidDomainSettings.cell_size */ +PUSH_CONSTANT(VEC3, cellSize) +/* FluidDomainSettings.p0 */ +PUSH_CONSTANT(VEC3, domainOriginOffset) +/* FluidDomainSettings.res_min */ +PUSH_CONSTANT(IVEC3, adaptiveCellOffset) +PUSH_CONSTANT(INT, in_select_id) +VERTEX_OUT(overlay_volume_velocity_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_volume_velocity_vert.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_volume_velocity_streamline) - .do_static_compilation(true) - .additional_info("draw_volume") - .additional_info("overlay_volume_velocity"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(draw_volume) +ADDITIONAL_INFO(overlay_volume_velocity) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_volume_velocity_mac) - .do_static_compilation(true) - .define("USE_MAC") - .push_constant(Type::BOOL, "drawMACX") - .push_constant(Type::BOOL, "drawMACY") - .push_constant(Type::BOOL, "drawMACZ") - .additional_info("draw_volume") - .additional_info("overlay_volume_velocity"); +DO_STATIC_COMPILATION() +DEFINE("USE_MAC") +PUSH_CONSTANT(BOOL, drawMACX) +PUSH_CONSTANT(BOOL, drawMACY) +PUSH_CONSTANT(BOOL, drawMACZ) +ADDITIONAL_INFO(draw_volume) +ADDITIONAL_INFO(overlay_volume_velocity) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_volume_velocity_needle) - .do_static_compilation(true) - .define("USE_NEEDLE") - .additional_info("draw_volume") - .additional_info("overlay_volume_velocity"); +DO_STATIC_COMPILATION() +DEFINE("USE_NEEDLE") +ADDITIONAL_INFO(draw_volume) +ADDITIONAL_INFO(overlay_volume_velocity) +GPU_SHADER_CREATE_END() /** \} */ @@ -57,47 +63,53 @@ GPU_SHADER_CREATE_INFO(overlay_volume_velocity_needle) /** \name Volume Grid-Lines * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_volume_gridlines_iface).flat(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_volume_gridlines_iface) +FLAT(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_volume_gridlines) - .push_constant(Type::FLOAT, "slicePosition") - .push_constant(Type::INT, "sliceAxis") - /* FluidDomainSettings.res */ - .push_constant(Type::IVEC3, "volumeSize") - /* FluidDomainSettings.cell_size */ - .push_constant(Type::VEC3, "cellSize") - /* FluidDomainSettings.p0 */ - .push_constant(Type::VEC3, "domainOriginOffset") - /* FluidDomainSettings.res_min */ - .push_constant(Type::IVEC3, "adaptiveCellOffset") - .push_constant(Type::INT, "in_select_id") - .vertex_out(overlay_volume_gridlines_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_volume_gridlines_vert.glsl") - .fragment_source("overlay_varying_color.glsl"); +PUSH_CONSTANT(FLOAT, slicePosition) +PUSH_CONSTANT(INT, sliceAxis) +/* FluidDomainSettings.res */ +PUSH_CONSTANT(IVEC3, volumeSize) +/* FluidDomainSettings.cell_size */ +PUSH_CONSTANT(VEC3, cellSize) +/* FluidDomainSettings.p0 */ +PUSH_CONSTANT(VEC3, domainOriginOffset) +/* FluidDomainSettings.res_min */ +PUSH_CONSTANT(IVEC3, adaptiveCellOffset) +PUSH_CONSTANT(INT, in_select_id) +VERTEX_OUT(overlay_volume_gridlines_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_volume_gridlines_vert.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_volume_gridlines_flat) - .do_static_compilation(true) - .additional_info("draw_volume") - .additional_info("overlay_volume_gridlines"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(draw_volume) +ADDITIONAL_INFO(overlay_volume_gridlines) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_volume_gridlines_flags) - .do_static_compilation(true) - .define("SHOW_FLAGS") - .sampler(0, ImageType::UINT_3D, "flagTexture") - .additional_info("draw_volume") - .additional_info("overlay_volume_gridlines"); +DO_STATIC_COMPILATION() +DEFINE("SHOW_FLAGS") +SAMPLER(0, UINT_3D, flagTexture) +ADDITIONAL_INFO(draw_volume) +ADDITIONAL_INFO(overlay_volume_gridlines) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_volume_gridlines_range) - .do_static_compilation(true) - .define("SHOW_RANGE") - .push_constant(Type::FLOAT, "lowerBound") - .push_constant(Type::FLOAT, "upperBound") - .push_constant(Type::VEC4, "rangeColor") - .push_constant(Type::INT, "cellFilter") - .sampler(0, ImageType::UINT_3D, "flagTexture") - .sampler(1, ImageType::FLOAT_3D, "fieldTexture") - .additional_info("draw_volume") - .additional_info("overlay_volume_gridlines"); +DO_STATIC_COMPILATION() +DEFINE("SHOW_RANGE") +PUSH_CONSTANT(FLOAT, lowerBound) +PUSH_CONSTANT(FLOAT, upperBound) +PUSH_CONSTANT(VEC4, rangeColor) +PUSH_CONSTANT(INT, cellFilter) +SAMPLER(0, UINT_3D, flagTexture) +SAMPLER(1, FLOAT_3D, fieldTexture) +ADDITIONAL_INFO(draw_volume) +ADDITIONAL_INFO(overlay_volume_gridlines) +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_wireframe_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_wireframe_info.hh index 861c6b4b783..1e44ffe6c47 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_wireframe_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_wireframe_info.hh @@ -5,117 +5,128 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_INTERFACE_INFO(overlay_wireframe_iface) - .smooth(Type::VEC4, "finalColor") - .flat(Type::VEC2, "edgeStart") - .no_perspective(Type::VEC2, "edgePos"); +SMOOTH(VEC4, finalColor) +FLAT(VEC2, edgeStart) +NO_PERSPECTIVE(VEC2, edgePos) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_wireframe) - .do_static_compilation(true) - .push_constant(Type::FLOAT, "wireStepParam") - .push_constant(Type::FLOAT, "wireOpacity") - .push_constant(Type::BOOL, "useColoring") - .push_constant(Type::BOOL, "isTransform") - .push_constant(Type::INT, "colorType") - .push_constant(Type::BOOL, "isHair") - .push_constant(Type::MAT4, "hairDupliMatrix") - /* Scene Depth texture copy for manual depth test. */ - .sampler(0, ImageType::DEPTH_2D, "depthTex") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC3, "nor") - .vertex_in(2, Type::FLOAT, "wd") /* wire-data. */ - .vertex_out(overlay_wireframe_iface) - .vertex_source("overlay_wireframe_vert.glsl") - .fragment_source("overlay_wireframe_frag.glsl") - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "lineOutput") - .depth_write(DepthWrite::ANY) - .additional_info("draw_mesh") - .additional_info("draw_object_infos") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +PUSH_CONSTANT(FLOAT, wireStepParam) +PUSH_CONSTANT(FLOAT, wireOpacity) +PUSH_CONSTANT(BOOL, useColoring) +PUSH_CONSTANT(BOOL, isTransform) +PUSH_CONSTANT(INT, colorType) +PUSH_CONSTANT(BOOL, isHair) +PUSH_CONSTANT(MAT4, hairDupliMatrix) +/* Scene Depth texture copy for manual depth test. */ +SAMPLER(0, DEPTH_2D, depthTex) +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC3, nor) +VERTEX_IN(2, FLOAT, wd) /* wire-data. */ +VERTEX_OUT(overlay_wireframe_iface) +VERTEX_SOURCE("overlay_wireframe_vert.glsl") +FRAGMENT_SOURCE("overlay_wireframe_frag.glsl") +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, lineOutput) +DEPTH_WRITE(DepthWrite::ANY) +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_object_infos) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_wireframe_curve) - .do_static_compilation(true) - .define("CURVES") - .push_constant(Type::FLOAT, "wireOpacity") - .push_constant(Type::BOOL, "useColoring") - .push_constant(Type::BOOL, "isTransform") - .push_constant(Type::INT, "colorType") - .vertex_in(0, Type::VEC3, "pos") - .vertex_out(overlay_wireframe_iface) - .vertex_source("overlay_wireframe_vert.glsl") - .fragment_source("overlay_wireframe_frag.glsl") - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "lineOutput") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new") - .additional_info("draw_object_infos_new") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +DEFINE("CURVES") +PUSH_CONSTANT(FLOAT, wireOpacity) +PUSH_CONSTANT(BOOL, useColoring) +PUSH_CONSTANT(BOOL, isTransform) +PUSH_CONSTANT(INT, colorType) +VERTEX_IN(0, VEC3, pos) +VERTEX_OUT(overlay_wireframe_iface) +VERTEX_SOURCE("overlay_wireframe_vert.glsl") +FRAGMENT_SOURCE("overlay_wireframe_frag.glsl") +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, lineOutput) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(draw_object_infos_new) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(overlay_wireframe_points_iface) - .flat(Type::VEC4, "finalColor") - .flat(Type::VEC4, "finalColorInner"); +FLAT(VEC4, finalColor) +FLAT(VEC4, finalColorInner) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_wireframe_points) - .do_static_compilation(true) - .define("POINTS") - .push_constant(Type::BOOL, "useColoring") - .push_constant(Type::BOOL, "isTransform") - .push_constant(Type::INT, "colorType") - .vertex_in(0, Type::VEC3, "pos") - .vertex_out(overlay_wireframe_points_iface) - .vertex_source("overlay_wireframe_vert.glsl") - .fragment_source("overlay_wireframe_frag.glsl") - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "lineOutput") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new") - .additional_info("draw_object_infos_new") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +DEFINE("POINTS") +PUSH_CONSTANT(BOOL, useColoring) +PUSH_CONSTANT(BOOL, isTransform) +PUSH_CONSTANT(INT, colorType) +VERTEX_IN(0, VEC3, pos) +VERTEX_OUT(overlay_wireframe_points_iface) +VERTEX_SOURCE("overlay_wireframe_vert.glsl") +FRAGMENT_SOURCE("overlay_wireframe_frag.glsl") +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, lineOutput) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(draw_object_infos_new) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_wireframe_clipped) - .do_static_compilation(true) - .additional_info("overlay_wireframe") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_wireframe) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_wireframe_custom_depth) - .do_static_compilation(true) - .define("CUSTOM_DEPTH_BIAS") - .additional_info("overlay_wireframe"); +DO_STATIC_COMPILATION() +DEFINE("CUSTOM_DEPTH_BIAS") +ADDITIONAL_INFO(overlay_wireframe) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_wireframe_custom_depth_clipped) - .do_static_compilation(true) - .additional_info("overlay_wireframe_custom_depth") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_wireframe_custom_depth) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_wireframe_select) - .do_static_compilation(true) - .define("SELECT_EDGES") - .additional_info("overlay_wireframe"); +DO_STATIC_COMPILATION() +DEFINE("SELECT_EDGES") +ADDITIONAL_INFO(overlay_wireframe) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_wireframe_select_clipped) - .do_static_compilation(true) - .additional_info("overlay_wireframe_select") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_wireframe_select) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_wireframe_uv) - .do_static_compilation(true) - .define("WIREFRAME") - .storage_buf(0, Qualifier::READ, "float", "au[]", Frequency::GEOMETRY) - .push_constant(Type::IVEC2, "gpu_attr_0") - .define("lineStyle", "4" /* OVERLAY_UV_LINE_STYLE_SHADOW */) - .define("dashLength", "1" /* Not used by this line style */) - .define("use_edge_select", "false") - .push_constant(Type::BOOL, "doSmoothWire") - .push_constant(Type::FLOAT, "alpha") - .vertex_out(overlay_edit_uv_next_iface) - .fragment_out(0, Type::VEC4, "fragColor") - /* Note: Reuse edit mode shader as it is mostly the same. */ - .vertex_source("overlay_edit_uv_edges_next_vert.glsl") - .fragment_source("overlay_edit_uv_edges_next_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new") - .additional_info("gpu_index_load") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +DEFINE("WIREFRAME") +STORAGE_BUF_FREQ(0, READ, float, au[], GEOMETRY) +PUSH_CONSTANT(IVEC2, gpu_attr_0) +DEFINE_VALUE("lineStyle", "4" /* OVERLAY_UV_LINE_STYLE_SHADOW */) +DEFINE_VALUE("dashLength", "1" /* Not used by this line style */) +DEFINE_VALUE("use_edge_select", "false") +PUSH_CONSTANT(BOOL, doSmoothWire) +PUSH_CONSTANT(FLOAT, alpha) +VERTEX_OUT(overlay_edit_uv_next_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +/* Note: Reuse edit mode shader as it is mostly the same. */ +VERTEX_SOURCE("overlay_edit_uv_edges_next_vert.glsl") +FRAGMENT_SOURCE("overlay_edit_uv_edges_next_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(gpu_index_load) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/select/shaders/infos/select_id_info.hh b/source/blender/draw/engines/select/shaders/infos/select_id_info.hh index b3fc907e509..b2c30fda0ab 100644 --- a/source/blender/draw/engines/select/shaders/infos/select_id_info.hh +++ b/source/blender/draw/engines/select/shaders/infos/select_id_info.hh @@ -9,60 +9,68 @@ /** \name Select ID for Edit Mesh Selection * \{ */ -GPU_SHADER_INTERFACE_INFO(select_id_iface).flat(Type::INT, "select_id"); +GPU_SHADER_INTERFACE_INFO(select_id_iface) +FLAT(INT, select_id) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(select_id_flat) - .push_constant(Type::FLOAT, "sizeVertex") - .push_constant(Type::INT, "offset") - .push_constant(Type::FLOAT, "retopologyOffset") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::INT, "index") - .vertex_out(select_id_iface) - .fragment_out(0, Type::UINT, "fragColor") - .vertex_source("select_id_vert.glsl") - .fragment_source("select_id_frag.glsl") - .additional_info("draw_modelmat") - .do_static_compilation(true); +PUSH_CONSTANT(FLOAT, sizeVertex) +PUSH_CONSTANT(INT, offset) +PUSH_CONSTANT(FLOAT, retopologyOffset) +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, INT, index) +VERTEX_OUT(select_id_iface) +FRAGMENT_OUT(0, UINT, fragColor) +VERTEX_SOURCE("select_id_vert.glsl") +FRAGMENT_SOURCE("select_id_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(select_id_uniform) - .define("UNIFORM_ID") - .push_constant(Type::FLOAT, "sizeVertex") - .push_constant(Type::INT, "select_id") - .push_constant(Type::FLOAT, "retopologyOffset") - .vertex_in(0, Type::VEC3, "pos") - .fragment_out(0, Type::UINT, "fragColor") - .vertex_source("select_id_vert.glsl") - .fragment_source("select_id_frag.glsl") - .additional_info("draw_modelmat") - .do_static_compilation(true); +DEFINE("UNIFORM_ID") +PUSH_CONSTANT(FLOAT, sizeVertex) +PUSH_CONSTANT(INT, select_id) +PUSH_CONSTANT(FLOAT, retopologyOffset) +VERTEX_IN(0, VEC3, pos) +FRAGMENT_OUT(0, UINT, fragColor) +VERTEX_SOURCE("select_id_vert.glsl") +FRAGMENT_SOURCE("select_id_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(select_id_flat_clipped) - .additional_info("select_id_flat") - .additional_info("drw_clipped") - .do_static_compilation(true); +ADDITIONAL_INFO(select_id_flat) +ADDITIONAL_INFO(drw_clipped) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(select_id_uniform_clipped) - .additional_info("select_id_uniform") - .additional_info("drw_clipped") - .do_static_compilation(true); +ADDITIONAL_INFO(select_id_uniform) +ADDITIONAL_INFO(drw_clipped) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* Used to patch overlay shaders. */ GPU_SHADER_CREATE_INFO(select_id_patch) - .typedef_source("select_shader_shared.hh") - .vertex_out(select_id_iface) - /* Need to make sure the depth & stencil comparison runs before the fragment shader. */ - .early_fragment_test(true) - .uniform_buf(SELECT_DATA, "SelectInfoData", "select_info_buf") - /* Select IDs for instanced draw-calls not using #PassMain. */ - .storage_buf(SELECT_ID_IN, Qualifier::READ, "int", "in_select_buf[]") - /* Stores the result of the whole selection drawing. Content depends on selection mode. */ - .storage_buf(SELECT_ID_OUT, Qualifier::READ_WRITE, "uint", "out_select_buf[]"); +TYPEDEF_SOURCE("select_shader_shared.hh") +VERTEX_OUT(select_id_iface) +/* Need to make sure the depth & stencil comparison runs before the fragment shader. */ +EARLY_FRAGMENT_TEST(true) +UNIFORM_BUF(SELECT_DATA, SelectInfoData, select_info_buf) +/* Select IDs for instanced draw-calls not using #PassMain. */ +STORAGE_BUF(SELECT_ID_IN, READ, int, in_select_buf[]) +/* Stores the result of the whole selection drawing. Content depends on selection mode. */ +STORAGE_BUF(SELECT_ID_OUT, READ_WRITE, uint, out_select_buf[]) +GPU_SHADER_CREATE_END() /** \} */ GPU_SHADER_CREATE_INFO(select_debug_fullscreen) - .additional_info("draw_fullscreen") - .fragment_source("select_debug_frag.glsl") - .sampler(0, ImageType::UINT_2D, "image") - .fragment_out(0, Type::VEC4, "fragColor") - .do_static_compilation(true); +ADDITIONAL_INFO(draw_fullscreen) +FRAGMENT_SOURCE("select_debug_frag.glsl") +SAMPLER(0, UINT_2D, image) +FRAGMENT_OUT(0, VEC4, fragColor) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh index 25cf6a908ed..b8c29af8d7c 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh @@ -10,43 +10,52 @@ * \{ */ GPU_SHADER_CREATE_INFO(workbench_composite) - .sampler(3, ImageType::DEPTH_2D, "depth_tx") - .sampler(4, ImageType::FLOAT_2D, "normal_tx") - .sampler(5, ImageType::FLOAT_2D, "material_tx") - .uniform_buf(WB_WORLD_SLOT, "WorldData", "world_data") - .typedef_source("workbench_shader_shared.h") - .push_constant(Type::BOOL, "forceShadowing") - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_source("workbench_composite_frag.glsl") - .additional_info("draw_fullscreen") - .additional_info("draw_view"); +SAMPLER(3, DEPTH_2D, depth_tx) +SAMPLER(4, FLOAT_2D, normal_tx) +SAMPLER(5, FLOAT_2D, material_tx) +UNIFORM_BUF(WB_WORLD_SLOT, WorldData, world_data) +TYPEDEF_SOURCE("workbench_shader_shared.h") +PUSH_CONSTANT(BOOL, forceShadowing) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_SOURCE("workbench_composite_frag.glsl") +ADDITIONAL_INFO(draw_fullscreen) +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() /* Lighting */ -GPU_SHADER_CREATE_INFO(workbench_resolve_opaque_studio).define("WORKBENCH_LIGHTING_STUDIO"); +GPU_SHADER_CREATE_INFO(workbench_resolve_opaque_studio) +DEFINE("WORKBENCH_LIGHTING_STUDIO") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_resolve_opaque_matcap) - .define("WORKBENCH_LIGHTING_MATCAP") - .sampler(WB_MATCAP_SLOT, ImageType::FLOAT_2D_ARRAY, "matcap_tx"); +DEFINE("WORKBENCH_LIGHTING_MATCAP") +SAMPLER(WB_MATCAP_SLOT, FLOAT_2D_ARRAY, matcap_tx) +GPU_SHADER_CREATE_END() -GPU_SHADER_CREATE_INFO(workbench_resolve_opaque_flat).define("WORKBENCH_LIGHTING_FLAT"); +GPU_SHADER_CREATE_INFO(workbench_resolve_opaque_flat) +DEFINE("WORKBENCH_LIGHTING_FLAT") +GPU_SHADER_CREATE_END() /* Effects */ GPU_SHADER_CREATE_INFO(workbench_resolve_curvature) - .define("WORKBENCH_CURVATURE") - .sampler(6, ImageType::UINT_2D, "object_id_tx"); +DEFINE("WORKBENCH_CURVATURE") +SAMPLER(6, UINT_2D, object_id_tx) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_resolve_cavity) - .define("WORKBENCH_CAVITY") - /* TODO(@pragma37): GPU_SAMPLER_EXTEND_MODE_REPEAT is set in CavityEffect, - * it doesn't work here? */ - .sampler(7, ImageType::FLOAT_2D, "jitter_tx") - .uniform_buf(5, "vec4", "cavity_samples[512]"); +DEFINE("WORKBENCH_CAVITY") +/* TODO(@pragma37): GPU_SAMPLER_EXTEND_MODE_REPEAT is set in CavityEffect, + * it doesn't work here? */ +SAMPLER(7, FLOAT_2D, jitter_tx) +UNIFORM_BUF(5, vec4, cavity_samples[512]) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_resolve_shadow) - .define("WORKBENCH_SHADOW") - .sampler(8, ImageType::UINT_2D, "stencil_tx"); +DEFINE("WORKBENCH_SHADOW") +SAMPLER(8, UINT_2D, stencil_tx) +GPU_SHADER_CREATE_END() /* Variations */ diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_depth_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_depth_info.hh index 2d471595090..a5c93de9087 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_depth_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_depth_info.hh @@ -5,20 +5,23 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(workbench_merge_depth) - .sampler(0, ImageType::DEPTH_2D, "depth_tx") - .fragment_source("workbench_merge_depth_frag.glsl") - .additional_info("draw_fullscreen") - .depth_write(DepthWrite::ANY) - .do_static_compilation(true); +SAMPLER(0, DEPTH_2D, depth_tx) +FRAGMENT_SOURCE("workbench_merge_depth_frag.glsl") +ADDITIONAL_INFO(draw_fullscreen) +DEPTH_WRITE(DepthWrite::ANY) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_overlay_depth) - .fragment_source("workbench_overlay_depth_frag.glsl") - .additional_info("draw_fullscreen") - .depth_write(DepthWrite::ANY) - .do_static_compilation(true); +FRAGMENT_SOURCE("workbench_overlay_depth_frag.glsl") +ADDITIONAL_INFO(draw_fullscreen) +DEPTH_WRITE(DepthWrite::ANY) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_extract_stencil) - .fragment_out(0, Type::UINT, "out_stencil_value") - .fragment_source("workbench_extract_stencil.glsl") - .additional_info("draw_fullscreen") - .do_static_compilation(true); +FRAGMENT_OUT(0, UINT, out_stencil_value) +FRAGMENT_SOURCE("workbench_extract_stencil.glsl") +ADDITIONAL_INFO(draw_fullscreen) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_antialiasing_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_antialiasing_info.hh index 345f766e302..1f3cac83cc9 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_antialiasing_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_antialiasing_info.hh @@ -9,12 +9,13 @@ * \{ */ GPU_SHADER_CREATE_INFO(workbench_taa) - .sampler(0, ImageType::FLOAT_2D, "colorBuffer") - .push_constant(Type::FLOAT, "samplesWeights", 9) - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_source("workbench_effect_taa_frag.glsl") - .additional_info("draw_fullscreen") - .do_static_compilation(true); +SAMPLER(0, FLOAT_2D, colorBuffer) +PUSH_CONSTANT_ARRAY(FLOAT, samplesWeights, 9) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_SOURCE("workbench_effect_taa_frag.glsl") +ADDITIONAL_INFO(draw_fullscreen) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /** \} */ @@ -23,45 +24,50 @@ GPU_SHADER_CREATE_INFO(workbench_taa) * \{ */ GPU_SHADER_INTERFACE_INFO(workbench_smaa_iface) - .smooth(Type::VEC2, "uvs") - .smooth(Type::VEC2, "pixcoord") - .smooth(Type::VEC4, "offset[3]"); +SMOOTH(VEC2, uvs) +SMOOTH(VEC2, pixcoord) +SMOOTH(VEC4, offset[3]) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(workbench_smaa) - .define("SMAA_GLSL_3") - .define("SMAA_RT_METRICS", "viewportMetrics") - .define("SMAA_PRESET_HIGH") - .define("SMAA_LUMA_WEIGHT", "float4(1.0, 1.0, 1.0, 1.0)") - .define("SMAA_NO_DISCARD") - .vertex_out(workbench_smaa_iface) - .push_constant(Type::VEC4, "viewportMetrics") - .vertex_source("workbench_effect_smaa_vert.glsl") - .fragment_source("workbench_effect_smaa_frag.glsl"); +DEFINE("SMAA_GLSL_3") +DEFINE_VALUE("SMAA_RT_METRICS", "viewportMetrics") +DEFINE("SMAA_PRESET_HIGH") +DEFINE_VALUE("SMAA_LUMA_WEIGHT", "float4(1.0, 1.0, 1.0, 1.0)") +DEFINE("SMAA_NO_DISCARD") +VERTEX_OUT(workbench_smaa_iface) +PUSH_CONSTANT(VEC4, viewportMetrics) +VERTEX_SOURCE("workbench_effect_smaa_vert.glsl") +FRAGMENT_SOURCE("workbench_effect_smaa_frag.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_smaa_stage_0) - .define("SMAA_STAGE", "0") - .sampler(0, ImageType::FLOAT_2D, "colorTex") - .fragment_out(0, Type::VEC2, "out_edges") - .additional_info("workbench_smaa") - .do_static_compilation(true); +DEFINE_VALUE("SMAA_STAGE", "0") +SAMPLER(0, FLOAT_2D, colorTex) +FRAGMENT_OUT(0, VEC2, out_edges) +ADDITIONAL_INFO(workbench_smaa) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_smaa_stage_1) - .define("SMAA_STAGE", "1") - .sampler(0, ImageType::FLOAT_2D, "edgesTex") - .sampler(1, ImageType::FLOAT_2D, "areaTex") - .sampler(2, ImageType::FLOAT_2D, "searchTex") - .fragment_out(0, Type::VEC4, "out_weights") - .additional_info("workbench_smaa") - .do_static_compilation(true); +DEFINE_VALUE("SMAA_STAGE", "1") +SAMPLER(0, FLOAT_2D, edgesTex) +SAMPLER(1, FLOAT_2D, areaTex) +SAMPLER(2, FLOAT_2D, searchTex) +FRAGMENT_OUT(0, VEC4, out_weights) +ADDITIONAL_INFO(workbench_smaa) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_smaa_stage_2) - .define("SMAA_STAGE", "2") - .sampler(0, ImageType::FLOAT_2D, "colorTex") - .sampler(1, ImageType::FLOAT_2D, "blendTex") - .push_constant(Type::FLOAT, "mixFactor") - .push_constant(Type::FLOAT, "taaAccumulatedWeight") - .fragment_out(0, Type::VEC4, "out_color") - .additional_info("workbench_smaa") - .do_static_compilation(true); +DEFINE_VALUE("SMAA_STAGE", "2") +SAMPLER(0, FLOAT_2D, colorTex) +SAMPLER(1, FLOAT_2D, blendTex) +PUSH_CONSTANT(FLOAT, mixFactor) +PUSH_CONSTANT(FLOAT, taaAccumulatedWeight) +FRAGMENT_OUT(0, VEC4, out_color) +ADDITIONAL_INFO(workbench_smaa) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_dof_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_dof_info.hh index a7ef011e6ca..7ba5b44cc0c 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_dof_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_dof_info.hh @@ -5,54 +5,60 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(workbench_effect_dof) - /* TODO(fclem): Split resources per stage. */ - .sampler(0, ImageType::FLOAT_2D, "inputCocTex") - .sampler(1, ImageType::FLOAT_2D, "maxCocTilesTex") - .sampler(2, ImageType::FLOAT_2D, "sceneColorTex") - .sampler(3, ImageType::FLOAT_2D, "sceneDepthTex") - .sampler(4, ImageType::FLOAT_2D, "backgroundTex") - .sampler(5, ImageType::FLOAT_2D, "halfResColorTex") - .sampler(6, ImageType::FLOAT_2D, "blurTex") - .sampler(7, ImageType::FLOAT_2D, "noiseTex") - .push_constant(Type::VEC2, "invertedViewportSize") - .push_constant(Type::VEC2, "nearFar") - .push_constant(Type::VEC3, "dofParams") - .push_constant(Type::FLOAT, "noiseOffset") - .fragment_source("workbench_effect_dof_frag.glsl") - .additional_info("draw_fullscreen") - .additional_info("draw_view"); +/* TODO(fclem): Split resources per stage. */ +SAMPLER(0, FLOAT_2D, inputCocTex) +SAMPLER(1, FLOAT_2D, maxCocTilesTex) +SAMPLER(2, FLOAT_2D, sceneColorTex) +SAMPLER(3, FLOAT_2D, sceneDepthTex) +SAMPLER(4, FLOAT_2D, backgroundTex) +SAMPLER(5, FLOAT_2D, halfResColorTex) +SAMPLER(6, FLOAT_2D, blurTex) +SAMPLER(7, FLOAT_2D, noiseTex) +PUSH_CONSTANT(VEC2, invertedViewportSize) +PUSH_CONSTANT(VEC2, nearFar) +PUSH_CONSTANT(VEC3, dofParams) +PUSH_CONSTANT(FLOAT, noiseOffset) +FRAGMENT_SOURCE("workbench_effect_dof_frag.glsl") +ADDITIONAL_INFO(draw_fullscreen) +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_effect_dof_prepare) - .define("PREPARE") - .fragment_out(0, Type::VEC4, "halfResColor") - .fragment_out(1, Type::VEC2, "normalizedCoc") - .additional_info("workbench_effect_dof") - .do_static_compilation(true); +DEFINE("PREPARE") +FRAGMENT_OUT(0, VEC4, halfResColor) +FRAGMENT_OUT(1, VEC2, normalizedCoc) +ADDITIONAL_INFO(workbench_effect_dof) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_effect_dof_downsample) - .define("DOWNSAMPLE") - .fragment_out(0, Type::VEC4, "outColor") - .fragment_out(1, Type::VEC2, "outCocs") - .additional_info("workbench_effect_dof") - .do_static_compilation(true); +DEFINE("DOWNSAMPLE") +FRAGMENT_OUT(0, VEC4, outColor) +FRAGMENT_OUT(1, VEC2, outCocs) +ADDITIONAL_INFO(workbench_effect_dof) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_effect_dof_blur1) - .define("BLUR1") - .define("NUM_SAMPLES", "49") - .uniform_buf(1, "vec4", "samples[49]") - .fragment_out(0, Type::VEC4, "blurColor") - .additional_info("workbench_effect_dof") - .do_static_compilation(true); +DEFINE("BLUR1") +DEFINE_VALUE("NUM_SAMPLES", "49") +UNIFORM_BUF(1, vec4, samples[49]) +FRAGMENT_OUT(0, VEC4, blurColor) +ADDITIONAL_INFO(workbench_effect_dof) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_effect_dof_blur2) - .define("BLUR2") - .fragment_out(0, Type::VEC4, "finalColor") - .additional_info("workbench_effect_dof") - .do_static_compilation(true); +DEFINE("BLUR2") +FRAGMENT_OUT(0, VEC4, finalColor) +ADDITIONAL_INFO(workbench_effect_dof) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_effect_dof_resolve) - .define("RESOLVE") - .fragment_out(0, Type::VEC4, "finalColorAdd", DualBlend::SRC_0) - .fragment_out(0, Type::VEC4, "finalColorMul", DualBlend::SRC_1) - .additional_info("workbench_effect_dof") - .do_static_compilation(true); +DEFINE("RESOLVE") +FRAGMENT_OUT_DUAL(0, VEC4, finalColorAdd, SRC_0) +FRAGMENT_OUT_DUAL(0, VEC4, finalColorMul, SRC_1) +ADDITIONAL_INFO(workbench_effect_dof) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_outline_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_outline_info.hh index e820dbfd120..39248506eef 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_outline_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_outline_info.hh @@ -5,10 +5,11 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(workbench_effect_outline) - .typedef_source("workbench_shader_shared.h") - .fragment_source("workbench_effect_outline_frag.glsl") - .sampler(0, ImageType::UINT_2D, "objectIdBuffer") - .uniform_buf(WB_WORLD_SLOT, "WorldData", "world_data") - .fragment_out(0, Type::VEC4, "fragColor") - .additional_info("draw_fullscreen") - .do_static_compilation(true); +TYPEDEF_SOURCE("workbench_shader_shared.h") +FRAGMENT_SOURCE("workbench_effect_outline_frag.glsl") +SAMPLER(0, UINT_2D, objectIdBuffer) +UNIFORM_BUF(WB_WORLD_SLOT, WorldData, world_data) +FRAGMENT_OUT(0, VEC4, fragColor) +ADDITIONAL_INFO(draw_fullscreen) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_prepass_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_prepass_info.hh index af0baa6b80c..4dffaf7ac0c 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_prepass_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_prepass_info.hh @@ -5,33 +5,38 @@ #include "gpu_shader_create_info.hh" #include "workbench_defines.hh" +#include "draw_view_info.hh" + /* -------------------------------------------------------------------- */ /** \name Object Type * \{ */ GPU_SHADER_CREATE_INFO(workbench_mesh) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC3, "nor") - .vertex_in(2, Type::VEC4, "ac") - .vertex_in(3, Type::VEC2, "au") - .vertex_source("workbench_prepass_vert.glsl") - .additional_info("draw_modelmat_new_with_custom_id") - .additional_info("draw_resource_handle_new"); +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC3, nor) +VERTEX_IN(2, VEC4, ac) +VERTEX_IN(3, VEC2, au) +VERTEX_SOURCE("workbench_prepass_vert.glsl") +ADDITIONAL_INFO(draw_modelmat_new_with_custom_id) +ADDITIONAL_INFO(draw_resource_handle_new) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_curves) - .sampler(WB_CURVES_COLOR_SLOT, ImageType::FLOAT_BUFFER, "ac", Frequency::BATCH) - .sampler(WB_CURVES_UV_SLOT, ImageType::FLOAT_BUFFER, "au", Frequency::BATCH) - .push_constant(Type::INT, "emitter_object_id") - .vertex_source("workbench_prepass_hair_vert.glsl") - .additional_info("draw_modelmat_new_with_custom_id") - .additional_info("draw_resource_handle_new") - .additional_info("draw_hair_new"); +SAMPLER_FREQ(WB_CURVES_COLOR_SLOT, FLOAT_BUFFER, ac, BATCH) +SAMPLER_FREQ(WB_CURVES_UV_SLOT, FLOAT_BUFFER, au, BATCH) +PUSH_CONSTANT(INT, emitter_object_id) +VERTEX_SOURCE("workbench_prepass_hair_vert.glsl") +ADDITIONAL_INFO(draw_modelmat_new_with_custom_id) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(draw_hair_new) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_pointcloud) - .vertex_source("workbench_prepass_pointcloud_vert.glsl") - .additional_info("draw_modelmat_new_with_custom_id") - .additional_info("draw_resource_handle_new") - .additional_info("draw_pointcloud_new"); +VERTEX_SOURCE("workbench_prepass_pointcloud_vert.glsl") +ADDITIONAL_INFO(draw_modelmat_new_with_custom_id) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(draw_pointcloud_new) +GPU_SHADER_CREATE_END() /** \} */ @@ -39,11 +44,16 @@ GPU_SHADER_CREATE_INFO(workbench_pointcloud) /** \name Lighting Type (only for transparent) * \{ */ -GPU_SHADER_CREATE_INFO(workbench_lighting_flat).define("WORKBENCH_LIGHTING_FLAT"); -GPU_SHADER_CREATE_INFO(workbench_lighting_studio).define("WORKBENCH_LIGHTING_STUDIO"); +GPU_SHADER_CREATE_INFO(workbench_lighting_flat) +DEFINE("WORKBENCH_LIGHTING_FLAT") +GPU_SHADER_CREATE_END() +GPU_SHADER_CREATE_INFO(workbench_lighting_studio) +DEFINE("WORKBENCH_LIGHTING_STUDIO") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_lighting_matcap) - .define("WORKBENCH_LIGHTING_MATCAP") - .sampler(WB_MATCAP_SLOT, ImageType::FLOAT_2D_ARRAY, "matcap_tx"); +DEFINE("WORKBENCH_LIGHTING_MATCAP") +SAMPLER(WB_MATCAP_SLOT, FLOAT_2D_ARRAY, matcap_tx) +GPU_SHADER_CREATE_END() /** \} */ @@ -52,37 +62,43 @@ GPU_SHADER_CREATE_INFO(workbench_lighting_matcap) * \{ */ GPU_SHADER_INTERFACE_INFO(workbench_material_iface) - .smooth(Type::VEC3, "normal_interp") - .smooth(Type::VEC3, "color_interp") - .smooth(Type::FLOAT, "alpha_interp") - .smooth(Type::VEC2, "uv_interp") - .flat(Type::INT, "object_id") - .flat(Type::FLOAT, "_roughness") - .flat(Type::FLOAT, "metallic"); +SMOOTH(VEC3, normal_interp) +SMOOTH(VEC3, color_interp) +SMOOTH(FLOAT, alpha_interp) +SMOOTH(VEC2, uv_interp) +FLAT(INT, object_id) +FLAT(FLOAT, _roughness) +FLAT(FLOAT, metallic) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(workbench_color_material) - .define("WORKBENCH_COLOR_MATERIAL") - .storage_buf(WB_MATERIAL_SLOT, Qualifier::READ, "vec4", "materials_data[]"); +DEFINE("WORKBENCH_COLOR_MATERIAL") +STORAGE_BUF(WB_MATERIAL_SLOT, READ, vec4, materials_data[]) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_color_texture) - .define("WORKBENCH_COLOR_TEXTURE") - .define("WORKBENCH_TEXTURE_IMAGE_ARRAY") - .define("WORKBENCH_COLOR_MATERIAL") - .storage_buf(WB_MATERIAL_SLOT, Qualifier::READ, "vec4", "materials_data[]") - .sampler(WB_TEXTURE_SLOT, ImageType::FLOAT_2D, "imageTexture", Frequency::BATCH) - .sampler(WB_TILE_ARRAY_SLOT, ImageType::FLOAT_2D_ARRAY, "imageTileArray", Frequency::BATCH) - .sampler(WB_TILE_DATA_SLOT, ImageType::FLOAT_1D_ARRAY, "imageTileData", Frequency::BATCH) - .push_constant(Type::BOOL, "isImageTile") - .push_constant(Type::BOOL, "imagePremult") - .push_constant(Type::FLOAT, "imageTransparencyCutoff"); +DEFINE("WORKBENCH_COLOR_TEXTURE") +DEFINE("WORKBENCH_TEXTURE_IMAGE_ARRAY") +DEFINE("WORKBENCH_COLOR_MATERIAL") +STORAGE_BUF(WB_MATERIAL_SLOT, READ, vec4, materials_data[]) +SAMPLER_FREQ(WB_TEXTURE_SLOT, FLOAT_2D, imageTexture, BATCH) +SAMPLER_FREQ(WB_TILE_ARRAY_SLOT, FLOAT_2D_ARRAY, imageTileArray, BATCH) +SAMPLER_FREQ(WB_TILE_DATA_SLOT, FLOAT_1D_ARRAY, imageTileData, BATCH) +PUSH_CONSTANT(BOOL, isImageTile) +PUSH_CONSTANT(BOOL, imagePremult) +PUSH_CONSTANT(FLOAT, imageTransparencyCutoff) +GPU_SHADER_CREATE_END() -GPU_SHADER_CREATE_INFO(workbench_color_vertex).define("WORKBENCH_COLOR_VERTEX"); +GPU_SHADER_CREATE_INFO(workbench_color_vertex) +DEFINE("WORKBENCH_COLOR_VERTEX") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_prepass) - .define("WORKBENCH_NEXT") - .uniform_buf(WB_WORLD_SLOT, "WorldData", "world_data") - .vertex_out(workbench_material_iface) - .additional_info("draw_view"); +DEFINE("WORKBENCH_NEXT") +UNIFORM_BUF(WB_WORLD_SLOT, WorldData, world_data) +VERTEX_OUT(workbench_material_iface) +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() /** \} */ @@ -91,21 +107,23 @@ GPU_SHADER_CREATE_INFO(workbench_prepass) * \{ */ GPU_SHADER_CREATE_INFO(workbench_transparent_accum) - /* NOTE: Blending will be skipped on objectId because output is a - * non-normalized integer buffer. */ - .fragment_out(0, Type::VEC4, "out_transparent_accum") - .fragment_out(1, Type::VEC4, "out_revealage_accum") - .fragment_out(2, Type::UINT, "out_object_id") - .push_constant(Type::BOOL, "forceShadowing") - .typedef_source("workbench_shader_shared.h") - .fragment_source("workbench_transparent_accum_frag.glsl"); +/* NOTE: Blending will be skipped on objectId because output is a + * non-normalized integer buffer. */ +FRAGMENT_OUT(0, VEC4, out_transparent_accum) +FRAGMENT_OUT(1, VEC4, out_revealage_accum) +FRAGMENT_OUT(2, UINT, out_object_id) +PUSH_CONSTANT(BOOL, forceShadowing) +TYPEDEF_SOURCE("workbench_shader_shared.h") +FRAGMENT_SOURCE("workbench_transparent_accum_frag.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_opaque) - .fragment_out(0, Type::VEC4, "out_material") - .fragment_out(1, Type::VEC2, "out_normal") - .fragment_out(2, Type::UINT, "out_object_id") - .typedef_source("workbench_shader_shared.h") - .fragment_source("workbench_prepass_frag.glsl"); +FRAGMENT_OUT(0, VEC4, out_material) +FRAGMENT_OUT(1, VEC2, out_normal) +FRAGMENT_OUT(2, UINT, out_object_id) +TYPEDEF_SOURCE("workbench_shader_shared.h") +FRAGMENT_SOURCE("workbench_prepass_frag.glsl") +GPU_SHADER_CREATE_END() /** \} */ @@ -113,9 +131,15 @@ GPU_SHADER_CREATE_INFO(workbench_opaque) /** \name Variations Declaration * \{ */ -GPU_SHADER_CREATE_INFO(workbench_flat).define("WORKBENCH_SHADING_FLAT"); -GPU_SHADER_CREATE_INFO(workbench_studio).define("WORKBENCH_SHADING_STUDIO"); -GPU_SHADER_CREATE_INFO(workbench_matcap).define("WORKBENCH_SHADING_MATCAP"); +GPU_SHADER_CREATE_INFO(workbench_flat) +DEFINE("WORKBENCH_SHADING_FLAT") +GPU_SHADER_CREATE_END() +GPU_SHADER_CREATE_INFO(workbench_studio) +DEFINE("WORKBENCH_SHADING_STUDIO") +GPU_SHADER_CREATE_END() +GPU_SHADER_CREATE_INFO(workbench_matcap) +DEFINE("WORKBENCH_SHADING_MATCAP") +GPU_SHADER_CREATE_END() #define WORKBENCH_FINAL_VARIATION(name, ...) \ GPU_SHADER_CREATE_INFO(name).additional_info(__VA_ARGS__).do_static_compilation(true); @@ -143,7 +167,9 @@ GPU_SHADER_CREATE_INFO(workbench_matcap).define("WORKBENCH_SHADING_MATCAP"); WORKBENCH_PIPELINE_VARIATIONS(prefix##_curves, "workbench_curves", __VA_ARGS__) \ WORKBENCH_PIPELINE_VARIATIONS(prefix##_ptcloud, "workbench_pointcloud", __VA_ARGS__) +#ifndef GLSL_CPP_STUBS WORKBENCH_GEOMETRY_VARIATIONS(workbench_prepass, "workbench_prepass"); +#endif #undef WORKBENCH_FINAL_VARIATION #undef WORKBENCH_CLIPPING_VARIATIONS diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh index cda00ee5ae4..df115ee2ff3 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh @@ -11,42 +11,46 @@ * \{ */ GPU_SHADER_CREATE_INFO(workbench_shadow_common) - .storage_buf(3, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY) - /* WORKAROUND: Needed to support OpenSubdiv vertex format. Should be removed. */ - .push_constant(Type::IVEC2, "gpu_attr_3") - .uniform_buf(1, "ShadowPassData", "pass_data") - .typedef_source("workbench_shader_shared.h") - .additional_info("gpu_index_load") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new"); +STORAGE_BUF_FREQ(3, READ, float, pos[], GEOMETRY) +/* WORKAROUND: Needed to support OpenSubdiv vertex format. Should be removed. */ +PUSH_CONSTANT(IVEC2, gpu_attr_3) +UNIFORM_BUF(1, ShadowPassData, pass_data) +TYPEDEF_SOURCE("workbench_shader_shared.h") +ADDITIONAL_INFO(gpu_index_load) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_shadow_visibility_compute_common) - .local_group_size(DRW_VISIBILITY_GROUP_SIZE) - .define("DRW_VIEW_LEN", "64") - .storage_buf(0, Qualifier::READ, "ObjectBounds", "bounds_buf[]") - .uniform_buf(2, "ExtrudedFrustum", "extruded_frustum") - .push_constant(Type::INT, "resource_len") - .push_constant(Type::INT, "view_len") - .push_constant(Type::INT, "visibility_word_per_draw") - .push_constant(Type::BOOL, "force_fail_method") - .push_constant(Type::VEC3, "shadow_direction") - .typedef_source("workbench_shader_shared.h") - .compute_source("workbench_shadow_visibility_comp.glsl") - .additional_info("draw_view") - .additional_info("draw_view_culling"); +LOCAL_GROUP_SIZE(DRW_VISIBILITY_GROUP_SIZE) +DEFINE_VALUE("DRW_VIEW_LEN", "64") +STORAGE_BUF(0, READ, ObjectBounds, bounds_buf[]) +UNIFORM_BUF(2, ExtrudedFrustum, extruded_frustum) +PUSH_CONSTANT(INT, resource_len) +PUSH_CONSTANT(INT, view_len) +PUSH_CONSTANT(INT, visibility_word_per_draw) +PUSH_CONSTANT(BOOL, force_fail_method) +PUSH_CONSTANT(VEC3, shadow_direction) +TYPEDEF_SOURCE("workbench_shader_shared.h") +COMPUTE_SOURCE("workbench_shadow_visibility_comp.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_view_culling) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_shadow_visibility_compute_dynamic_pass_type) - .additional_info("workbench_shadow_visibility_compute_common") - .define("DYNAMIC_PASS_SELECTION") - .storage_buf(1, Qualifier::READ_WRITE, "uint", "pass_visibility_buf[]") - .storage_buf(2, Qualifier::READ_WRITE, "uint", "fail_visibility_buf[]") - .do_static_compilation(true); +ADDITIONAL_INFO(workbench_shadow_visibility_compute_common) +DEFINE("DYNAMIC_PASS_SELECTION") +STORAGE_BUF(1, READ_WRITE, uint, pass_visibility_buf[]) +STORAGE_BUF(2, READ_WRITE, uint, fail_visibility_buf[]) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_shadow_visibility_compute_static_pass_type) - .additional_info("workbench_shadow_visibility_compute_common") - .storage_buf(1, Qualifier::READ_WRITE, "uint", "visibility_buf[]") - .do_static_compilation(true); +ADDITIONAL_INFO(workbench_shadow_visibility_compute_common) +STORAGE_BUF(1, READ_WRITE, uint, visibility_buf[]) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /** \} */ @@ -55,11 +59,13 @@ GPU_SHADER_CREATE_INFO(workbench_shadow_visibility_compute_static_pass_type) * \{ */ GPU_SHADER_CREATE_INFO(workbench_shadow_no_debug) - .fragment_source("gpu_shader_depth_only_frag.glsl"); +FRAGMENT_SOURCE("gpu_shader_depth_only_frag.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_shadow_debug) - .fragment_out(0, Type::VEC4, "out_debug_color") - .fragment_source("workbench_shadow_debug_frag.glsl"); +FRAGMENT_OUT(0, VEC4, out_debug_color) +FRAGMENT_SOURCE("workbench_shadow_debug_frag.glsl") +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_transparent_resolve_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_transparent_resolve_info.hh index 94cffe3fc4c..bef6beb997c 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_transparent_resolve_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_transparent_resolve_info.hh @@ -5,9 +5,10 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(workbench_transparent_resolve) - .fragment_out(0, Type::VEC4, "fragColor") - .sampler(0, ImageType::FLOAT_2D, "transparentAccum") - .sampler(1, ImageType::FLOAT_2D, "transparentRevealage") - .fragment_source("workbench_transparent_resolve_frag.glsl") - .additional_info("draw_fullscreen") - .do_static_compilation(true); +FRAGMENT_OUT(0, VEC4, fragColor) +SAMPLER(0, FLOAT_2D, transparentAccum) +SAMPLER(1, FLOAT_2D, transparentRevealage) +FRAGMENT_SOURCE("workbench_transparent_resolve_frag.glsl") +ADDITIONAL_INFO(draw_fullscreen) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_volume_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_volume_info.hh index 710881b52e6..7a4a8b734ed 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_volume_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_volume_info.hh @@ -9,24 +9,26 @@ * \{ */ GPU_SHADER_CREATE_INFO(workbench_volume_common) - .vertex_in(0, Type::VEC3, "pos") - .fragment_out(0, Type::VEC4, "fragColor") - .sampler(0, ImageType::DEPTH_2D, "depthBuffer") - .sampler(1, ImageType::FLOAT_3D, "densityTexture") - .push_constant(Type::INT, "samplesLen") - .push_constant(Type::FLOAT, "noiseOfs") - .push_constant(Type::FLOAT, "stepLength") - .push_constant(Type::FLOAT, "densityScale") - .push_constant(Type::BOOL, "do_depth_test") - .vertex_source("workbench_volume_vert.glsl") - .fragment_source("workbench_volume_frag.glsl"); +VERTEX_IN(0, VEC3, pos) +FRAGMENT_OUT(0, VEC4, fragColor) +SAMPLER(0, DEPTH_2D, depthBuffer) +SAMPLER(1, FLOAT_3D, densityTexture) +PUSH_CONSTANT(INT, samplesLen) +PUSH_CONSTANT(FLOAT, noiseOfs) +PUSH_CONSTANT(FLOAT, stepLength) +PUSH_CONSTANT(FLOAT, densityScale) +PUSH_CONSTANT(BOOL, do_depth_test) +VERTEX_SOURCE("workbench_volume_vert.glsl") +FRAGMENT_SOURCE("workbench_volume_frag.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_volume) - .define("WORKBENCH_NEXT") - .sampler(6, ImageType::UINT_2D, "stencil_tx") - .additional_info("workbench_volume_common") - .additional_info("draw_object_infos_new") - .additional_info("draw_view"); +DEFINE("WORKBENCH_NEXT") +SAMPLER(6, UINT_2D, stencil_tx) +ADDITIONAL_INFO(workbench_volume_common) +ADDITIONAL_INFO(draw_object_infos_new) +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() /** \} */ /* -------------------------------------------------------------------- */ @@ -34,25 +36,29 @@ GPU_SHADER_CREATE_INFO(workbench_volume) * \{ */ GPU_SHADER_CREATE_INFO(workbench_volume_smoke_common) - .define("VOLUME_SMOKE") - .sampler(2, ImageType::FLOAT_3D, "flameTexture") - .sampler(3, ImageType::FLOAT_1D, "flameColorTexture") - .additional_info("draw_resource_id_varying"); +DEFINE("VOLUME_SMOKE") +SAMPLER(2, FLOAT_3D, flameTexture) +SAMPLER(3, FLOAT_1D, flameColorTexture) +ADDITIONAL_INFO(draw_resource_id_varying) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_volume_object_common) - .define("VOLUME_OBJECT") - .push_constant(Type::MAT4, "volumeTextureToObject") - /* FIXME(fclem): This overflow the push_constant limit. */ - .push_constant(Type::MAT4, "volumeObjectToTexture") - .additional_info("draw_resource_id_varying"); +DEFINE("VOLUME_OBJECT") +PUSH_CONSTANT(MAT4, volumeTextureToObject) +/* FIXME(fclem): This overflow the push_constant limit. */ +PUSH_CONSTANT(MAT4, volumeObjectToTexture) +ADDITIONAL_INFO(draw_resource_id_varying) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_volume_smoke) - .additional_info("workbench_volume_smoke_common") - .additional_info("draw_modelmat_new"); +ADDITIONAL_INFO(workbench_volume_smoke_common) +ADDITIONAL_INFO(draw_modelmat_new) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_volume_object) - .additional_info("workbench_volume_object_common") - .additional_info("draw_volume_new"); +ADDITIONAL_INFO(workbench_volume_object_common) +ADDITIONAL_INFO(draw_volume_new) +GPU_SHADER_CREATE_END() /** \} */ @@ -61,17 +67,19 @@ GPU_SHADER_CREATE_INFO(workbench_volume_object) * \{ */ GPU_SHADER_CREATE_INFO(workbench_volume_coba) - .define("USE_COBA") - .sampler(4, ImageType::UINT_3D, "flagTexture") - .sampler(5, ImageType::FLOAT_1D, "transferTexture") - .push_constant(Type::BOOL, "showPhi") - .push_constant(Type::BOOL, "showFlags") - .push_constant(Type::BOOL, "showPressure") - .push_constant(Type::FLOAT, "gridScale"); +DEFINE("USE_COBA") +SAMPLER(4, UINT_3D, flagTexture) +SAMPLER(5, FLOAT_1D, transferTexture) +PUSH_CONSTANT(BOOL, showPhi) +PUSH_CONSTANT(BOOL, showFlags) +PUSH_CONSTANT(BOOL, showPressure) +PUSH_CONSTANT(FLOAT, gridScale) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_volume_no_coba) - .sampler(4, ImageType::FLOAT_3D, "shadowTexture") - .push_constant(Type::VEC3, "activeColor"); +SAMPLER(4, FLOAT_3D, shadowTexture) +PUSH_CONSTANT(VEC3, activeColor) +GPU_SHADER_CREATE_END() /** \} */ @@ -79,9 +87,15 @@ GPU_SHADER_CREATE_INFO(workbench_volume_no_coba) /** \name Sampling variation * \{ */ -GPU_SHADER_CREATE_INFO(workbench_volume_linear).define("USE_TRILINEAR"); -GPU_SHADER_CREATE_INFO(workbench_volume_cubic).define("USE_TRICUBIC"); -GPU_SHADER_CREATE_INFO(workbench_volume_closest).define("USE_CLOSEST"); +GPU_SHADER_CREATE_INFO(workbench_volume_linear) +DEFINE("USE_TRILINEAR") +GPU_SHADER_CREATE_END() +GPU_SHADER_CREATE_INFO(workbench_volume_cubic) +DEFINE("USE_TRICUBIC") +GPU_SHADER_CREATE_END() +GPU_SHADER_CREATE_INFO(workbench_volume_closest) +DEFINE("USE_CLOSEST") +GPU_SHADER_CREATE_END() /** \} */ @@ -89,14 +103,17 @@ GPU_SHADER_CREATE_INFO(workbench_volume_closest).define("USE_CLOSEST"); /** \name Slice variation * \{ */ -GPU_SHADER_INTERFACE_INFO(workbench_volume_iface).smooth(Type::VEC3, "localPos"); +GPU_SHADER_INTERFACE_INFO(workbench_volume_iface) +SMOOTH(VEC3, localPos) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(workbench_volume_slice) - .define("VOLUME_SLICE") - .vertex_in(1, Type::VEC3, "uvs") - .vertex_out(workbench_volume_iface) - .push_constant(Type::INT, "sliceAxis") /* -1 is no slice. */ - .push_constant(Type::FLOAT, "slicePosition"); +DEFINE("VOLUME_SLICE") +VERTEX_IN(1, VEC3, uvs) +VERTEX_OUT(workbench_volume_iface) +PUSH_CONSTANT(INT, sliceAxis) /* -1 is no slice. */ +PUSH_CONSTANT(FLOAT, slicePosition) +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/gpu/shaders/infos/gpu_clip_planes_info.hh b/source/blender/gpu/shaders/infos/gpu_clip_planes_info.hh index ef116419f45..9462e50c213 100644 --- a/source/blender/gpu/shaders/infos/gpu_clip_planes_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_clip_planes_info.hh @@ -9,6 +9,7 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_clip_planes) - .uniform_buf(1, "GPUClipPlanes", "clipPlanes", Frequency::PASS) - .typedef_source("GPU_shader_shared.hh") - .define("USE_WORLD_CLIP_PLANES"); +UNIFORM_BUF_FREQ(1, GPUClipPlanes, clipPlanes, PASS) +TYPEDEF_SOURCE("GPU_shader_shared.hh") +DEFINE("USE_WORLD_CLIP_PLANES") +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_index_load_info.hh b/source/blender/gpu/shaders/infos/gpu_index_load_info.hh index ce73be6691a..fc189f9863d 100644 --- a/source/blender/gpu/shaders/infos/gpu_index_load_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_index_load_info.hh @@ -11,9 +11,9 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_index_load) - .push_constant(Type::BOOL, "gpu_index_no_buffer") - .push_constant(Type::BOOL, "gpu_index_16bit") - .push_constant(Type::INT, "gpu_index_base_index") - .storage_buf( - GPU_SSBO_INDEX_BUF_SLOT, Qualifier::READ, "uint", "gpu_index_buf[]", Frequency::GEOMETRY) - .define("GPU_INDEX_LOAD"); +PUSH_CONSTANT(BOOL, gpu_index_no_buffer) +PUSH_CONSTANT(BOOL, gpu_index_16bit) +PUSH_CONSTANT(INT, gpu_index_base_index) +STORAGE_BUF_FREQ(GPU_SSBO_INDEX_BUF_SLOT, READ, uint, gpu_index_buf[], GEOMETRY) +DEFINE("GPU_INDEX_LOAD") +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_area_borders_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_area_borders_info.hh index cf8d9890a3a..c53229e3127 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_area_borders_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_area_borders_info.hh @@ -8,17 +8,20 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(smooth_uv_iface).smooth(Type::VEC2, "uv"); +GPU_SHADER_INTERFACE_INFO(smooth_uv_iface) +SMOOTH(VEC2, uv) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(gpu_shader_2D_area_borders) - .vertex_in(0, Type::VEC2, "pos") - .vertex_out(smooth_uv_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC4, "rect") - .push_constant(Type::VEC4, "color") - .push_constant(Type::FLOAT, "scale") - .push_constant(Type::INT, "cornerLen") - .vertex_source("gpu_shader_2D_area_borders_vert.glsl") - .fragment_source("gpu_shader_2D_area_borders_frag.glsl") - .do_static_compilation(true); +VERTEX_IN(0, VEC2, pos) +VERTEX_OUT(smooth_uv_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC4, rect) +PUSH_CONSTANT(VEC4, color) +PUSH_CONSTANT(FLOAT, scale) +PUSH_CONSTANT(INT, cornerLen) +VERTEX_SOURCE("gpu_shader_2D_area_borders_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_2D_area_borders_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_checker_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_checker_info.hh index 42303fdf51a..84e82a7c3fa 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_checker_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_checker_info.hh @@ -9,12 +9,13 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_checker) - .vertex_in(0, Type::VEC2, "pos") - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC4, "color1") - .push_constant(Type::VEC4, "color2") - .push_constant(Type::INT, "size") - .vertex_source("gpu_shader_2D_vert.glsl") - .fragment_source("gpu_shader_checker_frag.glsl") - .do_static_compilation(true); +VERTEX_IN(0, VEC2, pos) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC4, color1) +PUSH_CONSTANT(VEC4, color2) +PUSH_CONSTANT(INT, size) +VERTEX_SOURCE("gpu_shader_2D_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_checker_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_diag_stripes_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_diag_stripes_info.hh index 89e7e20e4c7..53ef9b3ec3b 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_diag_stripes_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_diag_stripes_info.hh @@ -9,13 +9,14 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_diag_stripes) - .vertex_in(0, Type::VEC2, "pos") - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC4, "color1") - .push_constant(Type::VEC4, "color2") - .push_constant(Type::INT, "size1") - .push_constant(Type::INT, "size2") - .vertex_source("gpu_shader_2D_vert.glsl") - .fragment_source("gpu_shader_diag_stripes_frag.glsl") - .do_static_compilation(true); +VERTEX_IN(0, VEC2, pos) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC4, color1) +PUSH_CONSTANT(VEC4, color2) +PUSH_CONSTANT(INT, size1) +PUSH_CONSTANT(INT, size2) +VERTEX_SOURCE("gpu_shader_2D_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_diag_stripes_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_desaturate_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_desaturate_color_info.hh index cfa9ae9641e..4cded825133 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_desaturate_color_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_desaturate_color_info.hh @@ -9,8 +9,9 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_desaturate_color) - .additional_info("gpu_shader_2D_image_common") - .push_constant(Type::VEC4, "color") - .push_constant(Type::FLOAT, "factor") - .fragment_source("gpu_shader_image_desaturate_frag.glsl") - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_shader_2D_image_common) +PUSH_CONSTANT(VEC4, color) +PUSH_CONSTANT(FLOAT, factor) +FRAGMENT_SOURCE("gpu_shader_image_desaturate_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_info.hh index a3b1d8006e7..7bfafb4d2b5 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_info.hh @@ -10,10 +10,11 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_common) - .vertex_in(0, Type::VEC2, "pos") - .vertex_in(1, Type::VEC2, "texCoord") - .vertex_out(smooth_tex_coord_interp_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .sampler(0, ImageType::FLOAT_2D, "image") - .vertex_source("gpu_shader_2D_image_vert.glsl"); +VERTEX_IN(0, VEC2, pos) +VERTEX_IN(1, VEC2, texCoord) +VERTEX_OUT(smooth_tex_coord_interp_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +SAMPLER(0, FLOAT_2D, image) +VERTEX_SOURCE("gpu_shader_2D_image_vert.glsl") +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_overlays_merge_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_overlays_merge_info.hh index 2720f745822..230719e268f 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_overlays_merge_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_overlays_merge_info.hh @@ -10,29 +10,31 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_overlays_merge) - .vertex_in(0, Type::VEC2, "pos") - .vertex_in(1, Type::VEC2, "texCoord") - .vertex_out(smooth_tex_coord_interp_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::BOOL, "display_transform") - .push_constant(Type::BOOL, "overlay") - .push_constant(Type::BOOL, "use_hdr") - /* Sampler slots should match OCIO's. */ - .sampler(0, ImageType::FLOAT_2D, "image_texture") - .sampler(1, ImageType::FLOAT_2D, "overlays_texture") - .vertex_source("gpu_shader_2D_image_vert.glsl") - .fragment_source("gpu_shader_image_overlays_merge_frag.glsl") - .do_static_compilation(true); +VERTEX_IN(0, VEC2, pos) +VERTEX_IN(1, VEC2, texCoord) +VERTEX_OUT(smooth_tex_coord_interp_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(BOOL, display_transform) +PUSH_CONSTANT(BOOL, overlay) +PUSH_CONSTANT(BOOL, use_hdr) +/* Sampler slots should match OCIO's. */ +SAMPLER(0, FLOAT_2D, image_texture) +SAMPLER(1, FLOAT_2D, overlays_texture) +VERTEX_SOURCE("gpu_shader_2D_image_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_image_overlays_merge_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* Cycles display driver fallback shader. */ GPU_SHADER_CREATE_INFO(gpu_shader_cycles_display_fallback) - .vertex_in(0, Type::VEC2, "pos") - .vertex_in(1, Type::VEC2, "texCoord") - .vertex_out(smooth_tex_coord_interp_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::VEC2, "fullscreen") - .sampler(0, ImageType::FLOAT_2D, "image_texture") - .vertex_source("gpu_shader_display_fallback_vert.glsl") - .fragment_source("gpu_shader_display_fallback_frag.glsl") - .do_static_compilation(true); +VERTEX_IN(0, VEC2, pos) +VERTEX_IN(1, VEC2, texCoord) +VERTEX_OUT(smooth_tex_coord_interp_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(VEC2, fullscreen) +SAMPLER(0, FLOAT_2D, image_texture) +VERTEX_SOURCE("gpu_shader_display_fallback_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_display_fallback_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_overlays_stereo_merge_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_overlays_stereo_merge_info.hh index 314b535d254..435efcba121 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_overlays_stereo_merge_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_overlays_stereo_merge_info.hh @@ -9,13 +9,14 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_overlays_stereo_merge) - .vertex_in(0, Type::VEC2, "pos") - .fragment_out(0, Type::VEC4, "overlayColor") - .fragment_out(1, Type::VEC4, "imageColor") - .sampler(0, ImageType::FLOAT_2D, "imageTexture") - .sampler(1, ImageType::FLOAT_2D, "overlayTexture") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::INT, "stereoDisplaySettings") - .vertex_source("gpu_shader_2D_vert.glsl") - .fragment_source("gpu_shader_image_overlays_stereo_merge_frag.glsl") - .do_static_compilation(true); +VERTEX_IN(0, VEC2, pos) +FRAGMENT_OUT(0, VEC4, overlayColor) +FRAGMENT_OUT(1, VEC4, imageColor) +SAMPLER(0, FLOAT_2D, imageTexture) +SAMPLER(1, FLOAT_2D, overlayTexture) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(INT, stereoDisplaySettings) +VERTEX_SOURCE("gpu_shader_2D_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_image_overlays_stereo_merge_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_rect_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_rect_color_info.hh index a472e9bbb3a..42e863bca1e 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_rect_color_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_rect_color_info.hh @@ -10,13 +10,14 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_rect_color) - .vertex_out(smooth_tex_coord_interp_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC4, "color") - .push_constant(Type::VEC4, "rect_icon") - .push_constant(Type::VEC4, "rect_geom") - .sampler(0, ImageType::FLOAT_2D, "image") - .vertex_source("gpu_shader_2D_image_rect_vert.glsl") - .fragment_source("gpu_shader_image_color_frag.glsl") - .do_static_compilation(true); +VERTEX_OUT(smooth_tex_coord_interp_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC4, color) +PUSH_CONSTANT(VEC4, rect_icon) +PUSH_CONSTANT(VEC4, rect_geom) +SAMPLER(0, FLOAT_2D, image) +VERTEX_SOURCE("gpu_shader_2D_image_rect_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_image_color_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_shuffle_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_shuffle_color_info.hh index 146d4ff2570..13c28ae0b44 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_shuffle_color_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_shuffle_color_info.hh @@ -9,8 +9,9 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_shuffle_color) - .additional_info("gpu_shader_2D_image_common") - .push_constant(Type::VEC4, "color") - .push_constant(Type::VEC4, "shuffle") - .fragment_source("gpu_shader_image_shuffle_color_frag.glsl") - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_shader_2D_image_common) +PUSH_CONSTANT(VEC4, color) +PUSH_CONSTANT(VEC4, shuffle) +FRAGMENT_SOURCE("gpu_shader_image_shuffle_color_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_nodelink_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_nodelink_info.hh index b9b0eb9f9a4..c63d32f1038 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_nodelink_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_nodelink_info.hh @@ -9,52 +9,55 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_INTERFACE_INFO(nodelink_iface) - .smooth(Type::VEC4, "finalColor") - .smooth(Type::VEC2, "lineUV") - .flat(Type::FLOAT, "lineLength") - .flat(Type::FLOAT, "lineThickness") - .flat(Type::FLOAT, "dashLength") - .flat(Type::FLOAT, "dashFactor") - .flat(Type::INT, "hasBackLink") - .flat(Type::FLOAT, "dashAlpha") - .flat(Type::INT, "isMainLine") - .flat(Type::FLOAT, "aspect"); +SMOOTH(VEC4, finalColor) +SMOOTH(VEC2, lineUV) +FLAT(FLOAT, lineLength) +FLAT(FLOAT, lineThickness) +FLAT(FLOAT, dashLength) +FLAT(FLOAT, dashFactor) +FLAT(INT, hasBackLink) +FLAT(FLOAT, dashAlpha) +FLAT(INT, isMainLine) +FLAT(FLOAT, aspect) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(gpu_shader_2D_nodelink) - .vertex_in(0, Type::VEC2, "uv") - .vertex_in(1, Type::VEC2, "pos") - .vertex_in(2, Type::VEC2, "expand") - .vertex_out(nodelink_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .uniform_buf(0, "NodeLinkData", "node_link_data", Frequency::PASS) - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .vertex_source("gpu_shader_2D_nodelink_vert.glsl") - .fragment_source("gpu_shader_2D_nodelink_frag.glsl") - .typedef_source("GPU_shader_shared.hh") - .do_static_compilation(true); +VERTEX_IN(0, VEC2, uv) +VERTEX_IN(1, VEC2, pos) +VERTEX_IN(2, VEC2, expand) +VERTEX_OUT(nodelink_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +UNIFORM_BUF_FREQ(0, NodeLinkData, node_link_data, PASS) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +VERTEX_SOURCE("gpu_shader_2D_nodelink_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_2D_nodelink_frag.glsl") +TYPEDEF_SOURCE("GPU_shader_shared.hh") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_2D_nodelink_inst) - .vertex_in(0, Type::VEC2, "uv") - .vertex_in(1, Type::VEC2, "pos") - .vertex_in(2, Type::VEC2, "expand") - .vertex_in(3, Type::VEC2, "P0") - .vertex_in(4, Type::VEC2, "P1") - .vertex_in(5, Type::VEC2, "P2") - .vertex_in(6, Type::VEC2, "P3") - .vertex_in(7, Type::UVEC4, "colid_doarrow") - .vertex_in(8, Type::VEC4, "start_color") - .vertex_in(9, Type::VEC4, "end_color") - .vertex_in(10, Type::UVEC2, "domuted") - .vertex_in(11, Type::FLOAT, "dim_factor") - .vertex_in(12, Type::FLOAT, "thickness") - .vertex_in(13, Type::VEC3, "dash_params") - .vertex_in(14, Type::INT, "has_back_link") - .vertex_out(nodelink_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .uniform_buf(0, "NodeLinkInstanceData", "node_link_data", Frequency::PASS) - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .vertex_source("gpu_shader_2D_nodelink_vert.glsl") - .fragment_source("gpu_shader_2D_nodelink_frag.glsl") - .typedef_source("GPU_shader_shared.hh") - .define("USE_INSTANCE") - .do_static_compilation(true); +VERTEX_IN(0, VEC2, uv) +VERTEX_IN(1, VEC2, pos) +VERTEX_IN(2, VEC2, expand) +VERTEX_IN(3, VEC2, P0) +VERTEX_IN(4, VEC2, P1) +VERTEX_IN(5, VEC2, P2) +VERTEX_IN(6, VEC2, P3) +VERTEX_IN(7, UVEC4, colid_doarrow) +VERTEX_IN(8, VEC4, start_color) +VERTEX_IN(9, VEC4, end_color) +VERTEX_IN(10, UVEC2, domuted) +VERTEX_IN(11, FLOAT, dim_factor) +VERTEX_IN(12, FLOAT, thickness) +VERTEX_IN(13, VEC3, dash_params) +VERTEX_IN(14, INT, has_back_link) +VERTEX_OUT(nodelink_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +UNIFORM_BUF_FREQ(0, NodeLinkInstanceData, node_link_data, PASS) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +VERTEX_SOURCE("gpu_shader_2D_nodelink_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_2D_nodelink_frag.glsl") +TYPEDEF_SOURCE("GPU_shader_shared.hh") +DEFINE("USE_INSTANCE") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_point_uniform_size_uniform_color_aa_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_point_uniform_size_uniform_color_aa_info.hh index b2592296eb2..73da34416b0 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_point_uniform_size_uniform_color_aa_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_point_uniform_size_uniform_color_aa_info.hh @@ -10,13 +10,14 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_point_uniform_size_uniform_color_aa) - .vertex_in(0, Type::VEC2, "pos") - .vertex_out(smooth_radii_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC4, "color") - .push_constant(Type::FLOAT, "size") - .vertex_source("gpu_shader_2D_point_uniform_size_aa_vert.glsl") - .fragment_source("gpu_shader_point_uniform_color_aa_frag.glsl") - .additional_info("gpu_srgb_to_framebuffer_space") - .do_static_compilation(true); +VERTEX_IN(0, VEC2, pos) +VERTEX_OUT(smooth_radii_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC4, color) +PUSH_CONSTANT(FLOAT, size) +VERTEX_SOURCE("gpu_shader_2D_point_uniform_size_aa_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_point_uniform_color_aa_frag.glsl") +ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_point_uniform_size_uniform_color_outline_aa_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_point_uniform_size_uniform_color_outline_aa_info.hh index c99c89dba31..9b4c549eacb 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_point_uniform_size_uniform_color_outline_aa_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_point_uniform_size_uniform_color_outline_aa_info.hh @@ -10,14 +10,15 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_point_uniform_size_uniform_color_outline_aa) - .vertex_in(0, Type::VEC2, "pos") - .vertex_out(smooth_radii_outline_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC4, "color") - .push_constant(Type::VEC4, "outlineColor") - .push_constant(Type::FLOAT, "size") - .push_constant(Type::FLOAT, "outlineWidth") - .vertex_source("gpu_shader_2D_point_uniform_size_outline_aa_vert.glsl") - .fragment_source("gpu_shader_point_uniform_color_outline_aa_frag.glsl") - .do_static_compilation(true); +VERTEX_IN(0, VEC2, pos) +VERTEX_OUT(smooth_radii_outline_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC4, color) +PUSH_CONSTANT(VEC4, outlineColor) +PUSH_CONSTANT(FLOAT, size) +PUSH_CONSTANT(FLOAT, outlineWidth) +VERTEX_SOURCE("gpu_shader_2D_point_uniform_size_outline_aa_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_point_uniform_color_outline_aa_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_point_varying_size_varying_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_point_varying_size_varying_color_info.hh index 5578a987ec0..582af0f1d20 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_point_varying_size_varying_color_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_point_varying_size_varying_color_info.hh @@ -10,12 +10,13 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_point_varying_size_varying_color) - .vertex_in(0, Type::VEC2, "pos") - .vertex_in(1, Type::FLOAT, "size") - .vertex_in(2, Type::VEC4, "color") - .vertex_out(smooth_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .vertex_source("gpu_shader_2D_point_varying_size_varying_color_vert.glsl") - .fragment_source("gpu_shader_point_varying_color_frag.glsl") - .do_static_compilation(true); +VERTEX_IN(0, VEC2, pos) +VERTEX_IN(1, FLOAT, size) +VERTEX_IN(2, VEC4, color) +VERTEX_OUT(smooth_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +VERTEX_SOURCE("gpu_shader_2D_point_varying_size_varying_color_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_point_varying_color_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_widget_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_widget_info.hh index bf5bd6d8d9f..4375d4cc22e 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_widget_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_widget_info.hh @@ -10,56 +10,62 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_INTERFACE_INFO(gpu_widget_iface) - .flat(Type::FLOAT, "discardFac") - .flat(Type::FLOAT, "lineWidth") - .flat(Type::VEC2, "outRectSize") - .flat(Type::VEC4, "borderColor") - .flat(Type::VEC4, "embossColor") - .flat(Type::VEC4, "outRoundCorners") - .no_perspective(Type::FLOAT, "butCo") - .no_perspective(Type::VEC2, "uvInterp") - .no_perspective(Type::VEC4, "innerColor"); +FLAT(FLOAT, discardFac) +FLAT(FLOAT, lineWidth) +FLAT(VEC2, outRectSize) +FLAT(VEC4, borderColor) +FLAT(VEC4, embossColor) +FLAT(VEC4, outRoundCorners) +NO_PERSPECTIVE(FLOAT, butCo) +NO_PERSPECTIVE(VEC2, uvInterp) +NO_PERSPECTIVE(VEC4, innerColor) +GPU_SHADER_INTERFACE_END() /* TODO(fclem): Share with C code. */ #define MAX_PARAM 12 #define MAX_INSTANCE 6 GPU_SHADER_CREATE_INFO(gpu_shader_2D_widget_shared) - .define("MAX_PARAM", STRINGIFY(MAX_PARAM)) - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC3, "checkerColorAndSize") - .vertex_out(gpu_widget_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("gpu_shader_2D_widget_base_vert.glsl") - .fragment_source("gpu_shader_2D_widget_base_frag.glsl") - .additional_info("gpu_srgb_to_framebuffer_space"); +DEFINE_VALUE("MAX_PARAM", STRINGIFY(MAX_PARAM)) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC3, checkerColorAndSize) +VERTEX_OUT(gpu_widget_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("gpu_shader_2D_widget_base_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_2D_widget_base_frag.glsl") +ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_2D_widget_base) - .do_static_compilation(true) - /* gl_InstanceID is supposed to be 0 if not drawing instances, but this seems - * to be violated in some drivers. For example, macOS 10.15.4 and Intel Iris - * causes #78307 when using gl_InstanceID outside of instance. */ - .define("widgetID", "0") - .push_constant(Type::VEC4, "parameters", MAX_PARAM) - .additional_info("gpu_shader_2D_widget_shared"); +DO_STATIC_COMPILATION() +/* gl_InstanceID is supposed to be 0 if not drawing instances, but this seems + * to be violated in some drivers. For example, macOS 10.15.4 and Intel Iris + * causes #78307 when using gl_InstanceID outside of instance. */ +DEFINE_VALUE("widgetID", "0") +PUSH_CONSTANT_ARRAY(VEC4, parameters, MAX_PARAM) +ADDITIONAL_INFO(gpu_shader_2D_widget_shared) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_2D_widget_base_inst) - .do_static_compilation(true) - .define("widgetID", "gl_InstanceID") - .push_constant(Type::VEC4, "parameters", (MAX_PARAM * MAX_INSTANCE)) - .additional_info("gpu_shader_2D_widget_shared"); +DO_STATIC_COMPILATION() +DEFINE_VALUE("widgetID", "gl_InstanceID") +PUSH_CONSTANT_ARRAY(VEC4, parameters, (MAX_PARAM * MAX_INSTANCE)) +ADDITIONAL_INFO(gpu_shader_2D_widget_shared) +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(gpu_widget_shadow_iface) - .smooth(Type::FLOAT, "shadowFalloff") - .smooth(Type::FLOAT, "innerMask"); +SMOOTH(FLOAT, shadowFalloff) +SMOOTH(FLOAT, innerMask) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(gpu_shader_2D_widget_shadow) - .do_static_compilation(true) - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC4, "parameters", 4) - .push_constant(Type::FLOAT, "alpha") - .vertex_in(0, Type::UINT, "vflag") - .vertex_out(gpu_widget_shadow_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("gpu_shader_2D_widget_shadow_vert.glsl") - .fragment_source("gpu_shader_2D_widget_shadow_frag.glsl"); +DO_STATIC_COMPILATION() +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT_ARRAY(VEC4, parameters, 4) +PUSH_CONSTANT(FLOAT, alpha) +VERTEX_IN(0, UINT, vflag) +VERTEX_OUT(gpu_widget_shadow_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("gpu_shader_2D_widget_shadow_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_2D_widget_shadow_frag.glsl") +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_3D_depth_only_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_3D_depth_only_info.hh index 795b557ce1d..4566e7decf5 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_3D_depth_only_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_3D_depth_only_info.hh @@ -10,14 +10,16 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_3D_depth_only) - .vertex_in(0, Type::VEC3, "pos") - .vertex_out(flat_color_iface) - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .vertex_source("gpu_shader_3D_vert.glsl") - .fragment_source("gpu_shader_depth_only_frag.glsl") - .do_static_compilation(true); +VERTEX_IN(0, VEC3, pos) +VERTEX_OUT(flat_color_iface) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +VERTEX_SOURCE("gpu_shader_3D_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_depth_only_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_depth_only_clipped) - .additional_info("gpu_shader_3D_depth_only") - .additional_info("gpu_clip_planes") - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_shader_3D_depth_only) +ADDITIONAL_INFO(gpu_clip_planes) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_3D_flat_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_3D_flat_color_info.hh index eb0479f78c7..2adef85f16b 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_3D_flat_color_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_3D_flat_color_info.hh @@ -10,17 +10,19 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_3D_flat_color) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC4, "color") - .vertex_out(flat_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .vertex_source("gpu_shader_3D_flat_color_vert.glsl") - .fragment_source("gpu_shader_flat_color_frag.glsl") - .additional_info("gpu_srgb_to_framebuffer_space") - .do_static_compilation(true); +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC4, color) +VERTEX_OUT(flat_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +VERTEX_SOURCE("gpu_shader_3D_flat_color_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_flat_color_frag.glsl") +ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_flat_color_clipped) - .additional_info("gpu_shader_3D_flat_color") - .additional_info("gpu_clip_planes") - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_shader_3D_flat_color) +ADDITIONAL_INFO(gpu_clip_planes) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_3D_image_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_3D_image_info.hh index 0ba73b91a5c..34780456701 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_3D_image_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_3D_image_info.hh @@ -10,21 +10,24 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_3D_image_common) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC2, "texCoord") - .vertex_out(smooth_tex_coord_interp_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .sampler(0, ImageType::FLOAT_2D, "image") - .vertex_source("gpu_shader_3D_image_vert.glsl"); +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC2, texCoord) +VERTEX_OUT(smooth_tex_coord_interp_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +SAMPLER(0, FLOAT_2D, image) +VERTEX_SOURCE("gpu_shader_3D_image_vert.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_image) - .additional_info("gpu_shader_3D_image_common") - .fragment_source("gpu_shader_image_frag.glsl") - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_shader_3D_image_common) +FRAGMENT_SOURCE("gpu_shader_image_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_image_color) - .additional_info("gpu_shader_3D_image_common") - .push_constant(Type::VEC4, "color") - .fragment_source("gpu_shader_image_color_frag.glsl") - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_shader_3D_image_common) +PUSH_CONSTANT(VEC4, color) +FRAGMENT_SOURCE("gpu_shader_image_color_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_3D_point_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_3D_point_info.hh index cc3f340edb9..6897b437f21 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_3D_point_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_3D_point_info.hh @@ -9,29 +9,32 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_varying_size_varying_color) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC4, "color") - .vertex_in(2, Type::FLOAT, "size") - .vertex_out(smooth_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .vertex_source("gpu_shader_3D_point_varying_size_varying_color_vert.glsl") - .fragment_source("gpu_shader_point_varying_color_frag.glsl") - .do_static_compilation(true); +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC4, color) +VERTEX_IN(2, FLOAT, size) +VERTEX_OUT(smooth_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +VERTEX_SOURCE("gpu_shader_3D_point_varying_size_varying_color_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_point_varying_color_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_uniform_size_uniform_color_aa) - .vertex_in(0, Type::VEC3, "pos") - .vertex_out(smooth_radii_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC4, "color") - .push_constant(Type::FLOAT, "size") - .vertex_source("gpu_shader_3D_point_uniform_size_aa_vert.glsl") - .fragment_source("gpu_shader_point_uniform_color_aa_frag.glsl") - .additional_info("gpu_srgb_to_framebuffer_space") - .do_static_compilation(true); +VERTEX_IN(0, VEC3, pos) +VERTEX_OUT(smooth_radii_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC4, color) +PUSH_CONSTANT(FLOAT, size) +VERTEX_SOURCE("gpu_shader_3D_point_uniform_size_aa_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_point_uniform_color_aa_frag.glsl") +ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_uniform_size_uniform_color_aa_clipped) - .additional_info("gpu_shader_3D_point_uniform_size_uniform_color_aa") - .additional_info("gpu_clip_planes") - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_shader_3D_point_uniform_size_uniform_color_aa) +ADDITIONAL_INFO(gpu_clip_planes) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_3D_polyline_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_3D_polyline_info.hh index bd219140ce0..477d8cd7dcd 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_3D_polyline_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_3D_polyline_info.hh @@ -10,96 +10,108 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_NAMED_INTERFACE_INFO(gpu_shader_3D_polyline_iface, interp) - .smooth(Type::VEC4, "final_color") - .smooth(Type::FLOAT, "clip"); +SMOOTH(VEC4, final_color) +SMOOTH(FLOAT, clip) +GPU_SHADER_INTERFACE_END() GPU_SHADER_NAMED_INTERFACE_INFO(gpu_shader_3D_polyline_noperspective_iface, interp_noperspective) - .no_perspective(Type::FLOAT, "smoothline"); +NO_PERSPECTIVE(FLOAT, smoothline) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline) - .define("SMOOTH_WIDTH", "1.0") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC2, "viewportSize") - .push_constant(Type::FLOAT, "lineWidth") - .push_constant(Type::BOOL, "lineSmooth") - .vertex_in(0, Type::VEC3, "pos") - .vertex_out(gpu_shader_3D_polyline_iface) - .vertex_out(gpu_shader_3D_polyline_noperspective_iface) - .geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) - .geometry_out(gpu_shader_3D_polyline_iface) - .geometry_out(gpu_shader_3D_polyline_noperspective_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("gpu_shader_3D_polyline_vert.glsl") - .geometry_source("gpu_shader_3D_polyline_geom.glsl") - .fragment_source("gpu_shader_3D_polyline_frag.glsl") - .additional_info("gpu_srgb_to_framebuffer_space"); +DEFINE_VALUE("SMOOTH_WIDTH", "1.0") +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC2, viewportSize) +PUSH_CONSTANT(FLOAT, lineWidth) +PUSH_CONSTANT(BOOL, lineSmooth) +VERTEX_IN(0, VEC3, pos) +VERTEX_OUT(gpu_shader_3D_polyline_iface) +VERTEX_OUT(gpu_shader_3D_polyline_noperspective_iface) +GEOMETRY_LAYOUT(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) +GEOMETRY_OUT(gpu_shader_3D_polyline_iface) +GEOMETRY_OUT(gpu_shader_3D_polyline_noperspective_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("gpu_shader_3D_polyline_vert.glsl") +GEOMETRY_SOURCE("gpu_shader_3D_polyline_geom.glsl") +FRAGMENT_SOURCE("gpu_shader_3D_polyline_frag.glsl") +ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_no_geom) - .define("SMOOTH_WIDTH", "1.0") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC2, "viewportSize") - .push_constant(Type::FLOAT, "lineWidth") - .push_constant(Type::BOOL, "lineSmooth") - .vertex_in(0, Type::VEC3, "pos") - .vertex_out(gpu_shader_3D_polyline_iface) - .vertex_out(gpu_shader_3D_polyline_noperspective_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("gpu_shader_3D_polyline_vert_no_geom.glsl") - .fragment_source("gpu_shader_3D_polyline_frag.glsl") - .additional_info("gpu_srgb_to_framebuffer_space"); +DEFINE_VALUE("SMOOTH_WIDTH", "1.0") +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC2, viewportSize) +PUSH_CONSTANT(FLOAT, lineWidth) +PUSH_CONSTANT(BOOL, lineSmooth) +VERTEX_IN(0, VEC3, pos) +VERTEX_OUT(gpu_shader_3D_polyline_iface) +VERTEX_OUT(gpu_shader_3D_polyline_noperspective_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("gpu_shader_3D_polyline_vert_no_geom.glsl") +FRAGMENT_SOURCE("gpu_shader_3D_polyline_frag.glsl") +ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_uniform_color) - .do_static_compilation(true) - .define("UNIFORM") - .push_constant(Type::VEC4, "color") - .additional_info("gpu_shader_3D_polyline"); +DO_STATIC_COMPILATION() +DEFINE("UNIFORM") +PUSH_CONSTANT(VEC4, color) +ADDITIONAL_INFO(gpu_shader_3D_polyline) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_uniform_color_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .define("UNIFORM") - .push_constant(Type::VEC4, "color") - .additional_info("gpu_shader_3D_polyline_no_geom"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +DEFINE("UNIFORM") +PUSH_CONSTANT(VEC4, color) +ADDITIONAL_INFO(gpu_shader_3D_polyline_no_geom) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_uniform_color_clipped) - .do_static_compilation(true) - /* TODO(fclem): Put in a UBO to fit the 128byte requirement. */ - .push_constant(Type::MAT4, "ModelMatrix") - .push_constant(Type::VEC4, "ClipPlane") - .define("CLIP") - .additional_info("gpu_shader_3D_polyline_uniform_color"); +DO_STATIC_COMPILATION() +/* TODO(fclem): Put in a UBO to fit the 128byte requirement. */ +PUSH_CONSTANT(MAT4, ModelMatrix) +PUSH_CONSTANT(VEC4, ClipPlane) +DEFINE("CLIP") +ADDITIONAL_INFO(gpu_shader_3D_polyline_uniform_color) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_uniform_color_clipped_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - /* TODO(fclem): Put in an UBO to fit the 128byte requirement. */ - .push_constant(Type::MAT4, "ModelMatrix") - .push_constant(Type::VEC4, "ClipPlane") - .define("CLIP") - .additional_info("gpu_shader_3D_polyline_uniform_color_no_geom"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +/* TODO(fclem): Put in an UBO to fit the 128byte requirement. */ +PUSH_CONSTANT(MAT4, ModelMatrix) +PUSH_CONSTANT(VEC4, ClipPlane) +DEFINE("CLIP") +ADDITIONAL_INFO(gpu_shader_3D_polyline_uniform_color_no_geom) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_flat_color) - .do_static_compilation(true) - .define("FLAT") - .vertex_in(1, Type::VEC4, "color") - .additional_info("gpu_shader_3D_polyline"); +DO_STATIC_COMPILATION() +DEFINE("FLAT") +VERTEX_IN(1, VEC4, color) +ADDITIONAL_INFO(gpu_shader_3D_polyline) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_flat_color_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .define("FLAT") - .vertex_in(1, Type::VEC4, "color") - .additional_info("gpu_shader_3D_polyline_no_geom"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +DEFINE("FLAT") +VERTEX_IN(1, VEC4, color) +ADDITIONAL_INFO(gpu_shader_3D_polyline_no_geom) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_smooth_color) - .do_static_compilation(true) - .define("SMOOTH") - .vertex_in(1, Type::VEC4, "color") - .additional_info("gpu_shader_3D_polyline"); +DO_STATIC_COMPILATION() +DEFINE("SMOOTH") +VERTEX_IN(1, VEC4, color) +ADDITIONAL_INFO(gpu_shader_3D_polyline) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_smooth_color_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .define("SMOOTH") - .vertex_in(1, Type::VEC4, "color") - .additional_info("gpu_shader_3D_polyline_no_geom"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +DEFINE("SMOOTH") +VERTEX_IN(1, VEC4, color) +ADDITIONAL_INFO(gpu_shader_3D_polyline_no_geom) +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_3D_smooth_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_3D_smooth_color_info.hh index d860be2909c..d5989786fb3 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_3D_smooth_color_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_3D_smooth_color_info.hh @@ -10,17 +10,19 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_3D_smooth_color) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC4, "color") - .vertex_out(smooth_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .vertex_source("gpu_shader_3D_smooth_color_vert.glsl") - .fragment_source("gpu_shader_3D_smooth_color_frag.glsl") - .additional_info("gpu_srgb_to_framebuffer_space") - .do_static_compilation(true); +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC4, color) +VERTEX_OUT(smooth_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +VERTEX_SOURCE("gpu_shader_3D_smooth_color_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_3D_smooth_color_frag.glsl") +ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_smooth_color_clipped) - .additional_info("gpu_shader_3D_smooth_color") - .additional_info("gpu_clip_planes") - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_shader_3D_smooth_color) +ADDITIONAL_INFO(gpu_clip_planes) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_3D_uniform_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_3D_uniform_color_info.hh index ff55abdc2b4..0a347628f51 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_3D_uniform_color_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_3D_uniform_color_info.hh @@ -9,30 +9,33 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_3D_uniform_color) - .vertex_in(0, Type::VEC3, "pos") - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC4, "color") - .vertex_source("gpu_shader_3D_vert.glsl") - .fragment_source("gpu_shader_uniform_color_frag.glsl") - .additional_info("gpu_srgb_to_framebuffer_space") - .do_static_compilation(true); +VERTEX_IN(0, VEC3, pos) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC4, color) +VERTEX_SOURCE("gpu_shader_3D_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_uniform_color_frag.glsl") +ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_uniform_color_clipped) - .additional_info("gpu_shader_3D_uniform_color") - .additional_info("gpu_clip_planes") - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_shader_3D_uniform_color) +ADDITIONAL_INFO(gpu_clip_planes) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* Confusing naming convention. But this is a version with only one local clip plane. */ GPU_SHADER_CREATE_INFO(gpu_shader_3D_clipped_uniform_color) - .vertex_in(0, Type::VEC3, "pos") - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC4, "color") - /* TODO(@fclem): Put those two to one UBO. */ - .push_constant(Type::MAT4, "ModelMatrix") - .push_constant(Type::VEC4, "ClipPlane") - .vertex_source("gpu_shader_3D_clipped_uniform_color_vert.glsl") - .fragment_source("gpu_shader_uniform_color_frag.glsl") - .additional_info("gpu_srgb_to_framebuffer_space") - .do_static_compilation(true); +VERTEX_IN(0, VEC3, pos) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC4, color) +/* TODO(@fclem): Put those two to one UBO. */ +PUSH_CONSTANT(MAT4, ModelMatrix) +PUSH_CONSTANT(VEC4, ClipPlane) +VERTEX_SOURCE("gpu_shader_3D_clipped_uniform_color_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_uniform_color_frag.glsl") +ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_gpencil_stroke_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_gpencil_stroke_info.hh index 74d8954e2b7..eadb4264711 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_gpencil_stroke_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_gpencil_stroke_info.hh @@ -9,38 +9,43 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_NAMED_INTERFACE_INFO(gpencil_stroke_vert_iface, geometry_in) - .smooth(Type::VEC4, "finalColor") - .smooth(Type::FLOAT, "finalThickness"); +SMOOTH(VEC4, finalColor) +SMOOTH(FLOAT, finalThickness) +GPU_SHADER_INTERFACE_END() GPU_SHADER_NAMED_INTERFACE_INFO(gpencil_stroke_geom_iface, geometry_out) - .smooth(Type::VEC4, "mColor") - .smooth(Type::VEC2, "mTexCoord"); +SMOOTH(VEC4, mColor) +SMOOTH(VEC2, mTexCoord) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(gpu_shader_gpencil_stroke_base) - .vertex_in(0, Type::VEC4, "color") - .vertex_in(1, Type::VEC3, "pos") - .vertex_in(2, Type::FLOAT, "thickness") - .vertex_out(gpencil_stroke_vert_iface) - .fragment_out(0, Type::VEC4, "fragColor") +VERTEX_IN(0, VEC4, color) +VERTEX_IN(1, VEC3, pos) +VERTEX_IN(2, FLOAT, thickness) +VERTEX_OUT(gpencil_stroke_vert_iface) +FRAGMENT_OUT(0, VEC4, fragColor) - .uniform_buf(0, "GPencilStrokeData", "gpencil_stroke_data") +UNIFORM_BUF(0, GPencilStrokeData, gpencil_stroke_data) - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::MAT4, "ProjectionMatrix") - .fragment_source("gpu_shader_gpencil_stroke_frag.glsl") - .typedef_source("GPU_shader_shared.hh"); +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(MAT4, ProjectionMatrix) +FRAGMENT_SOURCE("gpu_shader_gpencil_stroke_frag.glsl") +TYPEDEF_SOURCE("GPU_shader_shared.hh") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_gpencil_stroke) - .additional_info("gpu_shader_gpencil_stroke_base") - .geometry_layout(PrimitiveIn::LINES_ADJACENCY, PrimitiveOut::TRIANGLE_STRIP, 13) - .geometry_out(gpencil_stroke_geom_iface) - .vertex_source("gpu_shader_gpencil_stroke_vert.glsl") - .geometry_source("gpu_shader_gpencil_stroke_geom.glsl") - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_shader_gpencil_stroke_base) +GEOMETRY_LAYOUT(PrimitiveIn::LINES_ADJACENCY, PrimitiveOut::TRIANGLE_STRIP, 13) +GEOMETRY_OUT(gpencil_stroke_geom_iface) +VERTEX_SOURCE("gpu_shader_gpencil_stroke_vert.glsl") +GEOMETRY_SOURCE("gpu_shader_gpencil_stroke_geom.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_gpencil_stroke_no_geom) - .metal_backend_only(true) - .define("USE_GEOMETRY_IFACE_COLOR") - .additional_info("gpu_shader_gpencil_stroke_base") - .vertex_out(gpencil_stroke_geom_iface) - .vertex_source("gpu_shader_gpencil_stroke_vert_no_geom.glsl") - .do_static_compilation(true); +METAL_BACKEND_ONLY() +DEFINE("USE_GEOMETRY_IFACE_COLOR") +ADDITIONAL_INFO(gpu_shader_gpencil_stroke_base) +VERTEX_OUT(gpencil_stroke_geom_iface) +VERTEX_SOURCE("gpu_shader_gpencil_stroke_vert_no_geom.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_icon_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_icon_info.hh index 2909b3061ba..27cdc063cf7 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_icon_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_icon_info.hh @@ -10,7 +10,7 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_icon) -DEFINE(DO_CORNER_MASKING) +DEFINE("DO_CORNER_MASKING") VERTEX_OUT(smooth_icon_interp_iface) FRAGMENT_OUT(0, VEC4, fragColor) PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) diff --git a/source/blender/gpu/shaders/infos/gpu_shader_index_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_index_info.hh index 4204416b032..51faa169441 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_index_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_index_info.hh @@ -10,25 +10,28 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_index_2d_array_points) - .local_group_size(16, 16, 1) - .push_constant(Type::INT, "elements_per_curve") - .push_constant(Type::INT, "ncurves") - .storage_buf(0, Qualifier::WRITE, "uint", "out_indices[]") - .compute_source("gpu_shader_index_2d_array_points.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16, 1) +PUSH_CONSTANT(INT, elements_per_curve) +PUSH_CONSTANT(INT, ncurves) +STORAGE_BUF(0, WRITE, uint, out_indices[]) +COMPUTE_SOURCE("gpu_shader_index_2d_array_points.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_index_2d_array_lines) - .local_group_size(16, 16, 1) - .push_constant(Type::INT, "elements_per_curve") - .push_constant(Type::INT, "ncurves") - .storage_buf(0, Qualifier::WRITE, "uint", "out_indices[]") - .compute_source("gpu_shader_index_2d_array_lines.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16, 1) +PUSH_CONSTANT(INT, elements_per_curve) +PUSH_CONSTANT(INT, ncurves) +STORAGE_BUF(0, WRITE, uint, out_indices[]) +COMPUTE_SOURCE("gpu_shader_index_2d_array_lines.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_index_2d_array_tris) - .local_group_size(16, 16, 1) - .push_constant(Type::INT, "elements_per_curve") - .push_constant(Type::INT, "ncurves") - .storage_buf(0, Qualifier::WRITE, "uint", "out_indices[]") - .compute_source("gpu_shader_index_2d_array_tris.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16, 1) +PUSH_CONSTANT(INT, elements_per_curve) +PUSH_CONSTANT(INT, ncurves) +STORAGE_BUF(0, WRITE, uint, out_indices[]) +COMPUTE_SOURCE("gpu_shader_index_2d_array_tris.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_instance_varying_color_varying_size_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_instance_varying_color_varying_size_info.hh index 844f5f4d982..d21e6257dcb 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_instance_varying_color_varying_size_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_instance_varying_color_varying_size_info.hh @@ -10,14 +10,15 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_instance_varying_color_varying_size) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC4, "color") - .vertex_in(2, Type::FLOAT, "size") - .vertex_in(3, Type::MAT4, "InstanceModelMatrix") - .vertex_out(flat_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ViewProjectionMatrix") - .vertex_source("gpu_shader_instance_variying_size_variying_color_vert.glsl") - .fragment_source("gpu_shader_flat_color_frag.glsl") - .additional_info("gpu_srgb_to_framebuffer_space") - .do_static_compilation(true); +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC4, color) +VERTEX_IN(2, FLOAT, size) +VERTEX_IN(3, MAT4, InstanceModelMatrix) +VERTEX_OUT(flat_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ViewProjectionMatrix) +VERTEX_SOURCE("gpu_shader_instance_variying_size_variying_color_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_flat_color_frag.glsl") +ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_keyframe_shape_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_keyframe_shape_info.hh index ccb188d5e83..a8fa31d6c75 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_keyframe_shape_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_keyframe_shape_info.hh @@ -9,24 +9,26 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_INTERFACE_INFO(keyframe_shape_iface) - .flat(Type::VEC4, "finalColor") - .flat(Type::VEC4, "finalOutlineColor") - .flat(Type::VEC4, "radii") - .flat(Type::VEC4, "thresholds") - .flat(Type::UINT, "finalFlags"); +FLAT(VEC4, finalColor) +FLAT(VEC4, finalOutlineColor) +FLAT(VEC4, radii) +FLAT(VEC4, thresholds) +FLAT(UINT, finalFlags) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(gpu_shader_keyframe_shape) - .typedef_source("GPU_shader_shared.hh") - .vertex_in(0, Type::VEC4, "color") - .vertex_in(1, Type::VEC4, "outlineColor") - .vertex_in(2, Type::VEC2, "pos") - .vertex_in(3, Type::FLOAT, "size") - .vertex_in(4, Type::UINT, "flags") - .vertex_out(keyframe_shape_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC2, "ViewportSize") - .push_constant(Type::FLOAT, "outline_scale") - .vertex_source("gpu_shader_keyframe_shape_vert.glsl") - .fragment_source("gpu_shader_keyframe_shape_frag.glsl") - .do_static_compilation(true); +TYPEDEF_SOURCE("GPU_shader_shared.hh") +VERTEX_IN(0, VEC4, color) +VERTEX_IN(1, VEC4, outlineColor) +VERTEX_IN(2, VEC2, pos) +VERTEX_IN(3, FLOAT, size) +VERTEX_IN(4, UINT, flags) +VERTEX_OUT(keyframe_shape_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC2, ViewportSize) +PUSH_CONSTANT(FLOAT, outline_scale) +VERTEX_SOURCE("gpu_shader_keyframe_shape_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_keyframe_shape_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_line_dashed_uniform_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_line_dashed_uniform_color_info.hh index 0d4535f0146..6c0ed1d687a 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_line_dashed_uniform_color_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_line_dashed_uniform_color_info.hh @@ -11,28 +11,31 @@ /* We leverage hardware interpolation to compute distance along the line. */ GPU_SHADER_INTERFACE_INFO(gpu_shader_line_dashed_interface) - .no_perspective(Type::VEC2, "stipple_start") /* In screen space */ - .flat(Type::VEC2, "stipple_pos"); /* In screen space */ +NO_PERSPECTIVE(VEC2, stipple_start) /* In screen space */ +FLAT(VEC2, stipple_pos) +GPU_SHADER_INTERFACE_END() /* In screen space */ GPU_SHADER_CREATE_INFO(gpu_shader_3D_line_dashed_uniform_color) - .vertex_in(0, Type::VEC3, "pos") - .vertex_out(flat_color_iface) - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC2, "viewport_size") - .push_constant(Type::FLOAT, "dash_width") - .push_constant(Type::FLOAT, "udash_factor") /* if > 1.0, solid line. */ - /* TODO(fclem): Remove this. And decide to discard if color2 alpha is 0. */ - .push_constant(Type::INT, "colors_len") /* Enabled if > 0, 1 for solid line. */ - .push_constant(Type::VEC4, "color") - .push_constant(Type::VEC4, "color2") - .vertex_out(gpu_shader_line_dashed_interface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("gpu_shader_3D_line_dashed_uniform_color_vert.glsl") - .fragment_source("gpu_shader_2D_line_dashed_frag.glsl") - .do_static_compilation(true); +VERTEX_IN(0, VEC3, pos) +VERTEX_OUT(flat_color_iface) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC2, viewport_size) +PUSH_CONSTANT(FLOAT, dash_width) +PUSH_CONSTANT(FLOAT, udash_factor) /* if > 1.0, solid line. */ +/* TODO(fclem): Remove this. And decide to discard if color2 alpha is 0. */ +PUSH_CONSTANT(INT, colors_len) /* Enabled if > 0, 1 for solid line. */ +PUSH_CONSTANT(VEC4, color) +PUSH_CONSTANT(VEC4, color2) +VERTEX_OUT(gpu_shader_line_dashed_interface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("gpu_shader_3D_line_dashed_uniform_color_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_2D_line_dashed_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_line_dashed_uniform_color_clipped) - .push_constant(Type::MAT4, "ModelMatrix") - .additional_info("gpu_shader_3D_line_dashed_uniform_color") - .additional_info("gpu_clip_planes") - .do_static_compilation(true); +PUSH_CONSTANT(MAT4, ModelMatrix) +ADDITIONAL_INFO(gpu_shader_3D_line_dashed_uniform_color) +ADDITIONAL_INFO(gpu_clip_planes) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_print_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_print_info.hh index 37defa7d433..b8462d05a2b 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_print_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_print_info.hh @@ -9,7 +9,7 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_print) - .storage_buf( - GPU_SHADER_PRINTF_SLOT, Qualifier::READ_WRITE, "uint", "gpu_print_buf[]", Frequency::PASS) - .define("GPU_SHADER_PRINTF_MAX_CAPACITY", STRINGIFY(GPU_SHADER_PRINTF_MAX_CAPACITY)) - .define("GPU_PRINT"); +STORAGE_BUF_FREQ(GPU_SHADER_PRINTF_SLOT, READ_WRITE, uint, gpu_print_buf[], PASS) +DEFINE_VALUE("GPU_SHADER_PRINTF_MAX_CAPACITY", STRINGIFY(GPU_SHADER_PRINTF_MAX_CAPACITY)) +DEFINE("GPU_PRINT") +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_sequencer_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_sequencer_info.hh index f18b1807f61..a7f22cd8aed 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_sequencer_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_sequencer_info.hh @@ -10,33 +10,37 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_INTERFACE_INFO(gpu_seq_strip_iface) - .no_perspective(Type::VEC2, "co_interp") - .flat(Type::UINT, "strip_id"); +NO_PERSPECTIVE(VEC2, co_interp) +FLAT(UINT, strip_id) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(gpu_shader_sequencer_strips) - .vertex_out(gpu_seq_strip_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .uniform_buf(0, "SeqStripDrawData", "strip_data[GPU_SEQ_STRIP_DRAW_DATA_LEN]") - .uniform_buf(1, "SeqContextDrawData", "context_data") - .typedef_source("GPU_shader_shared.hh") - .vertex_source("gpu_shader_sequencer_strips_vert.glsl") - .fragment_source("gpu_shader_sequencer_strips_frag.glsl") - .do_static_compilation(true); +VERTEX_OUT(gpu_seq_strip_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +UNIFORM_BUF(0, SeqStripDrawData, strip_data[GPU_SEQ_STRIP_DRAW_DATA_LEN]) +UNIFORM_BUF(1, SeqContextDrawData, context_data) +TYPEDEF_SOURCE("GPU_shader_shared.hh") +VERTEX_SOURCE("gpu_shader_sequencer_strips_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_sequencer_strips_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(gpu_seq_thumb_iface) - .no_perspective(Type::VEC2, "pos_interp") - .no_perspective(Type::VEC2, "texCoord_interp") - .flat(Type::UINT, "thumb_id"); +NO_PERSPECTIVE(VEC2, pos_interp) +NO_PERSPECTIVE(VEC2, texCoord_interp) +FLAT(UINT, thumb_id) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(gpu_shader_sequencer_thumbs) - .vertex_out(gpu_seq_thumb_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .uniform_buf(0, "SeqStripThumbData", "thumb_data[GPU_SEQ_STRIP_DRAW_DATA_LEN]") - .uniform_buf(1, "SeqContextDrawData", "context_data") - .sampler(0, ImageType::FLOAT_2D, "image") - .typedef_source("GPU_shader_shared.hh") - .vertex_source("gpu_shader_sequencer_thumbs_vert.glsl") - .fragment_source("gpu_shader_sequencer_thumbs_frag.glsl") - .do_static_compilation(true); +VERTEX_OUT(gpu_seq_thumb_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +UNIFORM_BUF(0, SeqStripThumbData, thumb_data[GPU_SEQ_STRIP_DRAW_DATA_LEN]) +UNIFORM_BUF(1, SeqContextDrawData, context_data) +SAMPLER(0, FLOAT_2D, image) +TYPEDEF_SOURCE("GPU_shader_shared.hh") +VERTEX_SOURCE("gpu_shader_sequencer_thumbs_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_sequencer_thumbs_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_simple_lighting_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_simple_lighting_info.hh index 2bc349f4b23..997c15a6a2a 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_simple_lighting_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_simple_lighting_info.hh @@ -8,17 +8,20 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(smooth_normal_iface).smooth(Type::VEC3, "normal"); +GPU_SHADER_INTERFACE_INFO(smooth_normal_iface) +SMOOTH(VEC3, normal) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(gpu_shader_simple_lighting) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC3, "nor") - .vertex_out(smooth_normal_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .uniform_buf(0, "SimpleLightingData", "simple_lighting_data", Frequency::PASS) - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::MAT3, "NormalMatrix") - .typedef_source("GPU_shader_shared.hh") - .vertex_source("gpu_shader_3D_normal_vert.glsl") - .fragment_source("gpu_shader_simple_lighting_frag.glsl") - .do_static_compilation(true); +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC3, nor) +VERTEX_OUT(smooth_normal_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +UNIFORM_BUF_FREQ(0, SimpleLightingData, simple_lighting_data, PASS) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(MAT3, NormalMatrix) +TYPEDEF_SOURCE("GPU_shader_shared.hh") +VERTEX_SOURCE("gpu_shader_3D_normal_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_simple_lighting_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_test_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_test_info.hh index f490f304fb7..216a122dab4 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_test_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_test_info.hh @@ -10,137 +10,159 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_test) - .typedef_source("GPU_shader_shared.hh") - .fragment_out(0, Type::UVEC4, "out_test") - .additional_info("draw_fullscreen"); +TYPEDEF_SOURCE("GPU_shader_shared.hh") +FRAGMENT_OUT(0, UVEC4, out_test) +ADDITIONAL_INFO(draw_fullscreen) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_math_test) - .fragment_source("gpu_math_test.glsl") - .additional_info("gpu_shader_test") - .do_static_compilation(true); +FRAGMENT_SOURCE("gpu_math_test.glsl") +ADDITIONAL_INFO(gpu_shader_test) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_compute_1d_test) - .local_group_size(1) - .image(1, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_1D, "img_output") - .compute_source("gpu_compute_1d_test.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(1) +IMAGE(1, GPU_RGBA32F, WRITE, FLOAT_1D, img_output) +COMPUTE_SOURCE("gpu_compute_1d_test.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_compute_2d_test) - .local_group_size(1, 1) - .image(1, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "img_output") - .compute_source("gpu_compute_2d_test.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(1, 1) +IMAGE(1, GPU_RGBA32F, WRITE, FLOAT_2D, img_output) +COMPUTE_SOURCE("gpu_compute_2d_test.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_compute_ibo_test) - .local_group_size(1) - .storage_buf(0, Qualifier::WRITE, "uint", "out_indices[]") - .compute_source("gpu_compute_ibo_test.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(1) +STORAGE_BUF(0, WRITE, uint, out_indices[]) +COMPUTE_SOURCE("gpu_compute_ibo_test.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_compute_vbo_test) - .local_group_size(1) - .storage_buf(0, Qualifier::WRITE, "vec4", "out_positions[]") - .compute_source("gpu_compute_vbo_test.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(1) +STORAGE_BUF(0, WRITE, vec4, out_positions[]) +COMPUTE_SOURCE("gpu_compute_vbo_test.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_compute_ssbo_test) - .local_group_size(1) - .storage_buf(0, Qualifier::WRITE, "int", "data_out[]") - .compute_source("gpu_compute_ssbo_test.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(1) +STORAGE_BUF(0, WRITE, int, data_out[]) +COMPUTE_SOURCE("gpu_compute_ssbo_test.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_compute_ssbo_binding_test) - .local_group_size(1) - .storage_buf(0, Qualifier::WRITE, "int", "data0[]") - .storage_buf(1, Qualifier::WRITE, "int", "data1[]") - .compute_source("gpu_compute_dummy_test.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(1) +STORAGE_BUF(0, WRITE, int, data0[]) +STORAGE_BUF(1, WRITE, int, data1[]) +COMPUTE_SOURCE("gpu_compute_dummy_test.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* Push constants. */ GPU_SHADER_CREATE_INFO(gpu_push_constants_base_test) - .local_group_size(1) - .storage_buf(0, Qualifier::WRITE, "float", "data_out[]") - .compute_source("gpu_push_constants_test.glsl"); +LOCAL_GROUP_SIZE(1) +STORAGE_BUF(0, WRITE, float, data_out[]) +COMPUTE_SOURCE("gpu_push_constants_test.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_push_constants_test) - .additional_info("gpu_push_constants_base_test") - .push_constant(Type::FLOAT, "float_in") - .push_constant(Type::VEC2, "vec2_in") - .push_constant(Type::VEC3, "vec3_in") - .push_constant(Type::VEC4, "vec4_in") - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_push_constants_base_test) +PUSH_CONSTANT(FLOAT, float_in) +PUSH_CONSTANT(VEC2, vec2_in) +PUSH_CONSTANT(VEC3, vec3_in) +PUSH_CONSTANT(VEC4, vec4_in) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* Push constants size test. */ GPU_SHADER_CREATE_INFO(gpu_push_constants_128bytes_test) - .additional_info("gpu_push_constants_test") - .push_constant(Type::FLOAT, "filler", 20) - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_push_constants_test) +PUSH_CONSTANT_ARRAY(FLOAT, filler, 20) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_push_constants_256bytes_test) - .additional_info("gpu_push_constants_128bytes_test") - .push_constant(Type::FLOAT, "filler2", 32) - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_push_constants_128bytes_test) +PUSH_CONSTANT_ARRAY(FLOAT, filler2, 32) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_push_constants_512bytes_test) - .additional_info("gpu_push_constants_256bytes_test") - .push_constant(Type::FLOAT, "filler3", 64) - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_push_constants_256bytes_test) +PUSH_CONSTANT_ARRAY(FLOAT, filler3, 64) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_push_constants_8192bytes_test) - .additional_info("gpu_push_constants_512bytes_test") - .push_constant(Type::FLOAT, "filler4", 1920) - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_push_constants_512bytes_test) +PUSH_CONSTANT_ARRAY(FLOAT, filler4, 1920) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_buffer_texture_test) - .local_group_size(1) - .sampler(0, ImageType::FLOAT_BUFFER, "bufferTexture") - .storage_buf(0, Qualifier::WRITE, "float", "data_out[]") - .compute_source("gpu_buffer_texture_test.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(1) +SAMPLER(0, FLOAT_BUFFER, bufferTexture) +STORAGE_BUF(0, WRITE, float, data_out[]) +COMPUTE_SOURCE("gpu_buffer_texture_test.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* Specialization constants. */ GPU_SHADER_CREATE_INFO(gpu_specialization_constants_base_test) - .storage_buf(0, Qualifier::WRITE, "int", "data_out[]") - .specialization_constant(Type::FLOAT, "float_in", 2) - .specialization_constant(Type::UINT, "uint_in", 3) - .specialization_constant(Type::INT, "int_in", 4) - .specialization_constant(Type::BOOL, "bool_in", true); +STORAGE_BUF(0, WRITE, int, data_out[]) +SPECIALIZATION_CONSTANT(FLOAT, float_in, 2) +SPECIALIZATION_CONSTANT(UINT, uint_in, 3) +SPECIALIZATION_CONSTANT(INT, int_in, 4) +SPECIALIZATION_CONSTANT(BOOL, bool_in, true) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_compute_specialization_test) - .local_group_size(1) - .additional_info("gpu_specialization_constants_base_test") - .compute_source("gpu_specialization_test.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(1) +ADDITIONAL_INFO(gpu_specialization_constants_base_test) +COMPUTE_SOURCE("gpu_specialization_test.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_graphic_specialization_test) - .additional_info("gpu_specialization_constants_base_test") - .vertex_source("gpu_specialization_test.glsl") - .fragment_source("gpu_specialization_test.glsl") - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_specialization_constants_base_test) +VERTEX_SOURCE("gpu_specialization_test.glsl") +FRAGMENT_SOURCE("gpu_specialization_test.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* EEVEE test. */ GPU_SHADER_CREATE_INFO(eevee_shadow_test) - .fragment_source("eevee_shadow_test.glsl") - .additional_info("gpu_shader_test") - .additional_info("eevee_shared") - .do_static_compilation(true); +FRAGMENT_SOURCE("eevee_shadow_test.glsl") +ADDITIONAL_INFO(gpu_shader_test) +ADDITIONAL_INFO(eevee_shared) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_occupancy_test) - .fragment_source("eevee_occupancy_test.glsl") - .additional_info("gpu_shader_test") - .additional_info("eevee_shared") - .do_static_compilation(true); +FRAGMENT_SOURCE("eevee_occupancy_test.glsl") +ADDITIONAL_INFO(gpu_shader_test) +ADDITIONAL_INFO(eevee_shared) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_gbuffer_normal_test) - .fragment_source("eevee_gbuffer_normal_test.glsl") - .additional_info("gpu_shader_test") - .additional_info("eevee_shared") - .do_static_compilation(true); +FRAGMENT_SOURCE("eevee_gbuffer_normal_test.glsl") +ADDITIONAL_INFO(gpu_shader_test) +ADDITIONAL_INFO(eevee_shared) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_gbuffer_closure_test) - .fragment_source("eevee_gbuffer_closure_test.glsl") - .additional_info("gpu_shader_test") - .additional_info("eevee_shared") - .do_static_compilation(true); +FRAGMENT_SOURCE("eevee_gbuffer_closure_test.glsl") +ADDITIONAL_INFO(gpu_shader_test) +ADDITIONAL_INFO(eevee_shared) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_text_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_text_info.hh index cb2b8636f9e..26dd528cc51 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_text_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_text_info.hh @@ -9,25 +9,27 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_INTERFACE_INFO(text_iface) - .flat(Type::VEC4, "color_flat") - .no_perspective(Type::VEC2, "texCoord_interp") - .flat(Type::INT, "glyph_offset") - .flat(Type::UINT, "glyph_flags") - .flat(Type::IVEC2, "glyph_dim"); +FLAT(VEC4, color_flat) +NO_PERSPECTIVE(VEC2, texCoord_interp) +FLAT(INT, glyph_offset) +FLAT(UINT, glyph_flags) +FLAT(IVEC2, glyph_dim) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(gpu_shader_text) - .vertex_in(0, Type::VEC4, "pos") - .vertex_in(1, Type::VEC4, "col") - .vertex_in(2, Type ::IVEC2, "glyph_size") - .vertex_in(3, Type ::INT, "offset") - .vertex_in(4, Type ::UINT, "flags") - .vertex_out(text_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::INT, "glyph_tex_width_mask") - .push_constant(Type::INT, "glyph_tex_width_shift") - .sampler(0, ImageType::FLOAT_2D, "glyph", Frequency::PASS) - .vertex_source("gpu_shader_text_vert.glsl") - .fragment_source("gpu_shader_text_frag.glsl") - .additional_info("gpu_srgb_to_framebuffer_space") - .do_static_compilation(true); +VERTEX_IN(0, VEC4, pos) +VERTEX_IN(1, VEC4, col) +VERTEX_IN(2, IVEC2, glyph_size) +VERTEX_IN(3, INT, offset) +VERTEX_IN(4, UINT, flags) +VERTEX_OUT(text_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(INT, glyph_tex_width_mask) +PUSH_CONSTANT(INT, glyph_tex_width_shift) +SAMPLER_FREQ(0, FLOAT_2D, glyph, PASS) +VERTEX_SOURCE("gpu_shader_text_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_text_frag.glsl") +ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_srgb_to_framebuffer_space_info.hh b/source/blender/gpu/shaders/infos/gpu_srgb_to_framebuffer_space_info.hh index 37ff2f958b8..62030deda70 100644 --- a/source/blender/gpu/shaders/infos/gpu_srgb_to_framebuffer_space_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_srgb_to_framebuffer_space_info.hh @@ -9,5 +9,6 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_srgb_to_framebuffer_space) - .push_constant(Type::BOOL, "srgbTarget") - .define("blender_srgb_to_framebuffer_space(a) a"); +PUSH_CONSTANT(BOOL, srgbTarget) +DEFINE("blender_srgb_to_framebuffer_space(a) a") +GPU_SHADER_CREATE_END() -- 2.30.2 From 186af04072178c4db9087946364bcdace3a51eb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 11:45:48 +0200 Subject: [PATCH 58/90] Fix wrong define --- source/blender/draw/intern/shaders/draw_view_info.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/draw/intern/shaders/draw_view_info.hh b/source/blender/draw/intern/shaders/draw_view_info.hh index 8c28ab55bcf..79067cfcd69 100644 --- a/source/blender/draw/intern/shaders/draw_view_info.hh +++ b/source/blender/draw/intern/shaders/draw_view_info.hh @@ -37,7 +37,7 @@ GPU_SHADER_CREATE_INFO(draw_resource_id_uniform) * Requires draw_resource_id[_uniform]. */ GPU_SHADER_CREATE_INFO(draw_resource_handle) - .define("resource_handle (drw_resourceChunk * DRW_RESOURCE_CHUNK_LEN + resource_id)") + .define("resource_handle", "(drw_resourceChunk * DRW_RESOURCE_CHUNK_LEN + resource_id)") .push_constant(Type::INT, "drw_resourceChunk"); /** \} */ -- 2.30.2 From bf0cf3f64f46de3d2e7eeeafdc1db93f0ae4c2ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 11:51:14 +0200 Subject: [PATCH 59/90] Remaining macros renaming --- .../draw/intern/shaders/draw_debug_info.hh | 59 +-- .../intern/shaders/draw_fullscreen_info.hh | 9 +- .../intern/shaders/draw_hair_refine_info.hh | 37 +- .../intern/shaders/draw_object_infos_info.hh | 67 ++-- .../draw/intern/shaders/draw_view_info.hh | 377 ++++++++++-------- 5 files changed, 297 insertions(+), 252 deletions(-) diff --git a/source/blender/draw/intern/shaders/draw_debug_info.hh b/source/blender/draw/intern/shaders/draw_debug_info.hh index 0121365d957..3d5803651d0 100644 --- a/source/blender/draw/intern/shaders/draw_debug_info.hh +++ b/source/blender/draw/intern/shaders/draw_debug_info.hh @@ -12,21 +12,25 @@ * \{ */ GPU_SHADER_CREATE_INFO(draw_debug_print) - .define("DRW_DEBUG_PRINT") - .typedef_source("draw_shader_shared.hh") - .storage_buf(DRW_DEBUG_PRINT_SLOT, Qualifier::READ_WRITE, "uint", "drw_debug_print_buf[]"); +DEFINE("DRW_DEBUG_PRINT") +TYPEDEF_SOURCE("draw_shader_shared.hh") +STORAGE_BUF(DRW_DEBUG_PRINT_SLOT, READ_WRITE, uint, drw_debug_print_buf[]) +GPU_SHADER_CREATE_END() -GPU_SHADER_INTERFACE_INFO(draw_debug_print_display_iface).flat(Type::UINT, "char_index"); +GPU_SHADER_INTERFACE_INFO(draw_debug_print_display_iface) +FLAT(UINT, char_index) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(draw_debug_print_display) - .do_static_compilation(true) - .typedef_source("draw_shader_shared.hh") - .storage_buf(DRW_DEBUG_PRINT_SLOT, Qualifier::READ, "uint", "drw_debug_print_buf[]") - .vertex_out(draw_debug_print_display_iface) - .fragment_out(0, Type::VEC4, "out_color") - .push_constant(Type::VEC2, "viewport_size") - .vertex_source("draw_debug_print_display_vert.glsl") - .fragment_source("draw_debug_print_display_frag.glsl"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("draw_shader_shared.hh") +STORAGE_BUF(DRW_DEBUG_PRINT_SLOT, READ, uint, drw_debug_print_buf[]) +VERTEX_OUT(draw_debug_print_display_iface) +FRAGMENT_OUT(0, VEC4, out_color) +PUSH_CONSTANT(VEC2, viewport_size) +VERTEX_SOURCE("draw_debug_print_display_vert.glsl") +FRAGMENT_SOURCE("draw_debug_print_display_frag.glsl") +GPU_SHADER_CREATE_END() /** \} */ @@ -37,23 +41,24 @@ GPU_SHADER_CREATE_INFO(draw_debug_print_display) * \{ */ GPU_SHADER_CREATE_INFO(draw_debug_draw) - .define("DRW_DEBUG_DRAW") - .typedef_source("draw_shader_shared.hh") - .storage_buf(DRW_DEBUG_DRAW_SLOT, - Qualifier::READ_WRITE, - "DRWDebugVert", - "drw_debug_verts_buf[]"); +DEFINE("DRW_DEBUG_DRAW") +TYPEDEF_SOURCE("draw_shader_shared.hh") +STORAGE_BUF(DRW_DEBUG_DRAW_SLOT, READ_WRITE, DRWDebugVert, drw_debug_verts_buf[]) +GPU_SHADER_CREATE_END() -GPU_SHADER_NAMED_INTERFACE_INFO(draw_debug_draw_display_iface, interp).flat(Type::VEC4, "color"); +GPU_SHADER_NAMED_INTERFACE_INFO(draw_debug_draw_display_iface, interp) +FLAT(VEC4, color) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(draw_debug_draw_display) - .do_static_compilation(true) - .typedef_source("draw_shader_shared.hh") - .storage_buf(DRW_DEBUG_DRAW_SLOT, Qualifier::READ, "DRWDebugVert", "drw_debug_verts_buf[]") - .vertex_out(draw_debug_draw_display_iface) - .fragment_out(0, Type::VEC4, "out_color") - .push_constant(Type::MAT4, "persmat") - .vertex_source("draw_debug_draw_display_vert.glsl") - .fragment_source("draw_debug_draw_display_frag.glsl"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("draw_shader_shared.hh") +STORAGE_BUF(DRW_DEBUG_DRAW_SLOT, READ, DRWDebugVert, drw_debug_verts_buf[]) +VERTEX_OUT(draw_debug_draw_display_iface) +FRAGMENT_OUT(0, VEC4, out_color) +PUSH_CONSTANT(MAT4, persmat) +VERTEX_SOURCE("draw_debug_draw_display_vert.glsl") +FRAGMENT_SOURCE("draw_debug_draw_display_frag.glsl") +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/intern/shaders/draw_fullscreen_info.hh b/source/blender/draw/intern/shaders/draw_fullscreen_info.hh index 09d92f5194d..e117f80c2b5 100644 --- a/source/blender/draw/intern/shaders/draw_fullscreen_info.hh +++ b/source/blender/draw/intern/shaders/draw_fullscreen_info.hh @@ -4,8 +4,11 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(fullscreen_iface).smooth(Type::VEC4, "uvcoordsvar"); +GPU_SHADER_INTERFACE_INFO(fullscreen_iface) +SMOOTH(VEC4, uvcoordsvar) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(draw_fullscreen) - .vertex_out(fullscreen_iface) - .vertex_source("common_fullscreen_vert.glsl"); +VERTEX_OUT(fullscreen_iface) +VERTEX_SOURCE("common_fullscreen_vert.glsl") +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/intern/shaders/draw_hair_refine_info.hh b/source/blender/draw/intern/shaders/draw_hair_refine_info.hh index 81d0b6ab1ae..d6b7afd1fd2 100644 --- a/source/blender/draw/intern/shaders/draw_hair_refine_info.hh +++ b/source/blender/draw/intern/shaders/draw_hair_refine_info.hh @@ -9,21 +9,22 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(draw_hair_refine_compute) - .local_group_size(1, 1) - .storage_buf(0, Qualifier::WRITE, "vec4", "posTime[]") - .sampler(0, ImageType::FLOAT_BUFFER, "hairPointBuffer") - .sampler(1, ImageType::UINT_BUFFER, "hairStrandBuffer") - .sampler(2, ImageType::UINT_BUFFER, "hairStrandSegBuffer") - .push_constant(Type::MAT4, "hairDupliMatrix") - .push_constant(Type::BOOL, "hairCloseTip") - .push_constant(Type::FLOAT, "hairRadShape") - .push_constant(Type::FLOAT, "hairRadTip") - .push_constant(Type::FLOAT, "hairRadRoot") - .push_constant(Type::INT, "hairThicknessRes") - .push_constant(Type::INT, "hairStrandsRes") - .push_constant(Type::INT, "hairStrandOffset") - .compute_source("common_hair_refine_comp.glsl") - .define("HAIR_PHASE_SUBDIV") - .define("HAIR_SHADER") - .define("DRW_HAIR_INFO") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(1, 1) +STORAGE_BUF(0, WRITE, vec4, posTime[]) +SAMPLER(0, FLOAT_BUFFER, hairPointBuffer) +SAMPLER(1, UINT_BUFFER, hairStrandBuffer) +SAMPLER(2, UINT_BUFFER, hairStrandSegBuffer) +PUSH_CONSTANT(MAT4, hairDupliMatrix) +PUSH_CONSTANT(BOOL, hairCloseTip) +PUSH_CONSTANT(FLOAT, hairRadShape) +PUSH_CONSTANT(FLOAT, hairRadTip) +PUSH_CONSTANT(FLOAT, hairRadRoot) +PUSH_CONSTANT(INT, hairThicknessRes) +PUSH_CONSTANT(INT, hairStrandsRes) +PUSH_CONSTANT(INT, hairStrandOffset) +COMPUTE_SOURCE("common_hair_refine_comp.glsl") +DEFINE("HAIR_PHASE_SUBDIV") +DEFINE("HAIR_SHADER") +DEFINE("DRW_HAIR_INFO") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/intern/shaders/draw_object_infos_info.hh b/source/blender/draw/intern/shaders/draw_object_infos_info.hh index 91497b459b3..38d0dc9cde0 100644 --- a/source/blender/draw/intern/shaders/draw_object_infos_info.hh +++ b/source/blender/draw/intern/shaders/draw_object_infos_info.hh @@ -6,46 +6,49 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(draw_object_infos) - .typedef_source("draw_shader_shared.hh") - .define("OBINFO_LIB") - .define("OrcoTexCoFactors", "(drw_infos[resource_id].orco_mul_bias)") - .define("ObjectInfo", "(drw_infos[resource_id].infos)") - .define("ObjectColor", "(drw_infos[resource_id].ob_color)") - .uniform_buf(DRW_OBJ_INFOS_UBO_SLOT, - "ObjectInfos", - "drw_infos[DRW_RESOURCE_CHUNK_LEN]", - Frequency::BATCH); +TYPEDEF_SOURCE("draw_shader_shared.hh") +DEFINE("OBINFO_LIB") +DEFINE_VALUE("OrcoTexCoFactors", "(drw_infos[resource_id].orco_mul_bias)") +DEFINE_VALUE("ObjectInfo", "(drw_infos[resource_id].infos)") +DEFINE_VALUE("ObjectColor", "(drw_infos[resource_id].ob_color)") +UNIFORM_BUF_FREQ(DRW_OBJ_INFOS_UBO_SLOT, ObjectInfos, drw_infos[DRW_RESOURCE_CHUNK_LEN], BATCH) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_volume_infos) - .typedef_source("draw_shader_shared.hh") - .define("VOLUME_INFO_LIB") - .uniform_buf(DRW_OBJ_DATA_INFO_UBO_SLOT, "VolumeInfos", "drw_volume", Frequency::BATCH); +TYPEDEF_SOURCE("draw_shader_shared.hh") +DEFINE("VOLUME_INFO_LIB") +UNIFORM_BUF_FREQ(DRW_OBJ_DATA_INFO_UBO_SLOT, VolumeInfos, drw_volume, BATCH) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_curves_infos) - .typedef_source("draw_shader_shared.hh") - .uniform_buf(DRW_OBJ_DATA_INFO_UBO_SLOT, "CurvesInfos", "drw_curves", Frequency::BATCH); +TYPEDEF_SOURCE("draw_shader_shared.hh") +UNIFORM_BUF_FREQ(DRW_OBJ_DATA_INFO_UBO_SLOT, CurvesInfos, drw_curves, BATCH) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_layer_attributes) - .typedef_source("draw_shader_shared.hh") - .define("VLATTR_LIB") - .uniform_buf(DRW_LAYER_ATTR_UBO_SLOT, - "LayerAttribute", - "drw_layer_attrs[DRW_RESOURCE_CHUNK_LEN]", - Frequency::BATCH); +TYPEDEF_SOURCE("draw_shader_shared.hh") +DEFINE("VLATTR_LIB") +UNIFORM_BUF_FREQ(DRW_LAYER_ATTR_UBO_SLOT, + LayerAttribute, + drw_layer_attrs[DRW_RESOURCE_CHUNK_LEN], + BATCH) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_object_infos_new) - .typedef_source("draw_shader_shared.hh") - .define("OBINFO_LIB") - .define("OBINFO_NEW") - .define("OrcoTexCoFactors", "(drw_infos[resource_id].orco_mul_bias)") - .define("ObjectInfo", "(drw_infos[resource_id].infos)") - .define("ObjectColor", "(drw_infos[resource_id].ob_color)") - .storage_buf(DRW_OBJ_INFOS_SLOT, Qualifier::READ, "ObjectInfos", "drw_infos[]"); +TYPEDEF_SOURCE("draw_shader_shared.hh") +DEFINE("OBINFO_LIB") +DEFINE("OBINFO_NEW") +DEFINE_VALUE("OrcoTexCoFactors", "(drw_infos[resource_id].orco_mul_bias)") +DEFINE_VALUE("ObjectInfo", "(drw_infos[resource_id].infos)") +DEFINE_VALUE("ObjectColor", "(drw_infos[resource_id].ob_color)") +STORAGE_BUF(DRW_OBJ_INFOS_SLOT, READ, ObjectInfos, drw_infos[]) +GPU_SHADER_CREATE_END() /** \note Requires draw_object_infos_new. */ GPU_SHADER_CREATE_INFO(draw_object_attribute_new) - .define("OBATTR_LIB") - .define("ObjectAttributeStart", "(drw_infos[resource_id].orco_mul_bias[0].w)") - .define("ObjectAttributeLen", "(drw_infos[resource_id].orco_mul_bias[1].w)") - .storage_buf(DRW_OBJ_ATTR_SLOT, Qualifier::READ, "ObjectAttribute", "drw_attrs[]") - .additional_info("draw_object_infos_new"); +DEFINE("OBATTR_LIB") +DEFINE_VALUE("ObjectAttributeStart", "(drw_infos[resource_id].orco_mul_bias[0].w)") +DEFINE_VALUE("ObjectAttributeLen", "(drw_infos[resource_id].orco_mul_bias[1].w)") +STORAGE_BUF(DRW_OBJ_ATTR_SLOT, READ, ObjectAttribute, drw_attrs[]) +ADDITIONAL_INFO(draw_object_infos_new) +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/intern/shaders/draw_view_info.hh b/source/blender/draw/intern/shaders/draw_view_info.hh index 79067cfcd69..f8e13104798 100644 --- a/source/blender/draw/intern/shaders/draw_view_info.hh +++ b/source/blender/draw/intern/shaders/draw_view_info.hh @@ -14,31 +14,37 @@ * \{ */ /* Standard way. Use gpu_InstanceIndex to index the object data. */ -GPU_SHADER_CREATE_INFO(draw_resource_id).define("DYNAMIC_RESOURCE_ID"); +GPU_SHADER_CREATE_INFO(draw_resource_id) +DEFINE("DYNAMIC_RESOURCE_ID") +GPU_SHADER_CREATE_END() /** * Used if the resource index needs to be passed to the fragment shader. * IMPORTANT: Vertex and Geometry shaders need to use PASS_RESOURCE_ID in main(). */ GPU_SHADER_NAMED_INTERFACE_INFO(draw_resource_id_iface, drw_ResourceID_iface) - .flat(Type::INT, "resource_index"); +FLAT(INT, resource_index) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(draw_resource_id_varying) - .vertex_out(draw_resource_id_iface) - .geometry_out(draw_resource_id_iface); /* Used if needed. */ +VERTEX_OUT(draw_resource_id_iface) +GEOMETRY_OUT(draw_resource_id_iface) +GPU_SHADER_CREATE_END() /* Used if needed. */ /* Variation used when drawing multiple instances for one object. */ GPU_SHADER_CREATE_INFO(draw_resource_id_uniform) - .define("UNIFORM_RESOURCE_ID") - .push_constant(Type::INT, "drw_ResourceID"); +DEFINE("UNIFORM_RESOURCE_ID") +PUSH_CONSTANT(INT, drw_ResourceID) +GPU_SHADER_CREATE_END() /** * Declare a resource handle that identify a unique object. * Requires draw_resource_id[_uniform]. */ GPU_SHADER_CREATE_INFO(draw_resource_handle) - .define("resource_handle", "(drw_resourceChunk * DRW_RESOURCE_CHUNK_LEN + resource_id)") - .push_constant(Type::INT, "drw_resourceChunk"); +DEFINE_VALUE("resource_handle", "(drw_resourceChunk * DRW_RESOURCE_CHUNK_LEN + resource_id)") +PUSH_CONSTANT(INT, drw_resourceChunk) +GPU_SHADER_CREATE_END() /** \} */ @@ -47,36 +53,38 @@ GPU_SHADER_CREATE_INFO(draw_resource_handle) * \{ */ GPU_SHADER_CREATE_INFO(draw_view) - .uniform_buf(DRW_VIEW_UBO_SLOT, "ViewMatrices", "drw_view_[DRW_VIEW_LEN]", Frequency::PASS) - .define("DRAW_VIEW_CREATE_INFO") - .define("drw_view", "drw_view_[drw_view_id]") - .typedef_source("draw_shader_shared.hh"); +UNIFORM_BUF_FREQ(DRW_VIEW_UBO_SLOT, ViewMatrices, drw_view_[DRW_VIEW_LEN], PASS) +DEFINE("DRAW_VIEW_CREATE_INFO") +DEFINE_VALUE("drw_view", "drw_view_[drw_view_id]") +TYPEDEF_SOURCE("draw_shader_shared.hh") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_view_culling) - .uniform_buf(DRW_VIEW_CULLING_UBO_SLOT, "ViewCullingData", "drw_view_culling_[DRW_VIEW_LEN]") - .define("DRW_VIEW_CULLING_INFO") - .define("drw_view_culling", "drw_view_culling_[drw_view_id]") - .typedef_source("draw_shader_shared.hh"); +UNIFORM_BUF(DRW_VIEW_CULLING_UBO_SLOT, ViewCullingData, drw_view_culling_[DRW_VIEW_LEN]) +DEFINE("DRW_VIEW_CULLING_INFO") +DEFINE_VALUE("drw_view_culling", "drw_view_culling_[drw_view_id]") +TYPEDEF_SOURCE("draw_shader_shared.hh") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_modelmat) - .uniform_buf(DRW_OBJ_MAT_UBO_SLOT, - "ObjectMatrices", - "drw_matrices[DRW_RESOURCE_CHUNK_LEN]", - Frequency::BATCH) - .define("ModelMatrix", "(drw_matrices[resource_id].model)") - .define("ModelMatrixInverse", "(drw_matrices[resource_id].model_inverse)") - .additional_info("draw_view"); +UNIFORM_BUF_FREQ(DRW_OBJ_MAT_UBO_SLOT, ObjectMatrices, drw_matrices[DRW_RESOURCE_CHUNK_LEN], BATCH) +DEFINE_VALUE("ModelMatrix", "(drw_matrices[resource_id].model)") +DEFINE_VALUE("ModelMatrixInverse", "(drw_matrices[resource_id].model_inverse)") +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_modelmat_legacy) - .define("DRW_LEGACY_MODEL_MATRIX") - .push_constant(Type::MAT4, "ModelMatrix") - .push_constant(Type::MAT4, "ModelMatrixInverse") - .additional_info("draw_view"); +DEFINE("DRW_LEGACY_MODEL_MATRIX") +PUSH_CONSTANT(MAT4, ModelMatrix) +PUSH_CONSTANT(MAT4, ModelMatrixInverse) +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_modelmat_instanced_attr) - .push_constant(Type::MAT4, "ModelMatrix") - .push_constant(Type::MAT4, "ModelMatrixInverse") - .additional_info("draw_view"); +PUSH_CONSTANT(MAT4, ModelMatrix) +PUSH_CONSTANT(MAT4, ModelMatrixInverse) +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() /** \} */ @@ -85,9 +93,10 @@ GPU_SHADER_CREATE_INFO(draw_modelmat_instanced_attr) * \{ */ GPU_SHADER_CREATE_INFO(drw_clipped) - /* TODO(fclem): Move to engine side. */ - .uniform_buf(DRW_CLIPPING_UBO_SLOT, "vec4", "drw_clipping_[6]", Frequency::PASS) - .define("USE_WORLD_CLIP_PLANES"); +/* TODO(fclem): Move to engine side. */ +UNIFORM_BUF_FREQ(DRW_CLIPPING_UBO_SLOT, vec4, drw_clipping_[6], PASS) +DEFINE("USE_WORLD_CLIP_PLANES") +GPU_SHADER_CREATE_END() /** \} */ @@ -96,8 +105,9 @@ GPU_SHADER_CREATE_INFO(drw_clipped) * \{ */ GPU_SHADER_CREATE_INFO(draw_globals) - .typedef_source("draw_common_shader_shared.hh") - .uniform_buf(7, "GlobalsUboStorage", "globalsBlock", Frequency::PASS); +TYPEDEF_SOURCE("draw_common_shader_shared.hh") +UNIFORM_BUF_FREQ(7, GlobalsUboStorage, globalsBlock, PASS) +GPU_SHADER_CREATE_END() /** \} */ @@ -106,91 +116,101 @@ GPU_SHADER_CREATE_INFO(draw_globals) * \{ */ GPU_SHADER_CREATE_INFO(draw_mesh) - .additional_info("draw_modelmat") - .additional_info("draw_resource_id"); +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(draw_resource_id) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_mesh_new) - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_id"); +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_id) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_hair) - .define("HAIR_SHADER") - .define("DRW_HAIR_INFO") - .sampler(15, ImageType::FLOAT_BUFFER, "hairPointBuffer") - /* TODO(@fclem): Pack these into one UBO. */ - .push_constant(Type::INT, "hairStrandsRes") - .push_constant(Type::INT, "hairThicknessRes") - .push_constant(Type::FLOAT, "hairRadRoot") - .push_constant(Type::FLOAT, "hairRadTip") - .push_constant(Type::FLOAT, "hairRadShape") - .push_constant(Type::BOOL, "hairCloseTip") - .push_constant(Type::INT, "hairStrandOffset") - .push_constant(Type::MAT4, "hairDupliMatrix") - .additional_info("draw_modelmat") - .additional_info("draw_resource_id"); +DEFINE("HAIR_SHADER") +DEFINE("DRW_HAIR_INFO") +SAMPLER(15, FLOAT_BUFFER, hairPointBuffer) +/* TODO(@fclem): Pack these into one UBO. */ +PUSH_CONSTANT(INT, hairStrandsRes) +PUSH_CONSTANT(INT, hairThicknessRes) +PUSH_CONSTANT(FLOAT, hairRadRoot) +PUSH_CONSTANT(FLOAT, hairRadTip) +PUSH_CONSTANT(FLOAT, hairRadShape) +PUSH_CONSTANT(BOOL, hairCloseTip) +PUSH_CONSTANT(INT, hairStrandOffset) +PUSH_CONSTANT(MAT4, hairDupliMatrix) +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(draw_resource_id) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_hair_new) - .define("HAIR_SHADER") - .define("DRW_HAIR_INFO") - .sampler(0, ImageType::FLOAT_BUFFER, "hairPointBuffer") - /* TODO(@fclem): Pack these into one UBO. */ - .push_constant(Type::INT, "hairStrandsRes") - .push_constant(Type::INT, "hairThicknessRes") - .push_constant(Type::FLOAT, "hairRadRoot") - .push_constant(Type::FLOAT, "hairRadTip") - .push_constant(Type::FLOAT, "hairRadShape") - .push_constant(Type::BOOL, "hairCloseTip") - .push_constant(Type::INT, "hairStrandOffset") - .push_constant(Type::MAT4, "hairDupliMatrix"); +DEFINE("HAIR_SHADER") +DEFINE("DRW_HAIR_INFO") +SAMPLER(0, FLOAT_BUFFER, hairPointBuffer) +/* TODO(@fclem): Pack these into one UBO. */ +PUSH_CONSTANT(INT, hairStrandsRes) +PUSH_CONSTANT(INT, hairThicknessRes) +PUSH_CONSTANT(FLOAT, hairRadRoot) +PUSH_CONSTANT(FLOAT, hairRadTip) +PUSH_CONSTANT(FLOAT, hairRadShape) +PUSH_CONSTANT(BOOL, hairCloseTip) +PUSH_CONSTANT(INT, hairStrandOffset) +PUSH_CONSTANT(MAT4, hairDupliMatrix) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_pointcloud) - .sampler(0, ImageType::FLOAT_BUFFER, "ptcloud_pos_rad_tx", Frequency::BATCH) - .define("POINTCLOUD_SHADER") - .define("DRW_POINTCLOUD_INFO") - .additional_info("draw_modelmat_instanced_attr") - .additional_info("draw_resource_id_uniform"); +SAMPLER_FREQ(0, FLOAT_BUFFER, ptcloud_pos_rad_tx, BATCH) +DEFINE("POINTCLOUD_SHADER") +DEFINE("DRW_POINTCLOUD_INFO") +ADDITIONAL_INFO(draw_modelmat_instanced_attr) +ADDITIONAL_INFO(draw_resource_id_uniform) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_pointcloud_new) - .sampler(0, ImageType::FLOAT_BUFFER, "ptcloud_pos_rad_tx", Frequency::BATCH) - .define("POINTCLOUD_SHADER") - .define("DRW_POINTCLOUD_INFO"); +SAMPLER_FREQ(0, FLOAT_BUFFER, ptcloud_pos_rad_tx, BATCH) +DEFINE("POINTCLOUD_SHADER") +DEFINE("DRW_POINTCLOUD_INFO") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_volume) - .additional_info("draw_modelmat") - .additional_info("draw_resource_id_uniform"); +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(draw_resource_id_uniform) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_volume_new) - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new"); +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_gpencil) - .typedef_source("gpencil_shader_shared.h") - .define("DRW_GPENCIL_INFO") - .sampler(0, ImageType::FLOAT_BUFFER, "gp_pos_tx") - .sampler(1, ImageType::FLOAT_BUFFER, "gp_col_tx") - /* Per Object */ - .push_constant(Type::FLOAT, "gpThicknessScale") /* TODO(fclem): Replace with object info. */ - .push_constant(Type::FLOAT, "gpThicknessWorldScale") /* TODO(fclem): Same as above. */ - .define("gpThicknessIsScreenSpace", "(gpThicknessWorldScale < 0.0)") - /* Per Layer */ - .push_constant(Type::FLOAT, "gpThicknessOffset") - .additional_info("draw_modelmat") - .additional_info("draw_object_infos"); +TYPEDEF_SOURCE("gpencil_shader_shared.h") +DEFINE("DRW_GPENCIL_INFO") +SAMPLER(0, FLOAT_BUFFER, gp_pos_tx) +SAMPLER(1, FLOAT_BUFFER, gp_col_tx) +/* Per Object */ +PUSH_CONSTANT(FLOAT, gpThicknessScale) /* TODO(fclem): Replace with object info. */ +PUSH_CONSTANT(FLOAT, gpThicknessWorldScale) /* TODO(fclem): Same as above. */ +DEFINE_VALUE("gpThicknessIsScreenSpace", "(gpThicknessWorldScale < 0.0)") +/* Per Layer */ +PUSH_CONSTANT(FLOAT, gpThicknessOffset) +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(draw_object_infos) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_gpencil_new) - .typedef_source("gpencil_shader_shared.h") - .define("DRW_GPENCIL_INFO") - .sampler(0, ImageType::FLOAT_BUFFER, "gp_pos_tx") - .sampler(1, ImageType::FLOAT_BUFFER, "gp_col_tx") - /* Per Object */ - .push_constant(Type::FLOAT, "gpThicknessScale") /* TODO(fclem): Replace with object info. */ - .push_constant(Type::FLOAT, "gpThicknessWorldScale") /* TODO(fclem): Same as above. */ - .define("gpThicknessIsScreenSpace", "(gpThicknessWorldScale < 0.0)") - /* Per Layer */ - .push_constant(Type::FLOAT, "gpThicknessOffset") - .additional_info("draw_resource_id_varying") - .additional_info("draw_view") - .additional_info("draw_object_infos_new"); +TYPEDEF_SOURCE("gpencil_shader_shared.h") +DEFINE("DRW_GPENCIL_INFO") +SAMPLER(0, FLOAT_BUFFER, gp_pos_tx) +SAMPLER(1, FLOAT_BUFFER, gp_col_tx) +/* Per Object */ +PUSH_CONSTANT(FLOAT, gpThicknessScale) /* TODO(fclem): Replace with object info. */ +PUSH_CONSTANT(FLOAT, gpThicknessWorldScale) /* TODO(fclem): Same as above. */ +DEFINE_VALUE("gpThicknessIsScreenSpace", "(gpThicknessWorldScale < 0.0)") +/* Per Layer */ +PUSH_CONSTANT(FLOAT, gpThicknessOffset) +ADDITIONAL_INFO(draw_resource_id_varying) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_object_infos_new) +GPU_SHADER_CREATE_END() /** \} */ @@ -199,52 +219,56 @@ GPU_SHADER_CREATE_INFO(draw_gpencil_new) * \{ */ GPU_SHADER_CREATE_INFO(draw_resource_finalize) - .do_static_compilation(true) - .typedef_source("draw_shader_shared.hh") - .define("DRAW_FINALIZE_SHADER") - .local_group_size(DRW_FINALIZE_GROUP_SIZE) - .storage_buf(0, Qualifier::READ, "ObjectMatrices", "matrix_buf[]") - .storage_buf(1, Qualifier::READ_WRITE, "ObjectBounds", "bounds_buf[]") - .storage_buf(2, Qualifier::READ_WRITE, "ObjectInfos", "infos_buf[]") - .push_constant(Type::INT, "resource_len") - .compute_source("draw_resource_finalize_comp.glsl"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("draw_shader_shared.hh") +DEFINE("DRAW_FINALIZE_SHADER") +LOCAL_GROUP_SIZE(DRW_FINALIZE_GROUP_SIZE) +STORAGE_BUF(0, READ, ObjectMatrices, matrix_buf[]) +STORAGE_BUF(1, READ_WRITE, ObjectBounds, bounds_buf[]) +STORAGE_BUF(2, READ_WRITE, ObjectInfos, infos_buf[]) +PUSH_CONSTANT(INT, resource_len) +COMPUTE_SOURCE("draw_resource_finalize_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_view_finalize) - .do_static_compilation(true) - .local_group_size(DRW_VIEW_MAX) - .define("DRW_VIEW_LEN", STRINGIFY(DRW_VIEW_MAX)) - .storage_buf(0, Qualifier::READ_WRITE, "ViewCullingData", "view_culling_buf[DRW_VIEW_LEN]") - .compute_source("draw_view_finalize_comp.glsl") - .additional_info("draw_view"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(DRW_VIEW_MAX) +DEFINE_VALUE("DRW_VIEW_LEN", STRINGIFY(DRW_VIEW_MAX)) +STORAGE_BUF(0, READ_WRITE, ViewCullingData, view_culling_buf[DRW_VIEW_LEN]) +COMPUTE_SOURCE("draw_view_finalize_comp.glsl") +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_visibility_compute) - .do_static_compilation(true) - .local_group_size(DRW_VISIBILITY_GROUP_SIZE) - .define("DRW_VIEW_LEN", STRINGIFY(DRW_VIEW_MAX)) - .storage_buf(0, Qualifier::READ, "ObjectBounds", "bounds_buf[]") - .storage_buf(1, Qualifier::READ_WRITE, "uint", "visibility_buf[]") - .push_constant(Type::INT, "resource_len") - .push_constant(Type::INT, "view_len") - .push_constant(Type::INT, "visibility_word_per_draw") - .compute_source("draw_visibility_comp.glsl") - .additional_info("draw_view") - .additional_info("draw_view_culling"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(DRW_VISIBILITY_GROUP_SIZE) +DEFINE_VALUE("DRW_VIEW_LEN", STRINGIFY(DRW_VIEW_MAX)) +STORAGE_BUF(0, READ, ObjectBounds, bounds_buf[]) +STORAGE_BUF(1, READ_WRITE, uint, visibility_buf[]) +PUSH_CONSTANT(INT, resource_len) +PUSH_CONSTANT(INT, view_len) +PUSH_CONSTANT(INT, visibility_word_per_draw) +COMPUTE_SOURCE("draw_visibility_comp.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_view_culling) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_command_generate) - .do_static_compilation(true) - .typedef_source("draw_shader_shared.hh") - .typedef_source("draw_command_shared.hh") - .local_group_size(DRW_COMMAND_GROUP_SIZE) - .storage_buf(0, Qualifier::READ_WRITE, "DrawGroup", "group_buf[]") - .storage_buf(1, Qualifier::READ, "uint", "visibility_buf[]") - .storage_buf(2, Qualifier::READ, "DrawPrototype", "prototype_buf[]") - .storage_buf(3, Qualifier::WRITE, "DrawCommand", "command_buf[]") - .storage_buf(DRW_RESOURCE_ID_SLOT, Qualifier::WRITE, "uint", "resource_id_buf[]") - .push_constant(Type::INT, "prototype_len") - .push_constant(Type::INT, "visibility_word_per_draw") - .push_constant(Type::INT, "view_shift") - .push_constant(Type::BOOL, "use_custom_ids") - .compute_source("draw_command_generate_comp.glsl"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("draw_shader_shared.hh") +TYPEDEF_SOURCE("draw_command_shared.hh") +LOCAL_GROUP_SIZE(DRW_COMMAND_GROUP_SIZE) +STORAGE_BUF(0, READ_WRITE, DrawGroup, group_buf[]) +STORAGE_BUF(1, READ, uint, visibility_buf[]) +STORAGE_BUF(2, READ, DrawPrototype, prototype_buf[]) +STORAGE_BUF(3, WRITE, DrawCommand, command_buf[]) +STORAGE_BUF(DRW_RESOURCE_ID_SLOT, WRITE, uint, resource_id_buf[]) +PUSH_CONSTANT(INT, prototype_len) +PUSH_CONSTANT(INT, visibility_word_per_draw) +PUSH_CONSTANT(INT, view_shift) +PUSH_CONSTANT(BOOL, use_custom_ids) +COMPUTE_SOURCE("draw_command_generate_comp.glsl") +GPU_SHADER_CREATE_END() /** \} */ @@ -254,35 +278,41 @@ GPU_SHADER_CREATE_INFO(draw_command_generate) * \{ */ GPU_SHADER_CREATE_INFO(draw_resource_id_new) - .define("UNIFORM_RESOURCE_ID_NEW") - /* TODO (Miguel Pozo): This is an int for compatibility. - * It should become uint once the "Next" ports are complete. */ - .storage_buf(DRW_RESOURCE_ID_SLOT, Qualifier::READ, "int", "resource_id_buf[]") - .define("drw_ResourceID", "resource_id_buf[gpu_BaseInstance + gl_InstanceID]"); +DEFINE("UNIFORM_RESOURCE_ID_NEW") +/* TODO (Miguel Pozo): This is an int for compatibility. + * It should become uint once the "Next" ports are complete. */ +STORAGE_BUF(DRW_RESOURCE_ID_SLOT, READ, int, resource_id_buf[]) +DEFINE_VALUE("drw_ResourceID", "resource_id_buf[gpu_BaseInstance + gl_InstanceID]") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_resource_with_custom_id_new) - .define("UNIFORM_RESOURCE_ID_NEW") - .define("WITH_CUSTOM_IDS") - .storage_buf(DRW_RESOURCE_ID_SLOT, Qualifier::READ, "int2", "resource_id_buf[]") - .define("drw_ResourceID", "resource_id_buf[gpu_BaseInstance + gl_InstanceID].x") - .define("drw_CustomID", "resource_id_buf[gpu_BaseInstance + gl_InstanceID].y"); +DEFINE("UNIFORM_RESOURCE_ID_NEW") +DEFINE("WITH_CUSTOM_IDS") +STORAGE_BUF(DRW_RESOURCE_ID_SLOT, READ, int2, resource_id_buf[]) +DEFINE_VALUE("drw_ResourceID", "resource_id_buf[gpu_BaseInstance + gl_InstanceID].x") +DEFINE_VALUE("drw_CustomID", "resource_id_buf[gpu_BaseInstance + gl_InstanceID].y") +GPU_SHADER_CREATE_END() /** * Workaround the lack of gl_BaseInstance by binding the resource_id_buf as vertex buf. */ GPU_SHADER_CREATE_INFO(draw_resource_id_fallback) - .define("UNIFORM_RESOURCE_ID_NEW") - .vertex_in(15, Type::INT, "drw_ResourceID"); +DEFINE("UNIFORM_RESOURCE_ID_NEW") +VERTEX_IN(15, INT, drw_ResourceID) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_resource_with_custom_id_fallback) - .define("UNIFORM_RESOURCE_ID_NEW") - .define("WITH_CUSTOM_IDS") - .vertex_in(15, Type::IVEC2, "vertex_in_drw_ResourceID") - .define("drw_ResourceID", "vertex_in_drw_ResourceID.x") - .define("drw_CustomID", "vertex_in_drw_ResourceID.y"); +DEFINE("UNIFORM_RESOURCE_ID_NEW") +DEFINE("WITH_CUSTOM_IDS") +VERTEX_IN(15, IVEC2, vertex_in_drw_ResourceID) +DEFINE_VALUE("drw_ResourceID", "vertex_in_drw_ResourceID.x") +DEFINE_VALUE("drw_CustomID", "vertex_in_drw_ResourceID.y") +GPU_SHADER_CREATE_END() /** TODO mask view id bits. */ -GPU_SHADER_CREATE_INFO(draw_resource_handle_new).define("resource_handle", "drw_ResourceID"); +GPU_SHADER_CREATE_INFO(draw_resource_handle_new) +DEFINE_VALUE("resource_handle", "drw_ResourceID") +GPU_SHADER_CREATE_END() /** \} */ @@ -291,21 +321,24 @@ GPU_SHADER_CREATE_INFO(draw_resource_handle_new).define("resource_handle", "drw_ * \{ */ GPU_SHADER_CREATE_INFO(draw_modelmat_new_common) - .typedef_source("draw_shader_shared.hh") - .storage_buf(DRW_OBJ_MAT_SLOT, Qualifier::READ, "ObjectMatrices", "drw_matrix_buf[]") - .define("DRAW_MODELMAT_CREATE_INFO") - .define("drw_ModelMatrixInverse", "drw_matrix_buf[resource_id].model_inverse") - .define("drw_ModelMatrix", "drw_matrix_buf[resource_id].model") - /* TODO For compatibility with old shaders. To be removed. */ - .define("ModelMatrixInverse", "drw_ModelMatrixInverse") - .define("ModelMatrix", "drw_ModelMatrix"); +TYPEDEF_SOURCE("draw_shader_shared.hh") +STORAGE_BUF(DRW_OBJ_MAT_SLOT, READ, ObjectMatrices, drw_matrix_buf[]) +DEFINE("DRAW_MODELMAT_CREATE_INFO") +DEFINE_VALUE("drw_ModelMatrixInverse", "drw_matrix_buf[resource_id].model_inverse") +DEFINE_VALUE("drw_ModelMatrix", "drw_matrix_buf[resource_id].model") +/* TODO For compatibility with old shaders. To be removed. */ +DEFINE_VALUE("ModelMatrixInverse", "drw_ModelMatrixInverse") +DEFINE_VALUE("ModelMatrix", "drw_ModelMatrix") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_modelmat_new) - .additional_info("draw_modelmat_new_common") - .additional_info("draw_resource_id_new"); +ADDITIONAL_INFO(draw_modelmat_new_common) +ADDITIONAL_INFO(draw_resource_id_new) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_modelmat_new_with_custom_id) - .additional_info("draw_modelmat_new_common") - .additional_info("draw_resource_with_custom_id_new"); +ADDITIONAL_INFO(draw_modelmat_new_common) +ADDITIONAL_INFO(draw_resource_with_custom_id_new) +GPU_SHADER_CREATE_END() /** \} */ -- 2.30.2 From 2663bdddb3702b115a83d1e943cc8373177a2eb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 12:00:25 +0200 Subject: [PATCH 60/90] Fix macros --- source/blender/gpu/intern/gpu_shader_create_info.hh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/blender/gpu/intern/gpu_shader_create_info.hh b/source/blender/gpu/intern/gpu_shader_create_info.hh index 9c45403b24d..acdeca0619a 100644 --- a/source/blender/gpu/intern/gpu_shader_create_info.hh +++ b/source/blender/gpu/intern/gpu_shader_create_info.hh @@ -39,7 +39,6 @@ namespace blender::gpu::shader { #if defined(GLSL_CPP_STUBS) -# error # define GPU_SHADER_NAMED_INTERFACE_INFO(_interface, _inst_name) \ namespace _interface { \ struct { @@ -48,7 +47,7 @@ namespace blender::gpu::shader { _inst_name; \ } -# define GPU_SHADER_INTERFACE_INFO(_interface, _inst_name) namespace _interface { +# define GPU_SHADER_INTERFACE_INFO(_interface) namespace _interface { # define GPU_SHADER_INTERFACE_END() } # define GPU_SHADER_CREATE_INFO(_info) \ -- 2.30.2 From 27fd5cfcf6b040f7467b2863cb10e86623dd3e7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 12:00:44 +0200 Subject: [PATCH 61/90] Fix stubs --- source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index 4d65934b800..e19285e2618 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -387,6 +387,8 @@ using mat2 = float2x2; using mat3 = float3x3; using mat4 = float4x4; +using MAT4 = float4x4; + /** \} */ /* -------------------------------------------------------------------- */ -- 2.30.2 From 34fc5cedf63f528642c3bcd9ae1fef444a829517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 12:01:08 +0200 Subject: [PATCH 62/90] Revert "Remaining macros renaming" This reverts commit bf0cf3f64f46de3d2e7eeeafdc1db93f0ae4c2ab. --- .../draw/intern/shaders/draw_debug_info.hh | 59 ++- .../intern/shaders/draw_fullscreen_info.hh | 9 +- .../intern/shaders/draw_hair_refine_info.hh | 37 +- .../intern/shaders/draw_object_infos_info.hh | 67 ++-- .../draw/intern/shaders/draw_view_info.hh | 377 ++++++++---------- 5 files changed, 252 insertions(+), 297 deletions(-) diff --git a/source/blender/draw/intern/shaders/draw_debug_info.hh b/source/blender/draw/intern/shaders/draw_debug_info.hh index 3d5803651d0..0121365d957 100644 --- a/source/blender/draw/intern/shaders/draw_debug_info.hh +++ b/source/blender/draw/intern/shaders/draw_debug_info.hh @@ -12,25 +12,21 @@ * \{ */ GPU_SHADER_CREATE_INFO(draw_debug_print) -DEFINE("DRW_DEBUG_PRINT") -TYPEDEF_SOURCE("draw_shader_shared.hh") -STORAGE_BUF(DRW_DEBUG_PRINT_SLOT, READ_WRITE, uint, drw_debug_print_buf[]) -GPU_SHADER_CREATE_END() + .define("DRW_DEBUG_PRINT") + .typedef_source("draw_shader_shared.hh") + .storage_buf(DRW_DEBUG_PRINT_SLOT, Qualifier::READ_WRITE, "uint", "drw_debug_print_buf[]"); -GPU_SHADER_INTERFACE_INFO(draw_debug_print_display_iface) -FLAT(UINT, char_index) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_INTERFACE_INFO(draw_debug_print_display_iface).flat(Type::UINT, "char_index"); GPU_SHADER_CREATE_INFO(draw_debug_print_display) -DO_STATIC_COMPILATION() -TYPEDEF_SOURCE("draw_shader_shared.hh") -STORAGE_BUF(DRW_DEBUG_PRINT_SLOT, READ, uint, drw_debug_print_buf[]) -VERTEX_OUT(draw_debug_print_display_iface) -FRAGMENT_OUT(0, VEC4, out_color) -PUSH_CONSTANT(VEC2, viewport_size) -VERTEX_SOURCE("draw_debug_print_display_vert.glsl") -FRAGMENT_SOURCE("draw_debug_print_display_frag.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .typedef_source("draw_shader_shared.hh") + .storage_buf(DRW_DEBUG_PRINT_SLOT, Qualifier::READ, "uint", "drw_debug_print_buf[]") + .vertex_out(draw_debug_print_display_iface) + .fragment_out(0, Type::VEC4, "out_color") + .push_constant(Type::VEC2, "viewport_size") + .vertex_source("draw_debug_print_display_vert.glsl") + .fragment_source("draw_debug_print_display_frag.glsl"); /** \} */ @@ -41,24 +37,23 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(draw_debug_draw) -DEFINE("DRW_DEBUG_DRAW") -TYPEDEF_SOURCE("draw_shader_shared.hh") -STORAGE_BUF(DRW_DEBUG_DRAW_SLOT, READ_WRITE, DRWDebugVert, drw_debug_verts_buf[]) -GPU_SHADER_CREATE_END() + .define("DRW_DEBUG_DRAW") + .typedef_source("draw_shader_shared.hh") + .storage_buf(DRW_DEBUG_DRAW_SLOT, + Qualifier::READ_WRITE, + "DRWDebugVert", + "drw_debug_verts_buf[]"); -GPU_SHADER_NAMED_INTERFACE_INFO(draw_debug_draw_display_iface, interp) -FLAT(VEC4, color) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_NAMED_INTERFACE_INFO(draw_debug_draw_display_iface, interp).flat(Type::VEC4, "color"); GPU_SHADER_CREATE_INFO(draw_debug_draw_display) -DO_STATIC_COMPILATION() -TYPEDEF_SOURCE("draw_shader_shared.hh") -STORAGE_BUF(DRW_DEBUG_DRAW_SLOT, READ, DRWDebugVert, drw_debug_verts_buf[]) -VERTEX_OUT(draw_debug_draw_display_iface) -FRAGMENT_OUT(0, VEC4, out_color) -PUSH_CONSTANT(MAT4, persmat) -VERTEX_SOURCE("draw_debug_draw_display_vert.glsl") -FRAGMENT_SOURCE("draw_debug_draw_display_frag.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .typedef_source("draw_shader_shared.hh") + .storage_buf(DRW_DEBUG_DRAW_SLOT, Qualifier::READ, "DRWDebugVert", "drw_debug_verts_buf[]") + .vertex_out(draw_debug_draw_display_iface) + .fragment_out(0, Type::VEC4, "out_color") + .push_constant(Type::MAT4, "persmat") + .vertex_source("draw_debug_draw_display_vert.glsl") + .fragment_source("draw_debug_draw_display_frag.glsl"); /** \} */ diff --git a/source/blender/draw/intern/shaders/draw_fullscreen_info.hh b/source/blender/draw/intern/shaders/draw_fullscreen_info.hh index e117f80c2b5..09d92f5194d 100644 --- a/source/blender/draw/intern/shaders/draw_fullscreen_info.hh +++ b/source/blender/draw/intern/shaders/draw_fullscreen_info.hh @@ -4,11 +4,8 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(fullscreen_iface) -SMOOTH(VEC4, uvcoordsvar) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_INTERFACE_INFO(fullscreen_iface).smooth(Type::VEC4, "uvcoordsvar"); GPU_SHADER_CREATE_INFO(draw_fullscreen) -VERTEX_OUT(fullscreen_iface) -VERTEX_SOURCE("common_fullscreen_vert.glsl") -GPU_SHADER_CREATE_END() + .vertex_out(fullscreen_iface) + .vertex_source("common_fullscreen_vert.glsl"); diff --git a/source/blender/draw/intern/shaders/draw_hair_refine_info.hh b/source/blender/draw/intern/shaders/draw_hair_refine_info.hh index d6b7afd1fd2..81d0b6ab1ae 100644 --- a/source/blender/draw/intern/shaders/draw_hair_refine_info.hh +++ b/source/blender/draw/intern/shaders/draw_hair_refine_info.hh @@ -9,22 +9,21 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(draw_hair_refine_compute) -LOCAL_GROUP_SIZE(1, 1) -STORAGE_BUF(0, WRITE, vec4, posTime[]) -SAMPLER(0, FLOAT_BUFFER, hairPointBuffer) -SAMPLER(1, UINT_BUFFER, hairStrandBuffer) -SAMPLER(2, UINT_BUFFER, hairStrandSegBuffer) -PUSH_CONSTANT(MAT4, hairDupliMatrix) -PUSH_CONSTANT(BOOL, hairCloseTip) -PUSH_CONSTANT(FLOAT, hairRadShape) -PUSH_CONSTANT(FLOAT, hairRadTip) -PUSH_CONSTANT(FLOAT, hairRadRoot) -PUSH_CONSTANT(INT, hairThicknessRes) -PUSH_CONSTANT(INT, hairStrandsRes) -PUSH_CONSTANT(INT, hairStrandOffset) -COMPUTE_SOURCE("common_hair_refine_comp.glsl") -DEFINE("HAIR_PHASE_SUBDIV") -DEFINE("HAIR_SHADER") -DEFINE("DRW_HAIR_INFO") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(1, 1) + .storage_buf(0, Qualifier::WRITE, "vec4", "posTime[]") + .sampler(0, ImageType::FLOAT_BUFFER, "hairPointBuffer") + .sampler(1, ImageType::UINT_BUFFER, "hairStrandBuffer") + .sampler(2, ImageType::UINT_BUFFER, "hairStrandSegBuffer") + .push_constant(Type::MAT4, "hairDupliMatrix") + .push_constant(Type::BOOL, "hairCloseTip") + .push_constant(Type::FLOAT, "hairRadShape") + .push_constant(Type::FLOAT, "hairRadTip") + .push_constant(Type::FLOAT, "hairRadRoot") + .push_constant(Type::INT, "hairThicknessRes") + .push_constant(Type::INT, "hairStrandsRes") + .push_constant(Type::INT, "hairStrandOffset") + .compute_source("common_hair_refine_comp.glsl") + .define("HAIR_PHASE_SUBDIV") + .define("HAIR_SHADER") + .define("DRW_HAIR_INFO") + .do_static_compilation(true); diff --git a/source/blender/draw/intern/shaders/draw_object_infos_info.hh b/source/blender/draw/intern/shaders/draw_object_infos_info.hh index 38d0dc9cde0..91497b459b3 100644 --- a/source/blender/draw/intern/shaders/draw_object_infos_info.hh +++ b/source/blender/draw/intern/shaders/draw_object_infos_info.hh @@ -6,49 +6,46 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(draw_object_infos) -TYPEDEF_SOURCE("draw_shader_shared.hh") -DEFINE("OBINFO_LIB") -DEFINE_VALUE("OrcoTexCoFactors", "(drw_infos[resource_id].orco_mul_bias)") -DEFINE_VALUE("ObjectInfo", "(drw_infos[resource_id].infos)") -DEFINE_VALUE("ObjectColor", "(drw_infos[resource_id].ob_color)") -UNIFORM_BUF_FREQ(DRW_OBJ_INFOS_UBO_SLOT, ObjectInfos, drw_infos[DRW_RESOURCE_CHUNK_LEN], BATCH) -GPU_SHADER_CREATE_END() + .typedef_source("draw_shader_shared.hh") + .define("OBINFO_LIB") + .define("OrcoTexCoFactors", "(drw_infos[resource_id].orco_mul_bias)") + .define("ObjectInfo", "(drw_infos[resource_id].infos)") + .define("ObjectColor", "(drw_infos[resource_id].ob_color)") + .uniform_buf(DRW_OBJ_INFOS_UBO_SLOT, + "ObjectInfos", + "drw_infos[DRW_RESOURCE_CHUNK_LEN]", + Frequency::BATCH); GPU_SHADER_CREATE_INFO(draw_volume_infos) -TYPEDEF_SOURCE("draw_shader_shared.hh") -DEFINE("VOLUME_INFO_LIB") -UNIFORM_BUF_FREQ(DRW_OBJ_DATA_INFO_UBO_SLOT, VolumeInfos, drw_volume, BATCH) -GPU_SHADER_CREATE_END() + .typedef_source("draw_shader_shared.hh") + .define("VOLUME_INFO_LIB") + .uniform_buf(DRW_OBJ_DATA_INFO_UBO_SLOT, "VolumeInfos", "drw_volume", Frequency::BATCH); GPU_SHADER_CREATE_INFO(draw_curves_infos) -TYPEDEF_SOURCE("draw_shader_shared.hh") -UNIFORM_BUF_FREQ(DRW_OBJ_DATA_INFO_UBO_SLOT, CurvesInfos, drw_curves, BATCH) -GPU_SHADER_CREATE_END() + .typedef_source("draw_shader_shared.hh") + .uniform_buf(DRW_OBJ_DATA_INFO_UBO_SLOT, "CurvesInfos", "drw_curves", Frequency::BATCH); GPU_SHADER_CREATE_INFO(draw_layer_attributes) -TYPEDEF_SOURCE("draw_shader_shared.hh") -DEFINE("VLATTR_LIB") -UNIFORM_BUF_FREQ(DRW_LAYER_ATTR_UBO_SLOT, - LayerAttribute, - drw_layer_attrs[DRW_RESOURCE_CHUNK_LEN], - BATCH) -GPU_SHADER_CREATE_END() + .typedef_source("draw_shader_shared.hh") + .define("VLATTR_LIB") + .uniform_buf(DRW_LAYER_ATTR_UBO_SLOT, + "LayerAttribute", + "drw_layer_attrs[DRW_RESOURCE_CHUNK_LEN]", + Frequency::BATCH); GPU_SHADER_CREATE_INFO(draw_object_infos_new) -TYPEDEF_SOURCE("draw_shader_shared.hh") -DEFINE("OBINFO_LIB") -DEFINE("OBINFO_NEW") -DEFINE_VALUE("OrcoTexCoFactors", "(drw_infos[resource_id].orco_mul_bias)") -DEFINE_VALUE("ObjectInfo", "(drw_infos[resource_id].infos)") -DEFINE_VALUE("ObjectColor", "(drw_infos[resource_id].ob_color)") -STORAGE_BUF(DRW_OBJ_INFOS_SLOT, READ, ObjectInfos, drw_infos[]) -GPU_SHADER_CREATE_END() + .typedef_source("draw_shader_shared.hh") + .define("OBINFO_LIB") + .define("OBINFO_NEW") + .define("OrcoTexCoFactors", "(drw_infos[resource_id].orco_mul_bias)") + .define("ObjectInfo", "(drw_infos[resource_id].infos)") + .define("ObjectColor", "(drw_infos[resource_id].ob_color)") + .storage_buf(DRW_OBJ_INFOS_SLOT, Qualifier::READ, "ObjectInfos", "drw_infos[]"); /** \note Requires draw_object_infos_new. */ GPU_SHADER_CREATE_INFO(draw_object_attribute_new) -DEFINE("OBATTR_LIB") -DEFINE_VALUE("ObjectAttributeStart", "(drw_infos[resource_id].orco_mul_bias[0].w)") -DEFINE_VALUE("ObjectAttributeLen", "(drw_infos[resource_id].orco_mul_bias[1].w)") -STORAGE_BUF(DRW_OBJ_ATTR_SLOT, READ, ObjectAttribute, drw_attrs[]) -ADDITIONAL_INFO(draw_object_infos_new) -GPU_SHADER_CREATE_END() + .define("OBATTR_LIB") + .define("ObjectAttributeStart", "(drw_infos[resource_id].orco_mul_bias[0].w)") + .define("ObjectAttributeLen", "(drw_infos[resource_id].orco_mul_bias[1].w)") + .storage_buf(DRW_OBJ_ATTR_SLOT, Qualifier::READ, "ObjectAttribute", "drw_attrs[]") + .additional_info("draw_object_infos_new"); diff --git a/source/blender/draw/intern/shaders/draw_view_info.hh b/source/blender/draw/intern/shaders/draw_view_info.hh index f8e13104798..79067cfcd69 100644 --- a/source/blender/draw/intern/shaders/draw_view_info.hh +++ b/source/blender/draw/intern/shaders/draw_view_info.hh @@ -14,37 +14,31 @@ * \{ */ /* Standard way. Use gpu_InstanceIndex to index the object data. */ -GPU_SHADER_CREATE_INFO(draw_resource_id) -DEFINE("DYNAMIC_RESOURCE_ID") -GPU_SHADER_CREATE_END() +GPU_SHADER_CREATE_INFO(draw_resource_id).define("DYNAMIC_RESOURCE_ID"); /** * Used if the resource index needs to be passed to the fragment shader. * IMPORTANT: Vertex and Geometry shaders need to use PASS_RESOURCE_ID in main(). */ GPU_SHADER_NAMED_INTERFACE_INFO(draw_resource_id_iface, drw_ResourceID_iface) -FLAT(INT, resource_index) -GPU_SHADER_INTERFACE_END() + .flat(Type::INT, "resource_index"); GPU_SHADER_CREATE_INFO(draw_resource_id_varying) -VERTEX_OUT(draw_resource_id_iface) -GEOMETRY_OUT(draw_resource_id_iface) -GPU_SHADER_CREATE_END() /* Used if needed. */ + .vertex_out(draw_resource_id_iface) + .geometry_out(draw_resource_id_iface); /* Used if needed. */ /* Variation used when drawing multiple instances for one object. */ GPU_SHADER_CREATE_INFO(draw_resource_id_uniform) -DEFINE("UNIFORM_RESOURCE_ID") -PUSH_CONSTANT(INT, drw_ResourceID) -GPU_SHADER_CREATE_END() + .define("UNIFORM_RESOURCE_ID") + .push_constant(Type::INT, "drw_ResourceID"); /** * Declare a resource handle that identify a unique object. * Requires draw_resource_id[_uniform]. */ GPU_SHADER_CREATE_INFO(draw_resource_handle) -DEFINE_VALUE("resource_handle", "(drw_resourceChunk * DRW_RESOURCE_CHUNK_LEN + resource_id)") -PUSH_CONSTANT(INT, drw_resourceChunk) -GPU_SHADER_CREATE_END() + .define("resource_handle", "(drw_resourceChunk * DRW_RESOURCE_CHUNK_LEN + resource_id)") + .push_constant(Type::INT, "drw_resourceChunk"); /** \} */ @@ -53,38 +47,36 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(draw_view) -UNIFORM_BUF_FREQ(DRW_VIEW_UBO_SLOT, ViewMatrices, drw_view_[DRW_VIEW_LEN], PASS) -DEFINE("DRAW_VIEW_CREATE_INFO") -DEFINE_VALUE("drw_view", "drw_view_[drw_view_id]") -TYPEDEF_SOURCE("draw_shader_shared.hh") -GPU_SHADER_CREATE_END() + .uniform_buf(DRW_VIEW_UBO_SLOT, "ViewMatrices", "drw_view_[DRW_VIEW_LEN]", Frequency::PASS) + .define("DRAW_VIEW_CREATE_INFO") + .define("drw_view", "drw_view_[drw_view_id]") + .typedef_source("draw_shader_shared.hh"); GPU_SHADER_CREATE_INFO(draw_view_culling) -UNIFORM_BUF(DRW_VIEW_CULLING_UBO_SLOT, ViewCullingData, drw_view_culling_[DRW_VIEW_LEN]) -DEFINE("DRW_VIEW_CULLING_INFO") -DEFINE_VALUE("drw_view_culling", "drw_view_culling_[drw_view_id]") -TYPEDEF_SOURCE("draw_shader_shared.hh") -GPU_SHADER_CREATE_END() + .uniform_buf(DRW_VIEW_CULLING_UBO_SLOT, "ViewCullingData", "drw_view_culling_[DRW_VIEW_LEN]") + .define("DRW_VIEW_CULLING_INFO") + .define("drw_view_culling", "drw_view_culling_[drw_view_id]") + .typedef_source("draw_shader_shared.hh"); GPU_SHADER_CREATE_INFO(draw_modelmat) -UNIFORM_BUF_FREQ(DRW_OBJ_MAT_UBO_SLOT, ObjectMatrices, drw_matrices[DRW_RESOURCE_CHUNK_LEN], BATCH) -DEFINE_VALUE("ModelMatrix", "(drw_matrices[resource_id].model)") -DEFINE_VALUE("ModelMatrixInverse", "(drw_matrices[resource_id].model_inverse)") -ADDITIONAL_INFO(draw_view) -GPU_SHADER_CREATE_END() + .uniform_buf(DRW_OBJ_MAT_UBO_SLOT, + "ObjectMatrices", + "drw_matrices[DRW_RESOURCE_CHUNK_LEN]", + Frequency::BATCH) + .define("ModelMatrix", "(drw_matrices[resource_id].model)") + .define("ModelMatrixInverse", "(drw_matrices[resource_id].model_inverse)") + .additional_info("draw_view"); GPU_SHADER_CREATE_INFO(draw_modelmat_legacy) -DEFINE("DRW_LEGACY_MODEL_MATRIX") -PUSH_CONSTANT(MAT4, ModelMatrix) -PUSH_CONSTANT(MAT4, ModelMatrixInverse) -ADDITIONAL_INFO(draw_view) -GPU_SHADER_CREATE_END() + .define("DRW_LEGACY_MODEL_MATRIX") + .push_constant(Type::MAT4, "ModelMatrix") + .push_constant(Type::MAT4, "ModelMatrixInverse") + .additional_info("draw_view"); GPU_SHADER_CREATE_INFO(draw_modelmat_instanced_attr) -PUSH_CONSTANT(MAT4, ModelMatrix) -PUSH_CONSTANT(MAT4, ModelMatrixInverse) -ADDITIONAL_INFO(draw_view) -GPU_SHADER_CREATE_END() + .push_constant(Type::MAT4, "ModelMatrix") + .push_constant(Type::MAT4, "ModelMatrixInverse") + .additional_info("draw_view"); /** \} */ @@ -93,10 +85,9 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(drw_clipped) -/* TODO(fclem): Move to engine side. */ -UNIFORM_BUF_FREQ(DRW_CLIPPING_UBO_SLOT, vec4, drw_clipping_[6], PASS) -DEFINE("USE_WORLD_CLIP_PLANES") -GPU_SHADER_CREATE_END() + /* TODO(fclem): Move to engine side. */ + .uniform_buf(DRW_CLIPPING_UBO_SLOT, "vec4", "drw_clipping_[6]", Frequency::PASS) + .define("USE_WORLD_CLIP_PLANES"); /** \} */ @@ -105,9 +96,8 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(draw_globals) -TYPEDEF_SOURCE("draw_common_shader_shared.hh") -UNIFORM_BUF_FREQ(7, GlobalsUboStorage, globalsBlock, PASS) -GPU_SHADER_CREATE_END() + .typedef_source("draw_common_shader_shared.hh") + .uniform_buf(7, "GlobalsUboStorage", "globalsBlock", Frequency::PASS); /** \} */ @@ -116,101 +106,91 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(draw_mesh) -ADDITIONAL_INFO(draw_modelmat) -ADDITIONAL_INFO(draw_resource_id) -GPU_SHADER_CREATE_END() + .additional_info("draw_modelmat") + .additional_info("draw_resource_id"); GPU_SHADER_CREATE_INFO(draw_mesh_new) -ADDITIONAL_INFO(draw_modelmat_new) -ADDITIONAL_INFO(draw_resource_id) -GPU_SHADER_CREATE_END() + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_id"); GPU_SHADER_CREATE_INFO(draw_hair) -DEFINE("HAIR_SHADER") -DEFINE("DRW_HAIR_INFO") -SAMPLER(15, FLOAT_BUFFER, hairPointBuffer) -/* TODO(@fclem): Pack these into one UBO. */ -PUSH_CONSTANT(INT, hairStrandsRes) -PUSH_CONSTANT(INT, hairThicknessRes) -PUSH_CONSTANT(FLOAT, hairRadRoot) -PUSH_CONSTANT(FLOAT, hairRadTip) -PUSH_CONSTANT(FLOAT, hairRadShape) -PUSH_CONSTANT(BOOL, hairCloseTip) -PUSH_CONSTANT(INT, hairStrandOffset) -PUSH_CONSTANT(MAT4, hairDupliMatrix) -ADDITIONAL_INFO(draw_modelmat) -ADDITIONAL_INFO(draw_resource_id) -GPU_SHADER_CREATE_END() + .define("HAIR_SHADER") + .define("DRW_HAIR_INFO") + .sampler(15, ImageType::FLOAT_BUFFER, "hairPointBuffer") + /* TODO(@fclem): Pack these into one UBO. */ + .push_constant(Type::INT, "hairStrandsRes") + .push_constant(Type::INT, "hairThicknessRes") + .push_constant(Type::FLOAT, "hairRadRoot") + .push_constant(Type::FLOAT, "hairRadTip") + .push_constant(Type::FLOAT, "hairRadShape") + .push_constant(Type::BOOL, "hairCloseTip") + .push_constant(Type::INT, "hairStrandOffset") + .push_constant(Type::MAT4, "hairDupliMatrix") + .additional_info("draw_modelmat") + .additional_info("draw_resource_id"); GPU_SHADER_CREATE_INFO(draw_hair_new) -DEFINE("HAIR_SHADER") -DEFINE("DRW_HAIR_INFO") -SAMPLER(0, FLOAT_BUFFER, hairPointBuffer) -/* TODO(@fclem): Pack these into one UBO. */ -PUSH_CONSTANT(INT, hairStrandsRes) -PUSH_CONSTANT(INT, hairThicknessRes) -PUSH_CONSTANT(FLOAT, hairRadRoot) -PUSH_CONSTANT(FLOAT, hairRadTip) -PUSH_CONSTANT(FLOAT, hairRadShape) -PUSH_CONSTANT(BOOL, hairCloseTip) -PUSH_CONSTANT(INT, hairStrandOffset) -PUSH_CONSTANT(MAT4, hairDupliMatrix) -GPU_SHADER_CREATE_END() + .define("HAIR_SHADER") + .define("DRW_HAIR_INFO") + .sampler(0, ImageType::FLOAT_BUFFER, "hairPointBuffer") + /* TODO(@fclem): Pack these into one UBO. */ + .push_constant(Type::INT, "hairStrandsRes") + .push_constant(Type::INT, "hairThicknessRes") + .push_constant(Type::FLOAT, "hairRadRoot") + .push_constant(Type::FLOAT, "hairRadTip") + .push_constant(Type::FLOAT, "hairRadShape") + .push_constant(Type::BOOL, "hairCloseTip") + .push_constant(Type::INT, "hairStrandOffset") + .push_constant(Type::MAT4, "hairDupliMatrix"); GPU_SHADER_CREATE_INFO(draw_pointcloud) -SAMPLER_FREQ(0, FLOAT_BUFFER, ptcloud_pos_rad_tx, BATCH) -DEFINE("POINTCLOUD_SHADER") -DEFINE("DRW_POINTCLOUD_INFO") -ADDITIONAL_INFO(draw_modelmat_instanced_attr) -ADDITIONAL_INFO(draw_resource_id_uniform) -GPU_SHADER_CREATE_END() + .sampler(0, ImageType::FLOAT_BUFFER, "ptcloud_pos_rad_tx", Frequency::BATCH) + .define("POINTCLOUD_SHADER") + .define("DRW_POINTCLOUD_INFO") + .additional_info("draw_modelmat_instanced_attr") + .additional_info("draw_resource_id_uniform"); GPU_SHADER_CREATE_INFO(draw_pointcloud_new) -SAMPLER_FREQ(0, FLOAT_BUFFER, ptcloud_pos_rad_tx, BATCH) -DEFINE("POINTCLOUD_SHADER") -DEFINE("DRW_POINTCLOUD_INFO") -GPU_SHADER_CREATE_END() + .sampler(0, ImageType::FLOAT_BUFFER, "ptcloud_pos_rad_tx", Frequency::BATCH) + .define("POINTCLOUD_SHADER") + .define("DRW_POINTCLOUD_INFO"); GPU_SHADER_CREATE_INFO(draw_volume) -ADDITIONAL_INFO(draw_modelmat) -ADDITIONAL_INFO(draw_resource_id_uniform) -GPU_SHADER_CREATE_END() + .additional_info("draw_modelmat") + .additional_info("draw_resource_id_uniform"); GPU_SHADER_CREATE_INFO(draw_volume_new) -ADDITIONAL_INFO(draw_modelmat_new) -ADDITIONAL_INFO(draw_resource_handle_new) -GPU_SHADER_CREATE_END() + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new"); GPU_SHADER_CREATE_INFO(draw_gpencil) -TYPEDEF_SOURCE("gpencil_shader_shared.h") -DEFINE("DRW_GPENCIL_INFO") -SAMPLER(0, FLOAT_BUFFER, gp_pos_tx) -SAMPLER(1, FLOAT_BUFFER, gp_col_tx) -/* Per Object */ -PUSH_CONSTANT(FLOAT, gpThicknessScale) /* TODO(fclem): Replace with object info. */ -PUSH_CONSTANT(FLOAT, gpThicknessWorldScale) /* TODO(fclem): Same as above. */ -DEFINE_VALUE("gpThicknessIsScreenSpace", "(gpThicknessWorldScale < 0.0)") -/* Per Layer */ -PUSH_CONSTANT(FLOAT, gpThicknessOffset) -ADDITIONAL_INFO(draw_modelmat) -ADDITIONAL_INFO(draw_object_infos) -GPU_SHADER_CREATE_END() + .typedef_source("gpencil_shader_shared.h") + .define("DRW_GPENCIL_INFO") + .sampler(0, ImageType::FLOAT_BUFFER, "gp_pos_tx") + .sampler(1, ImageType::FLOAT_BUFFER, "gp_col_tx") + /* Per Object */ + .push_constant(Type::FLOAT, "gpThicknessScale") /* TODO(fclem): Replace with object info. */ + .push_constant(Type::FLOAT, "gpThicknessWorldScale") /* TODO(fclem): Same as above. */ + .define("gpThicknessIsScreenSpace", "(gpThicknessWorldScale < 0.0)") + /* Per Layer */ + .push_constant(Type::FLOAT, "gpThicknessOffset") + .additional_info("draw_modelmat") + .additional_info("draw_object_infos"); GPU_SHADER_CREATE_INFO(draw_gpencil_new) -TYPEDEF_SOURCE("gpencil_shader_shared.h") -DEFINE("DRW_GPENCIL_INFO") -SAMPLER(0, FLOAT_BUFFER, gp_pos_tx) -SAMPLER(1, FLOAT_BUFFER, gp_col_tx) -/* Per Object */ -PUSH_CONSTANT(FLOAT, gpThicknessScale) /* TODO(fclem): Replace with object info. */ -PUSH_CONSTANT(FLOAT, gpThicknessWorldScale) /* TODO(fclem): Same as above. */ -DEFINE_VALUE("gpThicknessIsScreenSpace", "(gpThicknessWorldScale < 0.0)") -/* Per Layer */ -PUSH_CONSTANT(FLOAT, gpThicknessOffset) -ADDITIONAL_INFO(draw_resource_id_varying) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_object_infos_new) -GPU_SHADER_CREATE_END() + .typedef_source("gpencil_shader_shared.h") + .define("DRW_GPENCIL_INFO") + .sampler(0, ImageType::FLOAT_BUFFER, "gp_pos_tx") + .sampler(1, ImageType::FLOAT_BUFFER, "gp_col_tx") + /* Per Object */ + .push_constant(Type::FLOAT, "gpThicknessScale") /* TODO(fclem): Replace with object info. */ + .push_constant(Type::FLOAT, "gpThicknessWorldScale") /* TODO(fclem): Same as above. */ + .define("gpThicknessIsScreenSpace", "(gpThicknessWorldScale < 0.0)") + /* Per Layer */ + .push_constant(Type::FLOAT, "gpThicknessOffset") + .additional_info("draw_resource_id_varying") + .additional_info("draw_view") + .additional_info("draw_object_infos_new"); /** \} */ @@ -219,56 +199,52 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(draw_resource_finalize) -DO_STATIC_COMPILATION() -TYPEDEF_SOURCE("draw_shader_shared.hh") -DEFINE("DRAW_FINALIZE_SHADER") -LOCAL_GROUP_SIZE(DRW_FINALIZE_GROUP_SIZE) -STORAGE_BUF(0, READ, ObjectMatrices, matrix_buf[]) -STORAGE_BUF(1, READ_WRITE, ObjectBounds, bounds_buf[]) -STORAGE_BUF(2, READ_WRITE, ObjectInfos, infos_buf[]) -PUSH_CONSTANT(INT, resource_len) -COMPUTE_SOURCE("draw_resource_finalize_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .typedef_source("draw_shader_shared.hh") + .define("DRAW_FINALIZE_SHADER") + .local_group_size(DRW_FINALIZE_GROUP_SIZE) + .storage_buf(0, Qualifier::READ, "ObjectMatrices", "matrix_buf[]") + .storage_buf(1, Qualifier::READ_WRITE, "ObjectBounds", "bounds_buf[]") + .storage_buf(2, Qualifier::READ_WRITE, "ObjectInfos", "infos_buf[]") + .push_constant(Type::INT, "resource_len") + .compute_source("draw_resource_finalize_comp.glsl"); GPU_SHADER_CREATE_INFO(draw_view_finalize) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(DRW_VIEW_MAX) -DEFINE_VALUE("DRW_VIEW_LEN", STRINGIFY(DRW_VIEW_MAX)) -STORAGE_BUF(0, READ_WRITE, ViewCullingData, view_culling_buf[DRW_VIEW_LEN]) -COMPUTE_SOURCE("draw_view_finalize_comp.glsl") -ADDITIONAL_INFO(draw_view) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(DRW_VIEW_MAX) + .define("DRW_VIEW_LEN", STRINGIFY(DRW_VIEW_MAX)) + .storage_buf(0, Qualifier::READ_WRITE, "ViewCullingData", "view_culling_buf[DRW_VIEW_LEN]") + .compute_source("draw_view_finalize_comp.glsl") + .additional_info("draw_view"); GPU_SHADER_CREATE_INFO(draw_visibility_compute) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(DRW_VISIBILITY_GROUP_SIZE) -DEFINE_VALUE("DRW_VIEW_LEN", STRINGIFY(DRW_VIEW_MAX)) -STORAGE_BUF(0, READ, ObjectBounds, bounds_buf[]) -STORAGE_BUF(1, READ_WRITE, uint, visibility_buf[]) -PUSH_CONSTANT(INT, resource_len) -PUSH_CONSTANT(INT, view_len) -PUSH_CONSTANT(INT, visibility_word_per_draw) -COMPUTE_SOURCE("draw_visibility_comp.glsl") -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_view_culling) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(DRW_VISIBILITY_GROUP_SIZE) + .define("DRW_VIEW_LEN", STRINGIFY(DRW_VIEW_MAX)) + .storage_buf(0, Qualifier::READ, "ObjectBounds", "bounds_buf[]") + .storage_buf(1, Qualifier::READ_WRITE, "uint", "visibility_buf[]") + .push_constant(Type::INT, "resource_len") + .push_constant(Type::INT, "view_len") + .push_constant(Type::INT, "visibility_word_per_draw") + .compute_source("draw_visibility_comp.glsl") + .additional_info("draw_view") + .additional_info("draw_view_culling"); GPU_SHADER_CREATE_INFO(draw_command_generate) -DO_STATIC_COMPILATION() -TYPEDEF_SOURCE("draw_shader_shared.hh") -TYPEDEF_SOURCE("draw_command_shared.hh") -LOCAL_GROUP_SIZE(DRW_COMMAND_GROUP_SIZE) -STORAGE_BUF(0, READ_WRITE, DrawGroup, group_buf[]) -STORAGE_BUF(1, READ, uint, visibility_buf[]) -STORAGE_BUF(2, READ, DrawPrototype, prototype_buf[]) -STORAGE_BUF(3, WRITE, DrawCommand, command_buf[]) -STORAGE_BUF(DRW_RESOURCE_ID_SLOT, WRITE, uint, resource_id_buf[]) -PUSH_CONSTANT(INT, prototype_len) -PUSH_CONSTANT(INT, visibility_word_per_draw) -PUSH_CONSTANT(INT, view_shift) -PUSH_CONSTANT(BOOL, use_custom_ids) -COMPUTE_SOURCE("draw_command_generate_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .typedef_source("draw_shader_shared.hh") + .typedef_source("draw_command_shared.hh") + .local_group_size(DRW_COMMAND_GROUP_SIZE) + .storage_buf(0, Qualifier::READ_WRITE, "DrawGroup", "group_buf[]") + .storage_buf(1, Qualifier::READ, "uint", "visibility_buf[]") + .storage_buf(2, Qualifier::READ, "DrawPrototype", "prototype_buf[]") + .storage_buf(3, Qualifier::WRITE, "DrawCommand", "command_buf[]") + .storage_buf(DRW_RESOURCE_ID_SLOT, Qualifier::WRITE, "uint", "resource_id_buf[]") + .push_constant(Type::INT, "prototype_len") + .push_constant(Type::INT, "visibility_word_per_draw") + .push_constant(Type::INT, "view_shift") + .push_constant(Type::BOOL, "use_custom_ids") + .compute_source("draw_command_generate_comp.glsl"); /** \} */ @@ -278,41 +254,35 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(draw_resource_id_new) -DEFINE("UNIFORM_RESOURCE_ID_NEW") -/* TODO (Miguel Pozo): This is an int for compatibility. - * It should become uint once the "Next" ports are complete. */ -STORAGE_BUF(DRW_RESOURCE_ID_SLOT, READ, int, resource_id_buf[]) -DEFINE_VALUE("drw_ResourceID", "resource_id_buf[gpu_BaseInstance + gl_InstanceID]") -GPU_SHADER_CREATE_END() + .define("UNIFORM_RESOURCE_ID_NEW") + /* TODO (Miguel Pozo): This is an int for compatibility. + * It should become uint once the "Next" ports are complete. */ + .storage_buf(DRW_RESOURCE_ID_SLOT, Qualifier::READ, "int", "resource_id_buf[]") + .define("drw_ResourceID", "resource_id_buf[gpu_BaseInstance + gl_InstanceID]"); GPU_SHADER_CREATE_INFO(draw_resource_with_custom_id_new) -DEFINE("UNIFORM_RESOURCE_ID_NEW") -DEFINE("WITH_CUSTOM_IDS") -STORAGE_BUF(DRW_RESOURCE_ID_SLOT, READ, int2, resource_id_buf[]) -DEFINE_VALUE("drw_ResourceID", "resource_id_buf[gpu_BaseInstance + gl_InstanceID].x") -DEFINE_VALUE("drw_CustomID", "resource_id_buf[gpu_BaseInstance + gl_InstanceID].y") -GPU_SHADER_CREATE_END() + .define("UNIFORM_RESOURCE_ID_NEW") + .define("WITH_CUSTOM_IDS") + .storage_buf(DRW_RESOURCE_ID_SLOT, Qualifier::READ, "int2", "resource_id_buf[]") + .define("drw_ResourceID", "resource_id_buf[gpu_BaseInstance + gl_InstanceID].x") + .define("drw_CustomID", "resource_id_buf[gpu_BaseInstance + gl_InstanceID].y"); /** * Workaround the lack of gl_BaseInstance by binding the resource_id_buf as vertex buf. */ GPU_SHADER_CREATE_INFO(draw_resource_id_fallback) -DEFINE("UNIFORM_RESOURCE_ID_NEW") -VERTEX_IN(15, INT, drw_ResourceID) -GPU_SHADER_CREATE_END() + .define("UNIFORM_RESOURCE_ID_NEW") + .vertex_in(15, Type::INT, "drw_ResourceID"); GPU_SHADER_CREATE_INFO(draw_resource_with_custom_id_fallback) -DEFINE("UNIFORM_RESOURCE_ID_NEW") -DEFINE("WITH_CUSTOM_IDS") -VERTEX_IN(15, IVEC2, vertex_in_drw_ResourceID) -DEFINE_VALUE("drw_ResourceID", "vertex_in_drw_ResourceID.x") -DEFINE_VALUE("drw_CustomID", "vertex_in_drw_ResourceID.y") -GPU_SHADER_CREATE_END() + .define("UNIFORM_RESOURCE_ID_NEW") + .define("WITH_CUSTOM_IDS") + .vertex_in(15, Type::IVEC2, "vertex_in_drw_ResourceID") + .define("drw_ResourceID", "vertex_in_drw_ResourceID.x") + .define("drw_CustomID", "vertex_in_drw_ResourceID.y"); /** TODO mask view id bits. */ -GPU_SHADER_CREATE_INFO(draw_resource_handle_new) -DEFINE_VALUE("resource_handle", "drw_ResourceID") -GPU_SHADER_CREATE_END() +GPU_SHADER_CREATE_INFO(draw_resource_handle_new).define("resource_handle", "drw_ResourceID"); /** \} */ @@ -321,24 +291,21 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(draw_modelmat_new_common) -TYPEDEF_SOURCE("draw_shader_shared.hh") -STORAGE_BUF(DRW_OBJ_MAT_SLOT, READ, ObjectMatrices, drw_matrix_buf[]) -DEFINE("DRAW_MODELMAT_CREATE_INFO") -DEFINE_VALUE("drw_ModelMatrixInverse", "drw_matrix_buf[resource_id].model_inverse") -DEFINE_VALUE("drw_ModelMatrix", "drw_matrix_buf[resource_id].model") -/* TODO For compatibility with old shaders. To be removed. */ -DEFINE_VALUE("ModelMatrixInverse", "drw_ModelMatrixInverse") -DEFINE_VALUE("ModelMatrix", "drw_ModelMatrix") -GPU_SHADER_CREATE_END() + .typedef_source("draw_shader_shared.hh") + .storage_buf(DRW_OBJ_MAT_SLOT, Qualifier::READ, "ObjectMatrices", "drw_matrix_buf[]") + .define("DRAW_MODELMAT_CREATE_INFO") + .define("drw_ModelMatrixInverse", "drw_matrix_buf[resource_id].model_inverse") + .define("drw_ModelMatrix", "drw_matrix_buf[resource_id].model") + /* TODO For compatibility with old shaders. To be removed. */ + .define("ModelMatrixInverse", "drw_ModelMatrixInverse") + .define("ModelMatrix", "drw_ModelMatrix"); GPU_SHADER_CREATE_INFO(draw_modelmat_new) -ADDITIONAL_INFO(draw_modelmat_new_common) -ADDITIONAL_INFO(draw_resource_id_new) -GPU_SHADER_CREATE_END() + .additional_info("draw_modelmat_new_common") + .additional_info("draw_resource_id_new"); GPU_SHADER_CREATE_INFO(draw_modelmat_new_with_custom_id) -ADDITIONAL_INFO(draw_modelmat_new_common) -ADDITIONAL_INFO(draw_resource_with_custom_id_new) -GPU_SHADER_CREATE_END() + .additional_info("draw_modelmat_new_common") + .additional_info("draw_resource_with_custom_id_new"); /** \} */ -- 2.30.2 From 8ff5fc1e24385dfc92e4a80236dc8404edcfe9a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 12:01:15 +0200 Subject: [PATCH 63/90] Revert "Mass rename" This reverts commit 06abbd972bb2487b66ca7131c2405e2b66835bf6. --- .../infos/compositor_alpha_crop_info.hh | 15 +- .../infos/compositor_bilateral_blur_info.hh | 17 +- .../infos/compositor_bokeh_blur_info.hh | 19 +- ...ompositor_bokeh_blur_variable_size_info.hh | 21 +- .../infos/compositor_bokeh_image_info.hh | 19 +- .../shaders/infos/compositor_box_mask_info.hh | 49 +- .../infos/compositor_compute_preview_info.hh | 11 +- .../shaders/infos/compositor_convert_info.hh | 99 +- .../infos/compositor_cryptomatte_info.hh | 39 +- .../shaders/infos/compositor_defocus_info.hh | 55 +- .../compositor_deriche_gaussian_blur_info.hh | 36 +- .../infos/compositor_despeckle_info.hh | 17 +- .../infos/compositor_directional_blur_info.hh | 23 +- .../shaders/infos/compositor_displace_info.hh | 17 +- .../infos/compositor_double_edge_mask_info.hh | 36 +- .../infos/compositor_edge_filter_info.hh | 15 +- .../infos/compositor_ellipse_mask_info.hh | 49 +- .../shaders/infos/compositor_filter_info.hh | 15 +- .../shaders/infos/compositor_flip_info.hh | 15 +- .../shaders/infos/compositor_glare_info.hh | 176 +- .../shaders/infos/compositor_id_mask_info.hh | 13 +- .../infos/compositor_image_crop_info.hh | 13 +- .../shaders/infos/compositor_inpaint_info.hh | 47 +- .../infos/compositor_jump_flooding_info.hh | 13 +- .../shaders/infos/compositor_keying_info.hh | 89 +- .../infos/compositor_keying_screen_info.hh | 17 +- .../shaders/infos/compositor_kuwahara_info.hh | 101 +- .../shaders/infos/compositor_map_uv_info.hh | 25 +- .../compositor_morphological_blur_info.hh | 23 +- ...tor_morphological_distance_feather_info.hh | 27 +- .../compositor_morphological_distance_info.hh | 29 +- ...r_morphological_distance_threshold_info.hh | 17 +- .../compositor_morphological_step_info.hh | 29 +- .../infos/compositor_motion_blur_info.hh | 36 +- .../infos/compositor_movie_distortion_info.hh | 13 +- .../infos/compositor_normalize_info.hh | 15 +- .../compositor_parallel_reduction_info.hh | 273 ++- .../shaders/infos/compositor_pixelate_info.hh | 13 +- .../infos/compositor_plane_deform_info.hh | 56 +- .../compositor_premultiply_alpha_info.hh | 11 +- ...mpositor_projector_lens_distortion_info.hh | 13 +- .../infos/compositor_read_input_info.hh | 45 +- .../compositor_realize_on_domain_info.hh | 61 +- .../infos/compositor_scale_variable_info.hh | 15 +- .../compositor_screen_lens_distortion_info.hh | 25 +- .../shaders/infos/compositor_smaa_info.hh | 90 +- .../shaders/infos/compositor_split_info.hh | 27 +- .../compositor_summed_area_table_info.hh | 78 +- .../infos/compositor_sun_beams_info.hh | 15 +- .../infos/compositor_symmetric_blur_info.hh | 17 +- ...sitor_symmetric_blur_variable_size_info.hh | 19 +- ...ompositor_symmetric_separable_blur_info.hh | 36 +- ...etric_separable_blur_variable_size_info.hh | 34 +- .../compositor_tone_map_photoreceptor_info.hh | 23 +- .../infos/compositor_tone_map_simple_info.hh | 17 +- ...compositor_van_vliet_gaussian_blur_info.hh | 54 +- .../infos/compositor_write_output_info.hh | 36 +- .../infos/compositor_z_combine_info.hh | 57 +- .../basic/shaders/infos/basic_depth_info.hh | 40 +- .../infos/eevee_ambient_occlusion_info.hh | 33 +- .../shaders/infos/eevee_deferred_info.hh | 275 ++- .../infos/eevee_depth_of_field_info.hh | 360 ++-- .../shaders/infos/eevee_film_info.hh | 195 +-- .../shaders/infos/eevee_hiz_info.hh | 61 +- .../shaders/infos/eevee_light_culling_info.hh | 128 +- .../infos/eevee_lightprobe_sphere_info.hh | 169 +- .../infos/eevee_lightprobe_volume_info.hh | 387 ++--- .../shaders/infos/eevee_lookdev_info.hh | 28 +- .../shaders/infos/eevee_lut_info.hh | 15 +- .../shaders/infos/eevee_material_info.hh | 537 +++--- .../shaders/infos/eevee_motion_blur_info.hh | 77 +- .../shaders/infos/eevee_shadow_info.hh | 476 +++--- .../shaders/infos/eevee_subsurface_info.hh | 61 +- .../shaders/infos/eevee_tracing_info.hh | 456 +++-- .../shaders/infos/eevee_velocity_info.hh | 53 +- .../shaders/infos/eevee_volume_info.hh | 164 +- .../gpencil/shaders/infos/gpencil_info.hh | 216 ++- .../gpencil/shaders/infos/gpencil_vfx_info.hh | 171 +- .../image/shaders/infos/engine_image_info.hh | 56 +- .../infos/overlay_antialiasing_info.hh | 34 +- .../shaders/infos/overlay_armature_info.hh | 553 +++--- .../shaders/infos/overlay_background_info.hh | 36 +- .../shaders/infos/overlay_edit_mode_info.hh | 1487 ++++++++--------- .../shaders/infos/overlay_extra_info.hh | 631 ++++--- .../shaders/infos/overlay_facing_info.hh | 22 +- .../shaders/infos/overlay_grid_info.hh | 63 +- .../shaders/infos/overlay_outline_info.hh | 230 ++- .../shaders/infos/overlay_paint_info.hh | 211 ++- .../infos/overlay_sculpt_curves_info.hh | 70 +- .../shaders/infos/overlay_sculpt_info.hh | 41 +- .../infos/overlay_viewer_attribute_info.hh | 120 +- .../shaders/infos/overlay_volume_info.hh | 148 +- .../shaders/infos/overlay_wireframe_info.hh | 199 ++- .../select/shaders/infos/select_id_info.hh | 92 +- .../shaders/infos/workbench_composite_info.hh | 55 +- .../shaders/infos/workbench_depth_info.hh | 29 +- .../workbench_effect_antialiasing_info.hh | 82 +- .../infos/workbench_effect_dof_info.hh | 88 +- .../infos/workbench_effect_outline_info.hh | 15 +- .../shaders/infos/workbench_prepass_info.hh | 150 +- .../shaders/infos/workbench_shadow_info.hh | 72 +- .../workbench_transparent_resolve_info.hh | 13 +- .../shaders/infos/workbench_volume_info.hh | 111 +- .../gpu/shaders/infos/gpu_clip_planes_info.hh | 7 +- .../gpu/shaders/infos/gpu_index_load_info.hh | 12 +- .../infos/gpu_shader_2D_area_borders_info.hh | 27 +- .../infos/gpu_shader_2D_checker_info.hh | 19 +- .../infos/gpu_shader_2D_diag_stripes_info.hh | 21 +- ...u_shader_2D_image_desaturate_color_info.hh | 11 +- .../shaders/infos/gpu_shader_2D_image_info.hh | 15 +- ...gpu_shader_2D_image_overlays_merge_info.hh | 48 +- ...der_2D_image_overlays_stereo_merge_info.hh | 21 +- .../gpu_shader_2D_image_rect_color_info.hh | 21 +- .../gpu_shader_2D_image_shuffle_color_info.hh | 11 +- .../infos/gpu_shader_2D_nodelink_info.hh | 93 +- ...oint_uniform_size_uniform_color_aa_info.hh | 21 +- ...form_size_uniform_color_outline_aa_info.hh | 23 +- ...D_point_varying_size_varying_color_info.hh | 19 +- .../infos/gpu_shader_2D_widget_info.hh | 84 +- .../infos/gpu_shader_3D_depth_only_info.hh | 20 +- .../infos/gpu_shader_3D_flat_color_info.hh | 26 +- .../shaders/infos/gpu_shader_3D_image_info.hh | 31 +- .../shaders/infos/gpu_shader_3D_point_info.hh | 47 +- .../infos/gpu_shader_3D_polyline_info.hh | 154 +- .../infos/gpu_shader_3D_smooth_color_info.hh | 26 +- .../infos/gpu_shader_3D_uniform_color_info.hh | 47 +- .../infos/gpu_shader_gpencil_stroke_info.hh | 57 +- .../gpu/shaders/infos/gpu_shader_icon_info.hh | 2 +- .../shaders/infos/gpu_shader_index_info.hh | 39 +- ...nstance_varying_color_varying_size_info.hh | 23 +- .../infos/gpu_shader_keyframe_shape_info.hh | 40 +- ...u_shader_line_dashed_uniform_color_info.hh | 45 +- .../shaders/infos/gpu_shader_print_info.hh | 8 +- .../infos/gpu_shader_sequencer_info.hh | 52 +- .../infos/gpu_shader_simple_lighting_info.hh | 27 +- .../gpu/shaders/infos/gpu_shader_test_info.hh | 194 +-- .../gpu/shaders/infos/gpu_shader_text_info.hh | 42 +- .../gpu_srgb_to_framebuffer_space_info.hh | 5 +- 138 files changed, 5653 insertions(+), 6460 deletions(-) diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_alpha_crop_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_alpha_crop_info.hh index c52918574fc..3f45bfbed23 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_alpha_crop_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_alpha_crop_info.hh @@ -5,11 +5,10 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_alpha_crop) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(IVEC2, lower_bound) -PUSH_CONSTANT(IVEC2, upper_bound) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_alpha_crop.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::IVEC2, "lower_bound") + .push_constant(Type::IVEC2, "upper_bound") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_alpha_crop.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bilateral_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bilateral_blur_info.hh index 4494e4140c6..48eea13b7da 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bilateral_blur_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bilateral_blur_info.hh @@ -5,12 +5,11 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_bilateral_blur) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(INT, radius) -PUSH_CONSTANT(FLOAT, threshold) -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, FLOAT_2D, determinator_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_bilateral_blur.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::INT, "radius") + .push_constant(Type::FLOAT, "threshold") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::FLOAT_2D, "determinator_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_bilateral_blur.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_blur_info.hh index 32653f00828..0c5a20fea97 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_blur_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_blur_info.hh @@ -5,13 +5,12 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_bokeh_blur) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(INT, radius) -PUSH_CONSTANT(BOOL, extend_bounds) -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, FLOAT_2D, weights_tx) -SAMPLER(2, FLOAT_2D, mask_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_bokeh_blur.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::INT, "radius") + .push_constant(Type::BOOL, "extend_bounds") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::FLOAT_2D, "weights_tx") + .sampler(2, ImageType::FLOAT_2D, "mask_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_bokeh_blur.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_blur_variable_size_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_blur_variable_size_info.hh index 75cd0d0ac45..68c51b1911c 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_blur_variable_size_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_blur_variable_size_info.hh @@ -5,14 +5,13 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_bokeh_blur_variable_size) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(FLOAT, base_size) -PUSH_CONSTANT(INT, search_radius) -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, FLOAT_2D, weights_tx) -SAMPLER(2, FLOAT_2D, size_tx) -SAMPLER(3, FLOAT_2D, mask_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_bokeh_blur_variable_size.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::FLOAT, "base_size") + .push_constant(Type::INT, "search_radius") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::FLOAT_2D, "weights_tx") + .sampler(2, ImageType::FLOAT_2D, "size_tx") + .sampler(3, ImageType::FLOAT_2D, "mask_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_bokeh_blur_variable_size.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_image_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_image_info.hh index 9b47779bee7..79f480256f1 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_image_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_image_info.hh @@ -5,13 +5,12 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_bokeh_image) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(FLOAT, exterior_angle) -PUSH_CONSTANT(FLOAT, rotation) -PUSH_CONSTANT(FLOAT, roundness) -PUSH_CONSTANT(FLOAT, catadioptric) -PUSH_CONSTANT(FLOAT, lens_shift) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_bokeh_image.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::FLOAT, "exterior_angle") + .push_constant(Type::FLOAT, "rotation") + .push_constant(Type::FLOAT, "roundness") + .push_constant(Type::FLOAT, "catadioptric") + .push_constant(Type::FLOAT, "lens_shift") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_bokeh_image.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_box_mask_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_box_mask_info.hh index 7f105617489..068ca5286e3 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_box_mask_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_box_mask_info.hh @@ -5,38 +5,33 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_box_mask_shared) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(IVEC2, domain_size) -PUSH_CONSTANT(VEC2, location) -PUSH_CONSTANT(VEC2, size) -PUSH_CONSTANT(FLOAT, cos_angle) -PUSH_CONSTANT(FLOAT, sin_angle) -SAMPLER(0, FLOAT_2D, base_mask_tx) -SAMPLER(1, FLOAT_2D, mask_value_tx) -IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_mask_img) -COMPUTE_SOURCE("compositor_box_mask.glsl") -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::IVEC2, "domain_size") + .push_constant(Type::VEC2, "location") + .push_constant(Type::VEC2, "size") + .push_constant(Type::FLOAT, "cos_angle") + .push_constant(Type::FLOAT, "sin_angle") + .sampler(0, ImageType::FLOAT_2D, "base_mask_tx") + .sampler(1, ImageType::FLOAT_2D, "mask_value_tx") + .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_mask_img") + .compute_source("compositor_box_mask.glsl"); GPU_SHADER_CREATE_INFO(compositor_box_mask_add) -ADDITIONAL_INFO(compositor_box_mask_shared) -DEFINE("CMP_NODE_MASKTYPE_ADD") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_box_mask_shared") + .define("CMP_NODE_MASKTYPE_ADD") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_box_mask_subtract) -ADDITIONAL_INFO(compositor_box_mask_shared) -DEFINE("CMP_NODE_MASKTYPE_SUBTRACT") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_box_mask_shared") + .define("CMP_NODE_MASKTYPE_SUBTRACT") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_box_mask_multiply) -ADDITIONAL_INFO(compositor_box_mask_shared) -DEFINE("CMP_NODE_MASKTYPE_MULTIPLY") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_box_mask_shared") + .define("CMP_NODE_MASKTYPE_MULTIPLY") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_box_mask_not) -ADDITIONAL_INFO(compositor_box_mask_shared) -DEFINE("CMP_NODE_MASKTYPE_NOT") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_box_mask_shared") + .define("CMP_NODE_MASKTYPE_NOT") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_compute_preview_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_compute_preview_info.hh index 671f9c43a90..7c542b9fbb2 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_compute_preview_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_compute_preview_info.hh @@ -5,9 +5,8 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_compute_preview) -LOCAL_GROUP_SIZE(16, 16) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, preview_img) -COMPUTE_SOURCE("compositor_compute_preview.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "preview_img") + .compute_source("compositor_compute_preview.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_convert_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_convert_info.hh index d42fb8e3731..0fd680bdc9e 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_convert_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_convert_info.hh @@ -5,78 +5,67 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_convert_shared) -LOCAL_GROUP_SIZE(16, 16) -SAMPLER(0, FLOAT_2D, input_tx) -TYPEDEF_SOURCE("gpu_shader_compositor_type_conversion.glsl") -COMPUTE_SOURCE("compositor_convert.glsl") -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .typedef_source("gpu_shader_compositor_type_conversion.glsl") + .compute_source("compositor_convert.glsl"); GPU_SHADER_CREATE_INFO(compositor_convert_float_to_float) -ADDITIONAL_INFO(compositor_convert_shared) -IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) -DEFINE_VALUE("CONVERT_EXPRESSION(value)", "value") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_convert_shared") + .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .define("CONVERT_EXPRESSION(value)", "value") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_convert_float_to_vector) -ADDITIONAL_INFO(compositor_convert_shared) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(vec3_from_float(value.x), 1.0)") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_convert_shared") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .define("CONVERT_EXPRESSION(value)", "vec4(vec3_from_float(value.x), 1.0)") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_convert_float_to_color) -ADDITIONAL_INFO(compositor_convert_shared) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4_from_float(value.x)") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_convert_shared") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .define("CONVERT_EXPRESSION(value)", "vec4_from_float(value.x)") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_convert_color_to_float) -ADDITIONAL_INFO(compositor_convert_shared) -IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) -DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(float_from_vec4(value), vec3(0.0))") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_convert_shared") + .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .define("CONVERT_EXPRESSION(value)", "vec4(float_from_vec4(value), vec3(0.0))") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_convert_color_to_vector) -ADDITIONAL_INFO(compositor_convert_shared) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -DEFINE_VALUE("CONVERT_EXPRESSION(value)", "value") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_convert_shared") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .define("CONVERT_EXPRESSION(value)", "value") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_convert_color_to_color) -ADDITIONAL_INFO(compositor_convert_shared) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -DEFINE_VALUE("CONVERT_EXPRESSION(value)", "value") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_convert_shared") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .define("CONVERT_EXPRESSION(value)", "value") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_convert_vector_to_float) -ADDITIONAL_INFO(compositor_convert_shared) -IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) -DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(float_from_vec3(value.xyz), vec3(0.0))") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_convert_shared") + .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .define("CONVERT_EXPRESSION(value)", "vec4(float_from_vec3(value.xyz), vec3(0.0))") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_convert_vector_to_vector) -ADDITIONAL_INFO(compositor_convert_shared) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -DEFINE_VALUE("CONVERT_EXPRESSION(value)", "value") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_convert_shared") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .define("CONVERT_EXPRESSION(value)", "value") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_convert_vector_to_color) -ADDITIONAL_INFO(compositor_convert_shared) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4_from_vec3(value.xyz)") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_convert_shared") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .define("CONVERT_EXPRESSION(value)", "vec4_from_vec3(value.xyz)") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_convert_color_to_alpha) -ADDITIONAL_INFO(compositor_convert_shared) -IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) -DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(value.a)") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_convert_shared") + .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .define("CONVERT_EXPRESSION(value)", "vec4(value.a)") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_cryptomatte_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_cryptomatte_info.hh index 2bccba46eb3..1b68a89843d 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_cryptomatte_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_cryptomatte_info.hh @@ -5,28 +5,25 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_cryptomatte_pick) -LOCAL_GROUP_SIZE(16, 16) -SAMPLER(0, FLOAT_2D, first_layer_tx) -IMAGE(0, GPU_RGBA32F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_cryptomatte_pick.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .sampler(0, ImageType::FLOAT_2D, "first_layer_tx") + .image(0, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_cryptomatte_pick.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_cryptomatte_matte) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(INT, identifiers_count) -PUSH_CONSTANT_ARRAY(FLOAT, identifiers, 32) -SAMPLER(0, FLOAT_2D, layer_tx) -IMAGE(0, GPU_R16F, READ_WRITE, FLOAT_2D, matte_img) -COMPUTE_SOURCE("compositor_cryptomatte_matte.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::INT, "identifiers_count") + .push_constant(Type::FLOAT, "identifiers", 32) + .sampler(0, ImageType::FLOAT_2D, "layer_tx") + .image(0, GPU_R16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "matte_img") + .compute_source("compositor_cryptomatte_matte.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_cryptomatte_image) -LOCAL_GROUP_SIZE(16, 16) -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, FLOAT_2D, matte_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_cryptomatte_image.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::FLOAT_2D, "matte_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_cryptomatte_image.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_defocus_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_defocus_info.hh index 36565e25a88..6f92172a59b 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_defocus_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_defocus_info.hh @@ -5,36 +5,33 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_defocus_radius_from_scale) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(FLOAT, scale) -PUSH_CONSTANT(FLOAT, max_radius) -SAMPLER(0, FLOAT_2D, radius_tx) -IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, radius_img) -COMPUTE_SOURCE("compositor_defocus_radius_from_scale.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::FLOAT, "scale") + .push_constant(Type::FLOAT, "max_radius") + .sampler(0, ImageType::FLOAT_2D, "radius_tx") + .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "radius_img") + .compute_source("compositor_defocus_radius_from_scale.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_defocus_radius_from_depth) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(FLOAT, f_stop) -PUSH_CONSTANT(FLOAT, max_radius) -PUSH_CONSTANT(FLOAT, focal_length) -PUSH_CONSTANT(FLOAT, pixels_per_meter) -PUSH_CONSTANT(FLOAT, distance_to_image_of_focus) -SAMPLER(0, FLOAT_2D, depth_tx) -IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, radius_img) -COMPUTE_SOURCE("compositor_defocus_radius_from_depth.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::FLOAT, "f_stop") + .push_constant(Type::FLOAT, "max_radius") + .push_constant(Type::FLOAT, "focal_length") + .push_constant(Type::FLOAT, "pixels_per_meter") + .push_constant(Type::FLOAT, "distance_to_image_of_focus") + .sampler(0, ImageType::FLOAT_2D, "depth_tx") + .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "radius_img") + .compute_source("compositor_defocus_radius_from_depth.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_defocus_blur) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(BOOL, gamma_correct) -PUSH_CONSTANT(INT, search_radius) -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, FLOAT_2D, weights_tx) -SAMPLER(2, FLOAT_2D, radius_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_defocus_blur.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::BOOL, "gamma_correct") + .push_constant(Type::INT, "search_radius") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::FLOAT_2D, "weights_tx") + .sampler(2, ImageType::FLOAT_2D, "radius_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_defocus_blur.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_deriche_gaussian_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_deriche_gaussian_blur_info.hh index 502703d5dfd..e792aeb0fe4 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_deriche_gaussian_blur_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_deriche_gaussian_blur_info.hh @@ -5,24 +5,22 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_deriche_gaussian_blur) -LOCAL_GROUP_SIZE(128, 2) -PUSH_CONSTANT(VEC4, causal_feedforward_coefficients) -PUSH_CONSTANT(VEC4, non_causal_feedforward_coefficients) -PUSH_CONSTANT(VEC4, feedback_coefficients) -PUSH_CONSTANT(FLOAT, causal_boundary_coefficient) -PUSH_CONSTANT(FLOAT, non_causal_boundary_coefficient) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, causal_output_img) -IMAGE(1, GPU_RGBA16F, WRITE, FLOAT_2D, non_causal_output_img) -COMPUTE_SOURCE("compositor_deriche_gaussian_blur.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(128, 2) + .push_constant(Type::VEC4, "causal_feedforward_coefficients") + .push_constant(Type::VEC4, "non_causal_feedforward_coefficients") + .push_constant(Type::VEC4, "feedback_coefficients") + .push_constant(Type::FLOAT, "causal_boundary_coefficient") + .push_constant(Type::FLOAT, "non_causal_boundary_coefficient") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "causal_output_img") + .image(1, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "non_causal_output_img") + .compute_source("compositor_deriche_gaussian_blur.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_deriche_gaussian_blur_sum) -LOCAL_GROUP_SIZE(16, 16) -SAMPLER(0, FLOAT_2D, causal_input_tx) -SAMPLER(1, FLOAT_2D, non_causal_input_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_deriche_gaussian_blur_sum.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .sampler(0, ImageType::FLOAT_2D, "causal_input_tx") + .sampler(1, ImageType::FLOAT_2D, "non_causal_input_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_deriche_gaussian_blur_sum.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_despeckle_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_despeckle_info.hh index 156af295157..f94bfaa7ea0 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_despeckle_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_despeckle_info.hh @@ -5,12 +5,11 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_despeckle) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(FLOAT, threshold) -PUSH_CONSTANT(FLOAT, neighbor_threshold) -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, FLOAT_2D, factor_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_despeckle.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::FLOAT, "threshold") + .push_constant(Type::FLOAT, "neighbor_threshold") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::FLOAT_2D, "factor_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_despeckle.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_directional_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_directional_blur_info.hh index bd0d7a2969c..a1058a4e762 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_directional_blur_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_directional_blur_info.hh @@ -5,15 +5,14 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_directional_blur) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(INT, iterations) -PUSH_CONSTANT(VEC2, origin) -PUSH_CONSTANT(VEC2, translation) -PUSH_CONSTANT(FLOAT, rotation_sin) -PUSH_CONSTANT(FLOAT, rotation_cos) -PUSH_CONSTANT(FLOAT, scale) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_directional_blur.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::INT, "iterations") + .push_constant(Type::VEC2, "origin") + .push_constant(Type::VEC2, "translation") + .push_constant(Type::FLOAT, "rotation_sin") + .push_constant(Type::FLOAT, "rotation_cos") + .push_constant(Type::FLOAT, "scale") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_directional_blur.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_displace_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_displace_info.hh index bc0a7ca33bd..4baf9ced1e5 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_displace_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_displace_info.hh @@ -5,12 +5,11 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_displace) -LOCAL_GROUP_SIZE(16, 16) -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, FLOAT_2D, displacement_tx) -SAMPLER(2, FLOAT_2D, x_scale_tx) -SAMPLER(3, FLOAT_2D, y_scale_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_displace.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::FLOAT_2D, "displacement_tx") + .sampler(2, ImageType::FLOAT_2D, "x_scale_tx") + .sampler(3, ImageType::FLOAT_2D, "y_scale_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_displace.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_double_edge_mask_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_double_edge_mask_info.hh index b27df720c24..049a6502d5a 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_double_edge_mask_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_double_edge_mask_info.hh @@ -5,24 +5,22 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_double_edge_mask_compute_boundary) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(BOOL, include_all_inner_edges) -PUSH_CONSTANT(BOOL, include_edges_of_image) -SAMPLER(0, FLOAT_2D, inner_mask_tx) -SAMPLER(1, FLOAT_2D, outer_mask_tx) -IMAGE(0, GPU_RG16I, WRITE, INT_2D, inner_boundary_img) -IMAGE(1, GPU_RG16I, WRITE, INT_2D, outer_boundary_img) -COMPUTE_SOURCE("compositor_double_edge_mask_compute_boundary.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::BOOL, "include_all_inner_edges") + .push_constant(Type::BOOL, "include_edges_of_image") + .sampler(0, ImageType::FLOAT_2D, "inner_mask_tx") + .sampler(1, ImageType::FLOAT_2D, "outer_mask_tx") + .image(0, GPU_RG16I, Qualifier::WRITE, ImageType::INT_2D, "inner_boundary_img") + .image(1, GPU_RG16I, Qualifier::WRITE, ImageType::INT_2D, "outer_boundary_img") + .compute_source("compositor_double_edge_mask_compute_boundary.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_double_edge_mask_compute_gradient) -LOCAL_GROUP_SIZE(16, 16) -SAMPLER(0, FLOAT_2D, inner_mask_tx) -SAMPLER(1, FLOAT_2D, outer_mask_tx) -SAMPLER(2, INT_2D, flooded_inner_boundary_tx) -SAMPLER(3, INT_2D, flooded_outer_boundary_tx) -IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_double_edge_mask_compute_gradient.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .sampler(0, ImageType::FLOAT_2D, "inner_mask_tx") + .sampler(1, ImageType::FLOAT_2D, "outer_mask_tx") + .sampler(2, ImageType::INT_2D, "flooded_inner_boundary_tx") + .sampler(3, ImageType::INT_2D, "flooded_outer_boundary_tx") + .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_double_edge_mask_compute_gradient.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_edge_filter_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_edge_filter_info.hh index 2e159f72358..c524a87c051 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_edge_filter_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_edge_filter_info.hh @@ -5,11 +5,10 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_edge_filter) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(MAT4, ukernel) -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, FLOAT_2D, factor_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_edge_filter.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::MAT4, "ukernel") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::FLOAT_2D, "factor_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_edge_filter.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_ellipse_mask_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_ellipse_mask_info.hh index 8247ad833ba..08776540640 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_ellipse_mask_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_ellipse_mask_info.hh @@ -5,38 +5,33 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_ellipse_mask_shared) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(IVEC2, domain_size) -PUSH_CONSTANT(VEC2, location) -PUSH_CONSTANT(VEC2, radius) -PUSH_CONSTANT(FLOAT, cos_angle) -PUSH_CONSTANT(FLOAT, sin_angle) -SAMPLER(0, FLOAT_2D, base_mask_tx) -SAMPLER(1, FLOAT_2D, mask_value_tx) -IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_mask_img) -COMPUTE_SOURCE("compositor_ellipse_mask.glsl") -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::IVEC2, "domain_size") + .push_constant(Type::VEC2, "location") + .push_constant(Type::VEC2, "radius") + .push_constant(Type::FLOAT, "cos_angle") + .push_constant(Type::FLOAT, "sin_angle") + .sampler(0, ImageType::FLOAT_2D, "base_mask_tx") + .sampler(1, ImageType::FLOAT_2D, "mask_value_tx") + .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_mask_img") + .compute_source("compositor_ellipse_mask.glsl"); GPU_SHADER_CREATE_INFO(compositor_ellipse_mask_add) -ADDITIONAL_INFO(compositor_ellipse_mask_shared) -DEFINE("CMP_NODE_MASKTYPE_ADD") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_ellipse_mask_shared") + .define("CMP_NODE_MASKTYPE_ADD") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_ellipse_mask_subtract) -ADDITIONAL_INFO(compositor_ellipse_mask_shared) -DEFINE("CMP_NODE_MASKTYPE_SUBTRACT") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_ellipse_mask_shared") + .define("CMP_NODE_MASKTYPE_SUBTRACT") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_ellipse_mask_multiply) -ADDITIONAL_INFO(compositor_ellipse_mask_shared) -DEFINE("CMP_NODE_MASKTYPE_MULTIPLY") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_ellipse_mask_shared") + .define("CMP_NODE_MASKTYPE_MULTIPLY") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_ellipse_mask_not) -ADDITIONAL_INFO(compositor_ellipse_mask_shared) -DEFINE("CMP_NODE_MASKTYPE_NOT") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_ellipse_mask_shared") + .define("CMP_NODE_MASKTYPE_NOT") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_filter_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_filter_info.hh index 685596edcd2..55d9784a75a 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_filter_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_filter_info.hh @@ -5,11 +5,10 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_filter) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(MAT4, ukernel) -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, FLOAT_2D, factor_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_filter.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::MAT4, "ukernel") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::FLOAT_2D, "factor_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_filter.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_flip_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_flip_info.hh index 9fba416e3af..914600e26c1 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_flip_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_flip_info.hh @@ -5,11 +5,10 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_flip) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(BOOL, flip_x) -PUSH_CONSTANT(BOOL, flip_y) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_flip.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::BOOL, "flip_x") + .push_constant(Type::BOOL, "flip_y") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_flip.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_glare_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_glare_info.hh index dae0ecaac31..1b1db807bf4 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_glare_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_glare_info.hh @@ -9,140 +9,126 @@ * ------- */ GPU_SHADER_CREATE_INFO(compositor_glare_highlights) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(FLOAT, threshold) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_glare_highlights.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::FLOAT, "threshold") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_glare_highlights.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_glare_mix) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(FLOAT, mix_factor) -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, FLOAT_2D, glare_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_glare_mix.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::FLOAT, "mix_factor") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::FLOAT_2D, "glare_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_glare_mix.glsl") + .do_static_compilation(true); /* ------------ * Ghost Glare. * ------------ */ GPU_SHADER_CREATE_INFO(compositor_glare_ghost_base) -LOCAL_GROUP_SIZE(16, 16) -SAMPLER(0, FLOAT_2D, small_ghost_tx) -SAMPLER(1, FLOAT_2D, big_ghost_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, combined_ghost_img) -COMPUTE_SOURCE("compositor_glare_ghost_base.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .sampler(0, ImageType::FLOAT_2D, "small_ghost_tx") + .sampler(1, ImageType::FLOAT_2D, "big_ghost_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "combined_ghost_img") + .compute_source("compositor_glare_ghost_base.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_glare_ghost_accumulate) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(VEC4, scales) -PUSH_CONSTANT_ARRAY(VEC4, color_modulators, 4) -SAMPLER(0, FLOAT_2D, input_ghost_tx) -IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, accumulated_ghost_img) -COMPUTE_SOURCE("compositor_glare_ghost_accumulate.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::VEC4, "scales") + .push_constant(Type::VEC4, "color_modulators", 4) + .sampler(0, ImageType::FLOAT_2D, "input_ghost_tx") + .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "accumulated_ghost_img") + .compute_source("compositor_glare_ghost_accumulate.glsl") + .do_static_compilation(true); /* ----------- * Simple Star * ----------- */ GPU_SHADER_CREATE_INFO(compositor_glare_simple_star_horizontal_pass) -LOCAL_GROUP_SIZE(16) -PUSH_CONSTANT(INT, iterations) -PUSH_CONSTANT(FLOAT, fade_factor) -IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, horizontal_img) -COMPUTE_SOURCE("compositor_glare_simple_star_horizontal_pass.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16) + .push_constant(Type::INT, "iterations") + .push_constant(Type::FLOAT, "fade_factor") + .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "horizontal_img") + .compute_source("compositor_glare_simple_star_horizontal_pass.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_glare_simple_star_vertical_pass) -LOCAL_GROUP_SIZE(16) -PUSH_CONSTANT(INT, iterations) -PUSH_CONSTANT(FLOAT, fade_factor) -SAMPLER(0, FLOAT_2D, horizontal_tx) -IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, vertical_img) -COMPUTE_SOURCE("compositor_glare_simple_star_vertical_pass.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16) + .push_constant(Type::INT, "iterations") + .push_constant(Type::FLOAT, "fade_factor") + .sampler(0, ImageType::FLOAT_2D, "horizontal_tx") + .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "vertical_img") + .compute_source("compositor_glare_simple_star_vertical_pass.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_glare_simple_star_diagonal_pass) -LOCAL_GROUP_SIZE(16) -PUSH_CONSTANT(INT, iterations) -PUSH_CONSTANT(FLOAT, fade_factor) -IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, diagonal_img) -COMPUTE_SOURCE("compositor_glare_simple_star_diagonal_pass.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16) + .push_constant(Type::INT, "iterations") + .push_constant(Type::FLOAT, "fade_factor") + .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "diagonal_img") + .compute_source("compositor_glare_simple_star_diagonal_pass.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_glare_simple_star_anti_diagonal_pass) -LOCAL_GROUP_SIZE(16) -PUSH_CONSTANT(INT, iterations) -PUSH_CONSTANT(FLOAT, fade_factor) -SAMPLER(0, FLOAT_2D, diagonal_tx) -IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, anti_diagonal_img) -COMPUTE_SOURCE("compositor_glare_simple_star_anti_diagonal_pass.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16) + .push_constant(Type::INT, "iterations") + .push_constant(Type::FLOAT, "fade_factor") + .sampler(0, ImageType::FLOAT_2D, "diagonal_tx") + .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "anti_diagonal_img") + .compute_source("compositor_glare_simple_star_anti_diagonal_pass.glsl") + .do_static_compilation(true); /* ------- * Streaks * ------- */ GPU_SHADER_CREATE_INFO(compositor_glare_streaks_filter) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(FLOAT, color_modulator) -PUSH_CONSTANT(VEC3, fade_factors) -PUSH_CONSTANT(VEC2, streak_vector) -SAMPLER(0, FLOAT_2D, input_streak_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_streak_img) -COMPUTE_SOURCE("compositor_glare_streaks_filter.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::FLOAT, "color_modulator") + .push_constant(Type::VEC3, "fade_factors") + .push_constant(Type::VEC2, "streak_vector") + .sampler(0, ImageType::FLOAT_2D, "input_streak_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_streak_img") + .compute_source("compositor_glare_streaks_filter.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_glare_streaks_accumulate) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(FLOAT, attenuation_factor) -SAMPLER(0, FLOAT_2D, streak_tx) -IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, accumulated_streaks_img) -COMPUTE_SOURCE("compositor_glare_streaks_accumulate.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::FLOAT, "attenuation_factor") + .sampler(0, ImageType::FLOAT_2D, "streak_tx") + .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "accumulated_streaks_img") + .compute_source("compositor_glare_streaks_accumulate.glsl") + .do_static_compilation(true); /* ----- * Bloom * ----- */ GPU_SHADER_CREATE_INFO(compositor_glare_bloom_downsample_shared) -LOCAL_GROUP_SIZE(16, 16) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_glare_bloom_downsample.glsl") -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_glare_bloom_downsample.glsl"); GPU_SHADER_CREATE_INFO(compositor_glare_bloom_downsample_simple_average) -DEFINE("SIMPLE_AVERAGE") -ADDITIONAL_INFO(compositor_glare_bloom_downsample_shared) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .define("SIMPLE_AVERAGE") + .additional_info("compositor_glare_bloom_downsample_shared") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_glare_bloom_downsample_karis_average) -DEFINE("KARIS_AVERAGE") -ADDITIONAL_INFO(compositor_glare_bloom_downsample_shared) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .define("KARIS_AVERAGE") + .additional_info("compositor_glare_bloom_downsample_shared") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_glare_bloom_upsample) -LOCAL_GROUP_SIZE(16, 16) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_glare_bloom_upsample.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_glare_bloom_upsample.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_id_mask_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_id_mask_info.hh index c72d1f038e6..dbdd28d7a84 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_id_mask_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_id_mask_info.hh @@ -5,10 +5,9 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_id_mask) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(INT, index) -SAMPLER(0, FLOAT_2D, input_mask_tx) -IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_mask_img) -COMPUTE_SOURCE("compositor_id_mask.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::INT, "index") + .sampler(0, ImageType::FLOAT_2D, "input_mask_tx") + .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_mask_img") + .compute_source("compositor_id_mask.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_image_crop_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_image_crop_info.hh index 6a2a013ee0a..bcbd1278ed7 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_image_crop_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_image_crop_info.hh @@ -5,10 +5,9 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_image_crop) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(IVEC2, lower_bound) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_image_crop.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::IVEC2, "lower_bound") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_image_crop.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_inpaint_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_inpaint_info.hh index 5ffc3867837..bb2719992fb 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_inpaint_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_inpaint_info.hh @@ -5,32 +5,29 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_inpaint_compute_boundary) -LOCAL_GROUP_SIZE(16, 16) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_RG16I, WRITE, INT_2D, boundary_img) -COMPUTE_SOURCE("compositor_inpaint_compute_boundary.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_RG16I, Qualifier::WRITE, ImageType::INT_2D, "boundary_img") + .compute_source("compositor_inpaint_compute_boundary.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_inpaint_fill_region) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(INT, max_distance) -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, INT_2D, flooded_boundary_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, filled_region_img) -IMAGE(1, GPU_R16F, WRITE, FLOAT_2D, distance_to_boundary_img) -IMAGE(2, GPU_R16F, WRITE, FLOAT_2D, smoothing_radius_img) -COMPUTE_SOURCE("compositor_inpaint_fill_region.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::INT, "max_distance") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::INT_2D, "flooded_boundary_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "filled_region_img") + .image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "distance_to_boundary_img") + .image(2, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "smoothing_radius_img") + .compute_source("compositor_inpaint_fill_region.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_inpaint_compute_region) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(INT, max_distance) -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, FLOAT_2D, inpainted_region_tx) -SAMPLER(2, FLOAT_2D, distance_to_boundary_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_inpaint_compute_region.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::INT, "max_distance") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::FLOAT_2D, "inpainted_region_tx") + .sampler(2, ImageType::FLOAT_2D, "distance_to_boundary_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_inpaint_compute_region.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_jump_flooding_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_jump_flooding_info.hh index 536ad38ef19..90648beac22 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_jump_flooding_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_jump_flooding_info.hh @@ -5,10 +5,9 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_jump_flooding) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(INT, step_size) -SAMPLER(0, INT_2D, input_tx) -IMAGE(0, GPU_RG16I, WRITE, INT_2D, output_img) -COMPUTE_SOURCE("compositor_jump_flooding.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::INT, "step_size") + .sampler(0, ImageType::INT_2D, "input_tx") + .image(0, GPU_RG16I, Qualifier::WRITE, ImageType::INT_2D, "output_img") + .compute_source("compositor_jump_flooding.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_keying_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_keying_info.hh index 748c3a321a2..479c4ee94bd 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_keying_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_keying_info.hh @@ -5,58 +5,53 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_keying_extract_chroma) -LOCAL_GROUP_SIZE(16, 16) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_keying_extract_chroma.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_keying_extract_chroma.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_keying_replace_chroma) -LOCAL_GROUP_SIZE(16, 16) -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, FLOAT_2D, new_chroma_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_keying_replace_chroma.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::FLOAT_2D, "new_chroma_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_keying_replace_chroma.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_keying_compute_matte) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(FLOAT, key_balance) -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, FLOAT_2D, key_tx) -IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_keying_compute_matte.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::FLOAT, "key_balance") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::FLOAT_2D, "key_tx") + .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_keying_compute_matte.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_keying_tweak_matte) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(BOOL, compute_edges) -PUSH_CONSTANT(BOOL, apply_core_matte) -PUSH_CONSTANT(BOOL, apply_garbage_matte) -PUSH_CONSTANT(INT, edge_search_radius) -PUSH_CONSTANT(FLOAT, edge_tolerance) -PUSH_CONSTANT(FLOAT, black_level) -PUSH_CONSTANT(FLOAT, white_level) -SAMPLER(0, FLOAT_2D, input_matte_tx) -SAMPLER(1, FLOAT_2D, garbage_matte_tx) -SAMPLER(2, FLOAT_2D, core_matte_tx) -IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_matte_img) -IMAGE(1, GPU_R16F, WRITE, FLOAT_2D, output_edges_img) -COMPUTE_SOURCE("compositor_keying_tweak_matte.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::BOOL, "compute_edges") + .push_constant(Type::BOOL, "apply_core_matte") + .push_constant(Type::BOOL, "apply_garbage_matte") + .push_constant(Type::INT, "edge_search_radius") + .push_constant(Type::FLOAT, "edge_tolerance") + .push_constant(Type::FLOAT, "black_level") + .push_constant(Type::FLOAT, "white_level") + .sampler(0, ImageType::FLOAT_2D, "input_matte_tx") + .sampler(1, ImageType::FLOAT_2D, "garbage_matte_tx") + .sampler(2, ImageType::FLOAT_2D, "core_matte_tx") + .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_matte_img") + .image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_edges_img") + .compute_source("compositor_keying_tweak_matte.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_keying_compute_image) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(FLOAT, despill_factor) -PUSH_CONSTANT(FLOAT, despill_balance) -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, FLOAT_2D, matte_tx) -SAMPLER(2, FLOAT_2D, key_tx) -IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_keying_compute_image.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::FLOAT, "despill_factor") + .push_constant(Type::FLOAT, "despill_balance") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::FLOAT_2D, "matte_tx") + .sampler(2, ImageType::FLOAT_2D, "key_tx") + .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_keying_compute_image.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_keying_screen_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_keying_screen_info.hh index 547a2719106..ee1fd91e865 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_keying_screen_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_keying_screen_info.hh @@ -5,12 +5,11 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_keying_screen) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(FLOAT, smoothness) -PUSH_CONSTANT(INT, number_of_markers) -STORAGE_BUF(0, READ, vec2, marker_positions[]) -STORAGE_BUF(1, READ, vec4, marker_colors[]) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_keying_screen.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::FLOAT, "smoothness") + .push_constant(Type::INT, "number_of_markers") + .storage_buf(0, Qualifier::READ, "vec2", "marker_positions[]") + .storage_buf(1, Qualifier::READ, "vec4", "marker_colors[]") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_keying_screen.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_kuwahara_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_kuwahara_info.hh index d4100fd57e4..9aa88260774 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_kuwahara_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_kuwahara_info.hh @@ -5,79 +5,68 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_kuwahara_classic_shared) -LOCAL_GROUP_SIZE(16, 16) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_kuwahara_classic.glsl") -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_kuwahara_classic.glsl"); GPU_SHADER_CREATE_INFO(compositor_kuwahara_classic_convolution_shared) -ADDITIONAL_INFO(compositor_kuwahara_classic_shared) -SAMPLER(0, FLOAT_2D, input_tx) -GPU_SHADER_CREATE_END() + .additional_info("compositor_kuwahara_classic_shared") + .sampler(0, ImageType::FLOAT_2D, "input_tx"); GPU_SHADER_CREATE_INFO(compositor_kuwahara_classic_convolution_constant_size) -ADDITIONAL_INFO(compositor_kuwahara_classic_convolution_shared) -PUSH_CONSTANT(INT, size) -DEFINE("CONSTANT_SIZE") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_kuwahara_classic_convolution_shared") + .push_constant(Type::INT, "size") + .define("CONSTANT_SIZE") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_kuwahara_classic_convolution_variable_size) -ADDITIONAL_INFO(compositor_kuwahara_classic_convolution_shared) -SAMPLER(1, FLOAT_2D, size_tx) -DEFINE("VARIABLE_SIZE") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_kuwahara_classic_convolution_shared") + .sampler(1, ImageType::FLOAT_2D, "size_tx") + .define("VARIABLE_SIZE") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_kuwahara_classic_summed_area_table_shared) -ADDITIONAL_INFO(compositor_kuwahara_classic_shared) -DEFINE("SUMMED_AREA_TABLE") -SAMPLER(0, FLOAT_2D, table_tx) -SAMPLER(1, FLOAT_2D, squared_table_tx) -GPU_SHADER_CREATE_END() + .additional_info("compositor_kuwahara_classic_shared") + .define("SUMMED_AREA_TABLE") + .sampler(0, ImageType::FLOAT_2D, "table_tx") + .sampler(1, ImageType::FLOAT_2D, "squared_table_tx"); GPU_SHADER_CREATE_INFO(compositor_kuwahara_classic_summed_area_table_constant_size) -ADDITIONAL_INFO(compositor_kuwahara_classic_summed_area_table_shared) -PUSH_CONSTANT(INT, size) -DEFINE("CONSTANT_SIZE") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_kuwahara_classic_summed_area_table_shared") + .push_constant(Type::INT, "size") + .define("CONSTANT_SIZE") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_kuwahara_classic_summed_area_table_variable_size) -ADDITIONAL_INFO(compositor_kuwahara_classic_summed_area_table_shared) -SAMPLER(2, FLOAT_2D, size_tx) -DEFINE("VARIABLE_SIZE") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_kuwahara_classic_summed_area_table_shared") + .sampler(2, ImageType::FLOAT_2D, "size_tx") + .define("VARIABLE_SIZE") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_kuwahara_anisotropic_compute_structure_tensor) -LOCAL_GROUP_SIZE(16, 16) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, structure_tensor_img) -COMPUTE_SOURCE("compositor_kuwahara_anisotropic_compute_structure_tensor.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "structure_tensor_img") + .compute_source("compositor_kuwahara_anisotropic_compute_structure_tensor.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_kuwahara_anisotropic_shared) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(FLOAT, eccentricity) -PUSH_CONSTANT(FLOAT, sharpness) -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, FLOAT_2D, structure_tensor_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_kuwahara_anisotropic.glsl") -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::FLOAT, "eccentricity") + .push_constant(Type::FLOAT, "sharpness") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::FLOAT_2D, "structure_tensor_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_kuwahara_anisotropic.glsl"); GPU_SHADER_CREATE_INFO(compositor_kuwahara_anisotropic_constant_size) -ADDITIONAL_INFO(compositor_kuwahara_anisotropic_shared) -DEFINE("CONSTANT_SIZE") -PUSH_CONSTANT(FLOAT, size) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_kuwahara_anisotropic_shared") + .define("CONSTANT_SIZE") + .push_constant(Type::FLOAT, "size") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_kuwahara_anisotropic_variable_size) -ADDITIONAL_INFO(compositor_kuwahara_anisotropic_shared) -DEFINE("VARIABLE_SIZE") -SAMPLER(2, FLOAT_2D, size_tx) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_kuwahara_anisotropic_shared") + .define("VARIABLE_SIZE") + .sampler(2, ImageType::FLOAT_2D, "size_tx") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_map_uv_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_map_uv_info.hh index bbdd122cc26..73d87a020df 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_map_uv_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_map_uv_info.hh @@ -5,21 +5,18 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_map_uv_shared) -LOCAL_GROUP_SIZE(16, 16) -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, FLOAT_2D, uv_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::FLOAT_2D, "uv_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img"); GPU_SHADER_CREATE_INFO(compositor_map_uv_anisotropic) -ADDITIONAL_INFO(compositor_map_uv_shared) -PUSH_CONSTANT(FLOAT, gradient_attenuation_factor) -COMPUTE_SOURCE("compositor_map_uv_anisotropic.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_map_uv_shared") + .push_constant(Type::FLOAT, "gradient_attenuation_factor") + .compute_source("compositor_map_uv_anisotropic.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_map_uv_nearest_neighbour) -ADDITIONAL_INFO(compositor_map_uv_shared) -COMPUTE_SOURCE("compositor_map_uv_nearest_neighbour.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_map_uv_shared") + .compute_source("compositor_map_uv_nearest_neighbour.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_blur_info.hh index 6d0035aa02a..0a6098b1e32 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_blur_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_blur_info.hh @@ -5,20 +5,17 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_morphological_blur_shared) -LOCAL_GROUP_SIZE(16, 16) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_R16F, READ_WRITE, FLOAT_2D, blurred_input_img) -COMPUTE_SOURCE("compositor_morphological_blur.glsl") -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_R16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "blurred_input_img") + .compute_source("compositor_morphological_blur.glsl"); GPU_SHADER_CREATE_INFO(compositor_morphological_blur_dilate) -ADDITIONAL_INFO(compositor_morphological_blur_shared) -DEFINE_VALUE("OPERATOR(x, y)", "max(x, y)") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_morphological_blur_shared") + .define("OPERATOR(x, y)", "max(x, y)") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_morphological_blur_erode) -ADDITIONAL_INFO(compositor_morphological_blur_shared) -DEFINE_VALUE("OPERATOR(x, y)", "min(x, y)") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_morphological_blur_shared") + .define("OPERATOR(x, y)", "min(x, y)") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_feather_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_feather_info.hh index d45c808f6fb..bc777cbd9af 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_feather_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_feather_info.hh @@ -5,22 +5,19 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_morphological_distance_feather_shared) -LOCAL_GROUP_SIZE(16, 16) -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, FLOAT_1D, weights_tx) -SAMPLER(2, FLOAT_1D, falloffs_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_morphological_distance_feather.glsl") -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::FLOAT_1D, "weights_tx") + .sampler(2, ImageType::FLOAT_1D, "falloffs_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_morphological_distance_feather.glsl"); GPU_SHADER_CREATE_INFO(compositor_morphological_distance_feather_dilate) -ADDITIONAL_INFO(compositor_morphological_distance_feather_shared) -DEFINE_VALUE("FUNCTION(x)", "x") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_morphological_distance_feather_shared") + .define("FUNCTION(x)", "x") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_morphological_distance_feather_erode) -ADDITIONAL_INFO(compositor_morphological_distance_feather_shared) -DEFINE_VALUE("FUNCTION(x)", "1.0 - x") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_morphological_distance_feather_shared") + .define("FUNCTION(x)", "1.0 - x") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_info.hh index 11aefeef699..8eca47d6012 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_info.hh @@ -5,23 +5,20 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_morphological_distance_shared) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(INT, radius) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_morphological_distance.glsl") -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::INT, "radius") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_morphological_distance.glsl"); GPU_SHADER_CREATE_INFO(compositor_morphological_distance_dilate) -ADDITIONAL_INFO(compositor_morphological_distance_shared) -DEFINE_VALUE("OPERATOR(a, b)", "max(a, b)") -DEFINE_VALUE("LIMIT", "FLT_MIN") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_morphological_distance_shared") + .define("OPERATOR(a, b)", "max(a, b)") + .define("LIMIT", "FLT_MIN") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_morphological_distance_erode) -ADDITIONAL_INFO(compositor_morphological_distance_shared) -DEFINE_VALUE("OPERATOR(a, b)", "min(a, b)") -DEFINE_VALUE("LIMIT", "FLT_MAX") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_morphological_distance_shared") + .define("OPERATOR(a, b)", "min(a, b)") + .define("LIMIT", "FLT_MAX") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_threshold_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_threshold_info.hh index 7d7d710f26e..cd5bad139a4 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_threshold_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_threshold_info.hh @@ -5,12 +5,11 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_morphological_distance_threshold) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(INT, radius) -PUSH_CONSTANT(INT, distance) -PUSH_CONSTANT(FLOAT, inset) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_morphological_distance_threshold.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::INT, "radius") + .push_constant(Type::INT, "distance") + .push_constant(Type::FLOAT, "inset") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_morphological_distance_threshold.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_step_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_step_info.hh index 0b3fc35d23b..0d58f27b757 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_step_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_step_info.hh @@ -5,23 +5,20 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_morphological_step_shared) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(INT, radius) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_morphological_step.glsl") -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::INT, "radius") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_morphological_step.glsl"); GPU_SHADER_CREATE_INFO(compositor_morphological_step_dilate) -ADDITIONAL_INFO(compositor_morphological_step_shared) -DEFINE_VALUE("OPERATOR(a, b)", "max(a, b)") -DEFINE_VALUE("LIMIT", "FLT_MIN") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_morphological_step_shared") + .define("OPERATOR(a, b)", "max(a, b)") + .define("LIMIT", "FLT_MIN") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_morphological_step_erode) -ADDITIONAL_INFO(compositor_morphological_step_shared) -DEFINE_VALUE("OPERATOR(a, b)", "min(a, b)") -DEFINE_VALUE("LIMIT", "FLT_MAX") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_morphological_step_shared") + .define("OPERATOR(a, b)", "min(a, b)") + .define("LIMIT", "FLT_MAX") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_motion_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_motion_blur_info.hh index 8f3fe0a8529..446090c63a2 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_motion_blur_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_motion_blur_info.hh @@ -5,24 +5,22 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_motion_blur_max_velocity_dilate) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(FLOAT, shutter_speed) -SAMPLER(0, FLOAT_2D, input_tx) -STORAGE_BUF(0, READ_WRITE, uint, tile_indirection_buf[]) -COMPUTE_SOURCE("compositor_motion_blur_max_velocity_dilate.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::FLOAT, "shutter_speed") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .storage_buf(0, Qualifier::READ_WRITE, "uint", "tile_indirection_buf[]") + .compute_source("compositor_motion_blur_max_velocity_dilate.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_motion_blur) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(INT, samples_count) -PUSH_CONSTANT(FLOAT, shutter_speed) -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, FLOAT_2D, depth_tx) -SAMPLER(2, FLOAT_2D, velocity_tx) -SAMPLER(3, FLOAT_2D, max_velocity_tx) -STORAGE_BUF(0, READ, uint, tile_indirection_buf[]) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_motion_blur.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::INT, "samples_count") + .push_constant(Type::FLOAT, "shutter_speed") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::FLOAT_2D, "depth_tx") + .sampler(2, ImageType::FLOAT_2D, "velocity_tx") + .sampler(3, ImageType::FLOAT_2D, "max_velocity_tx") + .storage_buf(0, Qualifier::READ, "uint", "tile_indirection_buf[]") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_motion_blur.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_movie_distortion_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_movie_distortion_info.hh index 3469a8b7823..a18504ba48f 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_movie_distortion_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_movie_distortion_info.hh @@ -5,10 +5,9 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_movie_distortion) -LOCAL_GROUP_SIZE(16, 16) -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, FLOAT_2D, distortion_grid_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_movie_distortion.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::FLOAT_2D, "distortion_grid_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_movie_distortion.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_normalize_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_normalize_info.hh index 21ad46b0953..284f8dbfaca 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_normalize_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_normalize_info.hh @@ -5,11 +5,10 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_normalize) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(FLOAT, minimum) -PUSH_CONSTANT(FLOAT, scale) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_normalize.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::FLOAT, "minimum") + .push_constant(Type::FLOAT, "scale") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_normalize.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_parallel_reduction_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_parallel_reduction_info.hh index 34cecf19ca7..b0859269a99 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_parallel_reduction_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_parallel_reduction_info.hh @@ -5,210 +5,189 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_parallel_reduction_shared) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(BOOL, is_initial_reduction) -SAMPLER(0, FLOAT_2D, input_tx) -COMPUTE_SOURCE("compositor_parallel_reduction.glsl") -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::BOOL, "is_initial_reduction") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .compute_source("compositor_parallel_reduction.glsl"); /* -------------------------------------------------------------------- * Sum Reductions. */ GPU_SHADER_CREATE_INFO(compositor_sum_shared) -ADDITIONAL_INFO(compositor_parallel_reduction_shared) -DEFINE_VALUE("REDUCE(lhs, rhs)", "lhs + rhs") -GPU_SHADER_CREATE_END() + .additional_info("compositor_parallel_reduction_shared") + .define("REDUCE(lhs, rhs)", "lhs + rhs"); GPU_SHADER_CREATE_INFO(compositor_sum_float_shared) -ADDITIONAL_INFO(compositor_sum_shared) -IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, output_img) -DEFINE_VALUE("TYPE", "float") -DEFINE_VALUE("IDENTITY", "0.0") -DEFINE_VALUE("LOAD(value)", "value.x") -GPU_SHADER_CREATE_END() + .additional_info("compositor_sum_shared") + .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .define("TYPE", "float") + .define("IDENTITY", "0.0") + .define("LOAD(value)", "value.x"); GPU_SHADER_CREATE_INFO(compositor_sum_red) -ADDITIONAL_INFO(compositor_sum_float_shared) -DEFINE_VALUE("INITIALIZE(value)", "value.r") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_sum_float_shared") + .define("INITIALIZE(value)", "value.r") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_sum_green) -ADDITIONAL_INFO(compositor_sum_float_shared) -DEFINE_VALUE("INITIALIZE(value)", "value.g") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_sum_float_shared") + .define("INITIALIZE(value)", "value.g") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_sum_blue) -ADDITIONAL_INFO(compositor_sum_float_shared) -DEFINE_VALUE("INITIALIZE(value)", "value.b") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_sum_float_shared") + .define("INITIALIZE(value)", "value.b") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_sum_luminance) -ADDITIONAL_INFO(compositor_sum_float_shared) -PUSH_CONSTANT(VEC3, luminance_coefficients) -DEFINE_VALUE("INITIALIZE(value)", "dot(value.rgb, luminance_coefficients)") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_sum_float_shared") + .push_constant(Type::VEC3, "luminance_coefficients") + .define("INITIALIZE(value)", "dot(value.rgb, luminance_coefficients)") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_sum_log_luminance) -ADDITIONAL_INFO(compositor_sum_float_shared) -PUSH_CONSTANT(VEC3, luminance_coefficients) -DEFINE_VALUE("INITIALIZE(value)", "log(max(dot(value.rgb, luminance_coefficients), 1e-5))") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_sum_float_shared") + .push_constant(Type::VEC3, "luminance_coefficients") + .define("INITIALIZE(value)", "log(max(dot(value.rgb, luminance_coefficients), 1e-5))") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_sum_color) -ADDITIONAL_INFO(compositor_sum_shared) -IMAGE(0, GPU_RGBA32F, WRITE, FLOAT_2D, output_img) -DEFINE_VALUE("TYPE", "vec4") -DEFINE_VALUE("IDENTITY", "vec4(0.0)") -DEFINE_VALUE("INITIALIZE(value)", "value") -DEFINE_VALUE("LOAD(value)", "value") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_sum_shared") + .image(0, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .define("TYPE", "vec4") + .define("IDENTITY", "vec4(0.0)") + .define("INITIALIZE(value)", "value") + .define("LOAD(value)", "value") + .do_static_compilation(true); /* -------------------------------------------------------------------- * Sum Of Squared Difference Reductions. */ GPU_SHADER_CREATE_INFO(compositor_sum_squared_difference_float_shared) -ADDITIONAL_INFO(compositor_parallel_reduction_shared) -IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, output_img) -PUSH_CONSTANT(FLOAT, subtrahend) -DEFINE_VALUE("TYPE", "float") -DEFINE_VALUE("IDENTITY", "0.0") -DEFINE_VALUE("LOAD(value)", "value.x") -DEFINE_VALUE("REDUCE(lhs, rhs)", "lhs + rhs") -GPU_SHADER_CREATE_END() + .additional_info("compositor_parallel_reduction_shared") + .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .push_constant(Type::FLOAT, "subtrahend") + .define("TYPE", "float") + .define("IDENTITY", "0.0") + .define("LOAD(value)", "value.x") + .define("REDUCE(lhs, rhs)", "lhs + rhs"); GPU_SHADER_CREATE_INFO(compositor_sum_red_squared_difference) -ADDITIONAL_INFO(compositor_sum_squared_difference_float_shared) -DEFINE_VALUE("INITIALIZE(value)", "pow(value.r - subtrahend, 2.0)") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_sum_squared_difference_float_shared") + .define("INITIALIZE(value)", "pow(value.r - subtrahend, 2.0)") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_sum_green_squared_difference) -ADDITIONAL_INFO(compositor_sum_squared_difference_float_shared) -DEFINE_VALUE("INITIALIZE(value)", "pow(value.g - subtrahend, 2.0)") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_sum_squared_difference_float_shared") + .define("INITIALIZE(value)", "pow(value.g - subtrahend, 2.0)") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_sum_blue_squared_difference) -ADDITIONAL_INFO(compositor_sum_squared_difference_float_shared) -DEFINE_VALUE("INITIALIZE(value)", "pow(value.b - subtrahend, 2.0)") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_sum_squared_difference_float_shared") + .define("INITIALIZE(value)", "pow(value.b - subtrahend, 2.0)") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_sum_luminance_squared_difference) -ADDITIONAL_INFO(compositor_sum_squared_difference_float_shared) -PUSH_CONSTANT(VEC3, luminance_coefficients) -DEFINE_VALUE("INITIALIZE(value)", "pow(dot(value.rgb, luminance_coefficients) - subtrahend, 2.0)") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_sum_squared_difference_float_shared") + .push_constant(Type::VEC3, "luminance_coefficients") + .define("INITIALIZE(value)", "pow(dot(value.rgb, luminance_coefficients) - subtrahend, 2.0)") + .do_static_compilation(true); /* -------------------------------------------------------------------- * Maximum Reductions. */ GPU_SHADER_CREATE_INFO(compositor_maximum_luminance) -ADDITIONAL_INFO(compositor_parallel_reduction_shared) -TYPEDEF_SOURCE("common_math_lib.glsl") -IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, output_img) -PUSH_CONSTANT(VEC3, luminance_coefficients) -DEFINE_VALUE("TYPE", "float") -DEFINE_VALUE("IDENTITY", "FLT_MIN") -DEFINE_VALUE("INITIALIZE(value)", "dot(value.rgb, luminance_coefficients)") -DEFINE_VALUE("LOAD(value)", "value.x") -DEFINE_VALUE("REDUCE(lhs, rhs)", "max(lhs, rhs)") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_parallel_reduction_shared") + .typedef_source("common_math_lib.glsl") + .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .push_constant(Type::VEC3, "luminance_coefficients") + .define("TYPE", "float") + .define("IDENTITY", "FLT_MIN") + .define("INITIALIZE(value)", "dot(value.rgb, luminance_coefficients)") + .define("LOAD(value)", "value.x") + .define("REDUCE(lhs, rhs)", "max(lhs, rhs)") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_maximum_float) -ADDITIONAL_INFO(compositor_parallel_reduction_shared) -TYPEDEF_SOURCE("common_math_lib.glsl") -IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, output_img) -DEFINE_VALUE("TYPE", "float") -DEFINE_VALUE("IDENTITY", "FLT_MIN") -DEFINE_VALUE("INITIALIZE(value)", "value.x") -DEFINE_VALUE("LOAD(value)", "value.x") -DEFINE_VALUE("REDUCE(lhs, rhs)", "max(rhs, lhs)") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_parallel_reduction_shared") + .typedef_source("common_math_lib.glsl") + .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .define("TYPE", "float") + .define("IDENTITY", "FLT_MIN") + .define("INITIALIZE(value)", "value.x") + .define("LOAD(value)", "value.x") + .define("REDUCE(lhs, rhs)", "max(rhs, lhs)") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_maximum_float_in_range) -ADDITIONAL_INFO(compositor_parallel_reduction_shared) -IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, output_img) -PUSH_CONSTANT(FLOAT, lower_bound) -PUSH_CONSTANT(FLOAT, upper_bound) -DEFINE_VALUE("TYPE", "float") -DEFINE_VALUE("IDENTITY", "lower_bound") -DEFINE_VALUE("INITIALIZE(v)", "((v.x <= upper_bound) && (v.x >= lower_bound)) ? v.x : lower_bound") -DEFINE_VALUE("LOAD(value)", "value.x") -DEFINE_VALUE("REDUCE(lhs, rhs)", "((rhs > lhs) && (rhs <= upper_bound)) ? rhs : lhs") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_parallel_reduction_shared") + .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .push_constant(Type::FLOAT, "lower_bound") + .push_constant(Type::FLOAT, "upper_bound") + .define("TYPE", "float") + .define("IDENTITY", "lower_bound") + .define("INITIALIZE(v)", "((v.x <= upper_bound) && (v.x >= lower_bound)) ? v.x : lower_bound") + .define("LOAD(value)", "value.x") + .define("REDUCE(lhs, rhs)", "((rhs > lhs) && (rhs <= upper_bound)) ? rhs : lhs") + .do_static_compilation(true); /* -------------------------------------------------------------------- * Minimum Reductions. */ GPU_SHADER_CREATE_INFO(compositor_minimum_luminance) -ADDITIONAL_INFO(compositor_parallel_reduction_shared) -TYPEDEF_SOURCE("common_math_lib.glsl") -IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, output_img) -PUSH_CONSTANT(VEC3, luminance_coefficients) -DEFINE_VALUE("TYPE", "float") -DEFINE_VALUE("IDENTITY", "FLT_MAX") -DEFINE_VALUE("INITIALIZE(value)", "dot(value.rgb, luminance_coefficients)") -DEFINE_VALUE("LOAD(value)", "value.x") -DEFINE_VALUE("REDUCE(lhs, rhs)", "min(lhs, rhs)") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_parallel_reduction_shared") + .typedef_source("common_math_lib.glsl") + .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .push_constant(Type::VEC3, "luminance_coefficients") + .define("TYPE", "float") + .define("IDENTITY", "FLT_MAX") + .define("INITIALIZE(value)", "dot(value.rgb, luminance_coefficients)") + .define("LOAD(value)", "value.x") + .define("REDUCE(lhs, rhs)", "min(lhs, rhs)") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_minimum_float) -ADDITIONAL_INFO(compositor_parallel_reduction_shared) -TYPEDEF_SOURCE("common_math_lib.glsl") -IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, output_img) -DEFINE_VALUE("TYPE", "float") -DEFINE_VALUE("IDENTITY", "FLT_MAX") -DEFINE_VALUE("INITIALIZE(value)", "value.x") -DEFINE_VALUE("LOAD(value)", "value.x") -DEFINE_VALUE("REDUCE(lhs, rhs)", "min(rhs, lhs)") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_parallel_reduction_shared") + .typedef_source("common_math_lib.glsl") + .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .define("TYPE", "float") + .define("IDENTITY", "FLT_MAX") + .define("INITIALIZE(value)", "value.x") + .define("LOAD(value)", "value.x") + .define("REDUCE(lhs, rhs)", "min(rhs, lhs)") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_minimum_float_in_range) -ADDITIONAL_INFO(compositor_parallel_reduction_shared) -IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, output_img) -PUSH_CONSTANT(FLOAT, lower_bound) -PUSH_CONSTANT(FLOAT, upper_bound) -DEFINE_VALUE("TYPE", "float") -DEFINE_VALUE("IDENTITY", "upper_bound") -DEFINE_VALUE("INITIALIZE(v)", "((v.x <= upper_bound) && (v.x >= lower_bound)) ? v.x : upper_bound") -DEFINE_VALUE("LOAD(value)", "value.x") -DEFINE_VALUE("REDUCE(lhs, rhs)", "((rhs < lhs) && (rhs >= lower_bound)) ? rhs : lhs") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_parallel_reduction_shared") + .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .push_constant(Type::FLOAT, "lower_bound") + .push_constant(Type::FLOAT, "upper_bound") + .define("TYPE", "float") + .define("IDENTITY", "upper_bound") + .define("INITIALIZE(v)", "((v.x <= upper_bound) && (v.x >= lower_bound)) ? v.x : upper_bound") + .define("LOAD(value)", "value.x") + .define("REDUCE(lhs, rhs)", "((rhs < lhs) && (rhs >= lower_bound)) ? rhs : lhs") + .do_static_compilation(true); /* -------------------------------------------------------------------- * Velocity Reductions. */ GPU_SHADER_CREATE_INFO(compositor_max_velocity) -LOCAL_GROUP_SIZE(32, 32) -PUSH_CONSTANT(BOOL, is_initial_reduction) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -DEFINE_VALUE("TYPE", "vec4") -DEFINE_VALUE("IDENTITY", "vec4(0.0)") -DEFINE_VALUE("INITIALIZE(value)", "value") -DEFINE_VALUE("LOAD(value)", "value") -DEFINE_VALUE("REDUCE(lhs, rhs)", - "vec4(dot(lhs.xy, lhs.xy) > dot(rhs.xy, rhs.xy) ? lhs.xy : rhs.xy," - " dot(lhs.zw, lhs.zw) > dot(rhs.zw, rhs.zw) ? lhs.zw : rhs.zw)") -COMPUTE_SOURCE("compositor_parallel_reduction.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(32, 32) + .push_constant(Type::BOOL, "is_initial_reduction") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .define("TYPE", "vec4") + .define("IDENTITY", "vec4(0.0)") + .define("INITIALIZE(value)", "value") + .define("LOAD(value)", "value") + .define("REDUCE(lhs, rhs)", + "vec4(dot(lhs.xy, lhs.xy) > dot(rhs.xy, rhs.xy) ? lhs.xy : rhs.xy," + " dot(lhs.zw, lhs.zw) > dot(rhs.zw, rhs.zw) ? lhs.zw : rhs.zw)") + .compute_source("compositor_parallel_reduction.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_pixelate_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_pixelate_info.hh index 8df1a5ec50f..47cc6cf4661 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_pixelate_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_pixelate_info.hh @@ -5,10 +5,9 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_pixelate) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(INT, pixel_size) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_pixelate.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::INT, "pixel_size") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_pixelate.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_plane_deform_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_plane_deform_info.hh index 1aacbc11796..445896c8b06 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_plane_deform_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_plane_deform_info.hh @@ -5,39 +5,35 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_plane_deform_mask) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(MAT4, homography_matrix) -IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, mask_img) -COMPUTE_SOURCE("compositor_plane_deform_mask.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::MAT4, "homography_matrix") + .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "mask_img") + .compute_source("compositor_plane_deform_mask.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_plane_deform) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(MAT4, homography_matrix) -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, FLOAT_2D, mask_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_plane_deform.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::MAT4, "homography_matrix") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::FLOAT_2D, "mask_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_plane_deform.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_plane_deform_motion_blur_mask) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(INT, number_of_motion_blur_samples) -UNIFORM_BUF(0, mat4, homography_matrices[64]) -IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, mask_img) -COMPUTE_SOURCE("compositor_plane_deform_motion_blur_mask.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::INT, "number_of_motion_blur_samples") + .uniform_buf(0, "mat4", "homography_matrices[64]") + .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "mask_img") + .compute_source("compositor_plane_deform_motion_blur_mask.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_plane_deform_motion_blur) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(INT, number_of_motion_blur_samples) -UNIFORM_BUF(0, mat4, homography_matrices[64]) -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, FLOAT_2D, mask_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_plane_deform_motion_blur.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::INT, "number_of_motion_blur_samples") + .uniform_buf(0, "mat4", "homography_matrices[64]") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::FLOAT_2D, "mask_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_plane_deform_motion_blur.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_premultiply_alpha_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_premultiply_alpha_info.hh index 1baf1334b5b..c698750269b 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_premultiply_alpha_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_premultiply_alpha_info.hh @@ -5,9 +5,8 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_premultiply_alpha) -LOCAL_GROUP_SIZE(16, 16) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_premultiply_alpha.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_premultiply_alpha.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_projector_lens_distortion_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_projector_lens_distortion_info.hh index 5425065fbac..1acd02baa42 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_projector_lens_distortion_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_projector_lens_distortion_info.hh @@ -5,10 +5,9 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_projector_lens_distortion) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(FLOAT, dispersion) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_projector_lens_distortion.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::FLOAT, "dispersion") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_projector_lens_distortion.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_read_input_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_read_input_info.hh index 0aa1be33ff8..a8e80ebb948 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_read_input_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_read_input_info.hh @@ -5,36 +5,31 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_read_input_shared) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(IVEC2, lower_bound) -SAMPLER(0, FLOAT_2D, input_tx) -COMPUTE_SOURCE("compositor_read_input.glsl") -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::IVEC2, "lower_bound") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .compute_source("compositor_read_input.glsl"); GPU_SHADER_CREATE_INFO(compositor_read_input_float) -ADDITIONAL_INFO(compositor_read_input_shared) -IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) -DEFINE_VALUE("READ_EXPRESSION(input_color)", "vec4(input_color.r, vec3(0.0))") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_read_input_shared") + .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .define("READ_EXPRESSION(input_color)", "vec4(input_color.r, vec3(0.0))") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_read_input_vector) -ADDITIONAL_INFO(compositor_read_input_shared) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -DEFINE_VALUE("READ_EXPRESSION(input_color)", "input_color") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_read_input_shared") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .define("READ_EXPRESSION(input_color)", "input_color") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_read_input_color) -ADDITIONAL_INFO(compositor_read_input_shared) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -DEFINE_VALUE("READ_EXPRESSION(input_color)", "input_color") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_read_input_shared") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .define("READ_EXPRESSION(input_color)", "input_color") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_read_input_alpha) -ADDITIONAL_INFO(compositor_read_input_shared) -IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) -DEFINE_VALUE("READ_EXPRESSION(input_color)", "vec4(input_color.a, vec3(0.0))") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_read_input_shared") + .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .define("READ_EXPRESSION(input_color)", "vec4(input_color.a, vec3(0.0))") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_realize_on_domain_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_realize_on_domain_info.hh index 725ba946b2f..b870d438ad3 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_realize_on_domain_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_realize_on_domain_info.hh @@ -5,54 +5,45 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_shared) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(MAT4, inverse_transformation) -SAMPLER(0, FLOAT_2D, input_tx) -COMPUTE_SOURCE("compositor_realize_on_domain.glsl") -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::MAT4, "inverse_transformation") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .compute_source("compositor_realize_on_domain.glsl"); GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_standard_shared) -ADDITIONAL_INFO(compositor_realize_on_domain_shared) -DEFINE_VALUE("SAMPLER_FUNCTION", "texture") -GPU_SHADER_CREATE_END() + .additional_info("compositor_realize_on_domain_shared") + .define("SAMPLER_FUNCTION", "texture"); GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_bicubic_shared) -ADDITIONAL_INFO(compositor_realize_on_domain_shared) -DEFINE_VALUE("SAMPLER_FUNCTION", "texture_bicubic") -GPU_SHADER_CREATE_END() + .additional_info("compositor_realize_on_domain_shared") + .define("SAMPLER_FUNCTION", "texture_bicubic"); GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_color) -ADDITIONAL_INFO(compositor_realize_on_domain_standard_shared) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, domain_img) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_realize_on_domain_standard_shared") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "domain_img") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_vector) -ADDITIONAL_INFO(compositor_realize_on_domain_standard_shared) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, domain_img) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_realize_on_domain_standard_shared") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "domain_img") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_float) -ADDITIONAL_INFO(compositor_realize_on_domain_standard_shared) -IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, domain_img) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_realize_on_domain_standard_shared") + .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "domain_img") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_bicubic_color) -ADDITIONAL_INFO(compositor_realize_on_domain_bicubic_shared) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, domain_img) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_realize_on_domain_bicubic_shared") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "domain_img") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_bicubic_vector) -ADDITIONAL_INFO(compositor_realize_on_domain_bicubic_shared) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, domain_img) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_realize_on_domain_bicubic_shared") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "domain_img") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_bicubic_float) -ADDITIONAL_INFO(compositor_realize_on_domain_bicubic_shared) -IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, domain_img) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_realize_on_domain_bicubic_shared") + .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "domain_img") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_scale_variable_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_scale_variable_info.hh index 24d316a2f05..327ded2efab 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_scale_variable_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_scale_variable_info.hh @@ -5,11 +5,10 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_scale_variable) -LOCAL_GROUP_SIZE(16, 16) -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, FLOAT_2D, x_scale_tx) -SAMPLER(2, FLOAT_2D, y_scale_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_scale_variable.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::FLOAT_2D, "x_scale_tx") + .sampler(2, ImageType::FLOAT_2D, "y_scale_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_scale_variable.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_screen_lens_distortion_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_screen_lens_distortion_info.hh index 742bb2facbd..e3b03f1e724 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_screen_lens_distortion_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_screen_lens_distortion_info.hh @@ -5,21 +5,18 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_screen_lens_distortion_shared) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(VEC3, chromatic_distortion) -PUSH_CONSTANT(FLOAT, scale) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_screen_lens_distortion.glsl") -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::VEC3, "chromatic_distortion") + .push_constant(Type::FLOAT, "scale") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_screen_lens_distortion.glsl"); GPU_SHADER_CREATE_INFO(compositor_screen_lens_distortion) -ADDITIONAL_INFO(compositor_screen_lens_distortion_shared) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_screen_lens_distortion_shared") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_screen_lens_distortion_jitter) -ADDITIONAL_INFO(compositor_screen_lens_distortion_shared) -DEFINE("JITTER") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_screen_lens_distortion_shared") + .define("JITTER") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_smaa_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_smaa_info.hh index 03169ab921a..6b12ae4dfff 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_smaa_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_smaa_info.hh @@ -5,61 +5,55 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_smaa_edge_detection) -LOCAL_GROUP_SIZE(16, 16) -DEFINE("SMAA_GLSL_3") -DEFINE_VALUE("SMAA_RT_METRICS", - "vec4(1.0 / vec2(textureSize(input_tx, 0)), vec2(textureSize(input_tx, 0)))") -DEFINE_VALUE("SMAA_LUMA_WEIGHT", "vec4(luminance_coefficients, 0.0)") -DEFINE_VALUE("SMAA_THRESHOLD", "smaa_threshold") -DEFINE_VALUE("SMAA_LOCAL_CONTRAST_ADAPTATION_FACTOR", "smaa_local_contrast_adaptation_factor") -PUSH_CONSTANT(VEC3, luminance_coefficients) -PUSH_CONSTANT(FLOAT, smaa_threshold) -PUSH_CONSTANT(FLOAT, smaa_local_contrast_adaptation_factor) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, edges_img) -COMPUTE_SOURCE("compositor_smaa_edge_detection.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .define("SMAA_GLSL_3") + .define("SMAA_RT_METRICS", + "vec4(1.0 / vec2(textureSize(input_tx, 0)), vec2(textureSize(input_tx, 0)))") + .define("SMAA_LUMA_WEIGHT", "vec4(luminance_coefficients, 0.0)") + .define("SMAA_THRESHOLD", "smaa_threshold") + .define("SMAA_LOCAL_CONTRAST_ADAPTATION_FACTOR", "smaa_local_contrast_adaptation_factor") + .push_constant(Type::VEC3, "luminance_coefficients") + .push_constant(Type::FLOAT, "smaa_threshold") + .push_constant(Type::FLOAT, "smaa_local_contrast_adaptation_factor") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "edges_img") + .compute_source("compositor_smaa_edge_detection.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_smaa_blending_weight_calculation) -LOCAL_GROUP_SIZE(16, 16) -DEFINE("SMAA_GLSL_3") -DEFINE_VALUE("SMAA_RT_METRICS", - "vec4(1.0 / vec2(textureSize(edges_tx, 0)), vec2(textureSize(edges_tx, 0)))") -DEFINE_VALUE("SMAA_CORNER_ROUNDING", "smaa_corner_rounding") -PUSH_CONSTANT(INT, smaa_corner_rounding) -SAMPLER(0, FLOAT_2D, edges_tx) -SAMPLER(1, FLOAT_2D, area_tx) -SAMPLER(2, FLOAT_2D, search_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, weights_img) -COMPUTE_SOURCE("compositor_smaa_blending_weight_calculation.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .define("SMAA_GLSL_3") + .define("SMAA_RT_METRICS", + "vec4(1.0 / vec2(textureSize(edges_tx, 0)), vec2(textureSize(edges_tx, 0)))") + .define("SMAA_CORNER_ROUNDING", "smaa_corner_rounding") + .push_constant(Type::INT, "smaa_corner_rounding") + .sampler(0, ImageType::FLOAT_2D, "edges_tx") + .sampler(1, ImageType::FLOAT_2D, "area_tx") + .sampler(2, ImageType::FLOAT_2D, "search_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "weights_img") + .compute_source("compositor_smaa_blending_weight_calculation.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_smaa_neighborhood_blending_shared) -LOCAL_GROUP_SIZE(16, 16) -DEFINE("SMAA_GLSL_3") -DEFINE_VALUE("SMAA_RT_METRICS", - "vec4(1.0 / vec2(textureSize(input_tx, 0)), vec2(textureSize(input_tx, 0)))") -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, FLOAT_2D, weights_tx) -COMPUTE_SOURCE("compositor_smaa_neighborhood_blending.glsl") -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .define("SMAA_GLSL_3") + .define("SMAA_RT_METRICS", + "vec4(1.0 / vec2(textureSize(input_tx, 0)), vec2(textureSize(input_tx, 0)))") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::FLOAT_2D, "weights_tx") + .compute_source("compositor_smaa_neighborhood_blending.glsl"); GPU_SHADER_CREATE_INFO(compositor_smaa_neighborhood_blending_float4) -ADDITIONAL_INFO(compositor_smaa_neighborhood_blending_shared) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_smaa_neighborhood_blending_shared") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_smaa_neighborhood_blending_float2) -ADDITIONAL_INFO(compositor_smaa_neighborhood_blending_shared) -IMAGE(0, GPU_RG16F, WRITE, FLOAT_2D, output_img) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_smaa_neighborhood_blending_shared") + .image(0, GPU_RG16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_smaa_neighborhood_blending_float) -ADDITIONAL_INFO(compositor_smaa_neighborhood_blending_shared) -IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_smaa_neighborhood_blending_shared") + .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_split_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_split_info.hh index 863e2244ac0..0529a8469f2 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_split_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_split_info.hh @@ -5,22 +5,19 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_split_shared) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(FLOAT, split_ratio) -SAMPLER(0, FLOAT_2D, first_image_tx) -SAMPLER(1, FLOAT_2D, second_image_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_split.glsl") -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::FLOAT, "split_ratio") + .sampler(0, ImageType::FLOAT_2D, "first_image_tx") + .sampler(1, ImageType::FLOAT_2D, "second_image_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_split.glsl"); GPU_SHADER_CREATE_INFO(compositor_split_horizontal) -ADDITIONAL_INFO(compositor_split_shared) -DEFINE("SPLIT_HORIZONTAL") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_split_shared") + .define("SPLIT_HORIZONTAL") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_split_vertical) -ADDITIONAL_INFO(compositor_split_shared) -DEFINE("SPLIT_VERTICAL") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_split_shared") + .define("SPLIT_VERTICAL") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_summed_area_table_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_summed_area_table_info.hh index 56937b24e26..497fd2ea86d 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_summed_area_table_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_summed_area_table_info.hh @@ -5,60 +5,52 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_summed_area_table_compute_incomplete_prologues_shared) -LOCAL_GROUP_SIZE(16, 16) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_RGBA32F, WRITE, FLOAT_2D, incomplete_x_prologues_img) -IMAGE(1, GPU_RGBA32F, WRITE, FLOAT_2D, incomplete_y_prologues_img) -COMPUTE_SOURCE("compositor_summed_area_table_compute_incomplete_prologues.glsl") -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "incomplete_x_prologues_img") + .image(1, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "incomplete_y_prologues_img") + .compute_source("compositor_summed_area_table_compute_incomplete_prologues.glsl"); GPU_SHADER_CREATE_INFO(compositor_summed_area_table_compute_incomplete_prologues_identity) -ADDITIONAL_INFO(compositor_summed_area_table_compute_incomplete_prologues_shared) -DEFINE_VALUE("OPERATION(value)", "value") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_summed_area_table_compute_incomplete_prologues_shared") + .define("OPERATION(value)", "value") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_summed_area_table_compute_incomplete_prologues_square) -ADDITIONAL_INFO(compositor_summed_area_table_compute_incomplete_prologues_shared) -DEFINE_VALUE("OPERATION(value)", "value * value") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_summed_area_table_compute_incomplete_prologues_shared") + .define("OPERATION(value)", "value * value") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_summed_area_table_compute_complete_x_prologues) -LOCAL_GROUP_SIZE(16) -SAMPLER(0, FLOAT_2D, incomplete_x_prologues_tx) -IMAGE(0, GPU_RGBA32F, WRITE, FLOAT_2D, complete_x_prologues_img) -IMAGE(1, GPU_RGBA32F, WRITE, FLOAT_2D, complete_x_prologues_sum_img) -COMPUTE_SOURCE("compositor_summed_area_table_compute_complete_x_prologues.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16) + .sampler(0, ImageType::FLOAT_2D, "incomplete_x_prologues_tx") + .image(0, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "complete_x_prologues_img") + .image(1, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "complete_x_prologues_sum_img") + .compute_source("compositor_summed_area_table_compute_complete_x_prologues.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_summed_area_table_compute_complete_y_prologues) -LOCAL_GROUP_SIZE(16) -SAMPLER(0, FLOAT_2D, incomplete_y_prologues_tx) -SAMPLER(1, FLOAT_2D, complete_x_prologues_sum_tx) -IMAGE(0, GPU_RGBA32F, WRITE, FLOAT_2D, complete_y_prologues_img) -COMPUTE_SOURCE("compositor_summed_area_table_compute_complete_y_prologues.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16) + .sampler(0, ImageType::FLOAT_2D, "incomplete_y_prologues_tx") + .sampler(1, ImageType::FLOAT_2D, "complete_x_prologues_sum_tx") + .image(0, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "complete_y_prologues_img") + .compute_source("compositor_summed_area_table_compute_complete_y_prologues.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_summed_area_table_compute_complete_blocks_shared) -LOCAL_GROUP_SIZE(16, 16) -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, FLOAT_2D, complete_x_prologues_tx) -SAMPLER(2, FLOAT_2D, complete_y_prologues_tx) -IMAGE(0, GPU_RGBA32F, READ_WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_summed_area_table_compute_complete_blocks.glsl") -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::FLOAT_2D, "complete_x_prologues_tx") + .sampler(2, ImageType::FLOAT_2D, "complete_y_prologues_tx") + .image(0, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_summed_area_table_compute_complete_blocks.glsl"); GPU_SHADER_CREATE_INFO(compositor_summed_area_table_compute_complete_blocks_identity) -ADDITIONAL_INFO(compositor_summed_area_table_compute_complete_blocks_shared) -DEFINE_VALUE("OPERATION(value)", "value") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_summed_area_table_compute_complete_blocks_shared") + .define("OPERATION(value)", "value") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_summed_area_table_compute_complete_blocks_square) -ADDITIONAL_INFO(compositor_summed_area_table_compute_complete_blocks_shared) -DEFINE_VALUE("OPERATION(value)", "value * value") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_summed_area_table_compute_complete_blocks_shared") + .define("OPERATION(value)", "value * value") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_sun_beams_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_sun_beams_info.hh index 227ec2d2639..f6203e4a39f 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_sun_beams_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_sun_beams_info.hh @@ -5,11 +5,10 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_sun_beams) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(VEC2, source) -PUSH_CONSTANT(INT, max_steps) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_sun_beams.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::VEC2, "source") + .push_constant(Type::INT, "max_steps") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_sun_beams.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_blur_info.hh index 08babaaeb74..8719e6277b1 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_blur_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_blur_info.hh @@ -5,12 +5,11 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_symmetric_blur) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(BOOL, extend_bounds) -PUSH_CONSTANT(BOOL, gamma_correct) -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, FLOAT_2D, weights_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_symmetric_blur.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::BOOL, "extend_bounds") + .push_constant(Type::BOOL, "gamma_correct") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::FLOAT_2D, "weights_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_symmetric_blur.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_blur_variable_size_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_blur_variable_size_info.hh index af5e6626c2b..76ea55d2851 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_blur_variable_size_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_blur_variable_size_info.hh @@ -5,13 +5,12 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_symmetric_blur_variable_size) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(BOOL, extend_bounds) -PUSH_CONSTANT(BOOL, gamma_correct) -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, FLOAT_2D, weights_tx) -SAMPLER(2, FLOAT_2D, size_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_symmetric_blur_variable_size.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::BOOL, "extend_bounds") + .push_constant(Type::BOOL, "gamma_correct") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::FLOAT_2D, "weights_tx") + .sampler(2, ImageType::FLOAT_2D, "size_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_symmetric_blur_variable_size.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_separable_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_separable_blur_info.hh index 7f112c6a349..7a11dfad94b 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_separable_blur_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_separable_blur_info.hh @@ -5,29 +5,25 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_symmetric_separable_blur_shared) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(BOOL, extend_bounds) -PUSH_CONSTANT(BOOL, gamma_correct_input) -PUSH_CONSTANT(BOOL, gamma_uncorrect_output) -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, FLOAT_1D, weights_tx) -COMPUTE_SOURCE("compositor_symmetric_separable_blur.glsl") -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::BOOL, "extend_bounds") + .push_constant(Type::BOOL, "gamma_correct_input") + .push_constant(Type::BOOL, "gamma_uncorrect_output") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::FLOAT_1D, "weights_tx") + .compute_source("compositor_symmetric_separable_blur.glsl"); GPU_SHADER_CREATE_INFO(compositor_symmetric_separable_blur_float) -ADDITIONAL_INFO(compositor_symmetric_separable_blur_shared) -IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_symmetric_separable_blur_shared") + .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_symmetric_separable_blur_float2) -ADDITIONAL_INFO(compositor_symmetric_separable_blur_shared) -IMAGE(0, GPU_RG16F, WRITE, FLOAT_2D, output_img) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_symmetric_separable_blur_shared") + .image(0, GPU_RG16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_symmetric_separable_blur_float4) -ADDITIONAL_INFO(compositor_symmetric_separable_blur_shared) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_symmetric_separable_blur_shared") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_separable_blur_variable_size_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_separable_blur_variable_size_info.hh index 162bfe51762..1528c111b0e 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_separable_blur_variable_size_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_separable_blur_variable_size_info.hh @@ -5,28 +5,24 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_symmetric_separable_blur_variable_size_shared) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(BOOL, is_vertical_pass) -SAMPLER(0, FLOAT_2D, input_tx) -SAMPLER(1, FLOAT_1D, weights_tx) -SAMPLER(2, FLOAT_2D, radius_tx) -COMPUTE_SOURCE("compositor_symmetric_separable_blur_variable_size.glsl") -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::BOOL, "is_vertical_pass") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .sampler(1, ImageType::FLOAT_1D, "weights_tx") + .sampler(2, ImageType::FLOAT_2D, "radius_tx") + .compute_source("compositor_symmetric_separable_blur_variable_size.glsl"); GPU_SHADER_CREATE_INFO(compositor_symmetric_separable_blur_variable_size_float) -ADDITIONAL_INFO(compositor_symmetric_separable_blur_variable_size_shared) -IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_symmetric_separable_blur_variable_size_shared") + .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_symmetric_separable_blur_variable_size_float2) -ADDITIONAL_INFO(compositor_symmetric_separable_blur_variable_size_shared) -IMAGE(0, GPU_RG16F, WRITE, FLOAT_2D, output_img) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_symmetric_separable_blur_variable_size_shared") + .image(0, GPU_RG16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_symmetric_separable_blur_variable_size_float4) -ADDITIONAL_INFO(compositor_symmetric_separable_blur_variable_size_shared) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_symmetric_separable_blur_variable_size_shared") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_photoreceptor_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_photoreceptor_info.hh index 6a7668e6bc5..fa8bf78bf2e 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_photoreceptor_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_photoreceptor_info.hh @@ -5,15 +5,14 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_tone_map_photoreceptor) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(VEC4, global_adaptation_level) -PUSH_CONSTANT(FLOAT, contrast) -PUSH_CONSTANT(FLOAT, intensity) -PUSH_CONSTANT(FLOAT, chromatic_adaptation) -PUSH_CONSTANT(FLOAT, light_adaptation) -PUSH_CONSTANT(VEC3, luminance_coefficients) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_tone_map_photoreceptor.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::VEC4, "global_adaptation_level") + .push_constant(Type::FLOAT, "contrast") + .push_constant(Type::FLOAT, "intensity") + .push_constant(Type::FLOAT, "chromatic_adaptation") + .push_constant(Type::FLOAT, "light_adaptation") + .push_constant(Type::VEC3, "luminance_coefficients") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_tone_map_photoreceptor.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_simple_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_simple_info.hh index 2dfde065581..d5c56e22073 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_simple_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_simple_info.hh @@ -5,12 +5,11 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_tone_map_simple) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(FLOAT, luminance_scale) -PUSH_CONSTANT(FLOAT, luminance_scale_blend_factor) -PUSH_CONSTANT(FLOAT, inverse_gamma) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_tone_map_simple.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::FLOAT, "luminance_scale") + .push_constant(Type::FLOAT, "luminance_scale_blend_factor") + .push_constant(Type::FLOAT, "inverse_gamma") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_tone_map_simple.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_van_vliet_gaussian_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_van_vliet_gaussian_blur_info.hh index 243aeacc83a..9c5737257d7 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_van_vliet_gaussian_blur_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_van_vliet_gaussian_blur_info.hh @@ -5,33 +5,31 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_van_vliet_gaussian_blur) -LOCAL_GROUP_SIZE(64, 4) -PUSH_CONSTANT(VEC2, first_feedback_coefficients) -PUSH_CONSTANT(VEC2, first_causal_feedforward_coefficients) -PUSH_CONSTANT(VEC2, first_non_causal_feedforward_coefficients) -PUSH_CONSTANT(VEC2, second_feedback_coefficients) -PUSH_CONSTANT(VEC2, second_causal_feedforward_coefficients) -PUSH_CONSTANT(VEC2, second_non_causal_feedforward_coefficients) -PUSH_CONSTANT(FLOAT, first_causal_boundary_coefficient) -PUSH_CONSTANT(FLOAT, first_non_causal_boundary_coefficient) -PUSH_CONSTANT(FLOAT, second_causal_boundary_coefficient) -PUSH_CONSTANT(FLOAT, second_non_causal_boundary_coefficient) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, first_causal_output_img) -IMAGE(1, GPU_RGBA16F, WRITE, FLOAT_2D, first_non_causal_output_img) -IMAGE(2, GPU_RGBA16F, WRITE, FLOAT_2D, second_causal_output_img) -IMAGE(3, GPU_RGBA16F, WRITE, FLOAT_2D, second_non_causal_output_img) -COMPUTE_SOURCE("compositor_van_vliet_gaussian_blur.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(64, 4) + .push_constant(Type::VEC2, "first_feedback_coefficients") + .push_constant(Type::VEC2, "first_causal_feedforward_coefficients") + .push_constant(Type::VEC2, "first_non_causal_feedforward_coefficients") + .push_constant(Type::VEC2, "second_feedback_coefficients") + .push_constant(Type::VEC2, "second_causal_feedforward_coefficients") + .push_constant(Type::VEC2, "second_non_causal_feedforward_coefficients") + .push_constant(Type::FLOAT, "first_causal_boundary_coefficient") + .push_constant(Type::FLOAT, "first_non_causal_boundary_coefficient") + .push_constant(Type::FLOAT, "second_causal_boundary_coefficient") + .push_constant(Type::FLOAT, "second_non_causal_boundary_coefficient") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "first_causal_output_img") + .image(1, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "first_non_causal_output_img") + .image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "second_causal_output_img") + .image(3, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "second_non_causal_output_img") + .compute_source("compositor_van_vliet_gaussian_blur.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_van_vliet_gaussian_blur_sum) -LOCAL_GROUP_SIZE(16, 16) -SAMPLER(0, FLOAT_2D, first_causal_input_tx) -SAMPLER(1, FLOAT_2D, first_non_causal_input_tx) -SAMPLER(2, FLOAT_2D, second_causal_input_tx) -SAMPLER(3, FLOAT_2D, second_non_causal_input_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_van_vliet_gaussian_blur_sum.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .sampler(0, ImageType::FLOAT_2D, "first_causal_input_tx") + .sampler(1, ImageType::FLOAT_2D, "first_non_causal_input_tx") + .sampler(2, ImageType::FLOAT_2D, "second_causal_input_tx") + .sampler(3, ImageType::FLOAT_2D, "second_non_causal_input_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_van_vliet_gaussian_blur_sum.glsl") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_write_output_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_write_output_info.hh index ae9064cf0bf..cf4b32d5a8e 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_write_output_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_write_output_info.hh @@ -5,29 +5,25 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_write_output_shared) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(IVEC2, lower_bound) -PUSH_CONSTANT(IVEC2, upper_bound) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("compositor_write_output.glsl") -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::IVEC2, "lower_bound") + .push_constant(Type::IVEC2, "upper_bound") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("compositor_write_output.glsl"); GPU_SHADER_CREATE_INFO(compositor_write_output) -ADDITIONAL_INFO(compositor_write_output_shared) -DEFINE("DIRECT_OUTPUT") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_write_output_shared") + .define("DIRECT_OUTPUT") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_write_output_opaque) -ADDITIONAL_INFO(compositor_write_output_shared) -DEFINE("OPAQUE_OUTPUT") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_write_output_shared") + .define("OPAQUE_OUTPUT") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_write_output_alpha) -ADDITIONAL_INFO(compositor_write_output_shared) -SAMPLER(1, FLOAT_2D, alpha_tx) -DEFINE("ALPHA_OUTPUT") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("compositor_write_output_shared") + .sampler(1, ImageType::FLOAT_2D, "alpha_tx") + .define("ALPHA_OUTPUT") + .do_static_compilation(true); diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_z_combine_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_z_combine_info.hh index 925f01b945a..31043c7d354 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_z_combine_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_z_combine_info.hh @@ -5,37 +5,34 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_z_combine_simple) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(BOOL, use_alpha) -SAMPLER(0, FLOAT_2D, first_tx) -SAMPLER(1, FLOAT_2D, first_z_tx) -SAMPLER(2, FLOAT_2D, second_tx) -SAMPLER(3, FLOAT_2D, second_z_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, combined_img) -IMAGE(1, GPU_R16F, WRITE, FLOAT_2D, combined_z_img) -COMPUTE_SOURCE("compositor_z_combine_simple.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::BOOL, "use_alpha") + .sampler(0, ImageType::FLOAT_2D, "first_tx") + .sampler(1, ImageType::FLOAT_2D, "first_z_tx") + .sampler(2, ImageType::FLOAT_2D, "second_tx") + .sampler(3, ImageType::FLOAT_2D, "second_z_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "combined_img") + .image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "combined_z_img") + .compute_source("compositor_z_combine_simple.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_z_combine_compute_mask) -LOCAL_GROUP_SIZE(16, 16) -SAMPLER(0, FLOAT_2D, first_z_tx) -SAMPLER(1, FLOAT_2D, second_z_tx) -IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, mask_img) -COMPUTE_SOURCE("compositor_z_combine_compute_mask.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .sampler(0, ImageType::FLOAT_2D, "first_z_tx") + .sampler(1, ImageType::FLOAT_2D, "second_z_tx") + .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "mask_img") + .compute_source("compositor_z_combine_compute_mask.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(compositor_z_combine_from_mask) -LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(BOOL, use_alpha) -SAMPLER(0, FLOAT_2D, first_tx) -SAMPLER(1, FLOAT_2D, first_z_tx) -SAMPLER(2, FLOAT_2D, second_tx) -SAMPLER(3, FLOAT_2D, second_z_tx) -SAMPLER(4, FLOAT_2D, mask_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, combined_img) -IMAGE(1, GPU_R16F, WRITE, FLOAT_2D, combined_z_img) -COMPUTE_SOURCE("compositor_z_combine_from_mask.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16) + .push_constant(Type::BOOL, "use_alpha") + .sampler(0, ImageType::FLOAT_2D, "first_tx") + .sampler(1, ImageType::FLOAT_2D, "first_z_tx") + .sampler(2, ImageType::FLOAT_2D, "second_tx") + .sampler(3, ImageType::FLOAT_2D, "second_z_tx") + .sampler(4, ImageType::FLOAT_2D, "mask_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "combined_img") + .image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "combined_z_img") + .compute_source("compositor_z_combine_from_mask.glsl") + .do_static_compilation(true); diff --git a/source/blender/draw/engines/basic/shaders/infos/basic_depth_info.hh b/source/blender/draw/engines/basic/shaders/infos/basic_depth_info.hh index 30c848f2f5f..a9f3f6b90c3 100644 --- a/source/blender/draw/engines/basic/shaders/infos/basic_depth_info.hh +++ b/source/blender/draw/engines/basic/shaders/infos/basic_depth_info.hh @@ -11,9 +11,8 @@ * \{ */ GPU_SHADER_CREATE_INFO(basic_conservative) -GEOMETRY_LAYOUT(PrimitiveIn::TRIANGLES, PrimitiveOut::TRIANGLE_STRIP, 3) -GEOMETRY_SOURCE("basic_conservative_depth_geom.glsl") -GPU_SHADER_CREATE_END() + .geometry_layout(PrimitiveIn::TRIANGLES, PrimitiveOut::TRIANGLE_STRIP, 3) + .geometry_source("basic_conservative_depth_geom.glsl"); /** \} */ @@ -22,33 +21,28 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(basic_mesh) -VERTEX_IN(0, VEC3, pos) -VERTEX_SOURCE("basic_depth_vert.glsl") -ADDITIONAL_INFO(draw_mesh) -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC3, "pos") + .vertex_source("basic_depth_vert.glsl") + .additional_info("draw_mesh"); GPU_SHADER_CREATE_INFO(basic_pointcloud) -VERTEX_SOURCE("basic_depth_pointcloud_vert.glsl") -ADDITIONAL_INFO(draw_pointcloud) -GPU_SHADER_CREATE_END() + .vertex_source("basic_depth_pointcloud_vert.glsl") + .additional_info("draw_pointcloud"); GPU_SHADER_CREATE_INFO(basic_curves) -VERTEX_SOURCE("basic_depth_curves_vert.glsl") -ADDITIONAL_INFO(draw_hair) -GPU_SHADER_CREATE_END() + .vertex_source("basic_depth_curves_vert.glsl") + .additional_info("draw_hair"); /* Geometry-shader alternative paths. */ GPU_SHADER_CREATE_INFO(basic_mesh_conservative_no_geom) -VERTEX_IN(0, VEC3, pos) -VERTEX_SOURCE("basic_depth_vert_conservative_no_geom.glsl") -ADDITIONAL_INFO(draw_mesh) -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC3, "pos") + .vertex_source("basic_depth_vert_conservative_no_geom.glsl") + .additional_info("draw_mesh"); GPU_SHADER_CREATE_INFO(basic_pointcloud_conservative_no_geom) -DEFINE("CONSERVATIVE_RASTER") -VERTEX_SOURCE("basic_depth_pointcloud_vert.glsl") -ADDITIONAL_INFO(draw_pointcloud) -GPU_SHADER_CREATE_END() + .define("CONSERVATIVE_RASTER") + .vertex_source("basic_depth_pointcloud_vert.glsl") + .additional_info("draw_pointcloud"); /** \} */ @@ -79,9 +73,7 @@ GPU_SHADER_CREATE_END() /** \name Depth shader types. * \{ */ -GPU_SHADER_CREATE_INFO(basic_depth) -FRAGMENT_SOURCE("basic_depth_frag.glsl") -GPU_SHADER_CREATE_END() +GPU_SHADER_CREATE_INFO(basic_depth).fragment_source("basic_depth_frag.glsl"); BASIC_OBTYPE_VARIATIONS(basic_depth, "basic_depth", "draw_globals"); diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_ambient_occlusion_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_ambient_occlusion_info.hh index 7150b22a7b8..f64dc5c3bbd 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_ambient_occlusion_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_ambient_occlusion_info.hh @@ -6,20 +6,19 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(eevee_ambient_occlusion_pass) -DEFINE("HORIZON_OCCLUSION") -COMPUTE_SOURCE("eevee_ambient_occlusion_pass_comp.glsl") -LOCAL_GROUP_SIZE(AMBIENT_OCCLUSION_PASS_TILE_SIZE, AMBIENT_OCCLUSION_PASS_TILE_SIZE) -IMAGE(0, GPU_RGBA16F, READ, FLOAT_2D_ARRAY, in_normal_img) -PUSH_CONSTANT(INT, in_normal_img_layer_index) -IMAGE(1, GPU_R16F, WRITE, FLOAT_2D_ARRAY, out_ao_img) -PUSH_CONSTANT(INT, out_ao_img_layer_index) -SPECIALIZATION_CONSTANT(INT, ao_slice_count, 2) -SPECIALIZATION_CONSTANT(INT, ao_step_count, 8) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_hiz_data) -ADDITIONAL_INFO(eevee_sampling_data) -ADDITIONAL_INFO(eevee_utility_texture) -ADDITIONAL_INFO(eevee_global_ubo) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .define("HORIZON_OCCLUSION") + .compute_source("eevee_ambient_occlusion_pass_comp.glsl") + .local_group_size(AMBIENT_OCCLUSION_PASS_TILE_SIZE, AMBIENT_OCCLUSION_PASS_TILE_SIZE) + .image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D_ARRAY, "in_normal_img") + .push_constant(Type::INT, "in_normal_img_layer_index") + .image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_ao_img") + .push_constant(Type::INT, "out_ao_img_layer_index") + .specialization_constant(Type::INT, "ao_slice_count", 2) + .specialization_constant(Type::INT, "ao_step_count", 8) + .additional_info("draw_view") + .additional_info("eevee_shared") + .additional_info("eevee_hiz_data") + .additional_info("eevee_sampling_data") + .additional_info("eevee_utility_texture") + .additional_info("eevee_global_ubo") + .do_static_compilation(true); diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_deferred_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_deferred_info.hh index 48a7e3eb4e7..b1647c786a0 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_deferred_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_deferred_info.hh @@ -19,159 +19,149 @@ * \{ */ GPU_SHADER_CREATE_INFO(eevee_deferred_thickness_amend) -DO_STATIC_COMPILATION() -DEFINE("GBUFFER_LOAD") -SAMPLER(0, UINT_2D, gbuf_header_tx) -IMAGE(0, GPU_RG16, READ_WRITE, FLOAT_2D_ARRAY, gbuf_normal_img) -/* Early fragment test is needed to discard fragment that do not need this processing. */ -EARLY_FRAGMENT_TEST(true) -FRAGMENT_SOURCE("eevee_deferred_thickness_amend_frag.glsl") -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_fullscreen) -ADDITIONAL_INFO(eevee_sampling_data) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_light_data) -ADDITIONAL_INFO(eevee_shadow_data) -ADDITIONAL_INFO(eevee_hiz_data) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("GBUFFER_LOAD") + .sampler(0, ImageType::UINT_2D, "gbuf_header_tx") + .image(0, GPU_RG16, Qualifier::READ_WRITE, ImageType::FLOAT_2D_ARRAY, "gbuf_normal_img") + /* Early fragment test is needed to discard fragment that do not need this processing. */ + .early_fragment_test(true) + .fragment_source("eevee_deferred_thickness_amend_frag.glsl") + .additional_info("draw_view") + .additional_info("draw_fullscreen") + .additional_info("eevee_sampling_data") + .additional_info("eevee_shared") + .additional_info("eevee_light_data") + .additional_info("eevee_shadow_data") + .additional_info("eevee_hiz_data"); /** \} */ GPU_SHADER_CREATE_INFO(eevee_gbuffer_data) -DEFINE("GBUFFER_LOAD") -SAMPLER(12, UINT_2D, gbuf_header_tx) -SAMPLER(13, FLOAT_2D_ARRAY, gbuf_closure_tx) -SAMPLER(14, FLOAT_2D_ARRAY, gbuf_normal_tx) -GPU_SHADER_CREATE_END() + .define("GBUFFER_LOAD") + .sampler(12, ImageType::UINT_2D, "gbuf_header_tx") + .sampler(13, ImageType::FLOAT_2D_ARRAY, "gbuf_closure_tx") + .sampler(14, ImageType::FLOAT_2D_ARRAY, "gbuf_normal_tx"); GPU_SHADER_CREATE_INFO(eevee_deferred_tile_classify) -FRAGMENT_SOURCE("eevee_deferred_tile_classify_frag.glsl") -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_fullscreen) -SUBPASS_IN(1, UINT, in_gbuffer_header, DEFERRED_GBUFFER_ROG_ID) -TYPEDEF_SOURCE("draw_shader_shared.hh") -PUSH_CONSTANT(INT, current_bit) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .fragment_source("eevee_deferred_tile_classify_frag.glsl") + .additional_info("eevee_shared") + .additional_info("draw_fullscreen") + .subpass_in(1, Type::UINT, "in_gbuffer_header", DEFERRED_GBUFFER_ROG_ID) + .typedef_source("draw_shader_shared.hh") + .push_constant(Type::INT, "current_bit") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(eevee_deferred_light) -FRAGMENT_SOURCE("eevee_deferred_light_frag.glsl") -/* Early fragment test is needed to avoid processing background fragments. */ -EARLY_FRAGMENT_TEST(true) -FRAGMENT_OUT(0, VEC4, out_combined) -/* Chaining to next pass. */ -IMAGE_FREQ(2, DEFERRED_RADIANCE_FORMAT, WRITE, UINT_2D, direct_radiance_1_img, PASS) -IMAGE_FREQ(3, DEFERRED_RADIANCE_FORMAT, WRITE, UINT_2D, direct_radiance_2_img, PASS) -IMAGE_FREQ(4, DEFERRED_RADIANCE_FORMAT, WRITE, UINT_2D, direct_radiance_3_img, PASS) -/* Optimized out if use_split_indirect is false. */ -IMAGE_FREQ(5, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, indirect_radiance_1_img, PASS) -IMAGE_FREQ(6, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, indirect_radiance_2_img, PASS) -IMAGE_FREQ(7, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, indirect_radiance_3_img, PASS) -SPECIALIZATION_CONSTANT(BOOL, use_split_indirect, false) -SPECIALIZATION_CONSTANT(BOOL, use_lightprobe_eval, false) -SPECIALIZATION_CONSTANT(BOOL, use_transmission, false) -SPECIALIZATION_CONSTANT(INT, render_pass_shadow_id, -1) -DEFINE("SPECIALIZED_SHADOW_PARAMS") -SPECIALIZATION_CONSTANT(INT, shadow_ray_count, 1) -SPECIALIZATION_CONSTANT(INT, shadow_ray_step_count, 6) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_gbuffer_data) -ADDITIONAL_INFO(eevee_utility_texture) -ADDITIONAL_INFO(eevee_sampling_data) -ADDITIONAL_INFO(eevee_light_data) -ADDITIONAL_INFO(eevee_shadow_data) -ADDITIONAL_INFO(eevee_hiz_data) -ADDITIONAL_INFO(eevee_lightprobe_data) -ADDITIONAL_INFO(eevee_render_pass_out) -ADDITIONAL_INFO(draw_fullscreen) -ADDITIONAL_INFO(draw_view) -GPU_SHADER_CREATE_END() + .fragment_source("eevee_deferred_light_frag.glsl") + /* Early fragment test is needed to avoid processing background fragments. */ + .early_fragment_test(true) + .fragment_out(0, Type::VEC4, "out_combined") + /* Chaining to next pass. */ + .uimage_out(2, DEFERRED_RADIANCE_FORMAT, "direct_radiance_1_img") + .uimage_out(3, DEFERRED_RADIANCE_FORMAT, "direct_radiance_2_img") + .uimage_out(4, DEFERRED_RADIANCE_FORMAT, "direct_radiance_3_img") + /* Optimized out if use_split_indirect is false. */ + .image_out(5, RAYTRACE_RADIANCE_FORMAT, "indirect_radiance_1_img") + .image_out(6, RAYTRACE_RADIANCE_FORMAT, "indirect_radiance_2_img") + .image_out(7, RAYTRACE_RADIANCE_FORMAT, "indirect_radiance_3_img") + .specialization_constant(Type::BOOL, "use_split_indirect", false) + .specialization_constant(Type::BOOL, "use_lightprobe_eval", false) + .specialization_constant(Type::BOOL, "use_transmission", false) + .specialization_constant(Type::INT, "render_pass_shadow_id", -1) + .define("SPECIALIZED_SHADOW_PARAMS") + .specialization_constant(Type::INT, "shadow_ray_count", 1) + .specialization_constant(Type::INT, "shadow_ray_step_count", 6) + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data") + .additional_info("eevee_utility_texture") + .additional_info("eevee_sampling_data") + .additional_info("eevee_light_data") + .additional_info("eevee_shadow_data") + .additional_info("eevee_hiz_data") + .additional_info("eevee_lightprobe_data") + .additional_info("eevee_render_pass_out") + .additional_info("draw_fullscreen") + .additional_info("draw_view"); GPU_SHADER_CREATE_INFO(eevee_deferred_light_single) -ADDITIONAL_INFO(eevee_deferred_light) -DEFINE_VALUE("LIGHT_CLOSURE_EVAL_COUNT", "1") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("eevee_deferred_light") + .define("LIGHT_CLOSURE_EVAL_COUNT", "1") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(eevee_deferred_light_double) -ADDITIONAL_INFO(eevee_deferred_light) -DEFINE_VALUE("LIGHT_CLOSURE_EVAL_COUNT", "2") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("eevee_deferred_light") + .define("LIGHT_CLOSURE_EVAL_COUNT", "2") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(eevee_deferred_light_triple) -ADDITIONAL_INFO(eevee_deferred_light) -DEFINE_VALUE("LIGHT_CLOSURE_EVAL_COUNT", "3") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("eevee_deferred_light") + .define("LIGHT_CLOSURE_EVAL_COUNT", "3") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(eevee_deferred_combine) -/* Early fragment test is needed to avoid processing fragments background fragments. */ -EARLY_FRAGMENT_TEST(true) -/* Inputs. */ -SAMPLER(2, UINT_2D, direct_radiance_1_tx) -SAMPLER(3, UINT_2D, direct_radiance_2_tx) -SAMPLER(4, UINT_2D, direct_radiance_3_tx) -SAMPLER(5, FLOAT_2D, indirect_radiance_1_tx) -SAMPLER(6, FLOAT_2D, indirect_radiance_2_tx) -SAMPLER(7, FLOAT_2D, indirect_radiance_3_tx) -IMAGE(5, GPU_RGBA16F, READ_WRITE, FLOAT_2D, radiance_feedback_img) -FRAGMENT_OUT(0, VEC4, out_combined) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_gbuffer_data) -ADDITIONAL_INFO(eevee_render_pass_out) -ADDITIONAL_INFO(draw_fullscreen) -FRAGMENT_SOURCE("eevee_deferred_combine_frag.glsl") -/* NOTE: Both light IDs have a valid specialized assignment of '-1' so only when default is - * present will we instead dynamically look-up ID from the uniform buffer. */ -SPECIALIZATION_CONSTANT(BOOL, render_pass_diffuse_light_enabled, true) -SPECIALIZATION_CONSTANT(BOOL, render_pass_specular_light_enabled, true) -SPECIALIZATION_CONSTANT(BOOL, render_pass_normal_enabled, true) -SPECIALIZATION_CONSTANT(BOOL, use_radiance_feedback, false) -SPECIALIZATION_CONSTANT(BOOL, use_split_radiance, false) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + /* Early fragment test is needed to avoid processing fragments background fragments. */ + .early_fragment_test(true) + /* Inputs. */ + .sampler(2, ImageType::UINT_2D, "direct_radiance_1_tx") + .sampler(3, ImageType::UINT_2D, "direct_radiance_2_tx") + .sampler(4, ImageType::UINT_2D, "direct_radiance_3_tx") + .sampler(5, ImageType::FLOAT_2D, "indirect_radiance_1_tx") + .sampler(6, ImageType::FLOAT_2D, "indirect_radiance_2_tx") + .sampler(7, ImageType::FLOAT_2D, "indirect_radiance_3_tx") + .image(5, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "radiance_feedback_img") + .fragment_out(0, Type::VEC4, "out_combined") + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data") + .additional_info("eevee_render_pass_out") + .additional_info("draw_fullscreen") + .fragment_source("eevee_deferred_combine_frag.glsl") + /* NOTE: Both light IDs have a valid specialized assignment of '-1' so only when default is + * present will we instead dynamically look-up ID from the uniform buffer. */ + .specialization_constant(Type::BOOL, "render_pass_diffuse_light_enabled", true) + .specialization_constant(Type::BOOL, "render_pass_specular_light_enabled", true) + .specialization_constant(Type::BOOL, "render_pass_normal_enabled", true) + .specialization_constant(Type::BOOL, "use_radiance_feedback", false) + .specialization_constant(Type::BOOL, "use_split_radiance", false) + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(eevee_deferred_capture_eval) -/* Early fragment test is needed to avoid processing fragments without correct GBuffer data. */ -EARLY_FRAGMENT_TEST(true) -/* Inputs. */ -FRAGMENT_OUT(0, VEC4, out_radiance) -DEFINE_VALUE("LIGHT_CLOSURE_EVAL_COUNT", "1") -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_gbuffer_data) -ADDITIONAL_INFO(eevee_utility_texture) -ADDITIONAL_INFO(eevee_sampling_data) -ADDITIONAL_INFO(eevee_light_data) -ADDITIONAL_INFO(eevee_shadow_data) -ADDITIONAL_INFO(eevee_hiz_data) -ADDITIONAL_INFO(eevee_volume_probe_data) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_fullscreen) -FRAGMENT_SOURCE("eevee_deferred_capture_frag.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + /* Early fragment test is needed to avoid processing fragments without correct GBuffer data. */ + .early_fragment_test(true) + /* Inputs. */ + .fragment_out(0, Type::VEC4, "out_radiance") + .define("LIGHT_CLOSURE_EVAL_COUNT", "1") + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data") + .additional_info("eevee_utility_texture") + .additional_info("eevee_sampling_data") + .additional_info("eevee_light_data") + .additional_info("eevee_shadow_data") + .additional_info("eevee_hiz_data") + .additional_info("eevee_volume_probe_data") + .additional_info("draw_view") + .additional_info("draw_fullscreen") + .fragment_source("eevee_deferred_capture_frag.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(eevee_deferred_planar_eval) -/* Early fragment test is needed to avoid processing fragments without correct GBuffer data. */ -EARLY_FRAGMENT_TEST(true) -/* Inputs. */ -FRAGMENT_OUT(0, VEC4, out_radiance) -DEFINE("SPHERE_PROBE") -DEFINE_VALUE("LIGHT_CLOSURE_EVAL_COUNT", "1") -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_gbuffer_data) -ADDITIONAL_INFO(eevee_utility_texture) -ADDITIONAL_INFO(eevee_sampling_data) -ADDITIONAL_INFO(eevee_light_data) -ADDITIONAL_INFO(eevee_lightprobe_data) -ADDITIONAL_INFO(eevee_shadow_data) -ADDITIONAL_INFO(eevee_hiz_data) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_fullscreen) -FRAGMENT_SOURCE("eevee_deferred_planar_frag.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + /* Early fragment test is needed to avoid processing fragments without correct GBuffer data. */ + .early_fragment_test(true) + /* Inputs. */ + .fragment_out(0, Type::VEC4, "out_radiance") + .define("SPHERE_PROBE") + .define("LIGHT_CLOSURE_EVAL_COUNT", "1") + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data") + .additional_info("eevee_utility_texture") + .additional_info("eevee_sampling_data") + .additional_info("eevee_light_data") + .additional_info("eevee_lightprobe_data") + .additional_info("eevee_shadow_data") + .additional_info("eevee_hiz_data") + .additional_info("draw_view") + .additional_info("draw_fullscreen") + .fragment_source("eevee_deferred_planar_frag.glsl") + .do_static_compilation(true); #undef image_array_out #undef image_out @@ -182,15 +172,14 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(eevee_debug_gbuffer) -DO_STATIC_COMPILATION() -FRAGMENT_OUT_DUAL(0, VEC4, out_color_add, SRC_0) -FRAGMENT_OUT_DUAL(0, VEC4, out_color_mul, SRC_1) -PUSH_CONSTANT(INT, debug_mode) -FRAGMENT_SOURCE("eevee_debug_gbuffer_frag.glsl") -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_fullscreen) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_gbuffer_data) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .fragment_out(0, Type::VEC4, "out_color_add", DualBlend::SRC_0) + .fragment_out(0, Type::VEC4, "out_color_mul", DualBlend::SRC_1) + .push_constant(Type::INT, "debug_mode") + .fragment_source("eevee_debug_gbuffer_frag.glsl") + .additional_info("draw_view") + .additional_info("draw_fullscreen") + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data"); /** \} */ diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_depth_of_field_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_depth_of_field_info.hh index 858b8ff75f2..3d1644bfe12 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_depth_of_field_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_depth_of_field_info.hh @@ -10,81 +10,76 @@ * \{ */ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_bokeh_lut) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(DOF_BOKEH_LUT_SIZE, DOF_BOKEH_LUT_SIZE) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_view) -UNIFORM_BUF(6, DepthOfFieldData, dof_buf) -IMAGE(0, GPU_RG16F, WRITE, FLOAT_2D, out_gather_lut_img) -IMAGE(1, GPU_R16F, WRITE, FLOAT_2D, out_scatter_lut_img) -IMAGE(2, GPU_R16F, WRITE, FLOAT_2D, out_resolve_lut_img) -COMPUTE_SOURCE("eevee_depth_of_field_bokeh_lut_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(DOF_BOKEH_LUT_SIZE, DOF_BOKEH_LUT_SIZE) + .additional_info("eevee_shared") + .additional_info("draw_view") + .uniform_buf(6, "DepthOfFieldData", "dof_buf") + .image(0, GPU_RG16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_gather_lut_img") + .image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_scatter_lut_img") + .image(2, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_resolve_lut_img") + .compute_source("eevee_depth_of_field_bokeh_lut_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_depth_of_field_setup) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(DOF_DEFAULT_GROUP_SIZE, DOF_DEFAULT_GROUP_SIZE) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_view) -UNIFORM_BUF(6, DepthOfFieldData, dof_buf) -SAMPLER(0, FLOAT_2D, color_tx) -SAMPLER(1, DEPTH_2D, depth_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_img) -IMAGE(1, GPU_R16F, WRITE, FLOAT_2D, out_coc_img) -COMPUTE_SOURCE("eevee_depth_of_field_setup_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(DOF_DEFAULT_GROUP_SIZE, DOF_DEFAULT_GROUP_SIZE) + .additional_info("eevee_shared") + .additional_info("draw_view") + .uniform_buf(6, "DepthOfFieldData", "dof_buf") + .sampler(0, ImageType::FLOAT_2D, "color_tx") + .sampler(1, ImageType::DEPTH_2D, "depth_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img") + .image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_coc_img") + .compute_source("eevee_depth_of_field_setup_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_depth_of_field_stabilize) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(DOF_STABILIZE_GROUP_SIZE, DOF_STABILIZE_GROUP_SIZE) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(eevee_velocity_camera) -UNIFORM_BUF(6, DepthOfFieldData, dof_buf) -SAMPLER(0, FLOAT_2D, coc_tx) -SAMPLER(1, FLOAT_2D, color_tx) -SAMPLER(2, FLOAT_2D, velocity_tx) -SAMPLER(3, FLOAT_2D, in_history_tx) -SAMPLER(4, DEPTH_2D, depth_tx) -PUSH_CONSTANT(BOOL, u_use_history) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_img) -IMAGE(1, GPU_R16F, WRITE, FLOAT_2D, out_coc_img) -IMAGE(2, GPU_RGBA16F, WRITE, FLOAT_2D, out_history_img) -COMPUTE_SOURCE("eevee_depth_of_field_stabilize_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(DOF_STABILIZE_GROUP_SIZE, DOF_STABILIZE_GROUP_SIZE) + .additional_info("eevee_shared") + .additional_info("draw_view") + .additional_info("eevee_velocity_camera") + .uniform_buf(6, "DepthOfFieldData", "dof_buf") + .sampler(0, ImageType::FLOAT_2D, "coc_tx") + .sampler(1, ImageType::FLOAT_2D, "color_tx") + .sampler(2, ImageType::FLOAT_2D, "velocity_tx") + .sampler(3, ImageType::FLOAT_2D, "in_history_tx") + .sampler(4, ImageType::DEPTH_2D, "depth_tx") + .push_constant(Type::BOOL, "u_use_history") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img") + .image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_coc_img") + .image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_history_img") + .compute_source("eevee_depth_of_field_stabilize_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_depth_of_field_downsample) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(DOF_DEFAULT_GROUP_SIZE, DOF_DEFAULT_GROUP_SIZE) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_view) -SAMPLER(0, FLOAT_2D, color_tx) -SAMPLER(1, FLOAT_2D, coc_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_img) -COMPUTE_SOURCE("eevee_depth_of_field_downsample_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(DOF_DEFAULT_GROUP_SIZE, DOF_DEFAULT_GROUP_SIZE) + .additional_info("eevee_shared") + .additional_info("draw_view") + .sampler(0, ImageType::FLOAT_2D, "color_tx") + .sampler(1, ImageType::FLOAT_2D, "coc_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img") + .compute_source("eevee_depth_of_field_downsample_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_depth_of_field_reduce) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(DOF_REDUCE_GROUP_SIZE, DOF_REDUCE_GROUP_SIZE) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_view) -UNIFORM_BUF(6, DepthOfFieldData, dof_buf) -SAMPLER(0, FLOAT_2D, downsample_tx) -STORAGE_BUF(0, WRITE, ScatterRect, scatter_fg_list_buf[]) -STORAGE_BUF(1, WRITE, ScatterRect, scatter_bg_list_buf[]) -STORAGE_BUF(2, READ_WRITE, DrawCommand, scatter_fg_indirect_buf) -STORAGE_BUF(3, READ_WRITE, DrawCommand, scatter_bg_indirect_buf) -IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, inout_color_lod0_img) -IMAGE(1, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_lod1_img) -IMAGE(2, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_lod2_img) -IMAGE(3, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_lod3_img) -IMAGE(4, GPU_R16F, READ, FLOAT_2D, in_coc_lod0_img) -IMAGE(5, GPU_R16F, WRITE, FLOAT_2D, out_coc_lod1_img) -IMAGE(6, GPU_R16F, WRITE, FLOAT_2D, out_coc_lod2_img) -IMAGE(7, GPU_R16F, WRITE, FLOAT_2D, out_coc_lod3_img) -COMPUTE_SOURCE("eevee_depth_of_field_reduce_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(DOF_REDUCE_GROUP_SIZE, DOF_REDUCE_GROUP_SIZE) + .additional_info("eevee_shared") + .additional_info("draw_view") + .uniform_buf(6, "DepthOfFieldData", "dof_buf") + .sampler(0, ImageType::FLOAT_2D, "downsample_tx") + .storage_buf(0, Qualifier::WRITE, "ScatterRect", "scatter_fg_list_buf[]") + .storage_buf(1, Qualifier::WRITE, "ScatterRect", "scatter_bg_list_buf[]") + .storage_buf(2, Qualifier::READ_WRITE, "DrawCommand", "scatter_fg_indirect_buf") + .storage_buf(3, Qualifier::READ_WRITE, "DrawCommand", "scatter_bg_indirect_buf") + .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "inout_color_lod0_img") + .image(1, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_lod1_img") + .image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_lod2_img") + .image(3, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_lod3_img") + .image(4, GPU_R16F, Qualifier::READ, ImageType::FLOAT_2D, "in_coc_lod0_img") + .image(5, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_coc_lod1_img") + .image(6, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_coc_lod2_img") + .image(7, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_coc_lod3_img") + .compute_source("eevee_depth_of_field_reduce_comp.glsl"); /** \} */ @@ -93,44 +88,39 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_tiles_flatten) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(DOF_TILES_FLATTEN_GROUP_SIZE, DOF_TILES_FLATTEN_GROUP_SIZE) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_view) -SAMPLER(0, FLOAT_2D, coc_tx) -IMAGE(2, GPU_R11F_G11F_B10F, WRITE, FLOAT_2D, out_tiles_fg_img) -IMAGE(3, GPU_R11F_G11F_B10F, WRITE, FLOAT_2D, out_tiles_bg_img) -COMPUTE_SOURCE("eevee_depth_of_field_tiles_flatten_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(DOF_TILES_FLATTEN_GROUP_SIZE, DOF_TILES_FLATTEN_GROUP_SIZE) + .additional_info("eevee_shared") + .additional_info("draw_view") + .sampler(0, ImageType::FLOAT_2D, "coc_tx") + .image(2, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_tiles_fg_img") + .image(3, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_tiles_bg_img") + .compute_source("eevee_depth_of_field_tiles_flatten_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_depth_of_field_tiles_dilate) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(eevee_depth_of_field_tiles_common) -LOCAL_GROUP_SIZE(DOF_TILES_DILATE_GROUP_SIZE, DOF_TILES_DILATE_GROUP_SIZE) -IMAGE(2, GPU_R11F_G11F_B10F, WRITE, FLOAT_2D, out_tiles_fg_img) -IMAGE(3, GPU_R11F_G11F_B10F, WRITE, FLOAT_2D, out_tiles_bg_img) -PUSH_CONSTANT(INT, ring_count) -PUSH_CONSTANT(INT, ring_width_multiplier) -COMPUTE_SOURCE("eevee_depth_of_field_tiles_dilate_comp.glsl") -GPU_SHADER_CREATE_END() + .additional_info("eevee_shared") + .additional_info("draw_view") + .additional_info("eevee_depth_of_field_tiles_common") + .local_group_size(DOF_TILES_DILATE_GROUP_SIZE, DOF_TILES_DILATE_GROUP_SIZE) + .image(2, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_tiles_fg_img") + .image(3, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_tiles_bg_img") + .push_constant(Type::INT, "ring_count") + .push_constant(Type::INT, "ring_width_multiplier") + .compute_source("eevee_depth_of_field_tiles_dilate_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_depth_of_field_tiles_dilate_minabs) -DO_STATIC_COMPILATION() -DEFINE_VALUE("DILATE_MODE_MIN_MAX", "false") -ADDITIONAL_INFO(eevee_depth_of_field_tiles_dilate) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("DILATE_MODE_MIN_MAX", "false") + .additional_info("eevee_depth_of_field_tiles_dilate"); GPU_SHADER_CREATE_INFO(eevee_depth_of_field_tiles_dilate_minmax) -DO_STATIC_COMPILATION() -DEFINE_VALUE("DILATE_MODE_MIN_MAX", "true") -ADDITIONAL_INFO(eevee_depth_of_field_tiles_dilate) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("DILATE_MODE_MIN_MAX", "true") + .additional_info("eevee_depth_of_field_tiles_dilate"); GPU_SHADER_CREATE_INFO(eevee_depth_of_field_tiles_common) -IMAGE(0, GPU_R11F_G11F_B10F, READ, FLOAT_2D, in_tiles_fg_img) -IMAGE(1, GPU_R11F_G11F_B10F, READ, FLOAT_2D, in_tiles_bg_img) -GPU_SHADER_CREATE_END() + .image(0, GPU_R11F_G11F_B10F, Qualifier::READ, ImageType::FLOAT_2D, "in_tiles_fg_img") + .image(1, GPU_R11F_G11F_B10F, Qualifier::READ, ImageType::FLOAT_2D, "in_tiles_bg_img"); /** \} */ @@ -139,25 +129,19 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_no_lut) -DEFINE_VALUE("DOF_BOKEH_TEXTURE", "false") -/** - * WORKAROUND(@fclem): This is to keep the code as is for now. The bokeh_lut_tx is referenced - * even if not used after optimization. But we don't want to include it in the create infos. - */ -DEFINE_VALUE("bokeh_lut_tx", "color_tx") -GPU_SHADER_CREATE_END() + .define("DOF_BOKEH_TEXTURE", "false") + /** + * WORKAROUND(@fclem): This is to keep the code as is for now. The bokeh_lut_tx is referenced + * even if not used after optimization. But we don't want to include it in the create infos. + */ + .define("bokeh_lut_tx", "color_tx"); GPU_SHADER_CREATE_INFO(eevee_depth_of_field_lut) -DEFINE_VALUE("DOF_BOKEH_TEXTURE", "true") -SAMPLER(5, FLOAT_2D, bokeh_lut_tx) -GPU_SHADER_CREATE_END() + .define("DOF_BOKEH_TEXTURE", "true") + .sampler(5, ImageType::FLOAT_2D, "bokeh_lut_tx"); -GPU_SHADER_CREATE_INFO(eevee_depth_of_field_background) -DEFINE_VALUE("DOF_FOREGROUND_PASS", "false") -GPU_SHADER_CREATE_END() -GPU_SHADER_CREATE_INFO(eevee_depth_of_field_foreground) -DEFINE_VALUE("DOF_FOREGROUND_PASS", "true") -GPU_SHADER_CREATE_END() +GPU_SHADER_CREATE_INFO(eevee_depth_of_field_background).define("DOF_FOREGROUND_PASS", "false"); +GPU_SHADER_CREATE_INFO(eevee_depth_of_field_foreground).define("DOF_FOREGROUND_PASS", "true"); #define EEVEE_DOF_FINAL_VARIATION(name, ...) \ GPU_SHADER_CREATE_INFO(name).additional_info(__VA_ARGS__).do_static_compilation(true); @@ -177,46 +161,40 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_gather_common) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(eevee_depth_of_field_tiles_common) -ADDITIONAL_INFO(eevee_sampling_data) -UNIFORM_BUF(6, DepthOfFieldData, dof_buf) -LOCAL_GROUP_SIZE(DOF_GATHER_GROUP_SIZE, DOF_GATHER_GROUP_SIZE) -SAMPLER(0, FLOAT_2D, color_tx) -SAMPLER(1, FLOAT_2D, color_bilinear_tx) -SAMPLER(2, FLOAT_2D, coc_tx) -IMAGE(2, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_img) -IMAGE(3, GPU_R16F, WRITE, FLOAT_2D, out_weight_img) -GPU_SHADER_CREATE_END() + .additional_info("eevee_shared") + .additional_info("draw_view") + .additional_info("eevee_depth_of_field_tiles_common") + .additional_info("eevee_sampling_data") + .uniform_buf(6, "DepthOfFieldData", "dof_buf") + .local_group_size(DOF_GATHER_GROUP_SIZE, DOF_GATHER_GROUP_SIZE) + .sampler(0, ImageType::FLOAT_2D, "color_tx") + .sampler(1, ImageType::FLOAT_2D, "color_bilinear_tx") + .sampler(2, ImageType::FLOAT_2D, "coc_tx") + .image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img") + .image(3, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_weight_img"); GPU_SHADER_CREATE_INFO(eevee_depth_of_field_gather) -IMAGE(4, GPU_RG16F, WRITE, FLOAT_2D, out_occlusion_img) -COMPUTE_SOURCE("eevee_depth_of_field_gather_comp.glsl") -ADDITIONAL_INFO(eevee_depth_of_field_gather_common) -GPU_SHADER_CREATE_END() + .image(4, GPU_RG16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_occlusion_img") + .compute_source("eevee_depth_of_field_gather_comp.glsl") + .additional_info("eevee_depth_of_field_gather_common"); EEVEE_DOF_GROUND_VARIATIONS(eevee_depth_of_field_gather, "eevee_depth_of_field_gather") GPU_SHADER_CREATE_INFO(eevee_depth_of_field_hole_fill) -DO_STATIC_COMPILATION() -COMPUTE_SOURCE("eevee_depth_of_field_hole_fill_comp.glsl") -ADDITIONAL_INFO(eevee_depth_of_field_gather_common) -ADDITIONAL_INFO(eevee_depth_of_field_no_lut) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .compute_source("eevee_depth_of_field_hole_fill_comp.glsl") + .additional_info("eevee_depth_of_field_gather_common") + .additional_info("eevee_depth_of_field_no_lut"); GPU_SHADER_CREATE_INFO(eevee_depth_of_field_filter) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(DOF_FILTER_GROUP_SIZE, DOF_FILTER_GROUP_SIZE) -ADDITIONAL_INFO(eevee_shared) -SAMPLER(0, FLOAT_2D, color_tx) -SAMPLER(1, FLOAT_2D, weight_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_img) -IMAGE(1, GPU_R16F, WRITE, FLOAT_2D, out_weight_img) -COMPUTE_SOURCE( - "eevee_depth_of_field_" - "filter_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(DOF_FILTER_GROUP_SIZE, DOF_FILTER_GROUP_SIZE) + .additional_info("eevee_shared") + .sampler(0, ImageType::FLOAT_2D, "color_tx") + .sampler(1, ImageType::FLOAT_2D, "weight_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img") + .image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_weight_img") + .compute_source("eevee_depth_of_field_filter_comp.glsl"); /** \} */ @@ -225,38 +203,35 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_NAMED_INTERFACE_INFO(eevee_depth_of_field_scatter_flat_iface, interp_flat) -/** Colors, weights, and Circle of confusion radii for the 4 pixels to scatter. */ -FLAT(VEC4, color_and_coc1) -FLAT(VEC4, color_and_coc2) -FLAT(VEC4, color_and_coc3) -FLAT(VEC4, color_and_coc4) -/** Scaling factor for the bokeh distance. */ -FLAT(FLOAT, distance_scale) -GPU_SHADER_INTERFACE_END() + /** Colors, weights, and Circle of confusion radii for the 4 pixels to scatter. */ + .flat(Type::VEC4, "color_and_coc1") + .flat(Type::VEC4, "color_and_coc2") + .flat(Type::VEC4, "color_and_coc3") + .flat(Type::VEC4, "color_and_coc4") + /** Scaling factor for the bokeh distance. */ + .flat(Type::FLOAT, "distance_scale"); GPU_SHADER_NAMED_INTERFACE_INFO(eevee_depth_of_field_scatter_noperspective_iface, interp_noperspective) -/** Sprite pixel position with origin at sprite center. In pixels. */ -NO_PERSPECTIVE(VEC2, rect_uv1) -NO_PERSPECTIVE(VEC2, rect_uv2) -NO_PERSPECTIVE(VEC2, rect_uv3) -NO_PERSPECTIVE(VEC2, rect_uv4) -GPU_SHADER_INTERFACE_END() + /** Sprite pixel position with origin at sprite center. In pixels. */ + .no_perspective(Type::VEC2, "rect_uv1") + .no_perspective(Type::VEC2, "rect_uv2") + .no_perspective(Type::VEC2, "rect_uv3") + .no_perspective(Type::VEC2, "rect_uv4"); GPU_SHADER_CREATE_INFO(eevee_depth_of_field_scatter) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_view) -SAMPLER(0, FLOAT_2D, occlusion_tx) -SAMPLER(1, FLOAT_2D, bokeh_lut_tx) -UNIFORM_BUF(6, DepthOfFieldData, dof_buf) -STORAGE_BUF(0, READ, ScatterRect, scatter_list_buf[]) -FRAGMENT_OUT(0, VEC4, out_color) -PUSH_CONSTANT(BOOL, use_bokeh_lut) -VERTEX_OUT(eevee_depth_of_field_scatter_flat_iface) -VERTEX_OUT(eevee_depth_of_field_scatter_noperspective_iface) -VERTEX_SOURCE("eevee_depth_of_field_scatter_vert.glsl") -FRAGMENT_SOURCE("eevee_depth_of_field_scatter_frag.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("eevee_shared") + .additional_info("draw_view") + .sampler(0, ImageType::FLOAT_2D, "occlusion_tx") + .sampler(1, ImageType::FLOAT_2D, "bokeh_lut_tx") + .uniform_buf(6, "DepthOfFieldData", "dof_buf") + .storage_buf(0, Qualifier::READ, "ScatterRect", "scatter_list_buf[]") + .fragment_out(0, Type::VEC4, "out_color") + .push_constant(Type::BOOL, "use_bokeh_lut") + .vertex_out(eevee_depth_of_field_scatter_flat_iface) + .vertex_out(eevee_depth_of_field_scatter_noperspective_iface) + .vertex_source("eevee_depth_of_field_scatter_vert.glsl") + .fragment_source("eevee_depth_of_field_scatter_frag.glsl"); /** \} */ @@ -265,26 +240,25 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_resolve) -DEFINE_VALUE("DOF_RESOLVE_PASS", "true") -LOCAL_GROUP_SIZE(DOF_RESOLVE_GROUP_SIZE, DOF_RESOLVE_GROUP_SIZE) -SPECIALIZATION_CONSTANT(BOOL, do_debug_color, false) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(eevee_depth_of_field_tiles_common) -ADDITIONAL_INFO(eevee_sampling_data) -UNIFORM_BUF(6, DepthOfFieldData, dof_buf) -SAMPLER(0, DEPTH_2D, depth_tx) -SAMPLER(1, FLOAT_2D, color_tx) -SAMPLER(2, FLOAT_2D, color_bg_tx) -SAMPLER(3, FLOAT_2D, color_fg_tx) -SAMPLER(4, FLOAT_2D, color_hole_fill_tx) -SAMPLER(7, FLOAT_2D, weight_bg_tx) -SAMPLER(8, FLOAT_2D, weight_fg_tx) -SAMPLER(9, FLOAT_2D, weight_hole_fill_tx) -SAMPLER(10, FLOAT_2D, stable_color_tx) -IMAGE(2, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_img) -COMPUTE_SOURCE("eevee_depth_of_field_resolve_comp.glsl") -GPU_SHADER_CREATE_END() + .define("DOF_RESOLVE_PASS", "true") + .local_group_size(DOF_RESOLVE_GROUP_SIZE, DOF_RESOLVE_GROUP_SIZE) + .specialization_constant(Type::BOOL, "do_debug_color", false) + .additional_info("eevee_shared") + .additional_info("draw_view") + .additional_info("eevee_depth_of_field_tiles_common") + .additional_info("eevee_sampling_data") + .uniform_buf(6, "DepthOfFieldData", "dof_buf") + .sampler(0, ImageType::DEPTH_2D, "depth_tx") + .sampler(1, ImageType::FLOAT_2D, "color_tx") + .sampler(2, ImageType::FLOAT_2D, "color_bg_tx") + .sampler(3, ImageType::FLOAT_2D, "color_fg_tx") + .sampler(4, ImageType::FLOAT_2D, "color_hole_fill_tx") + .sampler(7, ImageType::FLOAT_2D, "weight_bg_tx") + .sampler(8, ImageType::FLOAT_2D, "weight_fg_tx") + .sampler(9, ImageType::FLOAT_2D, "weight_hole_fill_tx") + .sampler(10, ImageType::FLOAT_2D, "stable_color_tx") + .image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img") + .compute_source("eevee_depth_of_field_resolve_comp.glsl"); EEVEE_DOF_LUT_VARIATIONS(eevee_depth_of_field_resolve, "eevee_depth_of_field_resolve") diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_film_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_film_info.hh index 091e80993a0..fda797d9833 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_film_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_film_info.hh @@ -6,131 +6,120 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(eevee_film_base) -SAMPLER(0, DEPTH_2D, depth_tx) -SAMPLER(1, FLOAT_2D, combined_tx) -SAMPLER(2, FLOAT_2D, vector_tx) -SAMPLER(3, FLOAT_2D_ARRAY, rp_color_tx) -SAMPLER(4, FLOAT_2D_ARRAY, rp_value_tx) -/* Color History for TAA needs to be sampler to leverage bilinear sampling. */ -SAMPLER(5, FLOAT_2D, in_combined_tx) -SAMPLER(6, FLOAT_2D, cryptomatte_tx) -IMAGE(0, GPU_R32F, READ, FLOAT_2D_ARRAY, in_weight_img) -IMAGE(1, GPU_R32F, WRITE, FLOAT_2D_ARRAY, out_weight_img) -SPECIALIZATION_CONSTANT(UINT, enabled_categories, 0) -SPECIALIZATION_CONSTANT(INT, samples_len, 0) -SPECIALIZATION_CONSTANT(BOOL, use_reprojection, false) -SPECIALIZATION_CONSTANT(INT, scaling_factor, 1) -SPECIALIZATION_CONSTANT(INT, combined_id, 0) -SPECIALIZATION_CONSTANT(INT, display_id, -1) -SPECIALIZATION_CONSTANT(INT, normal_id, -1) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(eevee_velocity_camera) -ADDITIONAL_INFO(draw_view) -GPU_SHADER_CREATE_END() + .sampler(0, ImageType::DEPTH_2D, "depth_tx") + .sampler(1, ImageType::FLOAT_2D, "combined_tx") + .sampler(2, ImageType::FLOAT_2D, "vector_tx") + .sampler(3, ImageType::FLOAT_2D_ARRAY, "rp_color_tx") + .sampler(4, ImageType::FLOAT_2D_ARRAY, "rp_value_tx") + /* Color History for TAA needs to be sampler to leverage bilinear sampling. */ + .sampler(5, ImageType::FLOAT_2D, "in_combined_tx") + .sampler(6, ImageType::FLOAT_2D, "cryptomatte_tx") + .image(0, GPU_R32F, Qualifier::READ, ImageType::FLOAT_2D_ARRAY, "in_weight_img") + .image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_weight_img") + .specialization_constant(Type::UINT, "enabled_categories", 0) + .specialization_constant(Type::INT, "samples_len", 0) + .specialization_constant(Type::BOOL, "use_reprojection", false) + .specialization_constant(Type::INT, "scaling_factor", 1) + .specialization_constant(Type::INT, "combined_id", 0) + .specialization_constant(Type::INT, "display_id", -1) + .specialization_constant(Type::INT, "normal_id", -1) + .additional_info("eevee_shared") + .additional_info("eevee_global_ubo") + .additional_info("eevee_velocity_camera") + .additional_info("draw_view"); GPU_SHADER_CREATE_INFO(eevee_film) -/* Color History for TAA needs to be sampler to leverage bilinear sampling. */ -// IMAGE(2, GPU_RGBA16F, READ, FLOAT_2D, in_combined_img) -IMAGE(3, GPU_RGBA16F, WRITE, FLOAT_2D, out_combined_img) -IMAGE(4, GPU_R32F, READ_WRITE, FLOAT_2D, depth_img) -IMAGE(5, GPU_RGBA16F, READ_WRITE, FLOAT_2D_ARRAY, color_accum_img) -IMAGE(6, GPU_R16F, READ_WRITE, FLOAT_2D_ARRAY, value_accum_img) -IMAGE(7, GPU_RGBA32F, READ_WRITE, FLOAT_2D_ARRAY, cryptomatte_img) -ADDITIONAL_INFO(eevee_film_base) -GPU_SHADER_CREATE_END() + /* Color History for TAA needs to be sampler to leverage bilinear sampling. */ + //.image(2, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "in_combined_img") + .image(3, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_combined_img") + .image(4, GPU_R32F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "depth_img") + .image(5, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D_ARRAY, "color_accum_img") + .image(6, GPU_R16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D_ARRAY, "value_accum_img") + .image(7, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_2D_ARRAY, "cryptomatte_img") + .additional_info("eevee_film_base"); GPU_SHADER_CREATE_INFO(eevee_film_frag) -DO_STATIC_COMPILATION() -FRAGMENT_OUT(0, VEC4, out_color) -FRAGMENT_SOURCE("eevee_film_frag.glsl") -ADDITIONAL_INFO(draw_fullscreen) -ADDITIONAL_INFO(eevee_film) -DEPTH_WRITE(DepthWrite::ANY) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .fragment_out(0, Type::VEC4, "out_color") + .fragment_source("eevee_film_frag.glsl") + .additional_info("draw_fullscreen") + .additional_info("eevee_film") + .depth_write(DepthWrite::ANY); GPU_SHADER_CREATE_INFO(eevee_film_comp) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) -COMPUTE_SOURCE("eevee_film_comp.glsl") -ADDITIONAL_INFO(eevee_film) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE) + .compute_source("eevee_film_comp.glsl") + .additional_info("eevee_film"); GPU_SHADER_CREATE_INFO(eevee_film_cryptomatte_post) -DO_STATIC_COMPILATION() -IMAGE(0, GPU_RGBA32F, READ_WRITE, FLOAT_2D_ARRAY, cryptomatte_img) -PUSH_CONSTANT(INT, cryptomatte_layer_len) -PUSH_CONSTANT(INT, cryptomatte_samples_per_layer) -LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) -COMPUTE_SOURCE("eevee_film_cryptomatte_post_comp.glsl") -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(eevee_shared) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .image(0, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_2D_ARRAY, "cryptomatte_img") + .push_constant(Type::INT, "cryptomatte_layer_len") + .push_constant(Type::INT, "cryptomatte_samples_per_layer") + .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE) + .compute_source("eevee_film_cryptomatte_post_comp.glsl") + .additional_info("eevee_global_ubo") + .additional_info("eevee_shared"); GPU_SHADER_CREATE_INFO(eevee_film_copy_frag) -DO_STATIC_COMPILATION() -IMAGE(3, GPU_RGBA16F, READ, FLOAT_2D, out_combined_img) -IMAGE(4, GPU_R32F, READ, FLOAT_2D, depth_img) -IMAGE(5, GPU_RGBA16F, READ, FLOAT_2D_ARRAY, color_accum_img) -IMAGE(6, GPU_R16F, READ, FLOAT_2D_ARRAY, value_accum_img) -IMAGE(7, GPU_RGBA32F, READ, FLOAT_2D_ARRAY, cryptomatte_img) -DEPTH_WRITE(DepthWrite::ANY) -FRAGMENT_OUT(0, VEC4, out_color) -FRAGMENT_SOURCE("eevee_film_copy_frag.glsl") -DEFINE("FILM_COPY") -ADDITIONAL_INFO(draw_fullscreen) -ADDITIONAL_INFO(eevee_film_base) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .image(3, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "out_combined_img") + .image(4, GPU_R32F, Qualifier::READ, ImageType::FLOAT_2D, "depth_img") + .image(5, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D_ARRAY, "color_accum_img") + .image(6, GPU_R16F, Qualifier::READ, ImageType::FLOAT_2D_ARRAY, "value_accum_img") + .image(7, GPU_RGBA32F, Qualifier::READ, ImageType::FLOAT_2D_ARRAY, "cryptomatte_img") + .depth_write(DepthWrite::ANY) + .fragment_out(0, Type::VEC4, "out_color") + .fragment_source("eevee_film_copy_frag.glsl") + .define("FILM_COPY") + .additional_info("draw_fullscreen") + .additional_info("eevee_film_base"); /* The combined pass is stored into its own 2D texture with a format of GPU_RGBA16F. */ GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_combined) -LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) -PUSH_CONSTANT(IVEC2, offset) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("eevee_film_pass_convert_comp.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE) + .push_constant(Type::IVEC2, "offset") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("eevee_film_pass_convert_comp.glsl") + .do_static_compilation(true); /* The depth pass is stored into its own 2D texture with a format of GPU_R32F. */ GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_depth) -LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) -PUSH_CONSTANT(IVEC2, offset) -SAMPLER(0, FLOAT_2D, input_tx) -IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("eevee_film_pass_convert_comp.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE) + .push_constant(Type::IVEC2, "offset") + .sampler(0, ImageType::FLOAT_2D, "input_tx") + .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("eevee_film_pass_convert_comp.glsl") + .do_static_compilation(true); /* Value passes are stored in a slice of a 2D texture array with a format of GPU_R16F. */ GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_value) -LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) -PUSH_CONSTANT(IVEC2, offset) -DEFINE("IS_ARRAY_INPUT") -SAMPLER(0, FLOAT_2D_ARRAY, input_tx) -IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("eevee_film_pass_convert_comp.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE) + .push_constant(Type::IVEC2, "offset") + .define("IS_ARRAY_INPUT") + .sampler(0, ImageType::FLOAT_2D_ARRAY, "input_tx") + .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("eevee_film_pass_convert_comp.glsl") + .do_static_compilation(true); /* Color passes are stored in a slice of a 2D texture array with a format of GPU_RGBA16F. */ GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_color) -LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) -PUSH_CONSTANT(IVEC2, offset) -DEFINE("IS_ARRAY_INPUT") -SAMPLER(0, FLOAT_2D_ARRAY, input_tx) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("eevee_film_pass_convert_comp.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE) + .push_constant(Type::IVEC2, "offset") + .define("IS_ARRAY_INPUT") + .sampler(0, ImageType::FLOAT_2D_ARRAY, "input_tx") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("eevee_film_pass_convert_comp.glsl") + .do_static_compilation(true); /* Cryptomatte passes are stored in a slice of a 2D texture array with a format of GPU_RGBA32F. */ GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_cryptomatte) -LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) -PUSH_CONSTANT(IVEC2, offset) -DEFINE("IS_ARRAY_INPUT") -SAMPLER(0, FLOAT_2D_ARRAY, input_tx) -IMAGE(0, GPU_RGBA32F, WRITE, FLOAT_2D, output_img) -COMPUTE_SOURCE("eevee_film_pass_convert_comp.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE) + .push_constant(Type::IVEC2, "offset") + .define("IS_ARRAY_INPUT") + .sampler(0, ImageType::FLOAT_2D_ARRAY, "input_tx") + .image(0, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") + .compute_source("eevee_film_pass_convert_comp.glsl") + .do_static_compilation(true); diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_hiz_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_hiz_info.hh index 751b2f20631..8cf9d74d78a 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_hiz_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_hiz_info.hh @@ -6,44 +6,39 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(eevee_hiz_data) -SAMPLER(HIZ_TEX_SLOT, FLOAT_2D, hiz_tx) -ADDITIONAL_INFO(eevee_global_ubo) -GPU_SHADER_CREATE_END() + .sampler(HIZ_TEX_SLOT, ImageType::FLOAT_2D, "hiz_tx") + .additional_info("eevee_global_ubo"); GPU_SHADER_CREATE_INFO(eevee_hiz_update_base) -LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) -STORAGE_BUF(0, READ_WRITE, uint, finished_tile_counter) -IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, out_mip_0) -IMAGE(1, GPU_R32F, WRITE, FLOAT_2D, out_mip_1) -IMAGE(2, GPU_R32F, WRITE, FLOAT_2D, out_mip_2) -IMAGE(3, GPU_R32F, WRITE, FLOAT_2D, out_mip_3) -IMAGE(4, GPU_R32F, WRITE, FLOAT_2D, out_mip_4) -IMAGE(5, GPU_R32F, READ_WRITE, FLOAT_2D, out_mip_5) -IMAGE(6, GPU_R32F, WRITE, FLOAT_2D, out_mip_6) -SPECIALIZATION_CONSTANT(BOOL, update_mip_0, true) -COMPUTE_SOURCE("eevee_hiz_update_comp.glsl") -GPU_SHADER_CREATE_END() + .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE) + .storage_buf(0, Qualifier::READ_WRITE, "uint", "finished_tile_counter") + .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_mip_0") + .image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_mip_1") + .image(2, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_mip_2") + .image(3, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_mip_3") + .image(4, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_mip_4") + .image(5, GPU_R32F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "out_mip_5") + .image(6, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_mip_6") + .specialization_constant(Type::BOOL, "update_mip_0", true) + .compute_source("eevee_hiz_update_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_hiz_update) -DO_STATIC_COMPILATION() -SAMPLER(0, DEPTH_2D, depth_tx) -ADDITIONAL_INFO(eevee_hiz_update_base) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .sampler(0, ImageType::DEPTH_2D, "depth_tx") + .additional_info("eevee_hiz_update_base"); GPU_SHADER_CREATE_INFO(eevee_hiz_update_layer) -DO_STATIC_COMPILATION() -DEFINE("HIZ_LAYER") -SAMPLER(1, DEPTH_2D_ARRAY, depth_layered_tx) -PUSH_CONSTANT(INT, layer_id) -ADDITIONAL_INFO(eevee_hiz_update_base) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("HIZ_LAYER") + .sampler(1, ImageType::DEPTH_2D_ARRAY, "depth_layered_tx") + .push_constant(Type::INT, "layer_id") + .additional_info("eevee_hiz_update_base"); GPU_SHADER_CREATE_INFO(eevee_hiz_debug) -DO_STATIC_COMPILATION() -FRAGMENT_OUT_DUAL(0, VEC4, out_debug_color_add, SRC_0) -FRAGMENT_OUT_DUAL(0, VEC4, out_debug_color_mul, SRC_1) -FRAGMENT_SOURCE("eevee_hiz_debug_frag.glsl") -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_hiz_data) -ADDITIONAL_INFO(draw_fullscreen) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .fragment_out(0, Type::VEC4, "out_debug_color_add", DualBlend::SRC_0) + .fragment_out(0, Type::VEC4, "out_debug_color_mul", DualBlend::SRC_1) + .fragment_source("eevee_hiz_debug_frag.glsl") + .additional_info("eevee_shared") + .additional_info("eevee_hiz_data") + .additional_info("draw_fullscreen"); diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_light_culling_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_light_culling_info.hh index 14d884da5f3..f2170dc6e76 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_light_culling_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_light_culling_info.hh @@ -10,11 +10,10 @@ * \{ */ GPU_SHADER_CREATE_INFO(eevee_light_data) -STORAGE_BUF(LIGHT_CULL_BUF_SLOT, READ, LightCullingData, light_cull_buf) -STORAGE_BUF(LIGHT_BUF_SLOT, READ, LightData, light_buf[]) -STORAGE_BUF(LIGHT_ZBIN_BUF_SLOT, READ, uint, light_zbin_buf[]) -STORAGE_BUF(LIGHT_TILE_BUF_SLOT, READ, uint, light_tile_buf[]) -GPU_SHADER_CREATE_END() + .storage_buf(LIGHT_CULL_BUF_SLOT, Qualifier::READ, "LightCullingData", "light_cull_buf") + .storage_buf(LIGHT_BUF_SLOT, Qualifier::READ, "LightData", "light_buf[]") + .storage_buf(LIGHT_ZBIN_BUF_SLOT, Qualifier::READ, "uint", "light_zbin_buf[]") + .storage_buf(LIGHT_TILE_BUF_SLOT, Qualifier::READ, "uint", "light_tile_buf[]"); /** \} */ @@ -23,68 +22,63 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(eevee_light_culling_select) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_view_culling) -LOCAL_GROUP_SIZE(CULLING_SELECT_GROUP_SIZE) -STORAGE_BUF(0, READ_WRITE, LightCullingData, light_cull_buf) -STORAGE_BUF(1, READ, LightData, in_light_buf[]) -STORAGE_BUF(2, WRITE, LightData, out_light_buf[]) -STORAGE_BUF(3, WRITE, float, out_zdist_buf[]) -STORAGE_BUF(4, WRITE, uint, out_key_buf[]) -UNIFORM_BUF(0, LightData, sunlight_buf) -COMPUTE_SOURCE("eevee_light_culling_select_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("eevee_shared") + .additional_info("draw_view") + .additional_info("draw_view_culling") + .local_group_size(CULLING_SELECT_GROUP_SIZE) + .storage_buf(0, Qualifier::READ_WRITE, "LightCullingData", "light_cull_buf") + .storage_buf(1, Qualifier::READ, "LightData", "in_light_buf[]") + .storage_buf(2, Qualifier::WRITE, "LightData", "out_light_buf[]") + .storage_buf(3, Qualifier::WRITE, "float", "out_zdist_buf[]") + .storage_buf(4, Qualifier::WRITE, "uint", "out_key_buf[]") + .uniform_buf(0, "LightData", "sunlight_buf") + .compute_source("eevee_light_culling_select_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_light_culling_sort) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_view) -STORAGE_BUF(0, READ, LightCullingData, light_cull_buf) -STORAGE_BUF(1, READ, LightData, in_light_buf[]) -STORAGE_BUF(2, WRITE, LightData, out_light_buf[]) -STORAGE_BUF(3, READ, float, in_zdist_buf[]) -STORAGE_BUF(4, READ, uint, in_key_buf[]) -LOCAL_GROUP_SIZE(CULLING_SORT_GROUP_SIZE) -COMPUTE_SOURCE("eevee_light_culling_sort_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("eevee_shared") + .additional_info("draw_view") + .storage_buf(0, Qualifier::READ, "LightCullingData", "light_cull_buf") + .storage_buf(1, Qualifier::READ, "LightData", "in_light_buf[]") + .storage_buf(2, Qualifier::WRITE, "LightData", "out_light_buf[]") + .storage_buf(3, Qualifier::READ, "float", "in_zdist_buf[]") + .storage_buf(4, Qualifier::READ, "uint", "in_key_buf[]") + .local_group_size(CULLING_SORT_GROUP_SIZE) + .compute_source("eevee_light_culling_sort_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_light_culling_zbin) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_view) -LOCAL_GROUP_SIZE(CULLING_ZBIN_GROUP_SIZE) -STORAGE_BUF(0, READ, LightCullingData, light_cull_buf) -STORAGE_BUF(1, READ, LightData, light_buf[]) -STORAGE_BUF(2, WRITE, uint, out_zbin_buf[]) -COMPUTE_SOURCE("eevee_light_culling_zbin_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("eevee_shared") + .additional_info("draw_view") + .local_group_size(CULLING_ZBIN_GROUP_SIZE) + .storage_buf(0, Qualifier::READ, "LightCullingData", "light_cull_buf") + .storage_buf(1, Qualifier::READ, "LightData", "light_buf[]") + .storage_buf(2, Qualifier::WRITE, "uint", "out_zbin_buf[]") + .compute_source("eevee_light_culling_zbin_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_light_culling_tile) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_view_culling) -LOCAL_GROUP_SIZE(CULLING_TILE_GROUP_SIZE) -STORAGE_BUF(0, READ, LightCullingData, light_cull_buf) -STORAGE_BUF(1, READ, LightData, light_buf[]) -STORAGE_BUF(2, WRITE, uint, out_light_tile_buf[]) -COMPUTE_SOURCE("eevee_light_culling_tile_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("eevee_shared") + .additional_info("draw_view") + .additional_info("draw_view_culling") + .local_group_size(CULLING_TILE_GROUP_SIZE) + .storage_buf(0, Qualifier::READ, "LightCullingData", "light_cull_buf") + .storage_buf(1, Qualifier::READ, "LightData", "light_buf[]") + .storage_buf(2, Qualifier::WRITE, "uint", "out_light_tile_buf[]") + .compute_source("eevee_light_culling_tile_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_light_shadow_setup) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_sampling_data) -ADDITIONAL_INFO(eevee_global_ubo) -LOCAL_GROUP_SIZE(CULLING_SELECT_GROUP_SIZE) -STORAGE_BUF(0, READ, LightCullingData, light_cull_buf) -STORAGE_BUF(1, READ_WRITE, LightData, light_buf[]) -STORAGE_BUF(2, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) -STORAGE_BUF(3, READ_WRITE, ShadowTileMapClip, tilemaps_clip_buf[]) -COMPUTE_SOURCE("eevee_light_shadow_setup_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("eevee_shared") + .additional_info("eevee_sampling_data") + .additional_info("eevee_global_ubo") + .local_group_size(CULLING_SELECT_GROUP_SIZE) + .storage_buf(0, Qualifier::READ, "LightCullingData", "light_cull_buf") + .storage_buf(1, Qualifier::READ_WRITE, "LightData", "light_buf[]") + .storage_buf(2, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") + .storage_buf(3, Qualifier::READ_WRITE, "ShadowTileMapClip", "tilemaps_clip_buf[]") + .compute_source("eevee_light_shadow_setup_comp.glsl"); /** \} */ @@ -93,15 +87,11 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(eevee_light_culling_debug) -DO_STATIC_COMPILATION() -FRAGMENT_OUT_DUAL(0, VEC4, out_debug_color_add, SRC_0) -FRAGMENT_OUT_DUAL(0, VEC4, out_debug_color_mul, SRC_1) -FRAGMENT_SOURCE("eevee_light_culling_debug_frag.glsl") -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_fullscreen) -ADDITIONAL_INFO(eevee_light_data) -ADDITIONAL_INFO(eevee_hiz_data) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .fragment_out(0, Type::VEC4, "out_debug_color_add", DualBlend::SRC_0) + .fragment_out(0, Type::VEC4, "out_debug_color_mul", DualBlend::SRC_1) + .fragment_source("eevee_light_culling_debug_frag.glsl") + .additional_info( + "eevee_shared", "draw_view", "draw_fullscreen", "eevee_light_data", "eevee_hiz_data"); /** \} */ diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_sphere_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_sphere_info.hh index d046954a462..cc7db1ccb89 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_sphere_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_sphere_info.hh @@ -10,111 +10,106 @@ * \{ */ GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_data) -DEFINE("SPHERE_PROBE") -UNIFORM_BUF(SPHERE_PROBE_BUF_SLOT, SphereProbeData, lightprobe_sphere_buf[SPHERE_PROBE_MAX]) -SAMPLER(SPHERE_PROBE_TEX_SLOT, FLOAT_2D_ARRAY, lightprobe_spheres_tx) -GPU_SHADER_CREATE_END() + .define("SPHERE_PROBE") + .uniform_buf(SPHERE_PROBE_BUF_SLOT, + "SphereProbeData", + "lightprobe_sphere_buf[SPHERE_PROBE_MAX]") + .sampler(SPHERE_PROBE_TEX_SLOT, ImageType::FLOAT_2D_ARRAY, "lightprobe_spheres_tx"); /* Sample cubemap and remap into an octahedral texture. */ GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_remap) -LOCAL_GROUP_SIZE(SPHERE_PROBE_REMAP_GROUP_SIZE, SPHERE_PROBE_REMAP_GROUP_SIZE) -SPECIALIZATION_CONSTANT(BOOL, extract_sh, true) -SPECIALIZATION_CONSTANT(BOOL, extract_sun, true) -PUSH_CONSTANT(IVEC4, probe_coord_packed) -PUSH_CONSTANT(IVEC4, write_coord_packed) -PUSH_CONSTANT(IVEC4, world_coord_packed) -SAMPLER(0, FLOAT_CUBE, cubemap_tx) -SAMPLER(1, FLOAT_2D_ARRAY, atlas_tx) -STORAGE_BUF(0, WRITE, SphereProbeHarmonic, out_sh[]) -STORAGE_BUF(1, WRITE, SphereProbeSunLight, out_sun[]) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D_ARRAY, atlas_img) -COMPUTE_SOURCE("eevee_lightprobe_sphere_remap_comp.glsl") -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_global_ubo) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(SPHERE_PROBE_REMAP_GROUP_SIZE, SPHERE_PROBE_REMAP_GROUP_SIZE) + .specialization_constant(Type::BOOL, "extract_sh", true) + .specialization_constant(Type::BOOL, "extract_sun", true) + .push_constant(Type::IVEC4, "probe_coord_packed") + .push_constant(Type::IVEC4, "write_coord_packed") + .push_constant(Type::IVEC4, "world_coord_packed") + .sampler(0, ImageType::FLOAT_CUBE, "cubemap_tx") + .sampler(1, ImageType::FLOAT_2D_ARRAY, "atlas_tx") + .storage_buf(0, Qualifier::WRITE, "SphereProbeHarmonic", "out_sh[]") + .storage_buf(1, Qualifier::WRITE, "SphereProbeSunLight", "out_sun[]") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "atlas_img") + .compute_source("eevee_lightprobe_sphere_remap_comp.glsl") + .additional_info("eevee_shared") + .additional_info("eevee_global_ubo") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_irradiance) -LOCAL_GROUP_SIZE(SPHERE_PROBE_SH_GROUP_SIZE) -PUSH_CONSTANT(IVEC3, probe_remap_dispatch_size) -STORAGE_BUF(0, READ, SphereProbeHarmonic, in_sh[]) -STORAGE_BUF(1, WRITE, SphereProbeHarmonic, out_sh) -ADDITIONAL_INFO(eevee_shared) -DO_STATIC_COMPILATION() -COMPUTE_SOURCE("eevee_lightprobe_sphere_irradiance_comp.glsl") -GPU_SHADER_CREATE_END() + .local_group_size(SPHERE_PROBE_SH_GROUP_SIZE) + .push_constant(Type::IVEC3, "probe_remap_dispatch_size") + .storage_buf(0, Qualifier::READ, "SphereProbeHarmonic", "in_sh[]") + .storage_buf(1, Qualifier::WRITE, "SphereProbeHarmonic", "out_sh") + .additional_info("eevee_shared") + .do_static_compilation(true) + .compute_source("eevee_lightprobe_sphere_irradiance_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_sunlight) -LOCAL_GROUP_SIZE(SPHERE_PROBE_SH_GROUP_SIZE) -PUSH_CONSTANT(IVEC3, probe_remap_dispatch_size) -STORAGE_BUF(0, READ, SphereProbeSunLight, in_sun[]) -STORAGE_BUF(1, WRITE, LightData, sunlight_buf) -ADDITIONAL_INFO(eevee_shared) -DO_STATIC_COMPILATION() -COMPUTE_SOURCE("eevee_lightprobe_sphere_sunlight_comp.glsl") -GPU_SHADER_CREATE_END() + .local_group_size(SPHERE_PROBE_SH_GROUP_SIZE) + .push_constant(Type::IVEC3, "probe_remap_dispatch_size") + .storage_buf(0, Qualifier::READ, "SphereProbeSunLight", "in_sun[]") + .storage_buf(1, Qualifier::WRITE, "LightData", "sunlight_buf") + .additional_info("eevee_shared") + .do_static_compilation(true) + .compute_source("eevee_lightprobe_sphere_sunlight_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_select) -LOCAL_GROUP_SIZE(SPHERE_PROBE_SELECT_GROUP_SIZE) -STORAGE_BUF(0, READ_WRITE, SphereProbeData, lightprobe_sphere_buf[SPHERE_PROBE_MAX]) -PUSH_CONSTANT(INT, lightprobe_sphere_count) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_sampling_data) -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(eevee_volume_probe_data) -COMPUTE_SOURCE("eevee_lightprobe_sphere_select_comp.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(SPHERE_PROBE_SELECT_GROUP_SIZE) + .storage_buf(0, + Qualifier::READ_WRITE, + "SphereProbeData", + "lightprobe_sphere_buf[SPHERE_PROBE_MAX]") + .push_constant(Type::INT, "lightprobe_sphere_count") + .additional_info("eevee_shared") + .additional_info("eevee_sampling_data") + .additional_info("eevee_global_ubo") + .additional_info("eevee_volume_probe_data") + .compute_source("eevee_lightprobe_sphere_select_comp.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_convolve) -LOCAL_GROUP_SIZE(SPHERE_PROBE_GROUP_SIZE, SPHERE_PROBE_GROUP_SIZE) -ADDITIONAL_INFO(eevee_shared) -PUSH_CONSTANT(IVEC4, probe_coord_packed) -PUSH_CONSTANT(IVEC4, write_coord_packed) -PUSH_CONSTANT(IVEC4, read_coord_packed) -PUSH_CONSTANT(INT, read_lod) -SAMPLER(0, FLOAT_CUBE, cubemap_tx) -SAMPLER(1, FLOAT_2D_ARRAY, in_atlas_mip_tx) -IMAGE(1, GPU_RGBA16F, WRITE, FLOAT_2D_ARRAY, out_atlas_mip_img) -COMPUTE_SOURCE("eevee_lightprobe_sphere_convolve_comp.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(SPHERE_PROBE_GROUP_SIZE, SPHERE_PROBE_GROUP_SIZE) + .additional_info("eevee_shared") + .push_constant(Type::IVEC4, "probe_coord_packed") + .push_constant(Type::IVEC4, "write_coord_packed") + .push_constant(Type::IVEC4, "read_coord_packed") + .push_constant(Type::INT, "read_lod") + .sampler(0, ImageType::FLOAT_CUBE, "cubemap_tx") + .sampler(1, ImageType::FLOAT_2D_ARRAY, "in_atlas_mip_tx") + .image(1, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_atlas_mip_img") + .compute_source("eevee_lightprobe_sphere_convolve_comp.glsl") + .do_static_compilation(true); GPU_SHADER_INTERFACE_INFO(eevee_display_lightprobe_sphere_iface) -SMOOTH(VEC3, P) -SMOOTH(VEC2, lP) -FLAT(INT, probe_index) -GPU_SHADER_INTERFACE_END() + .smooth(Type::VEC3, "P") + .smooth(Type::VEC2, "lP") + .flat(Type::INT, "probe_index"); GPU_SHADER_CREATE_INFO(eevee_display_lightprobe_sphere) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(eevee_lightprobe_sphere_data) -STORAGE_BUF(0, READ, SphereProbeDisplayData, display_data_buf[]) -VERTEX_SOURCE("eevee_display_lightprobe_sphere_vert.glsl") -VERTEX_OUT(eevee_display_lightprobe_sphere_iface) -FRAGMENT_SOURCE("eevee_display_lightprobe_sphere_frag.glsl") -FRAGMENT_OUT(0, VEC4, out_color) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("eevee_shared") + .additional_info("draw_view") + .additional_info("eevee_lightprobe_sphere_data") + .storage_buf(0, Qualifier::READ, "SphereProbeDisplayData", "display_data_buf[]") + .vertex_source("eevee_display_lightprobe_sphere_vert.glsl") + .vertex_out(eevee_display_lightprobe_sphere_iface) + .fragment_source("eevee_display_lightprobe_sphere_frag.glsl") + .fragment_out(0, Type::VEC4, "out_color") + .do_static_compilation(true); GPU_SHADER_INTERFACE_INFO(eevee_display_lightprobe_planar_iface) -FLAT(VEC3, probe_normal) -FLAT(INT, probe_index) -GPU_SHADER_INTERFACE_END() + .flat(Type::VEC3, "probe_normal") + .flat(Type::INT, "probe_index"); GPU_SHADER_CREATE_INFO(eevee_display_lightprobe_planar) -PUSH_CONSTANT(IVEC4, world_coord_packed) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(eevee_lightprobe_planar_data) -ADDITIONAL_INFO(eevee_lightprobe_sphere_data) -STORAGE_BUF(0, READ, PlanarProbeDisplayData, display_data_buf[]) -VERTEX_SOURCE("eevee_display_lightprobe_planar_vert.glsl") -VERTEX_OUT(eevee_display_lightprobe_planar_iface) -FRAGMENT_SOURCE("eevee_display_lightprobe_planar_frag.glsl") -FRAGMENT_OUT(0, VEC4, out_color) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .push_constant(Type::IVEC4, "world_coord_packed") + .additional_info("eevee_shared") + .additional_info("draw_view") + .additional_info("eevee_lightprobe_planar_data") + .additional_info("eevee_lightprobe_sphere_data") + .storage_buf(0, Qualifier::READ, "PlanarProbeDisplayData", "display_data_buf[]") + .vertex_source("eevee_display_lightprobe_planar_vert.glsl") + .vertex_out(eevee_display_lightprobe_planar_iface) + .fragment_source("eevee_display_lightprobe_planar_frag.glsl") + .fragment_out(0, Type::VEC4, "out_color") + .do_static_compilation(true); /** \} */ diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_volume_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_volume_info.hh index 3221e6a465c..9efe18ed10c 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_volume_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_volume_info.hh @@ -10,65 +10,58 @@ * \{ */ GPU_SHADER_INTERFACE_INFO(eevee_debug_surfel_iface) -SMOOTH(VEC3, P) -FLAT(INT, surfel_index) -GPU_SHADER_INTERFACE_END() + .smooth(Type::VEC3, "P") + .flat(Type::INT, "surfel_index"); GPU_SHADER_CREATE_INFO(eevee_debug_surfels) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_view) -VERTEX_SOURCE("eevee_debug_surfels_vert.glsl") -VERTEX_OUT(eevee_debug_surfel_iface) -FRAGMENT_SOURCE("eevee_debug_surfels_frag.glsl") -FRAGMENT_OUT(0, VEC4, out_color) -STORAGE_BUF(0, READ, Surfel, surfels_buf[]) -PUSH_CONSTANT(FLOAT, debug_surfel_radius) -PUSH_CONSTANT(INT, debug_mode) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("eevee_shared") + .additional_info("draw_view") + .vertex_source("eevee_debug_surfels_vert.glsl") + .vertex_out(eevee_debug_surfel_iface) + .fragment_source("eevee_debug_surfels_frag.glsl") + .fragment_out(0, Type::VEC4, "out_color") + .storage_buf(0, Qualifier::READ, "Surfel", "surfels_buf[]") + .push_constant(Type::FLOAT, "debug_surfel_radius") + .push_constant(Type::INT, "debug_mode") + .do_static_compilation(true); -GPU_SHADER_INTERFACE_INFO(eevee_debug_irradiance_grid_iface) -SMOOTH(VEC4, interp_color) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_INTERFACE_INFO(eevee_debug_irradiance_grid_iface).smooth(Type::VEC4, "interp_color"); GPU_SHADER_CREATE_INFO(eevee_debug_irradiance_grid) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_view) -FRAGMENT_OUT(0, VEC4, out_color) -VERTEX_OUT(eevee_debug_irradiance_grid_iface) -SAMPLER(0, FLOAT_3D, debug_data_tx) -PUSH_CONSTANT(MAT4, grid_mat) -PUSH_CONSTANT(INT, debug_mode) -PUSH_CONSTANT(FLOAT, debug_value) -VERTEX_SOURCE("eevee_debug_irradiance_grid_vert.glsl") -FRAGMENT_SOURCE("eevee_debug_irradiance_grid_frag.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("eevee_shared") + .additional_info("draw_view") + .fragment_out(0, Type::VEC4, "out_color") + .vertex_out(eevee_debug_irradiance_grid_iface) + .sampler(0, ImageType::FLOAT_3D, "debug_data_tx") + .push_constant(Type::MAT4, "grid_mat") + .push_constant(Type::INT, "debug_mode") + .push_constant(Type::FLOAT, "debug_value") + .vertex_source("eevee_debug_irradiance_grid_vert.glsl") + .fragment_source("eevee_debug_irradiance_grid_frag.glsl") + .do_static_compilation(true); GPU_SHADER_INTERFACE_INFO(eevee_display_lightprobe_volume_iface) -SMOOTH(VEC2, lP) -FLAT(IVEC3, cell) -GPU_SHADER_INTERFACE_END() + .smooth(Type::VEC2, "lP") + .flat(Type::IVEC3, "cell"); GPU_SHADER_CREATE_INFO(eevee_display_lightprobe_volume) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_view) -VERTEX_SOURCE("eevee_display_lightprobe_volume_vert.glsl") -VERTEX_OUT(eevee_display_lightprobe_volume_iface) -FRAGMENT_SOURCE("eevee_display_lightprobe_volume_frag.glsl") -FRAGMENT_OUT(0, VEC4, out_color) -PUSH_CONSTANT(FLOAT, sphere_radius) -PUSH_CONSTANT(IVEC3, grid_resolution) -PUSH_CONSTANT(MAT4, grid_to_world) -PUSH_CONSTANT(MAT4, world_to_grid) -PUSH_CONSTANT(BOOL, display_validity) -SAMPLER(0, FLOAT_3D, irradiance_a_tx) -SAMPLER(1, FLOAT_3D, irradiance_b_tx) -SAMPLER(2, FLOAT_3D, irradiance_c_tx) -SAMPLER(3, FLOAT_3D, irradiance_d_tx) -SAMPLER(4, FLOAT_3D, validity_tx) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("eevee_shared") + .additional_info("draw_view") + .vertex_source("eevee_display_lightprobe_volume_vert.glsl") + .vertex_out(eevee_display_lightprobe_volume_iface) + .fragment_source("eevee_display_lightprobe_volume_frag.glsl") + .fragment_out(0, Type::VEC4, "out_color") + .push_constant(Type::FLOAT, "sphere_radius") + .push_constant(Type::IVEC3, "grid_resolution") + .push_constant(Type::MAT4, "grid_to_world") + .push_constant(Type::MAT4, "world_to_grid") + .push_constant(Type::BOOL, "display_validity") + .sampler(0, ImageType::FLOAT_3D, "irradiance_a_tx") + .sampler(1, ImageType::FLOAT_3D, "irradiance_b_tx") + .sampler(2, ImageType::FLOAT_3D, "irradiance_c_tx") + .sampler(3, ImageType::FLOAT_3D, "irradiance_d_tx") + .sampler(4, ImageType::FLOAT_3D, "validity_tx") + .do_static_compilation(true); /** \} */ @@ -77,117 +70,108 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(eevee_surfel_common) -STORAGE_BUF(SURFEL_BUF_SLOT, READ_WRITE, Surfel, surfel_buf[]) -STORAGE_BUF(CAPTURE_BUF_SLOT, READ, CaptureInfoData, capture_info_buf) -GPU_SHADER_CREATE_END() + .storage_buf(SURFEL_BUF_SLOT, Qualifier::READ_WRITE, "Surfel", "surfel_buf[]") + .storage_buf(CAPTURE_BUF_SLOT, Qualifier::READ, "CaptureInfoData", "capture_info_buf"); GPU_SHADER_CREATE_INFO(eevee_surfel_light) -DEFINE("LIGHT_ITER_FORCE_NO_CULLING") -DEFINE_VALUE("LIGHT_CLOSURE_EVAL_COUNT", "1") -LOCAL_GROUP_SIZE(SURFEL_GROUP_SIZE) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(eevee_utility_texture) -ADDITIONAL_INFO(eevee_surfel_common) -ADDITIONAL_INFO(eevee_light_data) -ADDITIONAL_INFO(eevee_shadow_data) -COMPUTE_SOURCE("eevee_surfel_light_comp.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .define("LIGHT_ITER_FORCE_NO_CULLING") + .define("LIGHT_CLOSURE_EVAL_COUNT", "1") + .local_group_size(SURFEL_GROUP_SIZE) + .additional_info("eevee_shared") + .additional_info("draw_view") + .additional_info("eevee_global_ubo") + .additional_info("eevee_utility_texture") + .additional_info("eevee_surfel_common") + .additional_info("eevee_light_data") + .additional_info("eevee_shadow_data") + .compute_source("eevee_surfel_light_comp.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(eevee_surfel_cluster_build) -LOCAL_GROUP_SIZE(SURFEL_GROUP_SIZE) -BUILTINS(BuiltinBits::TEXTURE_ATOMIC) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_surfel_common) -ADDITIONAL_INFO(draw_view) -IMAGE(0, GPU_R32I, READ_WRITE, INT_3D_ATOMIC, cluster_list_img) -COMPUTE_SOURCE("eevee_surfel_cluster_build_comp.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(SURFEL_GROUP_SIZE) + .builtins(BuiltinBits::TEXTURE_ATOMIC) + .additional_info("eevee_shared") + .additional_info("eevee_surfel_common") + .additional_info("draw_view") + .image(0, GPU_R32I, Qualifier::READ_WRITE, ImageType::INT_3D_ATOMIC, "cluster_list_img") + .compute_source("eevee_surfel_cluster_build_comp.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(eevee_surfel_list_build) -LOCAL_GROUP_SIZE(SURFEL_GROUP_SIZE) -BUILTINS(BuiltinBits::TEXTURE_ATOMIC) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_surfel_common) -ADDITIONAL_INFO(draw_view) -STORAGE_BUF(0, READ_WRITE, int, list_start_buf[]) -STORAGE_BUF(6, READ_WRITE, SurfelListInfoData, list_info_buf) -COMPUTE_SOURCE("eevee_surfel_list_build_comp.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(SURFEL_GROUP_SIZE) + .builtins(BuiltinBits::TEXTURE_ATOMIC) + .additional_info("eevee_shared") + .additional_info("eevee_surfel_common") + .additional_info("draw_view") + .storage_buf(0, Qualifier::READ_WRITE, "int", "list_start_buf[]") + .storage_buf(6, Qualifier::READ_WRITE, "SurfelListInfoData", "list_info_buf") + .compute_source("eevee_surfel_list_build_comp.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(eevee_surfel_list_sort) -LOCAL_GROUP_SIZE(SURFEL_LIST_GROUP_SIZE) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_surfel_common) -ADDITIONAL_INFO(draw_view) -STORAGE_BUF(0, READ_WRITE, int, list_start_buf[]) -STORAGE_BUF(6, READ, SurfelListInfoData, list_info_buf) -COMPUTE_SOURCE("eevee_surfel_list_sort_comp.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(SURFEL_LIST_GROUP_SIZE) + .additional_info("eevee_shared") + .additional_info("eevee_surfel_common") + .additional_info("draw_view") + .storage_buf(0, Qualifier::READ_WRITE, "int", "list_start_buf[]") + .storage_buf(6, Qualifier::READ, "SurfelListInfoData", "list_info_buf") + .compute_source("eevee_surfel_list_sort_comp.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(eevee_surfel_ray) -LOCAL_GROUP_SIZE(SURFEL_GROUP_SIZE) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_surfel_common) -ADDITIONAL_INFO(eevee_lightprobe_sphere_data) -ADDITIONAL_INFO(draw_view) -PUSH_CONSTANT(INT, radiance_src) -PUSH_CONSTANT(INT, radiance_dst) -COMPUTE_SOURCE("eevee_surfel_ray_comp.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(SURFEL_GROUP_SIZE) + .additional_info("eevee_shared") + .additional_info("eevee_surfel_common") + .additional_info("eevee_lightprobe_sphere_data") + .additional_info("draw_view") + .push_constant(Type::INT, "radiance_src") + .push_constant(Type::INT, "radiance_dst") + .compute_source("eevee_surfel_ray_comp.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_bounds) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(IRRADIANCE_BOUNDS_GROUP_SIZE) -STORAGE_BUF(0, READ_WRITE, CaptureInfoData, capture_info_buf) -STORAGE_BUF(1, READ, ObjectBounds, bounds_buf[]) -PUSH_CONSTANT(INT, resource_len) -TYPEDEF_SOURCE("draw_shader_shared.hh") -ADDITIONAL_INFO(eevee_shared) -COMPUTE_SOURCE("eevee_lightprobe_volume_bounds_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(IRRADIANCE_BOUNDS_GROUP_SIZE) + .storage_buf(0, Qualifier::READ_WRITE, "CaptureInfoData", "capture_info_buf") + .storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") + .push_constant(Type::INT, "resource_len") + .typedef_source("draw_shader_shared.hh") + .additional_info("eevee_shared") + .compute_source("eevee_lightprobe_volume_bounds_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_ray) -LOCAL_GROUP_SIZE(IRRADIANCE_GRID_GROUP_SIZE, - IRRADIANCE_GRID_GROUP_SIZE, - IRRADIANCE_GRID_GROUP_SIZE) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_surfel_common) -ADDITIONAL_INFO(eevee_lightprobe_sphere_data) -ADDITIONAL_INFO(draw_view) -PUSH_CONSTANT(INT, radiance_src) -STORAGE_BUF(0, READ, int, list_start_buf[]) -STORAGE_BUF(6, READ, SurfelListInfoData, list_info_buf) -IMAGE(0, GPU_RGBA32F, READ_WRITE, FLOAT_3D, irradiance_L0_img) -IMAGE(1, GPU_RGBA32F, READ_WRITE, FLOAT_3D, irradiance_L1_a_img) -IMAGE(2, GPU_RGBA32F, READ_WRITE, FLOAT_3D, irradiance_L1_b_img) -IMAGE(3, GPU_RGBA32F, READ_WRITE, FLOAT_3D, irradiance_L1_c_img) -IMAGE(4, GPU_RGBA16F, READ, FLOAT_3D, virtual_offset_img) -IMAGE(5, GPU_R32F, READ_WRITE, FLOAT_3D, validity_img) -COMPUTE_SOURCE("eevee_lightprobe_volume_ray_comp.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(IRRADIANCE_GRID_GROUP_SIZE, + IRRADIANCE_GRID_GROUP_SIZE, + IRRADIANCE_GRID_GROUP_SIZE) + .additional_info("eevee_shared") + .additional_info("eevee_surfel_common") + .additional_info("eevee_lightprobe_sphere_data") + .additional_info("draw_view") + .push_constant(Type::INT, "radiance_src") + .storage_buf(0, Qualifier::READ, "int", "list_start_buf[]") + .storage_buf(6, Qualifier::READ, "SurfelListInfoData", "list_info_buf") + .image(0, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "irradiance_L0_img") + .image(1, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "irradiance_L1_a_img") + .image(2, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "irradiance_L1_b_img") + .image(3, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "irradiance_L1_c_img") + .image(4, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_3D, "virtual_offset_img") + .image(5, GPU_R32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "validity_img") + .compute_source("eevee_lightprobe_volume_ray_comp.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_offset) -LOCAL_GROUP_SIZE(IRRADIANCE_GRID_GROUP_SIZE, - IRRADIANCE_GRID_GROUP_SIZE, - IRRADIANCE_GRID_GROUP_SIZE) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_surfel_common) -ADDITIONAL_INFO(draw_view) -STORAGE_BUF(0, READ, int, list_start_buf[]) -STORAGE_BUF(6, READ, SurfelListInfoData, list_info_buf) -IMAGE(0, GPU_R32I, READ, INT_3D_ATOMIC, cluster_list_img) -IMAGE(1, GPU_RGBA16F, READ_WRITE, FLOAT_3D, virtual_offset_img) -COMPUTE_SOURCE("eevee_lightprobe_volume_offset_comp.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(IRRADIANCE_GRID_GROUP_SIZE, + IRRADIANCE_GRID_GROUP_SIZE, + IRRADIANCE_GRID_GROUP_SIZE) + .additional_info("eevee_shared") + .additional_info("eevee_surfel_common") + .additional_info("draw_view") + .storage_buf(0, Qualifier::READ, "int", "list_start_buf[]") + .storage_buf(6, Qualifier::READ, "SurfelListInfoData", "list_info_buf") + .image(0, GPU_R32I, Qualifier::READ, ImageType::INT_3D_ATOMIC, "cluster_list_img") + .image(1, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "virtual_offset_img") + .compute_source("eevee_lightprobe_volume_offset_comp.glsl") + .do_static_compilation(true); /** \} */ @@ -196,71 +180,68 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_world) -LOCAL_GROUP_SIZE(IRRADIANCE_GRID_BRICK_SIZE, - IRRADIANCE_GRID_BRICK_SIZE, - IRRADIANCE_GRID_BRICK_SIZE) -DEFINE("IRRADIANCE_GRID_UPLOAD") -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_global_ubo) -PUSH_CONSTANT(INT, grid_index) -STORAGE_BUF(0, READ, uint, bricks_infos_buf[]) -STORAGE_BUF(1, READ, SphereProbeHarmonic, harmonic_buf) -UNIFORM_BUF(0, VolumeProbeData, grids_infos_buf[IRRADIANCE_GRID_MAX]) -IMAGE(0, VOLUME_PROBE_FORMAT, WRITE, FLOAT_3D, irradiance_atlas_img) -COMPUTE_SOURCE("eevee_lightprobe_volume_world_comp.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(IRRADIANCE_GRID_BRICK_SIZE, + IRRADIANCE_GRID_BRICK_SIZE, + IRRADIANCE_GRID_BRICK_SIZE) + .define("IRRADIANCE_GRID_UPLOAD") + .additional_info("eevee_shared") + .additional_info("eevee_global_ubo") + .push_constant(Type::INT, "grid_index") + .storage_buf(0, Qualifier::READ, "uint", "bricks_infos_buf[]") + .storage_buf(1, Qualifier::READ, "SphereProbeHarmonic", "harmonic_buf") + .uniform_buf(0, "VolumeProbeData", "grids_infos_buf[IRRADIANCE_GRID_MAX]") + .image(0, VOLUME_PROBE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_3D, "irradiance_atlas_img") + .compute_source("eevee_lightprobe_volume_world_comp.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_load) -LOCAL_GROUP_SIZE(IRRADIANCE_GRID_BRICK_SIZE, - IRRADIANCE_GRID_BRICK_SIZE, - IRRADIANCE_GRID_BRICK_SIZE) -DEFINE("IRRADIANCE_GRID_UPLOAD") -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_global_ubo) -PUSH_CONSTANT(MAT4, grid_local_to_world) -PUSH_CONSTANT(INT, grid_index) -PUSH_CONSTANT(INT, grid_start_index) -PUSH_CONSTANT(FLOAT, validity_threshold) -PUSH_CONSTANT(FLOAT, dilation_threshold) -PUSH_CONSTANT(FLOAT, dilation_radius) -PUSH_CONSTANT(FLOAT, grid_intensity_factor) -UNIFORM_BUF(0, VolumeProbeData, grids_infos_buf[IRRADIANCE_GRID_MAX]) -STORAGE_BUF(0, READ, uint, bricks_infos_buf[]) -SAMPLER(0, FLOAT_3D, irradiance_a_tx) -SAMPLER(1, FLOAT_3D, irradiance_b_tx) -SAMPLER(2, FLOAT_3D, irradiance_c_tx) -SAMPLER(3, FLOAT_3D, irradiance_d_tx) -SAMPLER(4, FLOAT_3D, visibility_a_tx) -SAMPLER(5, FLOAT_3D, visibility_b_tx) -SAMPLER(6, FLOAT_3D, visibility_c_tx) -SAMPLER(7, FLOAT_3D, visibility_d_tx) -SAMPLER(8, FLOAT_3D, irradiance_atlas_tx) -SAMPLER(9, FLOAT_3D, validity_tx) -IMAGE(0, VOLUME_PROBE_FORMAT, WRITE, FLOAT_3D, irradiance_atlas_img) -COMPUTE_SOURCE("eevee_lightprobe_volume_load_comp.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(IRRADIANCE_GRID_BRICK_SIZE, + IRRADIANCE_GRID_BRICK_SIZE, + IRRADIANCE_GRID_BRICK_SIZE) + .define("IRRADIANCE_GRID_UPLOAD") + .additional_info("eevee_shared") + .additional_info("eevee_global_ubo") + .push_constant(Type::MAT4, "grid_local_to_world") + .push_constant(Type::INT, "grid_index") + .push_constant(Type::INT, "grid_start_index") + .push_constant(Type::FLOAT, "validity_threshold") + .push_constant(Type::FLOAT, "dilation_threshold") + .push_constant(Type::FLOAT, "dilation_radius") + .push_constant(Type::FLOAT, "grid_intensity_factor") + .uniform_buf(0, "VolumeProbeData", "grids_infos_buf[IRRADIANCE_GRID_MAX]") + .storage_buf(0, Qualifier::READ, "uint", "bricks_infos_buf[]") + .sampler(0, ImageType::FLOAT_3D, "irradiance_a_tx") + .sampler(1, ImageType::FLOAT_3D, "irradiance_b_tx") + .sampler(2, ImageType::FLOAT_3D, "irradiance_c_tx") + .sampler(3, ImageType::FLOAT_3D, "irradiance_d_tx") + .sampler(4, ImageType::FLOAT_3D, "visibility_a_tx") + .sampler(5, ImageType::FLOAT_3D, "visibility_b_tx") + .sampler(6, ImageType::FLOAT_3D, "visibility_c_tx") + .sampler(7, ImageType::FLOAT_3D, "visibility_d_tx") + .sampler(8, ImageType::FLOAT_3D, "irradiance_atlas_tx") + .sampler(9, ImageType::FLOAT_3D, "validity_tx") + .image(0, VOLUME_PROBE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_3D, "irradiance_atlas_img") + .compute_source("eevee_lightprobe_volume_load_comp.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(eevee_volume_probe_data) -UNIFORM_BUF(IRRADIANCE_GRID_BUF_SLOT, VolumeProbeData, grids_infos_buf[IRRADIANCE_GRID_MAX]) -/* NOTE: Use uint instead of IrradianceBrickPacked because Metal needs to know the exact type. - */ -STORAGE_BUF(IRRADIANCE_BRICK_BUF_SLOT, READ, uint, bricks_infos_buf[]) -SAMPLER(VOLUME_PROBE_TEX_SLOT, FLOAT_3D, irradiance_atlas_tx) -DEFINE("IRRADIANCE_GRID_SAMPLING") -GPU_SHADER_CREATE_END() + .uniform_buf(IRRADIANCE_GRID_BUF_SLOT, + "VolumeProbeData", + "grids_infos_buf[IRRADIANCE_GRID_MAX]") + /* NOTE: Use uint instead of IrradianceBrickPacked because Metal needs to know the exact type. + */ + .storage_buf(IRRADIANCE_BRICK_BUF_SLOT, Qualifier::READ, "uint", "bricks_infos_buf[]") + .sampler(VOLUME_PROBE_TEX_SLOT, ImageType::FLOAT_3D, "irradiance_atlas_tx") + .define("IRRADIANCE_GRID_SAMPLING"); GPU_SHADER_CREATE_INFO(eevee_lightprobe_data) -ADDITIONAL_INFO(eevee_lightprobe_sphere_data) -ADDITIONAL_INFO(eevee_volume_probe_data) -GPU_SHADER_CREATE_END() + .additional_info("eevee_lightprobe_sphere_data") + .additional_info("eevee_volume_probe_data"); GPU_SHADER_CREATE_INFO(eevee_lightprobe_planar_data) -DEFINE("SPHERE_PROBE") -UNIFORM_BUF(PLANAR_PROBE_BUF_SLOT, PlanarProbeData, probe_planar_buf[PLANAR_PROBE_MAX]) -SAMPLER(PLANAR_PROBE_RADIANCE_TEX_SLOT, FLOAT_2D_ARRAY, planar_radiance_tx) -SAMPLER(PLANAR_PROBE_DEPTH_TEX_SLOT, DEPTH_2D_ARRAY, planar_depth_tx) -GPU_SHADER_CREATE_END() + .define("SPHERE_PROBE") + .uniform_buf(PLANAR_PROBE_BUF_SLOT, "PlanarProbeData", "probe_planar_buf[PLANAR_PROBE_MAX]") + .sampler(PLANAR_PROBE_RADIANCE_TEX_SLOT, ImageType::FLOAT_2D_ARRAY, "planar_radiance_tx") + .sampler(PLANAR_PROBE_DEPTH_TEX_SLOT, ImageType::DEPTH_2D_ARRAY, "planar_depth_tx"); /** \} */ diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lookdev_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lookdev_info.hh index d56e6fb841d..d56bf371eb5 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lookdev_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lookdev_info.hh @@ -6,20 +6,18 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_INTERFACE_INFO(eevee_lookdev_display_iface) -SMOOTH(VEC2, uv_coord) -FLAT(UINT, sphere_id) -GPU_SHADER_INTERFACE_END() + .smooth(Type::VEC2, "uv_coord") + .flat(Type::UINT, "sphere_id"); GPU_SHADER_CREATE_INFO(eevee_lookdev_display) -VERTEX_SOURCE("eevee_lookdev_display_vert.glsl") -VERTEX_OUT(eevee_lookdev_display_iface) -PUSH_CONSTANT(VEC2, viewportSize) -PUSH_CONSTANT(VEC2, invertedViewportSize) -PUSH_CONSTANT(IVEC2, anchor) -SAMPLER(0, FLOAT_2D, metallic_tx) -SAMPLER(1, FLOAT_2D, diffuse_tx) -FRAGMENT_OUT(0, VEC4, out_color) -FRAGMENT_SOURCE("eevee_lookdev_display_frag.glsl") -DEPTH_WRITE(DepthWrite::ANY) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .vertex_source("eevee_lookdev_display_vert.glsl") + .vertex_out(eevee_lookdev_display_iface) + .push_constant(Type::VEC2, "viewportSize") + .push_constant(Type::VEC2, "invertedViewportSize") + .push_constant(Type::IVEC2, "anchor") + .sampler(0, ImageType::FLOAT_2D, "metallic_tx") + .sampler(1, ImageType::FLOAT_2D, "diffuse_tx") + .fragment_out(0, Type::VEC4, "out_color") + .fragment_source("eevee_lookdev_display_frag.glsl") + .depth_write(DepthWrite::ANY) + .do_static_compilation(true); diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lut_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lut_info.hh index 16c838a1ace..421f1fd65e4 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lut_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lut_info.hh @@ -5,11 +5,10 @@ #include "eevee_defines.hh" GPU_SHADER_CREATE_INFO(eevee_lut) -LOCAL_GROUP_SIZE(LUT_WORKGROUP_SIZE, LUT_WORKGROUP_SIZE, 1) -PUSH_CONSTANT(INT, table_type) -PUSH_CONSTANT(IVEC3, table_extent) -IMAGE(0, GPU_RGBA32F, READ_WRITE, FLOAT_3D, table_img) -ADDITIONAL_INFO(eevee_shared) -COMPUTE_SOURCE("eevee_lut_comp.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(LUT_WORKGROUP_SIZE, LUT_WORKGROUP_SIZE, 1) + .push_constant(Type::INT, "table_type") + .push_constant(Type::IVEC3, "table_extent") + .image(0, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "table_img") + .additional_info("eevee_shared") + .compute_source("eevee_lut_comp.glsl") + .do_static_compilation(true); diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh index cf19c30def4..85dc0a39702 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh @@ -11,34 +11,28 @@ /* TODO(@fclem): This is a bit out of place at the moment. */ GPU_SHADER_CREATE_INFO(eevee_shared) -TYPEDEF_SOURCE("eevee_defines.hh") -TYPEDEF_SOURCE("eevee_shader_shared.hh") -GPU_SHADER_CREATE_END() + .typedef_source("eevee_defines.hh") + .typedef_source("eevee_shader_shared.hh"); GPU_SHADER_CREATE_INFO(eevee_global_ubo) -UNIFORM_BUF(UNIFORM_BUF_SLOT, UniformData, uniform_buf) -GPU_SHADER_CREATE_END() + .uniform_buf(UNIFORM_BUF_SLOT, "UniformData", "uniform_buf"); GPU_SHADER_CREATE_INFO(eevee_sampling_data) -DEFINE("EEVEE_SAMPLING_DATA") -ADDITIONAL_INFO(eevee_shared) -STORAGE_BUF(SAMPLING_BUF_SLOT, READ, SamplingData, sampling_buf) -GPU_SHADER_CREATE_END() + .define("EEVEE_SAMPLING_DATA") + .additional_info("eevee_shared") + .storage_buf(SAMPLING_BUF_SLOT, Qualifier::READ, "SamplingData", "sampling_buf"); GPU_SHADER_CREATE_INFO(eevee_utility_texture) -DEFINE("EEVEE_UTILITY_TX") -SAMPLER(RBUFS_UTILITY_TEX_SLOT, FLOAT_2D_ARRAY, utility_tx) -GPU_SHADER_CREATE_END() + .define("EEVEE_UTILITY_TX") + .sampler(RBUFS_UTILITY_TEX_SLOT, ImageType::FLOAT_2D_ARRAY, "utility_tx"); GPU_SHADER_NAMED_INTERFACE_INFO(eevee_clip_plane_iface, clip_interp) -SMOOTH(FLOAT, clip_distance) -GPU_SHADER_INTERFACE_END() + .smooth(Type::FLOAT, "clip_distance"); GPU_SHADER_CREATE_INFO(eevee_clip_plane) -VERTEX_OUT(eevee_clip_plane_iface) -UNIFORM_BUF(CLIP_PLANE_BUF, ClipPlaneData, clip_plane) -DEFINE("MAT_CLIP_PLANE") -GPU_SHADER_CREATE_END() + .vertex_out(eevee_clip_plane_iface) + .uniform_buf(CLIP_PLANE_BUF, "ClipPlaneData", "clip_plane") + .define("MAT_CLIP_PLANE"); /** \} */ @@ -48,110 +42,99 @@ GPU_SHADER_CREATE_END() /* Common interface */ GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_iface, interp) -/* World Position. */ -SMOOTH(VEC3, P) -/* World Normal. */ -SMOOTH(VEC3, N) -GPU_SHADER_INTERFACE_END() + /* World Position. */ + .smooth(Type::VEC3, "P") + /* World Normal. */ + .smooth(Type::VEC3, "N"); GPU_SHADER_CREATE_INFO(eevee_geom_mesh) -ADDITIONAL_INFO(eevee_shared) -DEFINE("MAT_GEOM_MESH") -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, VEC3, nor) -VERTEX_SOURCE("eevee_geom_mesh_vert.glsl") -VERTEX_OUT(eevee_surf_iface) -ADDITIONAL_INFO(draw_modelmat_new) -ADDITIONAL_INFO(draw_object_infos_new) -ADDITIONAL_INFO(draw_resource_id_varying) -ADDITIONAL_INFO(draw_view) -GPU_SHADER_CREATE_END() + .additional_info("eevee_shared") + .define("MAT_GEOM_MESH") + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC3, "nor") + .vertex_source("eevee_geom_mesh_vert.glsl") + .vertex_out(eevee_surf_iface) + .additional_info("draw_modelmat_new") + .additional_info("draw_object_infos_new") + .additional_info("draw_resource_id_varying") + .additional_info("draw_view"); GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_point_cloud_iface, point_cloud_interp) -SMOOTH(FLOAT, radius) -SMOOTH(VEC3, position) -GPU_SHADER_INTERFACE_END() + .smooth(Type::FLOAT, "radius") + .smooth(Type::VEC3, "position"); GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_point_cloud_flat_iface, point_cloud_interp_flat) -FLAT(INT, id) -GPU_SHADER_INTERFACE_END() + .flat(Type::INT, "id"); GPU_SHADER_CREATE_INFO(eevee_geom_point_cloud) -ADDITIONAL_INFO(eevee_shared) -DEFINE("MAT_GEOM_POINT_CLOUD") -VERTEX_SOURCE("eevee_geom_point_cloud_vert.glsl") -VERTEX_OUT(eevee_surf_iface) -VERTEX_OUT(eevee_surf_point_cloud_iface) -VERTEX_OUT(eevee_surf_point_cloud_flat_iface) -ADDITIONAL_INFO(draw_pointcloud_new) -ADDITIONAL_INFO(draw_modelmat_new) -ADDITIONAL_INFO(draw_object_infos_new) -ADDITIONAL_INFO(draw_resource_id_varying) -ADDITIONAL_INFO(draw_view) -GPU_SHADER_CREATE_END() + .additional_info("eevee_shared") + .define("MAT_GEOM_POINT_CLOUD") + .vertex_source("eevee_geom_point_cloud_vert.glsl") + .vertex_out(eevee_surf_iface) + .vertex_out(eevee_surf_point_cloud_iface) + .vertex_out(eevee_surf_point_cloud_flat_iface) + .additional_info("draw_pointcloud_new") + .additional_info("draw_modelmat_new") + .additional_info("draw_object_infos_new") + .additional_info("draw_resource_id_varying") + .additional_info("draw_view"); GPU_SHADER_CREATE_INFO(eevee_geom_volume) -ADDITIONAL_INFO(eevee_shared) -DEFINE("MAT_GEOM_VOLUME") -VERTEX_IN(0, VEC3, pos) -VERTEX_OUT(eevee_surf_iface) -VERTEX_SOURCE("eevee_geom_volume_vert.glsl") -ADDITIONAL_INFO(draw_modelmat_new) -ADDITIONAL_INFO(draw_object_infos_new) -ADDITIONAL_INFO(draw_resource_id_varying) -ADDITIONAL_INFO(draw_volume_infos) -ADDITIONAL_INFO(draw_view) -GPU_SHADER_CREATE_END() + .additional_info("eevee_shared") + .define("MAT_GEOM_VOLUME") + .vertex_in(0, Type::VEC3, "pos") + .vertex_out(eevee_surf_iface) + .vertex_source("eevee_geom_volume_vert.glsl") + .additional_info("draw_modelmat_new") + .additional_info("draw_object_infos_new") + .additional_info("draw_resource_id_varying") + .additional_info("draw_volume_infos") + .additional_info("draw_view"); GPU_SHADER_CREATE_INFO(eevee_geom_gpencil) -ADDITIONAL_INFO(eevee_shared) -DEFINE("MAT_GEOM_GPENCIL") -VERTEX_SOURCE("eevee_geom_gpencil_vert.glsl") -VERTEX_OUT(eevee_surf_iface) -ADDITIONAL_INFO(draw_gpencil_new) -ADDITIONAL_INFO(draw_modelmat_new) -ADDITIONAL_INFO(draw_object_infos_new) -ADDITIONAL_INFO(draw_resource_id_varying) -ADDITIONAL_INFO(draw_resource_id_new) -GPU_SHADER_CREATE_END() + .additional_info("eevee_shared") + .define("MAT_GEOM_GPENCIL") + .vertex_source("eevee_geom_gpencil_vert.glsl") + .vertex_out(eevee_surf_iface) + .additional_info("draw_gpencil_new") + .additional_info("draw_modelmat_new") + .additional_info("draw_object_infos_new") + .additional_info("draw_resource_id_varying") + .additional_info("draw_resource_id_new"); GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_curve_iface, curve_interp) -SMOOTH(VEC2, barycentric_coords) -SMOOTH(VEC3, tangent) -SMOOTH(VEC3, binormal) -SMOOTH(FLOAT, time) -SMOOTH(FLOAT, time_width) -SMOOTH(FLOAT, thickness) -GPU_SHADER_INTERFACE_END() + .smooth(Type::VEC2, "barycentric_coords") + .smooth(Type::VEC3, "tangent") + .smooth(Type::VEC3, "binormal") + .smooth(Type::FLOAT, "time") + .smooth(Type::FLOAT, "time_width") + .smooth(Type::FLOAT, "thickness"); GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_curve_flat_iface, curve_interp_flat) -FLAT(INT, strand_id) -GPU_SHADER_INTERFACE_END() + .flat(Type::INT, "strand_id"); GPU_SHADER_CREATE_INFO(eevee_geom_curves) -ADDITIONAL_INFO(eevee_shared) -DEFINE("MAT_GEOM_CURVES") -VERTEX_SOURCE("eevee_geom_curves_vert.glsl") -VERTEX_OUT(eevee_surf_iface) -VERTEX_OUT(eevee_surf_curve_iface) -VERTEX_OUT(eevee_surf_curve_flat_iface) -ADDITIONAL_INFO(draw_modelmat_new) -ADDITIONAL_INFO(draw_object_infos_new) -ADDITIONAL_INFO(draw_resource_id_varying) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_hair_new) -ADDITIONAL_INFO(draw_curves_infos) -GPU_SHADER_CREATE_END() + .additional_info("eevee_shared") + .define("MAT_GEOM_CURVES") + .vertex_source("eevee_geom_curves_vert.glsl") + .vertex_out(eevee_surf_iface) + .vertex_out(eevee_surf_curve_iface) + .vertex_out(eevee_surf_curve_flat_iface) + .additional_info("draw_modelmat_new") + .additional_info("draw_object_infos_new") + .additional_info("draw_resource_id_varying") + .additional_info("draw_view") + .additional_info("draw_hair_new") + .additional_info("draw_curves_infos"); GPU_SHADER_CREATE_INFO(eevee_geom_world) -ADDITIONAL_INFO(eevee_shared) -DEFINE("MAT_GEOM_WORLD") -BUILTINS(BuiltinBits::VERTEX_ID) -VERTEX_SOURCE("eevee_geom_world_vert.glsl") -VERTEX_OUT(eevee_surf_iface) -ADDITIONAL_INFO(draw_modelmat_new) -ADDITIONAL_INFO(draw_object_infos_new) /* Unused, but allow debug compilation. */ -ADDITIONAL_INFO(draw_resource_id_varying) -ADDITIONAL_INFO(draw_view) -GPU_SHADER_CREATE_END() + .additional_info("eevee_shared") + .define("MAT_GEOM_WORLD") + .builtins(BuiltinBits::VERTEX_ID) + .vertex_source("eevee_geom_world_vert.glsl") + .vertex_out(eevee_surf_iface) + .additional_info("draw_modelmat_new") + .additional_info("draw_object_infos_new") /* Unused, but allow debug compilation. */ + .additional_info("draw_resource_id_varying") + .additional_info("draw_view"); /** \} */ @@ -165,161 +148,156 @@ GPU_SHADER_CREATE_END() image(slot, format, qualifier, ImageType::FLOAT_2D_ARRAY, name, Frequency::PASS) GPU_SHADER_CREATE_INFO(eevee_render_pass_out) -DEFINE("MAT_RENDER_PASS_SUPPORT") -ADDITIONAL_INFO(eevee_global_ubo) -IMAGE_FREQ(RBUFS_COLOR_SLOT, GPU_RGBA16F, WRITE, FLOAT_2D, rp_color_img, PASS) -IMAGE_FREQ(RBUFS_VALUE_SLOT, GPU_R16F, WRITE, FLOAT_2D, rp_value_img, PASS) -GPU_SHADER_CREATE_END() + .define("MAT_RENDER_PASS_SUPPORT") + .additional_info("eevee_global_ubo") + .image_array_out(RBUFS_COLOR_SLOT, Qualifier::WRITE, GPU_RGBA16F, "rp_color_img") + .image_array_out(RBUFS_VALUE_SLOT, Qualifier::WRITE, GPU_R16F, "rp_value_img"); GPU_SHADER_CREATE_INFO(eevee_cryptomatte_out) -STORAGE_BUF(CRYPTOMATTE_BUF_SLOT, READ, vec2, cryptomatte_object_buf[]) -IMAGE_FREQ(RBUFS_CRYPTOMATTE_SLOT, GPU_RGBA32F, WRITE, FLOAT_2D, rp_cryptomatte_img, PASS) -GPU_SHADER_CREATE_END() + .storage_buf(CRYPTOMATTE_BUF_SLOT, Qualifier::READ, "vec2", "cryptomatte_object_buf[]") + .image_out(RBUFS_CRYPTOMATTE_SLOT, Qualifier::WRITE, GPU_RGBA32F, "rp_cryptomatte_img"); GPU_SHADER_CREATE_INFO(eevee_surf_deferred_base) -DEFINE("MAT_DEFERRED") -DEFINE("GBUFFER_WRITE") -/* NOTE: This removes the possibility of using gl_FragDepth. */ -EARLY_FRAGMENT_TEST(true) -/* Direct output. (Emissive, Holdout) */ -FRAGMENT_OUT(0, VEC4, out_radiance) -FRAGMENT_OUT_ROG(1, UINT, out_gbuf_header, DEFERRED_GBUFFER_ROG_ID) -FRAGMENT_OUT(2, VEC2, out_gbuf_normal) -FRAGMENT_OUT(3, VEC4, out_gbuf_closure1) -FRAGMENT_OUT(4, VEC4, out_gbuf_closure2) -/* Everything is stored inside a two layered target, one for each format. This is to fit the - * limitation of the number of images we can bind on a single shader. */ -IMAGE_FREQ(GBUF_CLOSURE_SLOT, GPU_RGB10_A2, WRITE, FLOAT_2D, out_gbuf_closure_img, PASS) -IMAGE_FREQ(GBUF_NORMAL_SLOT, GPU_RG16, WRITE, FLOAT_2D, out_gbuf_normal_img, PASS) -/* Added at runtime because of test shaders not having `node_tree`. */ -// ADDITIONAL_INFO(eevee_render_pass_out) -// ADDITIONAL_INFO(eevee_cryptomatte_out) -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(eevee_utility_texture) -ADDITIONAL_INFO(eevee_sampling_data) -ADDITIONAL_INFO(eevee_hiz_data) -GPU_SHADER_CREATE_END() + .define("MAT_DEFERRED") + .define("GBUFFER_WRITE") + /* NOTE: This removes the possibility of using gl_FragDepth. */ + .early_fragment_test(true) + /* Direct output. (Emissive, Holdout) */ + .fragment_out(0, Type::VEC4, "out_radiance") + .fragment_out(1, Type::UINT, "out_gbuf_header", DualBlend::NONE, DEFERRED_GBUFFER_ROG_ID) + .fragment_out(2, Type::VEC2, "out_gbuf_normal") + .fragment_out(3, Type::VEC4, "out_gbuf_closure1") + .fragment_out(4, Type::VEC4, "out_gbuf_closure2") + /* Everything is stored inside a two layered target, one for each format. This is to fit the + * limitation of the number of images we can bind on a single shader. */ + .image_array_out(GBUF_CLOSURE_SLOT, Qualifier::WRITE, GPU_RGB10_A2, "out_gbuf_closure_img") + .image_array_out(GBUF_NORMAL_SLOT, Qualifier::WRITE, GPU_RG16, "out_gbuf_normal_img") + /* Added at runtime because of test shaders not having `node_tree`. */ + // .additional_info("eevee_render_pass_out") + // .additional_info("eevee_cryptomatte_out") + .additional_info("eevee_global_ubo") + .additional_info("eevee_utility_texture") + .additional_info("eevee_sampling_data") + .additional_info("eevee_hiz_data"); GPU_SHADER_CREATE_INFO(eevee_surf_deferred) -FRAGMENT_SOURCE("eevee_surf_deferred_frag.glsl") -ADDITIONAL_INFO(eevee_surf_deferred_base) -GPU_SHADER_CREATE_END() + .fragment_source("eevee_surf_deferred_frag.glsl") + .additional_info("eevee_surf_deferred_base"); GPU_SHADER_CREATE_INFO(eevee_surf_deferred_hybrid) -FRAGMENT_SOURCE("eevee_surf_hybrid_frag.glsl") -ADDITIONAL_INFO(eevee_surf_deferred_base) -ADDITIONAL_INFO(eevee_light_data) -ADDITIONAL_INFO(eevee_lightprobe_data) -ADDITIONAL_INFO(eevee_shadow_data) -GPU_SHADER_CREATE_END() + .fragment_source("eevee_surf_hybrid_frag.glsl") + .additional_info("eevee_surf_deferred_base") + .additional_info("eevee_light_data") + .additional_info("eevee_lightprobe_data") + .additional_info("eevee_shadow_data"); GPU_SHADER_CREATE_INFO(eevee_surf_forward) -DEFINE("MAT_FORWARD") -/* Early fragment test is needed for render passes support for forward surfaces. */ -/* NOTE: This removes the possibility of using gl_FragDepth. */ -EARLY_FRAGMENT_TEST(true) -FRAGMENT_OUT_DUAL(0, VEC4, out_radiance, SRC_0) -FRAGMENT_OUT_DUAL(0, VEC4, out_transmittance, SRC_1) -FRAGMENT_SOURCE("eevee_surf_forward_frag.glsl") -/* Optionally added depending on the material. */ -// ADDITIONAL_INFO(eevee_render_pass_out) -// ADDITIONAL_INFO(eevee_cryptomatte_out) -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(eevee_light_data) -ADDITIONAL_INFO(eevee_lightprobe_data) -ADDITIONAL_INFO(eevee_utility_texture) -ADDITIONAL_INFO(eevee_sampling_data) -ADDITIONAL_INFO(eevee_shadow_data) -ADDITIONAL_INFO(eevee_hiz_data) -ADDITIONAL_INFO(eevee_volume_lib) -GPU_SHADER_CREATE_END() + .define("MAT_FORWARD") + /* Early fragment test is needed for render passes support for forward surfaces. */ + /* NOTE: This removes the possibility of using gl_FragDepth. */ + .early_fragment_test(true) + .fragment_out(0, Type::VEC4, "out_radiance", DualBlend::SRC_0) + .fragment_out(0, Type::VEC4, "out_transmittance", DualBlend::SRC_1) + .fragment_source("eevee_surf_forward_frag.glsl") + /* Optionally added depending on the material. */ + // .additional_info("eevee_render_pass_out") + // .additional_info("eevee_cryptomatte_out") + .additional_info("eevee_global_ubo") + .additional_info("eevee_light_data") + .additional_info("eevee_lightprobe_data") + .additional_info("eevee_utility_texture") + .additional_info("eevee_sampling_data") + .additional_info("eevee_shadow_data") + .additional_info("eevee_hiz_data") + .additional_info("eevee_volume_lib"); GPU_SHADER_CREATE_INFO(eevee_surf_capture) -DEFINE("MAT_CAPTURE") -STORAGE_BUF(SURFEL_BUF_SLOT, WRITE, Surfel, surfel_buf[]) -STORAGE_BUF(CAPTURE_BUF_SLOT, READ_WRITE, CaptureInfoData, capture_info_buf) -PUSH_CONSTANT(BOOL, is_double_sided) -FRAGMENT_SOURCE("eevee_surf_capture_frag.glsl") -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(eevee_utility_texture) -GPU_SHADER_CREATE_END() + .define("MAT_CAPTURE") + .storage_buf(SURFEL_BUF_SLOT, Qualifier::WRITE, "Surfel", "surfel_buf[]") + .storage_buf(CAPTURE_BUF_SLOT, Qualifier::READ_WRITE, "CaptureInfoData", "capture_info_buf") + .push_constant(Type::BOOL, "is_double_sided") + .fragment_source("eevee_surf_capture_frag.glsl") + .additional_info("eevee_global_ubo") + .additional_info("eevee_utility_texture"); GPU_SHADER_CREATE_INFO(eevee_surf_depth) -DEFINE("MAT_DEPTH") -FRAGMENT_SOURCE("eevee_surf_depth_frag.glsl") -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(eevee_sampling_data) -ADDITIONAL_INFO(eevee_utility_texture) -GPU_SHADER_CREATE_END() + .define("MAT_DEPTH") + .fragment_source("eevee_surf_depth_frag.glsl") + .additional_info("eevee_global_ubo") + .additional_info("eevee_sampling_data") + .additional_info("eevee_utility_texture"); GPU_SHADER_CREATE_INFO(eevee_surf_world) -PUSH_CONSTANT(FLOAT, world_opacity_fade) -PUSH_CONSTANT(FLOAT, world_background_blur) -PUSH_CONSTANT(IVEC4, world_coord_packed) -EARLY_FRAGMENT_TEST(true) -FRAGMENT_OUT(0, VEC4, out_background) -FRAGMENT_SOURCE("eevee_surf_world_frag.glsl") -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(eevee_lightprobe_sphere_data) -ADDITIONAL_INFO(eevee_volume_probe_data) -ADDITIONAL_INFO(eevee_sampling_data) -/* Optionally added depending on the material. */ -// ADDITIONAL_INFO(eevee_render_pass_out) -// ADDITIONAL_INFO(eevee_cryptomatte_out) -ADDITIONAL_INFO(eevee_utility_texture) -GPU_SHADER_CREATE_END() + .push_constant(Type::FLOAT, "world_opacity_fade") + .push_constant(Type::FLOAT, "world_background_blur") + .push_constant(Type::IVEC4, "world_coord_packed") + .early_fragment_test(true) + .fragment_out(0, Type::VEC4, "out_background") + .fragment_source("eevee_surf_world_frag.glsl") + .additional_info("eevee_global_ubo") + .additional_info("eevee_lightprobe_sphere_data") + .additional_info("eevee_volume_probe_data") + .additional_info("eevee_sampling_data") + /* Optionally added depending on the material. */ + // .additional_info("eevee_render_pass_out") + // .additional_info("eevee_cryptomatte_out") + .additional_info("eevee_utility_texture"); GPU_SHADER_CREATE_INFO(eevee_renderpass_clear) -FRAGMENT_OUT(0, VEC4, out_background) -FRAGMENT_SOURCE("eevee_renderpass_clear_frag.glsl") -ADDITIONAL_INFO(draw_fullscreen) -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(eevee_render_pass_out) -ADDITIONAL_INFO(eevee_cryptomatte_out) -ADDITIONAL_INFO(eevee_shared) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .fragment_out(0, Type::VEC4, "out_background") + .fragment_source("eevee_renderpass_clear_frag.glsl") + .additional_info("draw_fullscreen") + .additional_info("eevee_global_ubo") + .additional_info("eevee_render_pass_out") + .additional_info("eevee_cryptomatte_out") + .additional_info("eevee_shared") + .do_static_compilation(true); GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_shadow_atomic_iface, shadow_iface) -FLAT(INT, shadow_view_id) -GPU_SHADER_INTERFACE_END() + .flat(Type::INT, "shadow_view_id"); GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_shadow_clipping_iface, shadow_clip) -SMOOTH(VEC3, position) -SMOOTH(VEC3, vector) -GPU_SHADER_INTERFACE_END() + .smooth(Type::VEC3, "position") + .smooth(Type::VEC3, "vector"); GPU_SHADER_CREATE_INFO(eevee_surf_shadow) -DEFINE_VALUE("DRW_VIEW_LEN", STRINGIFY(SHADOW_VIEW_MAX)) -DEFINE("MAT_SHADOW") -BUILTINS(BuiltinBits::VIEWPORT_INDEX) -VERTEX_OUT(eevee_surf_shadow_clipping_iface) -STORAGE_BUF(SHADOW_RENDER_VIEW_BUF_SLOT, READ, ShadowRenderView, render_view_buf[SHADOW_VIEW_MAX]) -FRAGMENT_SOURCE("eevee_surf_shadow_frag.glsl") -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(eevee_utility_texture) -ADDITIONAL_INFO(eevee_sampling_data) -GPU_SHADER_CREATE_END() + .define("DRW_VIEW_LEN", STRINGIFY(SHADOW_VIEW_MAX)) + .define("MAT_SHADOW") + .builtins(BuiltinBits::VIEWPORT_INDEX) + .vertex_out(eevee_surf_shadow_clipping_iface) + .storage_buf(SHADOW_RENDER_VIEW_BUF_SLOT, + Qualifier::READ, + "ShadowRenderView", + "render_view_buf[SHADOW_VIEW_MAX]") + .fragment_source("eevee_surf_shadow_frag.glsl") + .additional_info("eevee_global_ubo") + .additional_info("eevee_utility_texture") + .additional_info("eevee_sampling_data"); GPU_SHADER_CREATE_INFO(eevee_surf_shadow_atomic) -ADDITIONAL_INFO(eevee_surf_shadow) -DEFINE("SHADOW_UPDATE_ATOMIC_RASTER") -BUILTINS(BuiltinBits::TEXTURE_ATOMIC) -VERTEX_OUT(eevee_surf_shadow_atomic_iface) -STORAGE_BUF(SHADOW_RENDER_MAP_BUF_SLOT, READ, uint, render_map_buf[SHADOW_RENDER_MAP_SIZE]) -IMAGE(SHADOW_ATLAS_IMG_SLOT, GPU_R32UI, READ_WRITE, UINT_2D_ARRAY_ATOMIC, shadow_atlas_img) -GPU_SHADER_CREATE_END() + .additional_info("eevee_surf_shadow") + .define("SHADOW_UPDATE_ATOMIC_RASTER") + .builtins(BuiltinBits::TEXTURE_ATOMIC) + .vertex_out(eevee_surf_shadow_atomic_iface) + .storage_buf(SHADOW_RENDER_MAP_BUF_SLOT, + Qualifier::READ, + "uint", + "render_map_buf[SHADOW_RENDER_MAP_SIZE]") + .image(SHADOW_ATLAS_IMG_SLOT, + GPU_R32UI, + Qualifier::READ_WRITE, + ImageType::UINT_2D_ARRAY_ATOMIC, + "shadow_atlas_img"); GPU_SHADER_CREATE_INFO(eevee_surf_shadow_tbdr) -ADDITIONAL_INFO(eevee_surf_shadow) -DEFINE("SHADOW_UPDATE_TBDR") -BUILTINS(BuiltinBits::LAYER) -/* Use greater depth write to avoid loosing the early Z depth test but ensure correct fragment - * ordering after slope bias. */ -DEPTH_WRITE(DepthWrite::GREATER) -/* F32 color attachment for on-tile depth accumulation without atomics. */ -FRAGMENT_OUT_ROG(0, FLOAT, out_depth, SHADOW_ROG_ID) -GPU_SHADER_CREATE_END() + .additional_info("eevee_surf_shadow") + .define("SHADOW_UPDATE_TBDR") + .builtins(BuiltinBits::LAYER) + /* Use greater depth write to avoid loosing the early Z depth test but ensure correct fragment + * ordering after slope bias. */ + .depth_write(DepthWrite::GREATER) + /* F32 color attachment for on-tile depth accumulation without atomics. */ + .fragment_out(0, Type::FLOAT, "out_depth", DualBlend::NONE, SHADOW_ROG_ID); #undef image_out #undef image_array_out @@ -331,39 +309,67 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(eevee_surf_volume) -DEFINE("MAT_VOLUME") -/* Only the front fragments have to be invoked. */ -EARLY_FRAGMENT_TEST(true) -IMAGE( - VOLUME_PROP_SCATTERING_IMG_SLOT, GPU_R11F_G11F_B10F, READ_WRITE, FLOAT_3D, out_scattering_img) -IMAGE( - VOLUME_PROP_EXTINCTION_IMG_SLOT, GPU_R11F_G11F_B10F, READ_WRITE, FLOAT_3D, out_extinction_img) -IMAGE(VOLUME_PROP_EMISSION_IMG_SLOT, GPU_R11F_G11F_B10F, READ_WRITE, FLOAT_3D, out_emissive_img) -IMAGE(VOLUME_PROP_PHASE_IMG_SLOT, GPU_R16F, READ_WRITE, FLOAT_3D, out_phase_img) -IMAGE(VOLUME_PROP_PHASE_WEIGHT_IMG_SLOT, GPU_R16F, READ_WRITE, FLOAT_3D, out_phase_weight_img) -IMAGE(VOLUME_OCCUPANCY_SLOT, GPU_R32UI, READ, UINT_3D_ATOMIC, occupancy_img) -FRAGMENT_SOURCE("eevee_surf_volume_frag.glsl") -ADDITIONAL_INFO(draw_modelmat_new_common) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(eevee_sampling_data) -ADDITIONAL_INFO(eevee_utility_texture) -GPU_SHADER_CREATE_END() + .define("MAT_VOLUME") + /* Only the front fragments have to be invoked. */ + .early_fragment_test(true) + .image(VOLUME_PROP_SCATTERING_IMG_SLOT, + GPU_R11F_G11F_B10F, + Qualifier::READ_WRITE, + ImageType::FLOAT_3D, + "out_scattering_img") + .image(VOLUME_PROP_EXTINCTION_IMG_SLOT, + GPU_R11F_G11F_B10F, + Qualifier::READ_WRITE, + ImageType::FLOAT_3D, + "out_extinction_img") + .image(VOLUME_PROP_EMISSION_IMG_SLOT, + GPU_R11F_G11F_B10F, + Qualifier::READ_WRITE, + ImageType::FLOAT_3D, + "out_emissive_img") + .image(VOLUME_PROP_PHASE_IMG_SLOT, + GPU_R16F, + Qualifier::READ_WRITE, + ImageType::FLOAT_3D, + "out_phase_img") + .image(VOLUME_PROP_PHASE_WEIGHT_IMG_SLOT, + GPU_R16F, + Qualifier::READ_WRITE, + ImageType::FLOAT_3D, + "out_phase_weight_img") + .image(VOLUME_OCCUPANCY_SLOT, + GPU_R32UI, + Qualifier::READ, + ImageType::UINT_3D_ATOMIC, + "occupancy_img") + .fragment_source("eevee_surf_volume_frag.glsl") + .additional_info("draw_modelmat_new_common") + .additional_info("draw_view") + .additional_info("eevee_shared") + .additional_info("eevee_global_ubo") + .additional_info("eevee_sampling_data") + .additional_info("eevee_utility_texture"); GPU_SHADER_CREATE_INFO(eevee_surf_occupancy) -DEFINE("MAT_OCCUPANCY") -/* All fragments need to be invoked even if we write to the depth buffer. */ -EARLY_FRAGMENT_TEST(false) -BUILTINS(BuiltinBits::TEXTURE_ATOMIC) -PUSH_CONSTANT(BOOL, use_fast_method) -IMAGE(VOLUME_HIT_DEPTH_SLOT, GPU_R32F, WRITE, FLOAT_3D, hit_depth_img) -IMAGE(VOLUME_HIT_COUNT_SLOT, GPU_R32UI, READ_WRITE, UINT_2D_ATOMIC, hit_count_img) -IMAGE(VOLUME_OCCUPANCY_SLOT, GPU_R32UI, READ_WRITE, UINT_3D_ATOMIC, occupancy_img) -FRAGMENT_SOURCE("eevee_surf_occupancy_frag.glsl") -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(eevee_sampling_data) -GPU_SHADER_CREATE_END() + .define("MAT_OCCUPANCY") + /* All fragments need to be invoked even if we write to the depth buffer. */ + .early_fragment_test(false) + .builtins(BuiltinBits::TEXTURE_ATOMIC) + .push_constant(Type::BOOL, "use_fast_method") + .image(VOLUME_HIT_DEPTH_SLOT, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_3D, "hit_depth_img") + .image(VOLUME_HIT_COUNT_SLOT, + GPU_R32UI, + Qualifier::READ_WRITE, + ImageType::UINT_2D_ATOMIC, + "hit_count_img") + .image(VOLUME_OCCUPANCY_SLOT, + GPU_R32UI, + Qualifier::READ_WRITE, + ImageType::UINT_3D_ATOMIC, + "occupancy_img") + .fragment_source("eevee_surf_occupancy_frag.glsl") + .additional_info("eevee_global_ubo") + .additional_info("eevee_sampling_data"); /** \} */ @@ -377,10 +383,9 @@ GPU_SHADER_CREATE_END() /* Stub functions defined by the material evaluation. */ GPU_SHADER_CREATE_INFO(eevee_material_stub) -DEFINE("EEVEE_MATERIAL_STUBS") -/* Dummy uniform buffer to detect overlap with material node-tree. */ -UNIFORM_BUF(0, int, node_tree) -GPU_SHADER_CREATE_END() + .define("EEVEE_MATERIAL_STUBS") + /* Dummy uniform buffer to detect overlap with material node-tree. */ + .uniform_buf(0, "int", "node_tree"); # define EEVEE_MAT_FINAL_VARIATION(name, ...) \ GPU_SHADER_CREATE_INFO(name).additional_info(__VA_ARGS__).do_static_compilation(true); diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_motion_blur_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_motion_blur_info.hh index abccab4170c..e5f53a5bdaa 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_motion_blur_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_motion_blur_info.hh @@ -6,52 +6,47 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(eevee_motion_blur_tiles_flatten) -LOCAL_GROUP_SIZE(MOTION_BLUR_GROUP_SIZE, MOTION_BLUR_GROUP_SIZE) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(eevee_velocity_camera) -UNIFORM_BUF(6, MotionBlurData, motion_blur_buf) -SAMPLER(0, DEPTH_2D, depth_tx) -IMAGE(1, GPU_RGBA16F, WRITE, FLOAT_2D, out_tiles_img) -COMPUTE_SOURCE("eevee_motion_blur_flatten_comp.glsl") -GPU_SHADER_CREATE_END() + .local_group_size(MOTION_BLUR_GROUP_SIZE, MOTION_BLUR_GROUP_SIZE) + .additional_info("eevee_shared") + .additional_info("draw_view") + .additional_info("eevee_velocity_camera") + .uniform_buf(6, "MotionBlurData", "motion_blur_buf") + .sampler(0, ImageType::DEPTH_2D, "depth_tx") + .image(1, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_tiles_img") + .compute_source("eevee_motion_blur_flatten_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_motion_blur_tiles_flatten_rg) -DO_STATIC_COMPILATION() -DEFINE("FLATTEN_RG") -IMAGE(0, GPU_RG16F, READ_WRITE, FLOAT_2D, velocity_img) -ADDITIONAL_INFO(eevee_motion_blur_tiles_flatten) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("FLATTEN_RG") + .image(0, GPU_RG16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "velocity_img") + .additional_info("eevee_motion_blur_tiles_flatten"); GPU_SHADER_CREATE_INFO(eevee_motion_blur_tiles_flatten_rgba) -DO_STATIC_COMPILATION() -IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, velocity_img) -ADDITIONAL_INFO(eevee_motion_blur_tiles_flatten) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "velocity_img") + .additional_info("eevee_motion_blur_tiles_flatten"); GPU_SHADER_CREATE_INFO(eevee_motion_blur_tiles_dilate) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(MOTION_BLUR_GROUP_SIZE, MOTION_BLUR_GROUP_SIZE) -ADDITIONAL_INFO(eevee_shared) -/* NOTE: See MotionBlurTileIndirection. */ -STORAGE_BUF(0, READ_WRITE, uint, tile_indirection_buf[]) -IMAGE(1, GPU_RGBA16F, READ, FLOAT_2D, in_tiles_img) -COMPUTE_SOURCE("eevee_motion_blur_dilate_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(MOTION_BLUR_GROUP_SIZE, MOTION_BLUR_GROUP_SIZE) + .additional_info("eevee_shared") + /* NOTE: See MotionBlurTileIndirection. */ + .storage_buf(0, Qualifier::READ_WRITE, "uint", "tile_indirection_buf[]") + .image(1, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "in_tiles_img") + .compute_source("eevee_motion_blur_dilate_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_motion_blur_gather) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(MOTION_BLUR_GROUP_SIZE, MOTION_BLUR_GROUP_SIZE) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(eevee_sampling_data) -UNIFORM_BUF(6, MotionBlurData, motion_blur_buf) -SAMPLER(0, DEPTH_2D, depth_tx) -SAMPLER(1, FLOAT_2D, velocity_tx) -SAMPLER(2, FLOAT_2D, in_color_tx) -/* NOTE: See MotionBlurTileIndirection. */ -STORAGE_BUF(0, READ, uint, tile_indirection_buf[]) -IMAGE(0, GPU_RGBA16F, READ, FLOAT_2D, in_tiles_img) -IMAGE(1, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_img) -COMPUTE_SOURCE("eevee_motion_blur_gather_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(MOTION_BLUR_GROUP_SIZE, MOTION_BLUR_GROUP_SIZE) + .additional_info("eevee_shared") + .additional_info("draw_view") + .additional_info("eevee_sampling_data") + .uniform_buf(6, "MotionBlurData", "motion_blur_buf") + .sampler(0, ImageType::DEPTH_2D, "depth_tx") + .sampler(1, ImageType::FLOAT_2D, "velocity_tx") + .sampler(2, ImageType::FLOAT_2D, "in_color_tx") + /* NOTE: See MotionBlurTileIndirection. */ + .storage_buf(0, Qualifier::READ, "uint", "tile_indirection_buf[]") + .image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "in_tiles_img") + .image(1, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img") + .compute_source("eevee_motion_blur_gather_comp.glsl"); diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_shadow_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_shadow_info.hh index 8f002876f89..4d3826daca6 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_shadow_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_shadow_info.hh @@ -13,284 +13,266 @@ /* NOTE(Metal): As this is implemented using a fundamental data type, this needs to be specified * explicitly as uint for code generation, as the MSLShaderGenerator needs to be able to * distinguish between classes and fundamental types during code generation. */ -#define SHADOW_TILE_DATA_PACKED uint -#define SHADOW_PAGE_PACKED uint +#define SHADOW_TILE_DATA_PACKED "uint" +#define SHADOW_PAGE_PACKED "uint" GPU_SHADER_CREATE_INFO(eevee_shadow_clipmap_clear) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(SHADOW_CLIPMAP_GROUP_SIZE) -STORAGE_BUF(0, WRITE, ShadowTileMapClip, tilemaps_clip_buf[]) -PUSH_CONSTANT(INT, tilemaps_clip_buf_len) -ADDITIONAL_INFO(eevee_shared) -COMPUTE_SOURCE("eevee_shadow_clipmap_clear_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(SHADOW_CLIPMAP_GROUP_SIZE) + .storage_buf(0, Qualifier::WRITE, "ShadowTileMapClip", "tilemaps_clip_buf[]") + .push_constant(Type::INT, "tilemaps_clip_buf_len") + .additional_info("eevee_shared") + .compute_source("eevee_shadow_clipmap_clear_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_shadow_tilemap_bounds) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(SHADOW_BOUNDS_GROUP_SIZE) -STORAGE_BUF(LIGHT_BUF_SLOT, READ_WRITE, LightData, light_buf[]) -STORAGE_BUF(LIGHT_CULL_BUF_SLOT, READ, LightCullingData, light_cull_buf) -STORAGE_BUF(4, READ, uint, casters_id_buf[]) -STORAGE_BUF(5, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) -STORAGE_BUF(6, READ, ObjectBounds, bounds_buf[]) -STORAGE_BUF(7, READ_WRITE, ShadowTileMapClip, tilemaps_clip_buf[]) -PUSH_CONSTANT(INT, resource_len) -TYPEDEF_SOURCE("draw_shader_shared.hh") -ADDITIONAL_INFO(eevee_shared) -COMPUTE_SOURCE("eevee_shadow_tilemap_bounds_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(SHADOW_BOUNDS_GROUP_SIZE) + .storage_buf(LIGHT_BUF_SLOT, Qualifier::READ_WRITE, "LightData", "light_buf[]") + .storage_buf(LIGHT_CULL_BUF_SLOT, Qualifier::READ, "LightCullingData", "light_cull_buf") + .storage_buf(4, Qualifier::READ, "uint", "casters_id_buf[]") + .storage_buf(5, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") + .storage_buf(6, Qualifier::READ, "ObjectBounds", "bounds_buf[]") + .storage_buf(7, Qualifier::READ_WRITE, "ShadowTileMapClip", "tilemaps_clip_buf[]") + .push_constant(Type::INT, "resource_len") + .typedef_source("draw_shader_shared.hh") + .additional_info("eevee_shared") + .compute_source("eevee_shadow_tilemap_bounds_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_shadow_tilemap_init) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) -STORAGE_BUF(0, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) -STORAGE_BUF(1, READ_WRITE, SHADOW_TILE_DATA_PACKED, tiles_buf[]) -STORAGE_BUF(2, READ_WRITE, ShadowTileMapClip, tilemaps_clip_buf[]) -STORAGE_BUF(4, READ_WRITE, uvec2, pages_cached_buf[]) -ADDITIONAL_INFO(eevee_shared) -COMPUTE_SOURCE("eevee_shadow_tilemap_init_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) + .storage_buf(0, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") + .storage_buf(1, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") + .storage_buf(2, Qualifier::READ_WRITE, "ShadowTileMapClip", "tilemaps_clip_buf[]") + .storage_buf(4, Qualifier::READ_WRITE, "uvec2", "pages_cached_buf[]") + .additional_info("eevee_shared") + .compute_source("eevee_shadow_tilemap_init_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_shadow_tag_update) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(1, 1, 1) -STORAGE_BUF(0, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) -STORAGE_BUF(1, READ_WRITE, SHADOW_TILE_DATA_PACKED, tiles_buf[]) -STORAGE_BUF(5, READ, ObjectBounds, bounds_buf[]) -STORAGE_BUF(6, READ, uint, resource_ids_buf[]) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_view_culling) -COMPUTE_SOURCE("eevee_shadow_tag_update_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(1, 1, 1) + .storage_buf(0, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") + .storage_buf(1, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") + .storage_buf(5, Qualifier::READ, "ObjectBounds", "bounds_buf[]") + .storage_buf(6, Qualifier::READ, "uint", "resource_ids_buf[]") + .additional_info("eevee_shared") + .additional_info("draw_view") + .additional_info("draw_view_culling") + .compute_source("eevee_shadow_tag_update_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_shadow_tag_usage_opaque) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(SHADOW_DEPTH_SCAN_GROUP_SIZE, SHADOW_DEPTH_SCAN_GROUP_SIZE) -STORAGE_BUF(5, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) -STORAGE_BUF(6, READ_WRITE, SHADOW_TILE_DATA_PACKED, tiles_buf[]) -PUSH_CONSTANT(IVEC2, input_depth_extent) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_view_culling) -ADDITIONAL_INFO(eevee_hiz_data) -ADDITIONAL_INFO(eevee_light_data) -COMPUTE_SOURCE("eevee_shadow_tag_usage_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(SHADOW_DEPTH_SCAN_GROUP_SIZE, SHADOW_DEPTH_SCAN_GROUP_SIZE) + .storage_buf(5, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") + .storage_buf(6, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") + .push_constant(Type::IVEC2, "input_depth_extent") + .additional_info( + "eevee_shared", "draw_view", "draw_view_culling", "eevee_hiz_data", "eevee_light_data") + .compute_source("eevee_shadow_tag_usage_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_shadow_tag_usage_surfels) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(SURFEL_GROUP_SIZE) -STORAGE_BUF(6, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) -STORAGE_BUF(7, READ_WRITE, SHADOW_TILE_DATA_PACKED, tiles_buf[]) -PUSH_CONSTANT(INT, directional_level) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_view_culling) -ADDITIONAL_INFO(eevee_light_data) -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(eevee_surfel_common) -COMPUTE_SOURCE("eevee_shadow_tag_usage_surfels_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(SURFEL_GROUP_SIZE) + .storage_buf(6, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") + .storage_buf(7, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") + .push_constant(Type::INT, "directional_level") + .additional_info("eevee_shared") + .additional_info("draw_view") + .additional_info("draw_view_culling") + .additional_info("eevee_light_data") + .additional_info("eevee_global_ubo") + .additional_info("eevee_surfel_common") + .compute_source("eevee_shadow_tag_usage_surfels_comp.glsl"); GPU_SHADER_NAMED_INTERFACE_INFO(eevee_shadow_tag_transparent_iface, interp) -SMOOTH(VEC3, P) -SMOOTH(VEC3, vP) -GPU_SHADER_INTERFACE_END() + .smooth(Type::VEC3, "P") + .smooth(Type::VEC3, "vP"); GPU_SHADER_NAMED_INTERFACE_INFO(eevee_shadow_tag_transparent_flat_iface, interp_flat) -FLAT(VEC3, ls_aabb_min) -FLAT(VEC3, ls_aabb_max) -GPU_SHADER_INTERFACE_END() + .flat(Type::VEC3, "ls_aabb_min") + .flat(Type::VEC3, "ls_aabb_max"); GPU_SHADER_CREATE_INFO(eevee_shadow_tag_usage_transparent) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -STORAGE_BUF(4, READ, ObjectBounds, bounds_buf[]) -STORAGE_BUF(5, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) -STORAGE_BUF(6, READ_WRITE, SHADOW_TILE_DATA_PACKED, tiles_buf[]) -PUSH_CONSTANT(IVEC2, fb_resolution) -PUSH_CONSTANT(INT, fb_lod) -VERTEX_OUT(eevee_shadow_tag_transparent_iface) -VERTEX_OUT(eevee_shadow_tag_transparent_flat_iface) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_resource_id_varying) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_view_culling) -ADDITIONAL_INFO(draw_modelmat_new) -ADDITIONAL_INFO(eevee_hiz_data) -ADDITIONAL_INFO(eevee_light_data) -VERTEX_SOURCE("eevee_shadow_tag_usage_vert.glsl") -FRAGMENT_SOURCE("eevee_shadow_tag_usage_frag.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .storage_buf(4, Qualifier::READ, "ObjectBounds", "bounds_buf[]") + .storage_buf(5, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") + .storage_buf(6, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") + .push_constant(Type::IVEC2, "fb_resolution") + .push_constant(Type::INT, "fb_lod") + .vertex_out(eevee_shadow_tag_transparent_iface) + .vertex_out(eevee_shadow_tag_transparent_flat_iface) + .additional_info("eevee_shared") + .additional_info("draw_resource_id_varying") + .additional_info("draw_view") + .additional_info("draw_view_culling") + .additional_info("draw_modelmat_new") + .additional_info("eevee_hiz_data") + .additional_info("eevee_light_data") + .vertex_source("eevee_shadow_tag_usage_vert.glsl") + .fragment_source("eevee_shadow_tag_usage_frag.glsl"); GPU_SHADER_CREATE_INFO(eevee_shadow_tag_usage_volume) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE) -STORAGE_BUF(4, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) -STORAGE_BUF(5, READ_WRITE, SHADOW_TILE_DATA_PACKED, tiles_buf[]) -ADDITIONAL_INFO(eevee_volume_properties_data) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_view_culling) -ADDITIONAL_INFO(eevee_hiz_data) -ADDITIONAL_INFO(eevee_light_data) -ADDITIONAL_INFO(eevee_sampling_data) -COMPUTE_SOURCE("eevee_shadow_tag_usage_volume_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE) + .storage_buf(4, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") + .storage_buf(5, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") + .additional_info("eevee_volume_properties_data") + .additional_info("eevee_shared") + .additional_info("draw_view") + .additional_info("draw_view_culling") + .additional_info("eevee_hiz_data") + .additional_info("eevee_light_data") + .additional_info("eevee_sampling_data") + .compute_source("eevee_shadow_tag_usage_volume_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_shadow_page_mask) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) -PUSH_CONSTANT(INT, max_view_per_tilemap) -STORAGE_BUF(0, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) -STORAGE_BUF(1, READ_WRITE, SHADOW_TILE_DATA_PACKED, tiles_buf[]) -ADDITIONAL_INFO(eevee_shared) -COMPUTE_SOURCE("eevee_shadow_page_mask_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) + .push_constant(Type::INT, "max_view_per_tilemap") + .storage_buf(0, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") + .storage_buf(1, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") + .additional_info("eevee_shared") + .compute_source("eevee_shadow_page_mask_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_shadow_page_free) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(SHADOW_TILEMAP_LOD0_LEN) -STORAGE_BUF(0, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) -STORAGE_BUF(1, READ_WRITE, SHADOW_TILE_DATA_PACKED, tiles_buf[]) -STORAGE_BUF(2, READ_WRITE, ShadowPagesInfoData, pages_infos_buf) -STORAGE_BUF(3, READ_WRITE, uint, pages_free_buf[]) -STORAGE_BUF(4, READ_WRITE, uvec2, pages_cached_buf[]) -ADDITIONAL_INFO(eevee_shared) -COMPUTE_SOURCE("eevee_shadow_page_free_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(SHADOW_TILEMAP_LOD0_LEN) + .storage_buf(0, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") + .storage_buf(1, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") + .storage_buf(2, Qualifier::READ_WRITE, "ShadowPagesInfoData", "pages_infos_buf") + .storage_buf(3, Qualifier::READ_WRITE, "uint", "pages_free_buf[]") + .storage_buf(4, Qualifier::READ_WRITE, "uvec2", "pages_cached_buf[]") + .additional_info("eevee_shared") + .compute_source("eevee_shadow_page_free_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_shadow_page_defrag) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(1) -TYPEDEF_SOURCE("draw_shader_shared.hh") -STORAGE_BUF(1, READ_WRITE, SHADOW_TILE_DATA_PACKED, tiles_buf[]) -STORAGE_BUF(2, READ_WRITE, ShadowPagesInfoData, pages_infos_buf) -STORAGE_BUF(3, READ_WRITE, uint, pages_free_buf[]) -STORAGE_BUF(4, READ_WRITE, uvec2, pages_cached_buf[]) -STORAGE_BUF(5, WRITE, DispatchCommand, clear_dispatch_buf) -STORAGE_BUF(6, WRITE, DrawCommand, tile_draw_buf) -STORAGE_BUF(7, READ_WRITE, ShadowStatistics, statistics_buf) -ADDITIONAL_INFO(eevee_shared) -COMPUTE_SOURCE("eevee_shadow_page_defrag_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(1) + .typedef_source("draw_shader_shared.hh") + .storage_buf(1, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") + .storage_buf(2, Qualifier::READ_WRITE, "ShadowPagesInfoData", "pages_infos_buf") + .storage_buf(3, Qualifier::READ_WRITE, "uint", "pages_free_buf[]") + .storage_buf(4, Qualifier::READ_WRITE, "uvec2", "pages_cached_buf[]") + .storage_buf(5, Qualifier::WRITE, "DispatchCommand", "clear_dispatch_buf") + .storage_buf(6, Qualifier::WRITE, "DrawCommand", "tile_draw_buf") + .storage_buf(7, Qualifier::READ_WRITE, "ShadowStatistics", "statistics_buf") + .additional_info("eevee_shared") + .compute_source("eevee_shadow_page_defrag_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_shadow_page_allocate) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(SHADOW_TILEMAP_LOD0_LEN) -TYPEDEF_SOURCE("draw_shader_shared.hh") -STORAGE_BUF(0, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) -STORAGE_BUF(1, READ_WRITE, SHADOW_TILE_DATA_PACKED, tiles_buf[]) -STORAGE_BUF(2, READ_WRITE, ShadowPagesInfoData, pages_infos_buf) -STORAGE_BUF(3, READ_WRITE, uint, pages_free_buf[]) -STORAGE_BUF(4, READ_WRITE, uvec2, pages_cached_buf[]) -STORAGE_BUF(6, READ_WRITE, ShadowStatistics, statistics_buf) -ADDITIONAL_INFO(eevee_shared) -COMPUTE_SOURCE("eevee_shadow_page_allocate_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(SHADOW_TILEMAP_LOD0_LEN) + .typedef_source("draw_shader_shared.hh") + .storage_buf(0, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") + .storage_buf(1, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") + .storage_buf(2, Qualifier::READ_WRITE, "ShadowPagesInfoData", "pages_infos_buf") + .storage_buf(3, Qualifier::READ_WRITE, "uint", "pages_free_buf[]") + .storage_buf(4, Qualifier::READ_WRITE, "uvec2", "pages_cached_buf[]") + .storage_buf(6, Qualifier::READ_WRITE, "ShadowStatistics", "statistics_buf") + .additional_info("eevee_shared") + .compute_source("eevee_shadow_page_allocate_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_shadow_tilemap_finalize) -DO_STATIC_COMPILATION() -TYPEDEF_SOURCE("draw_shader_shared.hh") -LOCAL_GROUP_SIZE(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) -STORAGE_BUF(0, READ, ShadowTileMapData, tilemaps_buf[]) -STORAGE_BUF(1, READ, SHADOW_TILE_DATA_PACKED, tiles_buf[]) -STORAGE_BUF(2, READ_WRITE, ShadowPagesInfoData, pages_infos_buf) -STORAGE_BUF(3, READ_WRITE, ShadowStatistics, statistics_buf) -STORAGE_BUF(4, WRITE, ViewMatrices, view_infos_buf[SHADOW_VIEW_MAX]) -STORAGE_BUF(5, WRITE, ShadowRenderView, render_view_buf[SHADOW_VIEW_MAX]) -STORAGE_BUF(6, READ, ShadowTileMapClip, tilemaps_clip_buf[]) -IMAGE(0, GPU_R32UI, WRITE, UINT_2D, tilemaps_img) -ADDITIONAL_INFO(eevee_shared) -COMPUTE_SOURCE("eevee_shadow_tilemap_finalize_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .typedef_source("draw_shader_shared.hh") + .local_group_size(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) + .storage_buf(0, Qualifier::READ, "ShadowTileMapData", "tilemaps_buf[]") + .storage_buf(1, Qualifier::READ, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") + .storage_buf(2, Qualifier::READ_WRITE, "ShadowPagesInfoData", "pages_infos_buf") + .storage_buf(3, Qualifier::READ_WRITE, "ShadowStatistics", "statistics_buf") + .storage_buf(4, Qualifier::WRITE, "ViewMatrices", "view_infos_buf[SHADOW_VIEW_MAX]") + .storage_buf(5, Qualifier::WRITE, "ShadowRenderView", "render_view_buf[SHADOW_VIEW_MAX]") + .storage_buf(6, Qualifier::READ, "ShadowTileMapClip", "tilemaps_clip_buf[]") + .image(0, GPU_R32UI, Qualifier::WRITE, ImageType::UINT_2D, "tilemaps_img") + .additional_info("eevee_shared") + .compute_source("eevee_shadow_tilemap_finalize_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_shadow_tilemap_rendermap) -DO_STATIC_COMPILATION() -TYPEDEF_SOURCE("draw_shader_shared.hh") -LOCAL_GROUP_SIZE(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) -STORAGE_BUF(0, READ_WRITE, ShadowStatistics, statistics_buf) -STORAGE_BUF(1, READ, ShadowRenderView, render_view_buf[SHADOW_VIEW_MAX]) -STORAGE_BUF(2, READ_WRITE, SHADOW_TILE_DATA_PACKED, tiles_buf[]) -STORAGE_BUF(3, READ_WRITE, DispatchCommand, clear_dispatch_buf) -STORAGE_BUF(4, READ_WRITE, DrawCommand, tile_draw_buf) -STORAGE_BUF(5, WRITE, SHADOW_PAGE_PACKED, dst_coord_buf[SHADOW_RENDER_MAP_SIZE]) -STORAGE_BUF(6, WRITE, SHADOW_PAGE_PACKED, src_coord_buf[SHADOW_RENDER_MAP_SIZE]) -STORAGE_BUF(7, WRITE, SHADOW_PAGE_PACKED, render_map_buf[SHADOW_RENDER_MAP_SIZE]) -ADDITIONAL_INFO(eevee_shared) -COMPUTE_SOURCE("eevee_shadow_tilemap_rendermap_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .typedef_source("draw_shader_shared.hh") + .local_group_size(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) + .storage_buf(0, Qualifier::READ_WRITE, "ShadowStatistics", "statistics_buf") + .storage_buf(1, Qualifier::READ, "ShadowRenderView", "render_view_buf[SHADOW_VIEW_MAX]") + .storage_buf(2, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") + .storage_buf(3, Qualifier::READ_WRITE, "DispatchCommand", "clear_dispatch_buf") + .storage_buf(4, Qualifier::READ_WRITE, "DrawCommand", "tile_draw_buf") + .storage_buf(5, Qualifier::WRITE, SHADOW_PAGE_PACKED, "dst_coord_buf[SHADOW_RENDER_MAP_SIZE]") + .storage_buf(6, Qualifier::WRITE, SHADOW_PAGE_PACKED, "src_coord_buf[SHADOW_RENDER_MAP_SIZE]") + .storage_buf(7, Qualifier::WRITE, SHADOW_PAGE_PACKED, "render_map_buf[SHADOW_RENDER_MAP_SIZE]") + .additional_info("eevee_shared") + .compute_source("eevee_shadow_tilemap_rendermap_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_shadow_tilemap_amend) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) -IMAGE(0, GPU_R32UI, READ_WRITE, UINT_2D, tilemaps_img) -STORAGE_BUF(LIGHT_CULL_BUF_SLOT, READ, LightCullingData, light_cull_buf) -STORAGE_BUF(LIGHT_BUF_SLOT, READ_WRITE, LightData, light_buf[]) -/* The call bind_resources(lights) also uses LIGHT_ZBIN_BUF_SLOT and LIGHT_TILE_BUF_SLOT. */ -STORAGE_BUF(4, READ, ShadowTileMapData, tilemaps_buf[]) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(draw_view) -COMPUTE_SOURCE("eevee_shadow_tilemap_amend_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) + .image(0, GPU_R32UI, Qualifier::READ_WRITE, ImageType::UINT_2D, "tilemaps_img") + .storage_buf(LIGHT_CULL_BUF_SLOT, Qualifier::READ, "LightCullingData", "light_cull_buf") + .storage_buf(LIGHT_BUF_SLOT, Qualifier::READ_WRITE, "LightData", "light_buf[]") + /* The call bind_resources(lights) also uses LIGHT_ZBIN_BUF_SLOT and LIGHT_TILE_BUF_SLOT. */ + .storage_buf(4, Qualifier::READ, "ShadowTileMapData", "tilemaps_buf[]") + .additional_info("eevee_shared") + .additional_info("draw_view") + .compute_source("eevee_shadow_tilemap_amend_comp.glsl"); /* AtomicMin clear implementation. */ GPU_SHADER_CREATE_INFO(eevee_shadow_page_clear) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(SHADOW_PAGE_CLEAR_GROUP_SIZE, SHADOW_PAGE_CLEAR_GROUP_SIZE) -STORAGE_BUF(2, READ, ShadowPagesInfoData, pages_infos_buf) -STORAGE_BUF(6, READ, SHADOW_PAGE_PACKED, dst_coord_buf[SHADOW_RENDER_MAP_SIZE]) -ADDITIONAL_INFO(eevee_shared) -COMPUTE_SOURCE("eevee_shadow_page_clear_comp.glsl") -IMAGE(SHADOW_ATLAS_IMG_SLOT, GPU_R32UI, READ_WRITE, UINT_2D_ARRAY_ATOMIC, shadow_atlas_img) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(SHADOW_PAGE_CLEAR_GROUP_SIZE, SHADOW_PAGE_CLEAR_GROUP_SIZE) + .storage_buf(2, Qualifier::READ, "ShadowPagesInfoData", "pages_infos_buf") + .storage_buf(6, Qualifier::READ, SHADOW_PAGE_PACKED, "dst_coord_buf[SHADOW_RENDER_MAP_SIZE]") + .additional_info("eevee_shared") + .compute_source("eevee_shadow_page_clear_comp.glsl") + .image(SHADOW_ATLAS_IMG_SLOT, + GPU_R32UI, + Qualifier::READ_WRITE, + ImageType::UINT_2D_ARRAY_ATOMIC, + "shadow_atlas_img"); /* TBDR clear implementation. */ GPU_SHADER_CREATE_INFO(eevee_shadow_page_tile_clear) -DO_STATIC_COMPILATION() -DEFINE("PASS_CLEAR") -ADDITIONAL_INFO(eevee_shared) -BUILTINS(BuiltinBits::VIEWPORT_INDEX | BuiltinBits::LAYER) -STORAGE_BUF(8, READ, SHADOW_PAGE_PACKED, src_coord_buf[SHADOW_RENDER_MAP_SIZE]) -VERTEX_SOURCE("eevee_shadow_page_tile_vert.glsl") -FRAGMENT_SOURCE("eevee_shadow_page_tile_frag.glsl") -FRAGMENT_OUT_ROG(0, FLOAT, out_tile_depth, SHADOW_ROG_ID) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("PASS_CLEAR") + .additional_info("eevee_shared") + .builtins(BuiltinBits::VIEWPORT_INDEX | BuiltinBits::LAYER) + .storage_buf(8, Qualifier::READ, SHADOW_PAGE_PACKED, "src_coord_buf[SHADOW_RENDER_MAP_SIZE]") + .vertex_source("eevee_shadow_page_tile_vert.glsl") + .fragment_source("eevee_shadow_page_tile_frag.glsl") + .fragment_out(0, Type::FLOAT, "out_tile_depth", DualBlend::NONE, SHADOW_ROG_ID); #ifdef APPLE /* Metal supports USHORT which saves a bit of performance here. */ -# define PAGE_Z_TYPE USHORT +# define PAGE_Z_TYPE Type::USHORT #else -# define PAGE_Z_TYPE UINT +# define PAGE_Z_TYPE Type::UINT #endif /* Interface for passing precalculated values in accumulation vertex to frag. */ GPU_SHADER_NAMED_INTERFACE_INFO(eevee_shadow_page_tile_store_noperspective_iface, interp_noperspective) -NO_PERSPECTIVE(VEC2, out_texel_xy) -GPU_SHADER_INTERFACE_END() - + .no_perspective(Type::VEC2, "out_texel_xy"); GPU_SHADER_NAMED_INTERFACE_INFO(eevee_shadow_page_tile_store_flat_iface, interp_flat) -FLAT(PAGE_Z_TYPE, out_page_z) -GPU_SHADER_INTERFACE_END() + .flat(PAGE_Z_TYPE, "out_page_z"); #undef PAGE_Z_TYPE /* 2nd tile pass to store shadow depths in atlas. */ GPU_SHADER_CREATE_INFO(eevee_shadow_page_tile_store) -DO_STATIC_COMPILATION() -DEFINE("PASS_DEPTH_STORE") -ADDITIONAL_INFO(eevee_shared) -BUILTINS(BuiltinBits::VIEWPORT_INDEX | BuiltinBits::LAYER) -STORAGE_BUF(7, READ, SHADOW_PAGE_PACKED, dst_coord_buf[SHADOW_RENDER_MAP_SIZE]) -STORAGE_BUF(8, READ, SHADOW_PAGE_PACKED, src_coord_buf[SHADOW_RENDER_MAP_SIZE]) -SUBPASS_IN(0, FLOAT, in_tile_depth, SHADOW_ROG_ID) -IMAGE(SHADOW_ATLAS_IMG_SLOT, GPU_R32UI, READ_WRITE, UINT_2D_ARRAY, shadow_atlas_img) -VERTEX_OUT(eevee_shadow_page_tile_store_noperspective_iface) -VERTEX_OUT(eevee_shadow_page_tile_store_flat_iface) -VERTEX_SOURCE("eevee_shadow_page_tile_vert.glsl") -FRAGMENT_SOURCE("eevee_shadow_page_tile_frag.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("PASS_DEPTH_STORE") + .additional_info("eevee_shared") + .builtins(BuiltinBits::VIEWPORT_INDEX | BuiltinBits::LAYER) + .storage_buf(7, Qualifier::READ, SHADOW_PAGE_PACKED, "dst_coord_buf[SHADOW_RENDER_MAP_SIZE]") + .storage_buf(8, Qualifier::READ, SHADOW_PAGE_PACKED, "src_coord_buf[SHADOW_RENDER_MAP_SIZE]") + .subpass_in(0, Type::FLOAT, "in_tile_depth", SHADOW_ROG_ID) + .image(SHADOW_ATLAS_IMG_SLOT, + GPU_R32UI, + Qualifier::READ_WRITE, + ImageType::UINT_2D_ARRAY, + "shadow_atlas_img") + .vertex_out(eevee_shadow_page_tile_store_noperspective_iface) + .vertex_out(eevee_shadow_page_tile_store_flat_iface) + .vertex_source("eevee_shadow_page_tile_vert.glsl") + .fragment_source("eevee_shadow_page_tile_frag.glsl"); /** \} */ @@ -299,18 +281,16 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(eevee_shadow_data) -/* SHADOW_READ_ATOMIC macro indicating shadow functions should use `usampler2DArrayAtomic` as - * the atlas type. */ -DEFINE("SHADOW_READ_ATOMIC") -BUILTINS(BuiltinBits::TEXTURE_ATOMIC) -SAMPLER(SHADOW_ATLAS_TEX_SLOT, UINT_2D_ARRAY_ATOMIC, shadow_atlas_tx) -SAMPLER(SHADOW_TILEMAPS_TEX_SLOT, UINT_2D, shadow_tilemaps_tx) -GPU_SHADER_CREATE_END() + /* SHADOW_READ_ATOMIC macro indicating shadow functions should use `usampler2DArrayAtomic` as + * the atlas type. */ + .define("SHADOW_READ_ATOMIC") + .builtins(BuiltinBits::TEXTURE_ATOMIC) + .sampler(SHADOW_ATLAS_TEX_SLOT, ImageType::UINT_2D_ARRAY_ATOMIC, "shadow_atlas_tx") + .sampler(SHADOW_TILEMAPS_TEX_SLOT, ImageType::UINT_2D, "shadow_tilemaps_tx"); GPU_SHADER_CREATE_INFO(eevee_shadow_data_non_atomic) -SAMPLER(SHADOW_ATLAS_TEX_SLOT, UINT_2D_ARRAY, shadow_atlas_tx) -SAMPLER(SHADOW_TILEMAPS_TEX_SLOT, UINT_2D, shadow_tilemaps_tx) -GPU_SHADER_CREATE_END() + .sampler(SHADOW_ATLAS_TEX_SLOT, ImageType::UINT_2D_ARRAY, "shadow_atlas_tx") + .sampler(SHADOW_TILEMAPS_TEX_SLOT, ImageType::UINT_2D, "shadow_tilemaps_tx"); /** \} */ @@ -319,21 +299,17 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(eevee_shadow_debug) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(eevee_shared) -STORAGE_BUF(5, READ, ShadowTileMapData, tilemaps_buf[]) -STORAGE_BUF(6, READ, SHADOW_TILE_DATA_PACKED, tiles_buf[]) -FRAGMENT_OUT_DUAL(0, VEC4, out_color_add, SRC_0) -FRAGMENT_OUT_DUAL(0, VEC4, out_color_mul, SRC_1) -PUSH_CONSTANT(INT, debug_mode) -PUSH_CONSTANT(INT, debug_tilemap_index) -DEPTH_WRITE(DepthWrite::ANY) -FRAGMENT_SOURCE("eevee_shadow_debug_frag.glsl") -ADDITIONAL_INFO(draw_fullscreen) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(eevee_hiz_data) -ADDITIONAL_INFO(eevee_light_data) -ADDITIONAL_INFO(eevee_shadow_data) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("eevee_shared") + .storage_buf(5, Qualifier::READ, "ShadowTileMapData", "tilemaps_buf[]") + .storage_buf(6, Qualifier::READ, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") + .fragment_out(0, Type::VEC4, "out_color_add", DualBlend::SRC_0) + .fragment_out(0, Type::VEC4, "out_color_mul", DualBlend::SRC_1) + .push_constant(Type::INT, "debug_mode") + .push_constant(Type::INT, "debug_tilemap_index") + .depth_write(DepthWrite::ANY) + .fragment_source("eevee_shadow_debug_frag.glsl") + .additional_info( + "draw_fullscreen", "draw_view", "eevee_hiz_data", "eevee_light_data", "eevee_shadow_data"); /** \} */ diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_subsurface_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_subsurface_info.hh index 9cbf7912e55..a6ea8f6b4e6 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_subsurface_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_subsurface_info.hh @@ -6,34 +6,37 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(eevee_subsurface_setup) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(SUBSURFACE_GROUP_SIZE, SUBSURFACE_GROUP_SIZE) -TYPEDEF_SOURCE("draw_shader_shared.hh") -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_gbuffer_data) -SAMPLER(2, DEPTH_2D, depth_tx) -IMAGE(0, DEFERRED_RADIANCE_FORMAT, READ, UINT_2D, direct_light_img) -IMAGE(1, RAYTRACE_RADIANCE_FORMAT, READ, FLOAT_2D, indirect_light_img) -IMAGE(2, SUBSURFACE_OBJECT_ID_FORMAT, WRITE, UINT_2D, object_id_img) -IMAGE(3, SUBSURFACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, radiance_img) -STORAGE_BUF(0, WRITE, uint, convolve_tile_buf[]) -STORAGE_BUF(1, READ_WRITE, DispatchCommand, convolve_dispatch_buf) -COMPUTE_SOURCE("eevee_subsurface_setup_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(SUBSURFACE_GROUP_SIZE, SUBSURFACE_GROUP_SIZE) + .typedef_source("draw_shader_shared.hh") + .additional_info("draw_view") + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data") + .sampler(2, ImageType::DEPTH_2D, "depth_tx") + .image(0, DEFERRED_RADIANCE_FORMAT, Qualifier::READ, ImageType::UINT_2D, "direct_light_img") + .image(1, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "indirect_light_img") + .image(2, SUBSURFACE_OBJECT_ID_FORMAT, Qualifier::WRITE, ImageType::UINT_2D, "object_id_img") + .image(3, SUBSURFACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "radiance_img") + .storage_buf(0, Qualifier::WRITE, "uint", "convolve_tile_buf[]") + .storage_buf(1, Qualifier::READ_WRITE, "DispatchCommand", "convolve_dispatch_buf") + .compute_source("eevee_subsurface_setup_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_subsurface_convolve) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(SUBSURFACE_GROUP_SIZE, SUBSURFACE_GROUP_SIZE) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_gbuffer_data) -ADDITIONAL_INFO(eevee_global_ubo) -SAMPLER(2, FLOAT_2D, radiance_tx) -SAMPLER(3, DEPTH_2D, depth_tx) -SAMPLER(4, UINT_2D, object_id_tx) -STORAGE_BUF(0, READ, uint, tiles_coord_buf[]) -IMAGE(0, DEFERRED_RADIANCE_FORMAT, WRITE, UINT_2D, out_direct_light_img) -IMAGE(1, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, out_indirect_light_img) -COMPUTE_SOURCE("eevee_subsurface_convolve_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(SUBSURFACE_GROUP_SIZE, SUBSURFACE_GROUP_SIZE) + .additional_info("draw_view") + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data") + .additional_info("eevee_global_ubo") + .sampler(2, ImageType::FLOAT_2D, "radiance_tx") + .sampler(3, ImageType::DEPTH_2D, "depth_tx") + .sampler(4, ImageType::UINT_2D, "object_id_tx") + .storage_buf(0, Qualifier::READ, "uint", "tiles_coord_buf[]") + .image( + 0, DEFERRED_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::UINT_2D, "out_direct_light_img") + .image(1, + RAYTRACE_RADIANCE_FORMAT, + Qualifier::WRITE, + ImageType::FLOAT_2D, + "out_indirect_light_img") + .compute_source("eevee_subsurface_convolve_comp.glsl"); diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_tracing_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_tracing_info.hh index ff2a2acd6a7..ff8f1a26084 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_tracing_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_tracing_info.hh @@ -15,266 +15,250 @@ image(slot, format, Qualifier::READ, type, name, Frequency::PASS) GPU_SHADER_CREATE_INFO(eevee_ray_tile_classify) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_gbuffer_data) -ADDITIONAL_INFO(eevee_global_ubo) -TYPEDEF_SOURCE("draw_shader_shared.hh") -IMAGE_FREQ(0, RAYTRACE_TILEMASK_FORMAT, WRITE, UINT_2D_ARRAY, tile_raytrace_denoise_img, PASS) -IMAGE_FREQ(1, RAYTRACE_TILEMASK_FORMAT, WRITE, UINT_2D_ARRAY, tile_raytrace_tracing_img, PASS) -IMAGE_FREQ(2, RAYTRACE_TILEMASK_FORMAT, WRITE, UINT_2D_ARRAY, tile_horizon_denoise_img, PASS) -IMAGE_FREQ(3, RAYTRACE_TILEMASK_FORMAT, WRITE, UINT_2D_ARRAY, tile_horizon_tracing_img, PASS) -COMPUTE_SOURCE("eevee_ray_tile_classify_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data") + .additional_info("eevee_global_ubo") + .typedef_source("draw_shader_shared.hh") + .image_out(0, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_raytrace_denoise_img") + .image_out(1, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_raytrace_tracing_img") + .image_out(2, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_horizon_denoise_img") + .image_out(3, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_horizon_tracing_img") + .compute_source("eevee_ray_tile_classify_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_ray_tile_compact) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_global_ubo) -TYPEDEF_SOURCE("draw_shader_shared.hh") -IMAGE_FREQ(0, RAYTRACE_TILEMASK_FORMAT, READ, UINT_2D_ARRAY, tile_raytrace_denoise_img, PASS) -IMAGE_FREQ(1, RAYTRACE_TILEMASK_FORMAT, READ, UINT_2D_ARRAY, tile_raytrace_tracing_img, PASS) -STORAGE_BUF(0, READ_WRITE, DispatchCommand, raytrace_tracing_dispatch_buf) -STORAGE_BUF(1, READ_WRITE, DispatchCommand, raytrace_denoise_dispatch_buf) -STORAGE_BUF(4, WRITE, uint, raytrace_tracing_tiles_buf[]) -STORAGE_BUF(5, WRITE, uint, raytrace_denoise_tiles_buf[]) -SPECIALIZATION_CONSTANT(INT, closure_index, 0) -SPECIALIZATION_CONSTANT(INT, resolution_scale, 2) -COMPUTE_SOURCE("eevee_ray_tile_compact_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) + .additional_info("eevee_shared") + .additional_info("eevee_global_ubo") + .typedef_source("draw_shader_shared.hh") + .image_in(0, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_raytrace_denoise_img") + .image_in(1, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_raytrace_tracing_img") + .storage_buf(0, Qualifier::READ_WRITE, "DispatchCommand", "raytrace_tracing_dispatch_buf") + .storage_buf(1, Qualifier::READ_WRITE, "DispatchCommand", "raytrace_denoise_dispatch_buf") + .storage_buf(4, Qualifier::WRITE, "uint", "raytrace_tracing_tiles_buf[]") + .storage_buf(5, Qualifier::WRITE, "uint", "raytrace_denoise_tiles_buf[]") + .specialization_constant(Type::INT, "closure_index", 0) + .specialization_constant(Type::INT, "resolution_scale", 2) + .compute_source("eevee_ray_tile_compact_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_ray_generate) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_gbuffer_data) -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(eevee_sampling_data) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(eevee_utility_texture) -IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, out_ray_data_img) -STORAGE_BUF(4, READ, uint, tiles_coord_buf[]) -SPECIALIZATION_CONSTANT(INT, closure_index, 0) -COMPUTE_SOURCE("eevee_ray_generate_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data") + .additional_info("eevee_global_ubo") + .additional_info("eevee_sampling_data") + .additional_info("draw_view") + .additional_info("eevee_utility_texture") + .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_ray_data_img") + .storage_buf(4, Qualifier::READ, "uint", "tiles_coord_buf[]") + .specialization_constant(Type::INT, "closure_index", 0) + .compute_source("eevee_ray_generate_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_ray_trace_fallback) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_gbuffer_data) -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(eevee_sampling_data) -ADDITIONAL_INFO(eevee_lightprobe_data) -IMAGE(0, GPU_RGBA16F, READ, FLOAT_2D, ray_data_img) -IMAGE(1, RAYTRACE_RAYTIME_FORMAT, WRITE, FLOAT_2D, ray_time_img) -IMAGE(2, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, ray_radiance_img) -SAMPLER(1, DEPTH_2D, depth_tx) -STORAGE_BUF(5, READ, uint, tiles_coord_buf[]) -SPECIALIZATION_CONSTANT(INT, closure_index, 0) -COMPUTE_SOURCE("eevee_ray_trace_fallback_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data") + .additional_info("eevee_global_ubo") + .additional_info("draw_view") + .additional_info("eevee_sampling_data") + .additional_info("eevee_lightprobe_data") + .image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "ray_data_img") + .image(1, RAYTRACE_RAYTIME_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_time_img") + .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_radiance_img") + .sampler(1, ImageType::DEPTH_2D, "depth_tx") + .storage_buf(5, Qualifier::READ, "uint", "tiles_coord_buf[]") + .specialization_constant(Type::INT, "closure_index", 0) + .compute_source("eevee_ray_trace_fallback_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_ray_trace_planar) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) -DEFINE("PLANAR_PROBES") -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(eevee_sampling_data) -ADDITIONAL_INFO(eevee_gbuffer_data) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(eevee_lightprobe_data) -ADDITIONAL_INFO(eevee_lightprobe_planar_data) -IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, ray_data_img) -IMAGE(1, RAYTRACE_RAYTIME_FORMAT, WRITE, FLOAT_2D, ray_time_img) -IMAGE(2, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, ray_radiance_img) -SAMPLER(2, DEPTH_2D, depth_tx) -STORAGE_BUF(5, READ, uint, tiles_coord_buf[]) -SPECIALIZATION_CONSTANT(INT, closure_index, 0) -COMPUTE_SOURCE("eevee_ray_trace_planar_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) + .define("PLANAR_PROBES") + .additional_info("eevee_shared") + .additional_info("eevee_global_ubo") + .additional_info("eevee_sampling_data") + .additional_info("eevee_gbuffer_data") + .additional_info("draw_view") + .additional_info("eevee_lightprobe_data") + .additional_info("eevee_lightprobe_planar_data") + .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "ray_data_img") + .image(1, RAYTRACE_RAYTIME_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_time_img") + .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_radiance_img") + .sampler(2, ImageType::DEPTH_2D, "depth_tx") + .storage_buf(5, Qualifier::READ, "uint", "tiles_coord_buf[]") + .specialization_constant(Type::INT, "closure_index", 0) + .compute_source("eevee_ray_trace_planar_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_ray_trace_screen) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(eevee_sampling_data) -ADDITIONAL_INFO(eevee_gbuffer_data) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(eevee_hiz_data) -ADDITIONAL_INFO(eevee_lightprobe_data) -IMAGE(0, GPU_RGBA16F, READ, FLOAT_2D, ray_data_img) -IMAGE(1, RAYTRACE_RAYTIME_FORMAT, WRITE, FLOAT_2D, ray_time_img) -IMAGE(2, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, ray_radiance_img) -SAMPLER(0, DEPTH_2D, depth_tx) -SAMPLER(1, FLOAT_2D, radiance_front_tx) -SAMPLER(2, FLOAT_2D, radiance_back_tx) -SAMPLER(4, FLOAT_2D, hiz_front_tx) -SAMPLER(5, FLOAT_2D, hiz_back_tx) -STORAGE_BUF(5, READ, uint, tiles_coord_buf[]) -COMPUTE_SOURCE("eevee_ray_trace_screen_comp.glsl") -/* Metal: Provide compiler with hint to tune per-thread resource allocation. */ -MTL_MAX_TOTAL_THREADS_PER_THREADGROUP(400) -SPECIALIZATION_CONSTANT(BOOL, trace_refraction, true) -SPECIALIZATION_CONSTANT(INT, closure_index, 0) -COMPUTE_SOURCE("eevee_ray_trace_screen_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) + .additional_info("eevee_shared") + .additional_info("eevee_global_ubo") + .additional_info("eevee_sampling_data") + .additional_info("eevee_gbuffer_data") + .additional_info("draw_view") + .additional_info("eevee_hiz_data") + .additional_info("eevee_lightprobe_data") + .image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "ray_data_img") + .image(1, RAYTRACE_RAYTIME_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_time_img") + .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_radiance_img") + .sampler(0, ImageType::DEPTH_2D, "depth_tx") + .sampler(1, ImageType::FLOAT_2D, "radiance_front_tx") + .sampler(2, ImageType::FLOAT_2D, "radiance_back_tx") + .sampler(4, ImageType::FLOAT_2D, "hiz_front_tx") + .sampler(5, ImageType::FLOAT_2D, "hiz_back_tx") + .storage_buf(5, Qualifier::READ, "uint", "tiles_coord_buf[]") + .compute_source("eevee_ray_trace_screen_comp.glsl") + /* Metal: Provide compiler with hint to tune per-thread resource allocation. */ + .mtl_max_total_threads_per_threadgroup(400) + .specialization_constant(Type::BOOL, "trace_refraction", true) + .specialization_constant(Type::INT, "closure_index", 0) + .compute_source("eevee_ray_trace_screen_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_ray_denoise_spatial) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_gbuffer_data) -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(eevee_sampling_data) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(eevee_utility_texture) -SAMPLER(3, DEPTH_2D, depth_tx) -IMAGE(0, GPU_RGBA16F, READ, FLOAT_2D, ray_data_img) -IMAGE(1, RAYTRACE_RAYTIME_FORMAT, READ, FLOAT_2D, ray_time_img) -IMAGE(2, RAYTRACE_RADIANCE_FORMAT, READ, FLOAT_2D, ray_radiance_img) -IMAGE(3, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, out_radiance_img) -IMAGE(4, RAYTRACE_VARIANCE_FORMAT, WRITE, FLOAT_2D, out_variance_img) -IMAGE(5, GPU_R32F, WRITE, FLOAT_2D, out_hit_depth_img) -IMAGE(6, RAYTRACE_TILEMASK_FORMAT, READ, UINT_2D_ARRAY, tile_mask_img) -STORAGE_BUF(4, READ, uint, tiles_coord_buf[]) -/* Metal: Provide compiler with hint to tune per-thread resource allocation. */ -MTL_MAX_TOTAL_THREADS_PER_THREADGROUP(316) -SPECIALIZATION_CONSTANT(INT, raytrace_resolution_scale, 2) -SPECIALIZATION_CONSTANT(BOOL, skip_denoise, false) -SPECIALIZATION_CONSTANT(INT, closure_index, 0) -COMPUTE_SOURCE("eevee_ray_denoise_spatial_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data") + .additional_info("eevee_global_ubo") + .additional_info("eevee_sampling_data") + .additional_info("draw_view") + .additional_info("eevee_utility_texture") + .sampler(3, ImageType::DEPTH_2D, "depth_tx") + .image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "ray_data_img") + .image(1, RAYTRACE_RAYTIME_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "ray_time_img") + .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "ray_radiance_img") + .image(3, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_radiance_img") + .image(4, RAYTRACE_VARIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_variance_img") + .image(5, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_hit_depth_img") + .image(6, RAYTRACE_TILEMASK_FORMAT, Qualifier::READ, ImageType::UINT_2D_ARRAY, "tile_mask_img") + .storage_buf(4, Qualifier::READ, "uint", "tiles_coord_buf[]") + /* Metal: Provide compiler with hint to tune per-thread resource allocation. */ + .mtl_max_total_threads_per_threadgroup(316) + .specialization_constant(Type::INT, "raytrace_resolution_scale", 2) + .specialization_constant(Type::BOOL, "skip_denoise", false) + .specialization_constant(Type::INT, "closure_index", 0) + .compute_source("eevee_ray_denoise_spatial_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_ray_denoise_temporal) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(draw_view) -SAMPLER(0, FLOAT_2D, radiance_history_tx) -SAMPLER(1, FLOAT_2D, variance_history_tx) -SAMPLER(2, UINT_2D_ARRAY, tilemask_history_tx) -SAMPLER(3, DEPTH_2D, depth_tx) -IMAGE(0, GPU_R32F, READ, FLOAT_2D, hit_depth_img) -IMAGE(1, RAYTRACE_RADIANCE_FORMAT, READ, FLOAT_2D, in_radiance_img) -IMAGE(2, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, out_radiance_img) -IMAGE(3, RAYTRACE_VARIANCE_FORMAT, READ, FLOAT_2D, in_variance_img) -IMAGE(4, RAYTRACE_VARIANCE_FORMAT, WRITE, FLOAT_2D, out_variance_img) -STORAGE_BUF(4, READ, uint, tiles_coord_buf[]) -COMPUTE_SOURCE("eevee_ray_denoise_temporal_comp.glsl") -/* Metal: Provide compiler with hint to tune per-thread resource allocation. */ -MTL_MAX_TOTAL_THREADS_PER_THREADGROUP(512) -SPECIALIZATION_CONSTANT(INT, closure_index, 0) -COMPUTE_SOURCE("eevee_ray_denoise_temporal_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) + .additional_info("eevee_shared") + .additional_info("eevee_global_ubo") + .additional_info("draw_view") + .sampler(0, ImageType::FLOAT_2D, "radiance_history_tx") + .sampler(1, ImageType::FLOAT_2D, "variance_history_tx") + .sampler(2, ImageType::UINT_2D_ARRAY, "tilemask_history_tx") + .sampler(3, ImageType::DEPTH_2D, "depth_tx") + .image(0, GPU_R32F, Qualifier::READ, ImageType::FLOAT_2D, "hit_depth_img") + .image(1, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "in_radiance_img") + .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_radiance_img") + .image(3, RAYTRACE_VARIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "in_variance_img") + .image(4, RAYTRACE_VARIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_variance_img") + .storage_buf(4, Qualifier::READ, "uint", "tiles_coord_buf[]") + .compute_source("eevee_ray_denoise_temporal_comp.glsl") + /* Metal: Provide compiler with hint to tune per-thread resource allocation. */ + .mtl_max_total_threads_per_threadgroup(512) + .specialization_constant(Type::INT, "closure_index", 0) + .compute_source("eevee_ray_denoise_temporal_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_ray_denoise_bilateral) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_gbuffer_data) -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(eevee_sampling_data) -ADDITIONAL_INFO(draw_view) -SAMPLER(1, DEPTH_2D, depth_tx) -IMAGE(1, RAYTRACE_RADIANCE_FORMAT, READ, FLOAT_2D, in_radiance_img) -IMAGE(2, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, out_radiance_img) -IMAGE(3, RAYTRACE_VARIANCE_FORMAT, READ, FLOAT_2D, in_variance_img) -IMAGE(6, RAYTRACE_TILEMASK_FORMAT, READ, UINT_2D_ARRAY, tile_mask_img) -STORAGE_BUF(4, READ, uint, tiles_coord_buf[]) -SPECIALIZATION_CONSTANT(INT, closure_index, 0) -COMPUTE_SOURCE("eevee_ray_denoise_bilateral_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data") + .additional_info("eevee_global_ubo") + .additional_info("eevee_sampling_data") + .additional_info("draw_view") + .sampler(1, ImageType::DEPTH_2D, "depth_tx") + .image(1, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "in_radiance_img") + .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_radiance_img") + .image(3, RAYTRACE_VARIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "in_variance_img") + .image(6, RAYTRACE_TILEMASK_FORMAT, Qualifier::READ, ImageType::UINT_2D_ARRAY, "tile_mask_img") + .storage_buf(4, Qualifier::READ, "uint", "tiles_coord_buf[]") + .specialization_constant(Type::INT, "closure_index", 0) + .compute_source("eevee_ray_denoise_bilateral_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_horizon_setup) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_gbuffer_data) -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(draw_view) -SAMPLER(0, DEPTH_2D, depth_tx) -SAMPLER(1, FLOAT_2D, in_radiance_tx) -IMAGE(2, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, out_radiance_img) -IMAGE(3, GPU_RGB10_A2, WRITE, FLOAT_2D, out_normal_img) -COMPUTE_SOURCE("eevee_horizon_setup_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data") + .additional_info("eevee_global_ubo") + .additional_info("draw_view") + .sampler(0, ImageType::DEPTH_2D, "depth_tx") + .sampler(1, ImageType::FLOAT_2D, "in_radiance_tx") + .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_radiance_img") + .image(3, GPU_RGB10_A2, Qualifier::WRITE, ImageType::FLOAT_2D, "out_normal_img") + .compute_source("eevee_horizon_setup_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_horizon_scan) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_gbuffer_data) -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(eevee_sampling_data) -ADDITIONAL_INFO(eevee_utility_texture) -ADDITIONAL_INFO(eevee_hiz_data) -ADDITIONAL_INFO(draw_view) -SPECIALIZATION_CONSTANT(INT, fast_gi_slice_count, 2) -SPECIALIZATION_CONSTANT(INT, fast_gi_step_count, 8) -SPECIALIZATION_CONSTANT(BOOL, fast_gi_ao_only, false) -SAMPLER(0, FLOAT_2D, screen_radiance_tx) -SAMPLER(1, FLOAT_2D, screen_normal_tx) -IMAGE(2, GPU_RGBA16F, WRITE, FLOAT_2D, horizon_radiance_0_img) -IMAGE(3, GPU_RGBA8, WRITE, FLOAT_2D, horizon_radiance_1_img) -IMAGE(4, GPU_RGBA8, WRITE, FLOAT_2D, horizon_radiance_2_img) -IMAGE(5, GPU_RGBA8, WRITE, FLOAT_2D, horizon_radiance_3_img) -STORAGE_BUF(7, READ, uint, tiles_coord_buf[]) -/* Metal: Provide compiler with hint to tune per-thread resource allocation. */ -MTL_MAX_TOTAL_THREADS_PER_THREADGROUP(400) -COMPUTE_SOURCE("eevee_horizon_scan_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data") + .additional_info("eevee_global_ubo") + .additional_info("eevee_sampling_data") + .additional_info("eevee_utility_texture") + .additional_info("eevee_hiz_data") + .additional_info("draw_view") + .specialization_constant(Type::INT, "fast_gi_slice_count", 2) + .specialization_constant(Type::INT, "fast_gi_step_count", 8) + .specialization_constant(Type::BOOL, "fast_gi_ao_only", false) + .sampler(0, ImageType::FLOAT_2D, "screen_radiance_tx") + .sampler(1, ImageType::FLOAT_2D, "screen_normal_tx") + .image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "horizon_radiance_0_img") + .image(3, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "horizon_radiance_1_img") + .image(4, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "horizon_radiance_2_img") + .image(5, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "horizon_radiance_3_img") + .storage_buf(7, Qualifier::READ, "uint", "tiles_coord_buf[]") + /* Metal: Provide compiler with hint to tune per-thread resource allocation. */ + .mtl_max_total_threads_per_threadgroup(400) + .compute_source("eevee_horizon_scan_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_horizon_denoise) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(eevee_sampling_data) -ADDITIONAL_INFO(eevee_hiz_data) -ADDITIONAL_INFO(draw_view) -SAMPLER(2, FLOAT_2D, in_sh_0_tx) -SAMPLER(4, FLOAT_2D, in_sh_1_tx) -SAMPLER(5, FLOAT_2D, in_sh_2_tx) -SAMPLER(6, FLOAT_2D, in_sh_3_tx) -SAMPLER(7, FLOAT_2D, screen_normal_tx) -IMAGE(2, GPU_RGBA16F, WRITE, FLOAT_2D, out_sh_0_img) -IMAGE(3, GPU_RGBA8, WRITE, FLOAT_2D, out_sh_1_img) -IMAGE(4, GPU_RGBA8, WRITE, FLOAT_2D, out_sh_2_img) -IMAGE(5, GPU_RGBA8, WRITE, FLOAT_2D, out_sh_3_img) -STORAGE_BUF(7, READ, uint, tiles_coord_buf[]) -COMPUTE_SOURCE("eevee_horizon_denoise_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) + .additional_info( + "eevee_shared", "eevee_global_ubo", "eevee_sampling_data", "eevee_hiz_data", "draw_view") + .sampler(2, ImageType::FLOAT_2D, "in_sh_0_tx") + .sampler(4, ImageType::FLOAT_2D, "in_sh_1_tx") + .sampler(5, ImageType::FLOAT_2D, "in_sh_2_tx") + .sampler(6, ImageType::FLOAT_2D, "in_sh_3_tx") + .sampler(7, ImageType::FLOAT_2D, "screen_normal_tx") + .image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_sh_0_img") + .image(3, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "out_sh_1_img") + .image(4, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "out_sh_2_img") + .image(5, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "out_sh_3_img") + .storage_buf(7, Qualifier::READ, "uint", "tiles_coord_buf[]") + .compute_source("eevee_horizon_denoise_comp.glsl"); GPU_SHADER_CREATE_INFO(eevee_horizon_resolve) -DO_STATIC_COMPILATION() -LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_gbuffer_data) -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(eevee_sampling_data) -ADDITIONAL_INFO(eevee_lightprobe_data) -ADDITIONAL_INFO(draw_view) -SAMPLER(1, DEPTH_2D, depth_tx) -SAMPLER(2, FLOAT_2D, horizon_radiance_0_tx) -SAMPLER(3, FLOAT_2D, horizon_radiance_1_tx) -SAMPLER(4, FLOAT_2D, horizon_radiance_2_tx) -SAMPLER(5, FLOAT_2D, horizon_radiance_3_tx) -SAMPLER(8, FLOAT_2D, screen_normal_tx) -IMAGE(3, RAYTRACE_RADIANCE_FORMAT, READ_WRITE, FLOAT_2D, closure0_img) -IMAGE(4, RAYTRACE_RADIANCE_FORMAT, READ_WRITE, FLOAT_2D, closure1_img) -IMAGE(5, RAYTRACE_RADIANCE_FORMAT, READ_WRITE, FLOAT_2D, closure2_img) -STORAGE_BUF(7, READ, uint, tiles_coord_buf[]) -/* Metal: Provide compiler with hint to tune per-thread resource allocation. */ -MTL_MAX_TOTAL_THREADS_PER_THREADGROUP(400) -COMPUTE_SOURCE("eevee_horizon_resolve_comp.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) + .additional_info("eevee_shared") + .additional_info("eevee_gbuffer_data") + .additional_info("eevee_global_ubo") + .additional_info("eevee_sampling_data") + .additional_info("eevee_lightprobe_data") + .additional_info("draw_view") + .sampler(1, ImageType::DEPTH_2D, "depth_tx") + .sampler(2, ImageType::FLOAT_2D, "horizon_radiance_0_tx") + .sampler(3, ImageType::FLOAT_2D, "horizon_radiance_1_tx") + .sampler(4, ImageType::FLOAT_2D, "horizon_radiance_2_tx") + .sampler(5, ImageType::FLOAT_2D, "horizon_radiance_3_tx") + .sampler(8, ImageType::FLOAT_2D, "screen_normal_tx") + .image(3, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "closure0_img") + .image(4, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "closure1_img") + .image(5, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "closure2_img") + .storage_buf(7, Qualifier::READ, "uint", "tiles_coord_buf[]") + /* Metal: Provide compiler with hint to tune per-thread resource allocation. */ + .mtl_max_total_threads_per_threadgroup(400) + .compute_source("eevee_horizon_resolve_comp.glsl"); #undef image_out #undef image_in diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_velocity_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_velocity_info.hh index 5f2b608f25d..4a2f8a15c05 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_velocity_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_velocity_info.hh @@ -15,38 +15,37 @@ /* Pass world space deltas to the fragment shader. * This is to make sure that the resulting motion vectors are valid even with displacement. */ GPU_SHADER_NAMED_INTERFACE_INFO(eevee_velocity_surface_iface, motion) -SMOOTH(VEC3, prev) -SMOOTH(VEC3, next) -GPU_SHADER_INTERFACE_END() + .smooth(Type::VEC3, "prev") + .smooth(Type::VEC3, "next"); GPU_SHADER_CREATE_INFO(eevee_velocity_camera) -DEFINE("VELOCITY_CAMERA") -UNIFORM_BUF(VELOCITY_CAMERA_PREV_BUF, CameraData, camera_prev) -UNIFORM_BUF(VELOCITY_CAMERA_CURR_BUF, CameraData, camera_curr) -UNIFORM_BUF(VELOCITY_CAMERA_NEXT_BUF, CameraData, camera_next) -GPU_SHADER_CREATE_END() + .define("VELOCITY_CAMERA") + .uniform_buf(VELOCITY_CAMERA_PREV_BUF, "CameraData", "camera_prev") + .uniform_buf(VELOCITY_CAMERA_CURR_BUF, "CameraData", "camera_curr") + .uniform_buf(VELOCITY_CAMERA_NEXT_BUF, "CameraData", "camera_next"); GPU_SHADER_CREATE_INFO(eevee_velocity_geom) -DEFINE("MAT_VELOCITY") -STORAGE_BUF(VELOCITY_OBJ_PREV_BUF_SLOT, READ, mat4, velocity_obj_prev_buf[]) -STORAGE_BUF(VELOCITY_OBJ_NEXT_BUF_SLOT, READ, mat4, velocity_obj_next_buf[]) -STORAGE_BUF(VELOCITY_GEO_PREV_BUF_SLOT, READ, vec4, velocity_geo_prev_buf[]) -STORAGE_BUF(VELOCITY_GEO_NEXT_BUF_SLOT, READ, vec4, velocity_geo_next_buf[]) -STORAGE_BUF(VELOCITY_INDIRECTION_BUF_SLOT, READ, VelocityIndex, velocity_indirection_buf[]) -VERTEX_OUT(eevee_velocity_surface_iface) -FRAGMENT_OUT(0, VEC4, out_velocity) -ADDITIONAL_INFO(eevee_velocity_camera) -GPU_SHADER_CREATE_END() + .define("MAT_VELOCITY") + .storage_buf(VELOCITY_OBJ_PREV_BUF_SLOT, Qualifier::READ, "mat4", "velocity_obj_prev_buf[]") + .storage_buf(VELOCITY_OBJ_NEXT_BUF_SLOT, Qualifier::READ, "mat4", "velocity_obj_next_buf[]") + .storage_buf(VELOCITY_GEO_PREV_BUF_SLOT, Qualifier::READ, "vec4", "velocity_geo_prev_buf[]") + .storage_buf(VELOCITY_GEO_NEXT_BUF_SLOT, Qualifier::READ, "vec4", "velocity_geo_next_buf[]") + .storage_buf(VELOCITY_INDIRECTION_BUF_SLOT, + Qualifier::READ, + "VelocityIndex", + "velocity_indirection_buf[]") + .vertex_out(eevee_velocity_surface_iface) + .fragment_out(0, Type::VEC4, "out_velocity") + .additional_info("eevee_velocity_camera"); GPU_SHADER_CREATE_INFO(eevee_vertex_copy) -COMPUTE_SOURCE("eevee_vertex_copy_comp.glsl") -LOCAL_GROUP_SIZE(VERTEX_COPY_GROUP_SIZE) -STORAGE_BUF(0, READ, float, in_buf[]) -STORAGE_BUF(1, WRITE, vec4, out_buf[]) -PUSH_CONSTANT(INT, start_offset) -PUSH_CONSTANT(INT, vertex_stride) -PUSH_CONSTANT(INT, vertex_count) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .compute_source("eevee_vertex_copy_comp.glsl") + .local_group_size(VERTEX_COPY_GROUP_SIZE) + .storage_buf(0, Qualifier::READ, "float", "in_buf[]") + .storage_buf(1, Qualifier::WRITE, "vec4", "out_buf[]") + .push_constant(Type::INT, "start_offset") + .push_constant(Type::INT, "vertex_stride") + .push_constant(Type::INT, "vertex_count") + .do_static_compilation(true); /** \} */ diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_volume_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_volume_info.hh index d49d0a27267..ea7c2c6908d 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_volume_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_volume_info.hh @@ -8,88 +8,106 @@ /* Used for shaders that need the final accumulated volume transmittance and scattering. */ GPU_SHADER_CREATE_INFO(eevee_volume_lib) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(draw_view) -SAMPLER(VOLUME_SCATTERING_TEX_SLOT, FLOAT_3D, volume_scattering_tx) -SAMPLER(VOLUME_TRANSMITTANCE_TEX_SLOT, FLOAT_3D, volume_transmittance_tx) -GPU_SHADER_CREATE_END() + .additional_info("eevee_shared") + .additional_info("eevee_global_ubo") + .additional_info("draw_view") + .sampler(VOLUME_SCATTERING_TEX_SLOT, ImageType::FLOAT_3D, "volume_scattering_tx") + .sampler(VOLUME_TRANSMITTANCE_TEX_SLOT, ImageType::FLOAT_3D, "volume_transmittance_tx"); GPU_SHADER_CREATE_INFO(eevee_volume_properties_data) -ADDITIONAL_INFO(eevee_global_ubo) -IMAGE(VOLUME_PROP_SCATTERING_IMG_SLOT, GPU_R11F_G11F_B10F, READ, FLOAT_3D, in_scattering_img) -IMAGE(VOLUME_PROP_EXTINCTION_IMG_SLOT, GPU_R11F_G11F_B10F, READ, FLOAT_3D, in_extinction_img) -IMAGE(VOLUME_PROP_EMISSION_IMG_SLOT, GPU_R11F_G11F_B10F, READ, FLOAT_3D, in_emission_img) -IMAGE(VOLUME_PROP_PHASE_IMG_SLOT, GPU_R16F, READ, FLOAT_3D, in_phase_img) -IMAGE(VOLUME_PROP_PHASE_WEIGHT_IMG_SLOT, GPU_R16F, READ, FLOAT_3D, in_phase_weight_img) -GPU_SHADER_CREATE_END() + .additional_info("eevee_global_ubo") + .image(VOLUME_PROP_SCATTERING_IMG_SLOT, + GPU_R11F_G11F_B10F, + Qualifier::READ, + ImageType::FLOAT_3D, + "in_scattering_img") + .image(VOLUME_PROP_EXTINCTION_IMG_SLOT, + GPU_R11F_G11F_B10F, + Qualifier::READ, + ImageType::FLOAT_3D, + "in_extinction_img") + .image(VOLUME_PROP_EMISSION_IMG_SLOT, + GPU_R11F_G11F_B10F, + Qualifier::READ, + ImageType::FLOAT_3D, + "in_emission_img") + .image( + VOLUME_PROP_PHASE_IMG_SLOT, GPU_R16F, Qualifier::READ, ImageType::FLOAT_3D, "in_phase_img") + .image(VOLUME_PROP_PHASE_WEIGHT_IMG_SLOT, + GPU_R16F, + Qualifier::READ, + ImageType::FLOAT_3D, + "in_phase_weight_img"); GPU_SHADER_CREATE_INFO(eevee_volume_scatter) -LOCAL_GROUP_SIZE(VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(draw_resource_id_varying) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(eevee_light_data) -ADDITIONAL_INFO(eevee_lightprobe_data) -ADDITIONAL_INFO(eevee_shadow_data) -ADDITIONAL_INFO(eevee_sampling_data) -ADDITIONAL_INFO(eevee_utility_texture) -ADDITIONAL_INFO(eevee_volume_properties_data) -SAMPLER(0, FLOAT_3D, scattering_history_tx) -SAMPLER(1, FLOAT_3D, extinction_history_tx) -IMAGE(5, GPU_R11F_G11F_B10F, WRITE, FLOAT_3D, out_scattering_img) -IMAGE(6, GPU_R11F_G11F_B10F, WRITE, FLOAT_3D, out_extinction_img) -COMPUTE_SOURCE("eevee_volume_scatter_comp.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE) + .additional_info("eevee_shared") + .additional_info("eevee_global_ubo") + .additional_info("draw_resource_id_varying") + .additional_info("draw_view") + .additional_info("eevee_light_data") + .additional_info("eevee_lightprobe_data") + .additional_info("eevee_shadow_data") + .additional_info("eevee_sampling_data") + .additional_info("eevee_utility_texture") + .additional_info("eevee_volume_properties_data") + .sampler(0, ImageType::FLOAT_3D, "scattering_history_tx") + .sampler(1, ImageType::FLOAT_3D, "extinction_history_tx") + .image(5, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_3D, "out_scattering_img") + .image(6, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_3D, "out_extinction_img") + .compute_source("eevee_volume_scatter_comp.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(eevee_volume_scatter_with_lights) -ADDITIONAL_INFO(eevee_volume_scatter) -DEFINE("VOLUME_LIGHTING") -DEFINE("VOLUME_IRRADIANCE") -DEFINE("VOLUME_SHADOW") -SAMPLER(9, FLOAT_3D, extinction_tx) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("eevee_volume_scatter") + .define("VOLUME_LIGHTING") + .define("VOLUME_IRRADIANCE") + .define("VOLUME_SHADOW") + .sampler(9, ImageType::FLOAT_3D, "extinction_tx") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(eevee_volume_occupancy_convert) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(draw_fullscreen) -BUILTINS(BuiltinBits::TEXTURE_ATOMIC) -IMAGE(VOLUME_HIT_DEPTH_SLOT, GPU_R32F, READ, FLOAT_3D, hit_depth_img) -IMAGE(VOLUME_HIT_COUNT_SLOT, GPU_R32UI, READ_WRITE, UINT_2D, hit_count_img) -IMAGE(VOLUME_OCCUPANCY_SLOT, GPU_R32UI, READ_WRITE, UINT_3D_ATOMIC, occupancy_img) -FRAGMENT_SOURCE("eevee_occupancy_convert_frag.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("eevee_shared") + .additional_info("eevee_global_ubo") + .additional_info("draw_fullscreen") + .builtins(BuiltinBits::TEXTURE_ATOMIC) + .image(VOLUME_HIT_DEPTH_SLOT, GPU_R32F, Qualifier::READ, ImageType::FLOAT_3D, "hit_depth_img") + .image(VOLUME_HIT_COUNT_SLOT, + GPU_R32UI, + Qualifier::READ_WRITE, + ImageType::UINT_2D, + "hit_count_img") + .image(VOLUME_OCCUPANCY_SLOT, + GPU_R32UI, + Qualifier::READ_WRITE, + ImageType::UINT_3D_ATOMIC, + "occupancy_img") + .fragment_source("eevee_occupancy_convert_frag.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(eevee_volume_integration) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_global_ubo) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(eevee_sampling_data) -COMPUTE_SOURCE("eevee_volume_integration_comp.glsl") -LOCAL_GROUP_SIZE(VOLUME_INTEGRATION_GROUP_SIZE, VOLUME_INTEGRATION_GROUP_SIZE, 1) -/* Inputs. */ -SAMPLER(0, FLOAT_3D, in_scattering_tx) -SAMPLER(1, FLOAT_3D, in_extinction_tx) -/* Outputs. */ -IMAGE(0, GPU_R11F_G11F_B10F, WRITE, FLOAT_3D, out_scattering_img) -IMAGE(1, GPU_R11F_G11F_B10F, WRITE, FLOAT_3D, out_transmittance_img) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("eevee_shared") + .additional_info("eevee_global_ubo") + .additional_info("draw_view") + .additional_info("eevee_sampling_data") + .compute_source("eevee_volume_integration_comp.glsl") + .local_group_size(VOLUME_INTEGRATION_GROUP_SIZE, VOLUME_INTEGRATION_GROUP_SIZE, 1) + /* Inputs. */ + .sampler(0, ImageType::FLOAT_3D, "in_scattering_tx") + .sampler(1, ImageType::FLOAT_3D, "in_extinction_tx") + /* Outputs. */ + .image(0, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_3D, "out_scattering_img") + .image(1, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_3D, "out_transmittance_img") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(eevee_volume_resolve) -ADDITIONAL_INFO(eevee_shared) -ADDITIONAL_INFO(eevee_volume_lib) -ADDITIONAL_INFO(draw_fullscreen) -ADDITIONAL_INFO(eevee_render_pass_out) -ADDITIONAL_INFO(eevee_hiz_data) -FRAGMENT_SOURCE("eevee_volume_resolve_frag.glsl") -FRAGMENT_OUT_DUAL(0, VEC4, out_radiance, SRC_0) -FRAGMENT_OUT_DUAL(0, VEC4, out_transmittance, SRC_1) -/** TODO(Miguel Pozo): Volume RenderPasses. */ -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("eevee_shared") + .additional_info("eevee_volume_lib") + .additional_info("draw_fullscreen") + .additional_info("eevee_render_pass_out") + .additional_info("eevee_hiz_data") + .fragment_source("eevee_volume_resolve_frag.glsl") + .fragment_out(0, Type::VEC4, "out_radiance", DualBlend::SRC_0) + .fragment_out(0, Type::VEC4, "out_transmittance", DualBlend::SRC_1) + /** TODO(Miguel Pozo): Volume RenderPasses. */ + .do_static_compilation(true); 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 49daebc258d..d82d11ccf7d 100644 --- a/source/blender/draw/engines/gpencil/shaders/infos/gpencil_info.hh +++ b/source/blender/draw/engines/gpencil/shaders/infos/gpencil_info.hh @@ -11,52 +11,48 @@ * \{ */ GPU_SHADER_NAMED_INTERFACE_INFO(gpencil_geometry_iface, gp_interp) -SMOOTH(VEC4, color_mul) -SMOOTH(VEC4, color_add) -SMOOTH(VEC3, pos) -SMOOTH(VEC2, uv) -GPU_SHADER_INTERFACE_END() + .smooth(Type::VEC4, "color_mul") + .smooth(Type::VEC4, "color_add") + .smooth(Type::VEC3, "pos") + .smooth(Type::VEC2, "uv"); GPU_SHADER_NAMED_INTERFACE_INFO(gpencil_geometry_flat_iface, gp_interp_flat) -FLAT(VEC2, aspect) -FLAT(VEC4, sspos) -FLAT(UINT, mat_flag) -FLAT(FLOAT, depth) -GPU_SHADER_INTERFACE_END() + .flat(Type::VEC2, "aspect") + .flat(Type::VEC4, "sspos") + .flat(Type::UINT, "mat_flag") + .flat(Type::FLOAT, "depth"); GPU_SHADER_NAMED_INTERFACE_INFO(gpencil_geometry_noperspective_iface, gp_interp_noperspective) -NO_PERSPECTIVE(VEC2, thickness) -NO_PERSPECTIVE(FLOAT, hardness) -GPU_SHADER_INTERFACE_END() + .no_perspective(Type::VEC2, "thickness") + .no_perspective(Type::FLOAT, "hardness"); GPU_SHADER_CREATE_INFO(gpencil_geometry) -DO_STATIC_COMPILATION() -DEFINE("GP_LIGHT") -TYPEDEF_SOURCE("gpencil_defines.h") -SAMPLER(2, FLOAT_2D, gpFillTexture) -SAMPLER(3, FLOAT_2D, gpStrokeTexture) -SAMPLER(4, DEPTH_2D, gpSceneDepthTexture) -SAMPLER(5, FLOAT_2D, gpMaskTexture) -UNIFORM_BUF_FREQ(4, gpMaterial, gp_materials[GPENCIL_MATERIAL_BUFFER_LEN], BATCH) -UNIFORM_BUF_FREQ(3, gpLight, gp_lights[GPENCIL_LIGHT_BUFFER_LEN], BATCH) -PUSH_CONSTANT(VEC2, viewportSize) -/* Per Object */ -PUSH_CONSTANT(VEC3, gpNormal) -PUSH_CONSTANT(BOOL, gpStrokeOrder3d) -PUSH_CONSTANT(INT, gpMaterialOffset) -/* Per Layer */ -PUSH_CONSTANT(FLOAT, gpVertexColorOpacity) -PUSH_CONSTANT(VEC4, gpLayerTint) -PUSH_CONSTANT(FLOAT, gpLayerOpacity) -PUSH_CONSTANT(FLOAT, gpStrokeIndexOffset) -FRAGMENT_OUT(0, VEC4, fragColor) -FRAGMENT_OUT(1, VEC4, revealColor) -VERTEX_OUT(gpencil_geometry_iface) -VERTEX_OUT(gpencil_geometry_flat_iface) -VERTEX_OUT(gpencil_geometry_noperspective_iface) -VERTEX_SOURCE("gpencil_vert.glsl") -FRAGMENT_SOURCE("gpencil_frag.glsl") -DEPTH_WRITE(DepthWrite::ANY) -ADDITIONAL_INFO(draw_gpencil) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("GP_LIGHT") + .typedef_source("gpencil_defines.h") + .sampler(2, ImageType::FLOAT_2D, "gpFillTexture") + .sampler(3, ImageType::FLOAT_2D, "gpStrokeTexture") + .sampler(4, ImageType::DEPTH_2D, "gpSceneDepthTexture") + .sampler(5, ImageType::FLOAT_2D, "gpMaskTexture") + .uniform_buf(4, "gpMaterial", "gp_materials[GPENCIL_MATERIAL_BUFFER_LEN]", Frequency::BATCH) + .uniform_buf(3, "gpLight", "gp_lights[GPENCIL_LIGHT_BUFFER_LEN]", Frequency::BATCH) + .push_constant(Type::VEC2, "viewportSize") + /* 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_out(gpencil_geometry_flat_iface) + .vertex_out(gpencil_geometry_noperspective_iface) + .vertex_source("gpencil_vert.glsl") + .fragment_source("gpencil_frag.glsl") + .depth_write(DepthWrite::ANY) + .additional_info("draw_gpencil"); /** \} */ @@ -65,38 +61,35 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(gpencil_layer_blend) -DO_STATIC_COMPILATION() -SAMPLER(0, FLOAT_2D, colorBuf) -SAMPLER(1, FLOAT_2D, revealBuf) -SAMPLER(2, FLOAT_2D, maskBuf) -PUSH_CONSTANT(INT, blendMode) -PUSH_CONSTANT(FLOAT, blendOpacity) -/* Reminder: This is considered SRC color in blend equations. - * Same operation on all buffers. */ -FRAGMENT_OUT(0, VEC4, fragColor) -FRAGMENT_OUT(1, VEC4, fragRevealage) -FRAGMENT_SOURCE("gpencil_layer_blend_frag.glsl") -ADDITIONAL_INFO(draw_fullscreen) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .sampler(0, ImageType::FLOAT_2D, "colorBuf") + .sampler(1, ImageType::FLOAT_2D, "revealBuf") + .sampler(2, ImageType::FLOAT_2D, "maskBuf") + .push_constant(Type::INT, "blendMode") + .push_constant(Type::FLOAT, "blendOpacity") + /* Reminder: This is considered SRC color in blend equations. + * Same operation on all buffers. */ + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_out(1, Type::VEC4, "fragRevealage") + .fragment_source("gpencil_layer_blend_frag.glsl") + .additional_info("draw_fullscreen"); GPU_SHADER_CREATE_INFO(gpencil_mask_invert) -DO_STATIC_COMPILATION() -FRAGMENT_OUT(0, VEC4, fragColor) -FRAGMENT_OUT(1, VEC4, fragRevealage) -FRAGMENT_SOURCE("gpencil_mask_invert_frag.glsl") -ADDITIONAL_INFO(draw_fullscreen) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_out(1, Type::VEC4, "fragRevealage") + .fragment_source("gpencil_mask_invert_frag.glsl") + .additional_info("draw_fullscreen"); GPU_SHADER_CREATE_INFO(gpencil_depth_merge) -DO_STATIC_COMPILATION() -PUSH_CONSTANT_ARRAY(VEC4, gpModelMatrix, 4) -PUSH_CONSTANT(BOOL, strokeOrder3d) -SAMPLER(0, DEPTH_2D, depthBuf) -VERTEX_SOURCE("gpencil_depth_merge_vert.glsl") -FRAGMENT_SOURCE("gpencil_depth_merge_frag.glsl") -DEPTH_WRITE(DepthWrite::ANY) -ADDITIONAL_INFO(draw_view) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .push_constant(Type::VEC4, "gpModelMatrix", 4) + .push_constant(Type::BOOL, "strokeOrder3d") + .sampler(0, ImageType::DEPTH_2D, "depthBuf") + .vertex_source("gpencil_depth_merge_vert.glsl") + .fragment_source("gpencil_depth_merge_frag.glsl") + .depth_write(DepthWrite::ANY) + .additional_info("draw_view"); /** \} */ @@ -105,57 +98,52 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_INTERFACE_INFO(gpencil_antialiasing_iface) -SMOOTH(VEC2, uvs) -SMOOTH(VEC2, pixcoord) -SMOOTH(VEC4, offset[3]) -GPU_SHADER_INTERFACE_END() + .smooth(Type::VEC2, "uvs") + .smooth(Type::VEC2, "pixcoord") + .smooth(Type::VEC4, "offset[3]"); GPU_SHADER_CREATE_INFO(gpencil_antialiasing) -DEFINE("SMAA_GLSL_3") -DEFINE_VALUE("SMAA_RT_METRICS", "viewportMetrics") -DEFINE("SMAA_PRESET_HIGH") -DEFINE_VALUE("SMAA_LUMA_WEIGHT", "float4(lumaWeight, lumaWeight, lumaWeight, 0.0)") -DEFINE("SMAA_NO_DISCARD") -VERTEX_OUT(gpencil_antialiasing_iface) -PUSH_CONSTANT(VEC4, viewportMetrics) -PUSH_CONSTANT(FLOAT, lumaWeight) -VERTEX_SOURCE("gpencil_antialiasing_vert.glsl") -FRAGMENT_SOURCE("gpencil_antialiasing_frag.glsl") -GPU_SHADER_CREATE_END() + .define("SMAA_GLSL_3") + .define("SMAA_RT_METRICS", "viewportMetrics") + .define("SMAA_PRESET_HIGH") + .define("SMAA_LUMA_WEIGHT", "float4(lumaWeight, lumaWeight, lumaWeight, 0.0)") + .define("SMAA_NO_DISCARD") + .vertex_out(gpencil_antialiasing_iface) + .push_constant(Type::VEC4, "viewportMetrics") + .push_constant(Type::FLOAT, "lumaWeight") + .vertex_source("gpencil_antialiasing_vert.glsl") + .fragment_source("gpencil_antialiasing_frag.glsl"); GPU_SHADER_CREATE_INFO(gpencil_antialiasing_stage_0) -DEFINE_VALUE("SMAA_STAGE", "0") -SAMPLER(0, FLOAT_2D, colorTex) -SAMPLER(1, FLOAT_2D, revealTex) -FRAGMENT_OUT(0, VEC2, out_edges) -ADDITIONAL_INFO(gpencil_antialiasing) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .define("SMAA_STAGE", "0") + .sampler(0, ImageType::FLOAT_2D, "colorTex") + .sampler(1, ImageType::FLOAT_2D, "revealTex") + .fragment_out(0, Type::VEC2, "out_edges") + .additional_info("gpencil_antialiasing") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(gpencil_antialiasing_stage_1) -DEFINE_VALUE("SMAA_STAGE", "1") -SAMPLER(0, FLOAT_2D, edgesTex) -SAMPLER(1, FLOAT_2D, areaTex) -SAMPLER(2, FLOAT_2D, searchTex) -FRAGMENT_OUT(0, VEC4, out_weights) -ADDITIONAL_INFO(gpencil_antialiasing) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .define("SMAA_STAGE", "1") + .sampler(0, ImageType::FLOAT_2D, "edgesTex") + .sampler(1, ImageType::FLOAT_2D, "areaTex") + .sampler(2, ImageType::FLOAT_2D, "searchTex") + .fragment_out(0, Type::VEC4, "out_weights") + .additional_info("gpencil_antialiasing") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(gpencil_antialiasing_stage_2) -DEFINE_VALUE("SMAA_STAGE", "2") -SAMPLER(0, FLOAT_2D, colorTex) -SAMPLER(1, FLOAT_2D, revealTex) -SAMPLER(2, FLOAT_2D, blendTex) -PUSH_CONSTANT(FLOAT, mixFactor) -PUSH_CONSTANT(FLOAT, taaAccumulatedWeight) -PUSH_CONSTANT(BOOL, doAntiAliasing) -PUSH_CONSTANT(BOOL, onlyAlpha) -/* Reminder: Blending func is `fragRevealage * DST + fragColor`. */ -FRAGMENT_OUT_DUAL(0, VEC4, out_color, SRC_0) -FRAGMENT_OUT_DUAL(0, VEC4, out_reveal, SRC_1) -ADDITIONAL_INFO(gpencil_antialiasing) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .define("SMAA_STAGE", "2") + .sampler(0, ImageType::FLOAT_2D, "colorTex") + .sampler(1, ImageType::FLOAT_2D, "revealTex") + .sampler(2, ImageType::FLOAT_2D, "blendTex") + .push_constant(Type::FLOAT, "mixFactor") + .push_constant(Type::FLOAT, "taaAccumulatedWeight") + .push_constant(Type::BOOL, "doAntiAliasing") + .push_constant(Type::BOOL, "onlyAlpha") + /* Reminder: Blending func is `fragRevealage * DST + fragColor`. */ + .fragment_out(0, Type::VEC4, "out_color", DualBlend::SRC_0) + .fragment_out(0, Type::VEC4, "out_reveal", DualBlend::SRC_1) + .additional_info("gpencil_antialiasing") + .do_static_compilation(true); /** \} */ diff --git a/source/blender/draw/engines/gpencil/shaders/infos/gpencil_vfx_info.hh b/source/blender/draw/engines/gpencil/shaders/infos/gpencil_vfx_info.hh index 5bf7d6bbbfd..72a74ab5ecc 100644 --- a/source/blender/draw/engines/gpencil/shaders/infos/gpencil_vfx_info.hh +++ b/source/blender/draw/engines/gpencil/shaders/infos/gpencil_vfx_info.hh @@ -5,109 +5,100 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpencil_fx_common) -SAMPLER(0, FLOAT_2D, colorBuf) -SAMPLER(1, FLOAT_2D, revealBuf) -/* Reminder: This is considered SRC color in blend equations. - * Same operation on all buffers. */ -FRAGMENT_OUT(0, VEC4, fragColor) -FRAGMENT_OUT(1, VEC4, fragRevealage) -FRAGMENT_SOURCE("gpencil_vfx_frag.glsl") -GPU_SHADER_CREATE_END() + .sampler(0, ImageType::FLOAT_2D, "colorBuf") + .sampler(1, ImageType::FLOAT_2D, "revealBuf") + /* Reminder: This is considered SRC color in blend equations. + * Same operation on all buffers. */ + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_out(1, Type::VEC4, "fragRevealage") + .fragment_source("gpencil_vfx_frag.glsl"); GPU_SHADER_CREATE_INFO(gpencil_fx_composite) -DO_STATIC_COMPILATION() -DEFINE("COMPOSITE") -PUSH_CONSTANT(BOOL, isFirstPass) -ADDITIONAL_INFO(gpencil_fx_common) -ADDITIONAL_INFO(draw_fullscreen) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("COMPOSITE") + .push_constant(Type::BOOL, "isFirstPass") + .additional_info("gpencil_fx_common") + .additional_info("draw_fullscreen"); GPU_SHADER_CREATE_INFO(gpencil_fx_colorize) -DO_STATIC_COMPILATION() -DEFINE("COLORIZE") -PUSH_CONSTANT(VEC3, lowColor) -PUSH_CONSTANT(VEC3, highColor) -PUSH_CONSTANT(FLOAT, factor) -PUSH_CONSTANT(INT, mode) -ADDITIONAL_INFO(gpencil_fx_common) -ADDITIONAL_INFO(draw_fullscreen) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("COLORIZE") + .push_constant(Type::VEC3, "lowColor") + .push_constant(Type::VEC3, "highColor") + .push_constant(Type::FLOAT, "factor") + .push_constant(Type::INT, "mode") + .additional_info("gpencil_fx_common") + .additional_info("draw_fullscreen"); GPU_SHADER_CREATE_INFO(gpencil_fx_blur) -DO_STATIC_COMPILATION() -DEFINE("BLUR") -PUSH_CONSTANT(VEC2, offset) -PUSH_CONSTANT(INT, sampCount) -ADDITIONAL_INFO(gpencil_fx_common) -ADDITIONAL_INFO(draw_fullscreen) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("BLUR") + .push_constant(Type::VEC2, "offset") + .push_constant(Type::INT, "sampCount") + .additional_info("gpencil_fx_common") + .additional_info("draw_fullscreen"); GPU_SHADER_CREATE_INFO(gpencil_fx_transform) -DO_STATIC_COMPILATION() -DEFINE("TRANSFORM") -PUSH_CONSTANT(VEC2, axisFlip) -PUSH_CONSTANT(VEC2, waveDir) -PUSH_CONSTANT(VEC2, waveOffset) -PUSH_CONSTANT(FLOAT, wavePhase) -PUSH_CONSTANT(VEC2, swirlCenter) -PUSH_CONSTANT(FLOAT, swirlAngle) -PUSH_CONSTANT(FLOAT, swirlRadius) -ADDITIONAL_INFO(gpencil_fx_common) -ADDITIONAL_INFO(draw_fullscreen) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("TRANSFORM") + .push_constant(Type::VEC2, "axisFlip") + .push_constant(Type::VEC2, "waveDir") + .push_constant(Type::VEC2, "waveOffset") + .push_constant(Type::FLOAT, "wavePhase") + .push_constant(Type::VEC2, "swirlCenter") + .push_constant(Type::FLOAT, "swirlAngle") + .push_constant(Type::FLOAT, "swirlRadius") + .additional_info("gpencil_fx_common") + .additional_info("draw_fullscreen"); GPU_SHADER_CREATE_INFO(gpencil_fx_glow) -DO_STATIC_COMPILATION() -DEFINE("GLOW") -PUSH_CONSTANT(VEC4, glowColor) -PUSH_CONSTANT(VEC2, offset) -PUSH_CONSTANT(INT, sampCount) -PUSH_CONSTANT(VEC4, threshold) -PUSH_CONSTANT(BOOL, firstPass) -PUSH_CONSTANT(BOOL, glowUnder) -PUSH_CONSTANT(INT, blendMode) -ADDITIONAL_INFO(gpencil_fx_common) -ADDITIONAL_INFO(draw_fullscreen) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("GLOW") + .push_constant(Type::VEC4, "glowColor") + .push_constant(Type::VEC2, "offset") + .push_constant(Type::INT, "sampCount") + .push_constant(Type::VEC4, "threshold") + .push_constant(Type::BOOL, "firstPass") + .push_constant(Type::BOOL, "glowUnder") + .push_constant(Type::INT, "blendMode") + .additional_info("gpencil_fx_common") + .additional_info("draw_fullscreen"); GPU_SHADER_CREATE_INFO(gpencil_fx_rim) -DO_STATIC_COMPILATION() -DEFINE("RIM") -PUSH_CONSTANT(VEC2, blurDir) -PUSH_CONSTANT(VEC2, uvOffset) -PUSH_CONSTANT(VEC3, rimColor) -PUSH_CONSTANT(VEC3, maskColor) -PUSH_CONSTANT(INT, sampCount) -PUSH_CONSTANT(INT, blendMode) -PUSH_CONSTANT(BOOL, isFirstPass) -ADDITIONAL_INFO(gpencil_fx_common) -ADDITIONAL_INFO(draw_fullscreen) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("RIM") + .push_constant(Type::VEC2, "blurDir") + .push_constant(Type::VEC2, "uvOffset") + .push_constant(Type::VEC3, "rimColor") + .push_constant(Type::VEC3, "maskColor") + .push_constant(Type::INT, "sampCount") + .push_constant(Type::INT, "blendMode") + .push_constant(Type::BOOL, "isFirstPass") + .additional_info("gpencil_fx_common") + .additional_info("draw_fullscreen"); GPU_SHADER_CREATE_INFO(gpencil_fx_shadow) -DO_STATIC_COMPILATION() -DEFINE("SHADOW") -PUSH_CONSTANT(VEC4, shadowColor) -PUSH_CONSTANT(VEC2, uvRotX) -PUSH_CONSTANT(VEC2, uvRotY) -PUSH_CONSTANT(VEC2, uvOffset) -PUSH_CONSTANT(VEC2, blurDir) -PUSH_CONSTANT(VEC2, waveDir) -PUSH_CONSTANT(VEC2, waveOffset) -PUSH_CONSTANT(FLOAT, wavePhase) -PUSH_CONSTANT(INT, sampCount) -PUSH_CONSTANT(BOOL, isFirstPass) -ADDITIONAL_INFO(gpencil_fx_common) -ADDITIONAL_INFO(draw_fullscreen) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("SHADOW") + .push_constant(Type::VEC4, "shadowColor") + .push_constant(Type::VEC2, "uvRotX") + .push_constant(Type::VEC2, "uvRotY") + .push_constant(Type::VEC2, "uvOffset") + .push_constant(Type::VEC2, "blurDir") + .push_constant(Type::VEC2, "waveDir") + .push_constant(Type::VEC2, "waveOffset") + .push_constant(Type::FLOAT, "wavePhase") + .push_constant(Type::INT, "sampCount") + .push_constant(Type::BOOL, "isFirstPass") + .additional_info("gpencil_fx_common") + .additional_info("draw_fullscreen"); GPU_SHADER_CREATE_INFO(gpencil_fx_pixelize) -DO_STATIC_COMPILATION() -DEFINE("PIXELIZE") -PUSH_CONSTANT(VEC2, targetPixelSize) -PUSH_CONSTANT(VEC2, targetPixelOffset) -PUSH_CONSTANT(VEC2, accumOffset) -PUSH_CONSTANT(INT, sampCount) -ADDITIONAL_INFO(gpencil_fx_common) -ADDITIONAL_INFO(draw_fullscreen) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("PIXELIZE") + .push_constant(Type::VEC2, "targetPixelSize") + .push_constant(Type::VEC2, "targetPixelOffset") + .push_constant(Type::VEC2, "accumOffset") + .push_constant(Type::INT, "sampCount") + .additional_info("gpencil_fx_common") + .additional_info("draw_fullscreen"); diff --git a/source/blender/draw/engines/image/shaders/infos/engine_image_info.hh b/source/blender/draw/engines/image/shaders/infos/engine_image_info.hh index 65b054c1515..f94f271da78 100644 --- a/source/blender/draw/engines/image/shaders/infos/engine_image_info.hh +++ b/source/blender/draw/engines/image/shaders/infos/engine_image_info.hh @@ -4,39 +4,33 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(image_engine_color_iface) -SMOOTH(VEC2, uv_screen) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_INTERFACE_INFO(image_engine_color_iface).smooth(Type::VEC2, "uv_screen"); GPU_SHADER_CREATE_INFO(image_engine_color_shader) -VERTEX_IN(0, IVEC2, pos) -VERTEX_OUT(image_engine_color_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -PUSH_CONSTANT(VEC4, shuffle) -PUSH_CONSTANT(VEC2, farNearDistances) -PUSH_CONSTANT(IVEC2, offset) -PUSH_CONSTANT(INT, drawFlags) -PUSH_CONSTANT(BOOL, imgPremultiplied) -SAMPLER(0, FLOAT_2D, imageTexture) -SAMPLER(1, DEPTH_2D, depth_texture) -VERTEX_SOURCE("image_engine_color_vert.glsl") -FRAGMENT_SOURCE("image_engine_color_frag.glsl") -ADDITIONAL_INFO(draw_modelmat) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::IVEC2, "pos") + .vertex_out(image_engine_color_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .push_constant(Type::VEC4, "shuffle") + .push_constant(Type::VEC2, "farNearDistances") + .push_constant(Type::IVEC2, "offset") + .push_constant(Type::INT, "drawFlags") + .push_constant(Type::BOOL, "imgPremultiplied") + .sampler(0, ImageType::FLOAT_2D, "imageTexture") + .sampler(1, ImageType::DEPTH_2D, "depth_texture") + .vertex_source("image_engine_color_vert.glsl") + .fragment_source("image_engine_color_frag.glsl") + .additional_info("draw_modelmat") + .do_static_compilation(true); -GPU_SHADER_INTERFACE_INFO(image_engine_depth_iface) -SMOOTH(VEC2, uv_image) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_INTERFACE_INFO(image_engine_depth_iface).smooth(Type::VEC2, "uv_image"); GPU_SHADER_CREATE_INFO(image_engine_depth_shader) -VERTEX_IN(0, IVEC2, pos) -VERTEX_IN(1, VEC2, uv) -VERTEX_OUT(image_engine_depth_iface) -PUSH_CONSTANT(VEC4, min_max_uv) -VERTEX_SOURCE("image_engine_depth_vert.glsl") -FRAGMENT_SOURCE("image_engine_depth_frag.glsl") -ADDITIONAL_INFO(draw_modelmat) -DEPTH_WRITE(DepthWrite::ANY) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::IVEC2, "pos") + .vertex_in(1, Type::VEC2, "uv") + .vertex_out(image_engine_depth_iface) + .push_constant(Type::VEC4, "min_max_uv") + .vertex_source("image_engine_depth_vert.glsl") + .fragment_source("image_engine_depth_frag.glsl") + .additional_info("draw_modelmat") + .depth_write(DepthWrite::ANY) + .do_static_compilation(true); diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_antialiasing_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_antialiasing_info.hh index 11004b510ba..feb06145300 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_antialiasing_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_antialiasing_info.hh @@ -5,23 +5,21 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(overlay_antialiasing) -DO_STATIC_COMPILATION() -SAMPLER(0, DEPTH_2D, depthTex) -SAMPLER(1, FLOAT_2D, colorTex) -SAMPLER(2, FLOAT_2D, lineTex) -PUSH_CONSTANT(BOOL, doSmoothLines) -FRAGMENT_OUT(0, VEC4, fragColor) -FRAGMENT_SOURCE("overlay_antialiasing_frag.glsl") -ADDITIONAL_INFO(draw_fullscreen) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .sampler(0, ImageType::DEPTH_2D, "depthTex") + .sampler(1, ImageType::FLOAT_2D, "colorTex") + .sampler(2, ImageType::FLOAT_2D, "lineTex") + .push_constant(Type::BOOL, "doSmoothLines") + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_source("overlay_antialiasing_frag.glsl") + .additional_info("draw_fullscreen") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_xray_fade) -DO_STATIC_COMPILATION() -SAMPLER(0, DEPTH_2D, depthTex) -SAMPLER(1, DEPTH_2D, xrayDepthTex) -PUSH_CONSTANT(FLOAT, opacity) -FRAGMENT_OUT(0, VEC4, fragColor) -FRAGMENT_SOURCE("overlay_xray_fade_frag.glsl") -ADDITIONAL_INFO(draw_fullscreen) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .sampler(0, ImageType::DEPTH_2D, "depthTex") + .sampler(1, ImageType::DEPTH_2D, "xrayDepthTex") + .push_constant(Type::FLOAT, "opacity") + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_source("overlay_xray_fade_frag.glsl") + .additional_info("draw_fullscreen"); diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_armature_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_armature_info.hh index b45d1d6c249..93daa6bd487 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_armature_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_armature_info.hh @@ -5,72 +5,64 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(overlay_frag_output) -FRAGMENT_OUT(0, VEC4, fragColor) -FRAGMENT_OUT(1, VEC4, lineOutput) -GPU_SHADER_CREATE_END() + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_out(1, Type::VEC4, "lineOutput"); GPU_SHADER_INTERFACE_INFO(overlay_armature_wire_iface) -FLAT(VEC4, finalColor) -FLAT(VEC2, edgeStart) -NO_PERSPECTIVE(VEC2, edgePos) -GPU_SHADER_INTERFACE_END() + .flat(Type::VEC4, "finalColor") + .flat(Type::VEC2, "edgeStart") + .no_perspective(Type::VEC2, "edgePos"); GPU_SHADER_CREATE_INFO(overlay_armature_common) -PUSH_CONSTANT(FLOAT, alpha) -ADDITIONAL_INFO(draw_view) -GPU_SHADER_CREATE_END() + .push_constant(Type::FLOAT, "alpha") + .additional_info("draw_view"); /* -------------------------------------------------------------------- */ /** \name Armature Sphere * \{ */ GPU_SHADER_CREATE_INFO(overlay_armature_sphere_outline) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC2, pos) -/* Per instance. */ -VERTEX_IN(1, MAT4, inst_obmat) -VERTEX_OUT(overlay_armature_wire_iface) -VERTEX_SOURCE("overlay_armature_sphere_outline_vert.glsl") -FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl") -ADDITIONAL_INFO(overlay_frag_output) -ADDITIONAL_INFO(overlay_armature_common) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC2, "pos") + /* Per instance. */ + .vertex_in(1, Type::MAT4, "inst_obmat") + .vertex_out(overlay_armature_wire_iface) + .vertex_source("overlay_armature_sphere_outline_vert.glsl") + .fragment_source("overlay_armature_wire_frag.glsl") + .additional_info("overlay_frag_output") + .additional_info("overlay_armature_common") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_armature_sphere_outline_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_armature_sphere_outline) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_armature_sphere_outline") + .additional_info("drw_clipped"); GPU_SHADER_INTERFACE_INFO(overlay_armature_sphere_solid_iface) -FLAT(VEC3, finalStateColor) -FLAT(VEC3, finalBoneColor) -FLAT(MAT4, sphereMatrix) -SMOOTH(VEC3, viewPosition) -GPU_SHADER_INTERFACE_END() + .flat(Type::VEC3, "finalStateColor") + .flat(Type::VEC3, "finalBoneColor") + .flat(Type::MAT4, "sphereMatrix") + .smooth(Type::VEC3, "viewPosition"); GPU_SHADER_CREATE_INFO(overlay_armature_sphere_solid) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC2, pos) -/* Per instance. */ -VERTEX_IN(1, VEC4, color) -VERTEX_IN(2, MAT4, inst_obmat) -DEPTH_WRITE(DepthWrite::GREATER) -VERTEX_OUT(overlay_armature_sphere_solid_iface) -VERTEX_SOURCE("overlay_armature_sphere_solid_vert.glsl") -FRAGMENT_SOURCE("overlay_armature_sphere_solid_frag.glsl") -ADDITIONAL_INFO(overlay_frag_output) -ADDITIONAL_INFO(overlay_armature_common) -ADDITIONAL_INFO(draw_globals) -DEPTH_WRITE(DepthWrite::ANY) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC2, "pos") + /* Per instance. */ + .vertex_in(1, Type::VEC4, "color") + .vertex_in(2, Type::MAT4, "inst_obmat") + .depth_write(DepthWrite::GREATER) + .vertex_out(overlay_armature_sphere_solid_iface) + .vertex_source("overlay_armature_sphere_solid_vert.glsl") + .fragment_source("overlay_armature_sphere_solid_frag.glsl") + .additional_info("overlay_frag_output") + .additional_info("overlay_armature_common") + .additional_info("draw_globals") + .depth_write(DepthWrite::ANY); GPU_SHADER_CREATE_INFO(overlay_armature_sphere_solid_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_armature_sphere_solid) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_armature_sphere_solid") + .additional_info("drw_clipped"); /** \} */ @@ -79,185 +71,166 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_NAMED_INTERFACE_INFO(overlay_armature_shape_outline_iface, geom_in) -SMOOTH(VEC4, pPos) -SMOOTH(VEC3, vPos) -SMOOTH(VEC2, ssPos) -SMOOTH(VEC4, vColSize) -GPU_SHADER_INTERFACE_END() + .smooth(Type::VEC4, "pPos") + .smooth(Type::VEC3, "vPos") + .smooth(Type::VEC2, "ssPos") + .smooth(Type::VEC4, "vColSize"); GPU_SHADER_NAMED_INTERFACE_INFO(overlay_armature_shape_outline_flat_iface, geom_flat_in) -FLAT(INT, inverted) -GPU_SHADER_INTERFACE_END() + .flat(Type::INT, "inverted"); GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_outline_no_geom_iface) -FLAT(VEC4, finalColor) -FLAT(VEC2, edgeStart) -NO_PERSPECTIVE(VEC2, edgePos) -GPU_SHADER_INTERFACE_END() + .flat(Type::VEC4, "finalColor") + .flat(Type::VEC2, "edgeStart") + .no_perspective(Type::VEC2, "edgePos"); GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -/* Per instance. */ -VERTEX_IN(3, MAT4, inst_obmat) -VERTEX_OUT(overlay_armature_shape_outline_iface) -VERTEX_OUT(overlay_armature_shape_outline_flat_iface) -GEOMETRY_LAYOUT(PrimitiveIn::LINES_ADJACENCY, PrimitiveOut::LINE_STRIP, 2) -GEOMETRY_OUT(overlay_armature_wire_iface) -VERTEX_SOURCE("overlay_armature_shape_outline_vert.glsl") -GEOMETRY_SOURCE("overlay_armature_shape_outline_geom.glsl") -FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl") -ADDITIONAL_INFO(overlay_frag_output) -ADDITIONAL_INFO(overlay_armature_common) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + /* Per instance. */ + .vertex_in(3, Type::MAT4, "inst_obmat") + .vertex_out(overlay_armature_shape_outline_iface) + .vertex_out(overlay_armature_shape_outline_flat_iface) + .geometry_layout(PrimitiveIn::LINES_ADJACENCY, PrimitiveOut::LINE_STRIP, 2) + .geometry_out(overlay_armature_wire_iface) + .vertex_source("overlay_armature_shape_outline_vert.glsl") + .geometry_source("overlay_armature_shape_outline_geom.glsl") + .fragment_source("overlay_armature_wire_frag.glsl") + .additional_info("overlay_frag_output") + .additional_info("overlay_armature_common") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_no_geom) -METAL_BACKEND_ONLY() -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -/* Per instance. */ -VERTEX_IN(3, MAT4, inst_obmat) -VERTEX_OUT(overlay_armature_shape_outline_no_geom_iface) -VERTEX_SOURCE("overlay_armature_shape_outline_vert_no_geom.glsl") -FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl") -ADDITIONAL_INFO(overlay_frag_output) -ADDITIONAL_INFO(overlay_armature_common) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .metal_backend_only(true) + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + /* Per instance. */ + .vertex_in(3, Type::MAT4, "inst_obmat") + .vertex_out(overlay_armature_shape_outline_no_geom_iface) + .vertex_source("overlay_armature_shape_outline_vert_no_geom.glsl") + .fragment_source("overlay_armature_wire_frag.glsl") + .additional_info("overlay_frag_output") + .additional_info("overlay_armature_common") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_next) -DO_STATIC_COMPILATION() -STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY) -STORAGE_BUF(1, READ, mat4, data_buf[]) -PUSH_CONSTANT(IVEC2, gpu_attr_0) -VERTEX_OUT(overlay_armature_shape_outline_no_geom_iface) -VERTEX_SOURCE("overlay_armature_shape_outline_next_vert.glsl") -FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl") -ADDITIONAL_INFO(overlay_frag_output) -ADDITIONAL_INFO(overlay_armature_common) -ADDITIONAL_INFO(gpu_index_load) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY) + .storage_buf(1, Qualifier::READ, "mat4", "data_buf[]") + .push_constant(Type::IVEC2, "gpu_attr_0") + .vertex_out(overlay_armature_shape_outline_no_geom_iface) + .vertex_source("overlay_armature_shape_outline_next_vert.glsl") + .fragment_source("overlay_armature_wire_frag.glsl") + .additional_info("overlay_frag_output") + .additional_info("overlay_armature_common") + .additional_info("gpu_index_load") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_armature_shape_outline) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_armature_shape_outline") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_clipped_no_geom) -METAL_BACKEND_ONLY() -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_armature_shape_outline_no_geom) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .metal_backend_only(true) + .do_static_compilation(true) + .additional_info("overlay_armature_shape_outline_no_geom") + .additional_info("drw_clipped"); GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_solid_iface) -SMOOTH(VEC4, finalColor) -FLAT(INT, inverted) -GPU_SHADER_INTERFACE_END() + .smooth(Type::VEC4, "finalColor") + .flat(Type::INT, "inverted"); GPU_SHADER_CREATE_INFO(overlay_armature_shape_solid) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, VEC3, nor) -/* Per instance. */ -VERTEX_IN(2, MAT4, inst_obmat) -DEPTH_WRITE(DepthWrite::GREATER) -VERTEX_OUT(overlay_armature_shape_solid_iface) -VERTEX_SOURCE("overlay_armature_shape_solid_vert.glsl") -FRAGMENT_SOURCE("overlay_armature_shape_solid_frag.glsl") -ADDITIONAL_INFO(overlay_frag_output) -ADDITIONAL_INFO(overlay_armature_common) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC3, "nor") + /* Per instance. */ + .vertex_in(2, Type::MAT4, "inst_obmat") + .depth_write(DepthWrite::GREATER) + .vertex_out(overlay_armature_shape_solid_iface) + .vertex_source("overlay_armature_shape_solid_vert.glsl") + .fragment_source("overlay_armature_shape_solid_frag.glsl") + .additional_info("overlay_frag_output") + .additional_info("overlay_armature_common") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_armature_shape_solid_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_armature_shape_solid) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_armature_shape_solid") + .additional_info("drw_clipped"); GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_wire_next_iface) -FLAT(VEC4, finalColor) -FLAT(FLOAT, wire_width) -NO_PERSPECTIVE(FLOAT, edgeCoord) -GPU_SHADER_INTERFACE_END() + .flat(Type::VEC4, "finalColor") + .flat(Type::FLOAT, "wire_width") + .no_perspective(Type::FLOAT, "edgeCoord"); GPU_SHADER_NAMED_INTERFACE_INFO(overlay_armature_shape_wire_iface, geometry_in) -FLAT(VEC4, finalColor) -FLAT(FLOAT, wire_width) -GPU_SHADER_INTERFACE_END() + .flat(Type::VEC4, "finalColor") + .flat(Type::FLOAT, "wire_width"); GPU_SHADER_NAMED_INTERFACE_INFO(overlay_armature_shape_wire_geom_iface, geometry_out) -FLAT(VEC4, finalColor) -FLAT(FLOAT, wire_width) -GPU_SHADER_INTERFACE_END() + .flat(Type::VEC4, "finalColor") + .flat(Type::FLOAT, "wire_width"); GPU_SHADER_NAMED_INTERFACE_INFO(overlay_armature_shape_wire_geom_noperspective_iface, geometry_noperspective_out) -NO_PERSPECTIVE(FLOAT, edgeCoord) -GPU_SHADER_INTERFACE_END() + .no_perspective(Type::FLOAT, "edgeCoord"); GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire) -DO_STATIC_COMPILATION() -PUSH_CONSTANT(BOOL, do_smooth_wire) -VERTEX_IN(0, VEC3, pos) -/* Per instance. */ -VERTEX_IN(2, MAT4, inst_obmat) -VERTEX_OUT(overlay_armature_shape_wire_iface) -VERTEX_SOURCE("overlay_armature_shape_wire_vert.glsl") -GEOMETRY_OUT(overlay_armature_shape_wire_geom_iface) -GEOMETRY_OUT(overlay_armature_shape_wire_geom_noperspective_iface) -GEOMETRY_LAYOUT(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) -GEOMETRY_SOURCE("overlay_armature_shape_wire_geom.glsl") -FRAGMENT_SOURCE("overlay_armature_shape_wire_frag.glsl") -TYPEDEF_SOURCE("overlay_shader_shared.h") -ADDITIONAL_INFO(overlay_frag_output) -ADDITIONAL_INFO(overlay_armature_common) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .push_constant(Type::BOOL, "do_smooth_wire") + .vertex_in(0, Type::VEC3, "pos") + /* Per instance. */ + .vertex_in(2, Type::MAT4, "inst_obmat") + .vertex_out(overlay_armature_shape_wire_iface) + .vertex_source("overlay_armature_shape_wire_vert.glsl") + .geometry_out(overlay_armature_shape_wire_geom_iface) + .geometry_out(overlay_armature_shape_wire_geom_noperspective_iface) + .geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) + .geometry_source("overlay_armature_shape_wire_geom.glsl") + .fragment_source("overlay_armature_shape_wire_frag.glsl") + .typedef_source("overlay_shader_shared.h") + .additional_info("overlay_frag_output") + .additional_info("overlay_armature_common") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_armature_shape_wire) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_armature_shape_wire") + .additional_info("drw_clipped"); #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire_no_geom) -METAL_BACKEND_ONLY() -DO_STATIC_COMPILATION() -PUSH_CONSTANT(BOOL, do_smooth_wire) -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(2, MAT4, inst_obmat) -VERTEX_OUT(overlay_armature_wire_iface) -VERTEX_SOURCE("overlay_armature_shape_wire_vert_no_geom.glsl") -FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl") -TYPEDEF_SOURCE("overlay_shader_shared.h") -ADDITIONAL_INFO(overlay_frag_output) -ADDITIONAL_INFO(overlay_armature_common) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .metal_backend_only(true) + .do_static_compilation(true) + .push_constant(Type::BOOL, "do_smooth_wire") + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(2, Type::MAT4, "inst_obmat") + .vertex_out(overlay_armature_wire_iface) + .vertex_source("overlay_armature_shape_wire_vert_no_geom.glsl") + .fragment_source("overlay_armature_wire_frag.glsl") + .typedef_source("overlay_shader_shared.h") + .additional_info("overlay_frag_output") + .additional_info("overlay_armature_common") + .additional_info("draw_globals"); #endif GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire_next) -DO_STATIC_COMPILATION() -DEFINE("NO_GEOM") -PUSH_CONSTANT(BOOL, do_smooth_wire) -STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY) -STORAGE_BUF(1, READ, mat4, data_buf[]) -PUSH_CONSTANT(IVEC2, gpu_attr_0) -DEFINE_VALUE("inst_obmat", "data_buf[gl_InstanceID]") -VERTEX_OUT(overlay_armature_shape_wire_next_iface) -VERTEX_SOURCE("overlay_armature_shape_wire_next_vert.glsl") -FRAGMENT_SOURCE("overlay_armature_shape_wire_frag.glsl") -TYPEDEF_SOURCE("overlay_shader_shared.h") -ADDITIONAL_INFO(overlay_frag_output) -ADDITIONAL_INFO(overlay_armature_common) -ADDITIONAL_INFO(gpu_index_load) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("NO_GEOM") + .push_constant(Type::BOOL, "do_smooth_wire") + .storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY) + .storage_buf(1, Qualifier::READ, "mat4", "data_buf[]") + .push_constant(Type::IVEC2, "gpu_attr_0") + .define("inst_obmat", "data_buf[gl_InstanceID]") + .vertex_out(overlay_armature_shape_wire_next_iface) + .vertex_source("overlay_armature_shape_wire_next_vert.glsl") + .fragment_source("overlay_armature_shape_wire_frag.glsl") + .typedef_source("overlay_shader_shared.h") + .additional_info("overlay_frag_output") + .additional_info("overlay_armature_common") + .additional_info("gpu_index_load") + .additional_info("draw_globals"); /** \} */ @@ -266,59 +239,54 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(overlay_armature_envelope_outline) -DO_STATIC_COMPILATION() -TYPEDEF_SOURCE("overlay_shader_shared.h") -VERTEX_IN(0, VEC2, pos0) -VERTEX_IN(1, VEC2, pos1) -VERTEX_IN(2, VEC2, pos2) -/* Per instance. */ -VERTEX_IN(3, VEC4, headSphere) -VERTEX_IN(4, VEC4, tailSphere) -VERTEX_IN(5, VEC4, outlineColorSize) -VERTEX_IN(6, VEC3, xAxis) -VERTEX_OUT(overlay_armature_wire_iface) -VERTEX_SOURCE("overlay_armature_envelope_outline_vert.glsl") -FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl") -ADDITIONAL_INFO(overlay_frag_output) -ADDITIONAL_INFO(overlay_armature_common) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .typedef_source("overlay_shader_shared.h") + .vertex_in(0, Type::VEC2, "pos0") + .vertex_in(1, Type::VEC2, "pos1") + .vertex_in(2, Type::VEC2, "pos2") + /* Per instance. */ + .vertex_in(3, Type::VEC4, "headSphere") + .vertex_in(4, Type::VEC4, "tailSphere") + .vertex_in(5, Type::VEC4, "outlineColorSize") + .vertex_in(6, Type::VEC3, "xAxis") + .vertex_out(overlay_armature_wire_iface) + .vertex_source("overlay_armature_envelope_outline_vert.glsl") + .fragment_source("overlay_armature_wire_frag.glsl") + .additional_info("overlay_frag_output") + .additional_info("overlay_armature_common") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_armature_envelope_outline_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_armature_envelope_outline) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_armature_envelope_outline") + .additional_info("drw_clipped"); GPU_SHADER_INTERFACE_INFO(overlay_armature_envelope_solid_iface) -FLAT(VEC3, finalStateColor) -FLAT(VEC3, finalBoneColor) -SMOOTH(VEC3, normalView) -GPU_SHADER_INTERFACE_END() + .flat(Type::VEC3, "finalStateColor") + .flat(Type::VEC3, "finalBoneColor") + .smooth(Type::VEC3, "normalView"); GPU_SHADER_CREATE_INFO(overlay_armature_envelope_solid) -DO_STATIC_COMPILATION() -TYPEDEF_SOURCE("overlay_shader_shared.h") -VERTEX_IN(0, VEC3, pos) -/* Per instance. Assumed to be in world coordinate already. */ -VERTEX_IN(1, VEC4, headSphere) -VERTEX_IN(2, VEC4, tailSphere) -VERTEX_IN(3, VEC3, xAxis) -VERTEX_IN(4, VEC3, stateColor) -VERTEX_IN(5, VEC3, boneColor) -VERTEX_OUT(overlay_armature_envelope_solid_iface) -PUSH_CONSTANT(BOOL, isDistance) -VERTEX_SOURCE("overlay_armature_envelope_solid_vert.glsl") -FRAGMENT_SOURCE("overlay_armature_envelope_solid_frag.glsl") -ADDITIONAL_INFO(overlay_frag_output) -ADDITIONAL_INFO(overlay_armature_common) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .typedef_source("overlay_shader_shared.h") + .vertex_in(0, Type::VEC3, "pos") + /* Per instance. Assumed to be in world coordinate already. */ + .vertex_in(1, Type::VEC4, "headSphere") + .vertex_in(2, Type::VEC4, "tailSphere") + .vertex_in(3, Type::VEC3, "xAxis") + .vertex_in(4, Type::VEC3, "stateColor") + .vertex_in(5, Type::VEC3, "boneColor") + .vertex_out(overlay_armature_envelope_solid_iface) + .push_constant(Type::BOOL, "isDistance") + .vertex_source("overlay_armature_envelope_solid_vert.glsl") + .fragment_source("overlay_armature_envelope_solid_frag.glsl") + .additional_info("overlay_frag_output") + .additional_info("overlay_armature_common"); GPU_SHADER_CREATE_INFO(overlay_armature_envelope_solid_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_armature_envelope_solid) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_armature_envelope_solid") + .additional_info("drw_clipped"); /** \} */ @@ -327,39 +295,36 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_INTERFACE_INFO(overlay_armature_stick_iface) -NO_PERSPECTIVE(FLOAT, colorFac) -FLAT(VEC4, finalWireColor) -FLAT(VEC4, finalInnerColor) -GPU_SHADER_INTERFACE_END() + .no_perspective(Type::FLOAT, "colorFac") + .flat(Type::VEC4, "finalWireColor") + .flat(Type::VEC4, "finalInnerColor"); GPU_SHADER_CREATE_INFO(overlay_armature_stick) -DO_STATIC_COMPILATION() -TYPEDEF_SOURCE("overlay_shader_shared.h") -/* Bone aligned screen space. */ -VERTEX_IN(0, VEC2, pos) -VERTEX_IN(1, UINT, flag) -/* Per instance. Assumed to be in world coordinate already. */ -VERTEX_IN(2, VEC3, boneStart) -VERTEX_IN(3, VEC3, boneEnd) -/* alpha encode if we do wire. If 0.0 we don't. */ -VERTEX_IN(4, VEC4, wireColor) -VERTEX_IN(5, VEC4, boneColor) -VERTEX_IN(6, VEC4, headColor) -VERTEX_IN(7, VEC4, tailColor) -DEFINE_VALUE("do_wire", "(wireColor.a > 0.0)") -VERTEX_OUT(overlay_armature_stick_iface) -VERTEX_SOURCE("overlay_armature_stick_vert.glsl") -FRAGMENT_SOURCE("overlay_armature_stick_frag.glsl") -ADDITIONAL_INFO(overlay_frag_output) -ADDITIONAL_INFO(overlay_armature_common) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .typedef_source("overlay_shader_shared.h") + /* Bone aligned screen space. */ + .vertex_in(0, Type::VEC2, "pos") + .vertex_in(1, Type::UINT, "flag") + /* Per instance. Assumed to be in world coordinate already. */ + .vertex_in(2, Type::VEC3, "boneStart") + .vertex_in(3, Type::VEC3, "boneEnd") + /* alpha encode if we do wire. If 0.0 we don't. */ + .vertex_in(4, Type::VEC4, "wireColor") + .vertex_in(5, Type::VEC4, "boneColor") + .vertex_in(6, Type::VEC4, "headColor") + .vertex_in(7, Type::VEC4, "tailColor") + .define("do_wire", "(wireColor.a > 0.0)") + .vertex_out(overlay_armature_stick_iface) + .vertex_source("overlay_armature_stick_vert.glsl") + .fragment_source("overlay_armature_stick_frag.glsl") + .additional_info("overlay_frag_output") + .additional_info("overlay_armature_common") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_armature_stick_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_armature_stick) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_armature_stick") + .additional_info("drw_clipped"); /** \} */ @@ -368,25 +333,23 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(overlay_armature_dof) -DO_STATIC_COMPILATION() -TYPEDEF_SOURCE("overlay_shader_shared.h") -VERTEX_IN(0, VEC2, pos) -/* Per instance. Assumed to be in world coordinate already. */ -VERTEX_IN(1, VEC4, color) -VERTEX_IN(2, MAT4, inst_obmat) -VERTEX_OUT(overlay_armature_wire_iface) -VERTEX_SOURCE("overlay_armature_dof_vert.glsl") -FRAGMENT_SOURCE("overlay_armature_dof_solid_frag.glsl") -ADDITIONAL_INFO(overlay_frag_output) -ADDITIONAL_INFO(overlay_armature_common) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .typedef_source("overlay_shader_shared.h") + .vertex_in(0, Type::VEC2, "pos") + /* Per instance. Assumed to be in world coordinate already. */ + .vertex_in(1, Type::VEC4, "color") + .vertex_in(2, Type::MAT4, "inst_obmat") + .vertex_out(overlay_armature_wire_iface) + .vertex_source("overlay_armature_dof_vert.glsl") + .fragment_source("overlay_armature_dof_solid_frag.glsl") + .additional_info("overlay_frag_output") + .additional_info("overlay_armature_common") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_armature_dof_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_armature_dof) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_armature_dof") + .additional_info("drw_clipped"); /** \} */ @@ -395,23 +358,21 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(overlay_armature_wire) -DO_STATIC_COMPILATION() -TYPEDEF_SOURCE("overlay_shader_shared.h") -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, VEC4, color) -PUSH_CONSTANT(FLOAT, alpha) -VERTEX_OUT(overlay_armature_wire_iface) -VERTEX_SOURCE("overlay_armature_wire_vert.glsl") -FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl") -ADDITIONAL_INFO(overlay_frag_output) -ADDITIONAL_INFO(draw_mesh) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .typedef_source("overlay_shader_shared.h") + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC4, "color") + .push_constant(Type::FLOAT, "alpha") + .vertex_out(overlay_armature_wire_iface) + .vertex_source("overlay_armature_wire_vert.glsl") + .fragment_source("overlay_armature_wire_frag.glsl") + .additional_info("overlay_frag_output") + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_armature_wire_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_armature_wire) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_armature_wire") + .additional_info("drw_clipped"); /** \} */ diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_background_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_background_info.hh index d5f15e27f8b..ab179baf277 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_background_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_background_info.hh @@ -5,24 +5,22 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(overlay_background) -DO_STATIC_COMPILATION() -TYPEDEF_SOURCE("overlay_shader_shared.h") -SAMPLER(0, FLOAT_2D, colorBuffer) -SAMPLER(1, DEPTH_2D, depthBuffer) -PUSH_CONSTANT(INT, bgType) -PUSH_CONSTANT(VEC4, colorOverride) -FRAGMENT_SOURCE("overlay_background_frag.glsl") -FRAGMENT_OUT(0, VEC4, fragColor) -ADDITIONAL_INFO(draw_fullscreen) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .typedef_source("overlay_shader_shared.h") + .sampler(0, ImageType::FLOAT_2D, "colorBuffer") + .sampler(1, ImageType::DEPTH_2D, "depthBuffer") + .push_constant(Type::INT, "bgType") + .push_constant(Type::VEC4, "colorOverride") + .fragment_source("overlay_background_frag.glsl") + .fragment_out(0, Type::VEC4, "fragColor") + .additional_info("draw_fullscreen") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_clipbound) -DO_STATIC_COMPILATION() -PUSH_CONSTANT(VEC4, ucolor) -PUSH_CONSTANT_ARRAY(VEC3, boundbox, 8) -VERTEX_SOURCE("overlay_clipbound_vert.glsl") -FRAGMENT_OUT(0, VEC4, fragColor) -FRAGMENT_SOURCE("overlay_uniform_color_frag.glsl") -ADDITIONAL_INFO(draw_view) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .push_constant(Type::VEC4, "ucolor") + .push_constant(Type::VEC3, "boundbox", 8) + .vertex_source("overlay_clipbound_vert.glsl") + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_source("overlay_uniform_color_frag.glsl") + .additional_info("draw_view"); diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh index bf2765c5cc7..f6ab857a1ae 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh @@ -4,368 +4,328 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(overlay_edit_flat_color_iface) -FLAT(VEC4, finalColor) -GPU_SHADER_INTERFACE_END() -GPU_SHADER_INTERFACE_INFO(overlay_edit_smooth_color_iface) -SMOOTH(VEC4, finalColor) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_INTERFACE_INFO(overlay_edit_flat_color_iface).flat(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_edit_smooth_color_iface).smooth(Type::VEC4, "finalColor"); GPU_SHADER_INTERFACE_INFO(overlay_edit_nopersp_color_iface) -NO_PERSPECTIVE(VEC4, finalColor) -GPU_SHADER_INTERFACE_END() + .no_perspective(Type::VEC4, "finalColor"); /* -------------------------------------------------------------------- */ /** \name Edit Mesh * \{ */ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_common) -DEFINE_VALUE("blender_srgb_to_framebuffer_space(a)", "a") -SAMPLER(0, DEPTH_2D, depthTex) -FRAGMENT_OUT(0, VEC4, fragColor) -PUSH_CONSTANT(BOOL, wireShading) -PUSH_CONSTANT(BOOL, selectFace) -PUSH_CONSTANT(BOOL, selectEdge) -PUSH_CONSTANT(FLOAT, alpha) -PUSH_CONSTANT(FLOAT, retopologyOffset) -PUSH_CONSTANT(IVEC4, dataMask) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .define("blender_srgb_to_framebuffer_space(a)", "a") + .sampler(0, ImageType::DEPTH_2D, "depthTex") + .fragment_out(0, Type::VEC4, "fragColor") + .push_constant(Type::BOOL, "wireShading") + .push_constant(Type::BOOL, "selectFace") + .push_constant(Type::BOOL, "selectEdge") + .push_constant(Type::FLOAT, "alpha") + .push_constant(Type::FLOAT, "retopologyOffset") + .push_constant(Type::IVEC4, "dataMask") + .additional_info("draw_globals"); #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_edit_mesh_common_no_geom) -METAL_BACKEND_ONLY() -DEFINE_VALUE("blender_srgb_to_framebuffer_space(a)", "a") -SAMPLER(0, DEPTH_2D, depthTex) -FRAGMENT_OUT(0, VEC4, fragColor) -PUSH_CONSTANT(BOOL, wireShading) -PUSH_CONSTANT(BOOL, selectFace) -PUSH_CONSTANT(BOOL, selectEdge) -PUSH_CONSTANT(FLOAT, alpha) -PUSH_CONSTANT(FLOAT, retopologyOffset) -PUSH_CONSTANT(IVEC4, dataMask) -VERTEX_SOURCE("overlay_edit_mesh_vert_no_geom.glsl") -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .metal_backend_only(true) + .define("blender_srgb_to_framebuffer_space(a)", "a") + .sampler(0, ImageType::DEPTH_2D, "depthTex") + .fragment_out(0, Type::VEC4, "fragColor") + .push_constant(Type::BOOL, "wireShading") + .push_constant(Type::BOOL, "selectFace") + .push_constant(Type::BOOL, "selectEdge") + .push_constant(Type::FLOAT, "alpha") + .push_constant(Type::FLOAT, "retopologyOffset") + .push_constant(Type::IVEC4, "dataMask") + .vertex_source("overlay_edit_mesh_vert_no_geom.glsl") + .additional_info("draw_globals"); #endif GPU_SHADER_CREATE_INFO(overlay_edit_mesh_depth) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -PUSH_CONSTANT(FLOAT, retopologyOffset) -VERTEX_SOURCE("overlay_edit_mesh_depth_vert.glsl") -FRAGMENT_SOURCE("overlay_depth_only_frag.glsl") -ADDITIONAL_INFO(draw_mesh) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .push_constant(Type::FLOAT, "retopologyOffset") + .vertex_source("overlay_edit_mesh_depth_vert.glsl") + .fragment_source("overlay_depth_only_frag.glsl") + .additional_info("draw_mesh"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_depth_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_edit_mesh_depth) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_edit_mesh_depth") + .additional_info("drw_clipped"); GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_vert_iface) -SMOOTH(VEC4, finalColor) -SMOOTH(FLOAT, vertexCrease) -GPU_SHADER_INTERFACE_END() + .smooth(Type::VEC4, "finalColor") + .smooth(Type::FLOAT, "vertexCrease"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_vert) -DO_STATIC_COMPILATION() -BUILTINS(BuiltinBits::POINT_SIZE) -DEFINE("VERT") -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, UVEC4, data) -VERTEX_IN(2, VEC3, vnor) -VERTEX_SOURCE("overlay_edit_mesh_vert.glsl") -VERTEX_OUT(overlay_edit_mesh_vert_iface) -FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") -ADDITIONAL_INFO(draw_modelmat) -ADDITIONAL_INFO(overlay_edit_mesh_common) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .builtins(BuiltinBits::POINT_SIZE) + .define("VERT") + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::UVEC4, "data") + .vertex_in(2, Type::VEC3, "vnor") + .vertex_source("overlay_edit_mesh_vert.glsl") + .vertex_out(overlay_edit_mesh_vert_iface) + .fragment_source("overlay_point_varying_color_frag.glsl") + .additional_info("draw_modelmat") + .additional_info("overlay_edit_mesh_common"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_vert_next) -DO_STATIC_COMPILATION() -BUILTINS(BuiltinBits::POINT_SIZE) -DEFINE("VERT") -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, UVEC4, data) -VERTEX_IN(2, VEC3, vnor) -VERTEX_SOURCE("overlay_edit_mesh_vertex_vert.glsl") -VERTEX_OUT(overlay_edit_mesh_vert_iface) -FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_modelmat_new) -ADDITIONAL_INFO(draw_resource_handle_new) -ADDITIONAL_INFO(overlay_edit_mesh_common) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .builtins(BuiltinBits::POINT_SIZE) + .define("VERT") + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::UVEC4, "data") + .vertex_in(2, Type::VEC3, "vnor") + .vertex_source("overlay_edit_mesh_vertex_vert.glsl") + .vertex_out(overlay_edit_mesh_vert_iface) + .fragment_source("overlay_point_varying_color_frag.glsl") + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new") + .additional_info("overlay_edit_mesh_common"); GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_mesh_edge_iface, geometry_in) -SMOOTH(VEC4, finalColor_) -SMOOTH(VEC4, finalColorOuter_) -SMOOTH(UINT, selectOverride_) -GPU_SHADER_INTERFACE_END() + .smooth(Type::VEC4, "finalColor_") + .smooth(Type::VEC4, "finalColorOuter_") + .smooth(Type::UINT, "selectOverride_"); GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_mesh_edge_geom_iface, geometry_out) -SMOOTH(VEC4, finalColor) -GPU_SHADER_INTERFACE_END() + .smooth(Type::VEC4, "finalColor"); GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_mesh_edge_geom_flat_iface, geometry_flat_out) -FLAT(VEC4, finalColorOuter) -GPU_SHADER_INTERFACE_END() + .flat(Type::VEC4, "finalColorOuter"); GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_mesh_edge_geom_noperspective_iface, geometry_noperspective_out) -NO_PERSPECTIVE(FLOAT, edgeCoord) -GPU_SHADER_INTERFACE_END() + .no_perspective(Type::FLOAT, "edgeCoord"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge) -DO_STATIC_COMPILATION() -DEFINE("EDGE") -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, UVEC4, data) -VERTEX_IN(2, VEC3, vnor) -PUSH_CONSTANT(BOOL, do_smooth_wire) -VERTEX_SOURCE("overlay_edit_mesh_vert.glsl") -VERTEX_OUT(overlay_edit_mesh_edge_iface) -GEOMETRY_OUT(overlay_edit_mesh_edge_geom_iface) -GEOMETRY_OUT(overlay_edit_mesh_edge_geom_flat_iface) -GEOMETRY_OUT(overlay_edit_mesh_edge_geom_noperspective_iface) -GEOMETRY_LAYOUT(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) -GEOMETRY_SOURCE("overlay_edit_mesh_geom.glsl") -FRAGMENT_SOURCE("overlay_edit_mesh_frag.glsl") -ADDITIONAL_INFO(draw_modelmat) -ADDITIONAL_INFO(overlay_edit_mesh_common) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("EDGE") + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::UVEC4, "data") + .vertex_in(2, Type::VEC3, "vnor") + .push_constant(Type::BOOL, "do_smooth_wire") + .vertex_source("overlay_edit_mesh_vert.glsl") + .vertex_out(overlay_edit_mesh_edge_iface) + .geometry_out(overlay_edit_mesh_edge_geom_iface) + .geometry_out(overlay_edit_mesh_edge_geom_flat_iface) + .geometry_out(overlay_edit_mesh_edge_geom_noperspective_iface) + .geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) + .geometry_source("overlay_edit_mesh_geom.glsl") + .fragment_source("overlay_edit_mesh_frag.glsl") + .additional_info("draw_modelmat") + .additional_info("overlay_edit_mesh_common"); /* The Non-Geometry shader variant passes directly to fragment. */ #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_no_geom) -METAL_BACKEND_ONLY() -DO_STATIC_COMPILATION() -DEFINE("EDGE") -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, UCHAR4, data) -VERTEX_IN(2, VEC3_101010I2, vnor) -PUSH_CONSTANT(BOOL, do_smooth_wire) -VERTEX_OUT(overlay_edit_mesh_edge_geom_iface) -VERTEX_OUT(overlay_edit_mesh_edge_geom_flat_iface) -VERTEX_OUT(overlay_edit_mesh_edge_geom_noperspective_iface) -FRAGMENT_SOURCE("overlay_edit_mesh_frag.glsl") -ADDITIONAL_INFO(draw_modelmat) -ADDITIONAL_INFO(overlay_edit_mesh_common_no_geom) -GPU_SHADER_CREATE_END() + .metal_backend_only(true) + .do_static_compilation(true) + .define("EDGE") + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::UCHAR4, "data") + .vertex_in(2, Type::VEC3_101010I2, "vnor") + .push_constant(Type::BOOL, "do_smooth_wire") + .vertex_out(overlay_edit_mesh_edge_geom_iface) + .vertex_out(overlay_edit_mesh_edge_geom_flat_iface) + .vertex_out(overlay_edit_mesh_edge_geom_noperspective_iface) + .fragment_source("overlay_edit_mesh_frag.glsl") + .additional_info("draw_modelmat") + .additional_info("overlay_edit_mesh_common_no_geom"); #endif /* Vertex Pull version for overlay next. */ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_next) -DO_STATIC_COMPILATION() -DEFINE("EDGE") -STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY) -STORAGE_BUF_FREQ(1, READ, uint, vnor[], GEOMETRY) -STORAGE_BUF_FREQ(2, READ, uint, data[], GEOMETRY) -PUSH_CONSTANT(IVEC2, gpu_attr_0) -PUSH_CONSTANT(IVEC2, gpu_attr_1) -PUSH_CONSTANT(IVEC2, gpu_attr_2) -PUSH_CONSTANT(BOOL, do_smooth_wire) -PUSH_CONSTANT(BOOL, use_vertex_selection) -VERTEX_OUT(overlay_edit_mesh_edge_geom_iface) -VERTEX_OUT(overlay_edit_mesh_edge_geom_flat_iface) -VERTEX_OUT(overlay_edit_mesh_edge_geom_noperspective_iface) -VERTEX_SOURCE("overlay_edit_mesh_edge_vert.glsl") -FRAGMENT_SOURCE("overlay_edit_mesh_frag.glsl") -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_modelmat_new) -ADDITIONAL_INFO(draw_resource_handle_new) -ADDITIONAL_INFO(gpu_index_load) -ADDITIONAL_INFO(overlay_edit_mesh_common) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("EDGE") + .storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY) + .storage_buf(1, Qualifier::READ, "uint", "vnor[]", Frequency::GEOMETRY) + .storage_buf(2, Qualifier::READ, "uint", "data[]", Frequency::GEOMETRY) + .push_constant(Type::IVEC2, "gpu_attr_0") + .push_constant(Type::IVEC2, "gpu_attr_1") + .push_constant(Type::IVEC2, "gpu_attr_2") + .push_constant(Type::BOOL, "do_smooth_wire") + .push_constant(Type::BOOL, "use_vertex_selection") + .vertex_out(overlay_edit_mesh_edge_geom_iface) + .vertex_out(overlay_edit_mesh_edge_geom_flat_iface) + .vertex_out(overlay_edit_mesh_edge_geom_noperspective_iface) + .vertex_source("overlay_edit_mesh_edge_vert.glsl") + .fragment_source("overlay_edit_mesh_frag.glsl") + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new") + .additional_info("gpu_index_load") + .additional_info("overlay_edit_mesh_common"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_flat) -DO_STATIC_COMPILATION() -DEFINE("FLAT") -ADDITIONAL_INFO(overlay_edit_mesh_edge) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("FLAT") + .additional_info("overlay_edit_mesh_edge"); #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_flat_no_geom) -METAL_BACKEND_ONLY() -DO_STATIC_COMPILATION() -DEFINE("FLAT") -ADDITIONAL_INFO(overlay_edit_mesh_edge_no_geom) -GPU_SHADER_CREATE_END() + .metal_backend_only(true) + .do_static_compilation(true) + .define("FLAT") + .additional_info("overlay_edit_mesh_edge_no_geom"); #endif GPU_SHADER_CREATE_INFO(overlay_edit_mesh_face) -DO_STATIC_COMPILATION() -DEFINE("FACE") -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, UVEC4, data) -VERTEX_SOURCE("overlay_edit_mesh_vert.glsl") -VERTEX_OUT(overlay_edit_flat_color_iface) -FRAGMENT_SOURCE("overlay_varying_color.glsl") -ADDITIONAL_INFO(draw_modelmat) -ADDITIONAL_INFO(overlay_edit_mesh_common) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("FACE") + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::UVEC4, "data") + .vertex_source("overlay_edit_mesh_vert.glsl") + .vertex_out(overlay_edit_flat_color_iface) + .fragment_source("overlay_varying_color.glsl") + .additional_info("draw_modelmat") + .additional_info("overlay_edit_mesh_common"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_face_next) -DO_STATIC_COMPILATION() -DEFINE("FACE") -DEFINE_VALUE("vnor", "vec3(0.0)") -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, UVEC4, data) -VERTEX_SOURCE("overlay_edit_mesh_face_vert.glsl") -VERTEX_OUT(overlay_edit_flat_color_iface) -FRAGMENT_SOURCE("overlay_varying_color.glsl") -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_modelmat_new) -ADDITIONAL_INFO(draw_resource_handle_new) -ADDITIONAL_INFO(overlay_edit_mesh_common) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("FACE") + .define("vnor", "vec3(0.0)") + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::UVEC4, "data") + .vertex_source("overlay_edit_mesh_face_vert.glsl") + .vertex_out(overlay_edit_flat_color_iface) + .fragment_source("overlay_varying_color.glsl") + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new") + .additional_info("overlay_edit_mesh_common"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_facedot) -DO_STATIC_COMPILATION() -DEFINE("FACEDOT") -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, UVEC4, data) -VERTEX_IN(2, VEC4, norAndFlag) -DEFINE_VALUE("vnor", "norAndFlag.xyz") -VERTEX_SOURCE("overlay_edit_mesh_vert.glsl") -VERTEX_OUT(overlay_edit_flat_color_iface) -FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") -ADDITIONAL_INFO(draw_modelmat) -ADDITIONAL_INFO(overlay_edit_mesh_common) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("FACEDOT") + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::UVEC4, "data") + .vertex_in(2, Type::VEC4, "norAndFlag") + .define("vnor", "norAndFlag.xyz") + .vertex_source("overlay_edit_mesh_vert.glsl") + .vertex_out(overlay_edit_flat_color_iface) + .fragment_source("overlay_point_varying_color_frag.glsl") + .additional_info("draw_modelmat") + .additional_info("overlay_edit_mesh_common"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_facedot_next) -DO_STATIC_COMPILATION() -DEFINE("FACEDOT") -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, UVEC4, data) -VERTEX_IN(2, VEC4, norAndFlag) -DEFINE_VALUE("vnor", "norAndFlag.xyz") -VERTEX_SOURCE("overlay_edit_mesh_facedot_vert.glsl") -VERTEX_OUT(overlay_edit_flat_color_iface) -FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_modelmat_new) -ADDITIONAL_INFO(draw_resource_handle_new) -ADDITIONAL_INFO(overlay_edit_mesh_common) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("FACEDOT") + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::UVEC4, "data") + .vertex_in(2, Type::VEC4, "norAndFlag") + .define("vnor", "norAndFlag.xyz") + .vertex_source("overlay_edit_mesh_facedot_vert.glsl") + .vertex_out(overlay_edit_flat_color_iface) + .fragment_source("overlay_point_varying_color_frag.glsl") + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new") + .additional_info("overlay_edit_mesh_common"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_normal) -DO_STATIC_COMPILATION() -DEFINE("WORKAROUND_INDEX_LOAD_INCLUDE") -/* WORKAROUND: Needed to support OpenSubdiv vertex format. Should be removed. */ -PUSH_CONSTANT(IVEC2, gpu_attr_0) -PUSH_CONSTANT(IVEC2, gpu_attr_1) -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, VEC4, lnor) -VERTEX_IN(2, VEC4, vnor) -VERTEX_IN(3, VEC4, norAndFlag) -SAMPLER(0, DEPTH_2D, depthTex) -PUSH_CONSTANT(FLOAT, normalSize) -PUSH_CONSTANT(FLOAT, normalScreenSize) -PUSH_CONSTANT(FLOAT, alpha) -PUSH_CONSTANT(BOOL, isConstantScreenSizeNormals) -VERTEX_OUT(overlay_edit_flat_color_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_edit_mesh_normal_vert.glsl") -FRAGMENT_SOURCE("overlay_varying_color.glsl") -ADDITIONAL_INFO(draw_modelmat_instanced_attr) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("WORKAROUND_INDEX_LOAD_INCLUDE") + /* WORKAROUND: Needed to support OpenSubdiv vertex format. Should be removed. */ + .push_constant(Type::IVEC2, "gpu_attr_0") + .push_constant(Type::IVEC2, "gpu_attr_1") + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC4, "lnor") + .vertex_in(2, Type::VEC4, "vnor") + .vertex_in(3, Type::VEC4, "norAndFlag") + .sampler(0, ImageType::DEPTH_2D, "depthTex") + .push_constant(Type::FLOAT, "normalSize") + .push_constant(Type::FLOAT, "normalScreenSize") + .push_constant(Type::FLOAT, "alpha") + .push_constant(Type::BOOL, "isConstantScreenSizeNormals") + .vertex_out(overlay_edit_flat_color_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_edit_mesh_normal_vert.glsl") + .fragment_source("overlay_varying_color.glsl") + .additional_info("draw_modelmat_instanced_attr") + .additional_info("draw_globals"); -GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_analysis_iface) -SMOOTH(VEC4, weightColor) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_analysis_iface).smooth(Type::VEC4, "weightColor"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_analysis) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, FLOAT, weight) -SAMPLER(0, FLOAT_1D, weightTex) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_OUT(overlay_edit_mesh_analysis_iface) -VERTEX_SOURCE("overlay_edit_mesh_analysis_vert.glsl") -FRAGMENT_SOURCE("overlay_edit_mesh_analysis_frag.glsl") -ADDITIONAL_INFO(draw_modelmat) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::FLOAT, "weight") + .sampler(0, ImageType::FLOAT_1D, "weightTex") + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_out(overlay_edit_mesh_analysis_iface) + .vertex_source("overlay_edit_mesh_analysis_vert.glsl") + .fragment_source("overlay_edit_mesh_analysis_frag.glsl") + .additional_info("draw_modelmat"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_skin_root) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, FLOAT, size) -VERTEX_IN(2, VEC3, local_pos) -VERTEX_OUT(overlay_edit_flat_color_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_edit_mesh_skin_root_vert.glsl") -FRAGMENT_SOURCE("overlay_varying_color.glsl") -ADDITIONAL_INFO(draw_modelmat_instanced_attr) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::FLOAT, "size") + .vertex_in(2, Type::VEC3, "local_pos") + .vertex_out(overlay_edit_flat_color_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_edit_mesh_skin_root_vert.glsl") + .fragment_source("overlay_varying_color.glsl") + .additional_info("draw_modelmat_instanced_attr") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_vert_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_edit_mesh_vert) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_edit_mesh_vert") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_edit_mesh_edge) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_edit_mesh_edge") + .additional_info("drw_clipped"); #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_clipped_no_geom) -METAL_BACKEND_ONLY() -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_edit_mesh_edge_no_geom) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .metal_backend_only(true) + .do_static_compilation(true) + .additional_info("overlay_edit_mesh_edge_no_geom") + .additional_info("drw_clipped"); #endif GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_flat_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_edit_mesh_edge_flat) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_edit_mesh_edge_flat") + .additional_info("drw_clipped"); #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_flat_clipped_no_geom) -METAL_BACKEND_ONLY() -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_edit_mesh_edge_flat_no_geom) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .metal_backend_only(true) + .do_static_compilation(true) + .additional_info("overlay_edit_mesh_edge_flat_no_geom") + .additional_info("drw_clipped"); #endif GPU_SHADER_CREATE_INFO(overlay_edit_mesh_face_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_edit_mesh_face) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_edit_mesh_face") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_facedot_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_edit_mesh_facedot) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_edit_mesh_facedot") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_normal_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_edit_mesh_normal) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_edit_mesh_normal") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_analysis_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_edit_mesh_analysis) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_edit_mesh_analysis") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_edit_mesh_skin_root_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_edit_mesh_skin_root) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_edit_mesh_skin_root") + .additional_info("drw_clipped"); /** \} */ @@ -374,187 +334,166 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_uv_iface, geom_in) -SMOOTH(FLOAT, selectionFac) -GPU_SHADER_INTERFACE_END() + .smooth(Type::FLOAT, "selectionFac"); GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_uv_flat_iface, geom_flat_in) -FLAT(VEC2, stippleStart) -GPU_SHADER_INTERFACE_END() + .flat(Type::VEC2, "stippleStart"); GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_uv_noperspective_iface, geom_noperspective_in) -NO_PERSPECTIVE(VEC2, stipplePos) -GPU_SHADER_INTERFACE_END() + .no_perspective(Type::VEC2, "stipplePos"); GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_uv_geom_iface, geom_out) -SMOOTH(FLOAT, selectionFac) -GPU_SHADER_INTERFACE_END() + .smooth(Type::FLOAT, "selectionFac"); GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_uv_geom_flat_iface, geom_flat_out) -FLAT(VEC2, stippleStart) -GPU_SHADER_INTERFACE_END() + .flat(Type::VEC2, "stippleStart"); GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_uv_geom_noperspective_iface, geom_noperspective_out) -NO_PERSPECTIVE(FLOAT, edgeCoord) -NO_PERSPECTIVE(VEC2, stipplePos) -GPU_SHADER_INTERFACE_END() + .no_perspective(Type::FLOAT, "edgeCoord") + .no_perspective(Type::VEC2, "stipplePos"); GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges_common) -VERTEX_IN(0, VEC2, au) -VERTEX_IN(1, INT, flag) -PUSH_CONSTANT(INT, lineStyle) -PUSH_CONSTANT(BOOL, doSmoothWire) -PUSH_CONSTANT(FLOAT, alpha) -PUSH_CONSTANT(FLOAT, dashLength) -FRAGMENT_OUT(0, VEC4, fragColor) -FRAGMENT_SOURCE("overlay_edit_uv_edges_frag.glsl") -ADDITIONAL_INFO(draw_mesh) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC2, "au") + .vertex_in(1, Type::INT, "flag") + .push_constant(Type::INT, "lineStyle") + .push_constant(Type::BOOL, "doSmoothWire") + .push_constant(Type::FLOAT, "alpha") + .push_constant(Type::FLOAT, "dashLength") + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_source("overlay_edit_uv_edges_frag.glsl") + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges) -ADDITIONAL_INFO(overlay_edit_uv_edges_common) -DO_STATIC_COMPILATION() -VERTEX_OUT(overlay_edit_uv_iface) -VERTEX_OUT(overlay_edit_uv_flat_iface) -VERTEX_OUT(overlay_edit_uv_noperspective_iface) -GEOMETRY_LAYOUT(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) -GEOMETRY_OUT(overlay_edit_uv_geom_iface) -GEOMETRY_OUT(overlay_edit_uv_geom_flat_iface) -GEOMETRY_OUT(overlay_edit_uv_geom_noperspective_iface) -VERTEX_SOURCE("overlay_edit_uv_edges_vert.glsl") -GEOMETRY_SOURCE("overlay_edit_uv_edges_geom.glsl") -GPU_SHADER_CREATE_END() + .additional_info("overlay_edit_uv_edges_common") + .do_static_compilation(true) + .vertex_out(overlay_edit_uv_iface) + .vertex_out(overlay_edit_uv_flat_iface) + .vertex_out(overlay_edit_uv_noperspective_iface) + .geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) + .geometry_out(overlay_edit_uv_geom_iface) + .geometry_out(overlay_edit_uv_geom_flat_iface) + .geometry_out(overlay_edit_uv_geom_noperspective_iface) + .vertex_source("overlay_edit_uv_edges_vert.glsl") + .geometry_source("overlay_edit_uv_edges_geom.glsl"); #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges_no_geom) -METAL_BACKEND_ONLY() -ADDITIONAL_INFO(overlay_edit_uv_edges_common) -DO_STATIC_COMPILATION() -VERTEX_OUT(overlay_edit_uv_geom_iface) -VERTEX_OUT(overlay_edit_uv_geom_flat_iface) -VERTEX_OUT(overlay_edit_uv_geom_noperspective_iface) -VERTEX_SOURCE("overlay_edit_uv_edges_vert_no_geom.glsl") -GPU_SHADER_CREATE_END() + .metal_backend_only(true) + .additional_info("overlay_edit_uv_edges_common") + .do_static_compilation(true) + .vertex_out(overlay_edit_uv_geom_iface) + .vertex_out(overlay_edit_uv_geom_flat_iface) + .vertex_out(overlay_edit_uv_geom_noperspective_iface) + .vertex_source("overlay_edit_uv_edges_vert_no_geom.glsl"); #endif GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges_select) -DO_STATIC_COMPILATION() -DEFINE("USE_EDGE_SELECT") -ADDITIONAL_INFO(overlay_edit_uv_edges) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("USE_EDGE_SELECT") + .additional_info("overlay_edit_uv_edges"); GPU_SHADER_INTERFACE_INFO(overlay_edit_uv_next_iface) -SMOOTH(FLOAT, selectionFac) -FLAT(VEC2, stippleStart) -NO_PERSPECTIVE(FLOAT, edgeCoord) -NO_PERSPECTIVE(VEC2, stipplePos) -GPU_SHADER_INTERFACE_END() + .smooth(Type::FLOAT, "selectionFac") + .flat(Type::VEC2, "stippleStart") + .no_perspective(Type::FLOAT, "edgeCoord") + .no_perspective(Type::VEC2, "stipplePos"); GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges_next) -DO_STATIC_COMPILATION() -STORAGE_BUF_FREQ(0, READ, float, au[], GEOMETRY) -STORAGE_BUF_FREQ(1, READ, uint, data[], GEOMETRY) -PUSH_CONSTANT(IVEC2, gpu_attr_0) -PUSH_CONSTANT(IVEC2, gpu_attr_1) -PUSH_CONSTANT(INT, lineStyle) -PUSH_CONSTANT(BOOL, doSmoothWire) -PUSH_CONSTANT(FLOAT, alpha) -PUSH_CONSTANT(FLOAT, dashLength) -SPECIALIZATION_CONSTANT(BOOL, use_edge_select, false) -VERTEX_OUT(overlay_edit_uv_next_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_edit_uv_edges_next_vert.glsl") -FRAGMENT_SOURCE("overlay_edit_uv_edges_next_frag.glsl") -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_modelmat_new) -ADDITIONAL_INFO(draw_resource_handle_new) -ADDITIONAL_INFO(gpu_index_load) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .storage_buf(0, Qualifier::READ, "float", "au[]", Frequency::GEOMETRY) + .storage_buf(1, Qualifier::READ, "uint", "data[]", Frequency::GEOMETRY) + .push_constant(Type::IVEC2, "gpu_attr_0") + .push_constant(Type::IVEC2, "gpu_attr_1") + .push_constant(Type::INT, "lineStyle") + .push_constant(Type::BOOL, "doSmoothWire") + .push_constant(Type::FLOAT, "alpha") + .push_constant(Type::FLOAT, "dashLength") + .specialization_constant(Type::BOOL, "use_edge_select", false) + .vertex_out(overlay_edit_uv_next_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_edit_uv_edges_next_vert.glsl") + .fragment_source("overlay_edit_uv_edges_next_frag.glsl") + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new") + .additional_info("gpu_index_load") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_uv_faces) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC2, au) -VERTEX_IN(1, UINT, flag) -PUSH_CONSTANT(FLOAT, uvOpacity) -VERTEX_OUT(overlay_edit_flat_color_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_edit_uv_faces_vert.glsl") -FRAGMENT_SOURCE("overlay_varying_color.glsl") -ADDITIONAL_INFO(draw_mesh) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC2, "au") + .vertex_in(1, Type::UINT, "flag") + .push_constant(Type::FLOAT, "uvOpacity") + .vertex_out(overlay_edit_flat_color_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_edit_uv_faces_vert.glsl") + .fragment_source("overlay_varying_color.glsl") + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_uv_face_dots) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC2, au) -VERTEX_IN(1, UINT, flag) -PUSH_CONSTANT(FLOAT, pointSize) -VERTEX_OUT(overlay_edit_flat_color_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_edit_uv_face_dots_vert.glsl") -FRAGMENT_SOURCE("overlay_varying_color.glsl") -ADDITIONAL_INFO(draw_mesh) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC2, "au") + .vertex_in(1, Type::UINT, "flag") + .push_constant(Type::FLOAT, "pointSize") + .vertex_out(overlay_edit_flat_color_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_edit_uv_face_dots_vert.glsl") + .fragment_source("overlay_varying_color.glsl") + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_INTERFACE_INFO(overlay_edit_uv_vert_iface) -SMOOTH(VEC4, fillColor) -SMOOTH(VEC4, outlineColor) -SMOOTH(VEC4, radii) -GPU_SHADER_INTERFACE_END() + .smooth(Type::VEC4, "fillColor") + .smooth(Type::VEC4, "outlineColor") + .smooth(Type::VEC4, "radii"); GPU_SHADER_CREATE_INFO(overlay_edit_uv_verts) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC2, au) -VERTEX_IN(1, UINT, flag) -PUSH_CONSTANT(FLOAT, pointSize) -PUSH_CONSTANT(FLOAT, outlineWidth) -PUSH_CONSTANT(VEC4, color) -VERTEX_OUT(overlay_edit_uv_vert_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_edit_uv_verts_vert.glsl") -FRAGMENT_SOURCE("overlay_edit_uv_verts_frag.glsl") -ADDITIONAL_INFO(draw_mesh) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC2, "au") + .vertex_in(1, Type::UINT, "flag") + .push_constant(Type::FLOAT, "pointSize") + .push_constant(Type::FLOAT, "outlineWidth") + .push_constant(Type::VEC4, "color") + .vertex_out(overlay_edit_uv_vert_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_edit_uv_verts_vert.glsl") + .fragment_source("overlay_edit_uv_verts_frag.glsl") + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_uv_tiled_image_borders) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -PUSH_CONSTANT(VEC4, ucolor) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_edit_uv_tiled_image_borders_vert.glsl") -FRAGMENT_SOURCE("overlay_uniform_color_frag.glsl") -ADDITIONAL_INFO(draw_mesh) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .push_constant(Type::VEC4, "ucolor") + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_edit_uv_tiled_image_borders_vert.glsl") + .fragment_source("overlay_uniform_color_frag.glsl") + .additional_info("draw_mesh"); -GPU_SHADER_INTERFACE_INFO(edit_uv_image_iface) -SMOOTH(VEC2, uvs) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_INTERFACE_INFO(edit_uv_image_iface).smooth(Type::VEC2, "uvs"); GPU_SHADER_CREATE_INFO(overlay_edit_uv_stencil_image) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -VERTEX_OUT(edit_uv_image_iface) -VERTEX_SOURCE("overlay_edit_uv_image_vert.glsl") -SAMPLER(0, FLOAT_2D, imgTexture) -PUSH_CONSTANT(BOOL, imgPremultiplied) -PUSH_CONSTANT(BOOL, imgAlphaBlend) -PUSH_CONSTANT(VEC4, ucolor) -FRAGMENT_OUT(0, VEC4, fragColor) -FRAGMENT_SOURCE("overlay_image_frag.glsl") -ADDITIONAL_INFO(draw_mesh) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_out(edit_uv_image_iface) + .vertex_source("overlay_edit_uv_image_vert.glsl") + .sampler(0, ImageType::FLOAT_2D, "imgTexture") + .push_constant(Type::BOOL, "imgPremultiplied") + .push_constant(Type::BOOL, "imgAlphaBlend") + .push_constant(Type::VEC4, "ucolor") + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_source("overlay_image_frag.glsl") + .additional_info("draw_mesh"); GPU_SHADER_CREATE_INFO(overlay_edit_uv_mask_image) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -VERTEX_OUT(edit_uv_image_iface) -SAMPLER(0, FLOAT_2D, imgTexture) -PUSH_CONSTANT(VEC4, color) -PUSH_CONSTANT(FLOAT, opacity) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_edit_uv_image_vert.glsl") -FRAGMENT_SOURCE("overlay_edit_uv_image_mask_frag.glsl") -ADDITIONAL_INFO(draw_mesh) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_out(edit_uv_image_iface) + .sampler(0, ImageType::FLOAT_2D, "imgTexture") + .push_constant(Type::VEC4, "color") + .push_constant(Type::FLOAT, "opacity") + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_edit_uv_image_vert.glsl") + .fragment_source("overlay_edit_uv_image_mask_frag.glsl") + .additional_info("draw_mesh"); /** \} */ @@ -563,34 +502,31 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(overlay_edit_uv_stretching) -VERTEX_IN(0, VEC2, pos) -PUSH_CONSTANT(VEC2, aspect) -PUSH_CONSTANT(FLOAT, stretch_opacity) -VERTEX_OUT(overlay_edit_nopersp_color_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_edit_uv_stretching_vert.glsl") -FRAGMENT_SOURCE("overlay_varying_color.glsl") -PUSH_CONSTANT(FLOAT, totalAreaRatio) -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC2, "pos") + .push_constant(Type::VEC2, "aspect") + .push_constant(Type::FLOAT, "stretch_opacity") + .vertex_out(overlay_edit_nopersp_color_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_edit_uv_stretching_vert.glsl") + .fragment_source("overlay_varying_color.glsl") + .push_constant(Type::FLOAT, "totalAreaRatio"); GPU_SHADER_CREATE_INFO(overlay_edit_uv_stretching_area) -DO_STATIC_COMPILATION() -VERTEX_IN(1, FLOAT, ratio) -PUSH_CONSTANT(FLOAT, totalAreaRatio) -ADDITIONAL_INFO(overlay_edit_uv_stretching) -ADDITIONAL_INFO(draw_mesh) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(1, Type::FLOAT, "ratio") + .push_constant(Type::FLOAT, "totalAreaRatio") + .additional_info("overlay_edit_uv_stretching") + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_uv_stretching_angle) -DO_STATIC_COMPILATION() -DEFINE("STRETCH_ANGLE") -VERTEX_IN(1, VEC2, uv_angles) -VERTEX_IN(2, FLOAT, angle) -ADDITIONAL_INFO(overlay_edit_uv_stretching) -ADDITIONAL_INFO(draw_mesh) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("STRETCH_ANGLE") + .vertex_in(1, Type::VEC2, "uv_angles") + .vertex_in(2, Type::FLOAT, "angle") + .additional_info("overlay_edit_uv_stretching") + .additional_info("draw_mesh") + .additional_info("draw_globals"); /** \} */ @@ -598,148 +534,136 @@ GPU_SHADER_CREATE_END() /** \name Edit Curve * \{ */ -GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_curve_handle_iface, vert) -FLAT(UINT, flag) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_curve_handle_iface, vert).flat(Type::UINT, "flag"); GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle) -DO_STATIC_COMPILATION() -TYPEDEF_SOURCE("overlay_shader_shared.h") -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, UINT, data) -VERTEX_OUT(overlay_edit_curve_handle_iface) -GEOMETRY_LAYOUT(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 10) -GEOMETRY_OUT(overlay_edit_smooth_color_iface) -PUSH_CONSTANT(BOOL, showCurveHandles) -PUSH_CONSTANT(INT, curveHandleDisplay) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_edit_curve_handle_vert.glsl") -GEOMETRY_SOURCE("overlay_edit_curve_handle_geom.glsl") -FRAGMENT_SOURCE("overlay_varying_color.glsl") -ADDITIONAL_INFO(draw_mesh) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .typedef_source("overlay_shader_shared.h") + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::UINT, "data") + .vertex_out(overlay_edit_curve_handle_iface) + .geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 10) + .geometry_out(overlay_edit_smooth_color_iface) + .push_constant(Type::BOOL, "showCurveHandles") + .push_constant(Type::INT, "curveHandleDisplay") + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_edit_curve_handle_vert.glsl") + .geometry_source("overlay_edit_curve_handle_geom.glsl") + .fragment_source("overlay_varying_color.glsl") + .additional_info("draw_mesh") + .additional_info("draw_globals"); #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_no_geom) -METAL_BACKEND_ONLY() -DO_STATIC_COMPILATION() -TYPEDEF_SOURCE("overlay_shader_shared.h") -/* NOTE: Color already in Linear space. Which is what we want. */ -DEFINE_VALUE("srgbTarget", "false") -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, UINT, data) -VERTEX_OUT(overlay_edit_smooth_color_iface) -PUSH_CONSTANT(BOOL, showCurveHandles) -PUSH_CONSTANT(INT, curveHandleDisplay) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_edit_curve_handle_vert_no_geom.glsl") -FRAGMENT_SOURCE("overlay_varying_color.glsl") -ADDITIONAL_INFO(draw_mesh) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .metal_backend_only(true) + .do_static_compilation(true) + .typedef_source("overlay_shader_shared.h") + /* NOTE: Color already in Linear space. Which is what we want. */ + .define("srgbTarget", "false") + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::UINT, "data") + .vertex_out(overlay_edit_smooth_color_iface) + .push_constant(Type::BOOL, "showCurveHandles") + .push_constant(Type::INT, "curveHandleDisplay") + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_edit_curve_handle_vert_no_geom.glsl") + .fragment_source("overlay_varying_color.glsl") + .additional_info("draw_mesh") + .additional_info("draw_globals"); #endif GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_next) -DO_STATIC_COMPILATION() -TYPEDEF_SOURCE("overlay_shader_shared.h") -STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY) -STORAGE_BUF_FREQ(1, READ, uint, data[], GEOMETRY) -PUSH_CONSTANT(IVEC2, gpu_attr_0) -PUSH_CONSTANT(IVEC2, gpu_attr_1) -VERTEX_OUT(overlay_edit_smooth_color_iface) -PUSH_CONSTANT(BOOL, showCurveHandles) -PUSH_CONSTANT(INT, curveHandleDisplay) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_edit_curve_handle_next_vert.glsl") -FRAGMENT_SOURCE("overlay_varying_color.glsl") -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_modelmat_new) -ADDITIONAL_INFO(draw_resource_handle_new) -ADDITIONAL_INFO(gpu_index_load) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .typedef_source("overlay_shader_shared.h") + .storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY) + .storage_buf(1, Qualifier::READ, "uint", "data[]", Frequency::GEOMETRY) + .push_constant(Type::IVEC2, "gpu_attr_0") + .push_constant(Type::IVEC2, "gpu_attr_1") + .vertex_out(overlay_edit_smooth_color_iface) + .push_constant(Type::BOOL, "showCurveHandles") + .push_constant(Type::INT, "curveHandleDisplay") + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_edit_curve_handle_next_vert.glsl") + .fragment_source("overlay_varying_color.glsl") + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new") + .additional_info("gpu_index_load") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_edit_curve_handle) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_edit_curve_handle") + .additional_info("drw_clipped"); #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_clipped_no_geom) -METAL_BACKEND_ONLY() -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_edit_curve_handle_no_geom) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .metal_backend_only(true) + .do_static_compilation(true) + .additional_info("overlay_edit_curve_handle_no_geom") + .additional_info("drw_clipped"); #endif GPU_SHADER_CREATE_INFO(overlay_edit_curve_point) -DO_STATIC_COMPILATION() -TYPEDEF_SOURCE("overlay_shader_shared.h") -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, UINT, data) -VERTEX_OUT(overlay_edit_flat_color_iface) -PUSH_CONSTANT(BOOL, showCurveHandles) -PUSH_CONSTANT(INT, curveHandleDisplay) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_edit_curve_point_vert.glsl") -FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") -ADDITIONAL_INFO(draw_mesh) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .typedef_source("overlay_shader_shared.h") + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::UINT, "data") + .vertex_out(overlay_edit_flat_color_iface) + .push_constant(Type::BOOL, "showCurveHandles") + .push_constant(Type::INT, "curveHandleDisplay") + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_edit_curve_point_vert.glsl") + .fragment_source("overlay_point_varying_color_frag.glsl") + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_curve_point_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_edit_curve_point) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_edit_curve_point") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_edit_curve_wire) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, VEC3, nor) -VERTEX_IN(2, VEC3, tan) -VERTEX_IN(3, FLOAT, rad) -PUSH_CONSTANT(FLOAT, normalSize) -VERTEX_OUT(overlay_edit_flat_color_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_edit_curve_wire_vert.glsl") -FRAGMENT_SOURCE("overlay_varying_color.glsl") -ADDITIONAL_INFO(draw_modelmat) -ADDITIONAL_INFO(draw_resource_id_uniform) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC3, "nor") + .vertex_in(2, Type::VEC3, "tan") + .vertex_in(3, Type::FLOAT, "rad") + .push_constant(Type::FLOAT, "normalSize") + .vertex_out(overlay_edit_flat_color_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_edit_curve_wire_vert.glsl") + .fragment_source("overlay_varying_color.glsl") + .additional_info("draw_modelmat") + .additional_info("draw_resource_id_uniform") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_curve_wire_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_edit_curve_wire) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_edit_curve_wire") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_edit_curve_normals) -DO_STATIC_COMPILATION() -STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY) -STORAGE_BUF_FREQ(1, READ, float, rad[], GEOMETRY) -STORAGE_BUF_FREQ(2, READ, uint, nor[], GEOMETRY) -STORAGE_BUF_FREQ(3, READ, uint, tan[], GEOMETRY) -PUSH_CONSTANT(IVEC2, gpu_attr_0) -PUSH_CONSTANT(IVEC2, gpu_attr_1) -PUSH_CONSTANT(IVEC2, gpu_attr_2) -PUSH_CONSTANT(IVEC2, gpu_attr_3) -PUSH_CONSTANT(FLOAT, normalSize) -PUSH_CONSTANT(BOOL, use_hq_normals) -VERTEX_OUT(overlay_edit_flat_color_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_edit_curve_wire_next_vert.glsl") -FRAGMENT_SOURCE("overlay_varying_color.glsl") -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_modelmat_new) -ADDITIONAL_INFO(draw_resource_handle_new) -ADDITIONAL_INFO(gpu_index_load) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY) + .storage_buf(1, Qualifier::READ, "float", "rad[]", Frequency::GEOMETRY) + .storage_buf(2, Qualifier::READ, "uint", "nor[]", Frequency::GEOMETRY) + .storage_buf(3, Qualifier::READ, "uint", "tan[]", Frequency::GEOMETRY) + .push_constant(Type::IVEC2, "gpu_attr_0") + .push_constant(Type::IVEC2, "gpu_attr_1") + .push_constant(Type::IVEC2, "gpu_attr_2") + .push_constant(Type::IVEC2, "gpu_attr_3") + .push_constant(Type::FLOAT, "normalSize") + .push_constant(Type::BOOL, "use_hq_normals") + .vertex_out(overlay_edit_flat_color_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_edit_curve_wire_next_vert.glsl") + .fragment_source("overlay_varying_color.glsl") + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new") + .additional_info("gpu_index_load") + .additional_info("draw_globals"); /** \} */ @@ -748,30 +672,27 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_INTERFACE_INFO(overlay_edit_curves_handle_iface) -SMOOTH(VEC4, finalColor) -SMOOTH(VEC4, leftColor) -GPU_SHADER_INTERFACE_END() + .smooth(Type::VEC4, "finalColor") + .smooth(Type::VEC4, "leftColor"); GPU_SHADER_CREATE_INFO(overlay_edit_curves_handle) -DO_STATIC_COMPILATION() -TYPEDEF_SOURCE("overlay_shader_shared.h") -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, UINT, data) -VERTEX_IN(2, FLOAT, selection) -VERTEX_OUT(overlay_edit_curves_handle_iface) -UNIFORM_BUF(0, int, curvesInfoBlock[4]) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_edit_curves_handle_vert.glsl") -FRAGMENT_SOURCE("overlay_edit_curves_handle_frag.glsl") -ADDITIONAL_INFO(draw_mesh) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .typedef_source("overlay_shader_shared.h") + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::UINT, "data") + .vertex_in(2, Type::FLOAT, "selection") + .vertex_out(overlay_edit_curves_handle_iface) + .uniform_buf(0, "int", "curvesInfoBlock[4]") + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_edit_curves_handle_vert.glsl") + .fragment_source("overlay_edit_curves_handle_frag.glsl") + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_curves_handle_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_edit_curves_handle) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_edit_curves_handle") + .additional_info("drw_clipped"); /** \} */ @@ -780,41 +701,37 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(overlay_edit_lattice_point) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, UINT, data) -VERTEX_OUT(overlay_edit_flat_color_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_edit_lattice_point_vert.glsl") -FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") -ADDITIONAL_INFO(draw_mesh) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::UINT, "data") + .vertex_out(overlay_edit_flat_color_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_edit_lattice_point_vert.glsl") + .fragment_source("overlay_point_varying_color_frag.glsl") + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_lattice_point_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_edit_lattice_point) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_edit_lattice_point") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_edit_lattice_wire) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, FLOAT, weight) -SAMPLER(0, FLOAT_1D, weightTex) -VERTEX_OUT(overlay_edit_smooth_color_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_edit_lattice_wire_vert.glsl") -FRAGMENT_SOURCE("overlay_varying_color.glsl") -ADDITIONAL_INFO(draw_mesh) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::FLOAT, "weight") + .sampler(0, ImageType::FLOAT_1D, "weightTex") + .vertex_out(overlay_edit_smooth_color_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_edit_lattice_wire_vert.glsl") + .fragment_source("overlay_varying_color.glsl") + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_lattice_wire_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_edit_lattice_wire) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_edit_lattice_wire") + .additional_info("drw_clipped"); /** \} */ @@ -823,46 +740,42 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(overlay_edit_particle_strand) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, FLOAT, selection) -SAMPLER(0, FLOAT_1D, weightTex) -PUSH_CONSTANT(BOOL, useWeight) -PUSH_CONSTANT(BOOL, useGreasePencil) -VERTEX_OUT(overlay_edit_smooth_color_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_edit_particle_strand_vert.glsl") -FRAGMENT_SOURCE("overlay_varying_color.glsl") -ADDITIONAL_INFO(draw_mesh) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::FLOAT, "selection") + .sampler(0, ImageType::FLOAT_1D, "weightTex") + .push_constant(Type::BOOL, "useWeight") + .push_constant(Type::BOOL, "useGreasePencil") + .vertex_out(overlay_edit_smooth_color_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_edit_particle_strand_vert.glsl") + .fragment_source("overlay_varying_color.glsl") + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_particle_strand_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_edit_particle_strand) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_edit_particle_strand") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_edit_particle_point) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, FLOAT, selection) -VERTEX_OUT(overlay_edit_flat_color_iface) -SAMPLER(0, FLOAT_1D, weightTex) -PUSH_CONSTANT(BOOL, useWeight) -PUSH_CONSTANT(BOOL, useGreasePencil) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_edit_particle_point_vert.glsl") -FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") -ADDITIONAL_INFO(draw_mesh) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::FLOAT, "selection") + .vertex_out(overlay_edit_flat_color_iface) + .sampler(0, ImageType::FLOAT_1D, "weightTex") + .push_constant(Type::BOOL, "useWeight") + .push_constant(Type::BOOL, "useGreasePencil") + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_edit_particle_point_vert.glsl") + .fragment_source("overlay_point_varying_color_frag.glsl") + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_particle_point_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_edit_particle_point) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_edit_particle_point") + .additional_info("drw_clipped"); /** \} */ @@ -871,73 +784,66 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(overlay_edit_gpencil) -TYPEDEF_SOURCE("overlay_shader_shared.h") -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, INT, ma) -VERTEX_IN(2, UINT, vflag) -VERTEX_IN(3, FLOAT, weight) -PUSH_CONSTANT(FLOAT, normalSize) -PUSH_CONSTANT(BOOL, doMultiframe) -PUSH_CONSTANT(BOOL, doStrokeEndpoints) -PUSH_CONSTANT(BOOL, hideSelect) -PUSH_CONSTANT(BOOL, doWeightColor) -PUSH_CONSTANT(FLOAT, gpEditOpacity) -PUSH_CONSTANT(VEC4, gpEditColor) -SAMPLER(0, FLOAT_1D, weightTex) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_edit_gpencil_vert.glsl") -ADDITIONAL_INFO(draw_mesh) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .typedef_source("overlay_shader_shared.h") + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::INT, "ma") + .vertex_in(2, Type::UINT, "vflag") + .vertex_in(3, Type::FLOAT, "weight") + .push_constant(Type::FLOAT, "normalSize") + .push_constant(Type::BOOL, "doMultiframe") + .push_constant(Type::BOOL, "doStrokeEndpoints") + .push_constant(Type::BOOL, "hideSelect") + .push_constant(Type::BOOL, "doWeightColor") + .push_constant(Type::FLOAT, "gpEditOpacity") + .push_constant(Type::VEC4, "gpEditColor") + .sampler(0, ImageType::FLOAT_1D, "weightTex") + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_edit_gpencil_vert.glsl") + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_wire) -DO_STATIC_COMPILATION() -VERTEX_OUT(overlay_edit_smooth_color_iface) -FRAGMENT_SOURCE("overlay_varying_color.glsl") -ADDITIONAL_INFO(overlay_edit_gpencil) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_out(overlay_edit_smooth_color_iface) + .fragment_source("overlay_varying_color.glsl") + .additional_info("overlay_edit_gpencil"); GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_wire_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_edit_gpencil_wire) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_edit_gpencil_wire") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_point) -DO_STATIC_COMPILATION() -DEFINE("USE_POINTS") -VERTEX_OUT(overlay_edit_flat_color_iface) -FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") -ADDITIONAL_INFO(overlay_edit_gpencil) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("USE_POINTS") + .vertex_out(overlay_edit_flat_color_iface) + .fragment_source("overlay_point_varying_color_frag.glsl") + .additional_info("overlay_edit_gpencil"); GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_point_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_edit_gpencil_point) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_edit_gpencil_point") + .additional_info("drw_clipped"); /* TODO(fclem): Refactor this to take list of point instead of drawing 1 point per drawcall. */ GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_guide_point) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, UINT, data) -VERTEX_OUT(overlay_edit_flat_color_iface) -PUSH_CONSTANT(VEC3, pPosition) -PUSH_CONSTANT(FLOAT, pSize) -PUSH_CONSTANT(VEC4, pColor) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_edit_gpencil_guide_vert.glsl") -FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") -ADDITIONAL_INFO(draw_mesh) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::UINT, "data") + .vertex_out(overlay_edit_flat_color_iface) + .push_constant(Type::VEC3, "pPosition") + .push_constant(Type::FLOAT, "pSize") + .push_constant(Type::VEC4, "pColor") + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_edit_gpencil_guide_vert.glsl") + .fragment_source("overlay_point_varying_color_frag.glsl") + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_guide_point_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_edit_gpencil_guide_point) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_edit_gpencil_guide_point") + .additional_info("drw_clipped"); /** \} */ @@ -948,92 +854,83 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(overlay_depth_only) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -VERTEX_SOURCE("overlay_depth_only_vert.glsl") -FRAGMENT_SOURCE("overlay_depth_only_frag.glsl") -ADDITIONAL_INFO(draw_mesh) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_source("overlay_depth_only_vert.glsl") + .fragment_source("overlay_depth_only_frag.glsl") + .additional_info("draw_mesh"); GPU_SHADER_CREATE_INFO(overlay_depth_only_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_depth_only) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_depth_only") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_depth_mesh) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -VERTEX_SOURCE("basic_depth_vert.glsl") -FRAGMENT_SOURCE("overlay_depth_only_frag.glsl") -ADDITIONAL_INFO(draw_globals) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_modelmat_new) -ADDITIONAL_INFO(draw_resource_handle_new) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_source("basic_depth_vert.glsl") + .fragment_source("overlay_depth_only_frag.glsl") + .additional_info("draw_globals") + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new"); GPU_SHADER_CREATE_INFO(overlay_depth_mesh_conservative) -DO_STATIC_COMPILATION() -STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY) -PUSH_CONSTANT(IVEC2, gpu_attr_0) -VERTEX_SOURCE("overlay_depth_only_mesh_conservative_vert.glsl") -FRAGMENT_SOURCE("overlay_depth_only_frag.glsl") -ADDITIONAL_INFO(draw_globals) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_modelmat_new) -ADDITIONAL_INFO(gpu_index_load) -ADDITIONAL_INFO(draw_resource_handle_new) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY) + .push_constant(Type::IVEC2, "gpu_attr_0") + .vertex_source("overlay_depth_only_mesh_conservative_vert.glsl") + .fragment_source("overlay_depth_only_frag.glsl") + .additional_info("draw_globals") + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("gpu_index_load") + .additional_info("draw_resource_handle_new"); GPU_SHADER_NAMED_INTERFACE_INFO(overlay_depth_only_gpencil_flat_iface, gp_interp_flat) -FLAT(VEC2, aspect) -FLAT(VEC4, sspos) -GPU_SHADER_INTERFACE_END() + .flat(Type::VEC2, "aspect") + .flat(Type::VEC4, "sspos"); GPU_SHADER_NAMED_INTERFACE_INFO(overlay_depth_only_gpencil_noperspective_iface, gp_interp_noperspective) -NO_PERSPECTIVE(VEC2, thickness) -NO_PERSPECTIVE(FLOAT, hardness) -GPU_SHADER_INTERFACE_END() + .no_perspective(Type::VEC2, "thickness") + .no_perspective(Type::FLOAT, "hardness"); GPU_SHADER_CREATE_INFO(overlay_depth_gpencil) -DO_STATIC_COMPILATION() -TYPEDEF_SOURCE("gpencil_shader_shared.h") -VERTEX_OUT(overlay_depth_only_gpencil_flat_iface) -VERTEX_OUT(overlay_depth_only_gpencil_noperspective_iface) -VERTEX_SOURCE("overlay_depth_only_gpencil_vert.glsl") -FRAGMENT_SOURCE("overlay_depth_only_gpencil_frag.glsl") -DEPTH_WRITE(DepthWrite::ANY) -PUSH_CONSTANT(BOOL, gpStrokeOrder3d) /* TODO(fclem): Move to a GPencil object UBO. */ -PUSH_CONSTANT(VEC4, gpDepthPlane) /* TODO(fclem): Move to a GPencil object UBO. */ -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_modelmat_new) -ADDITIONAL_INFO(draw_resource_handle_new) -ADDITIONAL_INFO(draw_globals) -ADDITIONAL_INFO(draw_gpencil_new) -ADDITIONAL_INFO(draw_object_infos_new) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .typedef_source("gpencil_shader_shared.h") + .vertex_out(overlay_depth_only_gpencil_flat_iface) + .vertex_out(overlay_depth_only_gpencil_noperspective_iface) + .vertex_source("overlay_depth_only_gpencil_vert.glsl") + .fragment_source("overlay_depth_only_gpencil_frag.glsl") + .depth_write(DepthWrite::ANY) + .push_constant(Type::BOOL, "gpStrokeOrder3d") /* TODO(fclem): Move to a GPencil object UBO. */ + .push_constant(Type::VEC4, "gpDepthPlane") /* TODO(fclem): Move to a GPencil object UBO. */ + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new") + .additional_info("draw_globals") + .additional_info("draw_gpencil_new") + .additional_info("draw_object_infos_new"); GPU_SHADER_CREATE_INFO(overlay_depth_pointcloud) -DO_STATIC_COMPILATION() -VERTEX_SOURCE("basic_depth_pointcloud_vert.glsl") -FRAGMENT_SOURCE("overlay_depth_only_frag.glsl") -ADDITIONAL_INFO(draw_pointcloud_new) -ADDITIONAL_INFO(draw_globals) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_modelmat_new) -ADDITIONAL_INFO(draw_resource_handle_new) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_source("basic_depth_pointcloud_vert.glsl") + .fragment_source("overlay_depth_only_frag.glsl") + .additional_info("draw_pointcloud_new") + .additional_info("draw_globals") + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new"); GPU_SHADER_CREATE_INFO(overlay_depth_curves) -DO_STATIC_COMPILATION() -VERTEX_SOURCE("basic_depth_curves_vert.glsl") -FRAGMENT_SOURCE("overlay_depth_only_frag.glsl") -ADDITIONAL_INFO(draw_hair_new) -ADDITIONAL_INFO(draw_globals) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_modelmat_new) -ADDITIONAL_INFO(draw_resource_handle_new) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_source("basic_depth_curves_vert.glsl") + .fragment_source("overlay_depth_only_frag.glsl") + .additional_info("draw_hair_new") + .additional_info("draw_globals") + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new"); /** \} */ @@ -1042,34 +939,30 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(overlay_uniform_color) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -PUSH_CONSTANT(VEC4, ucolor) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_depth_only_vert.glsl") -FRAGMENT_SOURCE("overlay_uniform_color_frag.glsl") -ADDITIONAL_INFO(draw_mesh) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .push_constant(Type::VEC4, "ucolor") + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_depth_only_vert.glsl") + .fragment_source("overlay_uniform_color_frag.glsl") + .additional_info("draw_mesh"); GPU_SHADER_CREATE_INFO(overlay_uniform_color_pointcloud) -DO_STATIC_COMPILATION() -PUSH_CONSTANT(VEC4, ucolor) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_pointcloud_only_vert.glsl") -FRAGMENT_SOURCE("overlay_uniform_color_frag.glsl") -ADDITIONAL_INFO(draw_pointcloud) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .push_constant(Type::VEC4, "ucolor") + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_pointcloud_only_vert.glsl") + .fragment_source("overlay_uniform_color_frag.glsl") + .additional_info("draw_pointcloud"); GPU_SHADER_CREATE_INFO(overlay_uniform_color_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_uniform_color) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_uniform_color") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_uniform_color_pointcloud_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_uniform_color_pointcloud) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_uniform_color_pointcloud") + .additional_info("drw_clipped"); /** \} */ diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_extra_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_extra_info.hh index 10fc6e4c416..bc7269ed9ea 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_extra_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_extra_info.hh @@ -9,45 +9,40 @@ * \{ */ GPU_SHADER_INTERFACE_INFO(overlay_extra_iface) -NO_PERSPECTIVE(VEC2, edgePos) -FLAT(VEC2, edgeStart) -FLAT(VEC4, finalColor) -GPU_SHADER_INTERFACE_END() + .no_perspective(Type::VEC2, "edgePos") + .flat(Type::VEC2, "edgeStart") + .flat(Type::VEC4, "finalColor"); GPU_SHADER_CREATE_INFO(overlay_extra) -DO_STATIC_COMPILATION() -TYPEDEF_SOURCE("overlay_shader_shared.h") -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, INT, vclass) -/* Instance attributes. */ -VERTEX_IN(2, VEC4, color) -VERTEX_IN(3, MAT4, inst_obmat) -VERTEX_OUT(overlay_extra_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -FRAGMENT_OUT(1, VEC4, lineOutput) -VERTEX_SOURCE("overlay_extra_vert.glsl") -FRAGMENT_SOURCE("overlay_extra_frag.glsl") -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .typedef_source("overlay_shader_shared.h") + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::INT, "vclass") + /* Instance attributes. */ + .vertex_in(2, Type::VEC4, "color") + .vertex_in(3, Type::MAT4, "inst_obmat") + .vertex_out(overlay_extra_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_out(1, Type::VEC4, "lineOutput") + .vertex_source("overlay_extra_vert.glsl") + .fragment_source("overlay_extra_frag.glsl") + .additional_info("draw_view") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_extra_select) -DO_STATIC_COMPILATION() -DEFINE("SELECT_EDGES") -ADDITIONAL_INFO(overlay_extra) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("SELECT_EDGES") + .additional_info("overlay_extra"); GPU_SHADER_CREATE_INFO(overlay_extra_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_extra) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_extra") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_extra_select_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_extra_select) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_extra_select") + .additional_info("drw_clipped"); /** \} */ @@ -55,28 +50,24 @@ GPU_SHADER_CREATE_END() /** \name Irradiance Grid * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_extra_grid_iface) -FLAT(VEC4, finalColor) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_INTERFACE_INFO(overlay_extra_grid_iface).flat(Type::VEC4, "finalColor"); GPU_SHADER_CREATE_INFO(overlay_extra_grid) -DO_STATIC_COMPILATION() -SAMPLER(0, DEPTH_2D, depthBuffer) -PUSH_CONSTANT(MAT4, gridModelMatrix) -PUSH_CONSTANT(BOOL, isTransform) -VERTEX_OUT(overlay_extra_grid_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_extra_lightprobe_grid_vert.glsl") -FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .sampler(0, ImageType::DEPTH_2D, "depthBuffer") + .push_constant(Type::MAT4, "gridModelMatrix") + .push_constant(Type::BOOL, "isTransform") + .vertex_out(overlay_extra_grid_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_extra_lightprobe_grid_vert.glsl") + .fragment_source("overlay_point_varying_color_frag.glsl") + .additional_info("draw_view") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_extra_grid_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_extra_grid) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_extra_grid") + .additional_info("drw_clipped"); /** \} */ @@ -85,24 +76,22 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(overlay_extra_groundline) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -/* Instance attributes. */ -VERTEX_IN(1, VEC3, inst_pos) -VERTEX_OUT(overlay_extra_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -FRAGMENT_OUT(1, VEC4, lineOutput) -VERTEX_SOURCE("overlay_extra_groundline_vert.glsl") -FRAGMENT_SOURCE("overlay_extra_frag.glsl") -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + /* Instance attributes. */ + .vertex_in(1, Type::VEC3, "inst_pos") + .vertex_out(overlay_extra_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_out(1, Type::VEC4, "lineOutput") + .vertex_source("overlay_extra_groundline_vert.glsl") + .fragment_source("overlay_extra_frag.glsl") + .additional_info("draw_view") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_extra_groundline_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_extra_groundline) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_extra_groundline") + .additional_info("drw_clipped"); /** \} */ @@ -111,55 +100,48 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_INTERFACE_INFO(overlay_extra_wire_iface) -NO_PERSPECTIVE(VEC2, stipple_coord) -FLAT(VEC2, stipple_start) -FLAT(VEC4, finalColor) -GPU_SHADER_INTERFACE_END() + .no_perspective(Type::VEC2, "stipple_coord") + .flat(Type::VEC2, "stipple_start") + .flat(Type::VEC4, "finalColor"); GPU_SHADER_CREATE_INFO(overlay_extra_wire) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, VEC4, color) -/* If colorid is equal to 0 (i.e: Not specified) use color attribute and stippling. */ -VERTEX_IN(2, INT, colorid) -VERTEX_OUT(overlay_extra_wire_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -FRAGMENT_OUT(1, VEC4, lineOutput) -VERTEX_SOURCE("overlay_extra_wire_vert.glsl") -FRAGMENT_SOURCE("overlay_extra_wire_frag.glsl") -ADDITIONAL_INFO(draw_modelmat) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC4, "color") + /* If colorid is equal to 0 (i.e: Not specified) use color attribute and stippling. */ + .vertex_in(2, Type::INT, "colorid") + .vertex_out(overlay_extra_wire_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_out(1, Type::VEC4, "lineOutput") + .vertex_source("overlay_extra_wire_vert.glsl") + .fragment_source("overlay_extra_wire_frag.glsl") + .additional_info("draw_modelmat") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_extra_wire_select) -DO_STATIC_COMPILATION() -DEFINE("SELECT_EDGES") -ADDITIONAL_INFO(overlay_extra_wire) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("SELECT_EDGES") + .additional_info("overlay_extra_wire"); GPU_SHADER_CREATE_INFO(overlay_extra_wire_object) -DO_STATIC_COMPILATION() -DEFINE("OBJECT_WIRE") -ADDITIONAL_INFO(overlay_extra_wire) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("OBJECT_WIRE") + .additional_info("overlay_extra_wire"); GPU_SHADER_CREATE_INFO(overlay_extra_wire_select_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_extra_wire_select) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_extra_wire_select") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_extra_wire_object_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_extra_wire_object) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_extra_wire_object") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_extra_wire_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_extra_wire) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_extra_wire") + .additional_info("drw_clipped"); /** \} */ @@ -168,53 +150,46 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_INTERFACE_INFO(overlay_extra_point_iface) -FLAT(VEC4, radii) -FLAT(VEC4, fillColor) -FLAT(VEC4, outlineColor) -GPU_SHADER_INTERFACE_END() + .flat(Type::VEC4, "radii") + .flat(Type::VEC4, "fillColor") + .flat(Type::VEC4, "outlineColor"); GPU_SHADER_CREATE_INFO(overlay_extra_point) -DO_STATIC_COMPILATION() -/* TODO(fclem): Move the vertex shader to Overlay engine and remove this bypass. */ -DEFINE_VALUE("blender_srgb_to_framebuffer_space(a)", "a") -VERTEX_IN(0, VEC3, pos) -PUSH_CONSTANT(VEC4, ucolor) -VERTEX_OUT(overlay_extra_point_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_extra_point_vert.glsl") -FRAGMENT_SOURCE("overlay_point_varying_color_varying_outline_aa_frag.glsl") -ADDITIONAL_INFO(draw_modelmat) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + /* TODO(fclem): Move the vertex shader to Overlay engine and remove this bypass. */ + .define("blender_srgb_to_framebuffer_space(a)", "a") + .vertex_in(0, Type::VEC3, "pos") + .push_constant(Type::VEC4, "ucolor") + .vertex_out(overlay_extra_point_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_extra_point_vert.glsl") + .fragment_source("overlay_point_varying_color_varying_outline_aa_frag.glsl") + .additional_info("draw_modelmat") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_extra_point_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_extra_point) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_extra_point") + .additional_info("drw_clipped"); -GPU_SHADER_INTERFACE_INFO(overlay_extra_loose_point_iface) -SMOOTH(VEC4, finalColor) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_INTERFACE_INFO(overlay_extra_loose_point_iface).smooth(Type::VEC4, "finalColor"); GPU_SHADER_CREATE_INFO(overlay_extra_loose_point) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, VEC4, vertex_color) -VERTEX_OUT(overlay_extra_loose_point_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -FRAGMENT_OUT(1, VEC4, lineOutput) -VERTEX_SOURCE("overlay_extra_loose_point_vert.glsl") -FRAGMENT_SOURCE("overlay_extra_loose_point_frag.glsl") -ADDITIONAL_INFO(draw_modelmat) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC4, "vertex_color") + .vertex_out(overlay_extra_loose_point_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_out(1, Type::VEC4, "lineOutput") + .vertex_source("overlay_extra_loose_point_vert.glsl") + .fragment_source("overlay_extra_loose_point_frag.glsl") + .additional_info("draw_modelmat") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_extra_loose_point_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_extra_loose_point) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_extra_loose_point") + .additional_info("drw_clipped"); /** \} */ @@ -223,109 +198,98 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_NAMED_INTERFACE_INFO(overlay_motion_path_line_iface, interp) -SMOOTH(VEC4, color) -GPU_SHADER_INTERFACE_END() + .smooth(Type::VEC4, "color"); GPU_SHADER_NAMED_INTERFACE_INFO(overlay_motion_path_line_flat_iface, interp_flat) -FLAT(VEC2, ss_pos) -GPU_SHADER_INTERFACE_END() + .flat(Type::VEC2, "ss_pos"); GPU_SHADER_CREATE_INFO(overlay_motion_path_line) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -PUSH_CONSTANT(IVEC4, mpathLineSettings) -PUSH_CONSTANT(BOOL, selected) -PUSH_CONSTANT(VEC3, customColorPre) -PUSH_CONSTANT(VEC3, customColorPost) -PUSH_CONSTANT(INT, lineThickness) /* In pixels. */ -PUSH_CONSTANT(MAT4, camera_space_matrix) -VERTEX_OUT(overlay_motion_path_line_iface) -VERTEX_OUT(overlay_motion_path_line_flat_iface) -GEOMETRY_OUT(overlay_motion_path_line_iface) -GEOMETRY_LAYOUT(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_motion_path_line_vert.glsl") -GEOMETRY_SOURCE("overlay_motion_path_line_geom.glsl") -FRAGMENT_SOURCE("overlay_motion_path_line_frag.glsl") -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .push_constant(Type::IVEC4, "mpathLineSettings") + .push_constant(Type::BOOL, "selected") + .push_constant(Type::VEC3, "customColorPre") + .push_constant(Type::VEC3, "customColorPost") + .push_constant(Type::INT, "lineThickness") /* In pixels. */ + .push_constant(Type::MAT4, "camera_space_matrix") + .vertex_out(overlay_motion_path_line_iface) + .vertex_out(overlay_motion_path_line_flat_iface) + .geometry_out(overlay_motion_path_line_iface) + .geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_motion_path_line_vert.glsl") + .geometry_source("overlay_motion_path_line_geom.glsl") + .fragment_source("overlay_motion_path_line_frag.glsl") + .additional_info("draw_view") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_motion_path_line_no_geom) -METAL_BACKEND_ONLY() -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -PUSH_CONSTANT(IVEC4, mpathLineSettings) -PUSH_CONSTANT(BOOL, selected) -PUSH_CONSTANT(VEC3, customColorPre) -PUSH_CONSTANT(VEC3, customColorPost) -PUSH_CONSTANT(INT, lineThickness) /* In pixels. */ -VERTEX_OUT(overlay_motion_path_line_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_motion_path_line_vert_no_geom.glsl") -FRAGMENT_SOURCE("overlay_motion_path_line_frag.glsl") -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .metal_backend_only(true) + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .push_constant(Type::IVEC4, "mpathLineSettings") + .push_constant(Type::BOOL, "selected") + .push_constant(Type::VEC3, "customColorPre") + .push_constant(Type::VEC3, "customColorPost") + .push_constant(Type::INT, "lineThickness") /* In pixels. */ + .vertex_out(overlay_motion_path_line_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_motion_path_line_vert_no_geom.glsl") + .fragment_source("overlay_motion_path_line_frag.glsl") + .additional_info("draw_view") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_motion_path_line_next) -DO_STATIC_COMPILATION() -STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY) -PUSH_CONSTANT(IVEC2, gpu_attr_0) -PUSH_CONSTANT(IVEC4, mpathLineSettings) -PUSH_CONSTANT(BOOL, selected) -PUSH_CONSTANT(VEC3, customColorPre) -PUSH_CONSTANT(VEC3, customColorPost) -PUSH_CONSTANT(INT, lineThickness) /* In pixels. */ -PUSH_CONSTANT(MAT4, camera_space_matrix) -VERTEX_OUT(overlay_motion_path_line_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_motion_path_line_next_vert.glsl") -FRAGMENT_SOURCE("overlay_motion_path_line_frag.glsl") -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(gpu_index_load) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY) + .push_constant(Type::IVEC2, "gpu_attr_0") + .push_constant(Type::IVEC4, "mpathLineSettings") + .push_constant(Type::BOOL, "selected") + .push_constant(Type::VEC3, "customColorPre") + .push_constant(Type::VEC3, "customColorPost") + .push_constant(Type::INT, "lineThickness") /* In pixels. */ + .push_constant(Type::MAT4, "camera_space_matrix") + .vertex_out(overlay_motion_path_line_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_motion_path_line_next_vert.glsl") + .fragment_source("overlay_motion_path_line_frag.glsl") + .additional_info("draw_view") + .additional_info("gpu_index_load") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_motion_path_line_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_motion_path_line) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_motion_path_line") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_motion_path_line_clipped_no_geom) -METAL_BACKEND_ONLY() -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_motion_path_line_no_geom) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .metal_backend_only(true) + .do_static_compilation(true) + .additional_info("overlay_motion_path_line_no_geom") + .additional_info("drw_clipped"); -GPU_SHADER_INTERFACE_INFO(overlay_motion_path_point_iface) -FLAT(VEC4, finalColor) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_INTERFACE_INFO(overlay_motion_path_point_iface).flat(Type::VEC4, "finalColor"); GPU_SHADER_CREATE_INFO(overlay_motion_path_point) -DO_STATIC_COMPILATION() -TYPEDEF_SOURCE("overlay_shader_shared.h") -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, INT, flag) -PUSH_CONSTANT(IVEC4, mpathPointSettings) -PUSH_CONSTANT(BOOL, showKeyFrames) -PUSH_CONSTANT(VEC3, customColorPre) -PUSH_CONSTANT(VEC3, customColorPost) -PUSH_CONSTANT(MAT4, camera_space_matrix) -VERTEX_OUT(overlay_motion_path_point_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_motion_path_point_vert.glsl") -FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .typedef_source("overlay_shader_shared.h") + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::INT, "flag") + .push_constant(Type::IVEC4, "mpathPointSettings") + .push_constant(Type::BOOL, "showKeyFrames") + .push_constant(Type::VEC3, "customColorPre") + .push_constant(Type::VEC3, "customColorPost") + .push_constant(Type::MAT4, "camera_space_matrix") + .vertex_out(overlay_motion_path_point_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_motion_path_point_vert.glsl") + .fragment_source("overlay_point_varying_color_frag.glsl") + .additional_info("draw_view") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_motion_path_point_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_motion_path_point) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_motion_path_point") + .additional_info("drw_clipped"); /** \} */ @@ -333,31 +297,27 @@ GPU_SHADER_CREATE_END() /** \name Image Empty * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_image_iface) -SMOOTH(VEC2, uvs) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_INTERFACE_INFO(overlay_image_iface).smooth(Type::VEC2, "uvs"); GPU_SHADER_CREATE_INFO(overlay_image) -DO_STATIC_COMPILATION() -PUSH_CONSTANT(BOOL, depthSet) -PUSH_CONSTANT(BOOL, isCameraBackground) -PUSH_CONSTANT(BOOL, imgPremultiplied) -PUSH_CONSTANT(BOOL, imgAlphaBlend) -PUSH_CONSTANT(VEC4, ucolor) -VERTEX_IN(0, VEC3, pos) -VERTEX_OUT(overlay_image_iface) -SAMPLER(0, FLOAT_2D, imgTexture) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_image_vert.glsl") -FRAGMENT_SOURCE("overlay_image_frag.glsl") -ADDITIONAL_INFO(draw_mesh) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .push_constant(Type::BOOL, "depthSet") + .push_constant(Type::BOOL, "isCameraBackground") + .push_constant(Type::BOOL, "imgPremultiplied") + .push_constant(Type::BOOL, "imgAlphaBlend") + .push_constant(Type::VEC4, "ucolor") + .vertex_in(0, Type::VEC3, "pos") + .vertex_out(overlay_image_iface) + .sampler(0, ImageType::FLOAT_2D, "imgTexture") + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_image_vert.glsl") + .fragment_source("overlay_image_frag.glsl") + .additional_info("draw_mesh"); GPU_SHADER_CREATE_INFO(overlay_image_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_image) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_image") + .additional_info("drw_clipped"); /** \} */ @@ -366,26 +326,24 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(overlay_gpencil_canvas) -DO_STATIC_COMPILATION() -VERTEX_OUT(overlay_extra_iface) -PUSH_CONSTANT(VEC4, color) -PUSH_CONSTANT(VEC3, xAxis) -PUSH_CONSTANT(VEC3, yAxis) -PUSH_CONSTANT(VEC3, origin) -PUSH_CONSTANT(INT, halfLineCount) -FRAGMENT_OUT(0, VEC4, fragColor) -FRAGMENT_OUT(1, VEC4, lineOutput) -VERTEX_SOURCE("overlay_edit_gpencil_canvas_vert.glsl") -FRAGMENT_SOURCE("overlay_extra_frag.glsl") -ADDITIONAL_INFO(draw_mesh) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_out(overlay_extra_iface) + .push_constant(Type::VEC4, "color") + .push_constant(Type::VEC3, "xAxis") + .push_constant(Type::VEC3, "yAxis") + .push_constant(Type::VEC3, "origin") + .push_constant(Type::INT, "halfLineCount") + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_out(1, Type::VEC4, "lineOutput") + .vertex_source("overlay_edit_gpencil_canvas_vert.glsl") + .fragment_source("overlay_extra_frag.glsl") + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_gpencil_canvas_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_gpencil_canvas) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_gpencil_canvas") + .additional_info("drw_clipped"); /** \} */ @@ -393,94 +351,85 @@ GPU_SHADER_CREATE_END() /** \name Particle * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_particle_iface) -FLAT(VEC4, finalColor) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_INTERFACE_INFO(overlay_particle_iface).flat(Type::VEC4, "finalColor"); GPU_SHADER_CREATE_INFO(overlay_particle) -SAMPLER(0, FLOAT_1D, weightTex) -PUSH_CONSTANT(VEC4, ucolor) /* Draw-size packed in alpha. */ -VERTEX_IN(0, VEC3, part_pos) -VERTEX_IN(1, VEC4, part_rot) -VERTEX_IN(2, FLOAT, part_val) -VERTEX_OUT(overlay_particle_iface) -VERTEX_SOURCE("overlay_particle_vert.glsl") -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .sampler(0, ImageType::FLOAT_1D, "weightTex") + .push_constant(Type::VEC4, "ucolor") /* Draw-size packed in alpha. */ + .vertex_in(0, Type::VEC3, "part_pos") + .vertex_in(1, Type::VEC4, "part_rot") + .vertex_in(2, Type::FLOAT, "part_val") + .vertex_out(overlay_particle_iface) + .vertex_source("overlay_particle_vert.glsl") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_particle_dot) -DO_STATIC_COMPILATION() -DEFINE("USE_DOTS") -DEFINE_VALUE("vclass", "0") -DEFINE_VALUE("pos", "vec3(0.0)") -FRAGMENT_OUT(0, VEC4, fragColor) -FRAGMENT_OUT(1, VEC4, lineOutput) -FRAGMENT_SOURCE("overlay_particle_frag.glsl") -ADDITIONAL_INFO(overlay_particle) -ADDITIONAL_INFO(draw_mesh) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("USE_DOTS") + .define("vclass", "0") + .define("pos", "vec3(0.0)") + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_out(1, Type::VEC4, "lineOutput") + .fragment_source("overlay_particle_frag.glsl") + .additional_info("overlay_particle") + .additional_info("draw_mesh"); GPU_SHADER_CREATE_INFO(overlay_particle_dot_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_particle_dot) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_particle_dot") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_particle_shape) -DO_STATIC_COMPILATION() -/* Instantiated Attrs. */ -VERTEX_IN(3, VEC3, pos) -VERTEX_IN(4, INT, vclass) -FRAGMENT_OUT(0, VEC4, fragColor) -FRAGMENT_SOURCE("overlay_varying_color.glsl") -ADDITIONAL_INFO(overlay_particle) -ADDITIONAL_INFO(draw_modelmat) -ADDITIONAL_INFO(draw_resource_id_uniform) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + /* Instantiated Attrs. */ + .vertex_in(3, Type::VEC3, "pos") + .vertex_in(4, Type::INT, "vclass") + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_source("overlay_varying_color.glsl") + .additional_info("overlay_particle") + .additional_info("draw_modelmat") + .additional_info("draw_resource_id_uniform"); GPU_SHADER_CREATE_INFO(overlay_particle_shape_next) -DO_STATIC_COMPILATION() -TYPEDEF_SOURCE("overlay_shader_shared.h") -SAMPLER(0, FLOAT_1D, weightTex) -PUSH_CONSTANT(VEC4, ucolor) /* Draw-size packed in alpha. */ -PUSH_CONSTANT(INT, shape_type) -/* Use first attribute to only bind one buffer. */ -STORAGE_BUF_FREQ(0, READ, ParticlePointData, part_pos[], GEOMETRY) -VERTEX_OUT(overlay_extra_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -FRAGMENT_OUT(1, VEC4, lineOutput) -VERTEX_SOURCE("overlay_particle_shape_vert.glsl") -FRAGMENT_SOURCE("overlay_particle_shape_frag.glsl") -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_modelmat_new) -ADDITIONAL_INFO(draw_resource_handle_new) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .typedef_source("overlay_shader_shared.h") + .sampler(0, ImageType::FLOAT_1D, "weightTex") + .push_constant(Type::VEC4, "ucolor") /* Draw-size packed in alpha. */ + .push_constant(Type::INT, "shape_type") + /* Use first attribute to only bind one buffer. */ + .storage_buf(0, Qualifier::READ, "ParticlePointData", "part_pos[]", Frequency::GEOMETRY) + .vertex_out(overlay_extra_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_out(1, Type::VEC4, "lineOutput") + .vertex_source("overlay_particle_shape_vert.glsl") + .fragment_source("overlay_particle_shape_frag.glsl") + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_particle_hair_next) -DO_STATIC_COMPILATION() -TYPEDEF_SOURCE("overlay_shader_shared.h") -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, VEC3, nor) -PUSH_CONSTANT(INT, colorType) -PUSH_CONSTANT(BOOL, isTransform) -PUSH_CONSTANT(BOOL, useColoring) -VERTEX_OUT(overlay_extra_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -FRAGMENT_OUT(1, VEC4, lineOutput) -VERTEX_SOURCE("overlay_particle_hair_vert.glsl") -FRAGMENT_SOURCE("overlay_particle_shape_frag.glsl") -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_modelmat_new) -ADDITIONAL_INFO(draw_object_infos_new) -ADDITIONAL_INFO(draw_resource_handle_new) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .typedef_source("overlay_shader_shared.h") + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC3, "nor") + .push_constant(Type::INT, "colorType") + .push_constant(Type::BOOL, "isTransform") + .push_constant(Type::BOOL, "useColoring") + .vertex_out(overlay_extra_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_out(1, Type::VEC4, "lineOutput") + .vertex_source("overlay_particle_hair_vert.glsl") + .fragment_source("overlay_particle_shape_frag.glsl") + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_object_infos_new") + .additional_info("draw_resource_handle_new") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_particle_shape_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_particle_shape) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_particle_shape") + .additional_info("drw_clipped"); /** \} */ diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_facing_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_facing_info.hh index 1b9188727df..a37d8d764ea 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_facing_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_facing_info.hh @@ -5,17 +5,15 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(overlay_facing) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -VERTEX_SOURCE("overlay_facing_vert.glsl") -FRAGMENT_SOURCE("overlay_facing_frag.glsl") -FRAGMENT_OUT(0, VEC4, fragColor) -ADDITIONAL_INFO(draw_mesh) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_source("overlay_facing_vert.glsl") + .fragment_source("overlay_facing_frag.glsl") + .fragment_out(0, Type::VEC4, "fragColor") + .additional_info("draw_mesh") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_facing_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_facing) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_facing") + .additional_info("drw_clipped"); diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_grid_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_grid_info.hh index 47b34ee010a..2424f7298f2 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_grid_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_grid_info.hh @@ -5,43 +5,38 @@ #include "gpu_shader_create_info.hh" /* We use the normalized local position to avoid precision loss during interpolation. */ -GPU_SHADER_INTERFACE_INFO(overlay_grid_iface) -SMOOTH(VEC3, local_pos) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_INTERFACE_INFO(overlay_grid_iface).smooth(Type::VEC3, "local_pos"); GPU_SHADER_CREATE_INFO(overlay_grid) -DO_STATIC_COMPILATION() -TYPEDEF_SOURCE("overlay_shader_shared.h") -VERTEX_IN(0, VEC3, pos) -VERTEX_OUT(overlay_grid_iface) -FRAGMENT_OUT(0, VEC4, out_color) -SAMPLER(0, DEPTH_2D, depth_tx) -UNIFORM_BUF(3, OVERLAY_GridData, grid_buf) -PUSH_CONSTANT(VEC3, plane_axes) -PUSH_CONSTANT(INT, grid_flag) -VERTEX_SOURCE("overlay_grid_vert.glsl") -FRAGMENT_SOURCE("overlay_grid_frag.glsl") -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .typedef_source("overlay_shader_shared.h") + .vertex_in(0, Type::VEC3, "pos") + .vertex_out(overlay_grid_iface) + .fragment_out(0, Type::VEC4, "out_color") + .sampler(0, ImageType::DEPTH_2D, "depth_tx") + .uniform_buf(3, "OVERLAY_GridData", "grid_buf") + .push_constant(Type::VEC3, "plane_axes") + .push_constant(Type::INT, "grid_flag") + .vertex_source("overlay_grid_vert.glsl") + .fragment_source("overlay_grid_frag.glsl") + .additional_info("draw_view") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_grid_background) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -SAMPLER(0, DEPTH_2D, depthBuffer) -PUSH_CONSTANT(VEC4, ucolor) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_edit_uv_tiled_image_borders_vert.glsl") -FRAGMENT_SOURCE("overlay_grid_background_frag.glsl") -ADDITIONAL_INFO(draw_modelmat) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .sampler(0, ImageType::DEPTH_2D, "depthBuffer") + .push_constant(Type::VEC4, "ucolor") + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_edit_uv_tiled_image_borders_vert.glsl") + .fragment_source("overlay_grid_background_frag.glsl") + .additional_info("draw_modelmat"); GPU_SHADER_CREATE_INFO(overlay_grid_image) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -PUSH_CONSTANT(VEC4, ucolor) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_edit_uv_tiled_image_borders_vert.glsl") -FRAGMENT_SOURCE("overlay_uniform_color_frag.glsl") -ADDITIONAL_INFO(draw_modelmat) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .push_constant(Type::VEC4, "ucolor") + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_edit_uv_tiled_image_borders_vert.glsl") + .fragment_source("overlay_uniform_color_frag.glsl") + .additional_info("draw_modelmat"); diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_outline_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_outline_info.hh index 7334c7af217..3ef4afbed4b 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_outline_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_outline_info.hh @@ -8,147 +8,128 @@ /** \name Outline Pre-pass * \{ */ -GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_iface, interp) -FLAT(UINT, ob_id) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_iface, interp).flat(Type::UINT, "ob_id"); GPU_SHADER_CREATE_INFO(overlay_outline_prepass) -PUSH_CONSTANT(BOOL, isTransform) -VERTEX_OUT(overlay_outline_prepass_iface) -/* Using uint because 16bit uint can contain more ids than int. */ -FRAGMENT_OUT(0, UINT, out_object_id) -FRAGMENT_SOURCE("overlay_outline_prepass_frag.glsl") -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .push_constant(Type::BOOL, "isTransform") + .vertex_out(overlay_outline_prepass_iface) + /* Using uint because 16bit uint can contain more ids than int. */ + .fragment_out(0, Type::UINT, "out_object_id") + .fragment_source("overlay_outline_prepass_frag.glsl") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_outline_prepass_mesh) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -VERTEX_SOURCE("overlay_outline_prepass_vert.glsl") -ADDITIONAL_INFO(draw_mesh) -ADDITIONAL_INFO(draw_resource_handle) -ADDITIONAL_INFO(overlay_outline_prepass) -ADDITIONAL_INFO(draw_object_infos) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_source("overlay_outline_prepass_vert.glsl") + .additional_info("draw_mesh") + .additional_info("draw_resource_handle") + .additional_info("overlay_outline_prepass") + .additional_info("draw_object_infos"); GPU_SHADER_CREATE_INFO(overlay_outline_prepass_mesh_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_outline_prepass_mesh) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_outline_prepass_mesh") + .additional_info("drw_clipped"); -GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_wire_iface, vert) -FLAT(VEC3, pos) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_wire_iface, vert).flat(Type::VEC3, "pos"); GPU_SHADER_CREATE_INFO(overlay_outline_prepass_curves) -DO_STATIC_COMPILATION() -VERTEX_SOURCE("overlay_outline_prepass_curves_vert.glsl") -ADDITIONAL_INFO(draw_hair) -ADDITIONAL_INFO(draw_resource_handle) -ADDITIONAL_INFO(overlay_outline_prepass) -ADDITIONAL_INFO(draw_object_infos) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_source("overlay_outline_prepass_curves_vert.glsl") + .additional_info("draw_hair") + .additional_info("draw_resource_handle") + .additional_info("overlay_outline_prepass") + .additional_info("draw_object_infos"); GPU_SHADER_CREATE_INFO(overlay_outline_prepass_curves_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_outline_prepass_curves) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_outline_prepass_curves") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_outline_prepass_wire) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_outline_prepass) -ADDITIONAL_INFO(draw_object_infos) -ADDITIONAL_INFO(draw_mesh) -ADDITIONAL_INFO(draw_resource_handle) -VERTEX_IN(0, VEC3, pos) -DEFINE("USE_GEOM") -VERTEX_OUT(overlay_outline_prepass_wire_iface) -GEOMETRY_LAYOUT(PrimitiveIn::LINES_ADJACENCY, PrimitiveOut::LINE_STRIP, 2) -GEOMETRY_OUT(overlay_outline_prepass_iface) -VERTEX_SOURCE("overlay_outline_prepass_vert.glsl") -GEOMETRY_SOURCE("overlay_outline_prepass_geom.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_outline_prepass") + .additional_info("draw_object_infos") + .additional_info("draw_mesh") + .additional_info("draw_resource_handle") + .vertex_in(0, Type::VEC3, "pos") + .define("USE_GEOM") + .vertex_out(overlay_outline_prepass_wire_iface) + .geometry_layout(PrimitiveIn::LINES_ADJACENCY, PrimitiveOut::LINE_STRIP, 2) + .geometry_out(overlay_outline_prepass_iface) + .vertex_source("overlay_outline_prepass_vert.glsl") + .geometry_source("overlay_outline_prepass_geom.glsl"); GPU_SHADER_CREATE_INFO(overlay_outline_prepass_wire_next) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_outline_prepass) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_mesh_new) -ADDITIONAL_INFO(draw_object_infos_new) -ADDITIONAL_INFO(draw_resource_handle_new) -ADDITIONAL_INFO(gpu_index_load) -STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY) -PUSH_CONSTANT(IVEC2, gpu_attr_0) -VERTEX_SOURCE("overlay_outline_prepass_wire_vert.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_outline_prepass") + .additional_info("draw_view") + .additional_info("draw_mesh_new") + .additional_info("draw_object_infos_new") + .additional_info("draw_resource_handle_new") + .additional_info("gpu_index_load") + .storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY) + .push_constant(Type::IVEC2, "gpu_attr_0") + .vertex_source("overlay_outline_prepass_wire_vert.glsl"); GPU_SHADER_CREATE_INFO(overlay_outline_prepass_wire_no_geom) -METAL_BACKEND_ONLY() -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -ADDITIONAL_INFO(overlay_outline_prepass) -ADDITIONAL_INFO(draw_object_infos) -ADDITIONAL_INFO(draw_mesh) -ADDITIONAL_INFO(draw_resource_handle) -VERTEX_SOURCE("overlay_outline_prepass_vert_no_geom.glsl") -GPU_SHADER_CREATE_END() + .metal_backend_only(true) + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .additional_info("overlay_outline_prepass") + .additional_info("draw_object_infos") + .additional_info("draw_mesh") + .additional_info("draw_resource_handle") + .vertex_source("overlay_outline_prepass_vert_no_geom.glsl"); GPU_SHADER_CREATE_INFO(overlay_outline_prepass_wire_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_outline_prepass_wire) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_outline_prepass_wire") + .additional_info("drw_clipped"); GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_gpencil_flat_iface, gp_interp_flat) -FLAT(VEC2, aspect) -FLAT(VEC4, sspos) -GPU_SHADER_INTERFACE_END() + .flat(Type::VEC2, "aspect") + .flat(Type::VEC4, "sspos"); GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_gpencil_noperspective_iface, gp_interp_noperspective) -NO_PERSPECTIVE(VEC2, thickness) -NO_PERSPECTIVE(FLOAT, hardness) -GPU_SHADER_INTERFACE_END() + .no_perspective(Type::VEC2, "thickness") + .no_perspective(Type::FLOAT, "hardness"); GPU_SHADER_CREATE_INFO(overlay_outline_prepass_gpencil) -DO_STATIC_COMPILATION() -PUSH_CONSTANT(BOOL, isTransform) -VERTEX_OUT(overlay_outline_prepass_iface) -VERTEX_OUT(overlay_outline_prepass_gpencil_flat_iface) -VERTEX_OUT(overlay_outline_prepass_gpencil_noperspective_iface) -VERTEX_SOURCE("overlay_outline_prepass_gpencil_vert.glsl") -PUSH_CONSTANT(BOOL, gpStrokeOrder3d) /* TODO(fclem): Move to a GPencil object UBO. */ -PUSH_CONSTANT(VEC4, gpDepthPlane) /* TODO(fclem): Move to a GPencil object UBO. */ -/* Using uint because 16bit uint can contain more ids than int. */ -FRAGMENT_OUT(0, UINT, out_object_id) -FRAGMENT_SOURCE("overlay_outline_prepass_gpencil_frag.glsl") -DEPTH_WRITE(DepthWrite::ANY) -ADDITIONAL_INFO(draw_gpencil) -ADDITIONAL_INFO(draw_resource_handle) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .push_constant(Type::BOOL, "isTransform") + .vertex_out(overlay_outline_prepass_iface) + .vertex_out(overlay_outline_prepass_gpencil_flat_iface) + .vertex_out(overlay_outline_prepass_gpencil_noperspective_iface) + .vertex_source("overlay_outline_prepass_gpencil_vert.glsl") + .push_constant(Type::BOOL, "gpStrokeOrder3d") /* TODO(fclem): Move to a GPencil object UBO. */ + .push_constant(Type::VEC4, "gpDepthPlane") /* TODO(fclem): Move to a GPencil object UBO. */ + /* Using uint because 16bit uint can contain more ids than int. */ + .fragment_out(0, Type::UINT, "out_object_id") + .fragment_source("overlay_outline_prepass_gpencil_frag.glsl") + .depth_write(DepthWrite::ANY) + .additional_info("draw_gpencil") + .additional_info("draw_resource_handle") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_outline_prepass_gpencil_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_outline_prepass_gpencil) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_outline_prepass_gpencil") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_outline_prepass_pointcloud) -DO_STATIC_COMPILATION() -VERTEX_SOURCE("overlay_outline_prepass_pointcloud_vert.glsl") -ADDITIONAL_INFO(draw_pointcloud) -ADDITIONAL_INFO(draw_resource_handle) -ADDITIONAL_INFO(overlay_outline_prepass) -ADDITIONAL_INFO(draw_object_infos) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_source("overlay_outline_prepass_pointcloud_vert.glsl") + .additional_info("draw_pointcloud") + .additional_info("draw_resource_handle") + .additional_info("overlay_outline_prepass") + .additional_info("draw_object_infos"); GPU_SHADER_CREATE_INFO(overlay_outline_prepass_pointcloud_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_outline_prepass_pointcloud) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_outline_prepass_pointcloud") + .additional_info("drw_clipped"); /** \} */ @@ -157,20 +138,19 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(overlay_outline_detect) -DO_STATIC_COMPILATION() -PUSH_CONSTANT(FLOAT, alphaOcclu) -PUSH_CONSTANT(BOOL, isXrayWires) -PUSH_CONSTANT(BOOL, doAntiAliasing) -PUSH_CONSTANT(BOOL, doThickOutlines) -SAMPLER(0, UINT_2D, outlineId) -SAMPLER(1, DEPTH_2D, outlineDepth) -SAMPLER(2, DEPTH_2D, sceneDepth) -FRAGMENT_OUT(0, VEC4, fragColor) -FRAGMENT_OUT(1, VEC4, lineOutput) -FRAGMENT_SOURCE("overlay_outline_detect_frag.glsl") -ADDITIONAL_INFO(draw_fullscreen) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .push_constant(Type::FLOAT, "alphaOcclu") + .push_constant(Type::BOOL, "isXrayWires") + .push_constant(Type::BOOL, "doAntiAliasing") + .push_constant(Type::BOOL, "doThickOutlines") + .sampler(0, ImageType::UINT_2D, "outlineId") + .sampler(1, ImageType::DEPTH_2D, "outlineDepth") + .sampler(2, ImageType::DEPTH_2D, "sceneDepth") + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_out(1, Type::VEC4, "lineOutput") + .fragment_source("overlay_outline_detect_frag.glsl") + .additional_info("draw_fullscreen") + .additional_info("draw_view") + .additional_info("draw_globals"); /** \} */ diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_paint_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_paint_info.hh index 22c1ad5cd5b..aa82105c6ef 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_paint_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_paint_info.hh @@ -11,21 +11,19 @@ * \{ */ GPU_SHADER_CREATE_INFO(overlay_paint_face) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, VEC4, nor) /* Select flag on the 4th component. */ -PUSH_CONSTANT(VEC4, ucolor) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_paint_face_vert.glsl") -FRAGMENT_SOURCE("overlay_uniform_color_frag.glsl") -ADDITIONAL_INFO(draw_modelmat) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC4, "nor") /* Select flag on the 4th component. */ + .push_constant(Type::VEC4, "ucolor") + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_paint_face_vert.glsl") + .fragment_source("overlay_uniform_color_frag.glsl") + .additional_info("draw_modelmat"); GPU_SHADER_CREATE_INFO(overlay_paint_face_clipped) -ADDITIONAL_INFO(overlay_paint_face) -ADDITIONAL_INFO(drw_clipped) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("overlay_paint_face") + .additional_info("drw_clipped") + .do_static_compilation(true); /** \} */ @@ -35,27 +33,23 @@ GPU_SHADER_CREATE_END() * Used for vertex selection mode in Weight and Vertex Paint. * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_overlay_paint_point_iface) -SMOOTH(VEC4, finalColor) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_INTERFACE_INFO(overlay_overlay_paint_point_iface).smooth(Type::VEC4, "finalColor"); GPU_SHADER_CREATE_INFO(overlay_paint_point) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, VEC4, nor) /* Select flag on the 4th component. */ -VERTEX_OUT(overlay_overlay_paint_point_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_paint_point_vert.glsl") -FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") -ADDITIONAL_INFO(draw_modelmat) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC4, "nor") /* Select flag on the 4th component. */ + .vertex_out(overlay_overlay_paint_point_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_paint_point_vert.glsl") + .fragment_source("overlay_point_varying_color_frag.glsl") + .additional_info("draw_modelmat") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_paint_point_clipped) -ADDITIONAL_INFO(overlay_paint_point) -ADDITIONAL_INFO(drw_clipped) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("overlay_paint_point") + .additional_info("drw_clipped") + .do_static_compilation(true); /** \} */ @@ -65,31 +59,27 @@ GPU_SHADER_CREATE_END() * Used in Texture Paint mode for the Stencil Image Masking. * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_paint_texture_iface) -SMOOTH(VEC2, uv_interp) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_INTERFACE_INFO(overlay_paint_texture_iface).smooth(Type::VEC2, "uv_interp"); GPU_SHADER_CREATE_INFO(overlay_paint_texture) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, VEC2, mu) /* Masking uv map. */ -VERTEX_OUT(overlay_paint_texture_iface) -SAMPLER(0, FLOAT_2D, maskImage) -PUSH_CONSTANT(VEC3, maskColor) -PUSH_CONSTANT(FLOAT, opacity) /* `1.0` by default. */ -PUSH_CONSTANT(BOOL, maskInvertStencil) -PUSH_CONSTANT(BOOL, maskImagePremultiplied) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_paint_texture_vert.glsl") -FRAGMENT_SOURCE("overlay_paint_texture_frag.glsl") -ADDITIONAL_INFO(draw_modelmat) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC2, "mu") /* Masking uv map. */ + .vertex_out(overlay_paint_texture_iface) + .sampler(0, ImageType::FLOAT_2D, "maskImage") + .push_constant(Type::VEC3, "maskColor") + .push_constant(Type::FLOAT, "opacity") /* `1.0` by default. */ + .push_constant(Type::BOOL, "maskInvertStencil") + .push_constant(Type::BOOL, "maskImagePremultiplied") + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_paint_texture_vert.glsl") + .fragment_source("overlay_paint_texture_frag.glsl") + .additional_info("draw_modelmat"); GPU_SHADER_CREATE_INFO(overlay_paint_texture_clipped) -ADDITIONAL_INFO(overlay_paint_texture) -ADDITIONAL_INFO(drw_clipped) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("overlay_paint_texture") + .additional_info("drw_clipped") + .do_static_compilation(true); /** \} */ @@ -99,28 +89,24 @@ GPU_SHADER_CREATE_END() * It should be used to draw a Vertex Paint overlay. But it is currently unreachable. * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_paint_vertcol_iface) -SMOOTH(VEC3, finalColor) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_INTERFACE_INFO(overlay_paint_vertcol_iface).smooth(Type::VEC3, "finalColor"); GPU_SHADER_CREATE_INFO(overlay_paint_vertcol) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, VEC3, ac) /* Active color. */ -VERTEX_OUT(overlay_paint_vertcol_iface) -PUSH_CONSTANT(FLOAT, opacity) /* `1.0` by default. */ -PUSH_CONSTANT(BOOL, useAlphaBlend) /* `false` by default. */ -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_paint_vertcol_vert.glsl") -FRAGMENT_SOURCE("overlay_paint_vertcol_frag.glsl") -ADDITIONAL_INFO(draw_modelmat) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC3, "ac") /* Active color. */ + .vertex_out(overlay_paint_vertcol_iface) + .push_constant(Type::FLOAT, "opacity") /* `1.0` by default. */ + .push_constant(Type::BOOL, "useAlphaBlend") /* `false` by default. */ + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_paint_vertcol_vert.glsl") + .fragment_source("overlay_paint_vertcol_frag.glsl") + .additional_info("draw_modelmat"); GPU_SHADER_CREATE_INFO(overlay_paint_vertcol_clipped) -ADDITIONAL_INFO(overlay_paint_vertcol) -ADDITIONAL_INFO(drw_clipped) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("overlay_paint_vertcol") + .additional_info("drw_clipped") + .do_static_compilation(true); /** \} */ @@ -132,44 +118,39 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_INTERFACE_INFO(overlay_paint_weight_iface) -SMOOTH(VEC2, weight_interp) /* (weight, alert) */ -SMOOTH(FLOAT, color_fac) -GPU_SHADER_INTERFACE_END() + .smooth(Type::VEC2, "weight_interp") /* (weight, alert) */ + .smooth(Type::FLOAT, "color_fac"); GPU_SHADER_CREATE_INFO(overlay_paint_weight) -DO_STATIC_COMPILATION() -VERTEX_IN(0, FLOAT, weight) -VERTEX_IN(1, VEC3, pos) -VERTEX_IN(2, VEC3, nor) -VERTEX_OUT(overlay_paint_weight_iface) -SAMPLER(0, FLOAT_1D, colorramp) -PUSH_CONSTANT(FLOAT, opacity) /* `1.0` by default. */ -PUSH_CONSTANT(BOOL, drawContours) /* `false` by default. */ -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_paint_weight_vert.glsl") -FRAGMENT_SOURCE("overlay_paint_weight_frag.glsl") -ADDITIONAL_INFO(draw_modelmat) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::FLOAT, "weight") + .vertex_in(1, Type::VEC3, "pos") + .vertex_in(2, Type::VEC3, "nor") + .vertex_out(overlay_paint_weight_iface) + .sampler(0, ImageType::FLOAT_1D, "colorramp") + .push_constant(Type::FLOAT, "opacity") /* `1.0` by default. */ + .push_constant(Type::BOOL, "drawContours") /* `false` by default. */ + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_paint_weight_vert.glsl") + .fragment_source("overlay_paint_weight_frag.glsl") + .additional_info("draw_modelmat") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_paint_weight_fake_shading) -ADDITIONAL_INFO(overlay_paint_weight) -DEFINE("FAKE_SHADING") -PUSH_CONSTANT(VEC3, light_dir) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("overlay_paint_weight") + .define("FAKE_SHADING") + .push_constant(Type::VEC3, "light_dir") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(overlay_paint_weight_clipped) -ADDITIONAL_INFO(overlay_paint_weight) -ADDITIONAL_INFO(drw_clipped) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("overlay_paint_weight") + .additional_info("drw_clipped") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(overlay_paint_weight_fake_shading_clipped) -ADDITIONAL_INFO(overlay_paint_weight_fake_shading) -ADDITIONAL_INFO(drw_clipped) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("overlay_paint_weight_fake_shading") + .additional_info("drw_clipped") + .do_static_compilation(true); /** \} */ @@ -180,27 +161,23 @@ GPU_SHADER_CREATE_END() * paint modes. * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_paint_wire_iface) -FLAT(VEC4, finalColor) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_INTERFACE_INFO(overlay_paint_wire_iface).flat(Type::VEC4, "finalColor"); GPU_SHADER_CREATE_INFO(overlay_paint_wire) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, VEC4, nor) /* flag stored in w */ -VERTEX_OUT(overlay_paint_wire_iface) -PUSH_CONSTANT(BOOL, useSelect) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_paint_wire_vert.glsl") -FRAGMENT_SOURCE("overlay_varying_color.glsl") -ADDITIONAL_INFO(draw_modelmat) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC4, "nor") /* flag stored in w */ + .vertex_out(overlay_paint_wire_iface) + .push_constant(Type::BOOL, "useSelect") + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_paint_wire_vert.glsl") + .fragment_source("overlay_varying_color.glsl") + .additional_info("draw_modelmat") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_paint_wire_clipped) -ADDITIONAL_INFO(overlay_paint_vertcol) -ADDITIONAL_INFO(drw_clipped) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("overlay_paint_vertcol") + .additional_info("drw_clipped") + .do_static_compilation(true); /** \} */ diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_curves_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_curves_info.hh index 4dba29d13af..75d79357c93 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_curves_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_curves_info.hh @@ -5,51 +5,45 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_INTERFACE_INFO(overlay_sculpt_curves_selection_iface) -SMOOTH(FLOAT, mask_weight) -GPU_SHADER_INTERFACE_END() + .smooth(Type::FLOAT, "mask_weight"); GPU_SHADER_CREATE_INFO(overlay_sculpt_curves_selection) -DO_STATIC_COMPILATION() -PUSH_CONSTANT(BOOL, is_point_domain) -PUSH_CONSTANT(FLOAT, selection_opacity) -SAMPLER(1, FLOAT_BUFFER, selection_tx) -VERTEX_OUT(overlay_sculpt_curves_selection_iface) -VERTEX_SOURCE("overlay_sculpt_curves_selection_vert.glsl") -FRAGMENT_SOURCE("overlay_sculpt_curves_selection_frag.glsl") -FRAGMENT_OUT(0, VEC4, out_color) -ADDITIONAL_INFO(draw_hair) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .push_constant(Type::BOOL, "is_point_domain") + .push_constant(Type::FLOAT, "selection_opacity") + .sampler(1, ImageType::FLOAT_BUFFER, "selection_tx") + .vertex_out(overlay_sculpt_curves_selection_iface) + .vertex_source("overlay_sculpt_curves_selection_vert.glsl") + .fragment_source("overlay_sculpt_curves_selection_frag.glsl") + .fragment_out(0, Type::VEC4, "out_color") + .additional_info("draw_hair") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_sculpt_curves_selection_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_sculpt_curves_selection) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_sculpt_curves_selection") + .additional_info("drw_clipped"); GPU_SHADER_INTERFACE_INFO(overlay_sculpt_curves_cage_iface) -NO_PERSPECTIVE(VEC2, edgePos) -FLAT(VEC2, edgeStart) -SMOOTH(VEC4, finalColor) -GPU_SHADER_INTERFACE_END() + .no_perspective(Type::VEC2, "edgePos") + .flat(Type::VEC2, "edgeStart") + .smooth(Type::VEC4, "finalColor"); GPU_SHADER_CREATE_INFO(overlay_sculpt_curves_cage) -DO_STATIC_COMPILATION() -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, FLOAT, selection) -VERTEX_OUT(overlay_sculpt_curves_cage_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -FRAGMENT_OUT(1, VEC4, lineOutput) -PUSH_CONSTANT(FLOAT, opacity) -VERTEX_SOURCE("overlay_sculpt_curves_cage_vert.glsl") -FRAGMENT_SOURCE("overlay_extra_frag.glsl") -ADDITIONAL_INFO(draw_modelmat) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::FLOAT, "selection") + .vertex_out(overlay_sculpt_curves_cage_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_out(1, Type::VEC4, "lineOutput") + .push_constant(Type::FLOAT, "opacity") + .vertex_source("overlay_sculpt_curves_cage_vert.glsl") + .fragment_source("overlay_extra_frag.glsl") + .additional_info("draw_modelmat") + .additional_info("draw_view") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_sculpt_curves_cage_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_sculpt_curves_cage) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_sculpt_curves_cage") + .additional_info("drw_clipped"); diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_info.hh index 28f737c2cc6..8a8b266779e 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_info.hh @@ -5,29 +5,26 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_INTERFACE_INFO(overlay_sculpt_mask_iface) -FLAT(VEC3, faceset_color) -SMOOTH(FLOAT, mask_color) -SMOOTH(VEC4, finalColor) -GPU_SHADER_INTERFACE_END() + .flat(Type::VEC3, "faceset_color") + .smooth(Type::FLOAT, "mask_color") + .smooth(Type::VEC4, "finalColor"); GPU_SHADER_CREATE_INFO(overlay_sculpt_mask) -DO_STATIC_COMPILATION() -PUSH_CONSTANT(FLOAT, maskOpacity) -PUSH_CONSTANT(FLOAT, faceSetsOpacity) -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, VEC3, fset) -VERTEX_IN(2, FLOAT, msk) -VERTEX_OUT(overlay_sculpt_mask_iface) -VERTEX_SOURCE("overlay_sculpt_mask_vert.glsl") -FRAGMENT_SOURCE("overlay_sculpt_mask_frag.glsl") -FRAGMENT_OUT(0, VEC4, fragColor) -ADDITIONAL_INFO(draw_mesh) -ADDITIONAL_INFO(draw_object_infos) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .push_constant(Type::FLOAT, "maskOpacity") + .push_constant(Type::FLOAT, "faceSetsOpacity") + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC3, "fset") + .vertex_in(2, Type::FLOAT, "msk") + .vertex_out(overlay_sculpt_mask_iface) + .vertex_source("overlay_sculpt_mask_vert.glsl") + .fragment_source("overlay_sculpt_mask_frag.glsl") + .fragment_out(0, Type::VEC4, "fragColor") + .additional_info("draw_mesh") + .additional_info("draw_object_infos") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_sculpt_mask_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_sculpt_mask) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_sculpt_mask") + .additional_info("drw_clipped"); diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_viewer_attribute_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_viewer_attribute_info.hh index dde4663d503..a9d4771523f 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_viewer_attribute_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_viewer_attribute_info.hh @@ -4,86 +4,74 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(overlay_viewer_attribute_iface) -SMOOTH(VEC4, finalColor) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_INTERFACE_INFO(overlay_viewer_attribute_iface).smooth(Type::VEC4, "finalColor"); -GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_common) -PUSH_CONSTANT(FLOAT, opacity) -GPU_SHADER_CREATE_END() +GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_common).push_constant(Type::FLOAT, "opacity"); GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_mesh) -DO_STATIC_COMPILATION() -VERTEX_SOURCE("overlay_viewer_attribute_mesh_vert.glsl") -FRAGMENT_SOURCE("overlay_viewer_attribute_frag.glsl") -FRAGMENT_OUT(0, VEC4, out_color) -FRAGMENT_OUT(1, VEC4, lineOutput) -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, VEC4, attribute_value) -VERTEX_OUT(overlay_viewer_attribute_iface) -ADDITIONAL_INFO(overlay_viewer_attribute_common) -ADDITIONAL_INFO(draw_mesh) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_source("overlay_viewer_attribute_mesh_vert.glsl") + .fragment_source("overlay_viewer_attribute_frag.glsl") + .fragment_out(0, Type::VEC4, "out_color") + .fragment_out(1, Type::VEC4, "lineOutput") + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC4, "attribute_value") + .vertex_out(overlay_viewer_attribute_iface) + .additional_info("overlay_viewer_attribute_common") + .additional_info("draw_mesh"); GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_mesh_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_viewer_attribute_mesh) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_viewer_attribute_mesh") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_pointcloud) -DO_STATIC_COMPILATION() -VERTEX_SOURCE("overlay_viewer_attribute_pointcloud_vert.glsl") -FRAGMENT_SOURCE("overlay_viewer_attribute_frag.glsl") -FRAGMENT_OUT(0, VEC4, out_color) -FRAGMENT_OUT(1, VEC4, lineOutput) -SAMPLER(3, FLOAT_BUFFER, attribute_tx) -VERTEX_OUT(overlay_viewer_attribute_iface) -ADDITIONAL_INFO(overlay_viewer_attribute_common) -ADDITIONAL_INFO(draw_pointcloud) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_source("overlay_viewer_attribute_pointcloud_vert.glsl") + .fragment_source("overlay_viewer_attribute_frag.glsl") + .fragment_out(0, Type::VEC4, "out_color") + .fragment_out(1, Type::VEC4, "lineOutput") + .sampler(3, ImageType::FLOAT_BUFFER, "attribute_tx") + .vertex_out(overlay_viewer_attribute_iface) + .additional_info("overlay_viewer_attribute_common") + .additional_info("draw_pointcloud"); GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_pointcloud_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_viewer_attribute_pointcloud) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_viewer_attribute_pointcloud") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_curve) -DO_STATIC_COMPILATION() -VERTEX_SOURCE("overlay_viewer_attribute_curve_vert.glsl") -FRAGMENT_SOURCE("overlay_viewer_attribute_frag.glsl") -FRAGMENT_OUT(0, VEC4, out_color) -FRAGMENT_OUT(1, VEC4, lineOutput) -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, VEC4, attribute_value) -VERTEX_OUT(overlay_viewer_attribute_iface) -ADDITIONAL_INFO(overlay_viewer_attribute_common) -ADDITIONAL_INFO(draw_modelmat) -ADDITIONAL_INFO(draw_resource_id) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_source("overlay_viewer_attribute_curve_vert.glsl") + .fragment_source("overlay_viewer_attribute_frag.glsl") + .fragment_out(0, Type::VEC4, "out_color") + .fragment_out(1, Type::VEC4, "lineOutput") + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC4, "attribute_value") + .vertex_out(overlay_viewer_attribute_iface) + .additional_info("overlay_viewer_attribute_common") + .additional_info("draw_modelmat") + .additional_info("draw_resource_id"); GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_curve_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_viewer_attribute_curve) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_viewer_attribute_curve") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_curves) -DO_STATIC_COMPILATION() -VERTEX_SOURCE("overlay_viewer_attribute_curves_vert.glsl") -FRAGMENT_SOURCE("overlay_viewer_attribute_frag.glsl") -FRAGMENT_OUT(0, VEC4, out_color) -FRAGMENT_OUT(1, VEC4, lineOutput) -SAMPLER(0, FLOAT_BUFFER, color_tx) -PUSH_CONSTANT(BOOL, is_point_domain) -VERTEX_OUT(overlay_viewer_attribute_iface) -ADDITIONAL_INFO(overlay_viewer_attribute_common) -ADDITIONAL_INFO(draw_hair) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .vertex_source("overlay_viewer_attribute_curves_vert.glsl") + .fragment_source("overlay_viewer_attribute_frag.glsl") + .fragment_out(0, Type::VEC4, "out_color") + .fragment_out(1, Type::VEC4, "lineOutput") + .sampler(0, ImageType::FLOAT_BUFFER, "color_tx") + .push_constant(Type::BOOL, "is_point_domain") + .vertex_out(overlay_viewer_attribute_iface) + .additional_info("overlay_viewer_attribute_common") + .additional_info("draw_hair"); GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_curves_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_viewer_attribute_curves) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_viewer_attribute_curves") + .additional_info("drw_clipped"); diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_volume_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_volume_info.hh index 2bd30a709ed..aec5ec31523 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_volume_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_volume_info.hh @@ -8,54 +8,48 @@ /** \name Volume Velocity * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_volume_velocity_iface) -SMOOTH(VEC4, finalColor) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_INTERFACE_INFO(overlay_volume_velocity_iface).smooth(Type::VEC4, "finalColor"); GPU_SHADER_CREATE_INFO(overlay_volume_velocity) -SAMPLER(0, FLOAT_3D, velocityX) -SAMPLER(1, FLOAT_3D, velocityY) -SAMPLER(2, FLOAT_3D, velocityZ) -PUSH_CONSTANT(FLOAT, displaySize) -PUSH_CONSTANT(FLOAT, slicePosition) -PUSH_CONSTANT(INT, sliceAxis) -PUSH_CONSTANT(BOOL, scaleWithMagnitude) -PUSH_CONSTANT(BOOL, isCellCentered) -/* FluidDomainSettings.cell_size */ -PUSH_CONSTANT(VEC3, cellSize) -/* FluidDomainSettings.p0 */ -PUSH_CONSTANT(VEC3, domainOriginOffset) -/* FluidDomainSettings.res_min */ -PUSH_CONSTANT(IVEC3, adaptiveCellOffset) -PUSH_CONSTANT(INT, in_select_id) -VERTEX_OUT(overlay_volume_velocity_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_volume_velocity_vert.glsl") -FRAGMENT_SOURCE("overlay_varying_color.glsl") -GPU_SHADER_CREATE_END() + .sampler(0, ImageType::FLOAT_3D, "velocityX") + .sampler(1, ImageType::FLOAT_3D, "velocityY") + .sampler(2, ImageType::FLOAT_3D, "velocityZ") + .push_constant(Type::FLOAT, "displaySize") + .push_constant(Type::FLOAT, "slicePosition") + .push_constant(Type::INT, "sliceAxis") + .push_constant(Type::BOOL, "scaleWithMagnitude") + .push_constant(Type::BOOL, "isCellCentered") + /* FluidDomainSettings.cell_size */ + .push_constant(Type::VEC3, "cellSize") + /* FluidDomainSettings.p0 */ + .push_constant(Type::VEC3, "domainOriginOffset") + /* FluidDomainSettings.res_min */ + .push_constant(Type::IVEC3, "adaptiveCellOffset") + .push_constant(Type::INT, "in_select_id") + .vertex_out(overlay_volume_velocity_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_volume_velocity_vert.glsl") + .fragment_source("overlay_varying_color.glsl"); GPU_SHADER_CREATE_INFO(overlay_volume_velocity_streamline) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(draw_volume) -ADDITIONAL_INFO(overlay_volume_velocity) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("draw_volume") + .additional_info("overlay_volume_velocity"); GPU_SHADER_CREATE_INFO(overlay_volume_velocity_mac) -DO_STATIC_COMPILATION() -DEFINE("USE_MAC") -PUSH_CONSTANT(BOOL, drawMACX) -PUSH_CONSTANT(BOOL, drawMACY) -PUSH_CONSTANT(BOOL, drawMACZ) -ADDITIONAL_INFO(draw_volume) -ADDITIONAL_INFO(overlay_volume_velocity) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("USE_MAC") + .push_constant(Type::BOOL, "drawMACX") + .push_constant(Type::BOOL, "drawMACY") + .push_constant(Type::BOOL, "drawMACZ") + .additional_info("draw_volume") + .additional_info("overlay_volume_velocity"); GPU_SHADER_CREATE_INFO(overlay_volume_velocity_needle) -DO_STATIC_COMPILATION() -DEFINE("USE_NEEDLE") -ADDITIONAL_INFO(draw_volume) -ADDITIONAL_INFO(overlay_volume_velocity) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("USE_NEEDLE") + .additional_info("draw_volume") + .additional_info("overlay_volume_velocity"); /** \} */ @@ -63,53 +57,47 @@ GPU_SHADER_CREATE_END() /** \name Volume Grid-Lines * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_volume_gridlines_iface) -FLAT(VEC4, finalColor) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_INTERFACE_INFO(overlay_volume_gridlines_iface).flat(Type::VEC4, "finalColor"); GPU_SHADER_CREATE_INFO(overlay_volume_gridlines) -PUSH_CONSTANT(FLOAT, slicePosition) -PUSH_CONSTANT(INT, sliceAxis) -/* FluidDomainSettings.res */ -PUSH_CONSTANT(IVEC3, volumeSize) -/* FluidDomainSettings.cell_size */ -PUSH_CONSTANT(VEC3, cellSize) -/* FluidDomainSettings.p0 */ -PUSH_CONSTANT(VEC3, domainOriginOffset) -/* FluidDomainSettings.res_min */ -PUSH_CONSTANT(IVEC3, adaptiveCellOffset) -PUSH_CONSTANT(INT, in_select_id) -VERTEX_OUT(overlay_volume_gridlines_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("overlay_volume_gridlines_vert.glsl") -FRAGMENT_SOURCE("overlay_varying_color.glsl") -GPU_SHADER_CREATE_END() + .push_constant(Type::FLOAT, "slicePosition") + .push_constant(Type::INT, "sliceAxis") + /* FluidDomainSettings.res */ + .push_constant(Type::IVEC3, "volumeSize") + /* FluidDomainSettings.cell_size */ + .push_constant(Type::VEC3, "cellSize") + /* FluidDomainSettings.p0 */ + .push_constant(Type::VEC3, "domainOriginOffset") + /* FluidDomainSettings.res_min */ + .push_constant(Type::IVEC3, "adaptiveCellOffset") + .push_constant(Type::INT, "in_select_id") + .vertex_out(overlay_volume_gridlines_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("overlay_volume_gridlines_vert.glsl") + .fragment_source("overlay_varying_color.glsl"); GPU_SHADER_CREATE_INFO(overlay_volume_gridlines_flat) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(draw_volume) -ADDITIONAL_INFO(overlay_volume_gridlines) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("draw_volume") + .additional_info("overlay_volume_gridlines"); GPU_SHADER_CREATE_INFO(overlay_volume_gridlines_flags) -DO_STATIC_COMPILATION() -DEFINE("SHOW_FLAGS") -SAMPLER(0, UINT_3D, flagTexture) -ADDITIONAL_INFO(draw_volume) -ADDITIONAL_INFO(overlay_volume_gridlines) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("SHOW_FLAGS") + .sampler(0, ImageType::UINT_3D, "flagTexture") + .additional_info("draw_volume") + .additional_info("overlay_volume_gridlines"); GPU_SHADER_CREATE_INFO(overlay_volume_gridlines_range) -DO_STATIC_COMPILATION() -DEFINE("SHOW_RANGE") -PUSH_CONSTANT(FLOAT, lowerBound) -PUSH_CONSTANT(FLOAT, upperBound) -PUSH_CONSTANT(VEC4, rangeColor) -PUSH_CONSTANT(INT, cellFilter) -SAMPLER(0, UINT_3D, flagTexture) -SAMPLER(1, FLOAT_3D, fieldTexture) -ADDITIONAL_INFO(draw_volume) -ADDITIONAL_INFO(overlay_volume_gridlines) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("SHOW_RANGE") + .push_constant(Type::FLOAT, "lowerBound") + .push_constant(Type::FLOAT, "upperBound") + .push_constant(Type::VEC4, "rangeColor") + .push_constant(Type::INT, "cellFilter") + .sampler(0, ImageType::UINT_3D, "flagTexture") + .sampler(1, ImageType::FLOAT_3D, "fieldTexture") + .additional_info("draw_volume") + .additional_info("overlay_volume_gridlines"); /** \} */ diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_wireframe_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_wireframe_info.hh index 1e44ffe6c47..861c6b4b783 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_wireframe_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_wireframe_info.hh @@ -5,128 +5,117 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_INTERFACE_INFO(overlay_wireframe_iface) -SMOOTH(VEC4, finalColor) -FLAT(VEC2, edgeStart) -NO_PERSPECTIVE(VEC2, edgePos) -GPU_SHADER_INTERFACE_END() + .smooth(Type::VEC4, "finalColor") + .flat(Type::VEC2, "edgeStart") + .no_perspective(Type::VEC2, "edgePos"); GPU_SHADER_CREATE_INFO(overlay_wireframe) -DO_STATIC_COMPILATION() -PUSH_CONSTANT(FLOAT, wireStepParam) -PUSH_CONSTANT(FLOAT, wireOpacity) -PUSH_CONSTANT(BOOL, useColoring) -PUSH_CONSTANT(BOOL, isTransform) -PUSH_CONSTANT(INT, colorType) -PUSH_CONSTANT(BOOL, isHair) -PUSH_CONSTANT(MAT4, hairDupliMatrix) -/* Scene Depth texture copy for manual depth test. */ -SAMPLER(0, DEPTH_2D, depthTex) -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, VEC3, nor) -VERTEX_IN(2, FLOAT, wd) /* wire-data. */ -VERTEX_OUT(overlay_wireframe_iface) -VERTEX_SOURCE("overlay_wireframe_vert.glsl") -FRAGMENT_SOURCE("overlay_wireframe_frag.glsl") -FRAGMENT_OUT(0, VEC4, fragColor) -FRAGMENT_OUT(1, VEC4, lineOutput) -DEPTH_WRITE(DepthWrite::ANY) -ADDITIONAL_INFO(draw_mesh) -ADDITIONAL_INFO(draw_object_infos) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .push_constant(Type::FLOAT, "wireStepParam") + .push_constant(Type::FLOAT, "wireOpacity") + .push_constant(Type::BOOL, "useColoring") + .push_constant(Type::BOOL, "isTransform") + .push_constant(Type::INT, "colorType") + .push_constant(Type::BOOL, "isHair") + .push_constant(Type::MAT4, "hairDupliMatrix") + /* Scene Depth texture copy for manual depth test. */ + .sampler(0, ImageType::DEPTH_2D, "depthTex") + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC3, "nor") + .vertex_in(2, Type::FLOAT, "wd") /* wire-data. */ + .vertex_out(overlay_wireframe_iface) + .vertex_source("overlay_wireframe_vert.glsl") + .fragment_source("overlay_wireframe_frag.glsl") + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_out(1, Type::VEC4, "lineOutput") + .depth_write(DepthWrite::ANY) + .additional_info("draw_mesh") + .additional_info("draw_object_infos") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_wireframe_curve) -DO_STATIC_COMPILATION() -DEFINE("CURVES") -PUSH_CONSTANT(FLOAT, wireOpacity) -PUSH_CONSTANT(BOOL, useColoring) -PUSH_CONSTANT(BOOL, isTransform) -PUSH_CONSTANT(INT, colorType) -VERTEX_IN(0, VEC3, pos) -VERTEX_OUT(overlay_wireframe_iface) -VERTEX_SOURCE("overlay_wireframe_vert.glsl") -FRAGMENT_SOURCE("overlay_wireframe_frag.glsl") -FRAGMENT_OUT(0, VEC4, fragColor) -FRAGMENT_OUT(1, VEC4, lineOutput) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_modelmat_new) -ADDITIONAL_INFO(draw_resource_handle_new) -ADDITIONAL_INFO(draw_object_infos_new) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("CURVES") + .push_constant(Type::FLOAT, "wireOpacity") + .push_constant(Type::BOOL, "useColoring") + .push_constant(Type::BOOL, "isTransform") + .push_constant(Type::INT, "colorType") + .vertex_in(0, Type::VEC3, "pos") + .vertex_out(overlay_wireframe_iface) + .vertex_source("overlay_wireframe_vert.glsl") + .fragment_source("overlay_wireframe_frag.glsl") + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_out(1, Type::VEC4, "lineOutput") + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new") + .additional_info("draw_object_infos_new") + .additional_info("draw_globals"); GPU_SHADER_INTERFACE_INFO(overlay_wireframe_points_iface) -FLAT(VEC4, finalColor) -FLAT(VEC4, finalColorInner) -GPU_SHADER_INTERFACE_END() + .flat(Type::VEC4, "finalColor") + .flat(Type::VEC4, "finalColorInner"); GPU_SHADER_CREATE_INFO(overlay_wireframe_points) -DO_STATIC_COMPILATION() -DEFINE("POINTS") -PUSH_CONSTANT(BOOL, useColoring) -PUSH_CONSTANT(BOOL, isTransform) -PUSH_CONSTANT(INT, colorType) -VERTEX_IN(0, VEC3, pos) -VERTEX_OUT(overlay_wireframe_points_iface) -VERTEX_SOURCE("overlay_wireframe_vert.glsl") -FRAGMENT_SOURCE("overlay_wireframe_frag.glsl") -FRAGMENT_OUT(0, VEC4, fragColor) -FRAGMENT_OUT(1, VEC4, lineOutput) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_modelmat_new) -ADDITIONAL_INFO(draw_resource_handle_new) -ADDITIONAL_INFO(draw_object_infos_new) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("POINTS") + .push_constant(Type::BOOL, "useColoring") + .push_constant(Type::BOOL, "isTransform") + .push_constant(Type::INT, "colorType") + .vertex_in(0, Type::VEC3, "pos") + .vertex_out(overlay_wireframe_points_iface) + .vertex_source("overlay_wireframe_vert.glsl") + .fragment_source("overlay_wireframe_frag.glsl") + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_out(1, Type::VEC4, "lineOutput") + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new") + .additional_info("draw_object_infos_new") + .additional_info("draw_globals"); GPU_SHADER_CREATE_INFO(overlay_wireframe_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_wireframe) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_wireframe") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_wireframe_custom_depth) -DO_STATIC_COMPILATION() -DEFINE("CUSTOM_DEPTH_BIAS") -ADDITIONAL_INFO(overlay_wireframe) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("CUSTOM_DEPTH_BIAS") + .additional_info("overlay_wireframe"); GPU_SHADER_CREATE_INFO(overlay_wireframe_custom_depth_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_wireframe_custom_depth) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_wireframe_custom_depth") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_wireframe_select) -DO_STATIC_COMPILATION() -DEFINE("SELECT_EDGES") -ADDITIONAL_INFO(overlay_wireframe) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("SELECT_EDGES") + .additional_info("overlay_wireframe"); GPU_SHADER_CREATE_INFO(overlay_wireframe_select_clipped) -DO_STATIC_COMPILATION() -ADDITIONAL_INFO(overlay_wireframe_select) -ADDITIONAL_INFO(drw_clipped) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .additional_info("overlay_wireframe_select") + .additional_info("drw_clipped"); GPU_SHADER_CREATE_INFO(overlay_wireframe_uv) -DO_STATIC_COMPILATION() -DEFINE("WIREFRAME") -STORAGE_BUF_FREQ(0, READ, float, au[], GEOMETRY) -PUSH_CONSTANT(IVEC2, gpu_attr_0) -DEFINE_VALUE("lineStyle", "4" /* OVERLAY_UV_LINE_STYLE_SHADOW */) -DEFINE_VALUE("dashLength", "1" /* Not used by this line style */) -DEFINE_VALUE("use_edge_select", "false") -PUSH_CONSTANT(BOOL, doSmoothWire) -PUSH_CONSTANT(FLOAT, alpha) -VERTEX_OUT(overlay_edit_uv_next_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -/* Note: Reuse edit mode shader as it is mostly the same. */ -VERTEX_SOURCE("overlay_edit_uv_edges_next_vert.glsl") -FRAGMENT_SOURCE("overlay_edit_uv_edges_next_frag.glsl") -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_modelmat_new) -ADDITIONAL_INFO(draw_resource_handle_new) -ADDITIONAL_INFO(gpu_index_load) -ADDITIONAL_INFO(draw_globals) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("WIREFRAME") + .storage_buf(0, Qualifier::READ, "float", "au[]", Frequency::GEOMETRY) + .push_constant(Type::IVEC2, "gpu_attr_0") + .define("lineStyle", "4" /* OVERLAY_UV_LINE_STYLE_SHADOW */) + .define("dashLength", "1" /* Not used by this line style */) + .define("use_edge_select", "false") + .push_constant(Type::BOOL, "doSmoothWire") + .push_constant(Type::FLOAT, "alpha") + .vertex_out(overlay_edit_uv_next_iface) + .fragment_out(0, Type::VEC4, "fragColor") + /* Note: Reuse edit mode shader as it is mostly the same. */ + .vertex_source("overlay_edit_uv_edges_next_vert.glsl") + .fragment_source("overlay_edit_uv_edges_next_frag.glsl") + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new") + .additional_info("gpu_index_load") + .additional_info("draw_globals"); diff --git a/source/blender/draw/engines/select/shaders/infos/select_id_info.hh b/source/blender/draw/engines/select/shaders/infos/select_id_info.hh index b2c30fda0ab..b3fc907e509 100644 --- a/source/blender/draw/engines/select/shaders/infos/select_id_info.hh +++ b/source/blender/draw/engines/select/shaders/infos/select_id_info.hh @@ -9,68 +9,60 @@ /** \name Select ID for Edit Mesh Selection * \{ */ -GPU_SHADER_INTERFACE_INFO(select_id_iface) -FLAT(INT, select_id) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_INTERFACE_INFO(select_id_iface).flat(Type::INT, "select_id"); GPU_SHADER_CREATE_INFO(select_id_flat) -PUSH_CONSTANT(FLOAT, sizeVertex) -PUSH_CONSTANT(INT, offset) -PUSH_CONSTANT(FLOAT, retopologyOffset) -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, INT, index) -VERTEX_OUT(select_id_iface) -FRAGMENT_OUT(0, UINT, fragColor) -VERTEX_SOURCE("select_id_vert.glsl") -FRAGMENT_SOURCE("select_id_frag.glsl") -ADDITIONAL_INFO(draw_modelmat) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .push_constant(Type::FLOAT, "sizeVertex") + .push_constant(Type::INT, "offset") + .push_constant(Type::FLOAT, "retopologyOffset") + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::INT, "index") + .vertex_out(select_id_iface) + .fragment_out(0, Type::UINT, "fragColor") + .vertex_source("select_id_vert.glsl") + .fragment_source("select_id_frag.glsl") + .additional_info("draw_modelmat") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(select_id_uniform) -DEFINE("UNIFORM_ID") -PUSH_CONSTANT(FLOAT, sizeVertex) -PUSH_CONSTANT(INT, select_id) -PUSH_CONSTANT(FLOAT, retopologyOffset) -VERTEX_IN(0, VEC3, pos) -FRAGMENT_OUT(0, UINT, fragColor) -VERTEX_SOURCE("select_id_vert.glsl") -FRAGMENT_SOURCE("select_id_frag.glsl") -ADDITIONAL_INFO(draw_modelmat) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .define("UNIFORM_ID") + .push_constant(Type::FLOAT, "sizeVertex") + .push_constant(Type::INT, "select_id") + .push_constant(Type::FLOAT, "retopologyOffset") + .vertex_in(0, Type::VEC3, "pos") + .fragment_out(0, Type::UINT, "fragColor") + .vertex_source("select_id_vert.glsl") + .fragment_source("select_id_frag.glsl") + .additional_info("draw_modelmat") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(select_id_flat_clipped) -ADDITIONAL_INFO(select_id_flat) -ADDITIONAL_INFO(drw_clipped) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("select_id_flat") + .additional_info("drw_clipped") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(select_id_uniform_clipped) -ADDITIONAL_INFO(select_id_uniform) -ADDITIONAL_INFO(drw_clipped) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("select_id_uniform") + .additional_info("drw_clipped") + .do_static_compilation(true); /* Used to patch overlay shaders. */ GPU_SHADER_CREATE_INFO(select_id_patch) -TYPEDEF_SOURCE("select_shader_shared.hh") -VERTEX_OUT(select_id_iface) -/* Need to make sure the depth & stencil comparison runs before the fragment shader. */ -EARLY_FRAGMENT_TEST(true) -UNIFORM_BUF(SELECT_DATA, SelectInfoData, select_info_buf) -/* Select IDs for instanced draw-calls not using #PassMain. */ -STORAGE_BUF(SELECT_ID_IN, READ, int, in_select_buf[]) -/* Stores the result of the whole selection drawing. Content depends on selection mode. */ -STORAGE_BUF(SELECT_ID_OUT, READ_WRITE, uint, out_select_buf[]) -GPU_SHADER_CREATE_END() + .typedef_source("select_shader_shared.hh") + .vertex_out(select_id_iface) + /* Need to make sure the depth & stencil comparison runs before the fragment shader. */ + .early_fragment_test(true) + .uniform_buf(SELECT_DATA, "SelectInfoData", "select_info_buf") + /* Select IDs for instanced draw-calls not using #PassMain. */ + .storage_buf(SELECT_ID_IN, Qualifier::READ, "int", "in_select_buf[]") + /* Stores the result of the whole selection drawing. Content depends on selection mode. */ + .storage_buf(SELECT_ID_OUT, Qualifier::READ_WRITE, "uint", "out_select_buf[]"); /** \} */ GPU_SHADER_CREATE_INFO(select_debug_fullscreen) -ADDITIONAL_INFO(draw_fullscreen) -FRAGMENT_SOURCE("select_debug_frag.glsl") -SAMPLER(0, UINT_2D, image) -FRAGMENT_OUT(0, VEC4, fragColor) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("draw_fullscreen") + .fragment_source("select_debug_frag.glsl") + .sampler(0, ImageType::UINT_2D, "image") + .fragment_out(0, Type::VEC4, "fragColor") + .do_static_compilation(true); diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh index b8c29af8d7c..25cf6a908ed 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh @@ -10,52 +10,43 @@ * \{ */ GPU_SHADER_CREATE_INFO(workbench_composite) -SAMPLER(3, DEPTH_2D, depth_tx) -SAMPLER(4, FLOAT_2D, normal_tx) -SAMPLER(5, FLOAT_2D, material_tx) -UNIFORM_BUF(WB_WORLD_SLOT, WorldData, world_data) -TYPEDEF_SOURCE("workbench_shader_shared.h") -PUSH_CONSTANT(BOOL, forceShadowing) -FRAGMENT_OUT(0, VEC4, fragColor) -FRAGMENT_SOURCE("workbench_composite_frag.glsl") -ADDITIONAL_INFO(draw_fullscreen) -ADDITIONAL_INFO(draw_view) -GPU_SHADER_CREATE_END() + .sampler(3, ImageType::DEPTH_2D, "depth_tx") + .sampler(4, ImageType::FLOAT_2D, "normal_tx") + .sampler(5, ImageType::FLOAT_2D, "material_tx") + .uniform_buf(WB_WORLD_SLOT, "WorldData", "world_data") + .typedef_source("workbench_shader_shared.h") + .push_constant(Type::BOOL, "forceShadowing") + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_source("workbench_composite_frag.glsl") + .additional_info("draw_fullscreen") + .additional_info("draw_view"); /* Lighting */ -GPU_SHADER_CREATE_INFO(workbench_resolve_opaque_studio) -DEFINE("WORKBENCH_LIGHTING_STUDIO") -GPU_SHADER_CREATE_END() +GPU_SHADER_CREATE_INFO(workbench_resolve_opaque_studio).define("WORKBENCH_LIGHTING_STUDIO"); GPU_SHADER_CREATE_INFO(workbench_resolve_opaque_matcap) -DEFINE("WORKBENCH_LIGHTING_MATCAP") -SAMPLER(WB_MATCAP_SLOT, FLOAT_2D_ARRAY, matcap_tx) -GPU_SHADER_CREATE_END() + .define("WORKBENCH_LIGHTING_MATCAP") + .sampler(WB_MATCAP_SLOT, ImageType::FLOAT_2D_ARRAY, "matcap_tx"); -GPU_SHADER_CREATE_INFO(workbench_resolve_opaque_flat) -DEFINE("WORKBENCH_LIGHTING_FLAT") -GPU_SHADER_CREATE_END() +GPU_SHADER_CREATE_INFO(workbench_resolve_opaque_flat).define("WORKBENCH_LIGHTING_FLAT"); /* Effects */ GPU_SHADER_CREATE_INFO(workbench_resolve_curvature) -DEFINE("WORKBENCH_CURVATURE") -SAMPLER(6, UINT_2D, object_id_tx) -GPU_SHADER_CREATE_END() + .define("WORKBENCH_CURVATURE") + .sampler(6, ImageType::UINT_2D, "object_id_tx"); GPU_SHADER_CREATE_INFO(workbench_resolve_cavity) -DEFINE("WORKBENCH_CAVITY") -/* TODO(@pragma37): GPU_SAMPLER_EXTEND_MODE_REPEAT is set in CavityEffect, - * it doesn't work here? */ -SAMPLER(7, FLOAT_2D, jitter_tx) -UNIFORM_BUF(5, vec4, cavity_samples[512]) -GPU_SHADER_CREATE_END() + .define("WORKBENCH_CAVITY") + /* TODO(@pragma37): GPU_SAMPLER_EXTEND_MODE_REPEAT is set in CavityEffect, + * it doesn't work here? */ + .sampler(7, ImageType::FLOAT_2D, "jitter_tx") + .uniform_buf(5, "vec4", "cavity_samples[512]"); GPU_SHADER_CREATE_INFO(workbench_resolve_shadow) -DEFINE("WORKBENCH_SHADOW") -SAMPLER(8, UINT_2D, stencil_tx) -GPU_SHADER_CREATE_END() + .define("WORKBENCH_SHADOW") + .sampler(8, ImageType::UINT_2D, "stencil_tx"); /* Variations */ diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_depth_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_depth_info.hh index a5c93de9087..2d471595090 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_depth_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_depth_info.hh @@ -5,23 +5,20 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(workbench_merge_depth) -SAMPLER(0, DEPTH_2D, depth_tx) -FRAGMENT_SOURCE("workbench_merge_depth_frag.glsl") -ADDITIONAL_INFO(draw_fullscreen) -DEPTH_WRITE(DepthWrite::ANY) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .sampler(0, ImageType::DEPTH_2D, "depth_tx") + .fragment_source("workbench_merge_depth_frag.glsl") + .additional_info("draw_fullscreen") + .depth_write(DepthWrite::ANY) + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(workbench_overlay_depth) -FRAGMENT_SOURCE("workbench_overlay_depth_frag.glsl") -ADDITIONAL_INFO(draw_fullscreen) -DEPTH_WRITE(DepthWrite::ANY) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .fragment_source("workbench_overlay_depth_frag.glsl") + .additional_info("draw_fullscreen") + .depth_write(DepthWrite::ANY) + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(workbench_extract_stencil) -FRAGMENT_OUT(0, UINT, out_stencil_value) -FRAGMENT_SOURCE("workbench_extract_stencil.glsl") -ADDITIONAL_INFO(draw_fullscreen) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .fragment_out(0, Type::UINT, "out_stencil_value") + .fragment_source("workbench_extract_stencil.glsl") + .additional_info("draw_fullscreen") + .do_static_compilation(true); diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_antialiasing_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_antialiasing_info.hh index 1f3cac83cc9..345f766e302 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_antialiasing_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_antialiasing_info.hh @@ -9,13 +9,12 @@ * \{ */ GPU_SHADER_CREATE_INFO(workbench_taa) -SAMPLER(0, FLOAT_2D, colorBuffer) -PUSH_CONSTANT_ARRAY(FLOAT, samplesWeights, 9) -FRAGMENT_OUT(0, VEC4, fragColor) -FRAGMENT_SOURCE("workbench_effect_taa_frag.glsl") -ADDITIONAL_INFO(draw_fullscreen) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .sampler(0, ImageType::FLOAT_2D, "colorBuffer") + .push_constant(Type::FLOAT, "samplesWeights", 9) + .fragment_out(0, Type::VEC4, "fragColor") + .fragment_source("workbench_effect_taa_frag.glsl") + .additional_info("draw_fullscreen") + .do_static_compilation(true); /** \} */ @@ -24,50 +23,45 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_INTERFACE_INFO(workbench_smaa_iface) -SMOOTH(VEC2, uvs) -SMOOTH(VEC2, pixcoord) -SMOOTH(VEC4, offset[3]) -GPU_SHADER_INTERFACE_END() + .smooth(Type::VEC2, "uvs") + .smooth(Type::VEC2, "pixcoord") + .smooth(Type::VEC4, "offset[3]"); GPU_SHADER_CREATE_INFO(workbench_smaa) -DEFINE("SMAA_GLSL_3") -DEFINE_VALUE("SMAA_RT_METRICS", "viewportMetrics") -DEFINE("SMAA_PRESET_HIGH") -DEFINE_VALUE("SMAA_LUMA_WEIGHT", "float4(1.0, 1.0, 1.0, 1.0)") -DEFINE("SMAA_NO_DISCARD") -VERTEX_OUT(workbench_smaa_iface) -PUSH_CONSTANT(VEC4, viewportMetrics) -VERTEX_SOURCE("workbench_effect_smaa_vert.glsl") -FRAGMENT_SOURCE("workbench_effect_smaa_frag.glsl") -GPU_SHADER_CREATE_END() + .define("SMAA_GLSL_3") + .define("SMAA_RT_METRICS", "viewportMetrics") + .define("SMAA_PRESET_HIGH") + .define("SMAA_LUMA_WEIGHT", "float4(1.0, 1.0, 1.0, 1.0)") + .define("SMAA_NO_DISCARD") + .vertex_out(workbench_smaa_iface) + .push_constant(Type::VEC4, "viewportMetrics") + .vertex_source("workbench_effect_smaa_vert.glsl") + .fragment_source("workbench_effect_smaa_frag.glsl"); GPU_SHADER_CREATE_INFO(workbench_smaa_stage_0) -DEFINE_VALUE("SMAA_STAGE", "0") -SAMPLER(0, FLOAT_2D, colorTex) -FRAGMENT_OUT(0, VEC2, out_edges) -ADDITIONAL_INFO(workbench_smaa) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .define("SMAA_STAGE", "0") + .sampler(0, ImageType::FLOAT_2D, "colorTex") + .fragment_out(0, Type::VEC2, "out_edges") + .additional_info("workbench_smaa") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(workbench_smaa_stage_1) -DEFINE_VALUE("SMAA_STAGE", "1") -SAMPLER(0, FLOAT_2D, edgesTex) -SAMPLER(1, FLOAT_2D, areaTex) -SAMPLER(2, FLOAT_2D, searchTex) -FRAGMENT_OUT(0, VEC4, out_weights) -ADDITIONAL_INFO(workbench_smaa) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .define("SMAA_STAGE", "1") + .sampler(0, ImageType::FLOAT_2D, "edgesTex") + .sampler(1, ImageType::FLOAT_2D, "areaTex") + .sampler(2, ImageType::FLOAT_2D, "searchTex") + .fragment_out(0, Type::VEC4, "out_weights") + .additional_info("workbench_smaa") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(workbench_smaa_stage_2) -DEFINE_VALUE("SMAA_STAGE", "2") -SAMPLER(0, FLOAT_2D, colorTex) -SAMPLER(1, FLOAT_2D, blendTex) -PUSH_CONSTANT(FLOAT, mixFactor) -PUSH_CONSTANT(FLOAT, taaAccumulatedWeight) -FRAGMENT_OUT(0, VEC4, out_color) -ADDITIONAL_INFO(workbench_smaa) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .define("SMAA_STAGE", "2") + .sampler(0, ImageType::FLOAT_2D, "colorTex") + .sampler(1, ImageType::FLOAT_2D, "blendTex") + .push_constant(Type::FLOAT, "mixFactor") + .push_constant(Type::FLOAT, "taaAccumulatedWeight") + .fragment_out(0, Type::VEC4, "out_color") + .additional_info("workbench_smaa") + .do_static_compilation(true); /** \} */ diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_dof_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_dof_info.hh index 7ba5b44cc0c..a7ef011e6ca 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_dof_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_dof_info.hh @@ -5,60 +5,54 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(workbench_effect_dof) -/* TODO(fclem): Split resources per stage. */ -SAMPLER(0, FLOAT_2D, inputCocTex) -SAMPLER(1, FLOAT_2D, maxCocTilesTex) -SAMPLER(2, FLOAT_2D, sceneColorTex) -SAMPLER(3, FLOAT_2D, sceneDepthTex) -SAMPLER(4, FLOAT_2D, backgroundTex) -SAMPLER(5, FLOAT_2D, halfResColorTex) -SAMPLER(6, FLOAT_2D, blurTex) -SAMPLER(7, FLOAT_2D, noiseTex) -PUSH_CONSTANT(VEC2, invertedViewportSize) -PUSH_CONSTANT(VEC2, nearFar) -PUSH_CONSTANT(VEC3, dofParams) -PUSH_CONSTANT(FLOAT, noiseOffset) -FRAGMENT_SOURCE("workbench_effect_dof_frag.glsl") -ADDITIONAL_INFO(draw_fullscreen) -ADDITIONAL_INFO(draw_view) -GPU_SHADER_CREATE_END() + /* TODO(fclem): Split resources per stage. */ + .sampler(0, ImageType::FLOAT_2D, "inputCocTex") + .sampler(1, ImageType::FLOAT_2D, "maxCocTilesTex") + .sampler(2, ImageType::FLOAT_2D, "sceneColorTex") + .sampler(3, ImageType::FLOAT_2D, "sceneDepthTex") + .sampler(4, ImageType::FLOAT_2D, "backgroundTex") + .sampler(5, ImageType::FLOAT_2D, "halfResColorTex") + .sampler(6, ImageType::FLOAT_2D, "blurTex") + .sampler(7, ImageType::FLOAT_2D, "noiseTex") + .push_constant(Type::VEC2, "invertedViewportSize") + .push_constant(Type::VEC2, "nearFar") + .push_constant(Type::VEC3, "dofParams") + .push_constant(Type::FLOAT, "noiseOffset") + .fragment_source("workbench_effect_dof_frag.glsl") + .additional_info("draw_fullscreen") + .additional_info("draw_view"); GPU_SHADER_CREATE_INFO(workbench_effect_dof_prepare) -DEFINE("PREPARE") -FRAGMENT_OUT(0, VEC4, halfResColor) -FRAGMENT_OUT(1, VEC2, normalizedCoc) -ADDITIONAL_INFO(workbench_effect_dof) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .define("PREPARE") + .fragment_out(0, Type::VEC4, "halfResColor") + .fragment_out(1, Type::VEC2, "normalizedCoc") + .additional_info("workbench_effect_dof") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(workbench_effect_dof_downsample) -DEFINE("DOWNSAMPLE") -FRAGMENT_OUT(0, VEC4, outColor) -FRAGMENT_OUT(1, VEC2, outCocs) -ADDITIONAL_INFO(workbench_effect_dof) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .define("DOWNSAMPLE") + .fragment_out(0, Type::VEC4, "outColor") + .fragment_out(1, Type::VEC2, "outCocs") + .additional_info("workbench_effect_dof") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(workbench_effect_dof_blur1) -DEFINE("BLUR1") -DEFINE_VALUE("NUM_SAMPLES", "49") -UNIFORM_BUF(1, vec4, samples[49]) -FRAGMENT_OUT(0, VEC4, blurColor) -ADDITIONAL_INFO(workbench_effect_dof) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .define("BLUR1") + .define("NUM_SAMPLES", "49") + .uniform_buf(1, "vec4", "samples[49]") + .fragment_out(0, Type::VEC4, "blurColor") + .additional_info("workbench_effect_dof") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(workbench_effect_dof_blur2) -DEFINE("BLUR2") -FRAGMENT_OUT(0, VEC4, finalColor) -ADDITIONAL_INFO(workbench_effect_dof) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .define("BLUR2") + .fragment_out(0, Type::VEC4, "finalColor") + .additional_info("workbench_effect_dof") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(workbench_effect_dof_resolve) -DEFINE("RESOLVE") -FRAGMENT_OUT_DUAL(0, VEC4, finalColorAdd, SRC_0) -FRAGMENT_OUT_DUAL(0, VEC4, finalColorMul, SRC_1) -ADDITIONAL_INFO(workbench_effect_dof) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .define("RESOLVE") + .fragment_out(0, Type::VEC4, "finalColorAdd", DualBlend::SRC_0) + .fragment_out(0, Type::VEC4, "finalColorMul", DualBlend::SRC_1) + .additional_info("workbench_effect_dof") + .do_static_compilation(true); diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_outline_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_outline_info.hh index 39248506eef..e820dbfd120 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_outline_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_outline_info.hh @@ -5,11 +5,10 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(workbench_effect_outline) -TYPEDEF_SOURCE("workbench_shader_shared.h") -FRAGMENT_SOURCE("workbench_effect_outline_frag.glsl") -SAMPLER(0, UINT_2D, objectIdBuffer) -UNIFORM_BUF(WB_WORLD_SLOT, WorldData, world_data) -FRAGMENT_OUT(0, VEC4, fragColor) -ADDITIONAL_INFO(draw_fullscreen) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .typedef_source("workbench_shader_shared.h") + .fragment_source("workbench_effect_outline_frag.glsl") + .sampler(0, ImageType::UINT_2D, "objectIdBuffer") + .uniform_buf(WB_WORLD_SLOT, "WorldData", "world_data") + .fragment_out(0, Type::VEC4, "fragColor") + .additional_info("draw_fullscreen") + .do_static_compilation(true); diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_prepass_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_prepass_info.hh index 4dffaf7ac0c..af0baa6b80c 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_prepass_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_prepass_info.hh @@ -5,38 +5,33 @@ #include "gpu_shader_create_info.hh" #include "workbench_defines.hh" -#include "draw_view_info.hh" - /* -------------------------------------------------------------------- */ /** \name Object Type * \{ */ GPU_SHADER_CREATE_INFO(workbench_mesh) -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, VEC3, nor) -VERTEX_IN(2, VEC4, ac) -VERTEX_IN(3, VEC2, au) -VERTEX_SOURCE("workbench_prepass_vert.glsl") -ADDITIONAL_INFO(draw_modelmat_new_with_custom_id) -ADDITIONAL_INFO(draw_resource_handle_new) -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC3, "nor") + .vertex_in(2, Type::VEC4, "ac") + .vertex_in(3, Type::VEC2, "au") + .vertex_source("workbench_prepass_vert.glsl") + .additional_info("draw_modelmat_new_with_custom_id") + .additional_info("draw_resource_handle_new"); GPU_SHADER_CREATE_INFO(workbench_curves) -SAMPLER_FREQ(WB_CURVES_COLOR_SLOT, FLOAT_BUFFER, ac, BATCH) -SAMPLER_FREQ(WB_CURVES_UV_SLOT, FLOAT_BUFFER, au, BATCH) -PUSH_CONSTANT(INT, emitter_object_id) -VERTEX_SOURCE("workbench_prepass_hair_vert.glsl") -ADDITIONAL_INFO(draw_modelmat_new_with_custom_id) -ADDITIONAL_INFO(draw_resource_handle_new) -ADDITIONAL_INFO(draw_hair_new) -GPU_SHADER_CREATE_END() + .sampler(WB_CURVES_COLOR_SLOT, ImageType::FLOAT_BUFFER, "ac", Frequency::BATCH) + .sampler(WB_CURVES_UV_SLOT, ImageType::FLOAT_BUFFER, "au", Frequency::BATCH) + .push_constant(Type::INT, "emitter_object_id") + .vertex_source("workbench_prepass_hair_vert.glsl") + .additional_info("draw_modelmat_new_with_custom_id") + .additional_info("draw_resource_handle_new") + .additional_info("draw_hair_new"); GPU_SHADER_CREATE_INFO(workbench_pointcloud) -VERTEX_SOURCE("workbench_prepass_pointcloud_vert.glsl") -ADDITIONAL_INFO(draw_modelmat_new_with_custom_id) -ADDITIONAL_INFO(draw_resource_handle_new) -ADDITIONAL_INFO(draw_pointcloud_new) -GPU_SHADER_CREATE_END() + .vertex_source("workbench_prepass_pointcloud_vert.glsl") + .additional_info("draw_modelmat_new_with_custom_id") + .additional_info("draw_resource_handle_new") + .additional_info("draw_pointcloud_new"); /** \} */ @@ -44,16 +39,11 @@ GPU_SHADER_CREATE_END() /** \name Lighting Type (only for transparent) * \{ */ -GPU_SHADER_CREATE_INFO(workbench_lighting_flat) -DEFINE("WORKBENCH_LIGHTING_FLAT") -GPU_SHADER_CREATE_END() -GPU_SHADER_CREATE_INFO(workbench_lighting_studio) -DEFINE("WORKBENCH_LIGHTING_STUDIO") -GPU_SHADER_CREATE_END() +GPU_SHADER_CREATE_INFO(workbench_lighting_flat).define("WORKBENCH_LIGHTING_FLAT"); +GPU_SHADER_CREATE_INFO(workbench_lighting_studio).define("WORKBENCH_LIGHTING_STUDIO"); GPU_SHADER_CREATE_INFO(workbench_lighting_matcap) -DEFINE("WORKBENCH_LIGHTING_MATCAP") -SAMPLER(WB_MATCAP_SLOT, FLOAT_2D_ARRAY, matcap_tx) -GPU_SHADER_CREATE_END() + .define("WORKBENCH_LIGHTING_MATCAP") + .sampler(WB_MATCAP_SLOT, ImageType::FLOAT_2D_ARRAY, "matcap_tx"); /** \} */ @@ -62,43 +52,37 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_INTERFACE_INFO(workbench_material_iface) -SMOOTH(VEC3, normal_interp) -SMOOTH(VEC3, color_interp) -SMOOTH(FLOAT, alpha_interp) -SMOOTH(VEC2, uv_interp) -FLAT(INT, object_id) -FLAT(FLOAT, _roughness) -FLAT(FLOAT, metallic) -GPU_SHADER_INTERFACE_END() + .smooth(Type::VEC3, "normal_interp") + .smooth(Type::VEC3, "color_interp") + .smooth(Type::FLOAT, "alpha_interp") + .smooth(Type::VEC2, "uv_interp") + .flat(Type::INT, "object_id") + .flat(Type::FLOAT, "_roughness") + .flat(Type::FLOAT, "metallic"); GPU_SHADER_CREATE_INFO(workbench_color_material) -DEFINE("WORKBENCH_COLOR_MATERIAL") -STORAGE_BUF(WB_MATERIAL_SLOT, READ, vec4, materials_data[]) -GPU_SHADER_CREATE_END() + .define("WORKBENCH_COLOR_MATERIAL") + .storage_buf(WB_MATERIAL_SLOT, Qualifier::READ, "vec4", "materials_data[]"); GPU_SHADER_CREATE_INFO(workbench_color_texture) -DEFINE("WORKBENCH_COLOR_TEXTURE") -DEFINE("WORKBENCH_TEXTURE_IMAGE_ARRAY") -DEFINE("WORKBENCH_COLOR_MATERIAL") -STORAGE_BUF(WB_MATERIAL_SLOT, READ, vec4, materials_data[]) -SAMPLER_FREQ(WB_TEXTURE_SLOT, FLOAT_2D, imageTexture, BATCH) -SAMPLER_FREQ(WB_TILE_ARRAY_SLOT, FLOAT_2D_ARRAY, imageTileArray, BATCH) -SAMPLER_FREQ(WB_TILE_DATA_SLOT, FLOAT_1D_ARRAY, imageTileData, BATCH) -PUSH_CONSTANT(BOOL, isImageTile) -PUSH_CONSTANT(BOOL, imagePremult) -PUSH_CONSTANT(FLOAT, imageTransparencyCutoff) -GPU_SHADER_CREATE_END() + .define("WORKBENCH_COLOR_TEXTURE") + .define("WORKBENCH_TEXTURE_IMAGE_ARRAY") + .define("WORKBENCH_COLOR_MATERIAL") + .storage_buf(WB_MATERIAL_SLOT, Qualifier::READ, "vec4", "materials_data[]") + .sampler(WB_TEXTURE_SLOT, ImageType::FLOAT_2D, "imageTexture", Frequency::BATCH) + .sampler(WB_TILE_ARRAY_SLOT, ImageType::FLOAT_2D_ARRAY, "imageTileArray", Frequency::BATCH) + .sampler(WB_TILE_DATA_SLOT, ImageType::FLOAT_1D_ARRAY, "imageTileData", Frequency::BATCH) + .push_constant(Type::BOOL, "isImageTile") + .push_constant(Type::BOOL, "imagePremult") + .push_constant(Type::FLOAT, "imageTransparencyCutoff"); -GPU_SHADER_CREATE_INFO(workbench_color_vertex) -DEFINE("WORKBENCH_COLOR_VERTEX") -GPU_SHADER_CREATE_END() +GPU_SHADER_CREATE_INFO(workbench_color_vertex).define("WORKBENCH_COLOR_VERTEX"); GPU_SHADER_CREATE_INFO(workbench_prepass) -DEFINE("WORKBENCH_NEXT") -UNIFORM_BUF(WB_WORLD_SLOT, WorldData, world_data) -VERTEX_OUT(workbench_material_iface) -ADDITIONAL_INFO(draw_view) -GPU_SHADER_CREATE_END() + .define("WORKBENCH_NEXT") + .uniform_buf(WB_WORLD_SLOT, "WorldData", "world_data") + .vertex_out(workbench_material_iface) + .additional_info("draw_view"); /** \} */ @@ -107,23 +91,21 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(workbench_transparent_accum) -/* NOTE: Blending will be skipped on objectId because output is a - * non-normalized integer buffer. */ -FRAGMENT_OUT(0, VEC4, out_transparent_accum) -FRAGMENT_OUT(1, VEC4, out_revealage_accum) -FRAGMENT_OUT(2, UINT, out_object_id) -PUSH_CONSTANT(BOOL, forceShadowing) -TYPEDEF_SOURCE("workbench_shader_shared.h") -FRAGMENT_SOURCE("workbench_transparent_accum_frag.glsl") -GPU_SHADER_CREATE_END() + /* NOTE: Blending will be skipped on objectId because output is a + * non-normalized integer buffer. */ + .fragment_out(0, Type::VEC4, "out_transparent_accum") + .fragment_out(1, Type::VEC4, "out_revealage_accum") + .fragment_out(2, Type::UINT, "out_object_id") + .push_constant(Type::BOOL, "forceShadowing") + .typedef_source("workbench_shader_shared.h") + .fragment_source("workbench_transparent_accum_frag.glsl"); GPU_SHADER_CREATE_INFO(workbench_opaque) -FRAGMENT_OUT(0, VEC4, out_material) -FRAGMENT_OUT(1, VEC2, out_normal) -FRAGMENT_OUT(2, UINT, out_object_id) -TYPEDEF_SOURCE("workbench_shader_shared.h") -FRAGMENT_SOURCE("workbench_prepass_frag.glsl") -GPU_SHADER_CREATE_END() + .fragment_out(0, Type::VEC4, "out_material") + .fragment_out(1, Type::VEC2, "out_normal") + .fragment_out(2, Type::UINT, "out_object_id") + .typedef_source("workbench_shader_shared.h") + .fragment_source("workbench_prepass_frag.glsl"); /** \} */ @@ -131,15 +113,9 @@ GPU_SHADER_CREATE_END() /** \name Variations Declaration * \{ */ -GPU_SHADER_CREATE_INFO(workbench_flat) -DEFINE("WORKBENCH_SHADING_FLAT") -GPU_SHADER_CREATE_END() -GPU_SHADER_CREATE_INFO(workbench_studio) -DEFINE("WORKBENCH_SHADING_STUDIO") -GPU_SHADER_CREATE_END() -GPU_SHADER_CREATE_INFO(workbench_matcap) -DEFINE("WORKBENCH_SHADING_MATCAP") -GPU_SHADER_CREATE_END() +GPU_SHADER_CREATE_INFO(workbench_flat).define("WORKBENCH_SHADING_FLAT"); +GPU_SHADER_CREATE_INFO(workbench_studio).define("WORKBENCH_SHADING_STUDIO"); +GPU_SHADER_CREATE_INFO(workbench_matcap).define("WORKBENCH_SHADING_MATCAP"); #define WORKBENCH_FINAL_VARIATION(name, ...) \ GPU_SHADER_CREATE_INFO(name).additional_info(__VA_ARGS__).do_static_compilation(true); @@ -167,9 +143,7 @@ GPU_SHADER_CREATE_END() WORKBENCH_PIPELINE_VARIATIONS(prefix##_curves, "workbench_curves", __VA_ARGS__) \ WORKBENCH_PIPELINE_VARIATIONS(prefix##_ptcloud, "workbench_pointcloud", __VA_ARGS__) -#ifndef GLSL_CPP_STUBS WORKBENCH_GEOMETRY_VARIATIONS(workbench_prepass, "workbench_prepass"); -#endif #undef WORKBENCH_FINAL_VARIATION #undef WORKBENCH_CLIPPING_VARIATIONS diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh index df115ee2ff3..cda00ee5ae4 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh @@ -11,46 +11,42 @@ * \{ */ GPU_SHADER_CREATE_INFO(workbench_shadow_common) -STORAGE_BUF_FREQ(3, READ, float, pos[], GEOMETRY) -/* WORKAROUND: Needed to support OpenSubdiv vertex format. Should be removed. */ -PUSH_CONSTANT(IVEC2, gpu_attr_3) -UNIFORM_BUF(1, ShadowPassData, pass_data) -TYPEDEF_SOURCE("workbench_shader_shared.h") -ADDITIONAL_INFO(gpu_index_load) -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_modelmat_new) -ADDITIONAL_INFO(draw_resource_handle_new) -GPU_SHADER_CREATE_END() + .storage_buf(3, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY) + /* WORKAROUND: Needed to support OpenSubdiv vertex format. Should be removed. */ + .push_constant(Type::IVEC2, "gpu_attr_3") + .uniform_buf(1, "ShadowPassData", "pass_data") + .typedef_source("workbench_shader_shared.h") + .additional_info("gpu_index_load") + .additional_info("draw_view") + .additional_info("draw_modelmat_new") + .additional_info("draw_resource_handle_new"); GPU_SHADER_CREATE_INFO(workbench_shadow_visibility_compute_common) -LOCAL_GROUP_SIZE(DRW_VISIBILITY_GROUP_SIZE) -DEFINE_VALUE("DRW_VIEW_LEN", "64") -STORAGE_BUF(0, READ, ObjectBounds, bounds_buf[]) -UNIFORM_BUF(2, ExtrudedFrustum, extruded_frustum) -PUSH_CONSTANT(INT, resource_len) -PUSH_CONSTANT(INT, view_len) -PUSH_CONSTANT(INT, visibility_word_per_draw) -PUSH_CONSTANT(BOOL, force_fail_method) -PUSH_CONSTANT(VEC3, shadow_direction) -TYPEDEF_SOURCE("workbench_shader_shared.h") -COMPUTE_SOURCE("workbench_shadow_visibility_comp.glsl") -ADDITIONAL_INFO(draw_view) -ADDITIONAL_INFO(draw_view_culling) -GPU_SHADER_CREATE_END() + .local_group_size(DRW_VISIBILITY_GROUP_SIZE) + .define("DRW_VIEW_LEN", "64") + .storage_buf(0, Qualifier::READ, "ObjectBounds", "bounds_buf[]") + .uniform_buf(2, "ExtrudedFrustum", "extruded_frustum") + .push_constant(Type::INT, "resource_len") + .push_constant(Type::INT, "view_len") + .push_constant(Type::INT, "visibility_word_per_draw") + .push_constant(Type::BOOL, "force_fail_method") + .push_constant(Type::VEC3, "shadow_direction") + .typedef_source("workbench_shader_shared.h") + .compute_source("workbench_shadow_visibility_comp.glsl") + .additional_info("draw_view") + .additional_info("draw_view_culling"); GPU_SHADER_CREATE_INFO(workbench_shadow_visibility_compute_dynamic_pass_type) -ADDITIONAL_INFO(workbench_shadow_visibility_compute_common) -DEFINE("DYNAMIC_PASS_SELECTION") -STORAGE_BUF(1, READ_WRITE, uint, pass_visibility_buf[]) -STORAGE_BUF(2, READ_WRITE, uint, fail_visibility_buf[]) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("workbench_shadow_visibility_compute_common") + .define("DYNAMIC_PASS_SELECTION") + .storage_buf(1, Qualifier::READ_WRITE, "uint", "pass_visibility_buf[]") + .storage_buf(2, Qualifier::READ_WRITE, "uint", "fail_visibility_buf[]") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(workbench_shadow_visibility_compute_static_pass_type) -ADDITIONAL_INFO(workbench_shadow_visibility_compute_common) -STORAGE_BUF(1, READ_WRITE, uint, visibility_buf[]) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("workbench_shadow_visibility_compute_common") + .storage_buf(1, Qualifier::READ_WRITE, "uint", "visibility_buf[]") + .do_static_compilation(true); /** \} */ @@ -59,13 +55,11 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(workbench_shadow_no_debug) -FRAGMENT_SOURCE("gpu_shader_depth_only_frag.glsl") -GPU_SHADER_CREATE_END() + .fragment_source("gpu_shader_depth_only_frag.glsl"); GPU_SHADER_CREATE_INFO(workbench_shadow_debug) -FRAGMENT_OUT(0, VEC4, out_debug_color) -FRAGMENT_SOURCE("workbench_shadow_debug_frag.glsl") -GPU_SHADER_CREATE_END() + .fragment_out(0, Type::VEC4, "out_debug_color") + .fragment_source("workbench_shadow_debug_frag.glsl"); /** \} */ diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_transparent_resolve_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_transparent_resolve_info.hh index bef6beb997c..94cffe3fc4c 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_transparent_resolve_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_transparent_resolve_info.hh @@ -5,10 +5,9 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(workbench_transparent_resolve) -FRAGMENT_OUT(0, VEC4, fragColor) -SAMPLER(0, FLOAT_2D, transparentAccum) -SAMPLER(1, FLOAT_2D, transparentRevealage) -FRAGMENT_SOURCE("workbench_transparent_resolve_frag.glsl") -ADDITIONAL_INFO(draw_fullscreen) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .fragment_out(0, Type::VEC4, "fragColor") + .sampler(0, ImageType::FLOAT_2D, "transparentAccum") + .sampler(1, ImageType::FLOAT_2D, "transparentRevealage") + .fragment_source("workbench_transparent_resolve_frag.glsl") + .additional_info("draw_fullscreen") + .do_static_compilation(true); diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_volume_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_volume_info.hh index 7a4a8b734ed..710881b52e6 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_volume_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_volume_info.hh @@ -9,26 +9,24 @@ * \{ */ GPU_SHADER_CREATE_INFO(workbench_volume_common) -VERTEX_IN(0, VEC3, pos) -FRAGMENT_OUT(0, VEC4, fragColor) -SAMPLER(0, DEPTH_2D, depthBuffer) -SAMPLER(1, FLOAT_3D, densityTexture) -PUSH_CONSTANT(INT, samplesLen) -PUSH_CONSTANT(FLOAT, noiseOfs) -PUSH_CONSTANT(FLOAT, stepLength) -PUSH_CONSTANT(FLOAT, densityScale) -PUSH_CONSTANT(BOOL, do_depth_test) -VERTEX_SOURCE("workbench_volume_vert.glsl") -FRAGMENT_SOURCE("workbench_volume_frag.glsl") -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC3, "pos") + .fragment_out(0, Type::VEC4, "fragColor") + .sampler(0, ImageType::DEPTH_2D, "depthBuffer") + .sampler(1, ImageType::FLOAT_3D, "densityTexture") + .push_constant(Type::INT, "samplesLen") + .push_constant(Type::FLOAT, "noiseOfs") + .push_constant(Type::FLOAT, "stepLength") + .push_constant(Type::FLOAT, "densityScale") + .push_constant(Type::BOOL, "do_depth_test") + .vertex_source("workbench_volume_vert.glsl") + .fragment_source("workbench_volume_frag.glsl"); GPU_SHADER_CREATE_INFO(workbench_volume) -DEFINE("WORKBENCH_NEXT") -SAMPLER(6, UINT_2D, stencil_tx) -ADDITIONAL_INFO(workbench_volume_common) -ADDITIONAL_INFO(draw_object_infos_new) -ADDITIONAL_INFO(draw_view) -GPU_SHADER_CREATE_END() + .define("WORKBENCH_NEXT") + .sampler(6, ImageType::UINT_2D, "stencil_tx") + .additional_info("workbench_volume_common") + .additional_info("draw_object_infos_new") + .additional_info("draw_view"); /** \} */ /* -------------------------------------------------------------------- */ @@ -36,29 +34,25 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(workbench_volume_smoke_common) -DEFINE("VOLUME_SMOKE") -SAMPLER(2, FLOAT_3D, flameTexture) -SAMPLER(3, FLOAT_1D, flameColorTexture) -ADDITIONAL_INFO(draw_resource_id_varying) -GPU_SHADER_CREATE_END() + .define("VOLUME_SMOKE") + .sampler(2, ImageType::FLOAT_3D, "flameTexture") + .sampler(3, ImageType::FLOAT_1D, "flameColorTexture") + .additional_info("draw_resource_id_varying"); GPU_SHADER_CREATE_INFO(workbench_volume_object_common) -DEFINE("VOLUME_OBJECT") -PUSH_CONSTANT(MAT4, volumeTextureToObject) -/* FIXME(fclem): This overflow the push_constant limit. */ -PUSH_CONSTANT(MAT4, volumeObjectToTexture) -ADDITIONAL_INFO(draw_resource_id_varying) -GPU_SHADER_CREATE_END() + .define("VOLUME_OBJECT") + .push_constant(Type::MAT4, "volumeTextureToObject") + /* FIXME(fclem): This overflow the push_constant limit. */ + .push_constant(Type::MAT4, "volumeObjectToTexture") + .additional_info("draw_resource_id_varying"); GPU_SHADER_CREATE_INFO(workbench_volume_smoke) -ADDITIONAL_INFO(workbench_volume_smoke_common) -ADDITIONAL_INFO(draw_modelmat_new) -GPU_SHADER_CREATE_END() + .additional_info("workbench_volume_smoke_common") + .additional_info("draw_modelmat_new"); GPU_SHADER_CREATE_INFO(workbench_volume_object) -ADDITIONAL_INFO(workbench_volume_object_common) -ADDITIONAL_INFO(draw_volume_new) -GPU_SHADER_CREATE_END() + .additional_info("workbench_volume_object_common") + .additional_info("draw_volume_new"); /** \} */ @@ -67,19 +61,17 @@ GPU_SHADER_CREATE_END() * \{ */ GPU_SHADER_CREATE_INFO(workbench_volume_coba) -DEFINE("USE_COBA") -SAMPLER(4, UINT_3D, flagTexture) -SAMPLER(5, FLOAT_1D, transferTexture) -PUSH_CONSTANT(BOOL, showPhi) -PUSH_CONSTANT(BOOL, showFlags) -PUSH_CONSTANT(BOOL, showPressure) -PUSH_CONSTANT(FLOAT, gridScale) -GPU_SHADER_CREATE_END() + .define("USE_COBA") + .sampler(4, ImageType::UINT_3D, "flagTexture") + .sampler(5, ImageType::FLOAT_1D, "transferTexture") + .push_constant(Type::BOOL, "showPhi") + .push_constant(Type::BOOL, "showFlags") + .push_constant(Type::BOOL, "showPressure") + .push_constant(Type::FLOAT, "gridScale"); GPU_SHADER_CREATE_INFO(workbench_volume_no_coba) -SAMPLER(4, FLOAT_3D, shadowTexture) -PUSH_CONSTANT(VEC3, activeColor) -GPU_SHADER_CREATE_END() + .sampler(4, ImageType::FLOAT_3D, "shadowTexture") + .push_constant(Type::VEC3, "activeColor"); /** \} */ @@ -87,15 +79,9 @@ GPU_SHADER_CREATE_END() /** \name Sampling variation * \{ */ -GPU_SHADER_CREATE_INFO(workbench_volume_linear) -DEFINE("USE_TRILINEAR") -GPU_SHADER_CREATE_END() -GPU_SHADER_CREATE_INFO(workbench_volume_cubic) -DEFINE("USE_TRICUBIC") -GPU_SHADER_CREATE_END() -GPU_SHADER_CREATE_INFO(workbench_volume_closest) -DEFINE("USE_CLOSEST") -GPU_SHADER_CREATE_END() +GPU_SHADER_CREATE_INFO(workbench_volume_linear).define("USE_TRILINEAR"); +GPU_SHADER_CREATE_INFO(workbench_volume_cubic).define("USE_TRICUBIC"); +GPU_SHADER_CREATE_INFO(workbench_volume_closest).define("USE_CLOSEST"); /** \} */ @@ -103,17 +89,14 @@ GPU_SHADER_CREATE_END() /** \name Slice variation * \{ */ -GPU_SHADER_INTERFACE_INFO(workbench_volume_iface) -SMOOTH(VEC3, localPos) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_INTERFACE_INFO(workbench_volume_iface).smooth(Type::VEC3, "localPos"); GPU_SHADER_CREATE_INFO(workbench_volume_slice) -DEFINE("VOLUME_SLICE") -VERTEX_IN(1, VEC3, uvs) -VERTEX_OUT(workbench_volume_iface) -PUSH_CONSTANT(INT, sliceAxis) /* -1 is no slice. */ -PUSH_CONSTANT(FLOAT, slicePosition) -GPU_SHADER_CREATE_END() + .define("VOLUME_SLICE") + .vertex_in(1, Type::VEC3, "uvs") + .vertex_out(workbench_volume_iface) + .push_constant(Type::INT, "sliceAxis") /* -1 is no slice. */ + .push_constant(Type::FLOAT, "slicePosition"); /** \} */ diff --git a/source/blender/gpu/shaders/infos/gpu_clip_planes_info.hh b/source/blender/gpu/shaders/infos/gpu_clip_planes_info.hh index 9462e50c213..ef116419f45 100644 --- a/source/blender/gpu/shaders/infos/gpu_clip_planes_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_clip_planes_info.hh @@ -9,7 +9,6 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_clip_planes) -UNIFORM_BUF_FREQ(1, GPUClipPlanes, clipPlanes, PASS) -TYPEDEF_SOURCE("GPU_shader_shared.hh") -DEFINE("USE_WORLD_CLIP_PLANES") -GPU_SHADER_CREATE_END() + .uniform_buf(1, "GPUClipPlanes", "clipPlanes", Frequency::PASS) + .typedef_source("GPU_shader_shared.hh") + .define("USE_WORLD_CLIP_PLANES"); diff --git a/source/blender/gpu/shaders/infos/gpu_index_load_info.hh b/source/blender/gpu/shaders/infos/gpu_index_load_info.hh index fc189f9863d..ce73be6691a 100644 --- a/source/blender/gpu/shaders/infos/gpu_index_load_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_index_load_info.hh @@ -11,9 +11,9 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_index_load) -PUSH_CONSTANT(BOOL, gpu_index_no_buffer) -PUSH_CONSTANT(BOOL, gpu_index_16bit) -PUSH_CONSTANT(INT, gpu_index_base_index) -STORAGE_BUF_FREQ(GPU_SSBO_INDEX_BUF_SLOT, READ, uint, gpu_index_buf[], GEOMETRY) -DEFINE("GPU_INDEX_LOAD") -GPU_SHADER_CREATE_END() + .push_constant(Type::BOOL, "gpu_index_no_buffer") + .push_constant(Type::BOOL, "gpu_index_16bit") + .push_constant(Type::INT, "gpu_index_base_index") + .storage_buf( + GPU_SSBO_INDEX_BUF_SLOT, Qualifier::READ, "uint", "gpu_index_buf[]", Frequency::GEOMETRY) + .define("GPU_INDEX_LOAD"); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_area_borders_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_area_borders_info.hh index c53229e3127..cf8d9890a3a 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_area_borders_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_area_borders_info.hh @@ -8,20 +8,17 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(smooth_uv_iface) -SMOOTH(VEC2, uv) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_INTERFACE_INFO(smooth_uv_iface).smooth(Type::VEC2, "uv"); GPU_SHADER_CREATE_INFO(gpu_shader_2D_area_borders) -VERTEX_IN(0, VEC2, pos) -VERTEX_OUT(smooth_uv_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -PUSH_CONSTANT(VEC4, rect) -PUSH_CONSTANT(VEC4, color) -PUSH_CONSTANT(FLOAT, scale) -PUSH_CONSTANT(INT, cornerLen) -VERTEX_SOURCE("gpu_shader_2D_area_borders_vert.glsl") -FRAGMENT_SOURCE("gpu_shader_2D_area_borders_frag.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC2, "pos") + .vertex_out(smooth_uv_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .push_constant(Type::VEC4, "rect") + .push_constant(Type::VEC4, "color") + .push_constant(Type::FLOAT, "scale") + .push_constant(Type::INT, "cornerLen") + .vertex_source("gpu_shader_2D_area_borders_vert.glsl") + .fragment_source("gpu_shader_2D_area_borders_frag.glsl") + .do_static_compilation(true); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_checker_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_checker_info.hh index 84e82a7c3fa..42303fdf51a 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_checker_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_checker_info.hh @@ -9,13 +9,12 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_checker) -VERTEX_IN(0, VEC2, pos) -FRAGMENT_OUT(0, VEC4, fragColor) -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -PUSH_CONSTANT(VEC4, color1) -PUSH_CONSTANT(VEC4, color2) -PUSH_CONSTANT(INT, size) -VERTEX_SOURCE("gpu_shader_2D_vert.glsl") -FRAGMENT_SOURCE("gpu_shader_checker_frag.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC2, "pos") + .fragment_out(0, Type::VEC4, "fragColor") + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .push_constant(Type::VEC4, "color1") + .push_constant(Type::VEC4, "color2") + .push_constant(Type::INT, "size") + .vertex_source("gpu_shader_2D_vert.glsl") + .fragment_source("gpu_shader_checker_frag.glsl") + .do_static_compilation(true); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_diag_stripes_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_diag_stripes_info.hh index 53ef9b3ec3b..89e7e20e4c7 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_diag_stripes_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_diag_stripes_info.hh @@ -9,14 +9,13 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_diag_stripes) -VERTEX_IN(0, VEC2, pos) -FRAGMENT_OUT(0, VEC4, fragColor) -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -PUSH_CONSTANT(VEC4, color1) -PUSH_CONSTANT(VEC4, color2) -PUSH_CONSTANT(INT, size1) -PUSH_CONSTANT(INT, size2) -VERTEX_SOURCE("gpu_shader_2D_vert.glsl") -FRAGMENT_SOURCE("gpu_shader_diag_stripes_frag.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC2, "pos") + .fragment_out(0, Type::VEC4, "fragColor") + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .push_constant(Type::VEC4, "color1") + .push_constant(Type::VEC4, "color2") + .push_constant(Type::INT, "size1") + .push_constant(Type::INT, "size2") + .vertex_source("gpu_shader_2D_vert.glsl") + .fragment_source("gpu_shader_diag_stripes_frag.glsl") + .do_static_compilation(true); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_desaturate_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_desaturate_color_info.hh index 4cded825133..cfa9ae9641e 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_desaturate_color_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_desaturate_color_info.hh @@ -9,9 +9,8 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_desaturate_color) -ADDITIONAL_INFO(gpu_shader_2D_image_common) -PUSH_CONSTANT(VEC4, color) -PUSH_CONSTANT(FLOAT, factor) -FRAGMENT_SOURCE("gpu_shader_image_desaturate_frag.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("gpu_shader_2D_image_common") + .push_constant(Type::VEC4, "color") + .push_constant(Type::FLOAT, "factor") + .fragment_source("gpu_shader_image_desaturate_frag.glsl") + .do_static_compilation(true); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_info.hh index 7bfafb4d2b5..a3b1d8006e7 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_info.hh @@ -10,11 +10,10 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_common) -VERTEX_IN(0, VEC2, pos) -VERTEX_IN(1, VEC2, texCoord) -VERTEX_OUT(smooth_tex_coord_interp_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -SAMPLER(0, FLOAT_2D, image) -VERTEX_SOURCE("gpu_shader_2D_image_vert.glsl") -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC2, "pos") + .vertex_in(1, Type::VEC2, "texCoord") + .vertex_out(smooth_tex_coord_interp_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .sampler(0, ImageType::FLOAT_2D, "image") + .vertex_source("gpu_shader_2D_image_vert.glsl"); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_overlays_merge_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_overlays_merge_info.hh index 230719e268f..2720f745822 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_overlays_merge_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_overlays_merge_info.hh @@ -10,31 +10,29 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_overlays_merge) -VERTEX_IN(0, VEC2, pos) -VERTEX_IN(1, VEC2, texCoord) -VERTEX_OUT(smooth_tex_coord_interp_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -PUSH_CONSTANT(BOOL, display_transform) -PUSH_CONSTANT(BOOL, overlay) -PUSH_CONSTANT(BOOL, use_hdr) -/* Sampler slots should match OCIO's. */ -SAMPLER(0, FLOAT_2D, image_texture) -SAMPLER(1, FLOAT_2D, overlays_texture) -VERTEX_SOURCE("gpu_shader_2D_image_vert.glsl") -FRAGMENT_SOURCE("gpu_shader_image_overlays_merge_frag.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC2, "pos") + .vertex_in(1, Type::VEC2, "texCoord") + .vertex_out(smooth_tex_coord_interp_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .push_constant(Type::BOOL, "display_transform") + .push_constant(Type::BOOL, "overlay") + .push_constant(Type::BOOL, "use_hdr") + /* Sampler slots should match OCIO's. */ + .sampler(0, ImageType::FLOAT_2D, "image_texture") + .sampler(1, ImageType::FLOAT_2D, "overlays_texture") + .vertex_source("gpu_shader_2D_image_vert.glsl") + .fragment_source("gpu_shader_image_overlays_merge_frag.glsl") + .do_static_compilation(true); /* Cycles display driver fallback shader. */ GPU_SHADER_CREATE_INFO(gpu_shader_cycles_display_fallback) -VERTEX_IN(0, VEC2, pos) -VERTEX_IN(1, VEC2, texCoord) -VERTEX_OUT(smooth_tex_coord_interp_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -PUSH_CONSTANT(VEC2, fullscreen) -SAMPLER(0, FLOAT_2D, image_texture) -VERTEX_SOURCE("gpu_shader_display_fallback_vert.glsl") -FRAGMENT_SOURCE("gpu_shader_display_fallback_frag.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC2, "pos") + .vertex_in(1, Type::VEC2, "texCoord") + .vertex_out(smooth_tex_coord_interp_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .push_constant(Type::VEC2, "fullscreen") + .sampler(0, ImageType::FLOAT_2D, "image_texture") + .vertex_source("gpu_shader_display_fallback_vert.glsl") + .fragment_source("gpu_shader_display_fallback_frag.glsl") + .do_static_compilation(true); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_overlays_stereo_merge_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_overlays_stereo_merge_info.hh index 435efcba121..314b535d254 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_overlays_stereo_merge_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_overlays_stereo_merge_info.hh @@ -9,14 +9,13 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_overlays_stereo_merge) -VERTEX_IN(0, VEC2, pos) -FRAGMENT_OUT(0, VEC4, overlayColor) -FRAGMENT_OUT(1, VEC4, imageColor) -SAMPLER(0, FLOAT_2D, imageTexture) -SAMPLER(1, FLOAT_2D, overlayTexture) -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -PUSH_CONSTANT(INT, stereoDisplaySettings) -VERTEX_SOURCE("gpu_shader_2D_vert.glsl") -FRAGMENT_SOURCE("gpu_shader_image_overlays_stereo_merge_frag.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC2, "pos") + .fragment_out(0, Type::VEC4, "overlayColor") + .fragment_out(1, Type::VEC4, "imageColor") + .sampler(0, ImageType::FLOAT_2D, "imageTexture") + .sampler(1, ImageType::FLOAT_2D, "overlayTexture") + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .push_constant(Type::INT, "stereoDisplaySettings") + .vertex_source("gpu_shader_2D_vert.glsl") + .fragment_source("gpu_shader_image_overlays_stereo_merge_frag.glsl") + .do_static_compilation(true); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_rect_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_rect_color_info.hh index 42e863bca1e..a472e9bbb3a 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_rect_color_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_rect_color_info.hh @@ -10,14 +10,13 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_rect_color) -VERTEX_OUT(smooth_tex_coord_interp_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -PUSH_CONSTANT(VEC4, color) -PUSH_CONSTANT(VEC4, rect_icon) -PUSH_CONSTANT(VEC4, rect_geom) -SAMPLER(0, FLOAT_2D, image) -VERTEX_SOURCE("gpu_shader_2D_image_rect_vert.glsl") -FRAGMENT_SOURCE("gpu_shader_image_color_frag.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .vertex_out(smooth_tex_coord_interp_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .push_constant(Type::VEC4, "color") + .push_constant(Type::VEC4, "rect_icon") + .push_constant(Type::VEC4, "rect_geom") + .sampler(0, ImageType::FLOAT_2D, "image") + .vertex_source("gpu_shader_2D_image_rect_vert.glsl") + .fragment_source("gpu_shader_image_color_frag.glsl") + .do_static_compilation(true); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_shuffle_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_shuffle_color_info.hh index 13c28ae0b44..146d4ff2570 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_shuffle_color_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_shuffle_color_info.hh @@ -9,9 +9,8 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_shuffle_color) -ADDITIONAL_INFO(gpu_shader_2D_image_common) -PUSH_CONSTANT(VEC4, color) -PUSH_CONSTANT(VEC4, shuffle) -FRAGMENT_SOURCE("gpu_shader_image_shuffle_color_frag.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("gpu_shader_2D_image_common") + .push_constant(Type::VEC4, "color") + .push_constant(Type::VEC4, "shuffle") + .fragment_source("gpu_shader_image_shuffle_color_frag.glsl") + .do_static_compilation(true); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_nodelink_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_nodelink_info.hh index c63d32f1038..b9b0eb9f9a4 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_nodelink_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_nodelink_info.hh @@ -9,55 +9,52 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_INTERFACE_INFO(nodelink_iface) -SMOOTH(VEC4, finalColor) -SMOOTH(VEC2, lineUV) -FLAT(FLOAT, lineLength) -FLAT(FLOAT, lineThickness) -FLAT(FLOAT, dashLength) -FLAT(FLOAT, dashFactor) -FLAT(INT, hasBackLink) -FLAT(FLOAT, dashAlpha) -FLAT(INT, isMainLine) -FLAT(FLOAT, aspect) -GPU_SHADER_INTERFACE_END() + .smooth(Type::VEC4, "finalColor") + .smooth(Type::VEC2, "lineUV") + .flat(Type::FLOAT, "lineLength") + .flat(Type::FLOAT, "lineThickness") + .flat(Type::FLOAT, "dashLength") + .flat(Type::FLOAT, "dashFactor") + .flat(Type::INT, "hasBackLink") + .flat(Type::FLOAT, "dashAlpha") + .flat(Type::INT, "isMainLine") + .flat(Type::FLOAT, "aspect"); GPU_SHADER_CREATE_INFO(gpu_shader_2D_nodelink) -VERTEX_IN(0, VEC2, uv) -VERTEX_IN(1, VEC2, pos) -VERTEX_IN(2, VEC2, expand) -VERTEX_OUT(nodelink_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -UNIFORM_BUF_FREQ(0, NodeLinkData, node_link_data, PASS) -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -VERTEX_SOURCE("gpu_shader_2D_nodelink_vert.glsl") -FRAGMENT_SOURCE("gpu_shader_2D_nodelink_frag.glsl") -TYPEDEF_SOURCE("GPU_shader_shared.hh") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC2, "uv") + .vertex_in(1, Type::VEC2, "pos") + .vertex_in(2, Type::VEC2, "expand") + .vertex_out(nodelink_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .uniform_buf(0, "NodeLinkData", "node_link_data", Frequency::PASS) + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .vertex_source("gpu_shader_2D_nodelink_vert.glsl") + .fragment_source("gpu_shader_2D_nodelink_frag.glsl") + .typedef_source("GPU_shader_shared.hh") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(gpu_shader_2D_nodelink_inst) -VERTEX_IN(0, VEC2, uv) -VERTEX_IN(1, VEC2, pos) -VERTEX_IN(2, VEC2, expand) -VERTEX_IN(3, VEC2, P0) -VERTEX_IN(4, VEC2, P1) -VERTEX_IN(5, VEC2, P2) -VERTEX_IN(6, VEC2, P3) -VERTEX_IN(7, UVEC4, colid_doarrow) -VERTEX_IN(8, VEC4, start_color) -VERTEX_IN(9, VEC4, end_color) -VERTEX_IN(10, UVEC2, domuted) -VERTEX_IN(11, FLOAT, dim_factor) -VERTEX_IN(12, FLOAT, thickness) -VERTEX_IN(13, VEC3, dash_params) -VERTEX_IN(14, INT, has_back_link) -VERTEX_OUT(nodelink_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -UNIFORM_BUF_FREQ(0, NodeLinkInstanceData, node_link_data, PASS) -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -VERTEX_SOURCE("gpu_shader_2D_nodelink_vert.glsl") -FRAGMENT_SOURCE("gpu_shader_2D_nodelink_frag.glsl") -TYPEDEF_SOURCE("GPU_shader_shared.hh") -DEFINE("USE_INSTANCE") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC2, "uv") + .vertex_in(1, Type::VEC2, "pos") + .vertex_in(2, Type::VEC2, "expand") + .vertex_in(3, Type::VEC2, "P0") + .vertex_in(4, Type::VEC2, "P1") + .vertex_in(5, Type::VEC2, "P2") + .vertex_in(6, Type::VEC2, "P3") + .vertex_in(7, Type::UVEC4, "colid_doarrow") + .vertex_in(8, Type::VEC4, "start_color") + .vertex_in(9, Type::VEC4, "end_color") + .vertex_in(10, Type::UVEC2, "domuted") + .vertex_in(11, Type::FLOAT, "dim_factor") + .vertex_in(12, Type::FLOAT, "thickness") + .vertex_in(13, Type::VEC3, "dash_params") + .vertex_in(14, Type::INT, "has_back_link") + .vertex_out(nodelink_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .uniform_buf(0, "NodeLinkInstanceData", "node_link_data", Frequency::PASS) + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .vertex_source("gpu_shader_2D_nodelink_vert.glsl") + .fragment_source("gpu_shader_2D_nodelink_frag.glsl") + .typedef_source("GPU_shader_shared.hh") + .define("USE_INSTANCE") + .do_static_compilation(true); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_point_uniform_size_uniform_color_aa_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_point_uniform_size_uniform_color_aa_info.hh index 73da34416b0..b2592296eb2 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_point_uniform_size_uniform_color_aa_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_point_uniform_size_uniform_color_aa_info.hh @@ -10,14 +10,13 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_point_uniform_size_uniform_color_aa) -VERTEX_IN(0, VEC2, pos) -VERTEX_OUT(smooth_radii_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -PUSH_CONSTANT(VEC4, color) -PUSH_CONSTANT(FLOAT, size) -VERTEX_SOURCE("gpu_shader_2D_point_uniform_size_aa_vert.glsl") -FRAGMENT_SOURCE("gpu_shader_point_uniform_color_aa_frag.glsl") -ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC2, "pos") + .vertex_out(smooth_radii_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .push_constant(Type::VEC4, "color") + .push_constant(Type::FLOAT, "size") + .vertex_source("gpu_shader_2D_point_uniform_size_aa_vert.glsl") + .fragment_source("gpu_shader_point_uniform_color_aa_frag.glsl") + .additional_info("gpu_srgb_to_framebuffer_space") + .do_static_compilation(true); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_point_uniform_size_uniform_color_outline_aa_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_point_uniform_size_uniform_color_outline_aa_info.hh index 9b4c549eacb..c99c89dba31 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_point_uniform_size_uniform_color_outline_aa_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_point_uniform_size_uniform_color_outline_aa_info.hh @@ -10,15 +10,14 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_point_uniform_size_uniform_color_outline_aa) -VERTEX_IN(0, VEC2, pos) -VERTEX_OUT(smooth_radii_outline_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -PUSH_CONSTANT(VEC4, color) -PUSH_CONSTANT(VEC4, outlineColor) -PUSH_CONSTANT(FLOAT, size) -PUSH_CONSTANT(FLOAT, outlineWidth) -VERTEX_SOURCE("gpu_shader_2D_point_uniform_size_outline_aa_vert.glsl") -FRAGMENT_SOURCE("gpu_shader_point_uniform_color_outline_aa_frag.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC2, "pos") + .vertex_out(smooth_radii_outline_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .push_constant(Type::VEC4, "color") + .push_constant(Type::VEC4, "outlineColor") + .push_constant(Type::FLOAT, "size") + .push_constant(Type::FLOAT, "outlineWidth") + .vertex_source("gpu_shader_2D_point_uniform_size_outline_aa_vert.glsl") + .fragment_source("gpu_shader_point_uniform_color_outline_aa_frag.glsl") + .do_static_compilation(true); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_point_varying_size_varying_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_point_varying_size_varying_color_info.hh index 582af0f1d20..5578a987ec0 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_point_varying_size_varying_color_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_point_varying_size_varying_color_info.hh @@ -10,13 +10,12 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_point_varying_size_varying_color) -VERTEX_IN(0, VEC2, pos) -VERTEX_IN(1, FLOAT, size) -VERTEX_IN(2, VEC4, color) -VERTEX_OUT(smooth_color_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -VERTEX_SOURCE("gpu_shader_2D_point_varying_size_varying_color_vert.glsl") -FRAGMENT_SOURCE("gpu_shader_point_varying_color_frag.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC2, "pos") + .vertex_in(1, Type::FLOAT, "size") + .vertex_in(2, Type::VEC4, "color") + .vertex_out(smooth_color_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .vertex_source("gpu_shader_2D_point_varying_size_varying_color_vert.glsl") + .fragment_source("gpu_shader_point_varying_color_frag.glsl") + .do_static_compilation(true); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_widget_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_widget_info.hh index 4375d4cc22e..bf5bd6d8d9f 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_widget_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_widget_info.hh @@ -10,62 +10,56 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_INTERFACE_INFO(gpu_widget_iface) -FLAT(FLOAT, discardFac) -FLAT(FLOAT, lineWidth) -FLAT(VEC2, outRectSize) -FLAT(VEC4, borderColor) -FLAT(VEC4, embossColor) -FLAT(VEC4, outRoundCorners) -NO_PERSPECTIVE(FLOAT, butCo) -NO_PERSPECTIVE(VEC2, uvInterp) -NO_PERSPECTIVE(VEC4, innerColor) -GPU_SHADER_INTERFACE_END() + .flat(Type::FLOAT, "discardFac") + .flat(Type::FLOAT, "lineWidth") + .flat(Type::VEC2, "outRectSize") + .flat(Type::VEC4, "borderColor") + .flat(Type::VEC4, "embossColor") + .flat(Type::VEC4, "outRoundCorners") + .no_perspective(Type::FLOAT, "butCo") + .no_perspective(Type::VEC2, "uvInterp") + .no_perspective(Type::VEC4, "innerColor"); /* TODO(fclem): Share with C code. */ #define MAX_PARAM 12 #define MAX_INSTANCE 6 GPU_SHADER_CREATE_INFO(gpu_shader_2D_widget_shared) -DEFINE_VALUE("MAX_PARAM", STRINGIFY(MAX_PARAM)) -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -PUSH_CONSTANT(VEC3, checkerColorAndSize) -VERTEX_OUT(gpu_widget_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("gpu_shader_2D_widget_base_vert.glsl") -FRAGMENT_SOURCE("gpu_shader_2D_widget_base_frag.glsl") -ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) -GPU_SHADER_CREATE_END() + .define("MAX_PARAM", STRINGIFY(MAX_PARAM)) + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .push_constant(Type::VEC3, "checkerColorAndSize") + .vertex_out(gpu_widget_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("gpu_shader_2D_widget_base_vert.glsl") + .fragment_source("gpu_shader_2D_widget_base_frag.glsl") + .additional_info("gpu_srgb_to_framebuffer_space"); GPU_SHADER_CREATE_INFO(gpu_shader_2D_widget_base) -DO_STATIC_COMPILATION() -/* gl_InstanceID is supposed to be 0 if not drawing instances, but this seems - * to be violated in some drivers. For example, macOS 10.15.4 and Intel Iris - * causes #78307 when using gl_InstanceID outside of instance. */ -DEFINE_VALUE("widgetID", "0") -PUSH_CONSTANT_ARRAY(VEC4, parameters, MAX_PARAM) -ADDITIONAL_INFO(gpu_shader_2D_widget_shared) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + /* gl_InstanceID is supposed to be 0 if not drawing instances, but this seems + * to be violated in some drivers. For example, macOS 10.15.4 and Intel Iris + * causes #78307 when using gl_InstanceID outside of instance. */ + .define("widgetID", "0") + .push_constant(Type::VEC4, "parameters", MAX_PARAM) + .additional_info("gpu_shader_2D_widget_shared"); GPU_SHADER_CREATE_INFO(gpu_shader_2D_widget_base_inst) -DO_STATIC_COMPILATION() -DEFINE_VALUE("widgetID", "gl_InstanceID") -PUSH_CONSTANT_ARRAY(VEC4, parameters, (MAX_PARAM * MAX_INSTANCE)) -ADDITIONAL_INFO(gpu_shader_2D_widget_shared) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("widgetID", "gl_InstanceID") + .push_constant(Type::VEC4, "parameters", (MAX_PARAM * MAX_INSTANCE)) + .additional_info("gpu_shader_2D_widget_shared"); GPU_SHADER_INTERFACE_INFO(gpu_widget_shadow_iface) -SMOOTH(FLOAT, shadowFalloff) -SMOOTH(FLOAT, innerMask) -GPU_SHADER_INTERFACE_END() + .smooth(Type::FLOAT, "shadowFalloff") + .smooth(Type::FLOAT, "innerMask"); GPU_SHADER_CREATE_INFO(gpu_shader_2D_widget_shadow) -DO_STATIC_COMPILATION() -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -PUSH_CONSTANT_ARRAY(VEC4, parameters, 4) -PUSH_CONSTANT(FLOAT, alpha) -VERTEX_IN(0, UINT, vflag) -VERTEX_OUT(gpu_widget_shadow_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("gpu_shader_2D_widget_shadow_vert.glsl") -FRAGMENT_SOURCE("gpu_shader_2D_widget_shadow_frag.glsl") -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .push_constant(Type::VEC4, "parameters", 4) + .push_constant(Type::FLOAT, "alpha") + .vertex_in(0, Type::UINT, "vflag") + .vertex_out(gpu_widget_shadow_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("gpu_shader_2D_widget_shadow_vert.glsl") + .fragment_source("gpu_shader_2D_widget_shadow_frag.glsl"); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_3D_depth_only_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_3D_depth_only_info.hh index 4566e7decf5..795b557ce1d 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_3D_depth_only_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_3D_depth_only_info.hh @@ -10,16 +10,14 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_3D_depth_only) -VERTEX_IN(0, VEC3, pos) -VERTEX_OUT(flat_color_iface) -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -VERTEX_SOURCE("gpu_shader_3D_vert.glsl") -FRAGMENT_SOURCE("gpu_shader_depth_only_frag.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC3, "pos") + .vertex_out(flat_color_iface) + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .vertex_source("gpu_shader_3D_vert.glsl") + .fragment_source("gpu_shader_depth_only_frag.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(gpu_shader_3D_depth_only_clipped) -ADDITIONAL_INFO(gpu_shader_3D_depth_only) -ADDITIONAL_INFO(gpu_clip_planes) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("gpu_shader_3D_depth_only") + .additional_info("gpu_clip_planes") + .do_static_compilation(true); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_3D_flat_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_3D_flat_color_info.hh index 2adef85f16b..eb0479f78c7 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_3D_flat_color_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_3D_flat_color_info.hh @@ -10,19 +10,17 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_3D_flat_color) -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, VEC4, color) -VERTEX_OUT(flat_color_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -VERTEX_SOURCE("gpu_shader_3D_flat_color_vert.glsl") -FRAGMENT_SOURCE("gpu_shader_flat_color_frag.glsl") -ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC4, "color") + .vertex_out(flat_color_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .vertex_source("gpu_shader_3D_flat_color_vert.glsl") + .fragment_source("gpu_shader_flat_color_frag.glsl") + .additional_info("gpu_srgb_to_framebuffer_space") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(gpu_shader_3D_flat_color_clipped) -ADDITIONAL_INFO(gpu_shader_3D_flat_color) -ADDITIONAL_INFO(gpu_clip_planes) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("gpu_shader_3D_flat_color") + .additional_info("gpu_clip_planes") + .do_static_compilation(true); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_3D_image_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_3D_image_info.hh index 34780456701..0ba73b91a5c 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_3D_image_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_3D_image_info.hh @@ -10,24 +10,21 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_3D_image_common) -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, VEC2, texCoord) -VERTEX_OUT(smooth_tex_coord_interp_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -SAMPLER(0, FLOAT_2D, image) -VERTEX_SOURCE("gpu_shader_3D_image_vert.glsl") -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC2, "texCoord") + .vertex_out(smooth_tex_coord_interp_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .sampler(0, ImageType::FLOAT_2D, "image") + .vertex_source("gpu_shader_3D_image_vert.glsl"); GPU_SHADER_CREATE_INFO(gpu_shader_3D_image) -ADDITIONAL_INFO(gpu_shader_3D_image_common) -FRAGMENT_SOURCE("gpu_shader_image_frag.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("gpu_shader_3D_image_common") + .fragment_source("gpu_shader_image_frag.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(gpu_shader_3D_image_color) -ADDITIONAL_INFO(gpu_shader_3D_image_common) -PUSH_CONSTANT(VEC4, color) -FRAGMENT_SOURCE("gpu_shader_image_color_frag.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("gpu_shader_3D_image_common") + .push_constant(Type::VEC4, "color") + .fragment_source("gpu_shader_image_color_frag.glsl") + .do_static_compilation(true); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_3D_point_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_3D_point_info.hh index 6897b437f21..cc3f340edb9 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_3D_point_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_3D_point_info.hh @@ -9,32 +9,29 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_varying_size_varying_color) -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, VEC4, color) -VERTEX_IN(2, FLOAT, size) -VERTEX_OUT(smooth_color_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -VERTEX_SOURCE("gpu_shader_3D_point_varying_size_varying_color_vert.glsl") -FRAGMENT_SOURCE("gpu_shader_point_varying_color_frag.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC4, "color") + .vertex_in(2, Type::FLOAT, "size") + .vertex_out(smooth_color_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .vertex_source("gpu_shader_3D_point_varying_size_varying_color_vert.glsl") + .fragment_source("gpu_shader_point_varying_color_frag.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_uniform_size_uniform_color_aa) -VERTEX_IN(0, VEC3, pos) -VERTEX_OUT(smooth_radii_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -PUSH_CONSTANT(VEC4, color) -PUSH_CONSTANT(FLOAT, size) -VERTEX_SOURCE("gpu_shader_3D_point_uniform_size_aa_vert.glsl") -FRAGMENT_SOURCE("gpu_shader_point_uniform_color_aa_frag.glsl") -ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC3, "pos") + .vertex_out(smooth_radii_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .push_constant(Type::VEC4, "color") + .push_constant(Type::FLOAT, "size") + .vertex_source("gpu_shader_3D_point_uniform_size_aa_vert.glsl") + .fragment_source("gpu_shader_point_uniform_color_aa_frag.glsl") + .additional_info("gpu_srgb_to_framebuffer_space") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_uniform_size_uniform_color_aa_clipped) -ADDITIONAL_INFO(gpu_shader_3D_point_uniform_size_uniform_color_aa) -ADDITIONAL_INFO(gpu_clip_planes) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("gpu_shader_3D_point_uniform_size_uniform_color_aa") + .additional_info("gpu_clip_planes") + .do_static_compilation(true); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_3D_polyline_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_3D_polyline_info.hh index 477d8cd7dcd..bd219140ce0 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_3D_polyline_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_3D_polyline_info.hh @@ -10,108 +10,96 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_NAMED_INTERFACE_INFO(gpu_shader_3D_polyline_iface, interp) -SMOOTH(VEC4, final_color) -SMOOTH(FLOAT, clip) -GPU_SHADER_INTERFACE_END() + .smooth(Type::VEC4, "final_color") + .smooth(Type::FLOAT, "clip"); GPU_SHADER_NAMED_INTERFACE_INFO(gpu_shader_3D_polyline_noperspective_iface, interp_noperspective) -NO_PERSPECTIVE(FLOAT, smoothline) -GPU_SHADER_INTERFACE_END() + .no_perspective(Type::FLOAT, "smoothline"); GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline) -DEFINE_VALUE("SMOOTH_WIDTH", "1.0") -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -PUSH_CONSTANT(VEC2, viewportSize) -PUSH_CONSTANT(FLOAT, lineWidth) -PUSH_CONSTANT(BOOL, lineSmooth) -VERTEX_IN(0, VEC3, pos) -VERTEX_OUT(gpu_shader_3D_polyline_iface) -VERTEX_OUT(gpu_shader_3D_polyline_noperspective_iface) -GEOMETRY_LAYOUT(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) -GEOMETRY_OUT(gpu_shader_3D_polyline_iface) -GEOMETRY_OUT(gpu_shader_3D_polyline_noperspective_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("gpu_shader_3D_polyline_vert.glsl") -GEOMETRY_SOURCE("gpu_shader_3D_polyline_geom.glsl") -FRAGMENT_SOURCE("gpu_shader_3D_polyline_frag.glsl") -ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) -GPU_SHADER_CREATE_END() + .define("SMOOTH_WIDTH", "1.0") + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .push_constant(Type::VEC2, "viewportSize") + .push_constant(Type::FLOAT, "lineWidth") + .push_constant(Type::BOOL, "lineSmooth") + .vertex_in(0, Type::VEC3, "pos") + .vertex_out(gpu_shader_3D_polyline_iface) + .vertex_out(gpu_shader_3D_polyline_noperspective_iface) + .geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) + .geometry_out(gpu_shader_3D_polyline_iface) + .geometry_out(gpu_shader_3D_polyline_noperspective_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("gpu_shader_3D_polyline_vert.glsl") + .geometry_source("gpu_shader_3D_polyline_geom.glsl") + .fragment_source("gpu_shader_3D_polyline_frag.glsl") + .additional_info("gpu_srgb_to_framebuffer_space"); GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_no_geom) -DEFINE_VALUE("SMOOTH_WIDTH", "1.0") -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -PUSH_CONSTANT(VEC2, viewportSize) -PUSH_CONSTANT(FLOAT, lineWidth) -PUSH_CONSTANT(BOOL, lineSmooth) -VERTEX_IN(0, VEC3, pos) -VERTEX_OUT(gpu_shader_3D_polyline_iface) -VERTEX_OUT(gpu_shader_3D_polyline_noperspective_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("gpu_shader_3D_polyline_vert_no_geom.glsl") -FRAGMENT_SOURCE("gpu_shader_3D_polyline_frag.glsl") -ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) -GPU_SHADER_CREATE_END() + .define("SMOOTH_WIDTH", "1.0") + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .push_constant(Type::VEC2, "viewportSize") + .push_constant(Type::FLOAT, "lineWidth") + .push_constant(Type::BOOL, "lineSmooth") + .vertex_in(0, Type::VEC3, "pos") + .vertex_out(gpu_shader_3D_polyline_iface) + .vertex_out(gpu_shader_3D_polyline_noperspective_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("gpu_shader_3D_polyline_vert_no_geom.glsl") + .fragment_source("gpu_shader_3D_polyline_frag.glsl") + .additional_info("gpu_srgb_to_framebuffer_space"); GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_uniform_color) -DO_STATIC_COMPILATION() -DEFINE("UNIFORM") -PUSH_CONSTANT(VEC4, color) -ADDITIONAL_INFO(gpu_shader_3D_polyline) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("UNIFORM") + .push_constant(Type::VEC4, "color") + .additional_info("gpu_shader_3D_polyline"); GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_uniform_color_no_geom) -METAL_BACKEND_ONLY() -DO_STATIC_COMPILATION() -DEFINE("UNIFORM") -PUSH_CONSTANT(VEC4, color) -ADDITIONAL_INFO(gpu_shader_3D_polyline_no_geom) -GPU_SHADER_CREATE_END() + .metal_backend_only(true) + .do_static_compilation(true) + .define("UNIFORM") + .push_constant(Type::VEC4, "color") + .additional_info("gpu_shader_3D_polyline_no_geom"); GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_uniform_color_clipped) -DO_STATIC_COMPILATION() -/* TODO(fclem): Put in a UBO to fit the 128byte requirement. */ -PUSH_CONSTANT(MAT4, ModelMatrix) -PUSH_CONSTANT(VEC4, ClipPlane) -DEFINE("CLIP") -ADDITIONAL_INFO(gpu_shader_3D_polyline_uniform_color) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + /* TODO(fclem): Put in a UBO to fit the 128byte requirement. */ + .push_constant(Type::MAT4, "ModelMatrix") + .push_constant(Type::VEC4, "ClipPlane") + .define("CLIP") + .additional_info("gpu_shader_3D_polyline_uniform_color"); GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_uniform_color_clipped_no_geom) -METAL_BACKEND_ONLY() -DO_STATIC_COMPILATION() -/* TODO(fclem): Put in an UBO to fit the 128byte requirement. */ -PUSH_CONSTANT(MAT4, ModelMatrix) -PUSH_CONSTANT(VEC4, ClipPlane) -DEFINE("CLIP") -ADDITIONAL_INFO(gpu_shader_3D_polyline_uniform_color_no_geom) -GPU_SHADER_CREATE_END() + .metal_backend_only(true) + .do_static_compilation(true) + /* TODO(fclem): Put in an UBO to fit the 128byte requirement. */ + .push_constant(Type::MAT4, "ModelMatrix") + .push_constant(Type::VEC4, "ClipPlane") + .define("CLIP") + .additional_info("gpu_shader_3D_polyline_uniform_color_no_geom"); GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_flat_color) -DO_STATIC_COMPILATION() -DEFINE("FLAT") -VERTEX_IN(1, VEC4, color) -ADDITIONAL_INFO(gpu_shader_3D_polyline) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("FLAT") + .vertex_in(1, Type::VEC4, "color") + .additional_info("gpu_shader_3D_polyline"); GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_flat_color_no_geom) -METAL_BACKEND_ONLY() -DO_STATIC_COMPILATION() -DEFINE("FLAT") -VERTEX_IN(1, VEC4, color) -ADDITIONAL_INFO(gpu_shader_3D_polyline_no_geom) -GPU_SHADER_CREATE_END() + .metal_backend_only(true) + .do_static_compilation(true) + .define("FLAT") + .vertex_in(1, Type::VEC4, "color") + .additional_info("gpu_shader_3D_polyline_no_geom"); GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_smooth_color) -DO_STATIC_COMPILATION() -DEFINE("SMOOTH") -VERTEX_IN(1, VEC4, color) -ADDITIONAL_INFO(gpu_shader_3D_polyline) -GPU_SHADER_CREATE_END() + .do_static_compilation(true) + .define("SMOOTH") + .vertex_in(1, Type::VEC4, "color") + .additional_info("gpu_shader_3D_polyline"); GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_smooth_color_no_geom) -METAL_BACKEND_ONLY() -DO_STATIC_COMPILATION() -DEFINE("SMOOTH") -VERTEX_IN(1, VEC4, color) -ADDITIONAL_INFO(gpu_shader_3D_polyline_no_geom) -GPU_SHADER_CREATE_END() + .metal_backend_only(true) + .do_static_compilation(true) + .define("SMOOTH") + .vertex_in(1, Type::VEC4, "color") + .additional_info("gpu_shader_3D_polyline_no_geom"); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_3D_smooth_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_3D_smooth_color_info.hh index d5989786fb3..d860be2909c 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_3D_smooth_color_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_3D_smooth_color_info.hh @@ -10,19 +10,17 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_3D_smooth_color) -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, VEC4, color) -VERTEX_OUT(smooth_color_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -VERTEX_SOURCE("gpu_shader_3D_smooth_color_vert.glsl") -FRAGMENT_SOURCE("gpu_shader_3D_smooth_color_frag.glsl") -ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC4, "color") + .vertex_out(smooth_color_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .vertex_source("gpu_shader_3D_smooth_color_vert.glsl") + .fragment_source("gpu_shader_3D_smooth_color_frag.glsl") + .additional_info("gpu_srgb_to_framebuffer_space") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(gpu_shader_3D_smooth_color_clipped) -ADDITIONAL_INFO(gpu_shader_3D_smooth_color) -ADDITIONAL_INFO(gpu_clip_planes) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("gpu_shader_3D_smooth_color") + .additional_info("gpu_clip_planes") + .do_static_compilation(true); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_3D_uniform_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_3D_uniform_color_info.hh index 0a347628f51..ff55abdc2b4 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_3D_uniform_color_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_3D_uniform_color_info.hh @@ -9,33 +9,30 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_3D_uniform_color) -VERTEX_IN(0, VEC3, pos) -FRAGMENT_OUT(0, VEC4, fragColor) -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -PUSH_CONSTANT(VEC4, color) -VERTEX_SOURCE("gpu_shader_3D_vert.glsl") -FRAGMENT_SOURCE("gpu_shader_uniform_color_frag.glsl") -ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC3, "pos") + .fragment_out(0, Type::VEC4, "fragColor") + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .push_constant(Type::VEC4, "color") + .vertex_source("gpu_shader_3D_vert.glsl") + .fragment_source("gpu_shader_uniform_color_frag.glsl") + .additional_info("gpu_srgb_to_framebuffer_space") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(gpu_shader_3D_uniform_color_clipped) -ADDITIONAL_INFO(gpu_shader_3D_uniform_color) -ADDITIONAL_INFO(gpu_clip_planes) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("gpu_shader_3D_uniform_color") + .additional_info("gpu_clip_planes") + .do_static_compilation(true); /* Confusing naming convention. But this is a version with only one local clip plane. */ GPU_SHADER_CREATE_INFO(gpu_shader_3D_clipped_uniform_color) -VERTEX_IN(0, VEC3, pos) -FRAGMENT_OUT(0, VEC4, fragColor) -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -PUSH_CONSTANT(VEC4, color) -/* TODO(@fclem): Put those two to one UBO. */ -PUSH_CONSTANT(MAT4, ModelMatrix) -PUSH_CONSTANT(VEC4, ClipPlane) -VERTEX_SOURCE("gpu_shader_3D_clipped_uniform_color_vert.glsl") -FRAGMENT_SOURCE("gpu_shader_uniform_color_frag.glsl") -ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC3, "pos") + .fragment_out(0, Type::VEC4, "fragColor") + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .push_constant(Type::VEC4, "color") + /* TODO(@fclem): Put those two to one UBO. */ + .push_constant(Type::MAT4, "ModelMatrix") + .push_constant(Type::VEC4, "ClipPlane") + .vertex_source("gpu_shader_3D_clipped_uniform_color_vert.glsl") + .fragment_source("gpu_shader_uniform_color_frag.glsl") + .additional_info("gpu_srgb_to_framebuffer_space") + .do_static_compilation(true); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_gpencil_stroke_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_gpencil_stroke_info.hh index eadb4264711..74d8954e2b7 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_gpencil_stroke_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_gpencil_stroke_info.hh @@ -9,43 +9,38 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_NAMED_INTERFACE_INFO(gpencil_stroke_vert_iface, geometry_in) -SMOOTH(VEC4, finalColor) -SMOOTH(FLOAT, finalThickness) -GPU_SHADER_INTERFACE_END() + .smooth(Type::VEC4, "finalColor") + .smooth(Type::FLOAT, "finalThickness"); GPU_SHADER_NAMED_INTERFACE_INFO(gpencil_stroke_geom_iface, geometry_out) -SMOOTH(VEC4, mColor) -SMOOTH(VEC2, mTexCoord) -GPU_SHADER_INTERFACE_END() + .smooth(Type::VEC4, "mColor") + .smooth(Type::VEC2, "mTexCoord"); GPU_SHADER_CREATE_INFO(gpu_shader_gpencil_stroke_base) -VERTEX_IN(0, VEC4, color) -VERTEX_IN(1, VEC3, pos) -VERTEX_IN(2, FLOAT, thickness) -VERTEX_OUT(gpencil_stroke_vert_iface) -FRAGMENT_OUT(0, VEC4, fragColor) + .vertex_in(0, Type::VEC4, "color") + .vertex_in(1, Type::VEC3, "pos") + .vertex_in(2, Type::FLOAT, "thickness") + .vertex_out(gpencil_stroke_vert_iface) + .fragment_out(0, Type::VEC4, "fragColor") -UNIFORM_BUF(0, GPencilStrokeData, gpencil_stroke_data) + .uniform_buf(0, "GPencilStrokeData", "gpencil_stroke_data") -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -PUSH_CONSTANT(MAT4, ProjectionMatrix) -FRAGMENT_SOURCE("gpu_shader_gpencil_stroke_frag.glsl") -TYPEDEF_SOURCE("GPU_shader_shared.hh") -GPU_SHADER_CREATE_END() + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .push_constant(Type::MAT4, "ProjectionMatrix") + .fragment_source("gpu_shader_gpencil_stroke_frag.glsl") + .typedef_source("GPU_shader_shared.hh"); GPU_SHADER_CREATE_INFO(gpu_shader_gpencil_stroke) -ADDITIONAL_INFO(gpu_shader_gpencil_stroke_base) -GEOMETRY_LAYOUT(PrimitiveIn::LINES_ADJACENCY, PrimitiveOut::TRIANGLE_STRIP, 13) -GEOMETRY_OUT(gpencil_stroke_geom_iface) -VERTEX_SOURCE("gpu_shader_gpencil_stroke_vert.glsl") -GEOMETRY_SOURCE("gpu_shader_gpencil_stroke_geom.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("gpu_shader_gpencil_stroke_base") + .geometry_layout(PrimitiveIn::LINES_ADJACENCY, PrimitiveOut::TRIANGLE_STRIP, 13) + .geometry_out(gpencil_stroke_geom_iface) + .vertex_source("gpu_shader_gpencil_stroke_vert.glsl") + .geometry_source("gpu_shader_gpencil_stroke_geom.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(gpu_shader_gpencil_stroke_no_geom) -METAL_BACKEND_ONLY() -DEFINE("USE_GEOMETRY_IFACE_COLOR") -ADDITIONAL_INFO(gpu_shader_gpencil_stroke_base) -VERTEX_OUT(gpencil_stroke_geom_iface) -VERTEX_SOURCE("gpu_shader_gpencil_stroke_vert_no_geom.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .metal_backend_only(true) + .define("USE_GEOMETRY_IFACE_COLOR") + .additional_info("gpu_shader_gpencil_stroke_base") + .vertex_out(gpencil_stroke_geom_iface) + .vertex_source("gpu_shader_gpencil_stroke_vert_no_geom.glsl") + .do_static_compilation(true); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_icon_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_icon_info.hh index 27cdc063cf7..2909b3061ba 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_icon_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_icon_info.hh @@ -10,7 +10,7 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_icon) -DEFINE("DO_CORNER_MASKING") +DEFINE(DO_CORNER_MASKING) VERTEX_OUT(smooth_icon_interp_iface) FRAGMENT_OUT(0, VEC4, fragColor) PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) diff --git a/source/blender/gpu/shaders/infos/gpu_shader_index_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_index_info.hh index 51faa169441..4204416b032 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_index_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_index_info.hh @@ -10,28 +10,25 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_index_2d_array_points) -LOCAL_GROUP_SIZE(16, 16, 1) -PUSH_CONSTANT(INT, elements_per_curve) -PUSH_CONSTANT(INT, ncurves) -STORAGE_BUF(0, WRITE, uint, out_indices[]) -COMPUTE_SOURCE("gpu_shader_index_2d_array_points.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16, 1) + .push_constant(Type::INT, "elements_per_curve") + .push_constant(Type::INT, "ncurves") + .storage_buf(0, Qualifier::WRITE, "uint", "out_indices[]") + .compute_source("gpu_shader_index_2d_array_points.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(gpu_shader_index_2d_array_lines) -LOCAL_GROUP_SIZE(16, 16, 1) -PUSH_CONSTANT(INT, elements_per_curve) -PUSH_CONSTANT(INT, ncurves) -STORAGE_BUF(0, WRITE, uint, out_indices[]) -COMPUTE_SOURCE("gpu_shader_index_2d_array_lines.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16, 1) + .push_constant(Type::INT, "elements_per_curve") + .push_constant(Type::INT, "ncurves") + .storage_buf(0, Qualifier::WRITE, "uint", "out_indices[]") + .compute_source("gpu_shader_index_2d_array_lines.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(gpu_shader_index_2d_array_tris) -LOCAL_GROUP_SIZE(16, 16, 1) -PUSH_CONSTANT(INT, elements_per_curve) -PUSH_CONSTANT(INT, ncurves) -STORAGE_BUF(0, WRITE, uint, out_indices[]) -COMPUTE_SOURCE("gpu_shader_index_2d_array_tris.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(16, 16, 1) + .push_constant(Type::INT, "elements_per_curve") + .push_constant(Type::INT, "ncurves") + .storage_buf(0, Qualifier::WRITE, "uint", "out_indices[]") + .compute_source("gpu_shader_index_2d_array_tris.glsl") + .do_static_compilation(true); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_instance_varying_color_varying_size_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_instance_varying_color_varying_size_info.hh index d21e6257dcb..844f5f4d982 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_instance_varying_color_varying_size_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_instance_varying_color_varying_size_info.hh @@ -10,15 +10,14 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_instance_varying_color_varying_size) -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, VEC4, color) -VERTEX_IN(2, FLOAT, size) -VERTEX_IN(3, MAT4, InstanceModelMatrix) -VERTEX_OUT(flat_color_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -PUSH_CONSTANT(MAT4, ViewProjectionMatrix) -VERTEX_SOURCE("gpu_shader_instance_variying_size_variying_color_vert.glsl") -FRAGMENT_SOURCE("gpu_shader_flat_color_frag.glsl") -ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC4, "color") + .vertex_in(2, Type::FLOAT, "size") + .vertex_in(3, Type::MAT4, "InstanceModelMatrix") + .vertex_out(flat_color_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .push_constant(Type::MAT4, "ViewProjectionMatrix") + .vertex_source("gpu_shader_instance_variying_size_variying_color_vert.glsl") + .fragment_source("gpu_shader_flat_color_frag.glsl") + .additional_info("gpu_srgb_to_framebuffer_space") + .do_static_compilation(true); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_keyframe_shape_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_keyframe_shape_info.hh index a8fa31d6c75..ccb188d5e83 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_keyframe_shape_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_keyframe_shape_info.hh @@ -9,26 +9,24 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_INTERFACE_INFO(keyframe_shape_iface) -FLAT(VEC4, finalColor) -FLAT(VEC4, finalOutlineColor) -FLAT(VEC4, radii) -FLAT(VEC4, thresholds) -FLAT(UINT, finalFlags) -GPU_SHADER_INTERFACE_END() + .flat(Type::VEC4, "finalColor") + .flat(Type::VEC4, "finalOutlineColor") + .flat(Type::VEC4, "radii") + .flat(Type::VEC4, "thresholds") + .flat(Type::UINT, "finalFlags"); GPU_SHADER_CREATE_INFO(gpu_shader_keyframe_shape) -TYPEDEF_SOURCE("GPU_shader_shared.hh") -VERTEX_IN(0, VEC4, color) -VERTEX_IN(1, VEC4, outlineColor) -VERTEX_IN(2, VEC2, pos) -VERTEX_IN(3, FLOAT, size) -VERTEX_IN(4, UINT, flags) -VERTEX_OUT(keyframe_shape_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -PUSH_CONSTANT(VEC2, ViewportSize) -PUSH_CONSTANT(FLOAT, outline_scale) -VERTEX_SOURCE("gpu_shader_keyframe_shape_vert.glsl") -FRAGMENT_SOURCE("gpu_shader_keyframe_shape_frag.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .typedef_source("GPU_shader_shared.hh") + .vertex_in(0, Type::VEC4, "color") + .vertex_in(1, Type::VEC4, "outlineColor") + .vertex_in(2, Type::VEC2, "pos") + .vertex_in(3, Type::FLOAT, "size") + .vertex_in(4, Type::UINT, "flags") + .vertex_out(keyframe_shape_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .push_constant(Type::VEC2, "ViewportSize") + .push_constant(Type::FLOAT, "outline_scale") + .vertex_source("gpu_shader_keyframe_shape_vert.glsl") + .fragment_source("gpu_shader_keyframe_shape_frag.glsl") + .do_static_compilation(true); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_line_dashed_uniform_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_line_dashed_uniform_color_info.hh index 6c0ed1d687a..0d4535f0146 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_line_dashed_uniform_color_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_line_dashed_uniform_color_info.hh @@ -11,31 +11,28 @@ /* We leverage hardware interpolation to compute distance along the line. */ GPU_SHADER_INTERFACE_INFO(gpu_shader_line_dashed_interface) -NO_PERSPECTIVE(VEC2, stipple_start) /* In screen space */ -FLAT(VEC2, stipple_pos) -GPU_SHADER_INTERFACE_END() /* In screen space */ + .no_perspective(Type::VEC2, "stipple_start") /* In screen space */ + .flat(Type::VEC2, "stipple_pos"); /* In screen space */ GPU_SHADER_CREATE_INFO(gpu_shader_3D_line_dashed_uniform_color) -VERTEX_IN(0, VEC3, pos) -VERTEX_OUT(flat_color_iface) -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -PUSH_CONSTANT(VEC2, viewport_size) -PUSH_CONSTANT(FLOAT, dash_width) -PUSH_CONSTANT(FLOAT, udash_factor) /* if > 1.0, solid line. */ -/* TODO(fclem): Remove this. And decide to discard if color2 alpha is 0. */ -PUSH_CONSTANT(INT, colors_len) /* Enabled if > 0, 1 for solid line. */ -PUSH_CONSTANT(VEC4, color) -PUSH_CONSTANT(VEC4, color2) -VERTEX_OUT(gpu_shader_line_dashed_interface) -FRAGMENT_OUT(0, VEC4, fragColor) -VERTEX_SOURCE("gpu_shader_3D_line_dashed_uniform_color_vert.glsl") -FRAGMENT_SOURCE("gpu_shader_2D_line_dashed_frag.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC3, "pos") + .vertex_out(flat_color_iface) + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .push_constant(Type::VEC2, "viewport_size") + .push_constant(Type::FLOAT, "dash_width") + .push_constant(Type::FLOAT, "udash_factor") /* if > 1.0, solid line. */ + /* TODO(fclem): Remove this. And decide to discard if color2 alpha is 0. */ + .push_constant(Type::INT, "colors_len") /* Enabled if > 0, 1 for solid line. */ + .push_constant(Type::VEC4, "color") + .push_constant(Type::VEC4, "color2") + .vertex_out(gpu_shader_line_dashed_interface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("gpu_shader_3D_line_dashed_uniform_color_vert.glsl") + .fragment_source("gpu_shader_2D_line_dashed_frag.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(gpu_shader_3D_line_dashed_uniform_color_clipped) -PUSH_CONSTANT(MAT4, ModelMatrix) -ADDITIONAL_INFO(gpu_shader_3D_line_dashed_uniform_color) -ADDITIONAL_INFO(gpu_clip_planes) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .push_constant(Type::MAT4, "ModelMatrix") + .additional_info("gpu_shader_3D_line_dashed_uniform_color") + .additional_info("gpu_clip_planes") + .do_static_compilation(true); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_print_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_print_info.hh index b8462d05a2b..37defa7d433 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_print_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_print_info.hh @@ -9,7 +9,7 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_print) -STORAGE_BUF_FREQ(GPU_SHADER_PRINTF_SLOT, READ_WRITE, uint, gpu_print_buf[], PASS) -DEFINE_VALUE("GPU_SHADER_PRINTF_MAX_CAPACITY", STRINGIFY(GPU_SHADER_PRINTF_MAX_CAPACITY)) -DEFINE("GPU_PRINT") -GPU_SHADER_CREATE_END() + .storage_buf( + GPU_SHADER_PRINTF_SLOT, Qualifier::READ_WRITE, "uint", "gpu_print_buf[]", Frequency::PASS) + .define("GPU_SHADER_PRINTF_MAX_CAPACITY", STRINGIFY(GPU_SHADER_PRINTF_MAX_CAPACITY)) + .define("GPU_PRINT"); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_sequencer_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_sequencer_info.hh index a7f22cd8aed..f18b1807f61 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_sequencer_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_sequencer_info.hh @@ -10,37 +10,33 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_INTERFACE_INFO(gpu_seq_strip_iface) -NO_PERSPECTIVE(VEC2, co_interp) -FLAT(UINT, strip_id) -GPU_SHADER_INTERFACE_END() + .no_perspective(Type::VEC2, "co_interp") + .flat(Type::UINT, "strip_id"); GPU_SHADER_CREATE_INFO(gpu_shader_sequencer_strips) -VERTEX_OUT(gpu_seq_strip_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -UNIFORM_BUF(0, SeqStripDrawData, strip_data[GPU_SEQ_STRIP_DRAW_DATA_LEN]) -UNIFORM_BUF(1, SeqContextDrawData, context_data) -TYPEDEF_SOURCE("GPU_shader_shared.hh") -VERTEX_SOURCE("gpu_shader_sequencer_strips_vert.glsl") -FRAGMENT_SOURCE("gpu_shader_sequencer_strips_frag.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .vertex_out(gpu_seq_strip_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .uniform_buf(0, "SeqStripDrawData", "strip_data[GPU_SEQ_STRIP_DRAW_DATA_LEN]") + .uniform_buf(1, "SeqContextDrawData", "context_data") + .typedef_source("GPU_shader_shared.hh") + .vertex_source("gpu_shader_sequencer_strips_vert.glsl") + .fragment_source("gpu_shader_sequencer_strips_frag.glsl") + .do_static_compilation(true); GPU_SHADER_INTERFACE_INFO(gpu_seq_thumb_iface) -NO_PERSPECTIVE(VEC2, pos_interp) -NO_PERSPECTIVE(VEC2, texCoord_interp) -FLAT(UINT, thumb_id) -GPU_SHADER_INTERFACE_END() + .no_perspective(Type::VEC2, "pos_interp") + .no_perspective(Type::VEC2, "texCoord_interp") + .flat(Type::UINT, "thumb_id"); GPU_SHADER_CREATE_INFO(gpu_shader_sequencer_thumbs) -VERTEX_OUT(gpu_seq_thumb_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -UNIFORM_BUF(0, SeqStripThumbData, thumb_data[GPU_SEQ_STRIP_DRAW_DATA_LEN]) -UNIFORM_BUF(1, SeqContextDrawData, context_data) -SAMPLER(0, FLOAT_2D, image) -TYPEDEF_SOURCE("GPU_shader_shared.hh") -VERTEX_SOURCE("gpu_shader_sequencer_thumbs_vert.glsl") -FRAGMENT_SOURCE("gpu_shader_sequencer_thumbs_frag.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .vertex_out(gpu_seq_thumb_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .uniform_buf(0, "SeqStripThumbData", "thumb_data[GPU_SEQ_STRIP_DRAW_DATA_LEN]") + .uniform_buf(1, "SeqContextDrawData", "context_data") + .sampler(0, ImageType::FLOAT_2D, "image") + .typedef_source("GPU_shader_shared.hh") + .vertex_source("gpu_shader_sequencer_thumbs_vert.glsl") + .fragment_source("gpu_shader_sequencer_thumbs_frag.glsl") + .do_static_compilation(true); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_simple_lighting_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_simple_lighting_info.hh index 997c15a6a2a..2bc349f4b23 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_simple_lighting_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_simple_lighting_info.hh @@ -8,20 +8,17 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(smooth_normal_iface) -SMOOTH(VEC3, normal) -GPU_SHADER_INTERFACE_END() +GPU_SHADER_INTERFACE_INFO(smooth_normal_iface).smooth(Type::VEC3, "normal"); GPU_SHADER_CREATE_INFO(gpu_shader_simple_lighting) -VERTEX_IN(0, VEC3, pos) -VERTEX_IN(1, VEC3, nor) -VERTEX_OUT(smooth_normal_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -UNIFORM_BUF_FREQ(0, SimpleLightingData, simple_lighting_data, PASS) -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -PUSH_CONSTANT(MAT3, NormalMatrix) -TYPEDEF_SOURCE("GPU_shader_shared.hh") -VERTEX_SOURCE("gpu_shader_3D_normal_vert.glsl") -FRAGMENT_SOURCE("gpu_shader_simple_lighting_frag.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC3, "nor") + .vertex_out(smooth_normal_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .uniform_buf(0, "SimpleLightingData", "simple_lighting_data", Frequency::PASS) + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .push_constant(Type::MAT3, "NormalMatrix") + .typedef_source("GPU_shader_shared.hh") + .vertex_source("gpu_shader_3D_normal_vert.glsl") + .fragment_source("gpu_shader_simple_lighting_frag.glsl") + .do_static_compilation(true); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_test_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_test_info.hh index 216a122dab4..f490f304fb7 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_test_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_test_info.hh @@ -10,159 +10,137 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_test) -TYPEDEF_SOURCE("GPU_shader_shared.hh") -FRAGMENT_OUT(0, UVEC4, out_test) -ADDITIONAL_INFO(draw_fullscreen) -GPU_SHADER_CREATE_END() + .typedef_source("GPU_shader_shared.hh") + .fragment_out(0, Type::UVEC4, "out_test") + .additional_info("draw_fullscreen"); GPU_SHADER_CREATE_INFO(gpu_math_test) -FRAGMENT_SOURCE("gpu_math_test.glsl") -ADDITIONAL_INFO(gpu_shader_test) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .fragment_source("gpu_math_test.glsl") + .additional_info("gpu_shader_test") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(gpu_compute_1d_test) -LOCAL_GROUP_SIZE(1) -IMAGE(1, GPU_RGBA32F, WRITE, FLOAT_1D, img_output) -COMPUTE_SOURCE("gpu_compute_1d_test.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(1) + .image(1, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_1D, "img_output") + .compute_source("gpu_compute_1d_test.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(gpu_compute_2d_test) -LOCAL_GROUP_SIZE(1, 1) -IMAGE(1, GPU_RGBA32F, WRITE, FLOAT_2D, img_output) -COMPUTE_SOURCE("gpu_compute_2d_test.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(1, 1) + .image(1, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "img_output") + .compute_source("gpu_compute_2d_test.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(gpu_compute_ibo_test) -LOCAL_GROUP_SIZE(1) -STORAGE_BUF(0, WRITE, uint, out_indices[]) -COMPUTE_SOURCE("gpu_compute_ibo_test.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(1) + .storage_buf(0, Qualifier::WRITE, "uint", "out_indices[]") + .compute_source("gpu_compute_ibo_test.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(gpu_compute_vbo_test) -LOCAL_GROUP_SIZE(1) -STORAGE_BUF(0, WRITE, vec4, out_positions[]) -COMPUTE_SOURCE("gpu_compute_vbo_test.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(1) + .storage_buf(0, Qualifier::WRITE, "vec4", "out_positions[]") + .compute_source("gpu_compute_vbo_test.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(gpu_compute_ssbo_test) -LOCAL_GROUP_SIZE(1) -STORAGE_BUF(0, WRITE, int, data_out[]) -COMPUTE_SOURCE("gpu_compute_ssbo_test.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(1) + .storage_buf(0, Qualifier::WRITE, "int", "data_out[]") + .compute_source("gpu_compute_ssbo_test.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(gpu_compute_ssbo_binding_test) -LOCAL_GROUP_SIZE(1) -STORAGE_BUF(0, WRITE, int, data0[]) -STORAGE_BUF(1, WRITE, int, data1[]) -COMPUTE_SOURCE("gpu_compute_dummy_test.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(1) + .storage_buf(0, Qualifier::WRITE, "int", "data0[]") + .storage_buf(1, Qualifier::WRITE, "int", "data1[]") + .compute_source("gpu_compute_dummy_test.glsl") + .do_static_compilation(true); /* Push constants. */ GPU_SHADER_CREATE_INFO(gpu_push_constants_base_test) -LOCAL_GROUP_SIZE(1) -STORAGE_BUF(0, WRITE, float, data_out[]) -COMPUTE_SOURCE("gpu_push_constants_test.glsl") -GPU_SHADER_CREATE_END() + .local_group_size(1) + .storage_buf(0, Qualifier::WRITE, "float", "data_out[]") + .compute_source("gpu_push_constants_test.glsl"); GPU_SHADER_CREATE_INFO(gpu_push_constants_test) -ADDITIONAL_INFO(gpu_push_constants_base_test) -PUSH_CONSTANT(FLOAT, float_in) -PUSH_CONSTANT(VEC2, vec2_in) -PUSH_CONSTANT(VEC3, vec3_in) -PUSH_CONSTANT(VEC4, vec4_in) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("gpu_push_constants_base_test") + .push_constant(Type::FLOAT, "float_in") + .push_constant(Type::VEC2, "vec2_in") + .push_constant(Type::VEC3, "vec3_in") + .push_constant(Type::VEC4, "vec4_in") + .do_static_compilation(true); /* Push constants size test. */ GPU_SHADER_CREATE_INFO(gpu_push_constants_128bytes_test) -ADDITIONAL_INFO(gpu_push_constants_test) -PUSH_CONSTANT_ARRAY(FLOAT, filler, 20) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("gpu_push_constants_test") + .push_constant(Type::FLOAT, "filler", 20) + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(gpu_push_constants_256bytes_test) -ADDITIONAL_INFO(gpu_push_constants_128bytes_test) -PUSH_CONSTANT_ARRAY(FLOAT, filler2, 32) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("gpu_push_constants_128bytes_test") + .push_constant(Type::FLOAT, "filler2", 32) + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(gpu_push_constants_512bytes_test) -ADDITIONAL_INFO(gpu_push_constants_256bytes_test) -PUSH_CONSTANT_ARRAY(FLOAT, filler3, 64) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("gpu_push_constants_256bytes_test") + .push_constant(Type::FLOAT, "filler3", 64) + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(gpu_push_constants_8192bytes_test) -ADDITIONAL_INFO(gpu_push_constants_512bytes_test) -PUSH_CONSTANT_ARRAY(FLOAT, filler4, 1920) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("gpu_push_constants_512bytes_test") + .push_constant(Type::FLOAT, "filler4", 1920) + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(gpu_buffer_texture_test) -LOCAL_GROUP_SIZE(1) -SAMPLER(0, FLOAT_BUFFER, bufferTexture) -STORAGE_BUF(0, WRITE, float, data_out[]) -COMPUTE_SOURCE("gpu_buffer_texture_test.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(1) + .sampler(0, ImageType::FLOAT_BUFFER, "bufferTexture") + .storage_buf(0, Qualifier::WRITE, "float", "data_out[]") + .compute_source("gpu_buffer_texture_test.glsl") + .do_static_compilation(true); /* Specialization constants. */ GPU_SHADER_CREATE_INFO(gpu_specialization_constants_base_test) -STORAGE_BUF(0, WRITE, int, data_out[]) -SPECIALIZATION_CONSTANT(FLOAT, float_in, 2) -SPECIALIZATION_CONSTANT(UINT, uint_in, 3) -SPECIALIZATION_CONSTANT(INT, int_in, 4) -SPECIALIZATION_CONSTANT(BOOL, bool_in, true) -GPU_SHADER_CREATE_END() + .storage_buf(0, Qualifier::WRITE, "int", "data_out[]") + .specialization_constant(Type::FLOAT, "float_in", 2) + .specialization_constant(Type::UINT, "uint_in", 3) + .specialization_constant(Type::INT, "int_in", 4) + .specialization_constant(Type::BOOL, "bool_in", true); GPU_SHADER_CREATE_INFO(gpu_compute_specialization_test) -LOCAL_GROUP_SIZE(1) -ADDITIONAL_INFO(gpu_specialization_constants_base_test) -COMPUTE_SOURCE("gpu_specialization_test.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .local_group_size(1) + .additional_info("gpu_specialization_constants_base_test") + .compute_source("gpu_specialization_test.glsl") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(gpu_graphic_specialization_test) -ADDITIONAL_INFO(gpu_specialization_constants_base_test) -VERTEX_SOURCE("gpu_specialization_test.glsl") -FRAGMENT_SOURCE("gpu_specialization_test.glsl") -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .additional_info("gpu_specialization_constants_base_test") + .vertex_source("gpu_specialization_test.glsl") + .fragment_source("gpu_specialization_test.glsl") + .do_static_compilation(true); /* EEVEE test. */ GPU_SHADER_CREATE_INFO(eevee_shadow_test) -FRAGMENT_SOURCE("eevee_shadow_test.glsl") -ADDITIONAL_INFO(gpu_shader_test) -ADDITIONAL_INFO(eevee_shared) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .fragment_source("eevee_shadow_test.glsl") + .additional_info("gpu_shader_test") + .additional_info("eevee_shared") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(eevee_occupancy_test) -FRAGMENT_SOURCE("eevee_occupancy_test.glsl") -ADDITIONAL_INFO(gpu_shader_test) -ADDITIONAL_INFO(eevee_shared) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .fragment_source("eevee_occupancy_test.glsl") + .additional_info("gpu_shader_test") + .additional_info("eevee_shared") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(eevee_gbuffer_normal_test) -FRAGMENT_SOURCE("eevee_gbuffer_normal_test.glsl") -ADDITIONAL_INFO(gpu_shader_test) -ADDITIONAL_INFO(eevee_shared) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .fragment_source("eevee_gbuffer_normal_test.glsl") + .additional_info("gpu_shader_test") + .additional_info("eevee_shared") + .do_static_compilation(true); GPU_SHADER_CREATE_INFO(eevee_gbuffer_closure_test) -FRAGMENT_SOURCE("eevee_gbuffer_closure_test.glsl") -ADDITIONAL_INFO(gpu_shader_test) -ADDITIONAL_INFO(eevee_shared) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .fragment_source("eevee_gbuffer_closure_test.glsl") + .additional_info("gpu_shader_test") + .additional_info("eevee_shared") + .do_static_compilation(true); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_text_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_text_info.hh index 26dd528cc51..cb2b8636f9e 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_text_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_text_info.hh @@ -9,27 +9,25 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_INTERFACE_INFO(text_iface) -FLAT(VEC4, color_flat) -NO_PERSPECTIVE(VEC2, texCoord_interp) -FLAT(INT, glyph_offset) -FLAT(UINT, glyph_flags) -FLAT(IVEC2, glyph_dim) -GPU_SHADER_INTERFACE_END() + .flat(Type::VEC4, "color_flat") + .no_perspective(Type::VEC2, "texCoord_interp") + .flat(Type::INT, "glyph_offset") + .flat(Type::UINT, "glyph_flags") + .flat(Type::IVEC2, "glyph_dim"); GPU_SHADER_CREATE_INFO(gpu_shader_text) -VERTEX_IN(0, VEC4, pos) -VERTEX_IN(1, VEC4, col) -VERTEX_IN(2, IVEC2, glyph_size) -VERTEX_IN(3, INT, offset) -VERTEX_IN(4, UINT, flags) -VERTEX_OUT(text_iface) -FRAGMENT_OUT(0, VEC4, fragColor) -PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -PUSH_CONSTANT(INT, glyph_tex_width_mask) -PUSH_CONSTANT(INT, glyph_tex_width_shift) -SAMPLER_FREQ(0, FLOAT_2D, glyph, PASS) -VERTEX_SOURCE("gpu_shader_text_vert.glsl") -FRAGMENT_SOURCE("gpu_shader_text_frag.glsl") -ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) -DO_STATIC_COMPILATION() -GPU_SHADER_CREATE_END() + .vertex_in(0, Type::VEC4, "pos") + .vertex_in(1, Type::VEC4, "col") + .vertex_in(2, Type ::IVEC2, "glyph_size") + .vertex_in(3, Type ::INT, "offset") + .vertex_in(4, Type ::UINT, "flags") + .vertex_out(text_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .push_constant(Type::MAT4, "ModelViewProjectionMatrix") + .push_constant(Type::INT, "glyph_tex_width_mask") + .push_constant(Type::INT, "glyph_tex_width_shift") + .sampler(0, ImageType::FLOAT_2D, "glyph", Frequency::PASS) + .vertex_source("gpu_shader_text_vert.glsl") + .fragment_source("gpu_shader_text_frag.glsl") + .additional_info("gpu_srgb_to_framebuffer_space") + .do_static_compilation(true); diff --git a/source/blender/gpu/shaders/infos/gpu_srgb_to_framebuffer_space_info.hh b/source/blender/gpu/shaders/infos/gpu_srgb_to_framebuffer_space_info.hh index 62030deda70..37ff2f958b8 100644 --- a/source/blender/gpu/shaders/infos/gpu_srgb_to_framebuffer_space_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_srgb_to_framebuffer_space_info.hh @@ -9,6 +9,5 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_srgb_to_framebuffer_space) -PUSH_CONSTANT(BOOL, srgbTarget) -DEFINE("blender_srgb_to_framebuffer_space(a) a") -GPU_SHADER_CREATE_END() + .push_constant(Type::BOOL, "srgbTarget") + .define("blender_srgb_to_framebuffer_space(a) a"); -- 2.30.2 From d0f7c26cf10c3bef9454b8604a30c8991fa422fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 12:15:06 +0200 Subject: [PATCH 64/90] Mass rename compositor and gpu builtin shaders infos --- .../infos/compositor_alpha_crop_info.hh | 15 +- .../infos/compositor_bilateral_blur_info.hh | 17 +- .../infos/compositor_bokeh_blur_info.hh | 19 +- ...ompositor_bokeh_blur_variable_size_info.hh | 21 +- .../infos/compositor_bokeh_image_info.hh | 19 +- .../shaders/infos/compositor_box_mask_info.hh | 49 ++-- .../infos/compositor_compute_preview_info.hh | 11 +- .../shaders/infos/compositor_convert_info.hh | 99 ++++--- .../infos/compositor_cryptomatte_info.hh | 39 +-- .../shaders/infos/compositor_defocus_info.hh | 55 ++-- .../compositor_deriche_gaussian_blur_info.hh | 36 +-- .../infos/compositor_despeckle_info.hh | 17 +- .../infos/compositor_directional_blur_info.hh | 23 +- .../shaders/infos/compositor_displace_info.hh | 17 +- .../infos/compositor_double_edge_mask_info.hh | 36 +-- .../infos/compositor_edge_filter_info.hh | 15 +- .../infos/compositor_ellipse_mask_info.hh | 49 ++-- .../shaders/infos/compositor_filter_info.hh | 15 +- .../shaders/infos/compositor_flip_info.hh | 15 +- .../shaders/infos/compositor_glare_info.hh | 176 +++++------ .../shaders/infos/compositor_id_mask_info.hh | 13 +- .../infos/compositor_image_crop_info.hh | 13 +- .../shaders/infos/compositor_inpaint_info.hh | 47 +-- .../infos/compositor_jump_flooding_info.hh | 13 +- .../shaders/infos/compositor_keying_info.hh | 89 +++--- .../infos/compositor_keying_screen_info.hh | 17 +- .../shaders/infos/compositor_kuwahara_info.hh | 101 ++++--- .../shaders/infos/compositor_map_uv_info.hh | 25 +- .../compositor_morphological_blur_info.hh | 23 +- ...tor_morphological_distance_feather_info.hh | 27 +- .../compositor_morphological_distance_info.hh | 29 +- ...r_morphological_distance_threshold_info.hh | 17 +- .../compositor_morphological_step_info.hh | 29 +- .../infos/compositor_motion_blur_info.hh | 36 +-- .../infos/compositor_movie_distortion_info.hh | 13 +- .../infos/compositor_normalize_info.hh | 15 +- .../compositor_parallel_reduction_info.hh | 273 ++++++++++-------- .../shaders/infos/compositor_pixelate_info.hh | 13 +- .../infos/compositor_plane_deform_info.hh | 56 ++-- .../compositor_premultiply_alpha_info.hh | 11 +- ...mpositor_projector_lens_distortion_info.hh | 13 +- .../infos/compositor_read_input_info.hh | 45 +-- .../compositor_realize_on_domain_info.hh | 61 ++-- .../infos/compositor_scale_variable_info.hh | 15 +- .../compositor_screen_lens_distortion_info.hh | 25 +- .../shaders/infos/compositor_smaa_info.hh | 90 +++--- .../shaders/infos/compositor_split_info.hh | 27 +- .../compositor_summed_area_table_info.hh | 78 ++--- .../infos/compositor_sun_beams_info.hh | 15 +- .../infos/compositor_symmetric_blur_info.hh | 17 +- ...sitor_symmetric_blur_variable_size_info.hh | 19 +- ...ompositor_symmetric_separable_blur_info.hh | 36 ++- ...etric_separable_blur_variable_size_info.hh | 34 ++- .../compositor_tone_map_photoreceptor_info.hh | 23 +- .../infos/compositor_tone_map_simple_info.hh | 17 +- ...compositor_van_vliet_gaussian_blur_info.hh | 54 ++-- .../infos/compositor_write_output_info.hh | 36 ++- .../infos/compositor_z_combine_info.hh | 57 ++-- .../gpu/shaders/infos/gpu_clip_planes_info.hh | 7 +- 59 files changed, 1229 insertions(+), 1043 deletions(-) diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_alpha_crop_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_alpha_crop_info.hh index 3f45bfbed23..c52918574fc 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_alpha_crop_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_alpha_crop_info.hh @@ -5,10 +5,11 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_alpha_crop) - .local_group_size(16, 16) - .push_constant(Type::IVEC2, "lower_bound") - .push_constant(Type::IVEC2, "upper_bound") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_alpha_crop.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(IVEC2, lower_bound) +PUSH_CONSTANT(IVEC2, upper_bound) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_alpha_crop.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bilateral_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bilateral_blur_info.hh index 48eea13b7da..4494e4140c6 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bilateral_blur_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bilateral_blur_info.hh @@ -5,11 +5,12 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_bilateral_blur) - .local_group_size(16, 16) - .push_constant(Type::INT, "radius") - .push_constant(Type::FLOAT, "threshold") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "determinator_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_bilateral_blur.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, radius) +PUSH_CONSTANT(FLOAT, threshold) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, determinator_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_bilateral_blur.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_blur_info.hh index 0c5a20fea97..32653f00828 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_blur_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_blur_info.hh @@ -5,12 +5,13 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_bokeh_blur) - .local_group_size(16, 16) - .push_constant(Type::INT, "radius") - .push_constant(Type::BOOL, "extend_bounds") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "weights_tx") - .sampler(2, ImageType::FLOAT_2D, "mask_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_bokeh_blur.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, radius) +PUSH_CONSTANT(BOOL, extend_bounds) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, weights_tx) +SAMPLER(2, FLOAT_2D, mask_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_bokeh_blur.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_blur_variable_size_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_blur_variable_size_info.hh index 68c51b1911c..75cd0d0ac45 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_blur_variable_size_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_blur_variable_size_info.hh @@ -5,13 +5,14 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_bokeh_blur_variable_size) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "base_size") - .push_constant(Type::INT, "search_radius") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "weights_tx") - .sampler(2, ImageType::FLOAT_2D, "size_tx") - .sampler(3, ImageType::FLOAT_2D, "mask_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_bokeh_blur_variable_size.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, base_size) +PUSH_CONSTANT(INT, search_radius) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, weights_tx) +SAMPLER(2, FLOAT_2D, size_tx) +SAMPLER(3, FLOAT_2D, mask_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_bokeh_blur_variable_size.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_image_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_image_info.hh index 79f480256f1..9b47779bee7 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_image_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_image_info.hh @@ -5,12 +5,13 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_bokeh_image) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "exterior_angle") - .push_constant(Type::FLOAT, "rotation") - .push_constant(Type::FLOAT, "roundness") - .push_constant(Type::FLOAT, "catadioptric") - .push_constant(Type::FLOAT, "lens_shift") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_bokeh_image.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, exterior_angle) +PUSH_CONSTANT(FLOAT, rotation) +PUSH_CONSTANT(FLOAT, roundness) +PUSH_CONSTANT(FLOAT, catadioptric) +PUSH_CONSTANT(FLOAT, lens_shift) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_bokeh_image.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_box_mask_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_box_mask_info.hh index 068ca5286e3..7f105617489 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_box_mask_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_box_mask_info.hh @@ -5,33 +5,38 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_box_mask_shared) - .local_group_size(16, 16) - .push_constant(Type::IVEC2, "domain_size") - .push_constant(Type::VEC2, "location") - .push_constant(Type::VEC2, "size") - .push_constant(Type::FLOAT, "cos_angle") - .push_constant(Type::FLOAT, "sin_angle") - .sampler(0, ImageType::FLOAT_2D, "base_mask_tx") - .sampler(1, ImageType::FLOAT_2D, "mask_value_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_mask_img") - .compute_source("compositor_box_mask.glsl"); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(IVEC2, domain_size) +PUSH_CONSTANT(VEC2, location) +PUSH_CONSTANT(VEC2, size) +PUSH_CONSTANT(FLOAT, cos_angle) +PUSH_CONSTANT(FLOAT, sin_angle) +SAMPLER(0, FLOAT_2D, base_mask_tx) +SAMPLER(1, FLOAT_2D, mask_value_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_mask_img) +COMPUTE_SOURCE("compositor_box_mask.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_box_mask_add) - .additional_info("compositor_box_mask_shared") - .define("CMP_NODE_MASKTYPE_ADD") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_box_mask_shared) +DEFINE("CMP_NODE_MASKTYPE_ADD") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_box_mask_subtract) - .additional_info("compositor_box_mask_shared") - .define("CMP_NODE_MASKTYPE_SUBTRACT") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_box_mask_shared) +DEFINE("CMP_NODE_MASKTYPE_SUBTRACT") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_box_mask_multiply) - .additional_info("compositor_box_mask_shared") - .define("CMP_NODE_MASKTYPE_MULTIPLY") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_box_mask_shared) +DEFINE("CMP_NODE_MASKTYPE_MULTIPLY") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_box_mask_not) - .additional_info("compositor_box_mask_shared") - .define("CMP_NODE_MASKTYPE_NOT") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_box_mask_shared) +DEFINE("CMP_NODE_MASKTYPE_NOT") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_compute_preview_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_compute_preview_info.hh index 7c542b9fbb2..671f9c43a90 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_compute_preview_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_compute_preview_info.hh @@ -5,8 +5,9 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_compute_preview) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "preview_img") - .compute_source("compositor_compute_preview.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, preview_img) +COMPUTE_SOURCE("compositor_compute_preview.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_convert_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_convert_info.hh index 0fd680bdc9e..d42fb8e3731 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_convert_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_convert_info.hh @@ -5,67 +5,78 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_convert_shared) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .typedef_source("gpu_shader_compositor_type_conversion.glsl") - .compute_source("compositor_convert.glsl"); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +TYPEDEF_SOURCE("gpu_shader_compositor_type_conversion.glsl") +COMPUTE_SOURCE("compositor_convert.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float_to_float) - .additional_info("compositor_convert_shared") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("CONVERT_EXPRESSION(value)", "value") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_convert_shared) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("CONVERT_EXPRESSION(value)", "value") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float_to_vector) - .additional_info("compositor_convert_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("CONVERT_EXPRESSION(value)", "vec4(vec3_from_float(value.x), 1.0)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_convert_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(vec3_from_float(value.x), 1.0)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float_to_color) - .additional_info("compositor_convert_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("CONVERT_EXPRESSION(value)", "vec4_from_float(value.x)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_convert_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4_from_float(value.x)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_color_to_float) - .additional_info("compositor_convert_shared") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("CONVERT_EXPRESSION(value)", "vec4(float_from_vec4(value), vec3(0.0))") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_convert_shared) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(float_from_vec4(value), vec3(0.0))") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_color_to_vector) - .additional_info("compositor_convert_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("CONVERT_EXPRESSION(value)", "value") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_convert_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("CONVERT_EXPRESSION(value)", "value") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_color_to_color) - .additional_info("compositor_convert_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("CONVERT_EXPRESSION(value)", "value") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_convert_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("CONVERT_EXPRESSION(value)", "value") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_vector_to_float) - .additional_info("compositor_convert_shared") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("CONVERT_EXPRESSION(value)", "vec4(float_from_vec3(value.xyz), vec3(0.0))") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_convert_shared) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(float_from_vec3(value.xyz), vec3(0.0))") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_vector_to_vector) - .additional_info("compositor_convert_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("CONVERT_EXPRESSION(value)", "value") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_convert_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("CONVERT_EXPRESSION(value)", "value") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_vector_to_color) - .additional_info("compositor_convert_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("CONVERT_EXPRESSION(value)", "vec4_from_vec3(value.xyz)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_convert_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4_from_vec3(value.xyz)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_color_to_alpha) - .additional_info("compositor_convert_shared") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("CONVERT_EXPRESSION(value)", "vec4(value.a)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_convert_shared) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(value.a)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_cryptomatte_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_cryptomatte_info.hh index 1b68a89843d..2bccba46eb3 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_cryptomatte_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_cryptomatte_info.hh @@ -5,25 +5,28 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_cryptomatte_pick) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "first_layer_tx") - .image(0, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_cryptomatte_pick.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, first_layer_tx) +IMAGE(0, GPU_RGBA32F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_cryptomatte_pick.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_cryptomatte_matte) - .local_group_size(16, 16) - .push_constant(Type::INT, "identifiers_count") - .push_constant(Type::FLOAT, "identifiers", 32) - .sampler(0, ImageType::FLOAT_2D, "layer_tx") - .image(0, GPU_R16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "matte_img") - .compute_source("compositor_cryptomatte_matte.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, identifiers_count) +PUSH_CONSTANT_ARRAY(FLOAT, identifiers, 32) +SAMPLER(0, FLOAT_2D, layer_tx) +IMAGE(0, GPU_R16F, READ_WRITE, FLOAT_2D, matte_img) +COMPUTE_SOURCE("compositor_cryptomatte_matte.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_cryptomatte_image) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "matte_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_cryptomatte_image.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, matte_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_cryptomatte_image.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_defocus_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_defocus_info.hh index 6f92172a59b..36565e25a88 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_defocus_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_defocus_info.hh @@ -5,33 +5,36 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_defocus_radius_from_scale) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "scale") - .push_constant(Type::FLOAT, "max_radius") - .sampler(0, ImageType::FLOAT_2D, "radius_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "radius_img") - .compute_source("compositor_defocus_radius_from_scale.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, scale) +PUSH_CONSTANT(FLOAT, max_radius) +SAMPLER(0, FLOAT_2D, radius_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, radius_img) +COMPUTE_SOURCE("compositor_defocus_radius_from_scale.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_defocus_radius_from_depth) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "f_stop") - .push_constant(Type::FLOAT, "max_radius") - .push_constant(Type::FLOAT, "focal_length") - .push_constant(Type::FLOAT, "pixels_per_meter") - .push_constant(Type::FLOAT, "distance_to_image_of_focus") - .sampler(0, ImageType::FLOAT_2D, "depth_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "radius_img") - .compute_source("compositor_defocus_radius_from_depth.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, f_stop) +PUSH_CONSTANT(FLOAT, max_radius) +PUSH_CONSTANT(FLOAT, focal_length) +PUSH_CONSTANT(FLOAT, pixels_per_meter) +PUSH_CONSTANT(FLOAT, distance_to_image_of_focus) +SAMPLER(0, FLOAT_2D, depth_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, radius_img) +COMPUTE_SOURCE("compositor_defocus_radius_from_depth.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_defocus_blur) - .local_group_size(16, 16) - .push_constant(Type::BOOL, "gamma_correct") - .push_constant(Type::INT, "search_radius") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "weights_tx") - .sampler(2, ImageType::FLOAT_2D, "radius_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_defocus_blur.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(BOOL, gamma_correct) +PUSH_CONSTANT(INT, search_radius) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, weights_tx) +SAMPLER(2, FLOAT_2D, radius_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_defocus_blur.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_deriche_gaussian_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_deriche_gaussian_blur_info.hh index e792aeb0fe4..502703d5dfd 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_deriche_gaussian_blur_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_deriche_gaussian_blur_info.hh @@ -5,22 +5,24 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_deriche_gaussian_blur) - .local_group_size(128, 2) - .push_constant(Type::VEC4, "causal_feedforward_coefficients") - .push_constant(Type::VEC4, "non_causal_feedforward_coefficients") - .push_constant(Type::VEC4, "feedback_coefficients") - .push_constant(Type::FLOAT, "causal_boundary_coefficient") - .push_constant(Type::FLOAT, "non_causal_boundary_coefficient") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "causal_output_img") - .image(1, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "non_causal_output_img") - .compute_source("compositor_deriche_gaussian_blur.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(128, 2) +PUSH_CONSTANT(VEC4, causal_feedforward_coefficients) +PUSH_CONSTANT(VEC4, non_causal_feedforward_coefficients) +PUSH_CONSTANT(VEC4, feedback_coefficients) +PUSH_CONSTANT(FLOAT, causal_boundary_coefficient) +PUSH_CONSTANT(FLOAT, non_causal_boundary_coefficient) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, causal_output_img) +IMAGE(1, GPU_RGBA16F, WRITE, FLOAT_2D, non_causal_output_img) +COMPUTE_SOURCE("compositor_deriche_gaussian_blur.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_deriche_gaussian_blur_sum) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "causal_input_tx") - .sampler(1, ImageType::FLOAT_2D, "non_causal_input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_deriche_gaussian_blur_sum.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, causal_input_tx) +SAMPLER(1, FLOAT_2D, non_causal_input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_deriche_gaussian_blur_sum.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_despeckle_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_despeckle_info.hh index f94bfaa7ea0..156af295157 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_despeckle_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_despeckle_info.hh @@ -5,11 +5,12 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_despeckle) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "threshold") - .push_constant(Type::FLOAT, "neighbor_threshold") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "factor_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_despeckle.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, threshold) +PUSH_CONSTANT(FLOAT, neighbor_threshold) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, factor_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_despeckle.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_directional_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_directional_blur_info.hh index a1058a4e762..bd0d7a2969c 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_directional_blur_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_directional_blur_info.hh @@ -5,14 +5,15 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_directional_blur) - .local_group_size(16, 16) - .push_constant(Type::INT, "iterations") - .push_constant(Type::VEC2, "origin") - .push_constant(Type::VEC2, "translation") - .push_constant(Type::FLOAT, "rotation_sin") - .push_constant(Type::FLOAT, "rotation_cos") - .push_constant(Type::FLOAT, "scale") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_directional_blur.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, iterations) +PUSH_CONSTANT(VEC2, origin) +PUSH_CONSTANT(VEC2, translation) +PUSH_CONSTANT(FLOAT, rotation_sin) +PUSH_CONSTANT(FLOAT, rotation_cos) +PUSH_CONSTANT(FLOAT, scale) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_directional_blur.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_displace_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_displace_info.hh index 4baf9ced1e5..bc0a7ca33bd 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_displace_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_displace_info.hh @@ -5,11 +5,12 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_displace) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "displacement_tx") - .sampler(2, ImageType::FLOAT_2D, "x_scale_tx") - .sampler(3, ImageType::FLOAT_2D, "y_scale_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_displace.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, displacement_tx) +SAMPLER(2, FLOAT_2D, x_scale_tx) +SAMPLER(3, FLOAT_2D, y_scale_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_displace.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_double_edge_mask_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_double_edge_mask_info.hh index 049a6502d5a..b27df720c24 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_double_edge_mask_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_double_edge_mask_info.hh @@ -5,22 +5,24 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_double_edge_mask_compute_boundary) - .local_group_size(16, 16) - .push_constant(Type::BOOL, "include_all_inner_edges") - .push_constant(Type::BOOL, "include_edges_of_image") - .sampler(0, ImageType::FLOAT_2D, "inner_mask_tx") - .sampler(1, ImageType::FLOAT_2D, "outer_mask_tx") - .image(0, GPU_RG16I, Qualifier::WRITE, ImageType::INT_2D, "inner_boundary_img") - .image(1, GPU_RG16I, Qualifier::WRITE, ImageType::INT_2D, "outer_boundary_img") - .compute_source("compositor_double_edge_mask_compute_boundary.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(BOOL, include_all_inner_edges) +PUSH_CONSTANT(BOOL, include_edges_of_image) +SAMPLER(0, FLOAT_2D, inner_mask_tx) +SAMPLER(1, FLOAT_2D, outer_mask_tx) +IMAGE(0, GPU_RG16I, WRITE, INT_2D, inner_boundary_img) +IMAGE(1, GPU_RG16I, WRITE, INT_2D, outer_boundary_img) +COMPUTE_SOURCE("compositor_double_edge_mask_compute_boundary.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_double_edge_mask_compute_gradient) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "inner_mask_tx") - .sampler(1, ImageType::FLOAT_2D, "outer_mask_tx") - .sampler(2, ImageType::INT_2D, "flooded_inner_boundary_tx") - .sampler(3, ImageType::INT_2D, "flooded_outer_boundary_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_double_edge_mask_compute_gradient.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, inner_mask_tx) +SAMPLER(1, FLOAT_2D, outer_mask_tx) +SAMPLER(2, INT_2D, flooded_inner_boundary_tx) +SAMPLER(3, INT_2D, flooded_outer_boundary_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_double_edge_mask_compute_gradient.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_edge_filter_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_edge_filter_info.hh index c524a87c051..2e159f72358 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_edge_filter_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_edge_filter_info.hh @@ -5,10 +5,11 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_edge_filter) - .local_group_size(16, 16) - .push_constant(Type::MAT4, "ukernel") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "factor_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_edge_filter.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(MAT4, ukernel) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, factor_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_edge_filter.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_ellipse_mask_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_ellipse_mask_info.hh index 08776540640..8247ad833ba 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_ellipse_mask_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_ellipse_mask_info.hh @@ -5,33 +5,38 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_ellipse_mask_shared) - .local_group_size(16, 16) - .push_constant(Type::IVEC2, "domain_size") - .push_constant(Type::VEC2, "location") - .push_constant(Type::VEC2, "radius") - .push_constant(Type::FLOAT, "cos_angle") - .push_constant(Type::FLOAT, "sin_angle") - .sampler(0, ImageType::FLOAT_2D, "base_mask_tx") - .sampler(1, ImageType::FLOAT_2D, "mask_value_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_mask_img") - .compute_source("compositor_ellipse_mask.glsl"); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(IVEC2, domain_size) +PUSH_CONSTANT(VEC2, location) +PUSH_CONSTANT(VEC2, radius) +PUSH_CONSTANT(FLOAT, cos_angle) +PUSH_CONSTANT(FLOAT, sin_angle) +SAMPLER(0, FLOAT_2D, base_mask_tx) +SAMPLER(1, FLOAT_2D, mask_value_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_mask_img) +COMPUTE_SOURCE("compositor_ellipse_mask.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_ellipse_mask_add) - .additional_info("compositor_ellipse_mask_shared") - .define("CMP_NODE_MASKTYPE_ADD") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_ellipse_mask_shared) +DEFINE("CMP_NODE_MASKTYPE_ADD") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_ellipse_mask_subtract) - .additional_info("compositor_ellipse_mask_shared") - .define("CMP_NODE_MASKTYPE_SUBTRACT") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_ellipse_mask_shared) +DEFINE("CMP_NODE_MASKTYPE_SUBTRACT") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_ellipse_mask_multiply) - .additional_info("compositor_ellipse_mask_shared") - .define("CMP_NODE_MASKTYPE_MULTIPLY") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_ellipse_mask_shared) +DEFINE("CMP_NODE_MASKTYPE_MULTIPLY") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_ellipse_mask_not) - .additional_info("compositor_ellipse_mask_shared") - .define("CMP_NODE_MASKTYPE_NOT") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_ellipse_mask_shared) +DEFINE("CMP_NODE_MASKTYPE_NOT") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_filter_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_filter_info.hh index 55d9784a75a..685596edcd2 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_filter_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_filter_info.hh @@ -5,10 +5,11 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_filter) - .local_group_size(16, 16) - .push_constant(Type::MAT4, "ukernel") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "factor_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_filter.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(MAT4, ukernel) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, factor_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_filter.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_flip_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_flip_info.hh index 914600e26c1..9fba416e3af 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_flip_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_flip_info.hh @@ -5,10 +5,11 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_flip) - .local_group_size(16, 16) - .push_constant(Type::BOOL, "flip_x") - .push_constant(Type::BOOL, "flip_y") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_flip.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(BOOL, flip_x) +PUSH_CONSTANT(BOOL, flip_y) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_flip.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_glare_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_glare_info.hh index 1b1db807bf4..dae0ecaac31 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_glare_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_glare_info.hh @@ -9,126 +9,140 @@ * ------- */ GPU_SHADER_CREATE_INFO(compositor_glare_highlights) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "threshold") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_glare_highlights.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, threshold) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_glare_highlights.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_glare_mix) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "mix_factor") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "glare_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_glare_mix.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, mix_factor) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, glare_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_glare_mix.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* ------------ * Ghost Glare. * ------------ */ GPU_SHADER_CREATE_INFO(compositor_glare_ghost_base) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "small_ghost_tx") - .sampler(1, ImageType::FLOAT_2D, "big_ghost_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "combined_ghost_img") - .compute_source("compositor_glare_ghost_base.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, small_ghost_tx) +SAMPLER(1, FLOAT_2D, big_ghost_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, combined_ghost_img) +COMPUTE_SOURCE("compositor_glare_ghost_base.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_glare_ghost_accumulate) - .local_group_size(16, 16) - .push_constant(Type::VEC4, "scales") - .push_constant(Type::VEC4, "color_modulators", 4) - .sampler(0, ImageType::FLOAT_2D, "input_ghost_tx") - .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "accumulated_ghost_img") - .compute_source("compositor_glare_ghost_accumulate.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(VEC4, scales) +PUSH_CONSTANT_ARRAY(VEC4, color_modulators, 4) +SAMPLER(0, FLOAT_2D, input_ghost_tx) +IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, accumulated_ghost_img) +COMPUTE_SOURCE("compositor_glare_ghost_accumulate.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* ----------- * Simple Star * ----------- */ GPU_SHADER_CREATE_INFO(compositor_glare_simple_star_horizontal_pass) - .local_group_size(16) - .push_constant(Type::INT, "iterations") - .push_constant(Type::FLOAT, "fade_factor") - .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "horizontal_img") - .compute_source("compositor_glare_simple_star_horizontal_pass.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16) +PUSH_CONSTANT(INT, iterations) +PUSH_CONSTANT(FLOAT, fade_factor) +IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, horizontal_img) +COMPUTE_SOURCE("compositor_glare_simple_star_horizontal_pass.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_glare_simple_star_vertical_pass) - .local_group_size(16) - .push_constant(Type::INT, "iterations") - .push_constant(Type::FLOAT, "fade_factor") - .sampler(0, ImageType::FLOAT_2D, "horizontal_tx") - .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "vertical_img") - .compute_source("compositor_glare_simple_star_vertical_pass.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16) +PUSH_CONSTANT(INT, iterations) +PUSH_CONSTANT(FLOAT, fade_factor) +SAMPLER(0, FLOAT_2D, horizontal_tx) +IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, vertical_img) +COMPUTE_SOURCE("compositor_glare_simple_star_vertical_pass.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_glare_simple_star_diagonal_pass) - .local_group_size(16) - .push_constant(Type::INT, "iterations") - .push_constant(Type::FLOAT, "fade_factor") - .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "diagonal_img") - .compute_source("compositor_glare_simple_star_diagonal_pass.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16) +PUSH_CONSTANT(INT, iterations) +PUSH_CONSTANT(FLOAT, fade_factor) +IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, diagonal_img) +COMPUTE_SOURCE("compositor_glare_simple_star_diagonal_pass.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_glare_simple_star_anti_diagonal_pass) - .local_group_size(16) - .push_constant(Type::INT, "iterations") - .push_constant(Type::FLOAT, "fade_factor") - .sampler(0, ImageType::FLOAT_2D, "diagonal_tx") - .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "anti_diagonal_img") - .compute_source("compositor_glare_simple_star_anti_diagonal_pass.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16) +PUSH_CONSTANT(INT, iterations) +PUSH_CONSTANT(FLOAT, fade_factor) +SAMPLER(0, FLOAT_2D, diagonal_tx) +IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, anti_diagonal_img) +COMPUTE_SOURCE("compositor_glare_simple_star_anti_diagonal_pass.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* ------- * Streaks * ------- */ GPU_SHADER_CREATE_INFO(compositor_glare_streaks_filter) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "color_modulator") - .push_constant(Type::VEC3, "fade_factors") - .push_constant(Type::VEC2, "streak_vector") - .sampler(0, ImageType::FLOAT_2D, "input_streak_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_streak_img") - .compute_source("compositor_glare_streaks_filter.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, color_modulator) +PUSH_CONSTANT(VEC3, fade_factors) +PUSH_CONSTANT(VEC2, streak_vector) +SAMPLER(0, FLOAT_2D, input_streak_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_streak_img) +COMPUTE_SOURCE("compositor_glare_streaks_filter.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_glare_streaks_accumulate) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "attenuation_factor") - .sampler(0, ImageType::FLOAT_2D, "streak_tx") - .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "accumulated_streaks_img") - .compute_source("compositor_glare_streaks_accumulate.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, attenuation_factor) +SAMPLER(0, FLOAT_2D, streak_tx) +IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, accumulated_streaks_img) +COMPUTE_SOURCE("compositor_glare_streaks_accumulate.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* ----- * Bloom * ----- */ GPU_SHADER_CREATE_INFO(compositor_glare_bloom_downsample_shared) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_glare_bloom_downsample.glsl"); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_glare_bloom_downsample.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_glare_bloom_downsample_simple_average) - .define("SIMPLE_AVERAGE") - .additional_info("compositor_glare_bloom_downsample_shared") - .do_static_compilation(true); +DEFINE("SIMPLE_AVERAGE") +ADDITIONAL_INFO(compositor_glare_bloom_downsample_shared) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_glare_bloom_downsample_karis_average) - .define("KARIS_AVERAGE") - .additional_info("compositor_glare_bloom_downsample_shared") - .do_static_compilation(true); +DEFINE("KARIS_AVERAGE") +ADDITIONAL_INFO(compositor_glare_bloom_downsample_shared) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_glare_bloom_upsample) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_glare_bloom_upsample.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_glare_bloom_upsample.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_id_mask_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_id_mask_info.hh index dbdd28d7a84..c72d1f038e6 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_id_mask_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_id_mask_info.hh @@ -5,9 +5,10 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_id_mask) - .local_group_size(16, 16) - .push_constant(Type::INT, "index") - .sampler(0, ImageType::FLOAT_2D, "input_mask_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_mask_img") - .compute_source("compositor_id_mask.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, index) +SAMPLER(0, FLOAT_2D, input_mask_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_mask_img) +COMPUTE_SOURCE("compositor_id_mask.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_image_crop_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_image_crop_info.hh index bcbd1278ed7..6a2a013ee0a 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_image_crop_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_image_crop_info.hh @@ -5,9 +5,10 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_image_crop) - .local_group_size(16, 16) - .push_constant(Type::IVEC2, "lower_bound") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_image_crop.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(IVEC2, lower_bound) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_image_crop.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_inpaint_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_inpaint_info.hh index bb2719992fb..5ffc3867837 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_inpaint_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_inpaint_info.hh @@ -5,29 +5,32 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_inpaint_compute_boundary) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RG16I, Qualifier::WRITE, ImageType::INT_2D, "boundary_img") - .compute_source("compositor_inpaint_compute_boundary.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RG16I, WRITE, INT_2D, boundary_img) +COMPUTE_SOURCE("compositor_inpaint_compute_boundary.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_inpaint_fill_region) - .local_group_size(16, 16) - .push_constant(Type::INT, "max_distance") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::INT_2D, "flooded_boundary_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "filled_region_img") - .image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "distance_to_boundary_img") - .image(2, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "smoothing_radius_img") - .compute_source("compositor_inpaint_fill_region.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, max_distance) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, INT_2D, flooded_boundary_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, filled_region_img) +IMAGE(1, GPU_R16F, WRITE, FLOAT_2D, distance_to_boundary_img) +IMAGE(2, GPU_R16F, WRITE, FLOAT_2D, smoothing_radius_img) +COMPUTE_SOURCE("compositor_inpaint_fill_region.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_inpaint_compute_region) - .local_group_size(16, 16) - .push_constant(Type::INT, "max_distance") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "inpainted_region_tx") - .sampler(2, ImageType::FLOAT_2D, "distance_to_boundary_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_inpaint_compute_region.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, max_distance) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, inpainted_region_tx) +SAMPLER(2, FLOAT_2D, distance_to_boundary_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_inpaint_compute_region.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_jump_flooding_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_jump_flooding_info.hh index 90648beac22..536ad38ef19 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_jump_flooding_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_jump_flooding_info.hh @@ -5,9 +5,10 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_jump_flooding) - .local_group_size(16, 16) - .push_constant(Type::INT, "step_size") - .sampler(0, ImageType::INT_2D, "input_tx") - .image(0, GPU_RG16I, Qualifier::WRITE, ImageType::INT_2D, "output_img") - .compute_source("compositor_jump_flooding.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, step_size) +SAMPLER(0, INT_2D, input_tx) +IMAGE(0, GPU_RG16I, WRITE, INT_2D, output_img) +COMPUTE_SOURCE("compositor_jump_flooding.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_keying_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_keying_info.hh index 479c4ee94bd..748c3a321a2 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_keying_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_keying_info.hh @@ -5,53 +5,58 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_keying_extract_chroma) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_keying_extract_chroma.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_keying_extract_chroma.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_keying_replace_chroma) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "new_chroma_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_keying_replace_chroma.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, new_chroma_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_keying_replace_chroma.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_keying_compute_matte) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "key_balance") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "key_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_keying_compute_matte.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, key_balance) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, key_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_keying_compute_matte.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_keying_tweak_matte) - .local_group_size(16, 16) - .push_constant(Type::BOOL, "compute_edges") - .push_constant(Type::BOOL, "apply_core_matte") - .push_constant(Type::BOOL, "apply_garbage_matte") - .push_constant(Type::INT, "edge_search_radius") - .push_constant(Type::FLOAT, "edge_tolerance") - .push_constant(Type::FLOAT, "black_level") - .push_constant(Type::FLOAT, "white_level") - .sampler(0, ImageType::FLOAT_2D, "input_matte_tx") - .sampler(1, ImageType::FLOAT_2D, "garbage_matte_tx") - .sampler(2, ImageType::FLOAT_2D, "core_matte_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_matte_img") - .image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_edges_img") - .compute_source("compositor_keying_tweak_matte.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(BOOL, compute_edges) +PUSH_CONSTANT(BOOL, apply_core_matte) +PUSH_CONSTANT(BOOL, apply_garbage_matte) +PUSH_CONSTANT(INT, edge_search_radius) +PUSH_CONSTANT(FLOAT, edge_tolerance) +PUSH_CONSTANT(FLOAT, black_level) +PUSH_CONSTANT(FLOAT, white_level) +SAMPLER(0, FLOAT_2D, input_matte_tx) +SAMPLER(1, FLOAT_2D, garbage_matte_tx) +SAMPLER(2, FLOAT_2D, core_matte_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_matte_img) +IMAGE(1, GPU_R16F, WRITE, FLOAT_2D, output_edges_img) +COMPUTE_SOURCE("compositor_keying_tweak_matte.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_keying_compute_image) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "despill_factor") - .push_constant(Type::FLOAT, "despill_balance") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "matte_tx") - .sampler(2, ImageType::FLOAT_2D, "key_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_keying_compute_image.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, despill_factor) +PUSH_CONSTANT(FLOAT, despill_balance) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, matte_tx) +SAMPLER(2, FLOAT_2D, key_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_keying_compute_image.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_keying_screen_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_keying_screen_info.hh index ee1fd91e865..547a2719106 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_keying_screen_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_keying_screen_info.hh @@ -5,11 +5,12 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_keying_screen) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "smoothness") - .push_constant(Type::INT, "number_of_markers") - .storage_buf(0, Qualifier::READ, "vec2", "marker_positions[]") - .storage_buf(1, Qualifier::READ, "vec4", "marker_colors[]") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_keying_screen.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, smoothness) +PUSH_CONSTANT(INT, number_of_markers) +STORAGE_BUF(0, READ, vec2, marker_positions[]) +STORAGE_BUF(1, READ, vec4, marker_colors[]) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_keying_screen.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_kuwahara_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_kuwahara_info.hh index 9aa88260774..d4100fd57e4 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_kuwahara_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_kuwahara_info.hh @@ -5,68 +5,79 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_kuwahara_classic_shared) - .local_group_size(16, 16) - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_kuwahara_classic.glsl"); +LOCAL_GROUP_SIZE(16, 16) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_kuwahara_classic.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_kuwahara_classic_convolution_shared) - .additional_info("compositor_kuwahara_classic_shared") - .sampler(0, ImageType::FLOAT_2D, "input_tx"); +ADDITIONAL_INFO(compositor_kuwahara_classic_shared) +SAMPLER(0, FLOAT_2D, input_tx) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_kuwahara_classic_convolution_constant_size) - .additional_info("compositor_kuwahara_classic_convolution_shared") - .push_constant(Type::INT, "size") - .define("CONSTANT_SIZE") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_kuwahara_classic_convolution_shared) +PUSH_CONSTANT(INT, size) +DEFINE("CONSTANT_SIZE") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_kuwahara_classic_convolution_variable_size) - .additional_info("compositor_kuwahara_classic_convolution_shared") - .sampler(1, ImageType::FLOAT_2D, "size_tx") - .define("VARIABLE_SIZE") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_kuwahara_classic_convolution_shared) +SAMPLER(1, FLOAT_2D, size_tx) +DEFINE("VARIABLE_SIZE") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_kuwahara_classic_summed_area_table_shared) - .additional_info("compositor_kuwahara_classic_shared") - .define("SUMMED_AREA_TABLE") - .sampler(0, ImageType::FLOAT_2D, "table_tx") - .sampler(1, ImageType::FLOAT_2D, "squared_table_tx"); +ADDITIONAL_INFO(compositor_kuwahara_classic_shared) +DEFINE("SUMMED_AREA_TABLE") +SAMPLER(0, FLOAT_2D, table_tx) +SAMPLER(1, FLOAT_2D, squared_table_tx) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_kuwahara_classic_summed_area_table_constant_size) - .additional_info("compositor_kuwahara_classic_summed_area_table_shared") - .push_constant(Type::INT, "size") - .define("CONSTANT_SIZE") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_kuwahara_classic_summed_area_table_shared) +PUSH_CONSTANT(INT, size) +DEFINE("CONSTANT_SIZE") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_kuwahara_classic_summed_area_table_variable_size) - .additional_info("compositor_kuwahara_classic_summed_area_table_shared") - .sampler(2, ImageType::FLOAT_2D, "size_tx") - .define("VARIABLE_SIZE") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_kuwahara_classic_summed_area_table_shared) +SAMPLER(2, FLOAT_2D, size_tx) +DEFINE("VARIABLE_SIZE") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_kuwahara_anisotropic_compute_structure_tensor) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "structure_tensor_img") - .compute_source("compositor_kuwahara_anisotropic_compute_structure_tensor.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, structure_tensor_img) +COMPUTE_SOURCE("compositor_kuwahara_anisotropic_compute_structure_tensor.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_kuwahara_anisotropic_shared) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "eccentricity") - .push_constant(Type::FLOAT, "sharpness") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "structure_tensor_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_kuwahara_anisotropic.glsl"); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, eccentricity) +PUSH_CONSTANT(FLOAT, sharpness) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, structure_tensor_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_kuwahara_anisotropic.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_kuwahara_anisotropic_constant_size) - .additional_info("compositor_kuwahara_anisotropic_shared") - .define("CONSTANT_SIZE") - .push_constant(Type::FLOAT, "size") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_kuwahara_anisotropic_shared) +DEFINE("CONSTANT_SIZE") +PUSH_CONSTANT(FLOAT, size) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_kuwahara_anisotropic_variable_size) - .additional_info("compositor_kuwahara_anisotropic_shared") - .define("VARIABLE_SIZE") - .sampler(2, ImageType::FLOAT_2D, "size_tx") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_kuwahara_anisotropic_shared) +DEFINE("VARIABLE_SIZE") +SAMPLER(2, FLOAT_2D, size_tx) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_map_uv_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_map_uv_info.hh index 73d87a020df..bbdd122cc26 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_map_uv_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_map_uv_info.hh @@ -5,18 +5,21 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_map_uv_shared) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "uv_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img"); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, uv_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_map_uv_anisotropic) - .additional_info("compositor_map_uv_shared") - .push_constant(Type::FLOAT, "gradient_attenuation_factor") - .compute_source("compositor_map_uv_anisotropic.glsl") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_map_uv_shared) +PUSH_CONSTANT(FLOAT, gradient_attenuation_factor) +COMPUTE_SOURCE("compositor_map_uv_anisotropic.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_map_uv_nearest_neighbour) - .additional_info("compositor_map_uv_shared") - .compute_source("compositor_map_uv_nearest_neighbour.glsl") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_map_uv_shared) +COMPUTE_SOURCE("compositor_map_uv_nearest_neighbour.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_blur_info.hh index 0a6098b1e32..6d0035aa02a 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_blur_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_blur_info.hh @@ -5,17 +5,20 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_morphological_blur_shared) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_R16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "blurred_input_img") - .compute_source("compositor_morphological_blur.glsl"); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_R16F, READ_WRITE, FLOAT_2D, blurred_input_img) +COMPUTE_SOURCE("compositor_morphological_blur.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_morphological_blur_dilate) - .additional_info("compositor_morphological_blur_shared") - .define("OPERATOR(x, y)", "max(x, y)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_morphological_blur_shared) +DEFINE_VALUE("OPERATOR(x, y)", "max(x, y)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_morphological_blur_erode) - .additional_info("compositor_morphological_blur_shared") - .define("OPERATOR(x, y)", "min(x, y)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_morphological_blur_shared) +DEFINE_VALUE("OPERATOR(x, y)", "min(x, y)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_feather_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_feather_info.hh index bc777cbd9af..d45c808f6fb 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_feather_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_feather_info.hh @@ -5,19 +5,22 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_morphological_distance_feather_shared) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_1D, "weights_tx") - .sampler(2, ImageType::FLOAT_1D, "falloffs_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_morphological_distance_feather.glsl"); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_1D, weights_tx) +SAMPLER(2, FLOAT_1D, falloffs_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_morphological_distance_feather.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_morphological_distance_feather_dilate) - .additional_info("compositor_morphological_distance_feather_shared") - .define("FUNCTION(x)", "x") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_morphological_distance_feather_shared) +DEFINE_VALUE("FUNCTION(x)", "x") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_morphological_distance_feather_erode) - .additional_info("compositor_morphological_distance_feather_shared") - .define("FUNCTION(x)", "1.0 - x") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_morphological_distance_feather_shared) +DEFINE_VALUE("FUNCTION(x)", "1.0 - x") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_info.hh index 8eca47d6012..11aefeef699 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_info.hh @@ -5,20 +5,23 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_morphological_distance_shared) - .local_group_size(16, 16) - .push_constant(Type::INT, "radius") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_morphological_distance.glsl"); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, radius) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_morphological_distance.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_morphological_distance_dilate) - .additional_info("compositor_morphological_distance_shared") - .define("OPERATOR(a, b)", "max(a, b)") - .define("LIMIT", "FLT_MIN") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_morphological_distance_shared) +DEFINE_VALUE("OPERATOR(a, b)", "max(a, b)") +DEFINE_VALUE("LIMIT", "FLT_MIN") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_morphological_distance_erode) - .additional_info("compositor_morphological_distance_shared") - .define("OPERATOR(a, b)", "min(a, b)") - .define("LIMIT", "FLT_MAX") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_morphological_distance_shared) +DEFINE_VALUE("OPERATOR(a, b)", "min(a, b)") +DEFINE_VALUE("LIMIT", "FLT_MAX") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_threshold_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_threshold_info.hh index cd5bad139a4..7d7d710f26e 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_threshold_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_threshold_info.hh @@ -5,11 +5,12 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_morphological_distance_threshold) - .local_group_size(16, 16) - .push_constant(Type::INT, "radius") - .push_constant(Type::INT, "distance") - .push_constant(Type::FLOAT, "inset") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_morphological_distance_threshold.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, radius) +PUSH_CONSTANT(INT, distance) +PUSH_CONSTANT(FLOAT, inset) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_morphological_distance_threshold.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_step_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_step_info.hh index 0d58f27b757..0b3fc35d23b 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_step_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_step_info.hh @@ -5,20 +5,23 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_morphological_step_shared) - .local_group_size(16, 16) - .push_constant(Type::INT, "radius") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_morphological_step.glsl"); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, radius) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_morphological_step.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_morphological_step_dilate) - .additional_info("compositor_morphological_step_shared") - .define("OPERATOR(a, b)", "max(a, b)") - .define("LIMIT", "FLT_MIN") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_morphological_step_shared) +DEFINE_VALUE("OPERATOR(a, b)", "max(a, b)") +DEFINE_VALUE("LIMIT", "FLT_MIN") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_morphological_step_erode) - .additional_info("compositor_morphological_step_shared") - .define("OPERATOR(a, b)", "min(a, b)") - .define("LIMIT", "FLT_MAX") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_morphological_step_shared) +DEFINE_VALUE("OPERATOR(a, b)", "min(a, b)") +DEFINE_VALUE("LIMIT", "FLT_MAX") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_motion_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_motion_blur_info.hh index 446090c63a2..8f3fe0a8529 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_motion_blur_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_motion_blur_info.hh @@ -5,22 +5,24 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_motion_blur_max_velocity_dilate) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "shutter_speed") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .storage_buf(0, Qualifier::READ_WRITE, "uint", "tile_indirection_buf[]") - .compute_source("compositor_motion_blur_max_velocity_dilate.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, shutter_speed) +SAMPLER(0, FLOAT_2D, input_tx) +STORAGE_BUF(0, READ_WRITE, uint, tile_indirection_buf[]) +COMPUTE_SOURCE("compositor_motion_blur_max_velocity_dilate.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_motion_blur) - .local_group_size(16, 16) - .push_constant(Type::INT, "samples_count") - .push_constant(Type::FLOAT, "shutter_speed") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "depth_tx") - .sampler(2, ImageType::FLOAT_2D, "velocity_tx") - .sampler(3, ImageType::FLOAT_2D, "max_velocity_tx") - .storage_buf(0, Qualifier::READ, "uint", "tile_indirection_buf[]") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_motion_blur.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, samples_count) +PUSH_CONSTANT(FLOAT, shutter_speed) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, depth_tx) +SAMPLER(2, FLOAT_2D, velocity_tx) +SAMPLER(3, FLOAT_2D, max_velocity_tx) +STORAGE_BUF(0, READ, uint, tile_indirection_buf[]) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_motion_blur.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_movie_distortion_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_movie_distortion_info.hh index a18504ba48f..3469a8b7823 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_movie_distortion_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_movie_distortion_info.hh @@ -5,9 +5,10 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_movie_distortion) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "distortion_grid_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_movie_distortion.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, distortion_grid_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_movie_distortion.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_normalize_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_normalize_info.hh index 284f8dbfaca..21ad46b0953 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_normalize_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_normalize_info.hh @@ -5,10 +5,11 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_normalize) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "minimum") - .push_constant(Type::FLOAT, "scale") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_normalize.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, minimum) +PUSH_CONSTANT(FLOAT, scale) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_normalize.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_parallel_reduction_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_parallel_reduction_info.hh index b0859269a99..34cecf19ca7 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_parallel_reduction_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_parallel_reduction_info.hh @@ -5,189 +5,210 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_parallel_reduction_shared) - .local_group_size(16, 16) - .push_constant(Type::BOOL, "is_initial_reduction") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .compute_source("compositor_parallel_reduction.glsl"); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(BOOL, is_initial_reduction) +SAMPLER(0, FLOAT_2D, input_tx) +COMPUTE_SOURCE("compositor_parallel_reduction.glsl") +GPU_SHADER_CREATE_END() /* -------------------------------------------------------------------- * Sum Reductions. */ GPU_SHADER_CREATE_INFO(compositor_sum_shared) - .additional_info("compositor_parallel_reduction_shared") - .define("REDUCE(lhs, rhs)", "lhs + rhs"); +ADDITIONAL_INFO(compositor_parallel_reduction_shared) +DEFINE_VALUE("REDUCE(lhs, rhs)", "lhs + rhs") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_sum_float_shared) - .additional_info("compositor_sum_shared") - .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("TYPE", "float") - .define("IDENTITY", "0.0") - .define("LOAD(value)", "value.x"); +ADDITIONAL_INFO(compositor_sum_shared) +IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("TYPE", "float") +DEFINE_VALUE("IDENTITY", "0.0") +DEFINE_VALUE("LOAD(value)", "value.x") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_sum_red) - .additional_info("compositor_sum_float_shared") - .define("INITIALIZE(value)", "value.r") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_sum_float_shared) +DEFINE_VALUE("INITIALIZE(value)", "value.r") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_sum_green) - .additional_info("compositor_sum_float_shared") - .define("INITIALIZE(value)", "value.g") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_sum_float_shared) +DEFINE_VALUE("INITIALIZE(value)", "value.g") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_sum_blue) - .additional_info("compositor_sum_float_shared") - .define("INITIALIZE(value)", "value.b") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_sum_float_shared) +DEFINE_VALUE("INITIALIZE(value)", "value.b") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_sum_luminance) - .additional_info("compositor_sum_float_shared") - .push_constant(Type::VEC3, "luminance_coefficients") - .define("INITIALIZE(value)", "dot(value.rgb, luminance_coefficients)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_sum_float_shared) +PUSH_CONSTANT(VEC3, luminance_coefficients) +DEFINE_VALUE("INITIALIZE(value)", "dot(value.rgb, luminance_coefficients)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_sum_log_luminance) - .additional_info("compositor_sum_float_shared") - .push_constant(Type::VEC3, "luminance_coefficients") - .define("INITIALIZE(value)", "log(max(dot(value.rgb, luminance_coefficients), 1e-5))") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_sum_float_shared) +PUSH_CONSTANT(VEC3, luminance_coefficients) +DEFINE_VALUE("INITIALIZE(value)", "log(max(dot(value.rgb, luminance_coefficients), 1e-5))") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_sum_color) - .additional_info("compositor_sum_shared") - .image(0, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("TYPE", "vec4") - .define("IDENTITY", "vec4(0.0)") - .define("INITIALIZE(value)", "value") - .define("LOAD(value)", "value") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_sum_shared) +IMAGE(0, GPU_RGBA32F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("TYPE", "vec4") +DEFINE_VALUE("IDENTITY", "vec4(0.0)") +DEFINE_VALUE("INITIALIZE(value)", "value") +DEFINE_VALUE("LOAD(value)", "value") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* -------------------------------------------------------------------- * Sum Of Squared Difference Reductions. */ GPU_SHADER_CREATE_INFO(compositor_sum_squared_difference_float_shared) - .additional_info("compositor_parallel_reduction_shared") - .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .push_constant(Type::FLOAT, "subtrahend") - .define("TYPE", "float") - .define("IDENTITY", "0.0") - .define("LOAD(value)", "value.x") - .define("REDUCE(lhs, rhs)", "lhs + rhs"); +ADDITIONAL_INFO(compositor_parallel_reduction_shared) +IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, output_img) +PUSH_CONSTANT(FLOAT, subtrahend) +DEFINE_VALUE("TYPE", "float") +DEFINE_VALUE("IDENTITY", "0.0") +DEFINE_VALUE("LOAD(value)", "value.x") +DEFINE_VALUE("REDUCE(lhs, rhs)", "lhs + rhs") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_sum_red_squared_difference) - .additional_info("compositor_sum_squared_difference_float_shared") - .define("INITIALIZE(value)", "pow(value.r - subtrahend, 2.0)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_sum_squared_difference_float_shared) +DEFINE_VALUE("INITIALIZE(value)", "pow(value.r - subtrahend, 2.0)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_sum_green_squared_difference) - .additional_info("compositor_sum_squared_difference_float_shared") - .define("INITIALIZE(value)", "pow(value.g - subtrahend, 2.0)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_sum_squared_difference_float_shared) +DEFINE_VALUE("INITIALIZE(value)", "pow(value.g - subtrahend, 2.0)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_sum_blue_squared_difference) - .additional_info("compositor_sum_squared_difference_float_shared") - .define("INITIALIZE(value)", "pow(value.b - subtrahend, 2.0)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_sum_squared_difference_float_shared) +DEFINE_VALUE("INITIALIZE(value)", "pow(value.b - subtrahend, 2.0)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_sum_luminance_squared_difference) - .additional_info("compositor_sum_squared_difference_float_shared") - .push_constant(Type::VEC3, "luminance_coefficients") - .define("INITIALIZE(value)", "pow(dot(value.rgb, luminance_coefficients) - subtrahend, 2.0)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_sum_squared_difference_float_shared) +PUSH_CONSTANT(VEC3, luminance_coefficients) +DEFINE_VALUE("INITIALIZE(value)", "pow(dot(value.rgb, luminance_coefficients) - subtrahend, 2.0)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* -------------------------------------------------------------------- * Maximum Reductions. */ GPU_SHADER_CREATE_INFO(compositor_maximum_luminance) - .additional_info("compositor_parallel_reduction_shared") - .typedef_source("common_math_lib.glsl") - .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .push_constant(Type::VEC3, "luminance_coefficients") - .define("TYPE", "float") - .define("IDENTITY", "FLT_MIN") - .define("INITIALIZE(value)", "dot(value.rgb, luminance_coefficients)") - .define("LOAD(value)", "value.x") - .define("REDUCE(lhs, rhs)", "max(lhs, rhs)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_parallel_reduction_shared) +TYPEDEF_SOURCE("common_math_lib.glsl") +IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, output_img) +PUSH_CONSTANT(VEC3, luminance_coefficients) +DEFINE_VALUE("TYPE", "float") +DEFINE_VALUE("IDENTITY", "FLT_MIN") +DEFINE_VALUE("INITIALIZE(value)", "dot(value.rgb, luminance_coefficients)") +DEFINE_VALUE("LOAD(value)", "value.x") +DEFINE_VALUE("REDUCE(lhs, rhs)", "max(lhs, rhs)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_maximum_float) - .additional_info("compositor_parallel_reduction_shared") - .typedef_source("common_math_lib.glsl") - .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("TYPE", "float") - .define("IDENTITY", "FLT_MIN") - .define("INITIALIZE(value)", "value.x") - .define("LOAD(value)", "value.x") - .define("REDUCE(lhs, rhs)", "max(rhs, lhs)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_parallel_reduction_shared) +TYPEDEF_SOURCE("common_math_lib.glsl") +IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("TYPE", "float") +DEFINE_VALUE("IDENTITY", "FLT_MIN") +DEFINE_VALUE("INITIALIZE(value)", "value.x") +DEFINE_VALUE("LOAD(value)", "value.x") +DEFINE_VALUE("REDUCE(lhs, rhs)", "max(rhs, lhs)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_maximum_float_in_range) - .additional_info("compositor_parallel_reduction_shared") - .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .push_constant(Type::FLOAT, "lower_bound") - .push_constant(Type::FLOAT, "upper_bound") - .define("TYPE", "float") - .define("IDENTITY", "lower_bound") - .define("INITIALIZE(v)", "((v.x <= upper_bound) && (v.x >= lower_bound)) ? v.x : lower_bound") - .define("LOAD(value)", "value.x") - .define("REDUCE(lhs, rhs)", "((rhs > lhs) && (rhs <= upper_bound)) ? rhs : lhs") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_parallel_reduction_shared) +IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, output_img) +PUSH_CONSTANT(FLOAT, lower_bound) +PUSH_CONSTANT(FLOAT, upper_bound) +DEFINE_VALUE("TYPE", "float") +DEFINE_VALUE("IDENTITY", "lower_bound") +DEFINE_VALUE("INITIALIZE(v)", "((v.x <= upper_bound) && (v.x >= lower_bound)) ? v.x : lower_bound") +DEFINE_VALUE("LOAD(value)", "value.x") +DEFINE_VALUE("REDUCE(lhs, rhs)", "((rhs > lhs) && (rhs <= upper_bound)) ? rhs : lhs") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* -------------------------------------------------------------------- * Minimum Reductions. */ GPU_SHADER_CREATE_INFO(compositor_minimum_luminance) - .additional_info("compositor_parallel_reduction_shared") - .typedef_source("common_math_lib.glsl") - .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .push_constant(Type::VEC3, "luminance_coefficients") - .define("TYPE", "float") - .define("IDENTITY", "FLT_MAX") - .define("INITIALIZE(value)", "dot(value.rgb, luminance_coefficients)") - .define("LOAD(value)", "value.x") - .define("REDUCE(lhs, rhs)", "min(lhs, rhs)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_parallel_reduction_shared) +TYPEDEF_SOURCE("common_math_lib.glsl") +IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, output_img) +PUSH_CONSTANT(VEC3, luminance_coefficients) +DEFINE_VALUE("TYPE", "float") +DEFINE_VALUE("IDENTITY", "FLT_MAX") +DEFINE_VALUE("INITIALIZE(value)", "dot(value.rgb, luminance_coefficients)") +DEFINE_VALUE("LOAD(value)", "value.x") +DEFINE_VALUE("REDUCE(lhs, rhs)", "min(lhs, rhs)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_minimum_float) - .additional_info("compositor_parallel_reduction_shared") - .typedef_source("common_math_lib.glsl") - .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("TYPE", "float") - .define("IDENTITY", "FLT_MAX") - .define("INITIALIZE(value)", "value.x") - .define("LOAD(value)", "value.x") - .define("REDUCE(lhs, rhs)", "min(rhs, lhs)") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_parallel_reduction_shared) +TYPEDEF_SOURCE("common_math_lib.glsl") +IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("TYPE", "float") +DEFINE_VALUE("IDENTITY", "FLT_MAX") +DEFINE_VALUE("INITIALIZE(value)", "value.x") +DEFINE_VALUE("LOAD(value)", "value.x") +DEFINE_VALUE("REDUCE(lhs, rhs)", "min(rhs, lhs)") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_minimum_float_in_range) - .additional_info("compositor_parallel_reduction_shared") - .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .push_constant(Type::FLOAT, "lower_bound") - .push_constant(Type::FLOAT, "upper_bound") - .define("TYPE", "float") - .define("IDENTITY", "upper_bound") - .define("INITIALIZE(v)", "((v.x <= upper_bound) && (v.x >= lower_bound)) ? v.x : upper_bound") - .define("LOAD(value)", "value.x") - .define("REDUCE(lhs, rhs)", "((rhs < lhs) && (rhs >= lower_bound)) ? rhs : lhs") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_parallel_reduction_shared) +IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, output_img) +PUSH_CONSTANT(FLOAT, lower_bound) +PUSH_CONSTANT(FLOAT, upper_bound) +DEFINE_VALUE("TYPE", "float") +DEFINE_VALUE("IDENTITY", "upper_bound") +DEFINE_VALUE("INITIALIZE(v)", "((v.x <= upper_bound) && (v.x >= lower_bound)) ? v.x : upper_bound") +DEFINE_VALUE("LOAD(value)", "value.x") +DEFINE_VALUE("REDUCE(lhs, rhs)", "((rhs < lhs) && (rhs >= lower_bound)) ? rhs : lhs") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* -------------------------------------------------------------------- * Velocity Reductions. */ GPU_SHADER_CREATE_INFO(compositor_max_velocity) - .local_group_size(32, 32) - .push_constant(Type::BOOL, "is_initial_reduction") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("TYPE", "vec4") - .define("IDENTITY", "vec4(0.0)") - .define("INITIALIZE(value)", "value") - .define("LOAD(value)", "value") - .define("REDUCE(lhs, rhs)", - "vec4(dot(lhs.xy, lhs.xy) > dot(rhs.xy, rhs.xy) ? lhs.xy : rhs.xy," - " dot(lhs.zw, lhs.zw) > dot(rhs.zw, rhs.zw) ? lhs.zw : rhs.zw)") - .compute_source("compositor_parallel_reduction.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(32, 32) +PUSH_CONSTANT(BOOL, is_initial_reduction) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("TYPE", "vec4") +DEFINE_VALUE("IDENTITY", "vec4(0.0)") +DEFINE_VALUE("INITIALIZE(value)", "value") +DEFINE_VALUE("LOAD(value)", "value") +DEFINE_VALUE("REDUCE(lhs, rhs)", + "vec4(dot(lhs.xy, lhs.xy) > dot(rhs.xy, rhs.xy) ? lhs.xy : rhs.xy," + " dot(lhs.zw, lhs.zw) > dot(rhs.zw, rhs.zw) ? lhs.zw : rhs.zw)") +COMPUTE_SOURCE("compositor_parallel_reduction.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_pixelate_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_pixelate_info.hh index 47cc6cf4661..8df1a5ec50f 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_pixelate_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_pixelate_info.hh @@ -5,9 +5,10 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_pixelate) - .local_group_size(16, 16) - .push_constant(Type::INT, "pixel_size") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_pixelate.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, pixel_size) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_pixelate.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_plane_deform_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_plane_deform_info.hh index 445896c8b06..1aacbc11796 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_plane_deform_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_plane_deform_info.hh @@ -5,35 +5,39 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_plane_deform_mask) - .local_group_size(16, 16) - .push_constant(Type::MAT4, "homography_matrix") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "mask_img") - .compute_source("compositor_plane_deform_mask.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(MAT4, homography_matrix) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, mask_img) +COMPUTE_SOURCE("compositor_plane_deform_mask.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_plane_deform) - .local_group_size(16, 16) - .push_constant(Type::MAT4, "homography_matrix") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "mask_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_plane_deform.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(MAT4, homography_matrix) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, mask_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_plane_deform.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_plane_deform_motion_blur_mask) - .local_group_size(16, 16) - .push_constant(Type::INT, "number_of_motion_blur_samples") - .uniform_buf(0, "mat4", "homography_matrices[64]") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "mask_img") - .compute_source("compositor_plane_deform_motion_blur_mask.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, number_of_motion_blur_samples) +UNIFORM_BUF(0, mat4, homography_matrices[64]) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, mask_img) +COMPUTE_SOURCE("compositor_plane_deform_motion_blur_mask.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_plane_deform_motion_blur) - .local_group_size(16, 16) - .push_constant(Type::INT, "number_of_motion_blur_samples") - .uniform_buf(0, "mat4", "homography_matrices[64]") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "mask_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_plane_deform_motion_blur.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(INT, number_of_motion_blur_samples) +UNIFORM_BUF(0, mat4, homography_matrices[64]) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, mask_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_plane_deform_motion_blur.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_premultiply_alpha_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_premultiply_alpha_info.hh index c698750269b..1baf1334b5b 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_premultiply_alpha_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_premultiply_alpha_info.hh @@ -5,8 +5,9 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_premultiply_alpha) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_premultiply_alpha.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_premultiply_alpha.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_projector_lens_distortion_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_projector_lens_distortion_info.hh index 1acd02baa42..5425065fbac 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_projector_lens_distortion_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_projector_lens_distortion_info.hh @@ -5,9 +5,10 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_projector_lens_distortion) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "dispersion") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_projector_lens_distortion.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, dispersion) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_projector_lens_distortion.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_read_input_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_read_input_info.hh index a8e80ebb948..0aa1be33ff8 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_read_input_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_read_input_info.hh @@ -5,31 +5,36 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_read_input_shared) - .local_group_size(16, 16) - .push_constant(Type::IVEC2, "lower_bound") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .compute_source("compositor_read_input.glsl"); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(IVEC2, lower_bound) +SAMPLER(0, FLOAT_2D, input_tx) +COMPUTE_SOURCE("compositor_read_input.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_read_input_float) - .additional_info("compositor_read_input_shared") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("READ_EXPRESSION(input_color)", "vec4(input_color.r, vec3(0.0))") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_read_input_shared) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("READ_EXPRESSION(input_color)", "vec4(input_color.r, vec3(0.0))") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_read_input_vector) - .additional_info("compositor_read_input_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("READ_EXPRESSION(input_color)", "input_color") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_read_input_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("READ_EXPRESSION(input_color)", "input_color") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_read_input_color) - .additional_info("compositor_read_input_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("READ_EXPRESSION(input_color)", "input_color") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_read_input_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("READ_EXPRESSION(input_color)", "input_color") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_read_input_alpha) - .additional_info("compositor_read_input_shared") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .define("READ_EXPRESSION(input_color)", "vec4(input_color.a, vec3(0.0))") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_read_input_shared) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +DEFINE_VALUE("READ_EXPRESSION(input_color)", "vec4(input_color.a, vec3(0.0))") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_realize_on_domain_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_realize_on_domain_info.hh index b870d438ad3..725ba946b2f 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_realize_on_domain_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_realize_on_domain_info.hh @@ -5,45 +5,54 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_shared) - .local_group_size(16, 16) - .push_constant(Type::MAT4, "inverse_transformation") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .compute_source("compositor_realize_on_domain.glsl"); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(MAT4, inverse_transformation) +SAMPLER(0, FLOAT_2D, input_tx) +COMPUTE_SOURCE("compositor_realize_on_domain.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_standard_shared) - .additional_info("compositor_realize_on_domain_shared") - .define("SAMPLER_FUNCTION", "texture"); +ADDITIONAL_INFO(compositor_realize_on_domain_shared) +DEFINE_VALUE("SAMPLER_FUNCTION", "texture") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_bicubic_shared) - .additional_info("compositor_realize_on_domain_shared") - .define("SAMPLER_FUNCTION", "texture_bicubic"); +ADDITIONAL_INFO(compositor_realize_on_domain_shared) +DEFINE_VALUE("SAMPLER_FUNCTION", "texture_bicubic") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_color) - .additional_info("compositor_realize_on_domain_standard_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "domain_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_realize_on_domain_standard_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, domain_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_vector) - .additional_info("compositor_realize_on_domain_standard_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "domain_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_realize_on_domain_standard_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, domain_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_float) - .additional_info("compositor_realize_on_domain_standard_shared") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "domain_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_realize_on_domain_standard_shared) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, domain_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_bicubic_color) - .additional_info("compositor_realize_on_domain_bicubic_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "domain_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_realize_on_domain_bicubic_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, domain_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_bicubic_vector) - .additional_info("compositor_realize_on_domain_bicubic_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "domain_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_realize_on_domain_bicubic_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, domain_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_bicubic_float) - .additional_info("compositor_realize_on_domain_bicubic_shared") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "domain_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_realize_on_domain_bicubic_shared) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, domain_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_scale_variable_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_scale_variable_info.hh index 327ded2efab..24d316a2f05 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_scale_variable_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_scale_variable_info.hh @@ -5,10 +5,11 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_scale_variable) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "x_scale_tx") - .sampler(2, ImageType::FLOAT_2D, "y_scale_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_scale_variable.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, x_scale_tx) +SAMPLER(2, FLOAT_2D, y_scale_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_scale_variable.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_screen_lens_distortion_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_screen_lens_distortion_info.hh index e3b03f1e724..742bb2facbd 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_screen_lens_distortion_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_screen_lens_distortion_info.hh @@ -5,18 +5,21 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_screen_lens_distortion_shared) - .local_group_size(16, 16) - .push_constant(Type::VEC3, "chromatic_distortion") - .push_constant(Type::FLOAT, "scale") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_screen_lens_distortion.glsl"); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(VEC3, chromatic_distortion) +PUSH_CONSTANT(FLOAT, scale) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_screen_lens_distortion.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_screen_lens_distortion) - .additional_info("compositor_screen_lens_distortion_shared") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_screen_lens_distortion_shared) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_screen_lens_distortion_jitter) - .additional_info("compositor_screen_lens_distortion_shared") - .define("JITTER") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_screen_lens_distortion_shared) +DEFINE("JITTER") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_smaa_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_smaa_info.hh index 6b12ae4dfff..03169ab921a 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_smaa_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_smaa_info.hh @@ -5,55 +5,61 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_smaa_edge_detection) - .local_group_size(16, 16) - .define("SMAA_GLSL_3") - .define("SMAA_RT_METRICS", - "vec4(1.0 / vec2(textureSize(input_tx, 0)), vec2(textureSize(input_tx, 0)))") - .define("SMAA_LUMA_WEIGHT", "vec4(luminance_coefficients, 0.0)") - .define("SMAA_THRESHOLD", "smaa_threshold") - .define("SMAA_LOCAL_CONTRAST_ADAPTATION_FACTOR", "smaa_local_contrast_adaptation_factor") - .push_constant(Type::VEC3, "luminance_coefficients") - .push_constant(Type::FLOAT, "smaa_threshold") - .push_constant(Type::FLOAT, "smaa_local_contrast_adaptation_factor") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "edges_img") - .compute_source("compositor_smaa_edge_detection.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +DEFINE("SMAA_GLSL_3") +DEFINE_VALUE("SMAA_RT_METRICS", + "vec4(1.0 / vec2(textureSize(input_tx, 0)), vec2(textureSize(input_tx, 0)))") +DEFINE_VALUE("SMAA_LUMA_WEIGHT", "vec4(luminance_coefficients, 0.0)") +DEFINE_VALUE("SMAA_THRESHOLD", "smaa_threshold") +DEFINE_VALUE("SMAA_LOCAL_CONTRAST_ADAPTATION_FACTOR", "smaa_local_contrast_adaptation_factor") +PUSH_CONSTANT(VEC3, luminance_coefficients) +PUSH_CONSTANT(FLOAT, smaa_threshold) +PUSH_CONSTANT(FLOAT, smaa_local_contrast_adaptation_factor) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, edges_img) +COMPUTE_SOURCE("compositor_smaa_edge_detection.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_smaa_blending_weight_calculation) - .local_group_size(16, 16) - .define("SMAA_GLSL_3") - .define("SMAA_RT_METRICS", - "vec4(1.0 / vec2(textureSize(edges_tx, 0)), vec2(textureSize(edges_tx, 0)))") - .define("SMAA_CORNER_ROUNDING", "smaa_corner_rounding") - .push_constant(Type::INT, "smaa_corner_rounding") - .sampler(0, ImageType::FLOAT_2D, "edges_tx") - .sampler(1, ImageType::FLOAT_2D, "area_tx") - .sampler(2, ImageType::FLOAT_2D, "search_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "weights_img") - .compute_source("compositor_smaa_blending_weight_calculation.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +DEFINE("SMAA_GLSL_3") +DEFINE_VALUE("SMAA_RT_METRICS", + "vec4(1.0 / vec2(textureSize(edges_tx, 0)), vec2(textureSize(edges_tx, 0)))") +DEFINE_VALUE("SMAA_CORNER_ROUNDING", "smaa_corner_rounding") +PUSH_CONSTANT(INT, smaa_corner_rounding) +SAMPLER(0, FLOAT_2D, edges_tx) +SAMPLER(1, FLOAT_2D, area_tx) +SAMPLER(2, FLOAT_2D, search_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, weights_img) +COMPUTE_SOURCE("compositor_smaa_blending_weight_calculation.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_smaa_neighborhood_blending_shared) - .local_group_size(16, 16) - .define("SMAA_GLSL_3") - .define("SMAA_RT_METRICS", - "vec4(1.0 / vec2(textureSize(input_tx, 0)), vec2(textureSize(input_tx, 0)))") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "weights_tx") - .compute_source("compositor_smaa_neighborhood_blending.glsl"); +LOCAL_GROUP_SIZE(16, 16) +DEFINE("SMAA_GLSL_3") +DEFINE_VALUE("SMAA_RT_METRICS", + "vec4(1.0 / vec2(textureSize(input_tx, 0)), vec2(textureSize(input_tx, 0)))") +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, weights_tx) +COMPUTE_SOURCE("compositor_smaa_neighborhood_blending.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_smaa_neighborhood_blending_float4) - .additional_info("compositor_smaa_neighborhood_blending_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_smaa_neighborhood_blending_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_smaa_neighborhood_blending_float2) - .additional_info("compositor_smaa_neighborhood_blending_shared") - .image(0, GPU_RG16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_smaa_neighborhood_blending_shared) +IMAGE(0, GPU_RG16F, WRITE, FLOAT_2D, output_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_smaa_neighborhood_blending_float) - .additional_info("compositor_smaa_neighborhood_blending_shared") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_smaa_neighborhood_blending_shared) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_split_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_split_info.hh index 0529a8469f2..863e2244ac0 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_split_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_split_info.hh @@ -5,19 +5,22 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_split_shared) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "split_ratio") - .sampler(0, ImageType::FLOAT_2D, "first_image_tx") - .sampler(1, ImageType::FLOAT_2D, "second_image_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_split.glsl"); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, split_ratio) +SAMPLER(0, FLOAT_2D, first_image_tx) +SAMPLER(1, FLOAT_2D, second_image_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_split.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_split_horizontal) - .additional_info("compositor_split_shared") - .define("SPLIT_HORIZONTAL") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_split_shared) +DEFINE("SPLIT_HORIZONTAL") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_split_vertical) - .additional_info("compositor_split_shared") - .define("SPLIT_VERTICAL") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_split_shared) +DEFINE("SPLIT_VERTICAL") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_summed_area_table_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_summed_area_table_info.hh index 497fd2ea86d..56937b24e26 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_summed_area_table_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_summed_area_table_info.hh @@ -5,52 +5,60 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_summed_area_table_compute_incomplete_prologues_shared) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "incomplete_x_prologues_img") - .image(1, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "incomplete_y_prologues_img") - .compute_source("compositor_summed_area_table_compute_incomplete_prologues.glsl"); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA32F, WRITE, FLOAT_2D, incomplete_x_prologues_img) +IMAGE(1, GPU_RGBA32F, WRITE, FLOAT_2D, incomplete_y_prologues_img) +COMPUTE_SOURCE("compositor_summed_area_table_compute_incomplete_prologues.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_summed_area_table_compute_incomplete_prologues_identity) - .additional_info("compositor_summed_area_table_compute_incomplete_prologues_shared") - .define("OPERATION(value)", "value") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_summed_area_table_compute_incomplete_prologues_shared) +DEFINE_VALUE("OPERATION(value)", "value") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_summed_area_table_compute_incomplete_prologues_square) - .additional_info("compositor_summed_area_table_compute_incomplete_prologues_shared") - .define("OPERATION(value)", "value * value") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_summed_area_table_compute_incomplete_prologues_shared) +DEFINE_VALUE("OPERATION(value)", "value * value") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_summed_area_table_compute_complete_x_prologues) - .local_group_size(16) - .sampler(0, ImageType::FLOAT_2D, "incomplete_x_prologues_tx") - .image(0, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "complete_x_prologues_img") - .image(1, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "complete_x_prologues_sum_img") - .compute_source("compositor_summed_area_table_compute_complete_x_prologues.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16) +SAMPLER(0, FLOAT_2D, incomplete_x_prologues_tx) +IMAGE(0, GPU_RGBA32F, WRITE, FLOAT_2D, complete_x_prologues_img) +IMAGE(1, GPU_RGBA32F, WRITE, FLOAT_2D, complete_x_prologues_sum_img) +COMPUTE_SOURCE("compositor_summed_area_table_compute_complete_x_prologues.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_summed_area_table_compute_complete_y_prologues) - .local_group_size(16) - .sampler(0, ImageType::FLOAT_2D, "incomplete_y_prologues_tx") - .sampler(1, ImageType::FLOAT_2D, "complete_x_prologues_sum_tx") - .image(0, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "complete_y_prologues_img") - .compute_source("compositor_summed_area_table_compute_complete_y_prologues.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16) +SAMPLER(0, FLOAT_2D, incomplete_y_prologues_tx) +SAMPLER(1, FLOAT_2D, complete_x_prologues_sum_tx) +IMAGE(0, GPU_RGBA32F, WRITE, FLOAT_2D, complete_y_prologues_img) +COMPUTE_SOURCE("compositor_summed_area_table_compute_complete_y_prologues.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_summed_area_table_compute_complete_blocks_shared) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "complete_x_prologues_tx") - .sampler(2, ImageType::FLOAT_2D, "complete_y_prologues_tx") - .image(0, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_summed_area_table_compute_complete_blocks.glsl"); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, complete_x_prologues_tx) +SAMPLER(2, FLOAT_2D, complete_y_prologues_tx) +IMAGE(0, GPU_RGBA32F, READ_WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_summed_area_table_compute_complete_blocks.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_summed_area_table_compute_complete_blocks_identity) - .additional_info("compositor_summed_area_table_compute_complete_blocks_shared") - .define("OPERATION(value)", "value") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_summed_area_table_compute_complete_blocks_shared) +DEFINE_VALUE("OPERATION(value)", "value") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_summed_area_table_compute_complete_blocks_square) - .additional_info("compositor_summed_area_table_compute_complete_blocks_shared") - .define("OPERATION(value)", "value * value") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_summed_area_table_compute_complete_blocks_shared) +DEFINE_VALUE("OPERATION(value)", "value * value") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_sun_beams_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_sun_beams_info.hh index f6203e4a39f..227ec2d2639 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_sun_beams_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_sun_beams_info.hh @@ -5,10 +5,11 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_sun_beams) - .local_group_size(16, 16) - .push_constant(Type::VEC2, "source") - .push_constant(Type::INT, "max_steps") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_sun_beams.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(VEC2, source) +PUSH_CONSTANT(INT, max_steps) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_sun_beams.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_blur_info.hh index 8719e6277b1..08babaaeb74 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_blur_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_blur_info.hh @@ -5,11 +5,12 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_symmetric_blur) - .local_group_size(16, 16) - .push_constant(Type::BOOL, "extend_bounds") - .push_constant(Type::BOOL, "gamma_correct") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "weights_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_symmetric_blur.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(BOOL, extend_bounds) +PUSH_CONSTANT(BOOL, gamma_correct) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, weights_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_symmetric_blur.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_blur_variable_size_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_blur_variable_size_info.hh index 76ea55d2851..af5e6626c2b 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_blur_variable_size_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_blur_variable_size_info.hh @@ -5,12 +5,13 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_symmetric_blur_variable_size) - .local_group_size(16, 16) - .push_constant(Type::BOOL, "extend_bounds") - .push_constant(Type::BOOL, "gamma_correct") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_2D, "weights_tx") - .sampler(2, ImageType::FLOAT_2D, "size_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_symmetric_blur_variable_size.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(BOOL, extend_bounds) +PUSH_CONSTANT(BOOL, gamma_correct) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_2D, weights_tx) +SAMPLER(2, FLOAT_2D, size_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_symmetric_blur_variable_size.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_separable_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_separable_blur_info.hh index 7a11dfad94b..7f112c6a349 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_separable_blur_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_separable_blur_info.hh @@ -5,25 +5,29 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_symmetric_separable_blur_shared) - .local_group_size(16, 16) - .push_constant(Type::BOOL, "extend_bounds") - .push_constant(Type::BOOL, "gamma_correct_input") - .push_constant(Type::BOOL, "gamma_uncorrect_output") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_1D, "weights_tx") - .compute_source("compositor_symmetric_separable_blur.glsl"); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(BOOL, extend_bounds) +PUSH_CONSTANT(BOOL, gamma_correct_input) +PUSH_CONSTANT(BOOL, gamma_uncorrect_output) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_1D, weights_tx) +COMPUTE_SOURCE("compositor_symmetric_separable_blur.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_symmetric_separable_blur_float) - .additional_info("compositor_symmetric_separable_blur_shared") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_symmetric_separable_blur_shared) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_symmetric_separable_blur_float2) - .additional_info("compositor_symmetric_separable_blur_shared") - .image(0, GPU_RG16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_symmetric_separable_blur_shared) +IMAGE(0, GPU_RG16F, WRITE, FLOAT_2D, output_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_symmetric_separable_blur_float4) - .additional_info("compositor_symmetric_separable_blur_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_symmetric_separable_blur_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_separable_blur_variable_size_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_separable_blur_variable_size_info.hh index 1528c111b0e..162bfe51762 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_separable_blur_variable_size_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_separable_blur_variable_size_info.hh @@ -5,24 +5,28 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_symmetric_separable_blur_variable_size_shared) - .local_group_size(16, 16) - .push_constant(Type::BOOL, "is_vertical_pass") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .sampler(1, ImageType::FLOAT_1D, "weights_tx") - .sampler(2, ImageType::FLOAT_2D, "radius_tx") - .compute_source("compositor_symmetric_separable_blur_variable_size.glsl"); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(BOOL, is_vertical_pass) +SAMPLER(0, FLOAT_2D, input_tx) +SAMPLER(1, FLOAT_1D, weights_tx) +SAMPLER(2, FLOAT_2D, radius_tx) +COMPUTE_SOURCE("compositor_symmetric_separable_blur_variable_size.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_symmetric_separable_blur_variable_size_float) - .additional_info("compositor_symmetric_separable_blur_variable_size_shared") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_symmetric_separable_blur_variable_size_shared) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_symmetric_separable_blur_variable_size_float2) - .additional_info("compositor_symmetric_separable_blur_variable_size_shared") - .image(0, GPU_RG16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_symmetric_separable_blur_variable_size_shared) +IMAGE(0, GPU_RG16F, WRITE, FLOAT_2D, output_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_symmetric_separable_blur_variable_size_float4) - .additional_info("compositor_symmetric_separable_blur_variable_size_shared") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_symmetric_separable_blur_variable_size_shared) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_photoreceptor_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_photoreceptor_info.hh index fa8bf78bf2e..6a7668e6bc5 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_photoreceptor_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_photoreceptor_info.hh @@ -5,14 +5,15 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_tone_map_photoreceptor) - .local_group_size(16, 16) - .push_constant(Type::VEC4, "global_adaptation_level") - .push_constant(Type::FLOAT, "contrast") - .push_constant(Type::FLOAT, "intensity") - .push_constant(Type::FLOAT, "chromatic_adaptation") - .push_constant(Type::FLOAT, "light_adaptation") - .push_constant(Type::VEC3, "luminance_coefficients") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_tone_map_photoreceptor.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(VEC4, global_adaptation_level) +PUSH_CONSTANT(FLOAT, contrast) +PUSH_CONSTANT(FLOAT, intensity) +PUSH_CONSTANT(FLOAT, chromatic_adaptation) +PUSH_CONSTANT(FLOAT, light_adaptation) +PUSH_CONSTANT(VEC3, luminance_coefficients) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_tone_map_photoreceptor.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_simple_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_simple_info.hh index d5c56e22073..2dfde065581 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_simple_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_simple_info.hh @@ -5,11 +5,12 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_tone_map_simple) - .local_group_size(16, 16) - .push_constant(Type::FLOAT, "luminance_scale") - .push_constant(Type::FLOAT, "luminance_scale_blend_factor") - .push_constant(Type::FLOAT, "inverse_gamma") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_tone_map_simple.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, luminance_scale) +PUSH_CONSTANT(FLOAT, luminance_scale_blend_factor) +PUSH_CONSTANT(FLOAT, inverse_gamma) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_tone_map_simple.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_van_vliet_gaussian_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_van_vliet_gaussian_blur_info.hh index 9c5737257d7..243aeacc83a 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_van_vliet_gaussian_blur_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_van_vliet_gaussian_blur_info.hh @@ -5,31 +5,33 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_van_vliet_gaussian_blur) - .local_group_size(64, 4) - .push_constant(Type::VEC2, "first_feedback_coefficients") - .push_constant(Type::VEC2, "first_causal_feedforward_coefficients") - .push_constant(Type::VEC2, "first_non_causal_feedforward_coefficients") - .push_constant(Type::VEC2, "second_feedback_coefficients") - .push_constant(Type::VEC2, "second_causal_feedforward_coefficients") - .push_constant(Type::VEC2, "second_non_causal_feedforward_coefficients") - .push_constant(Type::FLOAT, "first_causal_boundary_coefficient") - .push_constant(Type::FLOAT, "first_non_causal_boundary_coefficient") - .push_constant(Type::FLOAT, "second_causal_boundary_coefficient") - .push_constant(Type::FLOAT, "second_non_causal_boundary_coefficient") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "first_causal_output_img") - .image(1, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "first_non_causal_output_img") - .image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "second_causal_output_img") - .image(3, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "second_non_causal_output_img") - .compute_source("compositor_van_vliet_gaussian_blur.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(64, 4) +PUSH_CONSTANT(VEC2, first_feedback_coefficients) +PUSH_CONSTANT(VEC2, first_causal_feedforward_coefficients) +PUSH_CONSTANT(VEC2, first_non_causal_feedforward_coefficients) +PUSH_CONSTANT(VEC2, second_feedback_coefficients) +PUSH_CONSTANT(VEC2, second_causal_feedforward_coefficients) +PUSH_CONSTANT(VEC2, second_non_causal_feedforward_coefficients) +PUSH_CONSTANT(FLOAT, first_causal_boundary_coefficient) +PUSH_CONSTANT(FLOAT, first_non_causal_boundary_coefficient) +PUSH_CONSTANT(FLOAT, second_causal_boundary_coefficient) +PUSH_CONSTANT(FLOAT, second_non_causal_boundary_coefficient) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, first_causal_output_img) +IMAGE(1, GPU_RGBA16F, WRITE, FLOAT_2D, first_non_causal_output_img) +IMAGE(2, GPU_RGBA16F, WRITE, FLOAT_2D, second_causal_output_img) +IMAGE(3, GPU_RGBA16F, WRITE, FLOAT_2D, second_non_causal_output_img) +COMPUTE_SOURCE("compositor_van_vliet_gaussian_blur.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_van_vliet_gaussian_blur_sum) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "first_causal_input_tx") - .sampler(1, ImageType::FLOAT_2D, "first_non_causal_input_tx") - .sampler(2, ImageType::FLOAT_2D, "second_causal_input_tx") - .sampler(3, ImageType::FLOAT_2D, "second_non_causal_input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_van_vliet_gaussian_blur_sum.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, first_causal_input_tx) +SAMPLER(1, FLOAT_2D, first_non_causal_input_tx) +SAMPLER(2, FLOAT_2D, second_causal_input_tx) +SAMPLER(3, FLOAT_2D, second_non_causal_input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_van_vliet_gaussian_blur_sum.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_write_output_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_write_output_info.hh index cf4b32d5a8e..ae9064cf0bf 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_write_output_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_write_output_info.hh @@ -5,25 +5,29 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_write_output_shared) - .local_group_size(16, 16) - .push_constant(Type::IVEC2, "lower_bound") - .push_constant(Type::IVEC2, "upper_bound") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("compositor_write_output.glsl"); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(IVEC2, lower_bound) +PUSH_CONSTANT(IVEC2, upper_bound) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_write_output.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_write_output) - .additional_info("compositor_write_output_shared") - .define("DIRECT_OUTPUT") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_write_output_shared) +DEFINE("DIRECT_OUTPUT") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_write_output_opaque) - .additional_info("compositor_write_output_shared") - .define("OPAQUE_OUTPUT") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_write_output_shared) +DEFINE("OPAQUE_OUTPUT") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_write_output_alpha) - .additional_info("compositor_write_output_shared") - .sampler(1, ImageType::FLOAT_2D, "alpha_tx") - .define("ALPHA_OUTPUT") - .do_static_compilation(true); +ADDITIONAL_INFO(compositor_write_output_shared) +SAMPLER(1, FLOAT_2D, alpha_tx) +DEFINE("ALPHA_OUTPUT") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_z_combine_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_z_combine_info.hh index 31043c7d354..925f01b945a 100644 --- a/source/blender/compositor/realtime_compositor/shaders/infos/compositor_z_combine_info.hh +++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_z_combine_info.hh @@ -5,34 +5,37 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(compositor_z_combine_simple) - .local_group_size(16, 16) - .push_constant(Type::BOOL, "use_alpha") - .sampler(0, ImageType::FLOAT_2D, "first_tx") - .sampler(1, ImageType::FLOAT_2D, "first_z_tx") - .sampler(2, ImageType::FLOAT_2D, "second_tx") - .sampler(3, ImageType::FLOAT_2D, "second_z_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "combined_img") - .image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "combined_z_img") - .compute_source("compositor_z_combine_simple.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(BOOL, use_alpha) +SAMPLER(0, FLOAT_2D, first_tx) +SAMPLER(1, FLOAT_2D, first_z_tx) +SAMPLER(2, FLOAT_2D, second_tx) +SAMPLER(3, FLOAT_2D, second_z_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, combined_img) +IMAGE(1, GPU_R16F, WRITE, FLOAT_2D, combined_z_img) +COMPUTE_SOURCE("compositor_z_combine_simple.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_z_combine_compute_mask) - .local_group_size(16, 16) - .sampler(0, ImageType::FLOAT_2D, "first_z_tx") - .sampler(1, ImageType::FLOAT_2D, "second_z_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "mask_img") - .compute_source("compositor_z_combine_compute_mask.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, first_z_tx) +SAMPLER(1, FLOAT_2D, second_z_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, mask_img) +COMPUTE_SOURCE("compositor_z_combine_compute_mask.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_z_combine_from_mask) - .local_group_size(16, 16) - .push_constant(Type::BOOL, "use_alpha") - .sampler(0, ImageType::FLOAT_2D, "first_tx") - .sampler(1, ImageType::FLOAT_2D, "first_z_tx") - .sampler(2, ImageType::FLOAT_2D, "second_tx") - .sampler(3, ImageType::FLOAT_2D, "second_z_tx") - .sampler(4, ImageType::FLOAT_2D, "mask_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "combined_img") - .image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "combined_z_img") - .compute_source("compositor_z_combine_from_mask.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(BOOL, use_alpha) +SAMPLER(0, FLOAT_2D, first_tx) +SAMPLER(1, FLOAT_2D, first_z_tx) +SAMPLER(2, FLOAT_2D, second_tx) +SAMPLER(3, FLOAT_2D, second_z_tx) +SAMPLER(4, FLOAT_2D, mask_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, combined_img) +IMAGE(1, GPU_R16F, WRITE, FLOAT_2D, combined_z_img) +COMPUTE_SOURCE("compositor_z_combine_from_mask.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_clip_planes_info.hh b/source/blender/gpu/shaders/infos/gpu_clip_planes_info.hh index ef116419f45..9462e50c213 100644 --- a/source/blender/gpu/shaders/infos/gpu_clip_planes_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_clip_planes_info.hh @@ -9,6 +9,7 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_clip_planes) - .uniform_buf(1, "GPUClipPlanes", "clipPlanes", Frequency::PASS) - .typedef_source("GPU_shader_shared.hh") - .define("USE_WORLD_CLIP_PLANES"); +UNIFORM_BUF_FREQ(1, GPUClipPlanes, clipPlanes, PASS) +TYPEDEF_SOURCE("GPU_shader_shared.hh") +DEFINE("USE_WORLD_CLIP_PLANES") +GPU_SHADER_CREATE_END() -- 2.30.2 From 31fd8d1d8cda52edc0d07317dda70433ec54b2e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 12:39:36 +0200 Subject: [PATCH 65/90] Add compositor includes --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index e19285e2618..59f61b48bcb 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -799,6 +799,64 @@ void groupMemoryBarrier() {} /* Include all create infos here so that they don't need to be individually included * inside shaders. */ /* TODO(fclem): Enable the ones ported to the macro Create infos. */ +#include "infos/compositor_alpha_crop_info.hh" +#include "infos/compositor_bilateral_blur_info.hh" +#include "infos/compositor_bokeh_blur_info.hh" +#include "infos/compositor_bokeh_blur_variable_size_info.hh" +#include "infos/compositor_bokeh_image_info.hh" +#include "infos/compositor_box_mask_info.hh" +#include "infos/compositor_compute_preview_info.hh" +#include "infos/compositor_convert_info.hh" +#include "infos/compositor_cryptomatte_info.hh" +#include "infos/compositor_defocus_info.hh" +#include "infos/compositor_deriche_gaussian_blur_info.hh" +#include "infos/compositor_despeckle_info.hh" +#include "infos/compositor_directional_blur_info.hh" +#include "infos/compositor_displace_info.hh" +#include "infos/compositor_double_edge_mask_info.hh" +#include "infos/compositor_edge_filter_info.hh" +#include "infos/compositor_ellipse_mask_info.hh" +#include "infos/compositor_filter_info.hh" +#include "infos/compositor_flip_info.hh" +#include "infos/compositor_glare_info.hh" +#include "infos/compositor_id_mask_info.hh" +#include "infos/compositor_image_crop_info.hh" +#include "infos/compositor_inpaint_info.hh" +#include "infos/compositor_jump_flooding_info.hh" +#include "infos/compositor_keying_info.hh" +#include "infos/compositor_keying_screen_info.hh" +#include "infos/compositor_kuwahara_info.hh" +#include "infos/compositor_map_uv_info.hh" +#include "infos/compositor_morphological_blur_info.hh" +#include "infos/compositor_morphological_distance_feather_info.hh" +#include "infos/compositor_morphological_distance_info.hh" +#include "infos/compositor_morphological_distance_threshold_info.hh" +#include "infos/compositor_morphological_step_info.hh" +#include "infos/compositor_motion_blur_info.hh" +#include "infos/compositor_movie_distortion_info.hh" +#include "infos/compositor_normalize_info.hh" +#include "infos/compositor_parallel_reduction_info.hh" +#include "infos/compositor_pixelate_info.hh" +#include "infos/compositor_plane_deform_info.hh" +#include "infos/compositor_premultiply_alpha_info.hh" +#include "infos/compositor_projector_lens_distortion_info.hh" +#include "infos/compositor_read_input_info.hh" +#include "infos/compositor_realize_on_domain_info.hh" +#include "infos/compositor_scale_variable_info.hh" +#include "infos/compositor_screen_lens_distortion_info.hh" +#include "infos/compositor_smaa_info.hh" +#include "infos/compositor_split_info.hh" +#include "infos/compositor_summed_area_table_info.hh" +#include "infos/compositor_sun_beams_info.hh" +#include "infos/compositor_symmetric_blur_info.hh" +#include "infos/compositor_symmetric_blur_variable_size_info.hh" +#include "infos/compositor_symmetric_separable_blur_info.hh" +#include "infos/compositor_symmetric_separable_blur_variable_size_info.hh" +#include "infos/compositor_tone_map_photoreceptor_info.hh" +#include "infos/compositor_tone_map_simple_info.hh" +#include "infos/compositor_van_vliet_gaussian_blur_info.hh" +#include "infos/compositor_write_output_info.hh" +#include "infos/compositor_z_combine_info.hh" // #include "draw_debug_info.hh" // #include "draw_fullscreen_info.hh" // #include "draw_hair_refine_info.hh" -- 2.30.2 From 6c09660fdda008594c24c3380bef7f0fe946beb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 12:39:48 +0200 Subject: [PATCH 66/90] Fix compilation --- source/blender/gpu/shaders/infos/gpu_shader_icon_info.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/gpu/shaders/infos/gpu_shader_icon_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_icon_info.hh index 2909b3061ba..27cdc063cf7 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_icon_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_icon_info.hh @@ -10,7 +10,7 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_icon) -DEFINE(DO_CORNER_MASKING) +DEFINE("DO_CORNER_MASKING") VERTEX_OUT(smooth_icon_interp_iface) FRAGMENT_OUT(0, VEC4, fragColor) PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) -- 2.30.2 From fd8bba622d248da89f35dd18e123c0f0976200c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 12:40:20 +0200 Subject: [PATCH 67/90] Allow 1 length vector to auto cast to scalar --- source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index 59f61b48bcb..97e2b939616 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -180,6 +180,14 @@ template struct ColSwizzle4 : ColSwizzle3 { &aabr, &aabg, &aabb, &aaba, &aaar, &aaag, &aaab, &aaaa; }; +template struct VecBase { + VecBase() = default; + template explicit VecBase(VecBase) {} + VecBase(T) {} + + operator T() {} +}; + template struct VecBase : VecOp, VecSwizzle2, ColSwizzle2 { T x, y; T r, g; -- 2.30.2 From a4ef239b4f31a6a74274fc595f43a111a92d5a99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 12:41:18 +0200 Subject: [PATCH 68/90] Macro rename builtin shader infos --- .../gpu/shaders/infos/gpu_index_load_info.hh | 12 +- .../infos/gpu_shader_2D_area_borders_info.hh | 27 +-- .../infos/gpu_shader_2D_checker_info.hh | 19 +- .../infos/gpu_shader_2D_diag_stripes_info.hh | 21 +- ...u_shader_2D_image_desaturate_color_info.hh | 11 +- .../shaders/infos/gpu_shader_2D_image_info.hh | 15 +- ...gpu_shader_2D_image_overlays_merge_info.hh | 48 ++--- ...der_2D_image_overlays_stereo_merge_info.hh | 21 +- .../gpu_shader_2D_image_rect_color_info.hh | 21 +- .../gpu_shader_2D_image_shuffle_color_info.hh | 11 +- .../infos/gpu_shader_2D_nodelink_info.hh | 93 +++++---- ...oint_uniform_size_uniform_color_aa_info.hh | 21 +- ...form_size_uniform_color_outline_aa_info.hh | 23 ++- ...D_point_varying_size_varying_color_info.hh | 19 +- .../infos/gpu_shader_2D_widget_info.hh | 84 ++++---- .../infos/gpu_shader_3D_depth_only_info.hh | 20 +- .../infos/gpu_shader_3D_flat_color_info.hh | 26 +-- .../shaders/infos/gpu_shader_3D_image_info.hh | 31 +-- .../shaders/infos/gpu_shader_3D_point_info.hh | 47 +++-- .../infos/gpu_shader_3D_polyline_info.hh | 154 +++++++------- .../infos/gpu_shader_3D_smooth_color_info.hh | 26 +-- .../infos/gpu_shader_3D_uniform_color_info.hh | 47 +++-- .../infos/gpu_shader_gpencil_stroke_info.hh | 57 ++--- .../shaders/infos/gpu_shader_index_info.hh | 39 ++-- ...nstance_varying_color_varying_size_info.hh | 23 ++- .../infos/gpu_shader_keyframe_shape_info.hh | 40 ++-- ...u_shader_line_dashed_uniform_color_info.hh | 45 ++-- .../shaders/infos/gpu_shader_print_info.hh | 8 +- .../infos/gpu_shader_sequencer_info.hh | 52 ++--- .../infos/gpu_shader_simple_lighting_info.hh | 27 +-- .../gpu/shaders/infos/gpu_shader_test_info.hh | 194 ++++++++++-------- .../gpu/shaders/infos/gpu_shader_text_info.hh | 33 ++- .../gpu_srgb_to_framebuffer_space_info.hh | 5 +- 33 files changed, 706 insertions(+), 614 deletions(-) diff --git a/source/blender/gpu/shaders/infos/gpu_index_load_info.hh b/source/blender/gpu/shaders/infos/gpu_index_load_info.hh index ce73be6691a..fc189f9863d 100644 --- a/source/blender/gpu/shaders/infos/gpu_index_load_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_index_load_info.hh @@ -11,9 +11,9 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_index_load) - .push_constant(Type::BOOL, "gpu_index_no_buffer") - .push_constant(Type::BOOL, "gpu_index_16bit") - .push_constant(Type::INT, "gpu_index_base_index") - .storage_buf( - GPU_SSBO_INDEX_BUF_SLOT, Qualifier::READ, "uint", "gpu_index_buf[]", Frequency::GEOMETRY) - .define("GPU_INDEX_LOAD"); +PUSH_CONSTANT(BOOL, gpu_index_no_buffer) +PUSH_CONSTANT(BOOL, gpu_index_16bit) +PUSH_CONSTANT(INT, gpu_index_base_index) +STORAGE_BUF_FREQ(GPU_SSBO_INDEX_BUF_SLOT, READ, uint, gpu_index_buf[], GEOMETRY) +DEFINE("GPU_INDEX_LOAD") +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_area_borders_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_area_borders_info.hh index cf8d9890a3a..c53229e3127 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_area_borders_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_area_borders_info.hh @@ -8,17 +8,20 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(smooth_uv_iface).smooth(Type::VEC2, "uv"); +GPU_SHADER_INTERFACE_INFO(smooth_uv_iface) +SMOOTH(VEC2, uv) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(gpu_shader_2D_area_borders) - .vertex_in(0, Type::VEC2, "pos") - .vertex_out(smooth_uv_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC4, "rect") - .push_constant(Type::VEC4, "color") - .push_constant(Type::FLOAT, "scale") - .push_constant(Type::INT, "cornerLen") - .vertex_source("gpu_shader_2D_area_borders_vert.glsl") - .fragment_source("gpu_shader_2D_area_borders_frag.glsl") - .do_static_compilation(true); +VERTEX_IN(0, VEC2, pos) +VERTEX_OUT(smooth_uv_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC4, rect) +PUSH_CONSTANT(VEC4, color) +PUSH_CONSTANT(FLOAT, scale) +PUSH_CONSTANT(INT, cornerLen) +VERTEX_SOURCE("gpu_shader_2D_area_borders_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_2D_area_borders_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_checker_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_checker_info.hh index 42303fdf51a..84e82a7c3fa 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_checker_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_checker_info.hh @@ -9,12 +9,13 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_checker) - .vertex_in(0, Type::VEC2, "pos") - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC4, "color1") - .push_constant(Type::VEC4, "color2") - .push_constant(Type::INT, "size") - .vertex_source("gpu_shader_2D_vert.glsl") - .fragment_source("gpu_shader_checker_frag.glsl") - .do_static_compilation(true); +VERTEX_IN(0, VEC2, pos) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC4, color1) +PUSH_CONSTANT(VEC4, color2) +PUSH_CONSTANT(INT, size) +VERTEX_SOURCE("gpu_shader_2D_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_checker_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_diag_stripes_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_diag_stripes_info.hh index 89e7e20e4c7..53ef9b3ec3b 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_diag_stripes_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_diag_stripes_info.hh @@ -9,13 +9,14 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_diag_stripes) - .vertex_in(0, Type::VEC2, "pos") - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC4, "color1") - .push_constant(Type::VEC4, "color2") - .push_constant(Type::INT, "size1") - .push_constant(Type::INT, "size2") - .vertex_source("gpu_shader_2D_vert.glsl") - .fragment_source("gpu_shader_diag_stripes_frag.glsl") - .do_static_compilation(true); +VERTEX_IN(0, VEC2, pos) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC4, color1) +PUSH_CONSTANT(VEC4, color2) +PUSH_CONSTANT(INT, size1) +PUSH_CONSTANT(INT, size2) +VERTEX_SOURCE("gpu_shader_2D_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_diag_stripes_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_desaturate_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_desaturate_color_info.hh index cfa9ae9641e..4cded825133 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_desaturate_color_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_desaturate_color_info.hh @@ -9,8 +9,9 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_desaturate_color) - .additional_info("gpu_shader_2D_image_common") - .push_constant(Type::VEC4, "color") - .push_constant(Type::FLOAT, "factor") - .fragment_source("gpu_shader_image_desaturate_frag.glsl") - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_shader_2D_image_common) +PUSH_CONSTANT(VEC4, color) +PUSH_CONSTANT(FLOAT, factor) +FRAGMENT_SOURCE("gpu_shader_image_desaturate_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_info.hh index a3b1d8006e7..7bfafb4d2b5 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_info.hh @@ -10,10 +10,11 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_common) - .vertex_in(0, Type::VEC2, "pos") - .vertex_in(1, Type::VEC2, "texCoord") - .vertex_out(smooth_tex_coord_interp_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .sampler(0, ImageType::FLOAT_2D, "image") - .vertex_source("gpu_shader_2D_image_vert.glsl"); +VERTEX_IN(0, VEC2, pos) +VERTEX_IN(1, VEC2, texCoord) +VERTEX_OUT(smooth_tex_coord_interp_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +SAMPLER(0, FLOAT_2D, image) +VERTEX_SOURCE("gpu_shader_2D_image_vert.glsl") +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_overlays_merge_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_overlays_merge_info.hh index 2720f745822..230719e268f 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_overlays_merge_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_overlays_merge_info.hh @@ -10,29 +10,31 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_overlays_merge) - .vertex_in(0, Type::VEC2, "pos") - .vertex_in(1, Type::VEC2, "texCoord") - .vertex_out(smooth_tex_coord_interp_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::BOOL, "display_transform") - .push_constant(Type::BOOL, "overlay") - .push_constant(Type::BOOL, "use_hdr") - /* Sampler slots should match OCIO's. */ - .sampler(0, ImageType::FLOAT_2D, "image_texture") - .sampler(1, ImageType::FLOAT_2D, "overlays_texture") - .vertex_source("gpu_shader_2D_image_vert.glsl") - .fragment_source("gpu_shader_image_overlays_merge_frag.glsl") - .do_static_compilation(true); +VERTEX_IN(0, VEC2, pos) +VERTEX_IN(1, VEC2, texCoord) +VERTEX_OUT(smooth_tex_coord_interp_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(BOOL, display_transform) +PUSH_CONSTANT(BOOL, overlay) +PUSH_CONSTANT(BOOL, use_hdr) +/* Sampler slots should match OCIO's. */ +SAMPLER(0, FLOAT_2D, image_texture) +SAMPLER(1, FLOAT_2D, overlays_texture) +VERTEX_SOURCE("gpu_shader_2D_image_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_image_overlays_merge_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* Cycles display driver fallback shader. */ GPU_SHADER_CREATE_INFO(gpu_shader_cycles_display_fallback) - .vertex_in(0, Type::VEC2, "pos") - .vertex_in(1, Type::VEC2, "texCoord") - .vertex_out(smooth_tex_coord_interp_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::VEC2, "fullscreen") - .sampler(0, ImageType::FLOAT_2D, "image_texture") - .vertex_source("gpu_shader_display_fallback_vert.glsl") - .fragment_source("gpu_shader_display_fallback_frag.glsl") - .do_static_compilation(true); +VERTEX_IN(0, VEC2, pos) +VERTEX_IN(1, VEC2, texCoord) +VERTEX_OUT(smooth_tex_coord_interp_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(VEC2, fullscreen) +SAMPLER(0, FLOAT_2D, image_texture) +VERTEX_SOURCE("gpu_shader_display_fallback_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_display_fallback_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_overlays_stereo_merge_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_overlays_stereo_merge_info.hh index 314b535d254..435efcba121 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_overlays_stereo_merge_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_overlays_stereo_merge_info.hh @@ -9,13 +9,14 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_overlays_stereo_merge) - .vertex_in(0, Type::VEC2, "pos") - .fragment_out(0, Type::VEC4, "overlayColor") - .fragment_out(1, Type::VEC4, "imageColor") - .sampler(0, ImageType::FLOAT_2D, "imageTexture") - .sampler(1, ImageType::FLOAT_2D, "overlayTexture") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::INT, "stereoDisplaySettings") - .vertex_source("gpu_shader_2D_vert.glsl") - .fragment_source("gpu_shader_image_overlays_stereo_merge_frag.glsl") - .do_static_compilation(true); +VERTEX_IN(0, VEC2, pos) +FRAGMENT_OUT(0, VEC4, overlayColor) +FRAGMENT_OUT(1, VEC4, imageColor) +SAMPLER(0, FLOAT_2D, imageTexture) +SAMPLER(1, FLOAT_2D, overlayTexture) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(INT, stereoDisplaySettings) +VERTEX_SOURCE("gpu_shader_2D_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_image_overlays_stereo_merge_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_rect_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_rect_color_info.hh index a472e9bbb3a..42e863bca1e 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_rect_color_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_rect_color_info.hh @@ -10,13 +10,14 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_rect_color) - .vertex_out(smooth_tex_coord_interp_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC4, "color") - .push_constant(Type::VEC4, "rect_icon") - .push_constant(Type::VEC4, "rect_geom") - .sampler(0, ImageType::FLOAT_2D, "image") - .vertex_source("gpu_shader_2D_image_rect_vert.glsl") - .fragment_source("gpu_shader_image_color_frag.glsl") - .do_static_compilation(true); +VERTEX_OUT(smooth_tex_coord_interp_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC4, color) +PUSH_CONSTANT(VEC4, rect_icon) +PUSH_CONSTANT(VEC4, rect_geom) +SAMPLER(0, FLOAT_2D, image) +VERTEX_SOURCE("gpu_shader_2D_image_rect_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_image_color_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_shuffle_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_shuffle_color_info.hh index 146d4ff2570..13c28ae0b44 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_shuffle_color_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_shuffle_color_info.hh @@ -9,8 +9,9 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_shuffle_color) - .additional_info("gpu_shader_2D_image_common") - .push_constant(Type::VEC4, "color") - .push_constant(Type::VEC4, "shuffle") - .fragment_source("gpu_shader_image_shuffle_color_frag.glsl") - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_shader_2D_image_common) +PUSH_CONSTANT(VEC4, color) +PUSH_CONSTANT(VEC4, shuffle) +FRAGMENT_SOURCE("gpu_shader_image_shuffle_color_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_nodelink_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_nodelink_info.hh index b9b0eb9f9a4..c63d32f1038 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_nodelink_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_nodelink_info.hh @@ -9,52 +9,55 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_INTERFACE_INFO(nodelink_iface) - .smooth(Type::VEC4, "finalColor") - .smooth(Type::VEC2, "lineUV") - .flat(Type::FLOAT, "lineLength") - .flat(Type::FLOAT, "lineThickness") - .flat(Type::FLOAT, "dashLength") - .flat(Type::FLOAT, "dashFactor") - .flat(Type::INT, "hasBackLink") - .flat(Type::FLOAT, "dashAlpha") - .flat(Type::INT, "isMainLine") - .flat(Type::FLOAT, "aspect"); +SMOOTH(VEC4, finalColor) +SMOOTH(VEC2, lineUV) +FLAT(FLOAT, lineLength) +FLAT(FLOAT, lineThickness) +FLAT(FLOAT, dashLength) +FLAT(FLOAT, dashFactor) +FLAT(INT, hasBackLink) +FLAT(FLOAT, dashAlpha) +FLAT(INT, isMainLine) +FLAT(FLOAT, aspect) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(gpu_shader_2D_nodelink) - .vertex_in(0, Type::VEC2, "uv") - .vertex_in(1, Type::VEC2, "pos") - .vertex_in(2, Type::VEC2, "expand") - .vertex_out(nodelink_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .uniform_buf(0, "NodeLinkData", "node_link_data", Frequency::PASS) - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .vertex_source("gpu_shader_2D_nodelink_vert.glsl") - .fragment_source("gpu_shader_2D_nodelink_frag.glsl") - .typedef_source("GPU_shader_shared.hh") - .do_static_compilation(true); +VERTEX_IN(0, VEC2, uv) +VERTEX_IN(1, VEC2, pos) +VERTEX_IN(2, VEC2, expand) +VERTEX_OUT(nodelink_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +UNIFORM_BUF_FREQ(0, NodeLinkData, node_link_data, PASS) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +VERTEX_SOURCE("gpu_shader_2D_nodelink_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_2D_nodelink_frag.glsl") +TYPEDEF_SOURCE("GPU_shader_shared.hh") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_2D_nodelink_inst) - .vertex_in(0, Type::VEC2, "uv") - .vertex_in(1, Type::VEC2, "pos") - .vertex_in(2, Type::VEC2, "expand") - .vertex_in(3, Type::VEC2, "P0") - .vertex_in(4, Type::VEC2, "P1") - .vertex_in(5, Type::VEC2, "P2") - .vertex_in(6, Type::VEC2, "P3") - .vertex_in(7, Type::UVEC4, "colid_doarrow") - .vertex_in(8, Type::VEC4, "start_color") - .vertex_in(9, Type::VEC4, "end_color") - .vertex_in(10, Type::UVEC2, "domuted") - .vertex_in(11, Type::FLOAT, "dim_factor") - .vertex_in(12, Type::FLOAT, "thickness") - .vertex_in(13, Type::VEC3, "dash_params") - .vertex_in(14, Type::INT, "has_back_link") - .vertex_out(nodelink_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .uniform_buf(0, "NodeLinkInstanceData", "node_link_data", Frequency::PASS) - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .vertex_source("gpu_shader_2D_nodelink_vert.glsl") - .fragment_source("gpu_shader_2D_nodelink_frag.glsl") - .typedef_source("GPU_shader_shared.hh") - .define("USE_INSTANCE") - .do_static_compilation(true); +VERTEX_IN(0, VEC2, uv) +VERTEX_IN(1, VEC2, pos) +VERTEX_IN(2, VEC2, expand) +VERTEX_IN(3, VEC2, P0) +VERTEX_IN(4, VEC2, P1) +VERTEX_IN(5, VEC2, P2) +VERTEX_IN(6, VEC2, P3) +VERTEX_IN(7, UVEC4, colid_doarrow) +VERTEX_IN(8, VEC4, start_color) +VERTEX_IN(9, VEC4, end_color) +VERTEX_IN(10, UVEC2, domuted) +VERTEX_IN(11, FLOAT, dim_factor) +VERTEX_IN(12, FLOAT, thickness) +VERTEX_IN(13, VEC3, dash_params) +VERTEX_IN(14, INT, has_back_link) +VERTEX_OUT(nodelink_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +UNIFORM_BUF_FREQ(0, NodeLinkInstanceData, node_link_data, PASS) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +VERTEX_SOURCE("gpu_shader_2D_nodelink_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_2D_nodelink_frag.glsl") +TYPEDEF_SOURCE("GPU_shader_shared.hh") +DEFINE("USE_INSTANCE") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_point_uniform_size_uniform_color_aa_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_point_uniform_size_uniform_color_aa_info.hh index b2592296eb2..73da34416b0 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_point_uniform_size_uniform_color_aa_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_point_uniform_size_uniform_color_aa_info.hh @@ -10,13 +10,14 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_point_uniform_size_uniform_color_aa) - .vertex_in(0, Type::VEC2, "pos") - .vertex_out(smooth_radii_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC4, "color") - .push_constant(Type::FLOAT, "size") - .vertex_source("gpu_shader_2D_point_uniform_size_aa_vert.glsl") - .fragment_source("gpu_shader_point_uniform_color_aa_frag.glsl") - .additional_info("gpu_srgb_to_framebuffer_space") - .do_static_compilation(true); +VERTEX_IN(0, VEC2, pos) +VERTEX_OUT(smooth_radii_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC4, color) +PUSH_CONSTANT(FLOAT, size) +VERTEX_SOURCE("gpu_shader_2D_point_uniform_size_aa_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_point_uniform_color_aa_frag.glsl") +ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_point_uniform_size_uniform_color_outline_aa_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_point_uniform_size_uniform_color_outline_aa_info.hh index c99c89dba31..9b4c549eacb 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_point_uniform_size_uniform_color_outline_aa_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_point_uniform_size_uniform_color_outline_aa_info.hh @@ -10,14 +10,15 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_point_uniform_size_uniform_color_outline_aa) - .vertex_in(0, Type::VEC2, "pos") - .vertex_out(smooth_radii_outline_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC4, "color") - .push_constant(Type::VEC4, "outlineColor") - .push_constant(Type::FLOAT, "size") - .push_constant(Type::FLOAT, "outlineWidth") - .vertex_source("gpu_shader_2D_point_uniform_size_outline_aa_vert.glsl") - .fragment_source("gpu_shader_point_uniform_color_outline_aa_frag.glsl") - .do_static_compilation(true); +VERTEX_IN(0, VEC2, pos) +VERTEX_OUT(smooth_radii_outline_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC4, color) +PUSH_CONSTANT(VEC4, outlineColor) +PUSH_CONSTANT(FLOAT, size) +PUSH_CONSTANT(FLOAT, outlineWidth) +VERTEX_SOURCE("gpu_shader_2D_point_uniform_size_outline_aa_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_point_uniform_color_outline_aa_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_point_varying_size_varying_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_point_varying_size_varying_color_info.hh index 5578a987ec0..582af0f1d20 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_point_varying_size_varying_color_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_point_varying_size_varying_color_info.hh @@ -10,12 +10,13 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_2D_point_varying_size_varying_color) - .vertex_in(0, Type::VEC2, "pos") - .vertex_in(1, Type::FLOAT, "size") - .vertex_in(2, Type::VEC4, "color") - .vertex_out(smooth_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .vertex_source("gpu_shader_2D_point_varying_size_varying_color_vert.glsl") - .fragment_source("gpu_shader_point_varying_color_frag.glsl") - .do_static_compilation(true); +VERTEX_IN(0, VEC2, pos) +VERTEX_IN(1, FLOAT, size) +VERTEX_IN(2, VEC4, color) +VERTEX_OUT(smooth_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +VERTEX_SOURCE("gpu_shader_2D_point_varying_size_varying_color_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_point_varying_color_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_widget_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_widget_info.hh index bf5bd6d8d9f..4375d4cc22e 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_2D_widget_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_widget_info.hh @@ -10,56 +10,62 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_INTERFACE_INFO(gpu_widget_iface) - .flat(Type::FLOAT, "discardFac") - .flat(Type::FLOAT, "lineWidth") - .flat(Type::VEC2, "outRectSize") - .flat(Type::VEC4, "borderColor") - .flat(Type::VEC4, "embossColor") - .flat(Type::VEC4, "outRoundCorners") - .no_perspective(Type::FLOAT, "butCo") - .no_perspective(Type::VEC2, "uvInterp") - .no_perspective(Type::VEC4, "innerColor"); +FLAT(FLOAT, discardFac) +FLAT(FLOAT, lineWidth) +FLAT(VEC2, outRectSize) +FLAT(VEC4, borderColor) +FLAT(VEC4, embossColor) +FLAT(VEC4, outRoundCorners) +NO_PERSPECTIVE(FLOAT, butCo) +NO_PERSPECTIVE(VEC2, uvInterp) +NO_PERSPECTIVE(VEC4, innerColor) +GPU_SHADER_INTERFACE_END() /* TODO(fclem): Share with C code. */ #define MAX_PARAM 12 #define MAX_INSTANCE 6 GPU_SHADER_CREATE_INFO(gpu_shader_2D_widget_shared) - .define("MAX_PARAM", STRINGIFY(MAX_PARAM)) - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC3, "checkerColorAndSize") - .vertex_out(gpu_widget_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("gpu_shader_2D_widget_base_vert.glsl") - .fragment_source("gpu_shader_2D_widget_base_frag.glsl") - .additional_info("gpu_srgb_to_framebuffer_space"); +DEFINE_VALUE("MAX_PARAM", STRINGIFY(MAX_PARAM)) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC3, checkerColorAndSize) +VERTEX_OUT(gpu_widget_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("gpu_shader_2D_widget_base_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_2D_widget_base_frag.glsl") +ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_2D_widget_base) - .do_static_compilation(true) - /* gl_InstanceID is supposed to be 0 if not drawing instances, but this seems - * to be violated in some drivers. For example, macOS 10.15.4 and Intel Iris - * causes #78307 when using gl_InstanceID outside of instance. */ - .define("widgetID", "0") - .push_constant(Type::VEC4, "parameters", MAX_PARAM) - .additional_info("gpu_shader_2D_widget_shared"); +DO_STATIC_COMPILATION() +/* gl_InstanceID is supposed to be 0 if not drawing instances, but this seems + * to be violated in some drivers. For example, macOS 10.15.4 and Intel Iris + * causes #78307 when using gl_InstanceID outside of instance. */ +DEFINE_VALUE("widgetID", "0") +PUSH_CONSTANT_ARRAY(VEC4, parameters, MAX_PARAM) +ADDITIONAL_INFO(gpu_shader_2D_widget_shared) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_2D_widget_base_inst) - .do_static_compilation(true) - .define("widgetID", "gl_InstanceID") - .push_constant(Type::VEC4, "parameters", (MAX_PARAM * MAX_INSTANCE)) - .additional_info("gpu_shader_2D_widget_shared"); +DO_STATIC_COMPILATION() +DEFINE_VALUE("widgetID", "gl_InstanceID") +PUSH_CONSTANT_ARRAY(VEC4, parameters, (MAX_PARAM * MAX_INSTANCE)) +ADDITIONAL_INFO(gpu_shader_2D_widget_shared) +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(gpu_widget_shadow_iface) - .smooth(Type::FLOAT, "shadowFalloff") - .smooth(Type::FLOAT, "innerMask"); +SMOOTH(FLOAT, shadowFalloff) +SMOOTH(FLOAT, innerMask) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(gpu_shader_2D_widget_shadow) - .do_static_compilation(true) - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC4, "parameters", 4) - .push_constant(Type::FLOAT, "alpha") - .vertex_in(0, Type::UINT, "vflag") - .vertex_out(gpu_widget_shadow_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("gpu_shader_2D_widget_shadow_vert.glsl") - .fragment_source("gpu_shader_2D_widget_shadow_frag.glsl"); +DO_STATIC_COMPILATION() +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT_ARRAY(VEC4, parameters, 4) +PUSH_CONSTANT(FLOAT, alpha) +VERTEX_IN(0, UINT, vflag) +VERTEX_OUT(gpu_widget_shadow_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("gpu_shader_2D_widget_shadow_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_2D_widget_shadow_frag.glsl") +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_3D_depth_only_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_3D_depth_only_info.hh index 795b557ce1d..4566e7decf5 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_3D_depth_only_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_3D_depth_only_info.hh @@ -10,14 +10,16 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_3D_depth_only) - .vertex_in(0, Type::VEC3, "pos") - .vertex_out(flat_color_iface) - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .vertex_source("gpu_shader_3D_vert.glsl") - .fragment_source("gpu_shader_depth_only_frag.glsl") - .do_static_compilation(true); +VERTEX_IN(0, VEC3, pos) +VERTEX_OUT(flat_color_iface) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +VERTEX_SOURCE("gpu_shader_3D_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_depth_only_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_depth_only_clipped) - .additional_info("gpu_shader_3D_depth_only") - .additional_info("gpu_clip_planes") - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_shader_3D_depth_only) +ADDITIONAL_INFO(gpu_clip_planes) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_3D_flat_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_3D_flat_color_info.hh index eb0479f78c7..2adef85f16b 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_3D_flat_color_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_3D_flat_color_info.hh @@ -10,17 +10,19 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_3D_flat_color) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC4, "color") - .vertex_out(flat_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .vertex_source("gpu_shader_3D_flat_color_vert.glsl") - .fragment_source("gpu_shader_flat_color_frag.glsl") - .additional_info("gpu_srgb_to_framebuffer_space") - .do_static_compilation(true); +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC4, color) +VERTEX_OUT(flat_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +VERTEX_SOURCE("gpu_shader_3D_flat_color_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_flat_color_frag.glsl") +ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_flat_color_clipped) - .additional_info("gpu_shader_3D_flat_color") - .additional_info("gpu_clip_planes") - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_shader_3D_flat_color) +ADDITIONAL_INFO(gpu_clip_planes) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_3D_image_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_3D_image_info.hh index 0ba73b91a5c..34780456701 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_3D_image_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_3D_image_info.hh @@ -10,21 +10,24 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_3D_image_common) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC2, "texCoord") - .vertex_out(smooth_tex_coord_interp_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .sampler(0, ImageType::FLOAT_2D, "image") - .vertex_source("gpu_shader_3D_image_vert.glsl"); +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC2, texCoord) +VERTEX_OUT(smooth_tex_coord_interp_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +SAMPLER(0, FLOAT_2D, image) +VERTEX_SOURCE("gpu_shader_3D_image_vert.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_image) - .additional_info("gpu_shader_3D_image_common") - .fragment_source("gpu_shader_image_frag.glsl") - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_shader_3D_image_common) +FRAGMENT_SOURCE("gpu_shader_image_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_image_color) - .additional_info("gpu_shader_3D_image_common") - .push_constant(Type::VEC4, "color") - .fragment_source("gpu_shader_image_color_frag.glsl") - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_shader_3D_image_common) +PUSH_CONSTANT(VEC4, color) +FRAGMENT_SOURCE("gpu_shader_image_color_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_3D_point_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_3D_point_info.hh index cc3f340edb9..6897b437f21 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_3D_point_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_3D_point_info.hh @@ -9,29 +9,32 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_varying_size_varying_color) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC4, "color") - .vertex_in(2, Type::FLOAT, "size") - .vertex_out(smooth_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .vertex_source("gpu_shader_3D_point_varying_size_varying_color_vert.glsl") - .fragment_source("gpu_shader_point_varying_color_frag.glsl") - .do_static_compilation(true); +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC4, color) +VERTEX_IN(2, FLOAT, size) +VERTEX_OUT(smooth_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +VERTEX_SOURCE("gpu_shader_3D_point_varying_size_varying_color_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_point_varying_color_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_uniform_size_uniform_color_aa) - .vertex_in(0, Type::VEC3, "pos") - .vertex_out(smooth_radii_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC4, "color") - .push_constant(Type::FLOAT, "size") - .vertex_source("gpu_shader_3D_point_uniform_size_aa_vert.glsl") - .fragment_source("gpu_shader_point_uniform_color_aa_frag.glsl") - .additional_info("gpu_srgb_to_framebuffer_space") - .do_static_compilation(true); +VERTEX_IN(0, VEC3, pos) +VERTEX_OUT(smooth_radii_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC4, color) +PUSH_CONSTANT(FLOAT, size) +VERTEX_SOURCE("gpu_shader_3D_point_uniform_size_aa_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_point_uniform_color_aa_frag.glsl") +ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_uniform_size_uniform_color_aa_clipped) - .additional_info("gpu_shader_3D_point_uniform_size_uniform_color_aa") - .additional_info("gpu_clip_planes") - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_shader_3D_point_uniform_size_uniform_color_aa) +ADDITIONAL_INFO(gpu_clip_planes) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_3D_polyline_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_3D_polyline_info.hh index bd219140ce0..53114f110e7 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_3D_polyline_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_3D_polyline_info.hh @@ -10,96 +10,108 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_NAMED_INTERFACE_INFO(gpu_shader_3D_polyline_iface, interp) - .smooth(Type::VEC4, "final_color") - .smooth(Type::FLOAT, "clip"); +SMOOTH(VEC4, final_color) +SMOOTH(FLOAT, clip) +GPU_SHADER_NAMED_INTERFACE_END(interp) GPU_SHADER_NAMED_INTERFACE_INFO(gpu_shader_3D_polyline_noperspective_iface, interp_noperspective) - .no_perspective(Type::FLOAT, "smoothline"); +NO_PERSPECTIVE(FLOAT, smoothline) +GPU_SHADER_NAMED_INTERFACE_END(interp_noperspective) GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline) - .define("SMOOTH_WIDTH", "1.0") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC2, "viewportSize") - .push_constant(Type::FLOAT, "lineWidth") - .push_constant(Type::BOOL, "lineSmooth") - .vertex_in(0, Type::VEC3, "pos") - .vertex_out(gpu_shader_3D_polyline_iface) - .vertex_out(gpu_shader_3D_polyline_noperspective_iface) - .geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) - .geometry_out(gpu_shader_3D_polyline_iface) - .geometry_out(gpu_shader_3D_polyline_noperspective_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("gpu_shader_3D_polyline_vert.glsl") - .geometry_source("gpu_shader_3D_polyline_geom.glsl") - .fragment_source("gpu_shader_3D_polyline_frag.glsl") - .additional_info("gpu_srgb_to_framebuffer_space"); +DEFINE_VALUE("SMOOTH_WIDTH", "1.0") +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC2, viewportSize) +PUSH_CONSTANT(FLOAT, lineWidth) +PUSH_CONSTANT(BOOL, lineSmooth) +VERTEX_IN(0, VEC3, pos) +VERTEX_OUT(gpu_shader_3D_polyline_iface) +VERTEX_OUT(gpu_shader_3D_polyline_noperspective_iface) +GEOMETRY_LAYOUT(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) +GEOMETRY_OUT(gpu_shader_3D_polyline_iface) +GEOMETRY_OUT(gpu_shader_3D_polyline_noperspective_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("gpu_shader_3D_polyline_vert.glsl") +GEOMETRY_SOURCE("gpu_shader_3D_polyline_geom.glsl") +FRAGMENT_SOURCE("gpu_shader_3D_polyline_frag.glsl") +ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_no_geom) - .define("SMOOTH_WIDTH", "1.0") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC2, "viewportSize") - .push_constant(Type::FLOAT, "lineWidth") - .push_constant(Type::BOOL, "lineSmooth") - .vertex_in(0, Type::VEC3, "pos") - .vertex_out(gpu_shader_3D_polyline_iface) - .vertex_out(gpu_shader_3D_polyline_noperspective_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("gpu_shader_3D_polyline_vert_no_geom.glsl") - .fragment_source("gpu_shader_3D_polyline_frag.glsl") - .additional_info("gpu_srgb_to_framebuffer_space"); +DEFINE_VALUE("SMOOTH_WIDTH", "1.0") +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC2, viewportSize) +PUSH_CONSTANT(FLOAT, lineWidth) +PUSH_CONSTANT(BOOL, lineSmooth) +VERTEX_IN(0, VEC3, pos) +VERTEX_OUT(gpu_shader_3D_polyline_iface) +VERTEX_OUT(gpu_shader_3D_polyline_noperspective_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("gpu_shader_3D_polyline_vert_no_geom.glsl") +FRAGMENT_SOURCE("gpu_shader_3D_polyline_frag.glsl") +ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_uniform_color) - .do_static_compilation(true) - .define("UNIFORM") - .push_constant(Type::VEC4, "color") - .additional_info("gpu_shader_3D_polyline"); +DO_STATIC_COMPILATION() +DEFINE("UNIFORM") +PUSH_CONSTANT(VEC4, color) +ADDITIONAL_INFO(gpu_shader_3D_polyline) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_uniform_color_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .define("UNIFORM") - .push_constant(Type::VEC4, "color") - .additional_info("gpu_shader_3D_polyline_no_geom"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +DEFINE("UNIFORM") +PUSH_CONSTANT(VEC4, color) +ADDITIONAL_INFO(gpu_shader_3D_polyline_no_geom) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_uniform_color_clipped) - .do_static_compilation(true) - /* TODO(fclem): Put in a UBO to fit the 128byte requirement. */ - .push_constant(Type::MAT4, "ModelMatrix") - .push_constant(Type::VEC4, "ClipPlane") - .define("CLIP") - .additional_info("gpu_shader_3D_polyline_uniform_color"); +DO_STATIC_COMPILATION() +/* TODO(fclem): Put in a UBO to fit the 128byte requirement. */ +PUSH_CONSTANT(MAT4, ModelMatrix) +PUSH_CONSTANT(VEC4, ClipPlane) +DEFINE("CLIP") +ADDITIONAL_INFO(gpu_shader_3D_polyline_uniform_color) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_uniform_color_clipped_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - /* TODO(fclem): Put in an UBO to fit the 128byte requirement. */ - .push_constant(Type::MAT4, "ModelMatrix") - .push_constant(Type::VEC4, "ClipPlane") - .define("CLIP") - .additional_info("gpu_shader_3D_polyline_uniform_color_no_geom"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +/* TODO(fclem): Put in an UBO to fit the 128byte requirement. */ +PUSH_CONSTANT(MAT4, ModelMatrix) +PUSH_CONSTANT(VEC4, ClipPlane) +DEFINE("CLIP") +ADDITIONAL_INFO(gpu_shader_3D_polyline_uniform_color_no_geom) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_flat_color) - .do_static_compilation(true) - .define("FLAT") - .vertex_in(1, Type::VEC4, "color") - .additional_info("gpu_shader_3D_polyline"); +DO_STATIC_COMPILATION() +DEFINE("FLAT") +VERTEX_IN(1, VEC4, color) +ADDITIONAL_INFO(gpu_shader_3D_polyline) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_flat_color_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .define("FLAT") - .vertex_in(1, Type::VEC4, "color") - .additional_info("gpu_shader_3D_polyline_no_geom"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +DEFINE("FLAT") +VERTEX_IN(1, VEC4, color) +ADDITIONAL_INFO(gpu_shader_3D_polyline_no_geom) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_smooth_color) - .do_static_compilation(true) - .define("SMOOTH") - .vertex_in(1, Type::VEC4, "color") - .additional_info("gpu_shader_3D_polyline"); +DO_STATIC_COMPILATION() +DEFINE("SMOOTH") +VERTEX_IN(1, VEC4, color) +ADDITIONAL_INFO(gpu_shader_3D_polyline) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_polyline_smooth_color_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .define("SMOOTH") - .vertex_in(1, Type::VEC4, "color") - .additional_info("gpu_shader_3D_polyline_no_geom"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +DEFINE("SMOOTH") +VERTEX_IN(1, VEC4, color) +ADDITIONAL_INFO(gpu_shader_3D_polyline_no_geom) +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_3D_smooth_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_3D_smooth_color_info.hh index d860be2909c..d5989786fb3 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_3D_smooth_color_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_3D_smooth_color_info.hh @@ -10,17 +10,19 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_3D_smooth_color) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC4, "color") - .vertex_out(smooth_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .vertex_source("gpu_shader_3D_smooth_color_vert.glsl") - .fragment_source("gpu_shader_3D_smooth_color_frag.glsl") - .additional_info("gpu_srgb_to_framebuffer_space") - .do_static_compilation(true); +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC4, color) +VERTEX_OUT(smooth_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +VERTEX_SOURCE("gpu_shader_3D_smooth_color_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_3D_smooth_color_frag.glsl") +ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_smooth_color_clipped) - .additional_info("gpu_shader_3D_smooth_color") - .additional_info("gpu_clip_planes") - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_shader_3D_smooth_color) +ADDITIONAL_INFO(gpu_clip_planes) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_3D_uniform_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_3D_uniform_color_info.hh index ff55abdc2b4..0a347628f51 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_3D_uniform_color_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_3D_uniform_color_info.hh @@ -9,30 +9,33 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_3D_uniform_color) - .vertex_in(0, Type::VEC3, "pos") - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC4, "color") - .vertex_source("gpu_shader_3D_vert.glsl") - .fragment_source("gpu_shader_uniform_color_frag.glsl") - .additional_info("gpu_srgb_to_framebuffer_space") - .do_static_compilation(true); +VERTEX_IN(0, VEC3, pos) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC4, color) +VERTEX_SOURCE("gpu_shader_3D_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_uniform_color_frag.glsl") +ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_uniform_color_clipped) - .additional_info("gpu_shader_3D_uniform_color") - .additional_info("gpu_clip_planes") - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_shader_3D_uniform_color) +ADDITIONAL_INFO(gpu_clip_planes) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* Confusing naming convention. But this is a version with only one local clip plane. */ GPU_SHADER_CREATE_INFO(gpu_shader_3D_clipped_uniform_color) - .vertex_in(0, Type::VEC3, "pos") - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC4, "color") - /* TODO(@fclem): Put those two to one UBO. */ - .push_constant(Type::MAT4, "ModelMatrix") - .push_constant(Type::VEC4, "ClipPlane") - .vertex_source("gpu_shader_3D_clipped_uniform_color_vert.glsl") - .fragment_source("gpu_shader_uniform_color_frag.glsl") - .additional_info("gpu_srgb_to_framebuffer_space") - .do_static_compilation(true); +VERTEX_IN(0, VEC3, pos) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC4, color) +/* TODO(@fclem): Put those two to one UBO. */ +PUSH_CONSTANT(MAT4, ModelMatrix) +PUSH_CONSTANT(VEC4, ClipPlane) +VERTEX_SOURCE("gpu_shader_3D_clipped_uniform_color_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_uniform_color_frag.glsl") +ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_gpencil_stroke_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_gpencil_stroke_info.hh index 74d8954e2b7..3adbb5b81a8 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_gpencil_stroke_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_gpencil_stroke_info.hh @@ -9,38 +9,43 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_NAMED_INTERFACE_INFO(gpencil_stroke_vert_iface, geometry_in) - .smooth(Type::VEC4, "finalColor") - .smooth(Type::FLOAT, "finalThickness"); +SMOOTH(VEC4, finalColor) +SMOOTH(FLOAT, finalThickness) +GPU_SHADER_NAMED_INTERFACE_END(geometry_in) GPU_SHADER_NAMED_INTERFACE_INFO(gpencil_stroke_geom_iface, geometry_out) - .smooth(Type::VEC4, "mColor") - .smooth(Type::VEC2, "mTexCoord"); +SMOOTH(VEC4, mColor) +SMOOTH(VEC2, mTexCoord) +GPU_SHADER_NAMED_INTERFACE_END(geometry_out) GPU_SHADER_CREATE_INFO(gpu_shader_gpencil_stroke_base) - .vertex_in(0, Type::VEC4, "color") - .vertex_in(1, Type::VEC3, "pos") - .vertex_in(2, Type::FLOAT, "thickness") - .vertex_out(gpencil_stroke_vert_iface) - .fragment_out(0, Type::VEC4, "fragColor") +VERTEX_IN(0, VEC4, color) +VERTEX_IN(1, VEC3, pos) +VERTEX_IN(2, FLOAT, thickness) +VERTEX_OUT(gpencil_stroke_vert_iface) +FRAGMENT_OUT(0, VEC4, fragColor) - .uniform_buf(0, "GPencilStrokeData", "gpencil_stroke_data") +UNIFORM_BUF(0, GPencilStrokeData, gpencil_stroke_data) - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::MAT4, "ProjectionMatrix") - .fragment_source("gpu_shader_gpencil_stroke_frag.glsl") - .typedef_source("GPU_shader_shared.hh"); +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(MAT4, ProjectionMatrix) +FRAGMENT_SOURCE("gpu_shader_gpencil_stroke_frag.glsl") +TYPEDEF_SOURCE("GPU_shader_shared.hh") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_gpencil_stroke) - .additional_info("gpu_shader_gpencil_stroke_base") - .geometry_layout(PrimitiveIn::LINES_ADJACENCY, PrimitiveOut::TRIANGLE_STRIP, 13) - .geometry_out(gpencil_stroke_geom_iface) - .vertex_source("gpu_shader_gpencil_stroke_vert.glsl") - .geometry_source("gpu_shader_gpencil_stroke_geom.glsl") - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_shader_gpencil_stroke_base) +GEOMETRY_LAYOUT(PrimitiveIn::LINES_ADJACENCY, PrimitiveOut::TRIANGLE_STRIP, 13) +GEOMETRY_OUT(gpencil_stroke_geom_iface) +VERTEX_SOURCE("gpu_shader_gpencil_stroke_vert.glsl") +GEOMETRY_SOURCE("gpu_shader_gpencil_stroke_geom.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_gpencil_stroke_no_geom) - .metal_backend_only(true) - .define("USE_GEOMETRY_IFACE_COLOR") - .additional_info("gpu_shader_gpencil_stroke_base") - .vertex_out(gpencil_stroke_geom_iface) - .vertex_source("gpu_shader_gpencil_stroke_vert_no_geom.glsl") - .do_static_compilation(true); +METAL_BACKEND_ONLY() +DEFINE("USE_GEOMETRY_IFACE_COLOR") +ADDITIONAL_INFO(gpu_shader_gpencil_stroke_base) +VERTEX_OUT(gpencil_stroke_geom_iface) +VERTEX_SOURCE("gpu_shader_gpencil_stroke_vert_no_geom.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_index_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_index_info.hh index 4204416b032..51faa169441 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_index_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_index_info.hh @@ -10,25 +10,28 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_index_2d_array_points) - .local_group_size(16, 16, 1) - .push_constant(Type::INT, "elements_per_curve") - .push_constant(Type::INT, "ncurves") - .storage_buf(0, Qualifier::WRITE, "uint", "out_indices[]") - .compute_source("gpu_shader_index_2d_array_points.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16, 1) +PUSH_CONSTANT(INT, elements_per_curve) +PUSH_CONSTANT(INT, ncurves) +STORAGE_BUF(0, WRITE, uint, out_indices[]) +COMPUTE_SOURCE("gpu_shader_index_2d_array_points.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_index_2d_array_lines) - .local_group_size(16, 16, 1) - .push_constant(Type::INT, "elements_per_curve") - .push_constant(Type::INT, "ncurves") - .storage_buf(0, Qualifier::WRITE, "uint", "out_indices[]") - .compute_source("gpu_shader_index_2d_array_lines.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16, 1) +PUSH_CONSTANT(INT, elements_per_curve) +PUSH_CONSTANT(INT, ncurves) +STORAGE_BUF(0, WRITE, uint, out_indices[]) +COMPUTE_SOURCE("gpu_shader_index_2d_array_lines.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_index_2d_array_tris) - .local_group_size(16, 16, 1) - .push_constant(Type::INT, "elements_per_curve") - .push_constant(Type::INT, "ncurves") - .storage_buf(0, Qualifier::WRITE, "uint", "out_indices[]") - .compute_source("gpu_shader_index_2d_array_tris.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(16, 16, 1) +PUSH_CONSTANT(INT, elements_per_curve) +PUSH_CONSTANT(INT, ncurves) +STORAGE_BUF(0, WRITE, uint, out_indices[]) +COMPUTE_SOURCE("gpu_shader_index_2d_array_tris.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_instance_varying_color_varying_size_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_instance_varying_color_varying_size_info.hh index 844f5f4d982..d21e6257dcb 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_instance_varying_color_varying_size_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_instance_varying_color_varying_size_info.hh @@ -10,14 +10,15 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_instance_varying_color_varying_size) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC4, "color") - .vertex_in(2, Type::FLOAT, "size") - .vertex_in(3, Type::MAT4, "InstanceModelMatrix") - .vertex_out(flat_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ViewProjectionMatrix") - .vertex_source("gpu_shader_instance_variying_size_variying_color_vert.glsl") - .fragment_source("gpu_shader_flat_color_frag.glsl") - .additional_info("gpu_srgb_to_framebuffer_space") - .do_static_compilation(true); +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC4, color) +VERTEX_IN(2, FLOAT, size) +VERTEX_IN(3, MAT4, InstanceModelMatrix) +VERTEX_OUT(flat_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ViewProjectionMatrix) +VERTEX_SOURCE("gpu_shader_instance_variying_size_variying_color_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_flat_color_frag.glsl") +ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_keyframe_shape_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_keyframe_shape_info.hh index ccb188d5e83..a8fa31d6c75 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_keyframe_shape_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_keyframe_shape_info.hh @@ -9,24 +9,26 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_INTERFACE_INFO(keyframe_shape_iface) - .flat(Type::VEC4, "finalColor") - .flat(Type::VEC4, "finalOutlineColor") - .flat(Type::VEC4, "radii") - .flat(Type::VEC4, "thresholds") - .flat(Type::UINT, "finalFlags"); +FLAT(VEC4, finalColor) +FLAT(VEC4, finalOutlineColor) +FLAT(VEC4, radii) +FLAT(VEC4, thresholds) +FLAT(UINT, finalFlags) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(gpu_shader_keyframe_shape) - .typedef_source("GPU_shader_shared.hh") - .vertex_in(0, Type::VEC4, "color") - .vertex_in(1, Type::VEC4, "outlineColor") - .vertex_in(2, Type::VEC2, "pos") - .vertex_in(3, Type::FLOAT, "size") - .vertex_in(4, Type::UINT, "flags") - .vertex_out(keyframe_shape_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC2, "ViewportSize") - .push_constant(Type::FLOAT, "outline_scale") - .vertex_source("gpu_shader_keyframe_shape_vert.glsl") - .fragment_source("gpu_shader_keyframe_shape_frag.glsl") - .do_static_compilation(true); +TYPEDEF_SOURCE("GPU_shader_shared.hh") +VERTEX_IN(0, VEC4, color) +VERTEX_IN(1, VEC4, outlineColor) +VERTEX_IN(2, VEC2, pos) +VERTEX_IN(3, FLOAT, size) +VERTEX_IN(4, UINT, flags) +VERTEX_OUT(keyframe_shape_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC2, ViewportSize) +PUSH_CONSTANT(FLOAT, outline_scale) +VERTEX_SOURCE("gpu_shader_keyframe_shape_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_keyframe_shape_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_line_dashed_uniform_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_line_dashed_uniform_color_info.hh index 0d4535f0146..6c0ed1d687a 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_line_dashed_uniform_color_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_line_dashed_uniform_color_info.hh @@ -11,28 +11,31 @@ /* We leverage hardware interpolation to compute distance along the line. */ GPU_SHADER_INTERFACE_INFO(gpu_shader_line_dashed_interface) - .no_perspective(Type::VEC2, "stipple_start") /* In screen space */ - .flat(Type::VEC2, "stipple_pos"); /* In screen space */ +NO_PERSPECTIVE(VEC2, stipple_start) /* In screen space */ +FLAT(VEC2, stipple_pos) +GPU_SHADER_INTERFACE_END() /* In screen space */ GPU_SHADER_CREATE_INFO(gpu_shader_3D_line_dashed_uniform_color) - .vertex_in(0, Type::VEC3, "pos") - .vertex_out(flat_color_iface) - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::VEC2, "viewport_size") - .push_constant(Type::FLOAT, "dash_width") - .push_constant(Type::FLOAT, "udash_factor") /* if > 1.0, solid line. */ - /* TODO(fclem): Remove this. And decide to discard if color2 alpha is 0. */ - .push_constant(Type::INT, "colors_len") /* Enabled if > 0, 1 for solid line. */ - .push_constant(Type::VEC4, "color") - .push_constant(Type::VEC4, "color2") - .vertex_out(gpu_shader_line_dashed_interface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("gpu_shader_3D_line_dashed_uniform_color_vert.glsl") - .fragment_source("gpu_shader_2D_line_dashed_frag.glsl") - .do_static_compilation(true); +VERTEX_IN(0, VEC3, pos) +VERTEX_OUT(flat_color_iface) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(VEC2, viewport_size) +PUSH_CONSTANT(FLOAT, dash_width) +PUSH_CONSTANT(FLOAT, udash_factor) /* if > 1.0, solid line. */ +/* TODO(fclem): Remove this. And decide to discard if color2 alpha is 0. */ +PUSH_CONSTANT(INT, colors_len) /* Enabled if > 0, 1 for solid line. */ +PUSH_CONSTANT(VEC4, color) +PUSH_CONSTANT(VEC4, color2) +VERTEX_OUT(gpu_shader_line_dashed_interface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("gpu_shader_3D_line_dashed_uniform_color_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_2D_line_dashed_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_shader_3D_line_dashed_uniform_color_clipped) - .push_constant(Type::MAT4, "ModelMatrix") - .additional_info("gpu_shader_3D_line_dashed_uniform_color") - .additional_info("gpu_clip_planes") - .do_static_compilation(true); +PUSH_CONSTANT(MAT4, ModelMatrix) +ADDITIONAL_INFO(gpu_shader_3D_line_dashed_uniform_color) +ADDITIONAL_INFO(gpu_clip_planes) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_print_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_print_info.hh index 37defa7d433..b8462d05a2b 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_print_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_print_info.hh @@ -9,7 +9,7 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_print) - .storage_buf( - GPU_SHADER_PRINTF_SLOT, Qualifier::READ_WRITE, "uint", "gpu_print_buf[]", Frequency::PASS) - .define("GPU_SHADER_PRINTF_MAX_CAPACITY", STRINGIFY(GPU_SHADER_PRINTF_MAX_CAPACITY)) - .define("GPU_PRINT"); +STORAGE_BUF_FREQ(GPU_SHADER_PRINTF_SLOT, READ_WRITE, uint, gpu_print_buf[], PASS) +DEFINE_VALUE("GPU_SHADER_PRINTF_MAX_CAPACITY", STRINGIFY(GPU_SHADER_PRINTF_MAX_CAPACITY)) +DEFINE("GPU_PRINT") +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_sequencer_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_sequencer_info.hh index f18b1807f61..a7f22cd8aed 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_sequencer_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_sequencer_info.hh @@ -10,33 +10,37 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_INTERFACE_INFO(gpu_seq_strip_iface) - .no_perspective(Type::VEC2, "co_interp") - .flat(Type::UINT, "strip_id"); +NO_PERSPECTIVE(VEC2, co_interp) +FLAT(UINT, strip_id) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(gpu_shader_sequencer_strips) - .vertex_out(gpu_seq_strip_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .uniform_buf(0, "SeqStripDrawData", "strip_data[GPU_SEQ_STRIP_DRAW_DATA_LEN]") - .uniform_buf(1, "SeqContextDrawData", "context_data") - .typedef_source("GPU_shader_shared.hh") - .vertex_source("gpu_shader_sequencer_strips_vert.glsl") - .fragment_source("gpu_shader_sequencer_strips_frag.glsl") - .do_static_compilation(true); +VERTEX_OUT(gpu_seq_strip_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +UNIFORM_BUF(0, SeqStripDrawData, strip_data[GPU_SEQ_STRIP_DRAW_DATA_LEN]) +UNIFORM_BUF(1, SeqContextDrawData, context_data) +TYPEDEF_SOURCE("GPU_shader_shared.hh") +VERTEX_SOURCE("gpu_shader_sequencer_strips_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_sequencer_strips_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(gpu_seq_thumb_iface) - .no_perspective(Type::VEC2, "pos_interp") - .no_perspective(Type::VEC2, "texCoord_interp") - .flat(Type::UINT, "thumb_id"); +NO_PERSPECTIVE(VEC2, pos_interp) +NO_PERSPECTIVE(VEC2, texCoord_interp) +FLAT(UINT, thumb_id) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(gpu_shader_sequencer_thumbs) - .vertex_out(gpu_seq_thumb_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .uniform_buf(0, "SeqStripThumbData", "thumb_data[GPU_SEQ_STRIP_DRAW_DATA_LEN]") - .uniform_buf(1, "SeqContextDrawData", "context_data") - .sampler(0, ImageType::FLOAT_2D, "image") - .typedef_source("GPU_shader_shared.hh") - .vertex_source("gpu_shader_sequencer_thumbs_vert.glsl") - .fragment_source("gpu_shader_sequencer_thumbs_frag.glsl") - .do_static_compilation(true); +VERTEX_OUT(gpu_seq_thumb_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +UNIFORM_BUF(0, SeqStripThumbData, thumb_data[GPU_SEQ_STRIP_DRAW_DATA_LEN]) +UNIFORM_BUF(1, SeqContextDrawData, context_data) +SAMPLER(0, FLOAT_2D, image) +TYPEDEF_SOURCE("GPU_shader_shared.hh") +VERTEX_SOURCE("gpu_shader_sequencer_thumbs_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_sequencer_thumbs_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_simple_lighting_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_simple_lighting_info.hh index 2bc349f4b23..997c15a6a2a 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_simple_lighting_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_simple_lighting_info.hh @@ -8,17 +8,20 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(smooth_normal_iface).smooth(Type::VEC3, "normal"); +GPU_SHADER_INTERFACE_INFO(smooth_normal_iface) +SMOOTH(VEC3, normal) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(gpu_shader_simple_lighting) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC3, "nor") - .vertex_out(smooth_normal_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .uniform_buf(0, "SimpleLightingData", "simple_lighting_data", Frequency::PASS) - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::MAT3, "NormalMatrix") - .typedef_source("GPU_shader_shared.hh") - .vertex_source("gpu_shader_3D_normal_vert.glsl") - .fragment_source("gpu_shader_simple_lighting_frag.glsl") - .do_static_compilation(true); +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC3, nor) +VERTEX_OUT(smooth_normal_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +UNIFORM_BUF_FREQ(0, SimpleLightingData, simple_lighting_data, PASS) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(MAT3, NormalMatrix) +TYPEDEF_SOURCE("GPU_shader_shared.hh") +VERTEX_SOURCE("gpu_shader_3D_normal_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_simple_lighting_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_test_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_test_info.hh index f490f304fb7..216a122dab4 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_test_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_test_info.hh @@ -10,137 +10,159 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_shader_test) - .typedef_source("GPU_shader_shared.hh") - .fragment_out(0, Type::UVEC4, "out_test") - .additional_info("draw_fullscreen"); +TYPEDEF_SOURCE("GPU_shader_shared.hh") +FRAGMENT_OUT(0, UVEC4, out_test) +ADDITIONAL_INFO(draw_fullscreen) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_math_test) - .fragment_source("gpu_math_test.glsl") - .additional_info("gpu_shader_test") - .do_static_compilation(true); +FRAGMENT_SOURCE("gpu_math_test.glsl") +ADDITIONAL_INFO(gpu_shader_test) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_compute_1d_test) - .local_group_size(1) - .image(1, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_1D, "img_output") - .compute_source("gpu_compute_1d_test.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(1) +IMAGE(1, GPU_RGBA32F, WRITE, FLOAT_1D, img_output) +COMPUTE_SOURCE("gpu_compute_1d_test.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_compute_2d_test) - .local_group_size(1, 1) - .image(1, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "img_output") - .compute_source("gpu_compute_2d_test.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(1, 1) +IMAGE(1, GPU_RGBA32F, WRITE, FLOAT_2D, img_output) +COMPUTE_SOURCE("gpu_compute_2d_test.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_compute_ibo_test) - .local_group_size(1) - .storage_buf(0, Qualifier::WRITE, "uint", "out_indices[]") - .compute_source("gpu_compute_ibo_test.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(1) +STORAGE_BUF(0, WRITE, uint, out_indices[]) +COMPUTE_SOURCE("gpu_compute_ibo_test.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_compute_vbo_test) - .local_group_size(1) - .storage_buf(0, Qualifier::WRITE, "vec4", "out_positions[]") - .compute_source("gpu_compute_vbo_test.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(1) +STORAGE_BUF(0, WRITE, vec4, out_positions[]) +COMPUTE_SOURCE("gpu_compute_vbo_test.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_compute_ssbo_test) - .local_group_size(1) - .storage_buf(0, Qualifier::WRITE, "int", "data_out[]") - .compute_source("gpu_compute_ssbo_test.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(1) +STORAGE_BUF(0, WRITE, int, data_out[]) +COMPUTE_SOURCE("gpu_compute_ssbo_test.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_compute_ssbo_binding_test) - .local_group_size(1) - .storage_buf(0, Qualifier::WRITE, "int", "data0[]") - .storage_buf(1, Qualifier::WRITE, "int", "data1[]") - .compute_source("gpu_compute_dummy_test.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(1) +STORAGE_BUF(0, WRITE, int, data0[]) +STORAGE_BUF(1, WRITE, int, data1[]) +COMPUTE_SOURCE("gpu_compute_dummy_test.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* Push constants. */ GPU_SHADER_CREATE_INFO(gpu_push_constants_base_test) - .local_group_size(1) - .storage_buf(0, Qualifier::WRITE, "float", "data_out[]") - .compute_source("gpu_push_constants_test.glsl"); +LOCAL_GROUP_SIZE(1) +STORAGE_BUF(0, WRITE, float, data_out[]) +COMPUTE_SOURCE("gpu_push_constants_test.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_push_constants_test) - .additional_info("gpu_push_constants_base_test") - .push_constant(Type::FLOAT, "float_in") - .push_constant(Type::VEC2, "vec2_in") - .push_constant(Type::VEC3, "vec3_in") - .push_constant(Type::VEC4, "vec4_in") - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_push_constants_base_test) +PUSH_CONSTANT(FLOAT, float_in) +PUSH_CONSTANT(VEC2, vec2_in) +PUSH_CONSTANT(VEC3, vec3_in) +PUSH_CONSTANT(VEC4, vec4_in) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* Push constants size test. */ GPU_SHADER_CREATE_INFO(gpu_push_constants_128bytes_test) - .additional_info("gpu_push_constants_test") - .push_constant(Type::FLOAT, "filler", 20) - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_push_constants_test) +PUSH_CONSTANT_ARRAY(FLOAT, filler, 20) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_push_constants_256bytes_test) - .additional_info("gpu_push_constants_128bytes_test") - .push_constant(Type::FLOAT, "filler2", 32) - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_push_constants_128bytes_test) +PUSH_CONSTANT_ARRAY(FLOAT, filler2, 32) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_push_constants_512bytes_test) - .additional_info("gpu_push_constants_256bytes_test") - .push_constant(Type::FLOAT, "filler3", 64) - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_push_constants_256bytes_test) +PUSH_CONSTANT_ARRAY(FLOAT, filler3, 64) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_push_constants_8192bytes_test) - .additional_info("gpu_push_constants_512bytes_test") - .push_constant(Type::FLOAT, "filler4", 1920) - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_push_constants_512bytes_test) +PUSH_CONSTANT_ARRAY(FLOAT, filler4, 1920) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_buffer_texture_test) - .local_group_size(1) - .sampler(0, ImageType::FLOAT_BUFFER, "bufferTexture") - .storage_buf(0, Qualifier::WRITE, "float", "data_out[]") - .compute_source("gpu_buffer_texture_test.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(1) +SAMPLER(0, FLOAT_BUFFER, bufferTexture) +STORAGE_BUF(0, WRITE, float, data_out[]) +COMPUTE_SOURCE("gpu_buffer_texture_test.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* Specialization constants. */ GPU_SHADER_CREATE_INFO(gpu_specialization_constants_base_test) - .storage_buf(0, Qualifier::WRITE, "int", "data_out[]") - .specialization_constant(Type::FLOAT, "float_in", 2) - .specialization_constant(Type::UINT, "uint_in", 3) - .specialization_constant(Type::INT, "int_in", 4) - .specialization_constant(Type::BOOL, "bool_in", true); +STORAGE_BUF(0, WRITE, int, data_out[]) +SPECIALIZATION_CONSTANT(FLOAT, float_in, 2) +SPECIALIZATION_CONSTANT(UINT, uint_in, 3) +SPECIALIZATION_CONSTANT(INT, int_in, 4) +SPECIALIZATION_CONSTANT(BOOL, bool_in, true) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_compute_specialization_test) - .local_group_size(1) - .additional_info("gpu_specialization_constants_base_test") - .compute_source("gpu_specialization_test.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(1) +ADDITIONAL_INFO(gpu_specialization_constants_base_test) +COMPUTE_SOURCE("gpu_specialization_test.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_graphic_specialization_test) - .additional_info("gpu_specialization_constants_base_test") - .vertex_source("gpu_specialization_test.glsl") - .fragment_source("gpu_specialization_test.glsl") - .do_static_compilation(true); +ADDITIONAL_INFO(gpu_specialization_constants_base_test) +VERTEX_SOURCE("gpu_specialization_test.glsl") +FRAGMENT_SOURCE("gpu_specialization_test.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* EEVEE test. */ GPU_SHADER_CREATE_INFO(eevee_shadow_test) - .fragment_source("eevee_shadow_test.glsl") - .additional_info("gpu_shader_test") - .additional_info("eevee_shared") - .do_static_compilation(true); +FRAGMENT_SOURCE("eevee_shadow_test.glsl") +ADDITIONAL_INFO(gpu_shader_test) +ADDITIONAL_INFO(eevee_shared) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_occupancy_test) - .fragment_source("eevee_occupancy_test.glsl") - .additional_info("gpu_shader_test") - .additional_info("eevee_shared") - .do_static_compilation(true); +FRAGMENT_SOURCE("eevee_occupancy_test.glsl") +ADDITIONAL_INFO(gpu_shader_test) +ADDITIONAL_INFO(eevee_shared) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_gbuffer_normal_test) - .fragment_source("eevee_gbuffer_normal_test.glsl") - .additional_info("gpu_shader_test") - .additional_info("eevee_shared") - .do_static_compilation(true); +FRAGMENT_SOURCE("eevee_gbuffer_normal_test.glsl") +ADDITIONAL_INFO(gpu_shader_test) +ADDITIONAL_INFO(eevee_shared) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_gbuffer_closure_test) - .fragment_source("eevee_gbuffer_closure_test.glsl") - .additional_info("gpu_shader_test") - .additional_info("eevee_shared") - .do_static_compilation(true); +FRAGMENT_SOURCE("eevee_gbuffer_closure_test.glsl") +ADDITIONAL_INFO(gpu_shader_test) +ADDITIONAL_INFO(eevee_shared) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_shader_text_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_text_info.hh index cb2b8636f9e..0cd355fc6dd 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_text_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_text_info.hh @@ -9,25 +9,22 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_INTERFACE_INFO(text_iface) - .flat(Type::VEC4, "color_flat") - .no_perspective(Type::VEC2, "texCoord_interp") - .flat(Type::INT, "glyph_offset") - .flat(Type::UINT, "glyph_flags") - .flat(Type::IVEC2, "glyph_dim"); +FLAT(VEC4, color_flat) +NO_PERSPECTIVE(VEC2, texCoord_interp) +FLAT(INT, glyph_offset) +FLAT(UINT, glyph_flags) +FLAT(IVEC2, glyph_dim) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(gpu_shader_text) - .vertex_in(0, Type::VEC4, "pos") - .vertex_in(1, Type::VEC4, "col") +VERTEX_IN(0, VEC4, pos) +VERTEX_IN(1, VEC4, col) .vertex_in(2, Type ::IVEC2, "glyph_size") .vertex_in(3, Type ::INT, "offset") - .vertex_in(4, Type ::UINT, "flags") - .vertex_out(text_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::MAT4, "ModelViewProjectionMatrix") - .push_constant(Type::INT, "glyph_tex_width_mask") - .push_constant(Type::INT, "glyph_tex_width_shift") - .sampler(0, ImageType::FLOAT_2D, "glyph", Frequency::PASS) - .vertex_source("gpu_shader_text_vert.glsl") - .fragment_source("gpu_shader_text_frag.glsl") - .additional_info("gpu_srgb_to_framebuffer_space") - .do_static_compilation(true); + .vertex_in(4, Type ::UINT, "flags") VERTEX_OUT(text_iface) FRAGMENT_OUT(0, VEC4, fragColor) + PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) PUSH_CONSTANT(INT, glyph_tex_width_mask) + PUSH_CONSTANT(INT, glyph_tex_width_shift) SAMPLER_FREQ(0, FLOAT_2D, glyph, PASS) + VERTEX_SOURCE("gpu_shader_text_vert.glsl") + FRAGMENT_SOURCE("gpu_shader_text_frag.glsl") + ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) DO_STATIC_COMPILATION() + GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/shaders/infos/gpu_srgb_to_framebuffer_space_info.hh b/source/blender/gpu/shaders/infos/gpu_srgb_to_framebuffer_space_info.hh index 37ff2f958b8..62030deda70 100644 --- a/source/blender/gpu/shaders/infos/gpu_srgb_to_framebuffer_space_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_srgb_to_framebuffer_space_info.hh @@ -9,5 +9,6 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_srgb_to_framebuffer_space) - .push_constant(Type::BOOL, "srgbTarget") - .define("blender_srgb_to_framebuffer_space(a) a"); +PUSH_CONSTANT(BOOL, srgbTarget) +DEFINE("blender_srgb_to_framebuffer_space(a) a") +GPU_SHADER_CREATE_END() -- 2.30.2 From 012344030394f6cb132ebf30e9ee00d5d2c162b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 12:56:20 +0200 Subject: [PATCH 69/90] Add constant accessor operators --- source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index 97e2b939616..2d61dc66e41 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -40,6 +40,7 @@ template struct VecOp { using VecT = VecBase; T &operator[](int) {} + const T &operator[](int) const {} VecT operator+() const {} VecT operator-() const {} @@ -328,6 +329,7 @@ template struct MatOp { using RowT = VecBase; ColT &operator[](int) {} + const ColT &operator[](int) const {} MatT operator*(MatT) const {} -- 2.30.2 From 083f51bef473d1243fcbaba645d1261aa1c04628 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 12:56:48 +0200 Subject: [PATCH 70/90] Add smoothstep overload for scalars --- source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 1 + 1 file changed, 1 insertion(+) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index 2d61dc66e41..929f510688a 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -598,6 +598,7 @@ template T sqrt(T) RET; template T step(T) RET; template T trunc(T) RET; template T ldexp(T, U) RET; +double smoothstep(double, double, double) RET; template T acos(T) RET; template T acosh(T) RET; -- 2.30.2 From 7be82143d40a81810b880345e88df0da9d2f8192 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 12:58:10 +0200 Subject: [PATCH 71/90] Add includes for builtin shaders --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 66 +++++++++---------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index 929f510688a..8f294f8c2df 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -894,40 +894,40 @@ void groupMemoryBarrier() {} // #include "infos/engine_image_info.hh" // #include "infos/gpencil_info.hh" // #include "infos/gpencil_vfx_info.hh" -// #include "infos/gpu_clip_planes_info.hh" -// #include "infos/gpu_index_load_info.hh" -// #include "infos/gpu_shader_2D_area_borders_info.hh" -// #include "infos/gpu_shader_2D_checker_info.hh" -// #include "infos/gpu_shader_2D_diag_stripes_info.hh" -// #include "infos/gpu_shader_2D_image_desaturate_color_info.hh" -// #include "infos/gpu_shader_2D_image_info.hh" -// #include "infos/gpu_shader_2D_image_overlays_merge_info.hh" -// #include "infos/gpu_shader_2D_image_overlays_stereo_merge_info.hh" -// #include "infos/gpu_shader_2D_image_rect_color_info.hh" -// #include "infos/gpu_shader_2D_image_shuffle_color_info.hh" -// #include "infos/gpu_shader_2D_nodelink_info.hh" -// #include "infos/gpu_shader_2D_point_uniform_size_uniform_color_aa_info.hh" -// #include "infos/gpu_shader_2D_point_uniform_size_uniform_color_outline_aa_info.hh" -// #include "infos/gpu_shader_2D_point_varying_size_varying_color_info.hh" -// #include "infos/gpu_shader_2D_widget_info.hh" -// #include "infos/gpu_shader_3D_depth_only_info.hh" -// #include "infos/gpu_shader_3D_flat_color_info.hh" -// #include "infos/gpu_shader_3D_image_info.hh" -// #include "infos/gpu_shader_3D_point_info.hh" -// #include "infos/gpu_shader_3D_polyline_info.hh" -// #include "infos/gpu_shader_3D_smooth_color_info.hh" -// #include "infos/gpu_shader_3D_uniform_color_info.hh" -// #include "infos/gpu_shader_gpencil_stroke_info.hh" +#include "infos/gpu_clip_planes_info.hh" +#include "infos/gpu_index_load_info.hh" +#include "infos/gpu_shader_2D_area_borders_info.hh" +#include "infos/gpu_shader_2D_checker_info.hh" +#include "infos/gpu_shader_2D_diag_stripes_info.hh" +#include "infos/gpu_shader_2D_image_desaturate_color_info.hh" +#include "infos/gpu_shader_2D_image_info.hh" +#include "infos/gpu_shader_2D_image_overlays_merge_info.hh" +#include "infos/gpu_shader_2D_image_overlays_stereo_merge_info.hh" +#include "infos/gpu_shader_2D_image_rect_color_info.hh" +#include "infos/gpu_shader_2D_image_shuffle_color_info.hh" +#include "infos/gpu_shader_2D_nodelink_info.hh" +#include "infos/gpu_shader_2D_point_uniform_size_uniform_color_aa_info.hh" +#include "infos/gpu_shader_2D_point_uniform_size_uniform_color_outline_aa_info.hh" +#include "infos/gpu_shader_2D_point_varying_size_varying_color_info.hh" +#include "infos/gpu_shader_2D_widget_info.hh" +#include "infos/gpu_shader_3D_depth_only_info.hh" +#include "infos/gpu_shader_3D_flat_color_info.hh" +#include "infos/gpu_shader_3D_image_info.hh" +#include "infos/gpu_shader_3D_point_info.hh" +#include "infos/gpu_shader_3D_polyline_info.hh" +#include "infos/gpu_shader_3D_smooth_color_info.hh" +#include "infos/gpu_shader_3D_uniform_color_info.hh" +#include "infos/gpu_shader_gpencil_stroke_info.hh" #include "infos/gpu_shader_icon_info.hh" -// #include "infos/gpu_shader_index_info.hh" -// #include "infos/gpu_shader_instance_varying_color_varying_size_info.hh" -// #include "infos/gpu_shader_keyframe_shape_info.hh" -// #include "infos/gpu_shader_line_dashed_uniform_color_info.hh" -// #include "infos/gpu_shader_print_info.hh" -// #include "infos/gpu_shader_sequencer_info.hh" -// #include "infos/gpu_shader_simple_lighting_info.hh" -// #include "infos/gpu_shader_text_info.hh" -// #include "infos/gpu_srgb_to_framebuffer_space_info.hh" +#include "infos/gpu_shader_index_info.hh" +#include "infos/gpu_shader_instance_varying_color_varying_size_info.hh" +#include "infos/gpu_shader_keyframe_shape_info.hh" +#include "infos/gpu_shader_line_dashed_uniform_color_info.hh" +#include "infos/gpu_shader_print_info.hh" +#include "infos/gpu_shader_sequencer_info.hh" +#include "infos/gpu_shader_simple_lighting_info.hh" +#include "infos/gpu_shader_text_info.hh" +#include "infos/gpu_srgb_to_framebuffer_space_info.hh" // #include "infos/overlay_antialiasing_info.hh" // #include "infos/overlay_armature_info.hh" // #include "infos/overlay_background_info.hh" -- 2.30.2 From 18663835c8bd15c0987f0e29cb28b0507e7ba8d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 13:00:37 +0200 Subject: [PATCH 72/90] Rename draw infos --- .../draw/intern/shaders/draw_debug_info.hh | 59 +-- .../intern/shaders/draw_fullscreen_info.hh | 9 +- .../intern/shaders/draw_hair_refine_info.hh | 37 +- .../intern/shaders/draw_object_infos_info.hh | 67 ++-- .../draw/intern/shaders/draw_view_info.hh | 377 ++++++++++-------- 5 files changed, 297 insertions(+), 252 deletions(-) diff --git a/source/blender/draw/intern/shaders/draw_debug_info.hh b/source/blender/draw/intern/shaders/draw_debug_info.hh index 0121365d957..454f42c0724 100644 --- a/source/blender/draw/intern/shaders/draw_debug_info.hh +++ b/source/blender/draw/intern/shaders/draw_debug_info.hh @@ -12,21 +12,25 @@ * \{ */ GPU_SHADER_CREATE_INFO(draw_debug_print) - .define("DRW_DEBUG_PRINT") - .typedef_source("draw_shader_shared.hh") - .storage_buf(DRW_DEBUG_PRINT_SLOT, Qualifier::READ_WRITE, "uint", "drw_debug_print_buf[]"); +DEFINE("DRW_DEBUG_PRINT") +TYPEDEF_SOURCE("draw_shader_shared.hh") +STORAGE_BUF(DRW_DEBUG_PRINT_SLOT, READ_WRITE, uint, drw_debug_print_buf[]) +GPU_SHADER_CREATE_END() -GPU_SHADER_INTERFACE_INFO(draw_debug_print_display_iface).flat(Type::UINT, "char_index"); +GPU_SHADER_INTERFACE_INFO(draw_debug_print_display_iface) +FLAT(UINT, char_index) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(draw_debug_print_display) - .do_static_compilation(true) - .typedef_source("draw_shader_shared.hh") - .storage_buf(DRW_DEBUG_PRINT_SLOT, Qualifier::READ, "uint", "drw_debug_print_buf[]") - .vertex_out(draw_debug_print_display_iface) - .fragment_out(0, Type::VEC4, "out_color") - .push_constant(Type::VEC2, "viewport_size") - .vertex_source("draw_debug_print_display_vert.glsl") - .fragment_source("draw_debug_print_display_frag.glsl"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("draw_shader_shared.hh") +STORAGE_BUF(DRW_DEBUG_PRINT_SLOT, READ, uint, drw_debug_print_buf[]) +VERTEX_OUT(draw_debug_print_display_iface) +FRAGMENT_OUT(0, VEC4, out_color) +PUSH_CONSTANT(VEC2, viewport_size) +VERTEX_SOURCE("draw_debug_print_display_vert.glsl") +FRAGMENT_SOURCE("draw_debug_print_display_frag.glsl") +GPU_SHADER_CREATE_END() /** \} */ @@ -37,23 +41,24 @@ GPU_SHADER_CREATE_INFO(draw_debug_print_display) * \{ */ GPU_SHADER_CREATE_INFO(draw_debug_draw) - .define("DRW_DEBUG_DRAW") - .typedef_source("draw_shader_shared.hh") - .storage_buf(DRW_DEBUG_DRAW_SLOT, - Qualifier::READ_WRITE, - "DRWDebugVert", - "drw_debug_verts_buf[]"); +DEFINE("DRW_DEBUG_DRAW") +TYPEDEF_SOURCE("draw_shader_shared.hh") +STORAGE_BUF(DRW_DEBUG_DRAW_SLOT, READ_WRITE, DRWDebugVert, drw_debug_verts_buf[]) +GPU_SHADER_CREATE_END() -GPU_SHADER_NAMED_INTERFACE_INFO(draw_debug_draw_display_iface, interp).flat(Type::VEC4, "color"); +GPU_SHADER_NAMED_INTERFACE_INFO(draw_debug_draw_display_iface, interp) +FLAT(VEC4, color) +GPU_SHADER_NAMED_INTERFACE_END(interp) GPU_SHADER_CREATE_INFO(draw_debug_draw_display) - .do_static_compilation(true) - .typedef_source("draw_shader_shared.hh") - .storage_buf(DRW_DEBUG_DRAW_SLOT, Qualifier::READ, "DRWDebugVert", "drw_debug_verts_buf[]") - .vertex_out(draw_debug_draw_display_iface) - .fragment_out(0, Type::VEC4, "out_color") - .push_constant(Type::MAT4, "persmat") - .vertex_source("draw_debug_draw_display_vert.glsl") - .fragment_source("draw_debug_draw_display_frag.glsl"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("draw_shader_shared.hh") +STORAGE_BUF(DRW_DEBUG_DRAW_SLOT, READ, DRWDebugVert, drw_debug_verts_buf[]) +VERTEX_OUT(draw_debug_draw_display_iface) +FRAGMENT_OUT(0, VEC4, out_color) +PUSH_CONSTANT(MAT4, persmat) +VERTEX_SOURCE("draw_debug_draw_display_vert.glsl") +FRAGMENT_SOURCE("draw_debug_draw_display_frag.glsl") +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/intern/shaders/draw_fullscreen_info.hh b/source/blender/draw/intern/shaders/draw_fullscreen_info.hh index 09d92f5194d..e117f80c2b5 100644 --- a/source/blender/draw/intern/shaders/draw_fullscreen_info.hh +++ b/source/blender/draw/intern/shaders/draw_fullscreen_info.hh @@ -4,8 +4,11 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(fullscreen_iface).smooth(Type::VEC4, "uvcoordsvar"); +GPU_SHADER_INTERFACE_INFO(fullscreen_iface) +SMOOTH(VEC4, uvcoordsvar) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(draw_fullscreen) - .vertex_out(fullscreen_iface) - .vertex_source("common_fullscreen_vert.glsl"); +VERTEX_OUT(fullscreen_iface) +VERTEX_SOURCE("common_fullscreen_vert.glsl") +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/intern/shaders/draw_hair_refine_info.hh b/source/blender/draw/intern/shaders/draw_hair_refine_info.hh index 81d0b6ab1ae..d6b7afd1fd2 100644 --- a/source/blender/draw/intern/shaders/draw_hair_refine_info.hh +++ b/source/blender/draw/intern/shaders/draw_hair_refine_info.hh @@ -9,21 +9,22 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(draw_hair_refine_compute) - .local_group_size(1, 1) - .storage_buf(0, Qualifier::WRITE, "vec4", "posTime[]") - .sampler(0, ImageType::FLOAT_BUFFER, "hairPointBuffer") - .sampler(1, ImageType::UINT_BUFFER, "hairStrandBuffer") - .sampler(2, ImageType::UINT_BUFFER, "hairStrandSegBuffer") - .push_constant(Type::MAT4, "hairDupliMatrix") - .push_constant(Type::BOOL, "hairCloseTip") - .push_constant(Type::FLOAT, "hairRadShape") - .push_constant(Type::FLOAT, "hairRadTip") - .push_constant(Type::FLOAT, "hairRadRoot") - .push_constant(Type::INT, "hairThicknessRes") - .push_constant(Type::INT, "hairStrandsRes") - .push_constant(Type::INT, "hairStrandOffset") - .compute_source("common_hair_refine_comp.glsl") - .define("HAIR_PHASE_SUBDIV") - .define("HAIR_SHADER") - .define("DRW_HAIR_INFO") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(1, 1) +STORAGE_BUF(0, WRITE, vec4, posTime[]) +SAMPLER(0, FLOAT_BUFFER, hairPointBuffer) +SAMPLER(1, UINT_BUFFER, hairStrandBuffer) +SAMPLER(2, UINT_BUFFER, hairStrandSegBuffer) +PUSH_CONSTANT(MAT4, hairDupliMatrix) +PUSH_CONSTANT(BOOL, hairCloseTip) +PUSH_CONSTANT(FLOAT, hairRadShape) +PUSH_CONSTANT(FLOAT, hairRadTip) +PUSH_CONSTANT(FLOAT, hairRadRoot) +PUSH_CONSTANT(INT, hairThicknessRes) +PUSH_CONSTANT(INT, hairStrandsRes) +PUSH_CONSTANT(INT, hairStrandOffset) +COMPUTE_SOURCE("common_hair_refine_comp.glsl") +DEFINE("HAIR_PHASE_SUBDIV") +DEFINE("HAIR_SHADER") +DEFINE("DRW_HAIR_INFO") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/intern/shaders/draw_object_infos_info.hh b/source/blender/draw/intern/shaders/draw_object_infos_info.hh index 91497b459b3..38d0dc9cde0 100644 --- a/source/blender/draw/intern/shaders/draw_object_infos_info.hh +++ b/source/blender/draw/intern/shaders/draw_object_infos_info.hh @@ -6,46 +6,49 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(draw_object_infos) - .typedef_source("draw_shader_shared.hh") - .define("OBINFO_LIB") - .define("OrcoTexCoFactors", "(drw_infos[resource_id].orco_mul_bias)") - .define("ObjectInfo", "(drw_infos[resource_id].infos)") - .define("ObjectColor", "(drw_infos[resource_id].ob_color)") - .uniform_buf(DRW_OBJ_INFOS_UBO_SLOT, - "ObjectInfos", - "drw_infos[DRW_RESOURCE_CHUNK_LEN]", - Frequency::BATCH); +TYPEDEF_SOURCE("draw_shader_shared.hh") +DEFINE("OBINFO_LIB") +DEFINE_VALUE("OrcoTexCoFactors", "(drw_infos[resource_id].orco_mul_bias)") +DEFINE_VALUE("ObjectInfo", "(drw_infos[resource_id].infos)") +DEFINE_VALUE("ObjectColor", "(drw_infos[resource_id].ob_color)") +UNIFORM_BUF_FREQ(DRW_OBJ_INFOS_UBO_SLOT, ObjectInfos, drw_infos[DRW_RESOURCE_CHUNK_LEN], BATCH) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_volume_infos) - .typedef_source("draw_shader_shared.hh") - .define("VOLUME_INFO_LIB") - .uniform_buf(DRW_OBJ_DATA_INFO_UBO_SLOT, "VolumeInfos", "drw_volume", Frequency::BATCH); +TYPEDEF_SOURCE("draw_shader_shared.hh") +DEFINE("VOLUME_INFO_LIB") +UNIFORM_BUF_FREQ(DRW_OBJ_DATA_INFO_UBO_SLOT, VolumeInfos, drw_volume, BATCH) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_curves_infos) - .typedef_source("draw_shader_shared.hh") - .uniform_buf(DRW_OBJ_DATA_INFO_UBO_SLOT, "CurvesInfos", "drw_curves", Frequency::BATCH); +TYPEDEF_SOURCE("draw_shader_shared.hh") +UNIFORM_BUF_FREQ(DRW_OBJ_DATA_INFO_UBO_SLOT, CurvesInfos, drw_curves, BATCH) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_layer_attributes) - .typedef_source("draw_shader_shared.hh") - .define("VLATTR_LIB") - .uniform_buf(DRW_LAYER_ATTR_UBO_SLOT, - "LayerAttribute", - "drw_layer_attrs[DRW_RESOURCE_CHUNK_LEN]", - Frequency::BATCH); +TYPEDEF_SOURCE("draw_shader_shared.hh") +DEFINE("VLATTR_LIB") +UNIFORM_BUF_FREQ(DRW_LAYER_ATTR_UBO_SLOT, + LayerAttribute, + drw_layer_attrs[DRW_RESOURCE_CHUNK_LEN], + BATCH) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_object_infos_new) - .typedef_source("draw_shader_shared.hh") - .define("OBINFO_LIB") - .define("OBINFO_NEW") - .define("OrcoTexCoFactors", "(drw_infos[resource_id].orco_mul_bias)") - .define("ObjectInfo", "(drw_infos[resource_id].infos)") - .define("ObjectColor", "(drw_infos[resource_id].ob_color)") - .storage_buf(DRW_OBJ_INFOS_SLOT, Qualifier::READ, "ObjectInfos", "drw_infos[]"); +TYPEDEF_SOURCE("draw_shader_shared.hh") +DEFINE("OBINFO_LIB") +DEFINE("OBINFO_NEW") +DEFINE_VALUE("OrcoTexCoFactors", "(drw_infos[resource_id].orco_mul_bias)") +DEFINE_VALUE("ObjectInfo", "(drw_infos[resource_id].infos)") +DEFINE_VALUE("ObjectColor", "(drw_infos[resource_id].ob_color)") +STORAGE_BUF(DRW_OBJ_INFOS_SLOT, READ, ObjectInfos, drw_infos[]) +GPU_SHADER_CREATE_END() /** \note Requires draw_object_infos_new. */ GPU_SHADER_CREATE_INFO(draw_object_attribute_new) - .define("OBATTR_LIB") - .define("ObjectAttributeStart", "(drw_infos[resource_id].orco_mul_bias[0].w)") - .define("ObjectAttributeLen", "(drw_infos[resource_id].orco_mul_bias[1].w)") - .storage_buf(DRW_OBJ_ATTR_SLOT, Qualifier::READ, "ObjectAttribute", "drw_attrs[]") - .additional_info("draw_object_infos_new"); +DEFINE("OBATTR_LIB") +DEFINE_VALUE("ObjectAttributeStart", "(drw_infos[resource_id].orco_mul_bias[0].w)") +DEFINE_VALUE("ObjectAttributeLen", "(drw_infos[resource_id].orco_mul_bias[1].w)") +STORAGE_BUF(DRW_OBJ_ATTR_SLOT, READ, ObjectAttribute, drw_attrs[]) +ADDITIONAL_INFO(draw_object_infos_new) +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/intern/shaders/draw_view_info.hh b/source/blender/draw/intern/shaders/draw_view_info.hh index 79067cfcd69..ed06cdda886 100644 --- a/source/blender/draw/intern/shaders/draw_view_info.hh +++ b/source/blender/draw/intern/shaders/draw_view_info.hh @@ -14,31 +14,37 @@ * \{ */ /* Standard way. Use gpu_InstanceIndex to index the object data. */ -GPU_SHADER_CREATE_INFO(draw_resource_id).define("DYNAMIC_RESOURCE_ID"); +GPU_SHADER_CREATE_INFO(draw_resource_id) +DEFINE("DYNAMIC_RESOURCE_ID") +GPU_SHADER_CREATE_END() /** * Used if the resource index needs to be passed to the fragment shader. * IMPORTANT: Vertex and Geometry shaders need to use PASS_RESOURCE_ID in main(). */ GPU_SHADER_NAMED_INTERFACE_INFO(draw_resource_id_iface, drw_ResourceID_iface) - .flat(Type::INT, "resource_index"); +FLAT(INT, resource_index) +GPU_SHADER_NAMED_INTERFACE_END(drw_ResourceID_iface) GPU_SHADER_CREATE_INFO(draw_resource_id_varying) - .vertex_out(draw_resource_id_iface) - .geometry_out(draw_resource_id_iface); /* Used if needed. */ +VERTEX_OUT(draw_resource_id_iface) +GEOMETRY_OUT(draw_resource_id_iface) +GPU_SHADER_CREATE_END() /* Used if needed. */ /* Variation used when drawing multiple instances for one object. */ GPU_SHADER_CREATE_INFO(draw_resource_id_uniform) - .define("UNIFORM_RESOURCE_ID") - .push_constant(Type::INT, "drw_ResourceID"); +DEFINE("UNIFORM_RESOURCE_ID") +PUSH_CONSTANT(INT, drw_ResourceID) +GPU_SHADER_CREATE_END() /** * Declare a resource handle that identify a unique object. * Requires draw_resource_id[_uniform]. */ GPU_SHADER_CREATE_INFO(draw_resource_handle) - .define("resource_handle", "(drw_resourceChunk * DRW_RESOURCE_CHUNK_LEN + resource_id)") - .push_constant(Type::INT, "drw_resourceChunk"); +DEFINE_VALUE("resource_handle", "(drw_resourceChunk * DRW_RESOURCE_CHUNK_LEN + resource_id)") +PUSH_CONSTANT(INT, drw_resourceChunk) +GPU_SHADER_CREATE_END() /** \} */ @@ -47,36 +53,38 @@ GPU_SHADER_CREATE_INFO(draw_resource_handle) * \{ */ GPU_SHADER_CREATE_INFO(draw_view) - .uniform_buf(DRW_VIEW_UBO_SLOT, "ViewMatrices", "drw_view_[DRW_VIEW_LEN]", Frequency::PASS) - .define("DRAW_VIEW_CREATE_INFO") - .define("drw_view", "drw_view_[drw_view_id]") - .typedef_source("draw_shader_shared.hh"); +UNIFORM_BUF_FREQ(DRW_VIEW_UBO_SLOT, ViewMatrices, drw_view_[DRW_VIEW_LEN], PASS) +DEFINE("DRAW_VIEW_CREATE_INFO") +DEFINE_VALUE("drw_view", "drw_view_[drw_view_id]") +TYPEDEF_SOURCE("draw_shader_shared.hh") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_view_culling) - .uniform_buf(DRW_VIEW_CULLING_UBO_SLOT, "ViewCullingData", "drw_view_culling_[DRW_VIEW_LEN]") - .define("DRW_VIEW_CULLING_INFO") - .define("drw_view_culling", "drw_view_culling_[drw_view_id]") - .typedef_source("draw_shader_shared.hh"); +UNIFORM_BUF(DRW_VIEW_CULLING_UBO_SLOT, ViewCullingData, drw_view_culling_[DRW_VIEW_LEN]) +DEFINE("DRW_VIEW_CULLING_INFO") +DEFINE_VALUE("drw_view_culling", "drw_view_culling_[drw_view_id]") +TYPEDEF_SOURCE("draw_shader_shared.hh") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_modelmat) - .uniform_buf(DRW_OBJ_MAT_UBO_SLOT, - "ObjectMatrices", - "drw_matrices[DRW_RESOURCE_CHUNK_LEN]", - Frequency::BATCH) - .define("ModelMatrix", "(drw_matrices[resource_id].model)") - .define("ModelMatrixInverse", "(drw_matrices[resource_id].model_inverse)") - .additional_info("draw_view"); +UNIFORM_BUF_FREQ(DRW_OBJ_MAT_UBO_SLOT, ObjectMatrices, drw_matrices[DRW_RESOURCE_CHUNK_LEN], BATCH) +DEFINE_VALUE("ModelMatrix", "(drw_matrices[resource_id].model)") +DEFINE_VALUE("ModelMatrixInverse", "(drw_matrices[resource_id].model_inverse)") +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_modelmat_legacy) - .define("DRW_LEGACY_MODEL_MATRIX") - .push_constant(Type::MAT4, "ModelMatrix") - .push_constant(Type::MAT4, "ModelMatrixInverse") - .additional_info("draw_view"); +DEFINE("DRW_LEGACY_MODEL_MATRIX") +PUSH_CONSTANT(MAT4, ModelMatrix) +PUSH_CONSTANT(MAT4, ModelMatrixInverse) +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_modelmat_instanced_attr) - .push_constant(Type::MAT4, "ModelMatrix") - .push_constant(Type::MAT4, "ModelMatrixInverse") - .additional_info("draw_view"); +PUSH_CONSTANT(MAT4, ModelMatrix) +PUSH_CONSTANT(MAT4, ModelMatrixInverse) +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() /** \} */ @@ -85,9 +93,10 @@ GPU_SHADER_CREATE_INFO(draw_modelmat_instanced_attr) * \{ */ GPU_SHADER_CREATE_INFO(drw_clipped) - /* TODO(fclem): Move to engine side. */ - .uniform_buf(DRW_CLIPPING_UBO_SLOT, "vec4", "drw_clipping_[6]", Frequency::PASS) - .define("USE_WORLD_CLIP_PLANES"); +/* TODO(fclem): Move to engine side. */ +UNIFORM_BUF_FREQ(DRW_CLIPPING_UBO_SLOT, vec4, drw_clipping_[6], PASS) +DEFINE("USE_WORLD_CLIP_PLANES") +GPU_SHADER_CREATE_END() /** \} */ @@ -96,8 +105,9 @@ GPU_SHADER_CREATE_INFO(drw_clipped) * \{ */ GPU_SHADER_CREATE_INFO(draw_globals) - .typedef_source("draw_common_shader_shared.hh") - .uniform_buf(7, "GlobalsUboStorage", "globalsBlock", Frequency::PASS); +TYPEDEF_SOURCE("draw_common_shader_shared.hh") +UNIFORM_BUF_FREQ(7, GlobalsUboStorage, globalsBlock, PASS) +GPU_SHADER_CREATE_END() /** \} */ @@ -106,91 +116,101 @@ GPU_SHADER_CREATE_INFO(draw_globals) * \{ */ GPU_SHADER_CREATE_INFO(draw_mesh) - .additional_info("draw_modelmat") - .additional_info("draw_resource_id"); +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(draw_resource_id) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_mesh_new) - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_id"); +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_id) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_hair) - .define("HAIR_SHADER") - .define("DRW_HAIR_INFO") - .sampler(15, ImageType::FLOAT_BUFFER, "hairPointBuffer") - /* TODO(@fclem): Pack these into one UBO. */ - .push_constant(Type::INT, "hairStrandsRes") - .push_constant(Type::INT, "hairThicknessRes") - .push_constant(Type::FLOAT, "hairRadRoot") - .push_constant(Type::FLOAT, "hairRadTip") - .push_constant(Type::FLOAT, "hairRadShape") - .push_constant(Type::BOOL, "hairCloseTip") - .push_constant(Type::INT, "hairStrandOffset") - .push_constant(Type::MAT4, "hairDupliMatrix") - .additional_info("draw_modelmat") - .additional_info("draw_resource_id"); +DEFINE("HAIR_SHADER") +DEFINE("DRW_HAIR_INFO") +SAMPLER(15, FLOAT_BUFFER, hairPointBuffer) +/* TODO(@fclem): Pack these into one UBO. */ +PUSH_CONSTANT(INT, hairStrandsRes) +PUSH_CONSTANT(INT, hairThicknessRes) +PUSH_CONSTANT(FLOAT, hairRadRoot) +PUSH_CONSTANT(FLOAT, hairRadTip) +PUSH_CONSTANT(FLOAT, hairRadShape) +PUSH_CONSTANT(BOOL, hairCloseTip) +PUSH_CONSTANT(INT, hairStrandOffset) +PUSH_CONSTANT(MAT4, hairDupliMatrix) +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(draw_resource_id) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_hair_new) - .define("HAIR_SHADER") - .define("DRW_HAIR_INFO") - .sampler(0, ImageType::FLOAT_BUFFER, "hairPointBuffer") - /* TODO(@fclem): Pack these into one UBO. */ - .push_constant(Type::INT, "hairStrandsRes") - .push_constant(Type::INT, "hairThicknessRes") - .push_constant(Type::FLOAT, "hairRadRoot") - .push_constant(Type::FLOAT, "hairRadTip") - .push_constant(Type::FLOAT, "hairRadShape") - .push_constant(Type::BOOL, "hairCloseTip") - .push_constant(Type::INT, "hairStrandOffset") - .push_constant(Type::MAT4, "hairDupliMatrix"); +DEFINE("HAIR_SHADER") +DEFINE("DRW_HAIR_INFO") +SAMPLER(0, FLOAT_BUFFER, hairPointBuffer) +/* TODO(@fclem): Pack these into one UBO. */ +PUSH_CONSTANT(INT, hairStrandsRes) +PUSH_CONSTANT(INT, hairThicknessRes) +PUSH_CONSTANT(FLOAT, hairRadRoot) +PUSH_CONSTANT(FLOAT, hairRadTip) +PUSH_CONSTANT(FLOAT, hairRadShape) +PUSH_CONSTANT(BOOL, hairCloseTip) +PUSH_CONSTANT(INT, hairStrandOffset) +PUSH_CONSTANT(MAT4, hairDupliMatrix) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_pointcloud) - .sampler(0, ImageType::FLOAT_BUFFER, "ptcloud_pos_rad_tx", Frequency::BATCH) - .define("POINTCLOUD_SHADER") - .define("DRW_POINTCLOUD_INFO") - .additional_info("draw_modelmat_instanced_attr") - .additional_info("draw_resource_id_uniform"); +SAMPLER_FREQ(0, FLOAT_BUFFER, ptcloud_pos_rad_tx, BATCH) +DEFINE("POINTCLOUD_SHADER") +DEFINE("DRW_POINTCLOUD_INFO") +ADDITIONAL_INFO(draw_modelmat_instanced_attr) +ADDITIONAL_INFO(draw_resource_id_uniform) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_pointcloud_new) - .sampler(0, ImageType::FLOAT_BUFFER, "ptcloud_pos_rad_tx", Frequency::BATCH) - .define("POINTCLOUD_SHADER") - .define("DRW_POINTCLOUD_INFO"); +SAMPLER_FREQ(0, FLOAT_BUFFER, ptcloud_pos_rad_tx, BATCH) +DEFINE("POINTCLOUD_SHADER") +DEFINE("DRW_POINTCLOUD_INFO") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_volume) - .additional_info("draw_modelmat") - .additional_info("draw_resource_id_uniform"); +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(draw_resource_id_uniform) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_volume_new) - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new"); +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_gpencil) - .typedef_source("gpencil_shader_shared.h") - .define("DRW_GPENCIL_INFO") - .sampler(0, ImageType::FLOAT_BUFFER, "gp_pos_tx") - .sampler(1, ImageType::FLOAT_BUFFER, "gp_col_tx") - /* Per Object */ - .push_constant(Type::FLOAT, "gpThicknessScale") /* TODO(fclem): Replace with object info. */ - .push_constant(Type::FLOAT, "gpThicknessWorldScale") /* TODO(fclem): Same as above. */ - .define("gpThicknessIsScreenSpace", "(gpThicknessWorldScale < 0.0)") - /* Per Layer */ - .push_constant(Type::FLOAT, "gpThicknessOffset") - .additional_info("draw_modelmat") - .additional_info("draw_object_infos"); +TYPEDEF_SOURCE("gpencil_shader_shared.h") +DEFINE("DRW_GPENCIL_INFO") +SAMPLER(0, FLOAT_BUFFER, gp_pos_tx) +SAMPLER(1, FLOAT_BUFFER, gp_col_tx) +/* Per Object */ +PUSH_CONSTANT(FLOAT, gpThicknessScale) /* TODO(fclem): Replace with object info. */ +PUSH_CONSTANT(FLOAT, gpThicknessWorldScale) /* TODO(fclem): Same as above. */ +DEFINE_VALUE("gpThicknessIsScreenSpace", "(gpThicknessWorldScale < 0.0)") +/* Per Layer */ +PUSH_CONSTANT(FLOAT, gpThicknessOffset) +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(draw_object_infos) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_gpencil_new) - .typedef_source("gpencil_shader_shared.h") - .define("DRW_GPENCIL_INFO") - .sampler(0, ImageType::FLOAT_BUFFER, "gp_pos_tx") - .sampler(1, ImageType::FLOAT_BUFFER, "gp_col_tx") - /* Per Object */ - .push_constant(Type::FLOAT, "gpThicknessScale") /* TODO(fclem): Replace with object info. */ - .push_constant(Type::FLOAT, "gpThicknessWorldScale") /* TODO(fclem): Same as above. */ - .define("gpThicknessIsScreenSpace", "(gpThicknessWorldScale < 0.0)") - /* Per Layer */ - .push_constant(Type::FLOAT, "gpThicknessOffset") - .additional_info("draw_resource_id_varying") - .additional_info("draw_view") - .additional_info("draw_object_infos_new"); +TYPEDEF_SOURCE("gpencil_shader_shared.h") +DEFINE("DRW_GPENCIL_INFO") +SAMPLER(0, FLOAT_BUFFER, gp_pos_tx) +SAMPLER(1, FLOAT_BUFFER, gp_col_tx) +/* Per Object */ +PUSH_CONSTANT(FLOAT, gpThicknessScale) /* TODO(fclem): Replace with object info. */ +PUSH_CONSTANT(FLOAT, gpThicknessWorldScale) /* TODO(fclem): Same as above. */ +DEFINE_VALUE("gpThicknessIsScreenSpace", "(gpThicknessWorldScale < 0.0)") +/* Per Layer */ +PUSH_CONSTANT(FLOAT, gpThicknessOffset) +ADDITIONAL_INFO(draw_resource_id_varying) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_object_infos_new) +GPU_SHADER_CREATE_END() /** \} */ @@ -199,52 +219,56 @@ GPU_SHADER_CREATE_INFO(draw_gpencil_new) * \{ */ GPU_SHADER_CREATE_INFO(draw_resource_finalize) - .do_static_compilation(true) - .typedef_source("draw_shader_shared.hh") - .define("DRAW_FINALIZE_SHADER") - .local_group_size(DRW_FINALIZE_GROUP_SIZE) - .storage_buf(0, Qualifier::READ, "ObjectMatrices", "matrix_buf[]") - .storage_buf(1, Qualifier::READ_WRITE, "ObjectBounds", "bounds_buf[]") - .storage_buf(2, Qualifier::READ_WRITE, "ObjectInfos", "infos_buf[]") - .push_constant(Type::INT, "resource_len") - .compute_source("draw_resource_finalize_comp.glsl"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("draw_shader_shared.hh") +DEFINE("DRAW_FINALIZE_SHADER") +LOCAL_GROUP_SIZE(DRW_FINALIZE_GROUP_SIZE) +STORAGE_BUF(0, READ, ObjectMatrices, matrix_buf[]) +STORAGE_BUF(1, READ_WRITE, ObjectBounds, bounds_buf[]) +STORAGE_BUF(2, READ_WRITE, ObjectInfos, infos_buf[]) +PUSH_CONSTANT(INT, resource_len) +COMPUTE_SOURCE("draw_resource_finalize_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_view_finalize) - .do_static_compilation(true) - .local_group_size(DRW_VIEW_MAX) - .define("DRW_VIEW_LEN", STRINGIFY(DRW_VIEW_MAX)) - .storage_buf(0, Qualifier::READ_WRITE, "ViewCullingData", "view_culling_buf[DRW_VIEW_LEN]") - .compute_source("draw_view_finalize_comp.glsl") - .additional_info("draw_view"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(DRW_VIEW_MAX) +DEFINE_VALUE("DRW_VIEW_LEN", STRINGIFY(DRW_VIEW_MAX)) +STORAGE_BUF(0, READ_WRITE, ViewCullingData, view_culling_buf[DRW_VIEW_LEN]) +COMPUTE_SOURCE("draw_view_finalize_comp.glsl") +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_visibility_compute) - .do_static_compilation(true) - .local_group_size(DRW_VISIBILITY_GROUP_SIZE) - .define("DRW_VIEW_LEN", STRINGIFY(DRW_VIEW_MAX)) - .storage_buf(0, Qualifier::READ, "ObjectBounds", "bounds_buf[]") - .storage_buf(1, Qualifier::READ_WRITE, "uint", "visibility_buf[]") - .push_constant(Type::INT, "resource_len") - .push_constant(Type::INT, "view_len") - .push_constant(Type::INT, "visibility_word_per_draw") - .compute_source("draw_visibility_comp.glsl") - .additional_info("draw_view") - .additional_info("draw_view_culling"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(DRW_VISIBILITY_GROUP_SIZE) +DEFINE_VALUE("DRW_VIEW_LEN", STRINGIFY(DRW_VIEW_MAX)) +STORAGE_BUF(0, READ, ObjectBounds, bounds_buf[]) +STORAGE_BUF(1, READ_WRITE, uint, visibility_buf[]) +PUSH_CONSTANT(INT, resource_len) +PUSH_CONSTANT(INT, view_len) +PUSH_CONSTANT(INT, visibility_word_per_draw) +COMPUTE_SOURCE("draw_visibility_comp.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_view_culling) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_command_generate) - .do_static_compilation(true) - .typedef_source("draw_shader_shared.hh") - .typedef_source("draw_command_shared.hh") - .local_group_size(DRW_COMMAND_GROUP_SIZE) - .storage_buf(0, Qualifier::READ_WRITE, "DrawGroup", "group_buf[]") - .storage_buf(1, Qualifier::READ, "uint", "visibility_buf[]") - .storage_buf(2, Qualifier::READ, "DrawPrototype", "prototype_buf[]") - .storage_buf(3, Qualifier::WRITE, "DrawCommand", "command_buf[]") - .storage_buf(DRW_RESOURCE_ID_SLOT, Qualifier::WRITE, "uint", "resource_id_buf[]") - .push_constant(Type::INT, "prototype_len") - .push_constant(Type::INT, "visibility_word_per_draw") - .push_constant(Type::INT, "view_shift") - .push_constant(Type::BOOL, "use_custom_ids") - .compute_source("draw_command_generate_comp.glsl"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("draw_shader_shared.hh") +TYPEDEF_SOURCE("draw_command_shared.hh") +LOCAL_GROUP_SIZE(DRW_COMMAND_GROUP_SIZE) +STORAGE_BUF(0, READ_WRITE, DrawGroup, group_buf[]) +STORAGE_BUF(1, READ, uint, visibility_buf[]) +STORAGE_BUF(2, READ, DrawPrototype, prototype_buf[]) +STORAGE_BUF(3, WRITE, DrawCommand, command_buf[]) +STORAGE_BUF(DRW_RESOURCE_ID_SLOT, WRITE, uint, resource_id_buf[]) +PUSH_CONSTANT(INT, prototype_len) +PUSH_CONSTANT(INT, visibility_word_per_draw) +PUSH_CONSTANT(INT, view_shift) +PUSH_CONSTANT(BOOL, use_custom_ids) +COMPUTE_SOURCE("draw_command_generate_comp.glsl") +GPU_SHADER_CREATE_END() /** \} */ @@ -254,35 +278,41 @@ GPU_SHADER_CREATE_INFO(draw_command_generate) * \{ */ GPU_SHADER_CREATE_INFO(draw_resource_id_new) - .define("UNIFORM_RESOURCE_ID_NEW") - /* TODO (Miguel Pozo): This is an int for compatibility. - * It should become uint once the "Next" ports are complete. */ - .storage_buf(DRW_RESOURCE_ID_SLOT, Qualifier::READ, "int", "resource_id_buf[]") - .define("drw_ResourceID", "resource_id_buf[gpu_BaseInstance + gl_InstanceID]"); +DEFINE("UNIFORM_RESOURCE_ID_NEW") +/* TODO (Miguel Pozo): This is an int for compatibility. + * It should become uint once the "Next" ports are complete. */ +STORAGE_BUF(DRW_RESOURCE_ID_SLOT, READ, int, resource_id_buf[]) +DEFINE_VALUE("drw_ResourceID", "resource_id_buf[gpu_BaseInstance + gl_InstanceID]") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_resource_with_custom_id_new) - .define("UNIFORM_RESOURCE_ID_NEW") - .define("WITH_CUSTOM_IDS") - .storage_buf(DRW_RESOURCE_ID_SLOT, Qualifier::READ, "int2", "resource_id_buf[]") - .define("drw_ResourceID", "resource_id_buf[gpu_BaseInstance + gl_InstanceID].x") - .define("drw_CustomID", "resource_id_buf[gpu_BaseInstance + gl_InstanceID].y"); +DEFINE("UNIFORM_RESOURCE_ID_NEW") +DEFINE("WITH_CUSTOM_IDS") +STORAGE_BUF(DRW_RESOURCE_ID_SLOT, READ, int2, resource_id_buf[]) +DEFINE_VALUE("drw_ResourceID", "resource_id_buf[gpu_BaseInstance + gl_InstanceID].x") +DEFINE_VALUE("drw_CustomID", "resource_id_buf[gpu_BaseInstance + gl_InstanceID].y") +GPU_SHADER_CREATE_END() /** * Workaround the lack of gl_BaseInstance by binding the resource_id_buf as vertex buf. */ GPU_SHADER_CREATE_INFO(draw_resource_id_fallback) - .define("UNIFORM_RESOURCE_ID_NEW") - .vertex_in(15, Type::INT, "drw_ResourceID"); +DEFINE("UNIFORM_RESOURCE_ID_NEW") +VERTEX_IN(15, INT, drw_ResourceID) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_resource_with_custom_id_fallback) - .define("UNIFORM_RESOURCE_ID_NEW") - .define("WITH_CUSTOM_IDS") - .vertex_in(15, Type::IVEC2, "vertex_in_drw_ResourceID") - .define("drw_ResourceID", "vertex_in_drw_ResourceID.x") - .define("drw_CustomID", "vertex_in_drw_ResourceID.y"); +DEFINE("UNIFORM_RESOURCE_ID_NEW") +DEFINE("WITH_CUSTOM_IDS") +VERTEX_IN(15, IVEC2, vertex_in_drw_ResourceID) +DEFINE_VALUE("drw_ResourceID", "vertex_in_drw_ResourceID.x") +DEFINE_VALUE("drw_CustomID", "vertex_in_drw_ResourceID.y") +GPU_SHADER_CREATE_END() /** TODO mask view id bits. */ -GPU_SHADER_CREATE_INFO(draw_resource_handle_new).define("resource_handle", "drw_ResourceID"); +GPU_SHADER_CREATE_INFO(draw_resource_handle_new) +DEFINE_VALUE("resource_handle", "drw_ResourceID") +GPU_SHADER_CREATE_END() /** \} */ @@ -291,21 +321,24 @@ GPU_SHADER_CREATE_INFO(draw_resource_handle_new).define("resource_handle", "drw_ * \{ */ GPU_SHADER_CREATE_INFO(draw_modelmat_new_common) - .typedef_source("draw_shader_shared.hh") - .storage_buf(DRW_OBJ_MAT_SLOT, Qualifier::READ, "ObjectMatrices", "drw_matrix_buf[]") - .define("DRAW_MODELMAT_CREATE_INFO") - .define("drw_ModelMatrixInverse", "drw_matrix_buf[resource_id].model_inverse") - .define("drw_ModelMatrix", "drw_matrix_buf[resource_id].model") - /* TODO For compatibility with old shaders. To be removed. */ - .define("ModelMatrixInverse", "drw_ModelMatrixInverse") - .define("ModelMatrix", "drw_ModelMatrix"); +TYPEDEF_SOURCE("draw_shader_shared.hh") +STORAGE_BUF(DRW_OBJ_MAT_SLOT, READ, ObjectMatrices, drw_matrix_buf[]) +DEFINE("DRAW_MODELMAT_CREATE_INFO") +DEFINE_VALUE("drw_ModelMatrixInverse", "drw_matrix_buf[resource_id].model_inverse") +DEFINE_VALUE("drw_ModelMatrix", "drw_matrix_buf[resource_id].model") +/* TODO For compatibility with old shaders. To be removed. */ +DEFINE_VALUE("ModelMatrixInverse", "drw_ModelMatrixInverse") +DEFINE_VALUE("ModelMatrix", "drw_ModelMatrix") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_modelmat_new) - .additional_info("draw_modelmat_new_common") - .additional_info("draw_resource_id_new"); +ADDITIONAL_INFO(draw_modelmat_new_common) +ADDITIONAL_INFO(draw_resource_id_new) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(draw_modelmat_new_with_custom_id) - .additional_info("draw_modelmat_new_common") - .additional_info("draw_resource_with_custom_id_new"); +ADDITIONAL_INFO(draw_modelmat_new_common) +ADDITIONAL_INFO(draw_resource_with_custom_id_new) +GPU_SHADER_CREATE_END() /** \} */ -- 2.30.2 From 9522d41dd57d8a9d0521639f7219b5106faf42e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 13:10:10 +0200 Subject: [PATCH 73/90] Add draw create info includes --- source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index 8f294f8c2df..f344bd2547f 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -810,6 +810,11 @@ void groupMemoryBarrier() {} /* Include all create infos here so that they don't need to be individually included * inside shaders. */ /* TODO(fclem): Enable the ones ported to the macro Create infos. */ +#include "draw_debug_info.hh" +#include "draw_fullscreen_info.hh" +#include "draw_hair_refine_info.hh" +#include "draw_object_infos_info.hh" +#include "draw_view_info.hh" #include "infos/compositor_alpha_crop_info.hh" #include "infos/compositor_bilateral_blur_info.hh" #include "infos/compositor_bokeh_blur_info.hh" @@ -868,11 +873,6 @@ void groupMemoryBarrier() {} #include "infos/compositor_van_vliet_gaussian_blur_info.hh" #include "infos/compositor_write_output_info.hh" #include "infos/compositor_z_combine_info.hh" -// #include "draw_debug_info.hh" -// #include "draw_fullscreen_info.hh" -// #include "draw_hair_refine_info.hh" -// #include "draw_object_infos_info.hh" -// #include "draw_view_info.hh" // #include "infos/basic_depth_info.hh" // #include "infos/eevee_ambient_occlusion_info.hh" // #include "infos/eevee_deferred_info.hh" -- 2.30.2 From 871e3e2e4ff121df6b878a307debc928f5548d98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 13:17:23 +0200 Subject: [PATCH 74/90] fixes to draw defines --- source/blender/draw/intern/draw_shader_shared.hh | 2 +- source/blender/draw/intern/shaders/draw_view_lib.glsl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/draw/intern/draw_shader_shared.hh b/source/blender/draw/intern/draw_shader_shared.hh index 6203c06984d..3eb2243c145 100644 --- a/source/blender/draw/intern/draw_shader_shared.hh +++ b/source/blender/draw/intern/draw_shader_shared.hh @@ -59,7 +59,7 @@ struct ObjectRef; /** \name Views * \{ */ -#ifndef DRW_VIEW_LEN +#if !defined(DRW_VIEW_LEN) && !defined(GLSL_CPP_STUBS) /* Single-view case (default). */ # define drw_view_id 0 # define DRW_VIEW_LEN 1 diff --git a/source/blender/draw/intern/shaders/draw_view_lib.glsl b/source/blender/draw/intern/shaders/draw_view_lib.glsl index fdb2e6488ab..18bc535d727 100644 --- a/source/blender/draw/intern/shaders/draw_view_lib.glsl +++ b/source/blender/draw/intern/shaders/draw_view_lib.glsl @@ -4,7 +4,7 @@ #pragma once -#ifndef DRAW_VIEW_CREATE_INFO +#if !defined(DRAW_VIEW_CREATE_INFO) && !defined(GLSL_CPP_STUBS) # error Missing draw_view additional create info on shader create info #endif -- 2.30.2 From d9bddad56c005f724fc7301b5b53f3a2af069f1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 13:26:36 +0200 Subject: [PATCH 75/90] Fix weird syntax not passing regex replacement --- .../gpu/shaders/infos/gpu_shader_text_info.hh | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/source/blender/gpu/shaders/infos/gpu_shader_text_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_text_info.hh index 0cd355fc6dd..3592858243c 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_text_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_text_info.hh @@ -19,12 +19,15 @@ GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(gpu_shader_text) VERTEX_IN(0, VEC4, pos) VERTEX_IN(1, VEC4, col) - .vertex_in(2, Type ::IVEC2, "glyph_size") - .vertex_in(3, Type ::INT, "offset") - .vertex_in(4, Type ::UINT, "flags") VERTEX_OUT(text_iface) FRAGMENT_OUT(0, VEC4, fragColor) - PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) PUSH_CONSTANT(INT, glyph_tex_width_mask) - PUSH_CONSTANT(INT, glyph_tex_width_shift) SAMPLER_FREQ(0, FLOAT_2D, glyph, PASS) - VERTEX_SOURCE("gpu_shader_text_vert.glsl") - FRAGMENT_SOURCE("gpu_shader_text_frag.glsl") - ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) DO_STATIC_COMPILATION() - GPU_SHADER_CREATE_END() +VERTEX_IN(2, IVEC2, glyph_size) +VERTEX_IN(3, INT, offset) +VERTEX_IN(4, UINT, flags) +VERTEX_OUT(text_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(MAT4, ModelViewProjectionMatrix) +PUSH_CONSTANT(INT, glyph_tex_width_mask) +PUSH_CONSTANT(INT, glyph_tex_width_shift) +SAMPLER_FREQ(0, FLOAT_2D, glyph, PASS) +VERTEX_SOURCE("gpu_shader_text_vert.glsl") +FRAGMENT_SOURCE("gpu_shader_text_frag.glsl") +ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space) DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() -- 2.30.2 From 181785fdc5438348dbb400f68e0123b262b01cc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 17:57:14 +0200 Subject: [PATCH 76/90] Add macro to expand additional infos inside variations macro --- .../basic/shaders/infos/basic_depth_info.hh | 17 ++++----- .../infos/eevee_depth_of_field_info.hh | 15 ++++---- .../shaders/infos/eevee_material_info.hh | 35 +++++++++---------- .../shaders/infos/workbench_composite_info.hh | 19 +++++----- .../shaders/infos/workbench_prepass_info.hh | 31 ++++++++-------- .../shaders/infos/workbench_shadow_info.hh | 25 +++++-------- .../shaders/infos/workbench_volume_info.hh | 24 ++++++------- .../gpu/intern/gpu_shader_create_info.hh | 15 ++++++++ 8 files changed, 85 insertions(+), 96 deletions(-) diff --git a/source/blender/draw/engines/basic/shaders/infos/basic_depth_info.hh b/source/blender/draw/engines/basic/shaders/infos/basic_depth_info.hh index a9f3f6b90c3..e0ccb4dc69e 100644 --- a/source/blender/draw/engines/basic/shaders/infos/basic_depth_info.hh +++ b/source/blender/draw/engines/basic/shaders/infos/basic_depth_info.hh @@ -50,22 +50,19 @@ GPU_SHADER_CREATE_INFO(basic_pointcloud_conservative_no_geom) /** \name Variations Declaration * \{ */ -#define BASIC_FINAL_VARIATION(name, ...) \ - GPU_SHADER_CREATE_INFO(name).additional_info(__VA_ARGS__).do_static_compilation(true); - #define BASIC_CLIPPING_VARIATIONS(prefix, ...) \ - BASIC_FINAL_VARIATION(prefix##_clipped, "drw_clipped", __VA_ARGS__) \ - BASIC_FINAL_VARIATION(prefix, __VA_ARGS__) + CREATE_INFO_VARIANT(prefix##_clipped, drw_clipped, __VA_ARGS__) \ + CREATE_INFO_VARIANT(prefix, __VA_ARGS__) #define BASIC_CONSERVATIVE_VARIATIONS(prefix, ...) \ - BASIC_CLIPPING_VARIATIONS(prefix##_conservative, "basic_conservative", __VA_ARGS__) \ + BASIC_CLIPPING_VARIATIONS(prefix##_conservative, basic_conservative, __VA_ARGS__) \ BASIC_CLIPPING_VARIATIONS(prefix##_conservative_no_geom, __VA_ARGS__) \ BASIC_CLIPPING_VARIATIONS(prefix, __VA_ARGS__) #define BASIC_OBTYPE_VARIATIONS(prefix, ...) \ - BASIC_CONSERVATIVE_VARIATIONS(prefix##_mesh, "basic_mesh", __VA_ARGS__) \ - BASIC_CONSERVATIVE_VARIATIONS(prefix##_pointcloud, "basic_pointcloud", __VA_ARGS__) \ - BASIC_CLIPPING_VARIATIONS(prefix##_curves, "basic_curves", __VA_ARGS__) + BASIC_CONSERVATIVE_VARIATIONS(prefix##_mesh, basic_mesh, __VA_ARGS__) \ + BASIC_CONSERVATIVE_VARIATIONS(prefix##_pointcloud, basic_pointcloud, __VA_ARGS__) \ + BASIC_CLIPPING_VARIATIONS(prefix##_curves, basic_curves, __VA_ARGS__) /** \} */ @@ -75,6 +72,6 @@ GPU_SHADER_CREATE_INFO(basic_pointcloud_conservative_no_geom) GPU_SHADER_CREATE_INFO(basic_depth).fragment_source("basic_depth_frag.glsl"); -BASIC_OBTYPE_VARIATIONS(basic_depth, "basic_depth", "draw_globals"); +BASIC_OBTYPE_VARIATIONS(basic_depth, basic_depth, draw_globals); /** \} */ diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_depth_of_field_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_depth_of_field_info.hh index 3d1644bfe12..8421cb23caf 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_depth_of_field_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_depth_of_field_info.hh @@ -143,16 +143,13 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_lut) GPU_SHADER_CREATE_INFO(eevee_depth_of_field_background).define("DOF_FOREGROUND_PASS", "false"); GPU_SHADER_CREATE_INFO(eevee_depth_of_field_foreground).define("DOF_FOREGROUND_PASS", "true"); -#define EEVEE_DOF_FINAL_VARIATION(name, ...) \ - GPU_SHADER_CREATE_INFO(name).additional_info(__VA_ARGS__).do_static_compilation(true); - #define EEVEE_DOF_LUT_VARIATIONS(prefix, ...) \ - EEVEE_DOF_FINAL_VARIATION(prefix##_lut, "eevee_depth_of_field_lut", __VA_ARGS__) \ - EEVEE_DOF_FINAL_VARIATION(prefix##_no_lut, "eevee_depth_of_field_no_lut", __VA_ARGS__) + CREATE_INFO_VARIANT(prefix##_lut, eevee_depth_of_field_lut, __VA_ARGS__) \ + CREATE_INFO_VARIANT(prefix##_no_lut, eevee_depth_of_field_no_lut, __VA_ARGS__) #define EEVEE_DOF_GROUND_VARIATIONS(name, ...) \ - EEVEE_DOF_LUT_VARIATIONS(name##_background, "eevee_depth_of_field_background", __VA_ARGS__) \ - EEVEE_DOF_LUT_VARIATIONS(name##_foreground, "eevee_depth_of_field_foreground", __VA_ARGS__) + EEVEE_DOF_LUT_VARIATIONS(name##_background, eevee_depth_of_field_background, __VA_ARGS__) \ + EEVEE_DOF_LUT_VARIATIONS(name##_foreground, eevee_depth_of_field_foreground, __VA_ARGS__) /** \} */ @@ -178,7 +175,7 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_gather) .compute_source("eevee_depth_of_field_gather_comp.glsl") .additional_info("eevee_depth_of_field_gather_common"); -EEVEE_DOF_GROUND_VARIATIONS(eevee_depth_of_field_gather, "eevee_depth_of_field_gather") +EEVEE_DOF_GROUND_VARIATIONS(eevee_depth_of_field_gather, eevee_depth_of_field_gather) GPU_SHADER_CREATE_INFO(eevee_depth_of_field_hole_fill) .do_static_compilation(true) @@ -260,6 +257,6 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_resolve) .image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img") .compute_source("eevee_depth_of_field_resolve_comp.glsl"); -EEVEE_DOF_LUT_VARIATIONS(eevee_depth_of_field_resolve, "eevee_depth_of_field_resolve") +EEVEE_DOF_LUT_VARIATIONS(eevee_depth_of_field_resolve, eevee_depth_of_field_resolve) /** \} */ diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh index 85dc0a39702..bcefa36be8c 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh @@ -387,30 +387,27 @@ GPU_SHADER_CREATE_INFO(eevee_material_stub) /* Dummy uniform buffer to detect overlap with material node-tree. */ .uniform_buf(0, "int", "node_tree"); -# define EEVEE_MAT_FINAL_VARIATION(name, ...) \ - GPU_SHADER_CREATE_INFO(name).additional_info(__VA_ARGS__).do_static_compilation(true); - # define EEVEE_MAT_GEOM_VARIATIONS(prefix, ...) \ - EEVEE_MAT_FINAL_VARIATION(prefix##_world, "eevee_geom_world", __VA_ARGS__) \ + CREATE_INFO_VARIANT(prefix##_world, eevee_geom_world, __VA_ARGS__) \ /* Turned off until dependency on common_view/math_lib are sorted out. */ \ - /* EEVEE_MAT_FINAL_VARIATION(prefix##_gpencil, "eevee_geom_gpencil", __VA_ARGS__) */ \ - EEVEE_MAT_FINAL_VARIATION(prefix##_curves, "eevee_geom_curves", __VA_ARGS__) \ - EEVEE_MAT_FINAL_VARIATION(prefix##_mesh, "eevee_geom_mesh", __VA_ARGS__) \ - EEVEE_MAT_FINAL_VARIATION(prefix##_point_cloud, "eevee_geom_point_cloud", __VA_ARGS__) \ - EEVEE_MAT_FINAL_VARIATION(prefix##_volume, "eevee_geom_volume", __VA_ARGS__) + /* CREATE_INFO_VARIANT(prefix##_gpencil, eevee_geom_gpencil, __VA_ARGS__) */ \ + CREATE_INFO_VARIANT(prefix##_curves, eevee_geom_curves, __VA_ARGS__) \ + CREATE_INFO_VARIANT(prefix##_mesh, eevee_geom_mesh, __VA_ARGS__) \ + CREATE_INFO_VARIANT(prefix##_point_cloud, eevee_geom_point_cloud, __VA_ARGS__) \ + CREATE_INFO_VARIANT(prefix##_volume, eevee_geom_volume, __VA_ARGS__) # define EEVEE_MAT_PIPE_VARIATIONS(name, ...) \ - EEVEE_MAT_GEOM_VARIATIONS(name##_world, "eevee_surf_world", __VA_ARGS__) \ - EEVEE_MAT_GEOM_VARIATIONS(name##_depth, "eevee_surf_depth", __VA_ARGS__) \ - EEVEE_MAT_GEOM_VARIATIONS(name##_deferred, "eevee_surf_deferred", __VA_ARGS__) \ - EEVEE_MAT_GEOM_VARIATIONS(name##_forward, "eevee_surf_forward", __VA_ARGS__) \ - EEVEE_MAT_GEOM_VARIATIONS(name##_capture, "eevee_surf_capture", __VA_ARGS__) \ - EEVEE_MAT_GEOM_VARIATIONS(name##_volume, "eevee_surf_volume", __VA_ARGS__) \ - EEVEE_MAT_GEOM_VARIATIONS(name##_occupancy, "eevee_surf_occupancy", __VA_ARGS__) \ - EEVEE_MAT_GEOM_VARIATIONS(name##_shadow_atomic, "eevee_surf_shadow_atomic", __VA_ARGS__) \ - EEVEE_MAT_GEOM_VARIATIONS(name##_shadow_tbdr, "eevee_surf_shadow_tbdr", __VA_ARGS__) + EEVEE_MAT_GEOM_VARIATIONS(name##_world, eevee_surf_world, __VA_ARGS__) \ + EEVEE_MAT_GEOM_VARIATIONS(name##_depth, eevee_surf_depth, __VA_ARGS__) \ + EEVEE_MAT_GEOM_VARIATIONS(name##_deferred, eevee_surf_deferred, __VA_ARGS__) \ + EEVEE_MAT_GEOM_VARIATIONS(name##_forward, eevee_surf_forward, __VA_ARGS__) \ + EEVEE_MAT_GEOM_VARIATIONS(name##_capture, eevee_surf_capture, __VA_ARGS__) \ + EEVEE_MAT_GEOM_VARIATIONS(name##_volume, eevee_surf_volume, __VA_ARGS__) \ + EEVEE_MAT_GEOM_VARIATIONS(name##_occupancy, eevee_surf_occupancy, __VA_ARGS__) \ + EEVEE_MAT_GEOM_VARIATIONS(name##_shadow_atomic, eevee_surf_shadow_atomic, __VA_ARGS__) \ + EEVEE_MAT_GEOM_VARIATIONS(name##_shadow_tbdr, eevee_surf_shadow_tbdr, __VA_ARGS__) -EEVEE_MAT_PIPE_VARIATIONS(eevee_surface, "eevee_material_stub") +EEVEE_MAT_PIPE_VARIATIONS(eevee_surface, eevee_material_stub) #endif diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh index 25cf6a908ed..852dc25bd6c 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh @@ -50,30 +50,27 @@ GPU_SHADER_CREATE_INFO(workbench_resolve_shadow) /* Variations */ -#define WORKBENCH_FINAL_VARIATION(name, ...) \ - GPU_SHADER_CREATE_INFO(name).additional_info(__VA_ARGS__).do_static_compilation(true); - #define WORKBENCH_RESOLVE_SHADOW_VARIATION(prefix, ...) \ - WORKBENCH_FINAL_VARIATION(prefix##_shadow, "workbench_resolve_shadow", __VA_ARGS__) \ - WORKBENCH_FINAL_VARIATION(prefix##_no_shadow, __VA_ARGS__) + CREATE_INFO_VARIANT(prefix##_shadow, workbench_resolve_shadow, __VA_ARGS__) \ + CREATE_INFO_VARIANT(prefix##_no_shadow, __VA_ARGS__) #define WORKBENCH_CURVATURE_VARIATIONS(prefix, ...) \ WORKBENCH_RESOLVE_SHADOW_VARIATION( \ - prefix##_curvature, "workbench_resolve_curvature", __VA_ARGS__) \ + prefix##_curvature, workbench_resolve_curvature, __VA_ARGS__) \ WORKBENCH_RESOLVE_SHADOW_VARIATION(prefix##_no_curvature, __VA_ARGS__) #define WORKBENCH_CAVITY_VARIATIONS(prefix, ...) \ - WORKBENCH_CURVATURE_VARIATIONS(prefix##_cavity, "workbench_resolve_cavity", __VA_ARGS__) \ + WORKBENCH_CURVATURE_VARIATIONS(prefix##_cavity, workbench_resolve_cavity, __VA_ARGS__) \ WORKBENCH_CURVATURE_VARIATIONS(prefix##_no_cavity, __VA_ARGS__) #define WORKBENCH_LIGHTING_VARIATIONS(prefix, ...) \ WORKBENCH_CAVITY_VARIATIONS( \ - prefix##_opaque_studio, "workbench_resolve_opaque_studio", __VA_ARGS__) \ + prefix##_opaque_studio, workbench_resolve_opaque_studio, __VA_ARGS__) \ WORKBENCH_CAVITY_VARIATIONS( \ - prefix##_opaque_matcap, "workbench_resolve_opaque_matcap", __VA_ARGS__) \ - WORKBENCH_CAVITY_VARIATIONS(prefix##_opaque_flat, "workbench_resolve_opaque_flat", __VA_ARGS__) + prefix##_opaque_matcap, workbench_resolve_opaque_matcap, __VA_ARGS__) \ + WORKBENCH_CAVITY_VARIATIONS(prefix##_opaque_flat, workbench_resolve_opaque_flat, __VA_ARGS__) -WORKBENCH_LIGHTING_VARIATIONS(workbench_resolve, "workbench_composite"); +WORKBENCH_LIGHTING_VARIATIONS(workbench_resolve, workbench_composite); #undef WORKBENCH_FINAL_VARIATION #undef WORKBENCH_CURVATURE_VARIATIONS diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_prepass_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_prepass_info.hh index af0baa6b80c..398a45e3c15 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_prepass_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_prepass_info.hh @@ -117,33 +117,30 @@ GPU_SHADER_CREATE_INFO(workbench_flat).define("WORKBENCH_SHADING_FLAT"); GPU_SHADER_CREATE_INFO(workbench_studio).define("WORKBENCH_SHADING_STUDIO"); GPU_SHADER_CREATE_INFO(workbench_matcap).define("WORKBENCH_SHADING_MATCAP"); -#define WORKBENCH_FINAL_VARIATION(name, ...) \ - GPU_SHADER_CREATE_INFO(name).additional_info(__VA_ARGS__).do_static_compilation(true); - #define WORKBENCH_CLIPPING_VARIATIONS(prefix, ...) \ - WORKBENCH_FINAL_VARIATION(prefix##_clip, "drw_clipped", __VA_ARGS__) \ - WORKBENCH_FINAL_VARIATION(prefix##_no_clip, __VA_ARGS__) + CREATE_INFO_VARIANT(prefix##_clip, drw_clipped, __VA_ARGS__) \ + CREATE_INFO_VARIANT(prefix##_no_clip, __VA_ARGS__) #define WORKBENCH_COLOR_VARIATIONS(prefix, ...) \ - WORKBENCH_CLIPPING_VARIATIONS(prefix##_material, "workbench_color_material", __VA_ARGS__) \ - WORKBENCH_CLIPPING_VARIATIONS(prefix##_texture, "workbench_color_texture", __VA_ARGS__) \ - WORKBENCH_CLIPPING_VARIATIONS(prefix##_vertex, "workbench_color_vertex", __VA_ARGS__) + WORKBENCH_CLIPPING_VARIATIONS(prefix##_material, workbench_color_material, __VA_ARGS__) \ + WORKBENCH_CLIPPING_VARIATIONS(prefix##_texture, workbench_color_texture, __VA_ARGS__) \ + WORKBENCH_CLIPPING_VARIATIONS(prefix##_vertex, workbench_color_vertex, __VA_ARGS__) #define WORKBENCH_SHADING_VARIATIONS(prefix, ...) \ - WORKBENCH_COLOR_VARIATIONS(prefix##_flat, "workbench_lighting_flat", __VA_ARGS__) \ - WORKBENCH_COLOR_VARIATIONS(prefix##_studio, "workbench_lighting_studio", __VA_ARGS__) \ - WORKBENCH_COLOR_VARIATIONS(prefix##_matcap, "workbench_lighting_matcap", __VA_ARGS__) + WORKBENCH_COLOR_VARIATIONS(prefix##_flat, workbench_lighting_flat, __VA_ARGS__) \ + WORKBENCH_COLOR_VARIATIONS(prefix##_studio, workbench_lighting_studio, __VA_ARGS__) \ + WORKBENCH_COLOR_VARIATIONS(prefix##_matcap, workbench_lighting_matcap, __VA_ARGS__) #define WORKBENCH_PIPELINE_VARIATIONS(prefix, ...) \ - WORKBENCH_SHADING_VARIATIONS(prefix##_transparent, "workbench_transparent_accum", __VA_ARGS__) \ - WORKBENCH_SHADING_VARIATIONS(prefix##_opaque, "workbench_opaque", __VA_ARGS__) + WORKBENCH_SHADING_VARIATIONS(prefix##_transparent, workbench_transparent_accum, __VA_ARGS__) \ + WORKBENCH_SHADING_VARIATIONS(prefix##_opaque, workbench_opaque, __VA_ARGS__) #define WORKBENCH_GEOMETRY_VARIATIONS(prefix, ...) \ - WORKBENCH_PIPELINE_VARIATIONS(prefix##_mesh, "workbench_mesh", __VA_ARGS__) \ - WORKBENCH_PIPELINE_VARIATIONS(prefix##_curves, "workbench_curves", __VA_ARGS__) \ - WORKBENCH_PIPELINE_VARIATIONS(prefix##_ptcloud, "workbench_pointcloud", __VA_ARGS__) + WORKBENCH_PIPELINE_VARIATIONS(prefix##_mesh, workbench_mesh, __VA_ARGS__) \ + WORKBENCH_PIPELINE_VARIATIONS(prefix##_curves, workbench_curves, __VA_ARGS__) \ + WORKBENCH_PIPELINE_VARIATIONS(prefix##_ptcloud, workbench_pointcloud, __VA_ARGS__) -WORKBENCH_GEOMETRY_VARIATIONS(workbench_prepass, "workbench_prepass"); +WORKBENCH_GEOMETRY_VARIATIONS(workbench_prepass, workbench_prepass); #undef WORKBENCH_FINAL_VARIATION #undef WORKBENCH_CLIPPING_VARIATIONS diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh index cda00ee5ae4..c12ef727c01 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh @@ -70,46 +70,39 @@ GPU_SHADER_CREATE_INFO(workbench_shadow_debug) #define WORKBENCH_SHADOW_VARIATIONS(common, prefix, suffix, ...) \ GPU_SHADER_CREATE_INFO(prefix##_pass_manifold_no_caps##suffix) \ .define("SHADOW_PASS") \ - .vertex_source("workbench_shadow_vert.glsl") \ - .additional_info(common, __VA_ARGS__) \ + .vertex_source("workbench_shadow_vert.glsl") ADDITIONAL_INFO_EXPAND(common, __VA_ARGS__) \ .do_static_compilation(true); \ GPU_SHADER_CREATE_INFO(prefix##_pass_no_manifold_no_caps##suffix) \ .define("SHADOW_PASS") \ .define("DOUBLE_MANIFOLD") \ - .vertex_source("workbench_shadow_vert.glsl") \ - .additional_info(common, __VA_ARGS__) \ + .vertex_source("workbench_shadow_vert.glsl") ADDITIONAL_INFO_EXPAND(common, __VA_ARGS__) \ .do_static_compilation(true); \ GPU_SHADER_CREATE_INFO(prefix##_fail_manifold_caps##suffix) \ .define("SHADOW_FAIL") \ .vertex_source("workbench_shadow_caps_vert.glsl") \ - .additional_info(common, __VA_ARGS__) \ + ADDITIONAL_INFO_EXPAND(common, __VA_ARGS__) \ .do_static_compilation(true); \ GPU_SHADER_CREATE_INFO(prefix##_fail_manifold_no_caps##suffix) \ .define("SHADOW_FAIL") \ - .vertex_source("workbench_shadow_vert.glsl") \ - .additional_info(common, __VA_ARGS__) \ + .vertex_source("workbench_shadow_vert.glsl") ADDITIONAL_INFO_EXPAND(common, __VA_ARGS__) \ .do_static_compilation(true); \ GPU_SHADER_CREATE_INFO(prefix##_fail_no_manifold_caps##suffix) \ .define("SHADOW_FAIL") \ .define("DOUBLE_MANIFOLD") \ .vertex_source("workbench_shadow_caps_vert.glsl") \ - .additional_info(common, __VA_ARGS__) \ + ADDITIONAL_INFO_EXPAND(common, __VA_ARGS__) \ .do_static_compilation(true); \ GPU_SHADER_CREATE_INFO(prefix##_fail_no_manifold_no_caps##suffix) \ .define("SHADOW_FAIL") \ .define("DOUBLE_MANIFOLD") \ - .vertex_source("workbench_shadow_vert.glsl") \ - .additional_info(common, __VA_ARGS__) \ + .vertex_source("workbench_shadow_vert.glsl") ADDITIONAL_INFO_EXPAND(common, __VA_ARGS__) \ .do_static_compilation(true); -WORKBENCH_SHADOW_VARIATIONS("workbench_shadow_common", - workbench_shadow, - , - "workbench_shadow_no_debug") +WORKBENCH_SHADOW_VARIATIONS(workbench_shadow_common, workbench_shadow, , workbench_shadow_no_debug) -WORKBENCH_SHADOW_VARIATIONS("workbench_shadow_common", +WORKBENCH_SHADOW_VARIATIONS(workbench_shadow_common, workbench_shadow, _debug, - "workbench_shadow_debug") + workbench_shadow_debug) /** \} */ diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_volume_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_volume_info.hh index 710881b52e6..2718215a734 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_volume_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_volume_info.hh @@ -105,26 +105,22 @@ GPU_SHADER_CREATE_INFO(workbench_volume_slice) * \{ */ #define WORKBENCH_VOLUME_SLICE_VARIATIONS(prefix, ...) \ - GPU_SHADER_CREATE_INFO(prefix##_slice) \ - .additional_info("workbench_volume_slice", __VA_ARGS__) \ - .do_static_compilation(true); \ - GPU_SHADER_CREATE_INFO(prefix##_no_slice) \ - .additional_info(__VA_ARGS__) \ - .do_static_compilation(true); + CREATE_INFO_VARIANT(prefix##_slice, workbench_volume_slice, __VA_ARGS__) \ + CREATE_INFO_VARIANT(prefix##_no_slice, __VA_ARGS__) #define WORKBENCH_VOLUME_COBA_VARIATIONS(prefix, ...) \ - WORKBENCH_VOLUME_SLICE_VARIATIONS(prefix##_coba, "workbench_volume_coba", __VA_ARGS__) \ - WORKBENCH_VOLUME_SLICE_VARIATIONS(prefix##_no_coba, "workbench_volume_no_coba", __VA_ARGS__) + WORKBENCH_VOLUME_SLICE_VARIATIONS(prefix##_coba, workbench_volume_coba, __VA_ARGS__) \ + WORKBENCH_VOLUME_SLICE_VARIATIONS(prefix##_no_coba, workbench_volume_no_coba, __VA_ARGS__) #define WORKBENCH_VOLUME_INTERP_VARIATIONS(prefix, ...) \ - WORKBENCH_VOLUME_COBA_VARIATIONS(prefix##_linear, "workbench_volume_linear", __VA_ARGS__) \ - WORKBENCH_VOLUME_COBA_VARIATIONS(prefix##_cubic, "workbench_volume_cubic", __VA_ARGS__) \ - WORKBENCH_VOLUME_COBA_VARIATIONS(prefix##_closest, "workbench_volume_closest", __VA_ARGS__) + WORKBENCH_VOLUME_COBA_VARIATIONS(prefix##_linear, workbench_volume_linear, __VA_ARGS__) \ + WORKBENCH_VOLUME_COBA_VARIATIONS(prefix##_cubic, workbench_volume_cubic, __VA_ARGS__) \ + WORKBENCH_VOLUME_COBA_VARIATIONS(prefix##_closest, workbench_volume_closest, __VA_ARGS__) #define WORKBENCH_VOLUME_SMOKE_VARIATIONS(prefix, ...) \ - WORKBENCH_VOLUME_INTERP_VARIATIONS(prefix##_smoke, "workbench_volume_smoke", __VA_ARGS__) \ - WORKBENCH_VOLUME_INTERP_VARIATIONS(prefix##_object, "workbench_volume_object", __VA_ARGS__) + WORKBENCH_VOLUME_INTERP_VARIATIONS(prefix##_smoke, workbench_volume_smoke, __VA_ARGS__) \ + WORKBENCH_VOLUME_INTERP_VARIATIONS(prefix##_object, workbench_volume_object, __VA_ARGS__) -WORKBENCH_VOLUME_SMOKE_VARIATIONS(workbench_volume, "workbench_volume") +WORKBENCH_VOLUME_SMOKE_VARIATIONS(workbench_volume, workbench_volume) /** \} */ diff --git a/source/blender/gpu/intern/gpu_shader_create_info.hh b/source/blender/gpu/intern/gpu_shader_create_info.hh index acdeca0619a..eadb6116a29 100644 --- a/source/blender/gpu/intern/gpu_shader_create_info.hh +++ b/source/blender/gpu/intern/gpu_shader_create_info.hh @@ -15,6 +15,7 @@ #include "BLI_hash.hh" #include "BLI_string_ref.hh" +#include "BLI_utildefines_variadic.h" #include "BLI_vector.hh" #include "GPU_common_types.hh" #include "GPU_material.hh" @@ -1394,3 +1395,17 @@ template<> struct DefaultHash Date: Sat, 28 Sep 2024 18:02:54 +0200 Subject: [PATCH 77/90] Manually port workbench shadow infos --- .../shaders/infos/workbench_shadow_info.hh | 61 ++++++++++++------- 1 file changed, 38 insertions(+), 23 deletions(-) diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh index c12ef727c01..7368928f7e2 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh @@ -69,34 +69,49 @@ GPU_SHADER_CREATE_INFO(workbench_shadow_debug) #define WORKBENCH_SHADOW_VARIATIONS(common, prefix, suffix, ...) \ GPU_SHADER_CREATE_INFO(prefix##_pass_manifold_no_caps##suffix) \ - .define("SHADOW_PASS") \ - .vertex_source("workbench_shadow_vert.glsl") ADDITIONAL_INFO_EXPAND(common, __VA_ARGS__) \ - .do_static_compilation(true); \ + DEFINE("SHADOW_PASS") \ + VERTEX_SOURCE("workbench_shadow_vert.glsl") \ + ADDITIONAL_INFO_EXPAND(common, __VA_ARGS__) \ + DO_STATIC_COMPILATION() \ + GPU_SHADER_CREATE_END() \ +\ GPU_SHADER_CREATE_INFO(prefix##_pass_no_manifold_no_caps##suffix) \ - .define("SHADOW_PASS") \ - .define("DOUBLE_MANIFOLD") \ - .vertex_source("workbench_shadow_vert.glsl") ADDITIONAL_INFO_EXPAND(common, __VA_ARGS__) \ - .do_static_compilation(true); \ + DEFINE("SHADOW_PASS") \ + DEFINE("DOUBLE_MANIFOLD") \ + VERTEX_SOURCE("workbench_shadow_vert.glsl") \ + ADDITIONAL_INFO_EXPAND(common, __VA_ARGS__) \ + DO_STATIC_COMPILATION() \ + GPU_SHADER_CREATE_END() \ +\ GPU_SHADER_CREATE_INFO(prefix##_fail_manifold_caps##suffix) \ - .define("SHADOW_FAIL") \ - .vertex_source("workbench_shadow_caps_vert.glsl") \ - ADDITIONAL_INFO_EXPAND(common, __VA_ARGS__) \ - .do_static_compilation(true); \ + DEFINE("SHADOW_FAIL") \ + VERTEX_SOURCE("workbench_shadow_caps_vert.glsl") \ + ADDITIONAL_INFO_EXPAND(common, __VA_ARGS__) \ + DO_STATIC_COMPILATION() \ + GPU_SHADER_CREATE_END() \ +\ GPU_SHADER_CREATE_INFO(prefix##_fail_manifold_no_caps##suffix) \ - .define("SHADOW_FAIL") \ - .vertex_source("workbench_shadow_vert.glsl") ADDITIONAL_INFO_EXPAND(common, __VA_ARGS__) \ - .do_static_compilation(true); \ + DEFINE("SHADOW_FAIL") \ + VERTEX_SOURCE("workbench_shadow_vert.glsl") \ + ADDITIONAL_INFO_EXPAND(common, __VA_ARGS__) \ + DO_STATIC_COMPILATION() \ + GPU_SHADER_CREATE_END() \ +\ GPU_SHADER_CREATE_INFO(prefix##_fail_no_manifold_caps##suffix) \ - .define("SHADOW_FAIL") \ - .define("DOUBLE_MANIFOLD") \ - .vertex_source("workbench_shadow_caps_vert.glsl") \ - ADDITIONAL_INFO_EXPAND(common, __VA_ARGS__) \ - .do_static_compilation(true); \ + DEFINE("SHADOW_FAIL") \ + DEFINE("DOUBLE_MANIFOLD") \ + VERTEX_SOURCE("workbench_shadow_caps_vert.glsl") \ + ADDITIONAL_INFO_EXPAND(common, __VA_ARGS__) \ + DO_STATIC_COMPILATION() \ + GPU_SHADER_CREATE_END() \ +\ GPU_SHADER_CREATE_INFO(prefix##_fail_no_manifold_no_caps##suffix) \ - .define("SHADOW_FAIL") \ - .define("DOUBLE_MANIFOLD") \ - .vertex_source("workbench_shadow_vert.glsl") ADDITIONAL_INFO_EXPAND(common, __VA_ARGS__) \ - .do_static_compilation(true); + DEFINE("SHADOW_FAIL") \ + DEFINE("DOUBLE_MANIFOLD") \ + VERTEX_SOURCE("workbench_shadow_vert.glsl") \ + ADDITIONAL_INFO_EXPAND(common, __VA_ARGS__) \ + DO_STATIC_COMPILATION() \ + GPU_SHADER_CREATE_END() WORKBENCH_SHADOW_VARIATIONS(workbench_shadow_common, workbench_shadow, , workbench_shadow_no_debug) -- 2.30.2 From 1550f62b3d51697633f2bd91c73c7e5de2acad41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 18:03:38 +0200 Subject: [PATCH 78/90] Mass rename workbench infos --- .../shaders/infos/workbench_composite_info.hh | 55 ++++--- .../shaders/infos/workbench_depth_info.hh | 29 ++-- .../workbench_effect_antialiasing_info.hh | 82 +++++----- .../infos/workbench_effect_dof_info.hh | 88 ++++++----- .../infos/workbench_effect_outline_info.hh | 15 +- .../shaders/infos/workbench_prepass_info.hh | 146 ++++++++++-------- .../shaders/infos/workbench_shadow_info.hh | 72 +++++---- .../workbench_transparent_resolve_info.hh | 13 +- .../shaders/infos/workbench_volume_info.hh | 111 +++++++------ 9 files changed, 341 insertions(+), 270 deletions(-) diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh index 852dc25bd6c..40b561ea783 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh @@ -10,43 +10,52 @@ * \{ */ GPU_SHADER_CREATE_INFO(workbench_composite) - .sampler(3, ImageType::DEPTH_2D, "depth_tx") - .sampler(4, ImageType::FLOAT_2D, "normal_tx") - .sampler(5, ImageType::FLOAT_2D, "material_tx") - .uniform_buf(WB_WORLD_SLOT, "WorldData", "world_data") - .typedef_source("workbench_shader_shared.h") - .push_constant(Type::BOOL, "forceShadowing") - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_source("workbench_composite_frag.glsl") - .additional_info("draw_fullscreen") - .additional_info("draw_view"); +SAMPLER(3, DEPTH_2D, depth_tx) +SAMPLER(4, FLOAT_2D, normal_tx) +SAMPLER(5, FLOAT_2D, material_tx) +UNIFORM_BUF(WB_WORLD_SLOT, WorldData, world_data) +TYPEDEF_SOURCE("workbench_shader_shared.h") +PUSH_CONSTANT(BOOL, forceShadowing) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_SOURCE("workbench_composite_frag.glsl") +ADDITIONAL_INFO(draw_fullscreen) +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() /* Lighting */ -GPU_SHADER_CREATE_INFO(workbench_resolve_opaque_studio).define("WORKBENCH_LIGHTING_STUDIO"); +GPU_SHADER_CREATE_INFO(workbench_resolve_opaque_studio) +DEFINE("WORKBENCH_LIGHTING_STUDIO") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_resolve_opaque_matcap) - .define("WORKBENCH_LIGHTING_MATCAP") - .sampler(WB_MATCAP_SLOT, ImageType::FLOAT_2D_ARRAY, "matcap_tx"); +DEFINE("WORKBENCH_LIGHTING_MATCAP") +SAMPLER(WB_MATCAP_SLOT, FLOAT_2D_ARRAY, matcap_tx) +GPU_SHADER_CREATE_END() -GPU_SHADER_CREATE_INFO(workbench_resolve_opaque_flat).define("WORKBENCH_LIGHTING_FLAT"); +GPU_SHADER_CREATE_INFO(workbench_resolve_opaque_flat) +DEFINE("WORKBENCH_LIGHTING_FLAT") +GPU_SHADER_CREATE_END() /* Effects */ GPU_SHADER_CREATE_INFO(workbench_resolve_curvature) - .define("WORKBENCH_CURVATURE") - .sampler(6, ImageType::UINT_2D, "object_id_tx"); +DEFINE("WORKBENCH_CURVATURE") +SAMPLER(6, UINT_2D, object_id_tx) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_resolve_cavity) - .define("WORKBENCH_CAVITY") - /* TODO(@pragma37): GPU_SAMPLER_EXTEND_MODE_REPEAT is set in CavityEffect, - * it doesn't work here? */ - .sampler(7, ImageType::FLOAT_2D, "jitter_tx") - .uniform_buf(5, "vec4", "cavity_samples[512]"); +DEFINE("WORKBENCH_CAVITY") +/* TODO(@pragma37): GPU_SAMPLER_EXTEND_MODE_REPEAT is set in CavityEffect, + * it doesn't work here? */ +SAMPLER(7, FLOAT_2D, jitter_tx) +UNIFORM_BUF(5, vec4, cavity_samples[512]) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_resolve_shadow) - .define("WORKBENCH_SHADOW") - .sampler(8, ImageType::UINT_2D, "stencil_tx"); +DEFINE("WORKBENCH_SHADOW") +SAMPLER(8, UINT_2D, stencil_tx) +GPU_SHADER_CREATE_END() /* Variations */ diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_depth_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_depth_info.hh index 2d471595090..a5c93de9087 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_depth_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_depth_info.hh @@ -5,20 +5,23 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(workbench_merge_depth) - .sampler(0, ImageType::DEPTH_2D, "depth_tx") - .fragment_source("workbench_merge_depth_frag.glsl") - .additional_info("draw_fullscreen") - .depth_write(DepthWrite::ANY) - .do_static_compilation(true); +SAMPLER(0, DEPTH_2D, depth_tx) +FRAGMENT_SOURCE("workbench_merge_depth_frag.glsl") +ADDITIONAL_INFO(draw_fullscreen) +DEPTH_WRITE(DepthWrite::ANY) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_overlay_depth) - .fragment_source("workbench_overlay_depth_frag.glsl") - .additional_info("draw_fullscreen") - .depth_write(DepthWrite::ANY) - .do_static_compilation(true); +FRAGMENT_SOURCE("workbench_overlay_depth_frag.glsl") +ADDITIONAL_INFO(draw_fullscreen) +DEPTH_WRITE(DepthWrite::ANY) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_extract_stencil) - .fragment_out(0, Type::UINT, "out_stencil_value") - .fragment_source("workbench_extract_stencil.glsl") - .additional_info("draw_fullscreen") - .do_static_compilation(true); +FRAGMENT_OUT(0, UINT, out_stencil_value) +FRAGMENT_SOURCE("workbench_extract_stencil.glsl") +ADDITIONAL_INFO(draw_fullscreen) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_antialiasing_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_antialiasing_info.hh index 345f766e302..1f3cac83cc9 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_antialiasing_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_antialiasing_info.hh @@ -9,12 +9,13 @@ * \{ */ GPU_SHADER_CREATE_INFO(workbench_taa) - .sampler(0, ImageType::FLOAT_2D, "colorBuffer") - .push_constant(Type::FLOAT, "samplesWeights", 9) - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_source("workbench_effect_taa_frag.glsl") - .additional_info("draw_fullscreen") - .do_static_compilation(true); +SAMPLER(0, FLOAT_2D, colorBuffer) +PUSH_CONSTANT_ARRAY(FLOAT, samplesWeights, 9) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_SOURCE("workbench_effect_taa_frag.glsl") +ADDITIONAL_INFO(draw_fullscreen) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /** \} */ @@ -23,45 +24,50 @@ GPU_SHADER_CREATE_INFO(workbench_taa) * \{ */ GPU_SHADER_INTERFACE_INFO(workbench_smaa_iface) - .smooth(Type::VEC2, "uvs") - .smooth(Type::VEC2, "pixcoord") - .smooth(Type::VEC4, "offset[3]"); +SMOOTH(VEC2, uvs) +SMOOTH(VEC2, pixcoord) +SMOOTH(VEC4, offset[3]) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(workbench_smaa) - .define("SMAA_GLSL_3") - .define("SMAA_RT_METRICS", "viewportMetrics") - .define("SMAA_PRESET_HIGH") - .define("SMAA_LUMA_WEIGHT", "float4(1.0, 1.0, 1.0, 1.0)") - .define("SMAA_NO_DISCARD") - .vertex_out(workbench_smaa_iface) - .push_constant(Type::VEC4, "viewportMetrics") - .vertex_source("workbench_effect_smaa_vert.glsl") - .fragment_source("workbench_effect_smaa_frag.glsl"); +DEFINE("SMAA_GLSL_3") +DEFINE_VALUE("SMAA_RT_METRICS", "viewportMetrics") +DEFINE("SMAA_PRESET_HIGH") +DEFINE_VALUE("SMAA_LUMA_WEIGHT", "float4(1.0, 1.0, 1.0, 1.0)") +DEFINE("SMAA_NO_DISCARD") +VERTEX_OUT(workbench_smaa_iface) +PUSH_CONSTANT(VEC4, viewportMetrics) +VERTEX_SOURCE("workbench_effect_smaa_vert.glsl") +FRAGMENT_SOURCE("workbench_effect_smaa_frag.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_smaa_stage_0) - .define("SMAA_STAGE", "0") - .sampler(0, ImageType::FLOAT_2D, "colorTex") - .fragment_out(0, Type::VEC2, "out_edges") - .additional_info("workbench_smaa") - .do_static_compilation(true); +DEFINE_VALUE("SMAA_STAGE", "0") +SAMPLER(0, FLOAT_2D, colorTex) +FRAGMENT_OUT(0, VEC2, out_edges) +ADDITIONAL_INFO(workbench_smaa) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_smaa_stage_1) - .define("SMAA_STAGE", "1") - .sampler(0, ImageType::FLOAT_2D, "edgesTex") - .sampler(1, ImageType::FLOAT_2D, "areaTex") - .sampler(2, ImageType::FLOAT_2D, "searchTex") - .fragment_out(0, Type::VEC4, "out_weights") - .additional_info("workbench_smaa") - .do_static_compilation(true); +DEFINE_VALUE("SMAA_STAGE", "1") +SAMPLER(0, FLOAT_2D, edgesTex) +SAMPLER(1, FLOAT_2D, areaTex) +SAMPLER(2, FLOAT_2D, searchTex) +FRAGMENT_OUT(0, VEC4, out_weights) +ADDITIONAL_INFO(workbench_smaa) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_smaa_stage_2) - .define("SMAA_STAGE", "2") - .sampler(0, ImageType::FLOAT_2D, "colorTex") - .sampler(1, ImageType::FLOAT_2D, "blendTex") - .push_constant(Type::FLOAT, "mixFactor") - .push_constant(Type::FLOAT, "taaAccumulatedWeight") - .fragment_out(0, Type::VEC4, "out_color") - .additional_info("workbench_smaa") - .do_static_compilation(true); +DEFINE_VALUE("SMAA_STAGE", "2") +SAMPLER(0, FLOAT_2D, colorTex) +SAMPLER(1, FLOAT_2D, blendTex) +PUSH_CONSTANT(FLOAT, mixFactor) +PUSH_CONSTANT(FLOAT, taaAccumulatedWeight) +FRAGMENT_OUT(0, VEC4, out_color) +ADDITIONAL_INFO(workbench_smaa) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_dof_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_dof_info.hh index a7ef011e6ca..7ba5b44cc0c 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_dof_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_dof_info.hh @@ -5,54 +5,60 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(workbench_effect_dof) - /* TODO(fclem): Split resources per stage. */ - .sampler(0, ImageType::FLOAT_2D, "inputCocTex") - .sampler(1, ImageType::FLOAT_2D, "maxCocTilesTex") - .sampler(2, ImageType::FLOAT_2D, "sceneColorTex") - .sampler(3, ImageType::FLOAT_2D, "sceneDepthTex") - .sampler(4, ImageType::FLOAT_2D, "backgroundTex") - .sampler(5, ImageType::FLOAT_2D, "halfResColorTex") - .sampler(6, ImageType::FLOAT_2D, "blurTex") - .sampler(7, ImageType::FLOAT_2D, "noiseTex") - .push_constant(Type::VEC2, "invertedViewportSize") - .push_constant(Type::VEC2, "nearFar") - .push_constant(Type::VEC3, "dofParams") - .push_constant(Type::FLOAT, "noiseOffset") - .fragment_source("workbench_effect_dof_frag.glsl") - .additional_info("draw_fullscreen") - .additional_info("draw_view"); +/* TODO(fclem): Split resources per stage. */ +SAMPLER(0, FLOAT_2D, inputCocTex) +SAMPLER(1, FLOAT_2D, maxCocTilesTex) +SAMPLER(2, FLOAT_2D, sceneColorTex) +SAMPLER(3, FLOAT_2D, sceneDepthTex) +SAMPLER(4, FLOAT_2D, backgroundTex) +SAMPLER(5, FLOAT_2D, halfResColorTex) +SAMPLER(6, FLOAT_2D, blurTex) +SAMPLER(7, FLOAT_2D, noiseTex) +PUSH_CONSTANT(VEC2, invertedViewportSize) +PUSH_CONSTANT(VEC2, nearFar) +PUSH_CONSTANT(VEC3, dofParams) +PUSH_CONSTANT(FLOAT, noiseOffset) +FRAGMENT_SOURCE("workbench_effect_dof_frag.glsl") +ADDITIONAL_INFO(draw_fullscreen) +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_effect_dof_prepare) - .define("PREPARE") - .fragment_out(0, Type::VEC4, "halfResColor") - .fragment_out(1, Type::VEC2, "normalizedCoc") - .additional_info("workbench_effect_dof") - .do_static_compilation(true); +DEFINE("PREPARE") +FRAGMENT_OUT(0, VEC4, halfResColor) +FRAGMENT_OUT(1, VEC2, normalizedCoc) +ADDITIONAL_INFO(workbench_effect_dof) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_effect_dof_downsample) - .define("DOWNSAMPLE") - .fragment_out(0, Type::VEC4, "outColor") - .fragment_out(1, Type::VEC2, "outCocs") - .additional_info("workbench_effect_dof") - .do_static_compilation(true); +DEFINE("DOWNSAMPLE") +FRAGMENT_OUT(0, VEC4, outColor) +FRAGMENT_OUT(1, VEC2, outCocs) +ADDITIONAL_INFO(workbench_effect_dof) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_effect_dof_blur1) - .define("BLUR1") - .define("NUM_SAMPLES", "49") - .uniform_buf(1, "vec4", "samples[49]") - .fragment_out(0, Type::VEC4, "blurColor") - .additional_info("workbench_effect_dof") - .do_static_compilation(true); +DEFINE("BLUR1") +DEFINE_VALUE("NUM_SAMPLES", "49") +UNIFORM_BUF(1, vec4, samples[49]) +FRAGMENT_OUT(0, VEC4, blurColor) +ADDITIONAL_INFO(workbench_effect_dof) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_effect_dof_blur2) - .define("BLUR2") - .fragment_out(0, Type::VEC4, "finalColor") - .additional_info("workbench_effect_dof") - .do_static_compilation(true); +DEFINE("BLUR2") +FRAGMENT_OUT(0, VEC4, finalColor) +ADDITIONAL_INFO(workbench_effect_dof) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_effect_dof_resolve) - .define("RESOLVE") - .fragment_out(0, Type::VEC4, "finalColorAdd", DualBlend::SRC_0) - .fragment_out(0, Type::VEC4, "finalColorMul", DualBlend::SRC_1) - .additional_info("workbench_effect_dof") - .do_static_compilation(true); +DEFINE("RESOLVE") +FRAGMENT_OUT_DUAL(0, VEC4, finalColorAdd, SRC_0) +FRAGMENT_OUT_DUAL(0, VEC4, finalColorMul, SRC_1) +ADDITIONAL_INFO(workbench_effect_dof) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_outline_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_outline_info.hh index e820dbfd120..39248506eef 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_outline_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_effect_outline_info.hh @@ -5,10 +5,11 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(workbench_effect_outline) - .typedef_source("workbench_shader_shared.h") - .fragment_source("workbench_effect_outline_frag.glsl") - .sampler(0, ImageType::UINT_2D, "objectIdBuffer") - .uniform_buf(WB_WORLD_SLOT, "WorldData", "world_data") - .fragment_out(0, Type::VEC4, "fragColor") - .additional_info("draw_fullscreen") - .do_static_compilation(true); +TYPEDEF_SOURCE("workbench_shader_shared.h") +FRAGMENT_SOURCE("workbench_effect_outline_frag.glsl") +SAMPLER(0, UINT_2D, objectIdBuffer) +UNIFORM_BUF(WB_WORLD_SLOT, WorldData, world_data) +FRAGMENT_OUT(0, VEC4, fragColor) +ADDITIONAL_INFO(draw_fullscreen) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_prepass_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_prepass_info.hh index 398a45e3c15..522c6261a52 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_prepass_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_prepass_info.hh @@ -10,28 +10,31 @@ * \{ */ GPU_SHADER_CREATE_INFO(workbench_mesh) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC3, "nor") - .vertex_in(2, Type::VEC4, "ac") - .vertex_in(3, Type::VEC2, "au") - .vertex_source("workbench_prepass_vert.glsl") - .additional_info("draw_modelmat_new_with_custom_id") - .additional_info("draw_resource_handle_new"); +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC3, nor) +VERTEX_IN(2, VEC4, ac) +VERTEX_IN(3, VEC2, au) +VERTEX_SOURCE("workbench_prepass_vert.glsl") +ADDITIONAL_INFO(draw_modelmat_new_with_custom_id) +ADDITIONAL_INFO(draw_resource_handle_new) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_curves) - .sampler(WB_CURVES_COLOR_SLOT, ImageType::FLOAT_BUFFER, "ac", Frequency::BATCH) - .sampler(WB_CURVES_UV_SLOT, ImageType::FLOAT_BUFFER, "au", Frequency::BATCH) - .push_constant(Type::INT, "emitter_object_id") - .vertex_source("workbench_prepass_hair_vert.glsl") - .additional_info("draw_modelmat_new_with_custom_id") - .additional_info("draw_resource_handle_new") - .additional_info("draw_hair_new"); +SAMPLER_FREQ(WB_CURVES_COLOR_SLOT, FLOAT_BUFFER, ac, BATCH) +SAMPLER_FREQ(WB_CURVES_UV_SLOT, FLOAT_BUFFER, au, BATCH) +PUSH_CONSTANT(INT, emitter_object_id) +VERTEX_SOURCE("workbench_prepass_hair_vert.glsl") +ADDITIONAL_INFO(draw_modelmat_new_with_custom_id) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(draw_hair_new) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_pointcloud) - .vertex_source("workbench_prepass_pointcloud_vert.glsl") - .additional_info("draw_modelmat_new_with_custom_id") - .additional_info("draw_resource_handle_new") - .additional_info("draw_pointcloud_new"); +VERTEX_SOURCE("workbench_prepass_pointcloud_vert.glsl") +ADDITIONAL_INFO(draw_modelmat_new_with_custom_id) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(draw_pointcloud_new) +GPU_SHADER_CREATE_END() /** \} */ @@ -39,11 +42,16 @@ GPU_SHADER_CREATE_INFO(workbench_pointcloud) /** \name Lighting Type (only for transparent) * \{ */ -GPU_SHADER_CREATE_INFO(workbench_lighting_flat).define("WORKBENCH_LIGHTING_FLAT"); -GPU_SHADER_CREATE_INFO(workbench_lighting_studio).define("WORKBENCH_LIGHTING_STUDIO"); +GPU_SHADER_CREATE_INFO(workbench_lighting_flat) +DEFINE("WORKBENCH_LIGHTING_FLAT") +GPU_SHADER_CREATE_END() +GPU_SHADER_CREATE_INFO(workbench_lighting_studio) +DEFINE("WORKBENCH_LIGHTING_STUDIO") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_lighting_matcap) - .define("WORKBENCH_LIGHTING_MATCAP") - .sampler(WB_MATCAP_SLOT, ImageType::FLOAT_2D_ARRAY, "matcap_tx"); +DEFINE("WORKBENCH_LIGHTING_MATCAP") +SAMPLER(WB_MATCAP_SLOT, FLOAT_2D_ARRAY, matcap_tx) +GPU_SHADER_CREATE_END() /** \} */ @@ -52,37 +60,43 @@ GPU_SHADER_CREATE_INFO(workbench_lighting_matcap) * \{ */ GPU_SHADER_INTERFACE_INFO(workbench_material_iface) - .smooth(Type::VEC3, "normal_interp") - .smooth(Type::VEC3, "color_interp") - .smooth(Type::FLOAT, "alpha_interp") - .smooth(Type::VEC2, "uv_interp") - .flat(Type::INT, "object_id") - .flat(Type::FLOAT, "_roughness") - .flat(Type::FLOAT, "metallic"); +SMOOTH(VEC3, normal_interp) +SMOOTH(VEC3, color_interp) +SMOOTH(FLOAT, alpha_interp) +SMOOTH(VEC2, uv_interp) +FLAT(INT, object_id) +FLAT(FLOAT, _roughness) +FLAT(FLOAT, metallic) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(workbench_color_material) - .define("WORKBENCH_COLOR_MATERIAL") - .storage_buf(WB_MATERIAL_SLOT, Qualifier::READ, "vec4", "materials_data[]"); +DEFINE("WORKBENCH_COLOR_MATERIAL") +STORAGE_BUF(WB_MATERIAL_SLOT, READ, vec4, materials_data[]) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_color_texture) - .define("WORKBENCH_COLOR_TEXTURE") - .define("WORKBENCH_TEXTURE_IMAGE_ARRAY") - .define("WORKBENCH_COLOR_MATERIAL") - .storage_buf(WB_MATERIAL_SLOT, Qualifier::READ, "vec4", "materials_data[]") - .sampler(WB_TEXTURE_SLOT, ImageType::FLOAT_2D, "imageTexture", Frequency::BATCH) - .sampler(WB_TILE_ARRAY_SLOT, ImageType::FLOAT_2D_ARRAY, "imageTileArray", Frequency::BATCH) - .sampler(WB_TILE_DATA_SLOT, ImageType::FLOAT_1D_ARRAY, "imageTileData", Frequency::BATCH) - .push_constant(Type::BOOL, "isImageTile") - .push_constant(Type::BOOL, "imagePremult") - .push_constant(Type::FLOAT, "imageTransparencyCutoff"); +DEFINE("WORKBENCH_COLOR_TEXTURE") +DEFINE("WORKBENCH_TEXTURE_IMAGE_ARRAY") +DEFINE("WORKBENCH_COLOR_MATERIAL") +STORAGE_BUF(WB_MATERIAL_SLOT, READ, vec4, materials_data[]) +SAMPLER_FREQ(WB_TEXTURE_SLOT, FLOAT_2D, imageTexture, BATCH) +SAMPLER_FREQ(WB_TILE_ARRAY_SLOT, FLOAT_2D_ARRAY, imageTileArray, BATCH) +SAMPLER_FREQ(WB_TILE_DATA_SLOT, FLOAT_1D_ARRAY, imageTileData, BATCH) +PUSH_CONSTANT(BOOL, isImageTile) +PUSH_CONSTANT(BOOL, imagePremult) +PUSH_CONSTANT(FLOAT, imageTransparencyCutoff) +GPU_SHADER_CREATE_END() -GPU_SHADER_CREATE_INFO(workbench_color_vertex).define("WORKBENCH_COLOR_VERTEX"); +GPU_SHADER_CREATE_INFO(workbench_color_vertex) +DEFINE("WORKBENCH_COLOR_VERTEX") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_prepass) - .define("WORKBENCH_NEXT") - .uniform_buf(WB_WORLD_SLOT, "WorldData", "world_data") - .vertex_out(workbench_material_iface) - .additional_info("draw_view"); +DEFINE("WORKBENCH_NEXT") +UNIFORM_BUF(WB_WORLD_SLOT, WorldData, world_data) +VERTEX_OUT(workbench_material_iface) +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() /** \} */ @@ -91,21 +105,23 @@ GPU_SHADER_CREATE_INFO(workbench_prepass) * \{ */ GPU_SHADER_CREATE_INFO(workbench_transparent_accum) - /* NOTE: Blending will be skipped on objectId because output is a - * non-normalized integer buffer. */ - .fragment_out(0, Type::VEC4, "out_transparent_accum") - .fragment_out(1, Type::VEC4, "out_revealage_accum") - .fragment_out(2, Type::UINT, "out_object_id") - .push_constant(Type::BOOL, "forceShadowing") - .typedef_source("workbench_shader_shared.h") - .fragment_source("workbench_transparent_accum_frag.glsl"); +/* NOTE: Blending will be skipped on objectId because output is a + * non-normalized integer buffer. */ +FRAGMENT_OUT(0, VEC4, out_transparent_accum) +FRAGMENT_OUT(1, VEC4, out_revealage_accum) +FRAGMENT_OUT(2, UINT, out_object_id) +PUSH_CONSTANT(BOOL, forceShadowing) +TYPEDEF_SOURCE("workbench_shader_shared.h") +FRAGMENT_SOURCE("workbench_transparent_accum_frag.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_opaque) - .fragment_out(0, Type::VEC4, "out_material") - .fragment_out(1, Type::VEC2, "out_normal") - .fragment_out(2, Type::UINT, "out_object_id") - .typedef_source("workbench_shader_shared.h") - .fragment_source("workbench_prepass_frag.glsl"); +FRAGMENT_OUT(0, VEC4, out_material) +FRAGMENT_OUT(1, VEC2, out_normal) +FRAGMENT_OUT(2, UINT, out_object_id) +TYPEDEF_SOURCE("workbench_shader_shared.h") +FRAGMENT_SOURCE("workbench_prepass_frag.glsl") +GPU_SHADER_CREATE_END() /** \} */ @@ -113,9 +129,15 @@ GPU_SHADER_CREATE_INFO(workbench_opaque) /** \name Variations Declaration * \{ */ -GPU_SHADER_CREATE_INFO(workbench_flat).define("WORKBENCH_SHADING_FLAT"); -GPU_SHADER_CREATE_INFO(workbench_studio).define("WORKBENCH_SHADING_STUDIO"); -GPU_SHADER_CREATE_INFO(workbench_matcap).define("WORKBENCH_SHADING_MATCAP"); +GPU_SHADER_CREATE_INFO(workbench_flat) +DEFINE("WORKBENCH_SHADING_FLAT") +GPU_SHADER_CREATE_END() +GPU_SHADER_CREATE_INFO(workbench_studio) +DEFINE("WORKBENCH_SHADING_STUDIO") +GPU_SHADER_CREATE_END() +GPU_SHADER_CREATE_INFO(workbench_matcap) +DEFINE("WORKBENCH_SHADING_MATCAP") +GPU_SHADER_CREATE_END() #define WORKBENCH_CLIPPING_VARIATIONS(prefix, ...) \ CREATE_INFO_VARIANT(prefix##_clip, drw_clipped, __VA_ARGS__) \ diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh index 7368928f7e2..0606d621b7f 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh @@ -11,42 +11,46 @@ * \{ */ GPU_SHADER_CREATE_INFO(workbench_shadow_common) - .storage_buf(3, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY) - /* WORKAROUND: Needed to support OpenSubdiv vertex format. Should be removed. */ - .push_constant(Type::IVEC2, "gpu_attr_3") - .uniform_buf(1, "ShadowPassData", "pass_data") - .typedef_source("workbench_shader_shared.h") - .additional_info("gpu_index_load") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new"); +STORAGE_BUF_FREQ(3, READ, float, pos[], GEOMETRY) +/* WORKAROUND: Needed to support OpenSubdiv vertex format. Should be removed. */ +PUSH_CONSTANT(IVEC2, gpu_attr_3) +UNIFORM_BUF(1, ShadowPassData, pass_data) +TYPEDEF_SOURCE("workbench_shader_shared.h") +ADDITIONAL_INFO(gpu_index_load) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_shadow_visibility_compute_common) - .local_group_size(DRW_VISIBILITY_GROUP_SIZE) - .define("DRW_VIEW_LEN", "64") - .storage_buf(0, Qualifier::READ, "ObjectBounds", "bounds_buf[]") - .uniform_buf(2, "ExtrudedFrustum", "extruded_frustum") - .push_constant(Type::INT, "resource_len") - .push_constant(Type::INT, "view_len") - .push_constant(Type::INT, "visibility_word_per_draw") - .push_constant(Type::BOOL, "force_fail_method") - .push_constant(Type::VEC3, "shadow_direction") - .typedef_source("workbench_shader_shared.h") - .compute_source("workbench_shadow_visibility_comp.glsl") - .additional_info("draw_view") - .additional_info("draw_view_culling"); +LOCAL_GROUP_SIZE(DRW_VISIBILITY_GROUP_SIZE) +DEFINE_VALUE("DRW_VIEW_LEN", "64") +STORAGE_BUF(0, READ, ObjectBounds, bounds_buf[]) +UNIFORM_BUF(2, ExtrudedFrustum, extruded_frustum) +PUSH_CONSTANT(INT, resource_len) +PUSH_CONSTANT(INT, view_len) +PUSH_CONSTANT(INT, visibility_word_per_draw) +PUSH_CONSTANT(BOOL, force_fail_method) +PUSH_CONSTANT(VEC3, shadow_direction) +TYPEDEF_SOURCE("workbench_shader_shared.h") +COMPUTE_SOURCE("workbench_shadow_visibility_comp.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_view_culling) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_shadow_visibility_compute_dynamic_pass_type) - .additional_info("workbench_shadow_visibility_compute_common") - .define("DYNAMIC_PASS_SELECTION") - .storage_buf(1, Qualifier::READ_WRITE, "uint", "pass_visibility_buf[]") - .storage_buf(2, Qualifier::READ_WRITE, "uint", "fail_visibility_buf[]") - .do_static_compilation(true); +ADDITIONAL_INFO(workbench_shadow_visibility_compute_common) +DEFINE("DYNAMIC_PASS_SELECTION") +STORAGE_BUF(1, READ_WRITE, uint, pass_visibility_buf[]) +STORAGE_BUF(2, READ_WRITE, uint, fail_visibility_buf[]) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_shadow_visibility_compute_static_pass_type) - .additional_info("workbench_shadow_visibility_compute_common") - .storage_buf(1, Qualifier::READ_WRITE, "uint", "visibility_buf[]") - .do_static_compilation(true); +ADDITIONAL_INFO(workbench_shadow_visibility_compute_common) +STORAGE_BUF(1, READ_WRITE, uint, visibility_buf[]) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /** \} */ @@ -55,11 +59,13 @@ GPU_SHADER_CREATE_INFO(workbench_shadow_visibility_compute_static_pass_type) * \{ */ GPU_SHADER_CREATE_INFO(workbench_shadow_no_debug) - .fragment_source("gpu_shader_depth_only_frag.glsl"); +FRAGMENT_SOURCE("gpu_shader_depth_only_frag.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_shadow_debug) - .fragment_out(0, Type::VEC4, "out_debug_color") - .fragment_source("workbench_shadow_debug_frag.glsl"); +FRAGMENT_OUT(0, VEC4, out_debug_color) +FRAGMENT_SOURCE("workbench_shadow_debug_frag.glsl") +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_transparent_resolve_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_transparent_resolve_info.hh index 94cffe3fc4c..bef6beb997c 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_transparent_resolve_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_transparent_resolve_info.hh @@ -5,9 +5,10 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(workbench_transparent_resolve) - .fragment_out(0, Type::VEC4, "fragColor") - .sampler(0, ImageType::FLOAT_2D, "transparentAccum") - .sampler(1, ImageType::FLOAT_2D, "transparentRevealage") - .fragment_source("workbench_transparent_resolve_frag.glsl") - .additional_info("draw_fullscreen") - .do_static_compilation(true); +FRAGMENT_OUT(0, VEC4, fragColor) +SAMPLER(0, FLOAT_2D, transparentAccum) +SAMPLER(1, FLOAT_2D, transparentRevealage) +FRAGMENT_SOURCE("workbench_transparent_resolve_frag.glsl") +ADDITIONAL_INFO(draw_fullscreen) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_volume_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_volume_info.hh index 2718215a734..9b3272d177c 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_volume_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_volume_info.hh @@ -9,24 +9,26 @@ * \{ */ GPU_SHADER_CREATE_INFO(workbench_volume_common) - .vertex_in(0, Type::VEC3, "pos") - .fragment_out(0, Type::VEC4, "fragColor") - .sampler(0, ImageType::DEPTH_2D, "depthBuffer") - .sampler(1, ImageType::FLOAT_3D, "densityTexture") - .push_constant(Type::INT, "samplesLen") - .push_constant(Type::FLOAT, "noiseOfs") - .push_constant(Type::FLOAT, "stepLength") - .push_constant(Type::FLOAT, "densityScale") - .push_constant(Type::BOOL, "do_depth_test") - .vertex_source("workbench_volume_vert.glsl") - .fragment_source("workbench_volume_frag.glsl"); +VERTEX_IN(0, VEC3, pos) +FRAGMENT_OUT(0, VEC4, fragColor) +SAMPLER(0, DEPTH_2D, depthBuffer) +SAMPLER(1, FLOAT_3D, densityTexture) +PUSH_CONSTANT(INT, samplesLen) +PUSH_CONSTANT(FLOAT, noiseOfs) +PUSH_CONSTANT(FLOAT, stepLength) +PUSH_CONSTANT(FLOAT, densityScale) +PUSH_CONSTANT(BOOL, do_depth_test) +VERTEX_SOURCE("workbench_volume_vert.glsl") +FRAGMENT_SOURCE("workbench_volume_frag.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_volume) - .define("WORKBENCH_NEXT") - .sampler(6, ImageType::UINT_2D, "stencil_tx") - .additional_info("workbench_volume_common") - .additional_info("draw_object_infos_new") - .additional_info("draw_view"); +DEFINE("WORKBENCH_NEXT") +SAMPLER(6, UINT_2D, stencil_tx) +ADDITIONAL_INFO(workbench_volume_common) +ADDITIONAL_INFO(draw_object_infos_new) +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() /** \} */ /* -------------------------------------------------------------------- */ @@ -34,25 +36,29 @@ GPU_SHADER_CREATE_INFO(workbench_volume) * \{ */ GPU_SHADER_CREATE_INFO(workbench_volume_smoke_common) - .define("VOLUME_SMOKE") - .sampler(2, ImageType::FLOAT_3D, "flameTexture") - .sampler(3, ImageType::FLOAT_1D, "flameColorTexture") - .additional_info("draw_resource_id_varying"); +DEFINE("VOLUME_SMOKE") +SAMPLER(2, FLOAT_3D, flameTexture) +SAMPLER(3, FLOAT_1D, flameColorTexture) +ADDITIONAL_INFO(draw_resource_id_varying) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_volume_object_common) - .define("VOLUME_OBJECT") - .push_constant(Type::MAT4, "volumeTextureToObject") - /* FIXME(fclem): This overflow the push_constant limit. */ - .push_constant(Type::MAT4, "volumeObjectToTexture") - .additional_info("draw_resource_id_varying"); +DEFINE("VOLUME_OBJECT") +PUSH_CONSTANT(MAT4, volumeTextureToObject) +/* FIXME(fclem): This overflow the push_constant limit. */ +PUSH_CONSTANT(MAT4, volumeObjectToTexture) +ADDITIONAL_INFO(draw_resource_id_varying) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_volume_smoke) - .additional_info("workbench_volume_smoke_common") - .additional_info("draw_modelmat_new"); +ADDITIONAL_INFO(workbench_volume_smoke_common) +ADDITIONAL_INFO(draw_modelmat_new) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_volume_object) - .additional_info("workbench_volume_object_common") - .additional_info("draw_volume_new"); +ADDITIONAL_INFO(workbench_volume_object_common) +ADDITIONAL_INFO(draw_volume_new) +GPU_SHADER_CREATE_END() /** \} */ @@ -61,17 +67,19 @@ GPU_SHADER_CREATE_INFO(workbench_volume_object) * \{ */ GPU_SHADER_CREATE_INFO(workbench_volume_coba) - .define("USE_COBA") - .sampler(4, ImageType::UINT_3D, "flagTexture") - .sampler(5, ImageType::FLOAT_1D, "transferTexture") - .push_constant(Type::BOOL, "showPhi") - .push_constant(Type::BOOL, "showFlags") - .push_constant(Type::BOOL, "showPressure") - .push_constant(Type::FLOAT, "gridScale"); +DEFINE("USE_COBA") +SAMPLER(4, UINT_3D, flagTexture) +SAMPLER(5, FLOAT_1D, transferTexture) +PUSH_CONSTANT(BOOL, showPhi) +PUSH_CONSTANT(BOOL, showFlags) +PUSH_CONSTANT(BOOL, showPressure) +PUSH_CONSTANT(FLOAT, gridScale) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(workbench_volume_no_coba) - .sampler(4, ImageType::FLOAT_3D, "shadowTexture") - .push_constant(Type::VEC3, "activeColor"); +SAMPLER(4, FLOAT_3D, shadowTexture) +PUSH_CONSTANT(VEC3, activeColor) +GPU_SHADER_CREATE_END() /** \} */ @@ -79,9 +87,15 @@ GPU_SHADER_CREATE_INFO(workbench_volume_no_coba) /** \name Sampling variation * \{ */ -GPU_SHADER_CREATE_INFO(workbench_volume_linear).define("USE_TRILINEAR"); -GPU_SHADER_CREATE_INFO(workbench_volume_cubic).define("USE_TRICUBIC"); -GPU_SHADER_CREATE_INFO(workbench_volume_closest).define("USE_CLOSEST"); +GPU_SHADER_CREATE_INFO(workbench_volume_linear) +DEFINE("USE_TRILINEAR") +GPU_SHADER_CREATE_END() +GPU_SHADER_CREATE_INFO(workbench_volume_cubic) +DEFINE("USE_TRICUBIC") +GPU_SHADER_CREATE_END() +GPU_SHADER_CREATE_INFO(workbench_volume_closest) +DEFINE("USE_CLOSEST") +GPU_SHADER_CREATE_END() /** \} */ @@ -89,14 +103,17 @@ GPU_SHADER_CREATE_INFO(workbench_volume_closest).define("USE_CLOSEST"); /** \name Slice variation * \{ */ -GPU_SHADER_INTERFACE_INFO(workbench_volume_iface).smooth(Type::VEC3, "localPos"); +GPU_SHADER_INTERFACE_INFO(workbench_volume_iface) +SMOOTH(VEC3, localPos) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(workbench_volume_slice) - .define("VOLUME_SLICE") - .vertex_in(1, Type::VEC3, "uvs") - .vertex_out(workbench_volume_iface) - .push_constant(Type::INT, "sliceAxis") /* -1 is no slice. */ - .push_constant(Type::FLOAT, "slicePosition"); +DEFINE("VOLUME_SLICE") +VERTEX_IN(1, VEC3, uvs) +VERTEX_OUT(workbench_volume_iface) +PUSH_CONSTANT(INT, sliceAxis) /* -1 is no slice. */ +PUSH_CONSTANT(FLOAT, slicePosition) +GPU_SHADER_CREATE_END() /** \} */ -- 2.30.2 From c8f0aba880cc7be114612c2b78cd7702b18cee36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 18:17:52 +0200 Subject: [PATCH 79/90] Add workbenhc info includes --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index f344bd2547f..c4745409477 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -943,12 +943,12 @@ void groupMemoryBarrier() {} // #include "infos/overlay_volume_info.hh" // #include "infos/overlay_wireframe_info.hh" // #include "infos/select_id_info.hh" -// #include "infos/workbench_composite_info.hh" -// #include "infos/workbench_depth_info.hh" -// #include "infos/workbench_effect_antialiasing_info.hh" -// #include "infos/workbench_effect_dof_info.hh" -// #include "infos/workbench_effect_outline_info.hh" -// #include "infos/workbench_prepass_info.hh" -// #include "infos/workbench_shadow_info.hh" -// #include "infos/workbench_transparent_resolve_info.hh" -// #include "infos/workbench_volume_info.hh" +#include "infos/workbench_composite_info.hh" +#include "infos/workbench_depth_info.hh" +#include "infos/workbench_effect_antialiasing_info.hh" +#include "infos/workbench_effect_dof_info.hh" +#include "infos/workbench_effect_outline_info.hh" +#include "infos/workbench_prepass_info.hh" +#include "infos/workbench_shadow_info.hh" +#include "infos/workbench_transparent_resolve_info.hh" +#include "infos/workbench_volume_info.hh" -- 2.30.2 From 577d237f6f5cf8030c493b15c328979d3e5db10c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 18:19:56 +0200 Subject: [PATCH 80/90] Remove trailing semicolon --- .../engines/workbench/shaders/infos/workbench_composite_info.hh | 2 +- .../engines/workbench/shaders/infos/workbench_prepass_info.hh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh index 40b561ea783..4e7e20d6602 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh @@ -79,7 +79,7 @@ GPU_SHADER_CREATE_END() prefix##_opaque_matcap, workbench_resolve_opaque_matcap, __VA_ARGS__) \ WORKBENCH_CAVITY_VARIATIONS(prefix##_opaque_flat, workbench_resolve_opaque_flat, __VA_ARGS__) -WORKBENCH_LIGHTING_VARIATIONS(workbench_resolve, workbench_composite); +WORKBENCH_LIGHTING_VARIATIONS(workbench_resolve, workbench_composite) #undef WORKBENCH_FINAL_VARIATION #undef WORKBENCH_CURVATURE_VARIATIONS diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_prepass_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_prepass_info.hh index 522c6261a52..592361a2b47 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_prepass_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_prepass_info.hh @@ -162,7 +162,7 @@ GPU_SHADER_CREATE_END() WORKBENCH_PIPELINE_VARIATIONS(prefix##_curves, workbench_curves, __VA_ARGS__) \ WORKBENCH_PIPELINE_VARIATIONS(prefix##_ptcloud, workbench_pointcloud, __VA_ARGS__) -WORKBENCH_GEOMETRY_VARIATIONS(workbench_prepass, workbench_prepass); +WORKBENCH_GEOMETRY_VARIATIONS(workbench_prepass, workbench_prepass) #undef WORKBENCH_FINAL_VARIATION #undef WORKBENCH_CLIPPING_VARIATIONS -- 2.30.2 From cde71b48265ed4234db606a8577dd60d4a60948f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 18:20:36 +0200 Subject: [PATCH 81/90] Add basic, image, gpencil, select engine infos --- .../basic/shaders/infos/basic_depth_info.hh | 40 ++-- .../gpencil/shaders/infos/gpencil_info.hh | 216 +++++++++--------- .../gpencil/shaders/infos/gpencil_vfx_info.hh | 171 +++++++------- .../image/shaders/infos/engine_image_info.hh | 56 +++-- .../select/shaders/infos/select_id_info.hh | 92 ++++---- 5 files changed, 309 insertions(+), 266 deletions(-) diff --git a/source/blender/draw/engines/basic/shaders/infos/basic_depth_info.hh b/source/blender/draw/engines/basic/shaders/infos/basic_depth_info.hh index e0ccb4dc69e..ec66129f537 100644 --- a/source/blender/draw/engines/basic/shaders/infos/basic_depth_info.hh +++ b/source/blender/draw/engines/basic/shaders/infos/basic_depth_info.hh @@ -11,8 +11,9 @@ * \{ */ GPU_SHADER_CREATE_INFO(basic_conservative) - .geometry_layout(PrimitiveIn::TRIANGLES, PrimitiveOut::TRIANGLE_STRIP, 3) - .geometry_source("basic_conservative_depth_geom.glsl"); +GEOMETRY_LAYOUT(PrimitiveIn::TRIANGLES, PrimitiveOut::TRIANGLE_STRIP, 3) +GEOMETRY_SOURCE("basic_conservative_depth_geom.glsl") +GPU_SHADER_CREATE_END() /** \} */ @@ -21,28 +22,33 @@ GPU_SHADER_CREATE_INFO(basic_conservative) * \{ */ GPU_SHADER_CREATE_INFO(basic_mesh) - .vertex_in(0, Type::VEC3, "pos") - .vertex_source("basic_depth_vert.glsl") - .additional_info("draw_mesh"); +VERTEX_IN(0, VEC3, pos) +VERTEX_SOURCE("basic_depth_vert.glsl") +ADDITIONAL_INFO(draw_mesh) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(basic_pointcloud) - .vertex_source("basic_depth_pointcloud_vert.glsl") - .additional_info("draw_pointcloud"); +VERTEX_SOURCE("basic_depth_pointcloud_vert.glsl") +ADDITIONAL_INFO(draw_pointcloud) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(basic_curves) - .vertex_source("basic_depth_curves_vert.glsl") - .additional_info("draw_hair"); +VERTEX_SOURCE("basic_depth_curves_vert.glsl") +ADDITIONAL_INFO(draw_hair) +GPU_SHADER_CREATE_END() /* Geometry-shader alternative paths. */ GPU_SHADER_CREATE_INFO(basic_mesh_conservative_no_geom) - .vertex_in(0, Type::VEC3, "pos") - .vertex_source("basic_depth_vert_conservative_no_geom.glsl") - .additional_info("draw_mesh"); +VERTEX_IN(0, VEC3, pos) +VERTEX_SOURCE("basic_depth_vert_conservative_no_geom.glsl") +ADDITIONAL_INFO(draw_mesh) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(basic_pointcloud_conservative_no_geom) - .define("CONSERVATIVE_RASTER") - .vertex_source("basic_depth_pointcloud_vert.glsl") - .additional_info("draw_pointcloud"); +DEFINE("CONSERVATIVE_RASTER") +VERTEX_SOURCE("basic_depth_pointcloud_vert.glsl") +ADDITIONAL_INFO(draw_pointcloud) +GPU_SHADER_CREATE_END() /** \} */ @@ -70,7 +76,9 @@ GPU_SHADER_CREATE_INFO(basic_pointcloud_conservative_no_geom) /** \name Depth shader types. * \{ */ -GPU_SHADER_CREATE_INFO(basic_depth).fragment_source("basic_depth_frag.glsl"); +GPU_SHADER_CREATE_INFO(basic_depth) +FRAGMENT_SOURCE("basic_depth_frag.glsl") +GPU_SHADER_CREATE_END() BASIC_OBTYPE_VARIATIONS(basic_depth, basic_depth, draw_globals); 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 d82d11ccf7d..9e547aa8dfa 100644 --- a/source/blender/draw/engines/gpencil/shaders/infos/gpencil_info.hh +++ b/source/blender/draw/engines/gpencil/shaders/infos/gpencil_info.hh @@ -11,48 +11,52 @@ * \{ */ GPU_SHADER_NAMED_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"); +SMOOTH(VEC4, color_mul) +SMOOTH(VEC4, color_add) +SMOOTH(VEC3, pos) +SMOOTH(VEC2, uv) +GPU_SHADER_NAMED_INTERFACE_END(gp_interp) GPU_SHADER_NAMED_INTERFACE_INFO(gpencil_geometry_flat_iface, gp_interp_flat) - .flat(Type::VEC2, "aspect") - .flat(Type::VEC4, "sspos") - .flat(Type::UINT, "mat_flag") - .flat(Type::FLOAT, "depth"); +FLAT(VEC2, aspect) +FLAT(VEC4, sspos) +FLAT(UINT, mat_flag) +FLAT(FLOAT, depth) +GPU_SHADER_NAMED_INTERFACE_END(gp_interp_flat) GPU_SHADER_NAMED_INTERFACE_INFO(gpencil_geometry_noperspective_iface, gp_interp_noperspective) - .no_perspective(Type::VEC2, "thickness") - .no_perspective(Type::FLOAT, "hardness"); +NO_PERSPECTIVE(VEC2, thickness) +NO_PERSPECTIVE(FLOAT, hardness) +GPU_SHADER_NAMED_INTERFACE_END(gp_interp_noperspective) GPU_SHADER_CREATE_INFO(gpencil_geometry) - .do_static_compilation(true) - .define("GP_LIGHT") - .typedef_source("gpencil_defines.h") - .sampler(2, ImageType::FLOAT_2D, "gpFillTexture") - .sampler(3, ImageType::FLOAT_2D, "gpStrokeTexture") - .sampler(4, ImageType::DEPTH_2D, "gpSceneDepthTexture") - .sampler(5, ImageType::FLOAT_2D, "gpMaskTexture") - .uniform_buf(4, "gpMaterial", "gp_materials[GPENCIL_MATERIAL_BUFFER_LEN]", Frequency::BATCH) - .uniform_buf(3, "gpLight", "gp_lights[GPENCIL_LIGHT_BUFFER_LEN]", Frequency::BATCH) - .push_constant(Type::VEC2, "viewportSize") - /* 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_out(gpencil_geometry_flat_iface) - .vertex_out(gpencil_geometry_noperspective_iface) - .vertex_source("gpencil_vert.glsl") - .fragment_source("gpencil_frag.glsl") - .depth_write(DepthWrite::ANY) - .additional_info("draw_gpencil"); +DO_STATIC_COMPILATION() +DEFINE("GP_LIGHT") +TYPEDEF_SOURCE("gpencil_defines.h") +SAMPLER(2, FLOAT_2D, gpFillTexture) +SAMPLER(3, FLOAT_2D, gpStrokeTexture) +SAMPLER(4, DEPTH_2D, gpSceneDepthTexture) +SAMPLER(5, FLOAT_2D, gpMaskTexture) +UNIFORM_BUF_FREQ(4, gpMaterial, gp_materials[GPENCIL_MATERIAL_BUFFER_LEN], BATCH) +UNIFORM_BUF_FREQ(3, gpLight, gp_lights[GPENCIL_LIGHT_BUFFER_LEN], BATCH) +PUSH_CONSTANT(VEC2, viewportSize) +/* Per Object */ +PUSH_CONSTANT(VEC3, gpNormal) +PUSH_CONSTANT(BOOL, gpStrokeOrder3d) +PUSH_CONSTANT(INT, gpMaterialOffset) +/* Per Layer */ +PUSH_CONSTANT(FLOAT, gpVertexColorOpacity) +PUSH_CONSTANT(VEC4, gpLayerTint) +PUSH_CONSTANT(FLOAT, gpLayerOpacity) +PUSH_CONSTANT(FLOAT, gpStrokeIndexOffset) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, revealColor) +VERTEX_OUT(gpencil_geometry_iface) +VERTEX_OUT(gpencil_geometry_flat_iface) +VERTEX_OUT(gpencil_geometry_noperspective_iface) +VERTEX_SOURCE("gpencil_vert.glsl") +FRAGMENT_SOURCE("gpencil_frag.glsl") +DEPTH_WRITE(DepthWrite::ANY) +ADDITIONAL_INFO(draw_gpencil) +GPU_SHADER_CREATE_END() /** \} */ @@ -61,35 +65,38 @@ GPU_SHADER_CREATE_INFO(gpencil_geometry) * \{ */ GPU_SHADER_CREATE_INFO(gpencil_layer_blend) - .do_static_compilation(true) - .sampler(0, ImageType::FLOAT_2D, "colorBuf") - .sampler(1, ImageType::FLOAT_2D, "revealBuf") - .sampler(2, ImageType::FLOAT_2D, "maskBuf") - .push_constant(Type::INT, "blendMode") - .push_constant(Type::FLOAT, "blendOpacity") - /* Reminder: This is considered SRC color in blend equations. - * Same operation on all buffers. */ - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "fragRevealage") - .fragment_source("gpencil_layer_blend_frag.glsl") - .additional_info("draw_fullscreen"); +DO_STATIC_COMPILATION() +SAMPLER(0, FLOAT_2D, colorBuf) +SAMPLER(1, FLOAT_2D, revealBuf) +SAMPLER(2, FLOAT_2D, maskBuf) +PUSH_CONSTANT(INT, blendMode) +PUSH_CONSTANT(FLOAT, blendOpacity) +/* Reminder: This is considered SRC color in blend equations. + * Same operation on all buffers. */ +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, fragRevealage) +FRAGMENT_SOURCE("gpencil_layer_blend_frag.glsl") +ADDITIONAL_INFO(draw_fullscreen) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpencil_mask_invert) - .do_static_compilation(true) - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "fragRevealage") - .fragment_source("gpencil_mask_invert_frag.glsl") - .additional_info("draw_fullscreen"); +DO_STATIC_COMPILATION() +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, fragRevealage) +FRAGMENT_SOURCE("gpencil_mask_invert_frag.glsl") +ADDITIONAL_INFO(draw_fullscreen) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpencil_depth_merge) - .do_static_compilation(true) - .push_constant(Type::VEC4, "gpModelMatrix", 4) - .push_constant(Type::BOOL, "strokeOrder3d") - .sampler(0, ImageType::DEPTH_2D, "depthBuf") - .vertex_source("gpencil_depth_merge_vert.glsl") - .fragment_source("gpencil_depth_merge_frag.glsl") - .depth_write(DepthWrite::ANY) - .additional_info("draw_view"); +DO_STATIC_COMPILATION() +PUSH_CONSTANT_ARRAY(VEC4, gpModelMatrix, 4) +PUSH_CONSTANT(BOOL, strokeOrder3d) +SAMPLER(0, DEPTH_2D, depthBuf) +VERTEX_SOURCE("gpencil_depth_merge_vert.glsl") +FRAGMENT_SOURCE("gpencil_depth_merge_frag.glsl") +DEPTH_WRITE(DepthWrite::ANY) +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() /** \} */ @@ -98,52 +105,57 @@ GPU_SHADER_CREATE_INFO(gpencil_depth_merge) * \{ */ GPU_SHADER_INTERFACE_INFO(gpencil_antialiasing_iface) - .smooth(Type::VEC2, "uvs") - .smooth(Type::VEC2, "pixcoord") - .smooth(Type::VEC4, "offset[3]"); +SMOOTH(VEC2, uvs) +SMOOTH(VEC2, pixcoord) +SMOOTH(VEC4, offset[3]) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(gpencil_antialiasing) - .define("SMAA_GLSL_3") - .define("SMAA_RT_METRICS", "viewportMetrics") - .define("SMAA_PRESET_HIGH") - .define("SMAA_LUMA_WEIGHT", "float4(lumaWeight, lumaWeight, lumaWeight, 0.0)") - .define("SMAA_NO_DISCARD") - .vertex_out(gpencil_antialiasing_iface) - .push_constant(Type::VEC4, "viewportMetrics") - .push_constant(Type::FLOAT, "lumaWeight") - .vertex_source("gpencil_antialiasing_vert.glsl") - .fragment_source("gpencil_antialiasing_frag.glsl"); +DEFINE("SMAA_GLSL_3") +DEFINE_VALUE("SMAA_RT_METRICS", "viewportMetrics") +DEFINE("SMAA_PRESET_HIGH") +DEFINE_VALUE("SMAA_LUMA_WEIGHT", "float4(lumaWeight, lumaWeight, lumaWeight, 0.0)") +DEFINE("SMAA_NO_DISCARD") +VERTEX_OUT(gpencil_antialiasing_iface) +PUSH_CONSTANT(VEC4, viewportMetrics) +PUSH_CONSTANT(FLOAT, lumaWeight) +VERTEX_SOURCE("gpencil_antialiasing_vert.glsl") +FRAGMENT_SOURCE("gpencil_antialiasing_frag.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpencil_antialiasing_stage_0) - .define("SMAA_STAGE", "0") - .sampler(0, ImageType::FLOAT_2D, "colorTex") - .sampler(1, ImageType::FLOAT_2D, "revealTex") - .fragment_out(0, Type::VEC2, "out_edges") - .additional_info("gpencil_antialiasing") - .do_static_compilation(true); +DEFINE_VALUE("SMAA_STAGE", "0") +SAMPLER(0, FLOAT_2D, colorTex) +SAMPLER(1, FLOAT_2D, revealTex) +FRAGMENT_OUT(0, VEC2, out_edges) +ADDITIONAL_INFO(gpencil_antialiasing) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpencil_antialiasing_stage_1) - .define("SMAA_STAGE", "1") - .sampler(0, ImageType::FLOAT_2D, "edgesTex") - .sampler(1, ImageType::FLOAT_2D, "areaTex") - .sampler(2, ImageType::FLOAT_2D, "searchTex") - .fragment_out(0, Type::VEC4, "out_weights") - .additional_info("gpencil_antialiasing") - .do_static_compilation(true); +DEFINE_VALUE("SMAA_STAGE", "1") +SAMPLER(0, FLOAT_2D, edgesTex) +SAMPLER(1, FLOAT_2D, areaTex) +SAMPLER(2, FLOAT_2D, searchTex) +FRAGMENT_OUT(0, VEC4, out_weights) +ADDITIONAL_INFO(gpencil_antialiasing) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpencil_antialiasing_stage_2) - .define("SMAA_STAGE", "2") - .sampler(0, ImageType::FLOAT_2D, "colorTex") - .sampler(1, ImageType::FLOAT_2D, "revealTex") - .sampler(2, ImageType::FLOAT_2D, "blendTex") - .push_constant(Type::FLOAT, "mixFactor") - .push_constant(Type::FLOAT, "taaAccumulatedWeight") - .push_constant(Type::BOOL, "doAntiAliasing") - .push_constant(Type::BOOL, "onlyAlpha") - /* Reminder: Blending func is `fragRevealage * DST + fragColor`. */ - .fragment_out(0, Type::VEC4, "out_color", DualBlend::SRC_0) - .fragment_out(0, Type::VEC4, "out_reveal", DualBlend::SRC_1) - .additional_info("gpencil_antialiasing") - .do_static_compilation(true); +DEFINE_VALUE("SMAA_STAGE", "2") +SAMPLER(0, FLOAT_2D, colorTex) +SAMPLER(1, FLOAT_2D, revealTex) +SAMPLER(2, FLOAT_2D, blendTex) +PUSH_CONSTANT(FLOAT, mixFactor) +PUSH_CONSTANT(FLOAT, taaAccumulatedWeight) +PUSH_CONSTANT(BOOL, doAntiAliasing) +PUSH_CONSTANT(BOOL, onlyAlpha) +/* Reminder: Blending func is `fragRevealage * DST + fragColor`. */ +FRAGMENT_OUT_DUAL(0, VEC4, out_color, SRC_0) +FRAGMENT_OUT_DUAL(0, VEC4, out_reveal, SRC_1) +ADDITIONAL_INFO(gpencil_antialiasing) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/gpencil/shaders/infos/gpencil_vfx_info.hh b/source/blender/draw/engines/gpencil/shaders/infos/gpencil_vfx_info.hh index 72a74ab5ecc..5bf7d6bbbfd 100644 --- a/source/blender/draw/engines/gpencil/shaders/infos/gpencil_vfx_info.hh +++ b/source/blender/draw/engines/gpencil/shaders/infos/gpencil_vfx_info.hh @@ -5,100 +5,109 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpencil_fx_common) - .sampler(0, ImageType::FLOAT_2D, "colorBuf") - .sampler(1, ImageType::FLOAT_2D, "revealBuf") - /* Reminder: This is considered SRC color in blend equations. - * Same operation on all buffers. */ - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "fragRevealage") - .fragment_source("gpencil_vfx_frag.glsl"); +SAMPLER(0, FLOAT_2D, colorBuf) +SAMPLER(1, FLOAT_2D, revealBuf) +/* Reminder: This is considered SRC color in blend equations. + * Same operation on all buffers. */ +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, fragRevealage) +FRAGMENT_SOURCE("gpencil_vfx_frag.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpencil_fx_composite) - .do_static_compilation(true) - .define("COMPOSITE") - .push_constant(Type::BOOL, "isFirstPass") - .additional_info("gpencil_fx_common") - .additional_info("draw_fullscreen"); +DO_STATIC_COMPILATION() +DEFINE("COMPOSITE") +PUSH_CONSTANT(BOOL, isFirstPass) +ADDITIONAL_INFO(gpencil_fx_common) +ADDITIONAL_INFO(draw_fullscreen) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpencil_fx_colorize) - .do_static_compilation(true) - .define("COLORIZE") - .push_constant(Type::VEC3, "lowColor") - .push_constant(Type::VEC3, "highColor") - .push_constant(Type::FLOAT, "factor") - .push_constant(Type::INT, "mode") - .additional_info("gpencil_fx_common") - .additional_info("draw_fullscreen"); +DO_STATIC_COMPILATION() +DEFINE("COLORIZE") +PUSH_CONSTANT(VEC3, lowColor) +PUSH_CONSTANT(VEC3, highColor) +PUSH_CONSTANT(FLOAT, factor) +PUSH_CONSTANT(INT, mode) +ADDITIONAL_INFO(gpencil_fx_common) +ADDITIONAL_INFO(draw_fullscreen) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpencil_fx_blur) - .do_static_compilation(true) - .define("BLUR") - .push_constant(Type::VEC2, "offset") - .push_constant(Type::INT, "sampCount") - .additional_info("gpencil_fx_common") - .additional_info("draw_fullscreen"); +DO_STATIC_COMPILATION() +DEFINE("BLUR") +PUSH_CONSTANT(VEC2, offset) +PUSH_CONSTANT(INT, sampCount) +ADDITIONAL_INFO(gpencil_fx_common) +ADDITIONAL_INFO(draw_fullscreen) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpencil_fx_transform) - .do_static_compilation(true) - .define("TRANSFORM") - .push_constant(Type::VEC2, "axisFlip") - .push_constant(Type::VEC2, "waveDir") - .push_constant(Type::VEC2, "waveOffset") - .push_constant(Type::FLOAT, "wavePhase") - .push_constant(Type::VEC2, "swirlCenter") - .push_constant(Type::FLOAT, "swirlAngle") - .push_constant(Type::FLOAT, "swirlRadius") - .additional_info("gpencil_fx_common") - .additional_info("draw_fullscreen"); +DO_STATIC_COMPILATION() +DEFINE("TRANSFORM") +PUSH_CONSTANT(VEC2, axisFlip) +PUSH_CONSTANT(VEC2, waveDir) +PUSH_CONSTANT(VEC2, waveOffset) +PUSH_CONSTANT(FLOAT, wavePhase) +PUSH_CONSTANT(VEC2, swirlCenter) +PUSH_CONSTANT(FLOAT, swirlAngle) +PUSH_CONSTANT(FLOAT, swirlRadius) +ADDITIONAL_INFO(gpencil_fx_common) +ADDITIONAL_INFO(draw_fullscreen) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpencil_fx_glow) - .do_static_compilation(true) - .define("GLOW") - .push_constant(Type::VEC4, "glowColor") - .push_constant(Type::VEC2, "offset") - .push_constant(Type::INT, "sampCount") - .push_constant(Type::VEC4, "threshold") - .push_constant(Type::BOOL, "firstPass") - .push_constant(Type::BOOL, "glowUnder") - .push_constant(Type::INT, "blendMode") - .additional_info("gpencil_fx_common") - .additional_info("draw_fullscreen"); +DO_STATIC_COMPILATION() +DEFINE("GLOW") +PUSH_CONSTANT(VEC4, glowColor) +PUSH_CONSTANT(VEC2, offset) +PUSH_CONSTANT(INT, sampCount) +PUSH_CONSTANT(VEC4, threshold) +PUSH_CONSTANT(BOOL, firstPass) +PUSH_CONSTANT(BOOL, glowUnder) +PUSH_CONSTANT(INT, blendMode) +ADDITIONAL_INFO(gpencil_fx_common) +ADDITIONAL_INFO(draw_fullscreen) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpencil_fx_rim) - .do_static_compilation(true) - .define("RIM") - .push_constant(Type::VEC2, "blurDir") - .push_constant(Type::VEC2, "uvOffset") - .push_constant(Type::VEC3, "rimColor") - .push_constant(Type::VEC3, "maskColor") - .push_constant(Type::INT, "sampCount") - .push_constant(Type::INT, "blendMode") - .push_constant(Type::BOOL, "isFirstPass") - .additional_info("gpencil_fx_common") - .additional_info("draw_fullscreen"); +DO_STATIC_COMPILATION() +DEFINE("RIM") +PUSH_CONSTANT(VEC2, blurDir) +PUSH_CONSTANT(VEC2, uvOffset) +PUSH_CONSTANT(VEC3, rimColor) +PUSH_CONSTANT(VEC3, maskColor) +PUSH_CONSTANT(INT, sampCount) +PUSH_CONSTANT(INT, blendMode) +PUSH_CONSTANT(BOOL, isFirstPass) +ADDITIONAL_INFO(gpencil_fx_common) +ADDITIONAL_INFO(draw_fullscreen) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpencil_fx_shadow) - .do_static_compilation(true) - .define("SHADOW") - .push_constant(Type::VEC4, "shadowColor") - .push_constant(Type::VEC2, "uvRotX") - .push_constant(Type::VEC2, "uvRotY") - .push_constant(Type::VEC2, "uvOffset") - .push_constant(Type::VEC2, "blurDir") - .push_constant(Type::VEC2, "waveDir") - .push_constant(Type::VEC2, "waveOffset") - .push_constant(Type::FLOAT, "wavePhase") - .push_constant(Type::INT, "sampCount") - .push_constant(Type::BOOL, "isFirstPass") - .additional_info("gpencil_fx_common") - .additional_info("draw_fullscreen"); +DO_STATIC_COMPILATION() +DEFINE("SHADOW") +PUSH_CONSTANT(VEC4, shadowColor) +PUSH_CONSTANT(VEC2, uvRotX) +PUSH_CONSTANT(VEC2, uvRotY) +PUSH_CONSTANT(VEC2, uvOffset) +PUSH_CONSTANT(VEC2, blurDir) +PUSH_CONSTANT(VEC2, waveDir) +PUSH_CONSTANT(VEC2, waveOffset) +PUSH_CONSTANT(FLOAT, wavePhase) +PUSH_CONSTANT(INT, sampCount) +PUSH_CONSTANT(BOOL, isFirstPass) +ADDITIONAL_INFO(gpencil_fx_common) +ADDITIONAL_INFO(draw_fullscreen) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpencil_fx_pixelize) - .do_static_compilation(true) - .define("PIXELIZE") - .push_constant(Type::VEC2, "targetPixelSize") - .push_constant(Type::VEC2, "targetPixelOffset") - .push_constant(Type::VEC2, "accumOffset") - .push_constant(Type::INT, "sampCount") - .additional_info("gpencil_fx_common") - .additional_info("draw_fullscreen"); +DO_STATIC_COMPILATION() +DEFINE("PIXELIZE") +PUSH_CONSTANT(VEC2, targetPixelSize) +PUSH_CONSTANT(VEC2, targetPixelOffset) +PUSH_CONSTANT(VEC2, accumOffset) +PUSH_CONSTANT(INT, sampCount) +ADDITIONAL_INFO(gpencil_fx_common) +ADDITIONAL_INFO(draw_fullscreen) +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/image/shaders/infos/engine_image_info.hh b/source/blender/draw/engines/image/shaders/infos/engine_image_info.hh index f94f271da78..65b054c1515 100644 --- a/source/blender/draw/engines/image/shaders/infos/engine_image_info.hh +++ b/source/blender/draw/engines/image/shaders/infos/engine_image_info.hh @@ -4,33 +4,39 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(image_engine_color_iface).smooth(Type::VEC2, "uv_screen"); +GPU_SHADER_INTERFACE_INFO(image_engine_color_iface) +SMOOTH(VEC2, uv_screen) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(image_engine_color_shader) - .vertex_in(0, Type::IVEC2, "pos") - .vertex_out(image_engine_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::VEC4, "shuffle") - .push_constant(Type::VEC2, "farNearDistances") - .push_constant(Type::IVEC2, "offset") - .push_constant(Type::INT, "drawFlags") - .push_constant(Type::BOOL, "imgPremultiplied") - .sampler(0, ImageType::FLOAT_2D, "imageTexture") - .sampler(1, ImageType::DEPTH_2D, "depth_texture") - .vertex_source("image_engine_color_vert.glsl") - .fragment_source("image_engine_color_frag.glsl") - .additional_info("draw_modelmat") - .do_static_compilation(true); +VERTEX_IN(0, IVEC2, pos) +VERTEX_OUT(image_engine_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(VEC4, shuffle) +PUSH_CONSTANT(VEC2, farNearDistances) +PUSH_CONSTANT(IVEC2, offset) +PUSH_CONSTANT(INT, drawFlags) +PUSH_CONSTANT(BOOL, imgPremultiplied) +SAMPLER(0, FLOAT_2D, imageTexture) +SAMPLER(1, DEPTH_2D, depth_texture) +VERTEX_SOURCE("image_engine_color_vert.glsl") +FRAGMENT_SOURCE("image_engine_color_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() -GPU_SHADER_INTERFACE_INFO(image_engine_depth_iface).smooth(Type::VEC2, "uv_image"); +GPU_SHADER_INTERFACE_INFO(image_engine_depth_iface) +SMOOTH(VEC2, uv_image) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(image_engine_depth_shader) - .vertex_in(0, Type::IVEC2, "pos") - .vertex_in(1, Type::VEC2, "uv") - .vertex_out(image_engine_depth_iface) - .push_constant(Type::VEC4, "min_max_uv") - .vertex_source("image_engine_depth_vert.glsl") - .fragment_source("image_engine_depth_frag.glsl") - .additional_info("draw_modelmat") - .depth_write(DepthWrite::ANY) - .do_static_compilation(true); +VERTEX_IN(0, IVEC2, pos) +VERTEX_IN(1, VEC2, uv) +VERTEX_OUT(image_engine_depth_iface) +PUSH_CONSTANT(VEC4, min_max_uv) +VERTEX_SOURCE("image_engine_depth_vert.glsl") +FRAGMENT_SOURCE("image_engine_depth_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +DEPTH_WRITE(DepthWrite::ANY) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/select/shaders/infos/select_id_info.hh b/source/blender/draw/engines/select/shaders/infos/select_id_info.hh index b3fc907e509..b2c30fda0ab 100644 --- a/source/blender/draw/engines/select/shaders/infos/select_id_info.hh +++ b/source/blender/draw/engines/select/shaders/infos/select_id_info.hh @@ -9,60 +9,68 @@ /** \name Select ID for Edit Mesh Selection * \{ */ -GPU_SHADER_INTERFACE_INFO(select_id_iface).flat(Type::INT, "select_id"); +GPU_SHADER_INTERFACE_INFO(select_id_iface) +FLAT(INT, select_id) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(select_id_flat) - .push_constant(Type::FLOAT, "sizeVertex") - .push_constant(Type::INT, "offset") - .push_constant(Type::FLOAT, "retopologyOffset") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::INT, "index") - .vertex_out(select_id_iface) - .fragment_out(0, Type::UINT, "fragColor") - .vertex_source("select_id_vert.glsl") - .fragment_source("select_id_frag.glsl") - .additional_info("draw_modelmat") - .do_static_compilation(true); +PUSH_CONSTANT(FLOAT, sizeVertex) +PUSH_CONSTANT(INT, offset) +PUSH_CONSTANT(FLOAT, retopologyOffset) +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, INT, index) +VERTEX_OUT(select_id_iface) +FRAGMENT_OUT(0, UINT, fragColor) +VERTEX_SOURCE("select_id_vert.glsl") +FRAGMENT_SOURCE("select_id_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(select_id_uniform) - .define("UNIFORM_ID") - .push_constant(Type::FLOAT, "sizeVertex") - .push_constant(Type::INT, "select_id") - .push_constant(Type::FLOAT, "retopologyOffset") - .vertex_in(0, Type::VEC3, "pos") - .fragment_out(0, Type::UINT, "fragColor") - .vertex_source("select_id_vert.glsl") - .fragment_source("select_id_frag.glsl") - .additional_info("draw_modelmat") - .do_static_compilation(true); +DEFINE("UNIFORM_ID") +PUSH_CONSTANT(FLOAT, sizeVertex) +PUSH_CONSTANT(INT, select_id) +PUSH_CONSTANT(FLOAT, retopologyOffset) +VERTEX_IN(0, VEC3, pos) +FRAGMENT_OUT(0, UINT, fragColor) +VERTEX_SOURCE("select_id_vert.glsl") +FRAGMENT_SOURCE("select_id_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(select_id_flat_clipped) - .additional_info("select_id_flat") - .additional_info("drw_clipped") - .do_static_compilation(true); +ADDITIONAL_INFO(select_id_flat) +ADDITIONAL_INFO(drw_clipped) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(select_id_uniform_clipped) - .additional_info("select_id_uniform") - .additional_info("drw_clipped") - .do_static_compilation(true); +ADDITIONAL_INFO(select_id_uniform) +ADDITIONAL_INFO(drw_clipped) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* Used to patch overlay shaders. */ GPU_SHADER_CREATE_INFO(select_id_patch) - .typedef_source("select_shader_shared.hh") - .vertex_out(select_id_iface) - /* Need to make sure the depth & stencil comparison runs before the fragment shader. */ - .early_fragment_test(true) - .uniform_buf(SELECT_DATA, "SelectInfoData", "select_info_buf") - /* Select IDs for instanced draw-calls not using #PassMain. */ - .storage_buf(SELECT_ID_IN, Qualifier::READ, "int", "in_select_buf[]") - /* Stores the result of the whole selection drawing. Content depends on selection mode. */ - .storage_buf(SELECT_ID_OUT, Qualifier::READ_WRITE, "uint", "out_select_buf[]"); +TYPEDEF_SOURCE("select_shader_shared.hh") +VERTEX_OUT(select_id_iface) +/* Need to make sure the depth & stencil comparison runs before the fragment shader. */ +EARLY_FRAGMENT_TEST(true) +UNIFORM_BUF(SELECT_DATA, SelectInfoData, select_info_buf) +/* Select IDs for instanced draw-calls not using #PassMain. */ +STORAGE_BUF(SELECT_ID_IN, READ, int, in_select_buf[]) +/* Stores the result of the whole selection drawing. Content depends on selection mode. */ +STORAGE_BUF(SELECT_ID_OUT, READ_WRITE, uint, out_select_buf[]) +GPU_SHADER_CREATE_END() /** \} */ GPU_SHADER_CREATE_INFO(select_debug_fullscreen) - .additional_info("draw_fullscreen") - .fragment_source("select_debug_frag.glsl") - .sampler(0, ImageType::UINT_2D, "image") - .fragment_out(0, Type::VEC4, "fragColor") - .do_static_compilation(true); +ADDITIONAL_INFO(draw_fullscreen) +FRAGMENT_SOURCE("select_debug_frag.glsl") +SAMPLER(0, UINT_2D, image) +FRAGMENT_OUT(0, VEC4, fragColor) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() -- 2.30.2 From fcad801b878f333909041e0c4293d16e42a89296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 18:22:43 +0200 Subject: [PATCH 82/90] Enable basic, image, gpencil, select engine infos --- source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index c4745409477..a45f42402c0 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -815,6 +815,7 @@ void groupMemoryBarrier() {} #include "draw_hair_refine_info.hh" #include "draw_object_infos_info.hh" #include "draw_view_info.hh" +#include "infos/basic_depth_info.hh" #include "infos/compositor_alpha_crop_info.hh" #include "infos/compositor_bilateral_blur_info.hh" #include "infos/compositor_bokeh_blur_info.hh" @@ -873,7 +874,6 @@ void groupMemoryBarrier() {} #include "infos/compositor_van_vliet_gaussian_blur_info.hh" #include "infos/compositor_write_output_info.hh" #include "infos/compositor_z_combine_info.hh" -// #include "infos/basic_depth_info.hh" // #include "infos/eevee_ambient_occlusion_info.hh" // #include "infos/eevee_deferred_info.hh" // #include "infos/eevee_depth_of_field_info.hh" @@ -891,9 +891,9 @@ void groupMemoryBarrier() {} // #include "infos/eevee_tracing_info.hh" // #include "infos/eevee_velocity_info.hh" // #include "infos/eevee_volume_info.hh" -// #include "infos/engine_image_info.hh" -// #include "infos/gpencil_info.hh" -// #include "infos/gpencil_vfx_info.hh" +#include "infos/engine_image_info.hh" +#include "infos/gpencil_info.hh" +#include "infos/gpencil_vfx_info.hh" #include "infos/gpu_clip_planes_info.hh" #include "infos/gpu_index_load_info.hh" #include "infos/gpu_shader_2D_area_borders_info.hh" @@ -942,7 +942,7 @@ void groupMemoryBarrier() {} // #include "infos/overlay_viewer_attribute_info.hh" // #include "infos/overlay_volume_info.hh" // #include "infos/overlay_wireframe_info.hh" -// #include "infos/select_id_info.hh" +#include "infos/select_id_info.hh" #include "infos/workbench_composite_info.hh" #include "infos/workbench_depth_info.hh" #include "infos/workbench_effect_antialiasing_info.hh" -- 2.30.2 From 72944075e879c5051d14e7ef7e9238f2fa946ee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 18:23:55 +0200 Subject: [PATCH 83/90] Remove trailing semicolon --- .../draw/engines/basic/shaders/infos/basic_depth_info.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/draw/engines/basic/shaders/infos/basic_depth_info.hh b/source/blender/draw/engines/basic/shaders/infos/basic_depth_info.hh index ec66129f537..37592faee9c 100644 --- a/source/blender/draw/engines/basic/shaders/infos/basic_depth_info.hh +++ b/source/blender/draw/engines/basic/shaders/infos/basic_depth_info.hh @@ -80,6 +80,6 @@ GPU_SHADER_CREATE_INFO(basic_depth) FRAGMENT_SOURCE("basic_depth_frag.glsl") GPU_SHADER_CREATE_END() -BASIC_OBTYPE_VARIATIONS(basic_depth, basic_depth, draw_globals); +BASIC_OBTYPE_VARIATIONS(basic_depth, basic_depth, draw_globals) /** \} */ -- 2.30.2 From d98723d27ea1de92ff03d22fcd7ef69f4d8cb7fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 18:24:10 +0200 Subject: [PATCH 84/90] Mass rename overlay infos --- .../infos/overlay_antialiasing_info.hh | 34 +- .../shaders/infos/overlay_armature_info.hh | 553 +++--- .../shaders/infos/overlay_background_info.hh | 36 +- .../shaders/infos/overlay_edit_mode_info.hh | 1487 +++++++++-------- .../shaders/infos/overlay_extra_info.hh | 631 +++---- .../shaders/infos/overlay_facing_info.hh | 22 +- .../shaders/infos/overlay_grid_info.hh | 63 +- .../shaders/infos/overlay_outline_info.hh | 230 +-- .../shaders/infos/overlay_paint_info.hh | 211 +-- .../infos/overlay_sculpt_curves_info.hh | 70 +- .../shaders/infos/overlay_sculpt_info.hh | 41 +- .../infos/overlay_viewer_attribute_info.hh | 120 +- .../shaders/infos/overlay_volume_info.hh | 148 +- .../shaders/infos/overlay_wireframe_info.hh | 199 +-- 14 files changed, 2070 insertions(+), 1775 deletions(-) diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_antialiasing_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_antialiasing_info.hh index feb06145300..11004b510ba 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_antialiasing_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_antialiasing_info.hh @@ -5,21 +5,23 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(overlay_antialiasing) - .do_static_compilation(true) - .sampler(0, ImageType::DEPTH_2D, "depthTex") - .sampler(1, ImageType::FLOAT_2D, "colorTex") - .sampler(2, ImageType::FLOAT_2D, "lineTex") - .push_constant(Type::BOOL, "doSmoothLines") - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_source("overlay_antialiasing_frag.glsl") - .additional_info("draw_fullscreen") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +SAMPLER(0, DEPTH_2D, depthTex) +SAMPLER(1, FLOAT_2D, colorTex) +SAMPLER(2, FLOAT_2D, lineTex) +PUSH_CONSTANT(BOOL, doSmoothLines) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_SOURCE("overlay_antialiasing_frag.glsl") +ADDITIONAL_INFO(draw_fullscreen) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_xray_fade) - .do_static_compilation(true) - .sampler(0, ImageType::DEPTH_2D, "depthTex") - .sampler(1, ImageType::DEPTH_2D, "xrayDepthTex") - .push_constant(Type::FLOAT, "opacity") - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_source("overlay_xray_fade_frag.glsl") - .additional_info("draw_fullscreen"); +DO_STATIC_COMPILATION() +SAMPLER(0, DEPTH_2D, depthTex) +SAMPLER(1, DEPTH_2D, xrayDepthTex) +PUSH_CONSTANT(FLOAT, opacity) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_SOURCE("overlay_xray_fade_frag.glsl") +ADDITIONAL_INFO(draw_fullscreen) +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_armature_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_armature_info.hh index 93daa6bd487..32d92e87c0b 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_armature_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_armature_info.hh @@ -5,64 +5,72 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(overlay_frag_output) - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "lineOutput"); +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, lineOutput) +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(overlay_armature_wire_iface) - .flat(Type::VEC4, "finalColor") - .flat(Type::VEC2, "edgeStart") - .no_perspective(Type::VEC2, "edgePos"); +FLAT(VEC4, finalColor) +FLAT(VEC2, edgeStart) +NO_PERSPECTIVE(VEC2, edgePos) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_armature_common) - .push_constant(Type::FLOAT, "alpha") - .additional_info("draw_view"); +PUSH_CONSTANT(FLOAT, alpha) +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() /* -------------------------------------------------------------------- */ /** \name Armature Sphere * \{ */ GPU_SHADER_CREATE_INFO(overlay_armature_sphere_outline) - .do_static_compilation(true) - .vertex_in(0, Type::VEC2, "pos") - /* Per instance. */ - .vertex_in(1, Type::MAT4, "inst_obmat") - .vertex_out(overlay_armature_wire_iface) - .vertex_source("overlay_armature_sphere_outline_vert.glsl") - .fragment_source("overlay_armature_wire_frag.glsl") - .additional_info("overlay_frag_output") - .additional_info("overlay_armature_common") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC2, pos) +/* Per instance. */ +VERTEX_IN(1, MAT4, inst_obmat) +VERTEX_OUT(overlay_armature_wire_iface) +VERTEX_SOURCE("overlay_armature_sphere_outline_vert.glsl") +FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl") +ADDITIONAL_INFO(overlay_frag_output) +ADDITIONAL_INFO(overlay_armature_common) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_armature_sphere_outline_clipped) - .do_static_compilation(true) - .additional_info("overlay_armature_sphere_outline") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_armature_sphere_outline) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(overlay_armature_sphere_solid_iface) - .flat(Type::VEC3, "finalStateColor") - .flat(Type::VEC3, "finalBoneColor") - .flat(Type::MAT4, "sphereMatrix") - .smooth(Type::VEC3, "viewPosition"); +FLAT(VEC3, finalStateColor) +FLAT(VEC3, finalBoneColor) +FLAT(MAT4, sphereMatrix) +SMOOTH(VEC3, viewPosition) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_armature_sphere_solid) - .do_static_compilation(true) - .vertex_in(0, Type::VEC2, "pos") - /* Per instance. */ - .vertex_in(1, Type::VEC4, "color") - .vertex_in(2, Type::MAT4, "inst_obmat") - .depth_write(DepthWrite::GREATER) - .vertex_out(overlay_armature_sphere_solid_iface) - .vertex_source("overlay_armature_sphere_solid_vert.glsl") - .fragment_source("overlay_armature_sphere_solid_frag.glsl") - .additional_info("overlay_frag_output") - .additional_info("overlay_armature_common") - .additional_info("draw_globals") - .depth_write(DepthWrite::ANY); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC2, pos) +/* Per instance. */ +VERTEX_IN(1, VEC4, color) +VERTEX_IN(2, MAT4, inst_obmat) +DEPTH_WRITE(DepthWrite::GREATER) +VERTEX_OUT(overlay_armature_sphere_solid_iface) +VERTEX_SOURCE("overlay_armature_sphere_solid_vert.glsl") +FRAGMENT_SOURCE("overlay_armature_sphere_solid_frag.glsl") +ADDITIONAL_INFO(overlay_frag_output) +ADDITIONAL_INFO(overlay_armature_common) +ADDITIONAL_INFO(draw_globals) +DEPTH_WRITE(DepthWrite::ANY) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_armature_sphere_solid_clipped) - .do_static_compilation(true) - .additional_info("overlay_armature_sphere_solid") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_armature_sphere_solid) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -71,166 +79,185 @@ GPU_SHADER_CREATE_INFO(overlay_armature_sphere_solid_clipped) * \{ */ GPU_SHADER_NAMED_INTERFACE_INFO(overlay_armature_shape_outline_iface, geom_in) - .smooth(Type::VEC4, "pPos") - .smooth(Type::VEC3, "vPos") - .smooth(Type::VEC2, "ssPos") - .smooth(Type::VEC4, "vColSize"); +SMOOTH(VEC4, pPos) +SMOOTH(VEC3, vPos) +SMOOTH(VEC2, ssPos) +SMOOTH(VEC4, vColSize) +GPU_SHADER_NAMED_INTERFACE_END(geom_in) GPU_SHADER_NAMED_INTERFACE_INFO(overlay_armature_shape_outline_flat_iface, geom_flat_in) - .flat(Type::INT, "inverted"); +FLAT(INT, inverted) +GPU_SHADER_NAMED_INTERFACE_END(geom_flat_in) GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_outline_no_geom_iface) - .flat(Type::VEC4, "finalColor") - .flat(Type::VEC2, "edgeStart") - .no_perspective(Type::VEC2, "edgePos"); +FLAT(VEC4, finalColor) +FLAT(VEC2, edgeStart) +NO_PERSPECTIVE(VEC2, edgePos) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - /* Per instance. */ - .vertex_in(3, Type::MAT4, "inst_obmat") - .vertex_out(overlay_armature_shape_outline_iface) - .vertex_out(overlay_armature_shape_outline_flat_iface) - .geometry_layout(PrimitiveIn::LINES_ADJACENCY, PrimitiveOut::LINE_STRIP, 2) - .geometry_out(overlay_armature_wire_iface) - .vertex_source("overlay_armature_shape_outline_vert.glsl") - .geometry_source("overlay_armature_shape_outline_geom.glsl") - .fragment_source("overlay_armature_wire_frag.glsl") - .additional_info("overlay_frag_output") - .additional_info("overlay_armature_common") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +/* Per instance. */ +VERTEX_IN(3, MAT4, inst_obmat) +VERTEX_OUT(overlay_armature_shape_outline_iface) +VERTEX_OUT(overlay_armature_shape_outline_flat_iface) +GEOMETRY_LAYOUT(PrimitiveIn::LINES_ADJACENCY, PrimitiveOut::LINE_STRIP, 2) +GEOMETRY_OUT(overlay_armature_wire_iface) +VERTEX_SOURCE("overlay_armature_shape_outline_vert.glsl") +GEOMETRY_SOURCE("overlay_armature_shape_outline_geom.glsl") +FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl") +ADDITIONAL_INFO(overlay_frag_output) +ADDITIONAL_INFO(overlay_armature_common) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - /* Per instance. */ - .vertex_in(3, Type::MAT4, "inst_obmat") - .vertex_out(overlay_armature_shape_outline_no_geom_iface) - .vertex_source("overlay_armature_shape_outline_vert_no_geom.glsl") - .fragment_source("overlay_armature_wire_frag.glsl") - .additional_info("overlay_frag_output") - .additional_info("overlay_armature_common") - .additional_info("draw_globals"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +/* Per instance. */ +VERTEX_IN(3, MAT4, inst_obmat) +VERTEX_OUT(overlay_armature_shape_outline_no_geom_iface) +VERTEX_SOURCE("overlay_armature_shape_outline_vert_no_geom.glsl") +FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl") +ADDITIONAL_INFO(overlay_frag_output) +ADDITIONAL_INFO(overlay_armature_common) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_next) - .do_static_compilation(true) - .storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY) - .storage_buf(1, Qualifier::READ, "mat4", "data_buf[]") - .push_constant(Type::IVEC2, "gpu_attr_0") - .vertex_out(overlay_armature_shape_outline_no_geom_iface) - .vertex_source("overlay_armature_shape_outline_next_vert.glsl") - .fragment_source("overlay_armature_wire_frag.glsl") - .additional_info("overlay_frag_output") - .additional_info("overlay_armature_common") - .additional_info("gpu_index_load") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY) +STORAGE_BUF(1, READ, mat4, data_buf[]) +PUSH_CONSTANT(IVEC2, gpu_attr_0) +VERTEX_OUT(overlay_armature_shape_outline_no_geom_iface) +VERTEX_SOURCE("overlay_armature_shape_outline_next_vert.glsl") +FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl") +ADDITIONAL_INFO(overlay_frag_output) +ADDITIONAL_INFO(overlay_armature_common) +ADDITIONAL_INFO(gpu_index_load) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_clipped) - .do_static_compilation(true) - .additional_info("overlay_armature_shape_outline") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_armature_shape_outline) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_clipped_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .additional_info("overlay_armature_shape_outline_no_geom") - .additional_info("drw_clipped"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_armature_shape_outline_no_geom) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_solid_iface) - .smooth(Type::VEC4, "finalColor") - .flat(Type::INT, "inverted"); +SMOOTH(VEC4, finalColor) +FLAT(INT, inverted) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_armature_shape_solid) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC3, "nor") - /* Per instance. */ - .vertex_in(2, Type::MAT4, "inst_obmat") - .depth_write(DepthWrite::GREATER) - .vertex_out(overlay_armature_shape_solid_iface) - .vertex_source("overlay_armature_shape_solid_vert.glsl") - .fragment_source("overlay_armature_shape_solid_frag.glsl") - .additional_info("overlay_frag_output") - .additional_info("overlay_armature_common") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC3, nor) +/* Per instance. */ +VERTEX_IN(2, MAT4, inst_obmat) +DEPTH_WRITE(DepthWrite::GREATER) +VERTEX_OUT(overlay_armature_shape_solid_iface) +VERTEX_SOURCE("overlay_armature_shape_solid_vert.glsl") +FRAGMENT_SOURCE("overlay_armature_shape_solid_frag.glsl") +ADDITIONAL_INFO(overlay_frag_output) +ADDITIONAL_INFO(overlay_armature_common) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_armature_shape_solid_clipped) - .do_static_compilation(true) - .additional_info("overlay_armature_shape_solid") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_armature_shape_solid) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_wire_next_iface) - .flat(Type::VEC4, "finalColor") - .flat(Type::FLOAT, "wire_width") - .no_perspective(Type::FLOAT, "edgeCoord"); +FLAT(VEC4, finalColor) +FLAT(FLOAT, wire_width) +NO_PERSPECTIVE(FLOAT, edgeCoord) +GPU_SHADER_INTERFACE_END() GPU_SHADER_NAMED_INTERFACE_INFO(overlay_armature_shape_wire_iface, geometry_in) - .flat(Type::VEC4, "finalColor") - .flat(Type::FLOAT, "wire_width"); +FLAT(VEC4, finalColor) +FLAT(FLOAT, wire_width) +GPU_SHADER_NAMED_INTERFACE_END(geometry_in) GPU_SHADER_NAMED_INTERFACE_INFO(overlay_armature_shape_wire_geom_iface, geometry_out) - .flat(Type::VEC4, "finalColor") - .flat(Type::FLOAT, "wire_width"); +FLAT(VEC4, finalColor) +FLAT(FLOAT, wire_width) +GPU_SHADER_NAMED_INTERFACE_END(geometry_out) GPU_SHADER_NAMED_INTERFACE_INFO(overlay_armature_shape_wire_geom_noperspective_iface, geometry_noperspective_out) - .no_perspective(Type::FLOAT, "edgeCoord"); +NO_PERSPECTIVE(FLOAT, edgeCoord) +GPU_SHADER_NAMED_INTERFACE_END(geometry_noperspective_out) GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire) - .do_static_compilation(true) - .push_constant(Type::BOOL, "do_smooth_wire") - .vertex_in(0, Type::VEC3, "pos") - /* Per instance. */ - .vertex_in(2, Type::MAT4, "inst_obmat") - .vertex_out(overlay_armature_shape_wire_iface) - .vertex_source("overlay_armature_shape_wire_vert.glsl") - .geometry_out(overlay_armature_shape_wire_geom_iface) - .geometry_out(overlay_armature_shape_wire_geom_noperspective_iface) - .geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) - .geometry_source("overlay_armature_shape_wire_geom.glsl") - .fragment_source("overlay_armature_shape_wire_frag.glsl") - .typedef_source("overlay_shader_shared.h") - .additional_info("overlay_frag_output") - .additional_info("overlay_armature_common") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +PUSH_CONSTANT(BOOL, do_smooth_wire) +VERTEX_IN(0, VEC3, pos) +/* Per instance. */ +VERTEX_IN(2, MAT4, inst_obmat) +VERTEX_OUT(overlay_armature_shape_wire_iface) +VERTEX_SOURCE("overlay_armature_shape_wire_vert.glsl") +GEOMETRY_OUT(overlay_armature_shape_wire_geom_iface) +GEOMETRY_OUT(overlay_armature_shape_wire_geom_noperspective_iface) +GEOMETRY_LAYOUT(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) +GEOMETRY_SOURCE("overlay_armature_shape_wire_geom.glsl") +FRAGMENT_SOURCE("overlay_armature_shape_wire_frag.glsl") +TYPEDEF_SOURCE("overlay_shader_shared.h") +ADDITIONAL_INFO(overlay_frag_output) +ADDITIONAL_INFO(overlay_armature_common) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire_clipped) - .do_static_compilation(true) - .additional_info("overlay_armature_shape_wire") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_armature_shape_wire) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .push_constant(Type::BOOL, "do_smooth_wire") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(2, Type::MAT4, "inst_obmat") - .vertex_out(overlay_armature_wire_iface) - .vertex_source("overlay_armature_shape_wire_vert_no_geom.glsl") - .fragment_source("overlay_armature_wire_frag.glsl") - .typedef_source("overlay_shader_shared.h") - .additional_info("overlay_frag_output") - .additional_info("overlay_armature_common") - .additional_info("draw_globals"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +PUSH_CONSTANT(BOOL, do_smooth_wire) +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(2, MAT4, inst_obmat) +VERTEX_OUT(overlay_armature_wire_iface) +VERTEX_SOURCE("overlay_armature_shape_wire_vert_no_geom.glsl") +FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl") +TYPEDEF_SOURCE("overlay_shader_shared.h") +ADDITIONAL_INFO(overlay_frag_output) +ADDITIONAL_INFO(overlay_armature_common) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() #endif GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire_next) - .do_static_compilation(true) - .define("NO_GEOM") - .push_constant(Type::BOOL, "do_smooth_wire") - .storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY) - .storage_buf(1, Qualifier::READ, "mat4", "data_buf[]") - .push_constant(Type::IVEC2, "gpu_attr_0") - .define("inst_obmat", "data_buf[gl_InstanceID]") - .vertex_out(overlay_armature_shape_wire_next_iface) - .vertex_source("overlay_armature_shape_wire_next_vert.glsl") - .fragment_source("overlay_armature_shape_wire_frag.glsl") - .typedef_source("overlay_shader_shared.h") - .additional_info("overlay_frag_output") - .additional_info("overlay_armature_common") - .additional_info("gpu_index_load") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +DEFINE("NO_GEOM") +PUSH_CONSTANT(BOOL, do_smooth_wire) +STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY) +STORAGE_BUF(1, READ, mat4, data_buf[]) +PUSH_CONSTANT(IVEC2, gpu_attr_0) +DEFINE_VALUE("inst_obmat", "data_buf[gl_InstanceID]") +VERTEX_OUT(overlay_armature_shape_wire_next_iface) +VERTEX_SOURCE("overlay_armature_shape_wire_next_vert.glsl") +FRAGMENT_SOURCE("overlay_armature_shape_wire_frag.glsl") +TYPEDEF_SOURCE("overlay_shader_shared.h") +ADDITIONAL_INFO(overlay_frag_output) +ADDITIONAL_INFO(overlay_armature_common) +ADDITIONAL_INFO(gpu_index_load) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() /** \} */ @@ -239,54 +266,59 @@ GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire_next) * \{ */ GPU_SHADER_CREATE_INFO(overlay_armature_envelope_outline) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - .vertex_in(0, Type::VEC2, "pos0") - .vertex_in(1, Type::VEC2, "pos1") - .vertex_in(2, Type::VEC2, "pos2") - /* Per instance. */ - .vertex_in(3, Type::VEC4, "headSphere") - .vertex_in(4, Type::VEC4, "tailSphere") - .vertex_in(5, Type::VEC4, "outlineColorSize") - .vertex_in(6, Type::VEC3, "xAxis") - .vertex_out(overlay_armature_wire_iface) - .vertex_source("overlay_armature_envelope_outline_vert.glsl") - .fragment_source("overlay_armature_wire_frag.glsl") - .additional_info("overlay_frag_output") - .additional_info("overlay_armature_common") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +VERTEX_IN(0, VEC2, pos0) +VERTEX_IN(1, VEC2, pos1) +VERTEX_IN(2, VEC2, pos2) +/* Per instance. */ +VERTEX_IN(3, VEC4, headSphere) +VERTEX_IN(4, VEC4, tailSphere) +VERTEX_IN(5, VEC4, outlineColorSize) +VERTEX_IN(6, VEC3, xAxis) +VERTEX_OUT(overlay_armature_wire_iface) +VERTEX_SOURCE("overlay_armature_envelope_outline_vert.glsl") +FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl") +ADDITIONAL_INFO(overlay_frag_output) +ADDITIONAL_INFO(overlay_armature_common) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_armature_envelope_outline_clipped) - .do_static_compilation(true) - .additional_info("overlay_armature_envelope_outline") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_armature_envelope_outline) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(overlay_armature_envelope_solid_iface) - .flat(Type::VEC3, "finalStateColor") - .flat(Type::VEC3, "finalBoneColor") - .smooth(Type::VEC3, "normalView"); +FLAT(VEC3, finalStateColor) +FLAT(VEC3, finalBoneColor) +SMOOTH(VEC3, normalView) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_armature_envelope_solid) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - .vertex_in(0, Type::VEC3, "pos") - /* Per instance. Assumed to be in world coordinate already. */ - .vertex_in(1, Type::VEC4, "headSphere") - .vertex_in(2, Type::VEC4, "tailSphere") - .vertex_in(3, Type::VEC3, "xAxis") - .vertex_in(4, Type::VEC3, "stateColor") - .vertex_in(5, Type::VEC3, "boneColor") - .vertex_out(overlay_armature_envelope_solid_iface) - .push_constant(Type::BOOL, "isDistance") - .vertex_source("overlay_armature_envelope_solid_vert.glsl") - .fragment_source("overlay_armature_envelope_solid_frag.glsl") - .additional_info("overlay_frag_output") - .additional_info("overlay_armature_common"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +VERTEX_IN(0, VEC3, pos) +/* Per instance. Assumed to be in world coordinate already. */ +VERTEX_IN(1, VEC4, headSphere) +VERTEX_IN(2, VEC4, tailSphere) +VERTEX_IN(3, VEC3, xAxis) +VERTEX_IN(4, VEC3, stateColor) +VERTEX_IN(5, VEC3, boneColor) +VERTEX_OUT(overlay_armature_envelope_solid_iface) +PUSH_CONSTANT(BOOL, isDistance) +VERTEX_SOURCE("overlay_armature_envelope_solid_vert.glsl") +FRAGMENT_SOURCE("overlay_armature_envelope_solid_frag.glsl") +ADDITIONAL_INFO(overlay_frag_output) +ADDITIONAL_INFO(overlay_armature_common) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_armature_envelope_solid_clipped) - .do_static_compilation(true) - .additional_info("overlay_armature_envelope_solid") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_armature_envelope_solid) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -295,36 +327,39 @@ GPU_SHADER_CREATE_INFO(overlay_armature_envelope_solid_clipped) * \{ */ GPU_SHADER_INTERFACE_INFO(overlay_armature_stick_iface) - .no_perspective(Type::FLOAT, "colorFac") - .flat(Type::VEC4, "finalWireColor") - .flat(Type::VEC4, "finalInnerColor"); +NO_PERSPECTIVE(FLOAT, colorFac) +FLAT(VEC4, finalWireColor) +FLAT(VEC4, finalInnerColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_armature_stick) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - /* Bone aligned screen space. */ - .vertex_in(0, Type::VEC2, "pos") - .vertex_in(1, Type::UINT, "flag") - /* Per instance. Assumed to be in world coordinate already. */ - .vertex_in(2, Type::VEC3, "boneStart") - .vertex_in(3, Type::VEC3, "boneEnd") - /* alpha encode if we do wire. If 0.0 we don't. */ - .vertex_in(4, Type::VEC4, "wireColor") - .vertex_in(5, Type::VEC4, "boneColor") - .vertex_in(6, Type::VEC4, "headColor") - .vertex_in(7, Type::VEC4, "tailColor") - .define("do_wire", "(wireColor.a > 0.0)") - .vertex_out(overlay_armature_stick_iface) - .vertex_source("overlay_armature_stick_vert.glsl") - .fragment_source("overlay_armature_stick_frag.glsl") - .additional_info("overlay_frag_output") - .additional_info("overlay_armature_common") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +/* Bone aligned screen space. */ +VERTEX_IN(0, VEC2, pos) +VERTEX_IN(1, UINT, flag) +/* Per instance. Assumed to be in world coordinate already. */ +VERTEX_IN(2, VEC3, boneStart) +VERTEX_IN(3, VEC3, boneEnd) +/* alpha encode if we do wire. If 0.0 we don't. */ +VERTEX_IN(4, VEC4, wireColor) +VERTEX_IN(5, VEC4, boneColor) +VERTEX_IN(6, VEC4, headColor) +VERTEX_IN(7, VEC4, tailColor) +DEFINE_VALUE("do_wire", "(wireColor.a > 0.0)") +VERTEX_OUT(overlay_armature_stick_iface) +VERTEX_SOURCE("overlay_armature_stick_vert.glsl") +FRAGMENT_SOURCE("overlay_armature_stick_frag.glsl") +ADDITIONAL_INFO(overlay_frag_output) +ADDITIONAL_INFO(overlay_armature_common) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_armature_stick_clipped) - .do_static_compilation(true) - .additional_info("overlay_armature_stick") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_armature_stick) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -333,23 +368,25 @@ GPU_SHADER_CREATE_INFO(overlay_armature_stick_clipped) * \{ */ GPU_SHADER_CREATE_INFO(overlay_armature_dof) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - .vertex_in(0, Type::VEC2, "pos") - /* Per instance. Assumed to be in world coordinate already. */ - .vertex_in(1, Type::VEC4, "color") - .vertex_in(2, Type::MAT4, "inst_obmat") - .vertex_out(overlay_armature_wire_iface) - .vertex_source("overlay_armature_dof_vert.glsl") - .fragment_source("overlay_armature_dof_solid_frag.glsl") - .additional_info("overlay_frag_output") - .additional_info("overlay_armature_common") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +VERTEX_IN(0, VEC2, pos) +/* Per instance. Assumed to be in world coordinate already. */ +VERTEX_IN(1, VEC4, color) +VERTEX_IN(2, MAT4, inst_obmat) +VERTEX_OUT(overlay_armature_wire_iface) +VERTEX_SOURCE("overlay_armature_dof_vert.glsl") +FRAGMENT_SOURCE("overlay_armature_dof_solid_frag.glsl") +ADDITIONAL_INFO(overlay_frag_output) +ADDITIONAL_INFO(overlay_armature_common) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_armature_dof_clipped) - .do_static_compilation(true) - .additional_info("overlay_armature_dof") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_armature_dof) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -358,21 +395,23 @@ GPU_SHADER_CREATE_INFO(overlay_armature_dof_clipped) * \{ */ GPU_SHADER_CREATE_INFO(overlay_armature_wire) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC4, "color") - .push_constant(Type::FLOAT, "alpha") - .vertex_out(overlay_armature_wire_iface) - .vertex_source("overlay_armature_wire_vert.glsl") - .fragment_source("overlay_armature_wire_frag.glsl") - .additional_info("overlay_frag_output") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC4, color) +PUSH_CONSTANT(FLOAT, alpha) +VERTEX_OUT(overlay_armature_wire_iface) +VERTEX_SOURCE("overlay_armature_wire_vert.glsl") +FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl") +ADDITIONAL_INFO(overlay_frag_output) +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_armature_wire_clipped) - .do_static_compilation(true) - .additional_info("overlay_armature_wire") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_armature_wire) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_background_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_background_info.hh index ab179baf277..d5f15e27f8b 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_background_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_background_info.hh @@ -5,22 +5,24 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(overlay_background) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - .sampler(0, ImageType::FLOAT_2D, "colorBuffer") - .sampler(1, ImageType::DEPTH_2D, "depthBuffer") - .push_constant(Type::INT, "bgType") - .push_constant(Type::VEC4, "colorOverride") - .fragment_source("overlay_background_frag.glsl") - .fragment_out(0, Type::VEC4, "fragColor") - .additional_info("draw_fullscreen") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +SAMPLER(0, FLOAT_2D, colorBuffer) +SAMPLER(1, DEPTH_2D, depthBuffer) +PUSH_CONSTANT(INT, bgType) +PUSH_CONSTANT(VEC4, colorOverride) +FRAGMENT_SOURCE("overlay_background_frag.glsl") +FRAGMENT_OUT(0, VEC4, fragColor) +ADDITIONAL_INFO(draw_fullscreen) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_clipbound) - .do_static_compilation(true) - .push_constant(Type::VEC4, "ucolor") - .push_constant(Type::VEC3, "boundbox", 8) - .vertex_source("overlay_clipbound_vert.glsl") - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_source("overlay_uniform_color_frag.glsl") - .additional_info("draw_view"); +DO_STATIC_COMPILATION() +PUSH_CONSTANT(VEC4, ucolor) +PUSH_CONSTANT_ARRAY(VEC3, boundbox, 8) +VERTEX_SOURCE("overlay_clipbound_vert.glsl") +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_SOURCE("overlay_uniform_color_frag.glsl") +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh index f6ab857a1ae..1f743291447 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh @@ -4,328 +4,368 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(overlay_edit_flat_color_iface).flat(Type::VEC4, "finalColor"); -GPU_SHADER_INTERFACE_INFO(overlay_edit_smooth_color_iface).smooth(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_edit_flat_color_iface) +FLAT(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() +GPU_SHADER_INTERFACE_INFO(overlay_edit_smooth_color_iface) +SMOOTH(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_INTERFACE_INFO(overlay_edit_nopersp_color_iface) - .no_perspective(Type::VEC4, "finalColor"); +NO_PERSPECTIVE(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() /* -------------------------------------------------------------------- */ /** \name Edit Mesh * \{ */ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_common) - .define("blender_srgb_to_framebuffer_space(a)", "a") - .sampler(0, ImageType::DEPTH_2D, "depthTex") - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::BOOL, "wireShading") - .push_constant(Type::BOOL, "selectFace") - .push_constant(Type::BOOL, "selectEdge") - .push_constant(Type::FLOAT, "alpha") - .push_constant(Type::FLOAT, "retopologyOffset") - .push_constant(Type::IVEC4, "dataMask") - .additional_info("draw_globals"); +DEFINE_VALUE("blender_srgb_to_framebuffer_space(a)", "a") +SAMPLER(0, DEPTH_2D, depthTex) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(BOOL, wireShading) +PUSH_CONSTANT(BOOL, selectFace) +PUSH_CONSTANT(BOOL, selectEdge) +PUSH_CONSTANT(FLOAT, alpha) +PUSH_CONSTANT(FLOAT, retopologyOffset) +PUSH_CONSTANT(IVEC4, dataMask) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_edit_mesh_common_no_geom) - .metal_backend_only(true) - .define("blender_srgb_to_framebuffer_space(a)", "a") - .sampler(0, ImageType::DEPTH_2D, "depthTex") - .fragment_out(0, Type::VEC4, "fragColor") - .push_constant(Type::BOOL, "wireShading") - .push_constant(Type::BOOL, "selectFace") - .push_constant(Type::BOOL, "selectEdge") - .push_constant(Type::FLOAT, "alpha") - .push_constant(Type::FLOAT, "retopologyOffset") - .push_constant(Type::IVEC4, "dataMask") - .vertex_source("overlay_edit_mesh_vert_no_geom.glsl") - .additional_info("draw_globals"); +METAL_BACKEND_ONLY() +DEFINE_VALUE("blender_srgb_to_framebuffer_space(a)", "a") +SAMPLER(0, DEPTH_2D, depthTex) +FRAGMENT_OUT(0, VEC4, fragColor) +PUSH_CONSTANT(BOOL, wireShading) +PUSH_CONSTANT(BOOL, selectFace) +PUSH_CONSTANT(BOOL, selectEdge) +PUSH_CONSTANT(FLOAT, alpha) +PUSH_CONSTANT(FLOAT, retopologyOffset) +PUSH_CONSTANT(IVEC4, dataMask) +VERTEX_SOURCE("overlay_edit_mesh_vert_no_geom.glsl") +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() #endif GPU_SHADER_CREATE_INFO(overlay_edit_mesh_depth) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .push_constant(Type::FLOAT, "retopologyOffset") - .vertex_source("overlay_edit_mesh_depth_vert.glsl") - .fragment_source("overlay_depth_only_frag.glsl") - .additional_info("draw_mesh"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +PUSH_CONSTANT(FLOAT, retopologyOffset) +VERTEX_SOURCE("overlay_edit_mesh_depth_vert.glsl") +FRAGMENT_SOURCE("overlay_depth_only_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_depth_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_mesh_depth") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_mesh_depth) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_vert_iface) - .smooth(Type::VEC4, "finalColor") - .smooth(Type::FLOAT, "vertexCrease"); +SMOOTH(VEC4, finalColor) +SMOOTH(FLOAT, vertexCrease) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_vert) - .do_static_compilation(true) - .builtins(BuiltinBits::POINT_SIZE) - .define("VERT") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::UVEC4, "data") - .vertex_in(2, Type::VEC3, "vnor") - .vertex_source("overlay_edit_mesh_vert.glsl") - .vertex_out(overlay_edit_mesh_vert_iface) - .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_modelmat") - .additional_info("overlay_edit_mesh_common"); +DO_STATIC_COMPILATION() +BUILTINS(BuiltinBits::POINT_SIZE) +DEFINE("VERT") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, UVEC4, data) +VERTEX_IN(2, VEC3, vnor) +VERTEX_SOURCE("overlay_edit_mesh_vert.glsl") +VERTEX_OUT(overlay_edit_mesh_vert_iface) +FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(overlay_edit_mesh_common) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_vert_next) - .do_static_compilation(true) - .builtins(BuiltinBits::POINT_SIZE) - .define("VERT") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::UVEC4, "data") - .vertex_in(2, Type::VEC3, "vnor") - .vertex_source("overlay_edit_mesh_vertex_vert.glsl") - .vertex_out(overlay_edit_mesh_vert_iface) - .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new") - .additional_info("overlay_edit_mesh_common"); +DO_STATIC_COMPILATION() +BUILTINS(BuiltinBits::POINT_SIZE) +DEFINE("VERT") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, UVEC4, data) +VERTEX_IN(2, VEC3, vnor) +VERTEX_SOURCE("overlay_edit_mesh_vertex_vert.glsl") +VERTEX_OUT(overlay_edit_mesh_vert_iface) +FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(overlay_edit_mesh_common) +GPU_SHADER_CREATE_END() GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_mesh_edge_iface, geometry_in) - .smooth(Type::VEC4, "finalColor_") - .smooth(Type::VEC4, "finalColorOuter_") - .smooth(Type::UINT, "selectOverride_"); +SMOOTH(VEC4, finalColor_) +SMOOTH(VEC4, finalColorOuter_) +SMOOTH(UINT, selectOverride_) +GPU_SHADER_NAMED_INTERFACE_END(geometry_in) GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_mesh_edge_geom_iface, geometry_out) - .smooth(Type::VEC4, "finalColor"); +SMOOTH(VEC4, finalColor) +GPU_SHADER_NAMED_INTERFACE_END(geometry_out) GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_mesh_edge_geom_flat_iface, geometry_flat_out) - .flat(Type::VEC4, "finalColorOuter"); +FLAT(VEC4, finalColorOuter) +GPU_SHADER_NAMED_INTERFACE_END(geometry_flat_out) GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_mesh_edge_geom_noperspective_iface, geometry_noperspective_out) - .no_perspective(Type::FLOAT, "edgeCoord"); +NO_PERSPECTIVE(FLOAT, edgeCoord) +GPU_SHADER_NAMED_INTERFACE_END(geometry_noperspective_out) GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge) - .do_static_compilation(true) - .define("EDGE") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::UVEC4, "data") - .vertex_in(2, Type::VEC3, "vnor") - .push_constant(Type::BOOL, "do_smooth_wire") - .vertex_source("overlay_edit_mesh_vert.glsl") - .vertex_out(overlay_edit_mesh_edge_iface) - .geometry_out(overlay_edit_mesh_edge_geom_iface) - .geometry_out(overlay_edit_mesh_edge_geom_flat_iface) - .geometry_out(overlay_edit_mesh_edge_geom_noperspective_iface) - .geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) - .geometry_source("overlay_edit_mesh_geom.glsl") - .fragment_source("overlay_edit_mesh_frag.glsl") - .additional_info("draw_modelmat") - .additional_info("overlay_edit_mesh_common"); +DO_STATIC_COMPILATION() +DEFINE("EDGE") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, UVEC4, data) +VERTEX_IN(2, VEC3, vnor) +PUSH_CONSTANT(BOOL, do_smooth_wire) +VERTEX_SOURCE("overlay_edit_mesh_vert.glsl") +VERTEX_OUT(overlay_edit_mesh_edge_iface) +GEOMETRY_OUT(overlay_edit_mesh_edge_geom_iface) +GEOMETRY_OUT(overlay_edit_mesh_edge_geom_flat_iface) +GEOMETRY_OUT(overlay_edit_mesh_edge_geom_noperspective_iface) +GEOMETRY_LAYOUT(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) +GEOMETRY_SOURCE("overlay_edit_mesh_geom.glsl") +FRAGMENT_SOURCE("overlay_edit_mesh_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(overlay_edit_mesh_common) +GPU_SHADER_CREATE_END() /* The Non-Geometry shader variant passes directly to fragment. */ #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .define("EDGE") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::UCHAR4, "data") - .vertex_in(2, Type::VEC3_101010I2, "vnor") - .push_constant(Type::BOOL, "do_smooth_wire") - .vertex_out(overlay_edit_mesh_edge_geom_iface) - .vertex_out(overlay_edit_mesh_edge_geom_flat_iface) - .vertex_out(overlay_edit_mesh_edge_geom_noperspective_iface) - .fragment_source("overlay_edit_mesh_frag.glsl") - .additional_info("draw_modelmat") - .additional_info("overlay_edit_mesh_common_no_geom"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +DEFINE("EDGE") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, UCHAR4, data) +VERTEX_IN(2, VEC3_101010I2, vnor) +PUSH_CONSTANT(BOOL, do_smooth_wire) +VERTEX_OUT(overlay_edit_mesh_edge_geom_iface) +VERTEX_OUT(overlay_edit_mesh_edge_geom_flat_iface) +VERTEX_OUT(overlay_edit_mesh_edge_geom_noperspective_iface) +FRAGMENT_SOURCE("overlay_edit_mesh_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(overlay_edit_mesh_common_no_geom) +GPU_SHADER_CREATE_END() #endif /* Vertex Pull version for overlay next. */ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_next) - .do_static_compilation(true) - .define("EDGE") - .storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY) - .storage_buf(1, Qualifier::READ, "uint", "vnor[]", Frequency::GEOMETRY) - .storage_buf(2, Qualifier::READ, "uint", "data[]", Frequency::GEOMETRY) - .push_constant(Type::IVEC2, "gpu_attr_0") - .push_constant(Type::IVEC2, "gpu_attr_1") - .push_constant(Type::IVEC2, "gpu_attr_2") - .push_constant(Type::BOOL, "do_smooth_wire") - .push_constant(Type::BOOL, "use_vertex_selection") - .vertex_out(overlay_edit_mesh_edge_geom_iface) - .vertex_out(overlay_edit_mesh_edge_geom_flat_iface) - .vertex_out(overlay_edit_mesh_edge_geom_noperspective_iface) - .vertex_source("overlay_edit_mesh_edge_vert.glsl") - .fragment_source("overlay_edit_mesh_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new") - .additional_info("gpu_index_load") - .additional_info("overlay_edit_mesh_common"); +DO_STATIC_COMPILATION() +DEFINE("EDGE") +STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY) +STORAGE_BUF_FREQ(1, READ, uint, vnor[], GEOMETRY) +STORAGE_BUF_FREQ(2, READ, uint, data[], GEOMETRY) +PUSH_CONSTANT(IVEC2, gpu_attr_0) +PUSH_CONSTANT(IVEC2, gpu_attr_1) +PUSH_CONSTANT(IVEC2, gpu_attr_2) +PUSH_CONSTANT(BOOL, do_smooth_wire) +PUSH_CONSTANT(BOOL, use_vertex_selection) +VERTEX_OUT(overlay_edit_mesh_edge_geom_iface) +VERTEX_OUT(overlay_edit_mesh_edge_geom_flat_iface) +VERTEX_OUT(overlay_edit_mesh_edge_geom_noperspective_iface) +VERTEX_SOURCE("overlay_edit_mesh_edge_vert.glsl") +FRAGMENT_SOURCE("overlay_edit_mesh_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(gpu_index_load) +ADDITIONAL_INFO(overlay_edit_mesh_common) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_flat) - .do_static_compilation(true) - .define("FLAT") - .additional_info("overlay_edit_mesh_edge"); +DO_STATIC_COMPILATION() +DEFINE("FLAT") +ADDITIONAL_INFO(overlay_edit_mesh_edge) +GPU_SHADER_CREATE_END() #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_flat_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .define("FLAT") - .additional_info("overlay_edit_mesh_edge_no_geom"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +DEFINE("FLAT") +ADDITIONAL_INFO(overlay_edit_mesh_edge_no_geom) +GPU_SHADER_CREATE_END() #endif GPU_SHADER_CREATE_INFO(overlay_edit_mesh_face) - .do_static_compilation(true) - .define("FACE") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::UVEC4, "data") - .vertex_source("overlay_edit_mesh_vert.glsl") - .vertex_out(overlay_edit_flat_color_iface) - .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_modelmat") - .additional_info("overlay_edit_mesh_common"); +DO_STATIC_COMPILATION() +DEFINE("FACE") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, UVEC4, data) +VERTEX_SOURCE("overlay_edit_mesh_vert.glsl") +VERTEX_OUT(overlay_edit_flat_color_iface) +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(overlay_edit_mesh_common) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_face_next) - .do_static_compilation(true) - .define("FACE") - .define("vnor", "vec3(0.0)") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::UVEC4, "data") - .vertex_source("overlay_edit_mesh_face_vert.glsl") - .vertex_out(overlay_edit_flat_color_iface) - .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new") - .additional_info("overlay_edit_mesh_common"); +DO_STATIC_COMPILATION() +DEFINE("FACE") +DEFINE_VALUE("vnor", "vec3(0.0)") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, UVEC4, data) +VERTEX_SOURCE("overlay_edit_mesh_face_vert.glsl") +VERTEX_OUT(overlay_edit_flat_color_iface) +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(overlay_edit_mesh_common) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_facedot) - .do_static_compilation(true) - .define("FACEDOT") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::UVEC4, "data") - .vertex_in(2, Type::VEC4, "norAndFlag") - .define("vnor", "norAndFlag.xyz") - .vertex_source("overlay_edit_mesh_vert.glsl") - .vertex_out(overlay_edit_flat_color_iface) - .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_modelmat") - .additional_info("overlay_edit_mesh_common"); +DO_STATIC_COMPILATION() +DEFINE("FACEDOT") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, UVEC4, data) +VERTEX_IN(2, VEC4, norAndFlag) +DEFINE_VALUE("vnor", "norAndFlag.xyz") +VERTEX_SOURCE("overlay_edit_mesh_vert.glsl") +VERTEX_OUT(overlay_edit_flat_color_iface) +FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(overlay_edit_mesh_common) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_facedot_next) - .do_static_compilation(true) - .define("FACEDOT") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::UVEC4, "data") - .vertex_in(2, Type::VEC4, "norAndFlag") - .define("vnor", "norAndFlag.xyz") - .vertex_source("overlay_edit_mesh_facedot_vert.glsl") - .vertex_out(overlay_edit_flat_color_iface) - .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new") - .additional_info("overlay_edit_mesh_common"); +DO_STATIC_COMPILATION() +DEFINE("FACEDOT") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, UVEC4, data) +VERTEX_IN(2, VEC4, norAndFlag) +DEFINE_VALUE("vnor", "norAndFlag.xyz") +VERTEX_SOURCE("overlay_edit_mesh_facedot_vert.glsl") +VERTEX_OUT(overlay_edit_flat_color_iface) +FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(overlay_edit_mesh_common) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_normal) - .do_static_compilation(true) - .define("WORKAROUND_INDEX_LOAD_INCLUDE") - /* WORKAROUND: Needed to support OpenSubdiv vertex format. Should be removed. */ - .push_constant(Type::IVEC2, "gpu_attr_0") - .push_constant(Type::IVEC2, "gpu_attr_1") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC4, "lnor") - .vertex_in(2, Type::VEC4, "vnor") - .vertex_in(3, Type::VEC4, "norAndFlag") - .sampler(0, ImageType::DEPTH_2D, "depthTex") - .push_constant(Type::FLOAT, "normalSize") - .push_constant(Type::FLOAT, "normalScreenSize") - .push_constant(Type::FLOAT, "alpha") - .push_constant(Type::BOOL, "isConstantScreenSizeNormals") - .vertex_out(overlay_edit_flat_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_mesh_normal_vert.glsl") - .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_modelmat_instanced_attr") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +DEFINE("WORKAROUND_INDEX_LOAD_INCLUDE") +/* WORKAROUND: Needed to support OpenSubdiv vertex format. Should be removed. */ +PUSH_CONSTANT(IVEC2, gpu_attr_0) +PUSH_CONSTANT(IVEC2, gpu_attr_1) +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC4, lnor) +VERTEX_IN(2, VEC4, vnor) +VERTEX_IN(3, VEC4, norAndFlag) +SAMPLER(0, DEPTH_2D, depthTex) +PUSH_CONSTANT(FLOAT, normalSize) +PUSH_CONSTANT(FLOAT, normalScreenSize) +PUSH_CONSTANT(FLOAT, alpha) +PUSH_CONSTANT(BOOL, isConstantScreenSizeNormals) +VERTEX_OUT(overlay_edit_flat_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_mesh_normal_vert.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(draw_modelmat_instanced_attr) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() -GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_analysis_iface).smooth(Type::VEC4, "weightColor"); +GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_analysis_iface) +SMOOTH(VEC4, weightColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_analysis) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::FLOAT, "weight") - .sampler(0, ImageType::FLOAT_1D, "weightTex") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_out(overlay_edit_mesh_analysis_iface) - .vertex_source("overlay_edit_mesh_analysis_vert.glsl") - .fragment_source("overlay_edit_mesh_analysis_frag.glsl") - .additional_info("draw_modelmat"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, FLOAT, weight) +SAMPLER(0, FLOAT_1D, weightTex) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_OUT(overlay_edit_mesh_analysis_iface) +VERTEX_SOURCE("overlay_edit_mesh_analysis_vert.glsl") +FRAGMENT_SOURCE("overlay_edit_mesh_analysis_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_skin_root) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::FLOAT, "size") - .vertex_in(2, Type::VEC3, "local_pos") - .vertex_out(overlay_edit_flat_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_mesh_skin_root_vert.glsl") - .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_modelmat_instanced_attr") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, FLOAT, size) +VERTEX_IN(2, VEC3, local_pos) +VERTEX_OUT(overlay_edit_flat_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_mesh_skin_root_vert.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(draw_modelmat_instanced_attr) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_vert_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_mesh_vert") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_mesh_vert) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_mesh_edge") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_mesh_edge) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_clipped_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .additional_info("overlay_edit_mesh_edge_no_geom") - .additional_info("drw_clipped"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_mesh_edge_no_geom) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() #endif GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_flat_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_mesh_edge_flat") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_mesh_edge_flat) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge_flat_clipped_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .additional_info("overlay_edit_mesh_edge_flat_no_geom") - .additional_info("drw_clipped"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_mesh_edge_flat_no_geom) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() #endif GPU_SHADER_CREATE_INFO(overlay_edit_mesh_face_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_mesh_face") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_mesh_face) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_facedot_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_mesh_facedot") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_mesh_facedot) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_normal_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_mesh_normal") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_mesh_normal) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_analysis_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_mesh_analysis") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_mesh_analysis) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_mesh_skin_root_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_mesh_skin_root") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_mesh_skin_root) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -334,166 +374,187 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_skin_root_clipped) * \{ */ GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_uv_iface, geom_in) - .smooth(Type::FLOAT, "selectionFac"); +SMOOTH(FLOAT, selectionFac) +GPU_SHADER_NAMED_INTERFACE_END(geom_in) GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_uv_flat_iface, geom_flat_in) - .flat(Type::VEC2, "stippleStart"); +FLAT(VEC2, stippleStart) +GPU_SHADER_NAMED_INTERFACE_END(geom_flat_in) GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_uv_noperspective_iface, geom_noperspective_in) - .no_perspective(Type::VEC2, "stipplePos"); +NO_PERSPECTIVE(VEC2, stipplePos) +GPU_SHADER_NAMED_INTERFACE_END(geom_noperspective_in) GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_uv_geom_iface, geom_out) - .smooth(Type::FLOAT, "selectionFac"); +SMOOTH(FLOAT, selectionFac) +GPU_SHADER_NAMED_INTERFACE_END(geom_out) GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_uv_geom_flat_iface, geom_flat_out) - .flat(Type::VEC2, "stippleStart"); +FLAT(VEC2, stippleStart) +GPU_SHADER_NAMED_INTERFACE_END(geom_flat_out) GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_uv_geom_noperspective_iface, geom_noperspective_out) - .no_perspective(Type::FLOAT, "edgeCoord") - .no_perspective(Type::VEC2, "stipplePos"); +NO_PERSPECTIVE(FLOAT, edgeCoord) +NO_PERSPECTIVE(VEC2, stipplePos) +GPU_SHADER_NAMED_INTERFACE_END(geom_noperspective_out) GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges_common) - .vertex_in(0, Type::VEC2, "au") - .vertex_in(1, Type::INT, "flag") - .push_constant(Type::INT, "lineStyle") - .push_constant(Type::BOOL, "doSmoothWire") - .push_constant(Type::FLOAT, "alpha") - .push_constant(Type::FLOAT, "dashLength") - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_source("overlay_edit_uv_edges_frag.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +VERTEX_IN(0, VEC2, au) +VERTEX_IN(1, INT, flag) +PUSH_CONSTANT(INT, lineStyle) +PUSH_CONSTANT(BOOL, doSmoothWire) +PUSH_CONSTANT(FLOAT, alpha) +PUSH_CONSTANT(FLOAT, dashLength) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_SOURCE("overlay_edit_uv_edges_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges) - .additional_info("overlay_edit_uv_edges_common") - .do_static_compilation(true) - .vertex_out(overlay_edit_uv_iface) - .vertex_out(overlay_edit_uv_flat_iface) - .vertex_out(overlay_edit_uv_noperspective_iface) - .geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) - .geometry_out(overlay_edit_uv_geom_iface) - .geometry_out(overlay_edit_uv_geom_flat_iface) - .geometry_out(overlay_edit_uv_geom_noperspective_iface) - .vertex_source("overlay_edit_uv_edges_vert.glsl") - .geometry_source("overlay_edit_uv_edges_geom.glsl"); +ADDITIONAL_INFO(overlay_edit_uv_edges_common) +DO_STATIC_COMPILATION() +VERTEX_OUT(overlay_edit_uv_iface) +VERTEX_OUT(overlay_edit_uv_flat_iface) +VERTEX_OUT(overlay_edit_uv_noperspective_iface) +GEOMETRY_LAYOUT(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) +GEOMETRY_OUT(overlay_edit_uv_geom_iface) +GEOMETRY_OUT(overlay_edit_uv_geom_flat_iface) +GEOMETRY_OUT(overlay_edit_uv_geom_noperspective_iface) +VERTEX_SOURCE("overlay_edit_uv_edges_vert.glsl") +GEOMETRY_SOURCE("overlay_edit_uv_edges_geom.glsl") +GPU_SHADER_CREATE_END() #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges_no_geom) - .metal_backend_only(true) - .additional_info("overlay_edit_uv_edges_common") - .do_static_compilation(true) - .vertex_out(overlay_edit_uv_geom_iface) - .vertex_out(overlay_edit_uv_geom_flat_iface) - .vertex_out(overlay_edit_uv_geom_noperspective_iface) - .vertex_source("overlay_edit_uv_edges_vert_no_geom.glsl"); +METAL_BACKEND_ONLY() +ADDITIONAL_INFO(overlay_edit_uv_edges_common) +DO_STATIC_COMPILATION() +VERTEX_OUT(overlay_edit_uv_geom_iface) +VERTEX_OUT(overlay_edit_uv_geom_flat_iface) +VERTEX_OUT(overlay_edit_uv_geom_noperspective_iface) +VERTEX_SOURCE("overlay_edit_uv_edges_vert_no_geom.glsl") +GPU_SHADER_CREATE_END() #endif GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges_select) - .do_static_compilation(true) - .define("USE_EDGE_SELECT") - .additional_info("overlay_edit_uv_edges"); +DO_STATIC_COMPILATION() +DEFINE("USE_EDGE_SELECT") +ADDITIONAL_INFO(overlay_edit_uv_edges) +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(overlay_edit_uv_next_iface) - .smooth(Type::FLOAT, "selectionFac") - .flat(Type::VEC2, "stippleStart") - .no_perspective(Type::FLOAT, "edgeCoord") - .no_perspective(Type::VEC2, "stipplePos"); +SMOOTH(FLOAT, selectionFac) +FLAT(VEC2, stippleStart) +NO_PERSPECTIVE(FLOAT, edgeCoord) +NO_PERSPECTIVE(VEC2, stipplePos) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges_next) - .do_static_compilation(true) - .storage_buf(0, Qualifier::READ, "float", "au[]", Frequency::GEOMETRY) - .storage_buf(1, Qualifier::READ, "uint", "data[]", Frequency::GEOMETRY) - .push_constant(Type::IVEC2, "gpu_attr_0") - .push_constant(Type::IVEC2, "gpu_attr_1") - .push_constant(Type::INT, "lineStyle") - .push_constant(Type::BOOL, "doSmoothWire") - .push_constant(Type::FLOAT, "alpha") - .push_constant(Type::FLOAT, "dashLength") - .specialization_constant(Type::BOOL, "use_edge_select", false) - .vertex_out(overlay_edit_uv_next_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_uv_edges_next_vert.glsl") - .fragment_source("overlay_edit_uv_edges_next_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new") - .additional_info("gpu_index_load") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +STORAGE_BUF_FREQ(0, READ, float, au[], GEOMETRY) +STORAGE_BUF_FREQ(1, READ, uint, data[], GEOMETRY) +PUSH_CONSTANT(IVEC2, gpu_attr_0) +PUSH_CONSTANT(IVEC2, gpu_attr_1) +PUSH_CONSTANT(INT, lineStyle) +PUSH_CONSTANT(BOOL, doSmoothWire) +PUSH_CONSTANT(FLOAT, alpha) +PUSH_CONSTANT(FLOAT, dashLength) +SPECIALIZATION_CONSTANT(BOOL, use_edge_select, false) +VERTEX_OUT(overlay_edit_uv_next_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_uv_edges_next_vert.glsl") +FRAGMENT_SOURCE("overlay_edit_uv_edges_next_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(gpu_index_load) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_uv_faces) - .do_static_compilation(true) - .vertex_in(0, Type::VEC2, "au") - .vertex_in(1, Type::UINT, "flag") - .push_constant(Type::FLOAT, "uvOpacity") - .vertex_out(overlay_edit_flat_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_uv_faces_vert.glsl") - .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC2, au) +VERTEX_IN(1, UINT, flag) +PUSH_CONSTANT(FLOAT, uvOpacity) +VERTEX_OUT(overlay_edit_flat_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_uv_faces_vert.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_uv_face_dots) - .do_static_compilation(true) - .vertex_in(0, Type::VEC2, "au") - .vertex_in(1, Type::UINT, "flag") - .push_constant(Type::FLOAT, "pointSize") - .vertex_out(overlay_edit_flat_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_uv_face_dots_vert.glsl") - .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC2, au) +VERTEX_IN(1, UINT, flag) +PUSH_CONSTANT(FLOAT, pointSize) +VERTEX_OUT(overlay_edit_flat_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_uv_face_dots_vert.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(overlay_edit_uv_vert_iface) - .smooth(Type::VEC4, "fillColor") - .smooth(Type::VEC4, "outlineColor") - .smooth(Type::VEC4, "radii"); +SMOOTH(VEC4, fillColor) +SMOOTH(VEC4, outlineColor) +SMOOTH(VEC4, radii) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_edit_uv_verts) - .do_static_compilation(true) - .vertex_in(0, Type::VEC2, "au") - .vertex_in(1, Type::UINT, "flag") - .push_constant(Type::FLOAT, "pointSize") - .push_constant(Type::FLOAT, "outlineWidth") - .push_constant(Type::VEC4, "color") - .vertex_out(overlay_edit_uv_vert_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_uv_verts_vert.glsl") - .fragment_source("overlay_edit_uv_verts_frag.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC2, au) +VERTEX_IN(1, UINT, flag) +PUSH_CONSTANT(FLOAT, pointSize) +PUSH_CONSTANT(FLOAT, outlineWidth) +PUSH_CONSTANT(VEC4, color) +VERTEX_OUT(overlay_edit_uv_vert_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_uv_verts_vert.glsl") +FRAGMENT_SOURCE("overlay_edit_uv_verts_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_uv_tiled_image_borders) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .push_constant(Type::VEC4, "ucolor") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_uv_tiled_image_borders_vert.glsl") - .fragment_source("overlay_uniform_color_frag.glsl") - .additional_info("draw_mesh"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +PUSH_CONSTANT(VEC4, ucolor) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_uv_tiled_image_borders_vert.glsl") +FRAGMENT_SOURCE("overlay_uniform_color_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +GPU_SHADER_CREATE_END() -GPU_SHADER_INTERFACE_INFO(edit_uv_image_iface).smooth(Type::VEC2, "uvs"); +GPU_SHADER_INTERFACE_INFO(edit_uv_image_iface) +SMOOTH(VEC2, uvs) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_edit_uv_stencil_image) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_out(edit_uv_image_iface) - .vertex_source("overlay_edit_uv_image_vert.glsl") - .sampler(0, ImageType::FLOAT_2D, "imgTexture") - .push_constant(Type::BOOL, "imgPremultiplied") - .push_constant(Type::BOOL, "imgAlphaBlend") - .push_constant(Type::VEC4, "ucolor") - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_source("overlay_image_frag.glsl") - .additional_info("draw_mesh"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_OUT(edit_uv_image_iface) +VERTEX_SOURCE("overlay_edit_uv_image_vert.glsl") +SAMPLER(0, FLOAT_2D, imgTexture) +PUSH_CONSTANT(BOOL, imgPremultiplied) +PUSH_CONSTANT(BOOL, imgAlphaBlend) +PUSH_CONSTANT(VEC4, ucolor) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_SOURCE("overlay_image_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_uv_mask_image) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_out(edit_uv_image_iface) - .sampler(0, ImageType::FLOAT_2D, "imgTexture") - .push_constant(Type::VEC4, "color") - .push_constant(Type::FLOAT, "opacity") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_uv_image_vert.glsl") - .fragment_source("overlay_edit_uv_image_mask_frag.glsl") - .additional_info("draw_mesh"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_OUT(edit_uv_image_iface) +SAMPLER(0, FLOAT_2D, imgTexture) +PUSH_CONSTANT(VEC4, color) +PUSH_CONSTANT(FLOAT, opacity) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_uv_image_vert.glsl") +FRAGMENT_SOURCE("overlay_edit_uv_image_mask_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +GPU_SHADER_CREATE_END() /** \} */ @@ -502,31 +563,34 @@ GPU_SHADER_CREATE_INFO(overlay_edit_uv_mask_image) * \{ */ GPU_SHADER_CREATE_INFO(overlay_edit_uv_stretching) - .vertex_in(0, Type::VEC2, "pos") - .push_constant(Type::VEC2, "aspect") - .push_constant(Type::FLOAT, "stretch_opacity") - .vertex_out(overlay_edit_nopersp_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_uv_stretching_vert.glsl") - .fragment_source("overlay_varying_color.glsl") - .push_constant(Type::FLOAT, "totalAreaRatio"); +VERTEX_IN(0, VEC2, pos) +PUSH_CONSTANT(VEC2, aspect) +PUSH_CONSTANT(FLOAT, stretch_opacity) +VERTEX_OUT(overlay_edit_nopersp_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_uv_stretching_vert.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +PUSH_CONSTANT(FLOAT, totalAreaRatio) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_uv_stretching_area) - .do_static_compilation(true) - .vertex_in(1, Type::FLOAT, "ratio") - .push_constant(Type::FLOAT, "totalAreaRatio") - .additional_info("overlay_edit_uv_stretching") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(1, FLOAT, ratio) +PUSH_CONSTANT(FLOAT, totalAreaRatio) +ADDITIONAL_INFO(overlay_edit_uv_stretching) +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_uv_stretching_angle) - .do_static_compilation(true) - .define("STRETCH_ANGLE") - .vertex_in(1, Type::VEC2, "uv_angles") - .vertex_in(2, Type::FLOAT, "angle") - .additional_info("overlay_edit_uv_stretching") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +DEFINE("STRETCH_ANGLE") +VERTEX_IN(1, VEC2, uv_angles) +VERTEX_IN(2, FLOAT, angle) +ADDITIONAL_INFO(overlay_edit_uv_stretching) +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() /** \} */ @@ -534,136 +598,148 @@ GPU_SHADER_CREATE_INFO(overlay_edit_uv_stretching_angle) /** \name Edit Curve * \{ */ -GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_curve_handle_iface, vert).flat(Type::UINT, "flag"); +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_curve_handle_iface, vert) +FLAT(UINT, flag) +GPU_SHADER_NAMED_INTERFACE_END(vert) GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::UINT, "data") - .vertex_out(overlay_edit_curve_handle_iface) - .geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 10) - .geometry_out(overlay_edit_smooth_color_iface) - .push_constant(Type::BOOL, "showCurveHandles") - .push_constant(Type::INT, "curveHandleDisplay") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_curve_handle_vert.glsl") - .geometry_source("overlay_edit_curve_handle_geom.glsl") - .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, UINT, data) +VERTEX_OUT(overlay_edit_curve_handle_iface) +GEOMETRY_LAYOUT(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 10) +GEOMETRY_OUT(overlay_edit_smooth_color_iface) +PUSH_CONSTANT(BOOL, showCurveHandles) +PUSH_CONSTANT(INT, curveHandleDisplay) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_curve_handle_vert.glsl") +GEOMETRY_SOURCE("overlay_edit_curve_handle_geom.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - /* NOTE: Color already in Linear space. Which is what we want. */ - .define("srgbTarget", "false") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::UINT, "data") - .vertex_out(overlay_edit_smooth_color_iface) - .push_constant(Type::BOOL, "showCurveHandles") - .push_constant(Type::INT, "curveHandleDisplay") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_curve_handle_vert_no_geom.glsl") - .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +/* NOTE: Color already in Linear space. Which is what we want. */ +DEFINE_VALUE("srgbTarget", "false") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, UINT, data) +VERTEX_OUT(overlay_edit_smooth_color_iface) +PUSH_CONSTANT(BOOL, showCurveHandles) +PUSH_CONSTANT(INT, curveHandleDisplay) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_curve_handle_vert_no_geom.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() #endif GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_next) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - .storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY) - .storage_buf(1, Qualifier::READ, "uint", "data[]", Frequency::GEOMETRY) - .push_constant(Type::IVEC2, "gpu_attr_0") - .push_constant(Type::IVEC2, "gpu_attr_1") - .vertex_out(overlay_edit_smooth_color_iface) - .push_constant(Type::BOOL, "showCurveHandles") - .push_constant(Type::INT, "curveHandleDisplay") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_curve_handle_next_vert.glsl") - .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new") - .additional_info("gpu_index_load") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY) +STORAGE_BUF_FREQ(1, READ, uint, data[], GEOMETRY) +PUSH_CONSTANT(IVEC2, gpu_attr_0) +PUSH_CONSTANT(IVEC2, gpu_attr_1) +VERTEX_OUT(overlay_edit_smooth_color_iface) +PUSH_CONSTANT(BOOL, showCurveHandles) +PUSH_CONSTANT(INT, curveHandleDisplay) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_curve_handle_next_vert.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(gpu_index_load) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_curve_handle") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_curve_handle) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() #ifdef WITH_METAL_BACKEND GPU_SHADER_CREATE_INFO(overlay_edit_curve_handle_clipped_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .additional_info("overlay_edit_curve_handle_no_geom") - .additional_info("drw_clipped"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_curve_handle_no_geom) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() #endif GPU_SHADER_CREATE_INFO(overlay_edit_curve_point) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::UINT, "data") - .vertex_out(overlay_edit_flat_color_iface) - .push_constant(Type::BOOL, "showCurveHandles") - .push_constant(Type::INT, "curveHandleDisplay") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_curve_point_vert.glsl") - .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, UINT, data) +VERTEX_OUT(overlay_edit_flat_color_iface) +PUSH_CONSTANT(BOOL, showCurveHandles) +PUSH_CONSTANT(INT, curveHandleDisplay) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_curve_point_vert.glsl") +FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_curve_point_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_curve_point") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_curve_point) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_curve_wire) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC3, "nor") - .vertex_in(2, Type::VEC3, "tan") - .vertex_in(3, Type::FLOAT, "rad") - .push_constant(Type::FLOAT, "normalSize") - .vertex_out(overlay_edit_flat_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_curve_wire_vert.glsl") - .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_modelmat") - .additional_info("draw_resource_id_uniform") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC3, nor) +VERTEX_IN(2, VEC3, tan) +VERTEX_IN(3, FLOAT, rad) +PUSH_CONSTANT(FLOAT, normalSize) +VERTEX_OUT(overlay_edit_flat_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_curve_wire_vert.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(draw_resource_id_uniform) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_curve_wire_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_curve_wire") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_curve_wire) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_curve_normals) - .do_static_compilation(true) - .storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY) - .storage_buf(1, Qualifier::READ, "float", "rad[]", Frequency::GEOMETRY) - .storage_buf(2, Qualifier::READ, "uint", "nor[]", Frequency::GEOMETRY) - .storage_buf(3, Qualifier::READ, "uint", "tan[]", Frequency::GEOMETRY) - .push_constant(Type::IVEC2, "gpu_attr_0") - .push_constant(Type::IVEC2, "gpu_attr_1") - .push_constant(Type::IVEC2, "gpu_attr_2") - .push_constant(Type::IVEC2, "gpu_attr_3") - .push_constant(Type::FLOAT, "normalSize") - .push_constant(Type::BOOL, "use_hq_normals") - .vertex_out(overlay_edit_flat_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_curve_wire_next_vert.glsl") - .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new") - .additional_info("gpu_index_load") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY) +STORAGE_BUF_FREQ(1, READ, float, rad[], GEOMETRY) +STORAGE_BUF_FREQ(2, READ, uint, nor[], GEOMETRY) +STORAGE_BUF_FREQ(3, READ, uint, tan[], GEOMETRY) +PUSH_CONSTANT(IVEC2, gpu_attr_0) +PUSH_CONSTANT(IVEC2, gpu_attr_1) +PUSH_CONSTANT(IVEC2, gpu_attr_2) +PUSH_CONSTANT(IVEC2, gpu_attr_3) +PUSH_CONSTANT(FLOAT, normalSize) +PUSH_CONSTANT(BOOL, use_hq_normals) +VERTEX_OUT(overlay_edit_flat_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_curve_wire_next_vert.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(gpu_index_load) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() /** \} */ @@ -672,27 +748,30 @@ GPU_SHADER_CREATE_INFO(overlay_edit_curve_normals) * \{ */ GPU_SHADER_INTERFACE_INFO(overlay_edit_curves_handle_iface) - .smooth(Type::VEC4, "finalColor") - .smooth(Type::VEC4, "leftColor"); +SMOOTH(VEC4, finalColor) +SMOOTH(VEC4, leftColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_edit_curves_handle) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::UINT, "data") - .vertex_in(2, Type::FLOAT, "selection") - .vertex_out(overlay_edit_curves_handle_iface) - .uniform_buf(0, "int", "curvesInfoBlock[4]") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_curves_handle_vert.glsl") - .fragment_source("overlay_edit_curves_handle_frag.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, UINT, data) +VERTEX_IN(2, FLOAT, selection) +VERTEX_OUT(overlay_edit_curves_handle_iface) +UNIFORM_BUF(0, int, curvesInfoBlock[4]) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_curves_handle_vert.glsl") +FRAGMENT_SOURCE("overlay_edit_curves_handle_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_curves_handle_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_curves_handle") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_curves_handle) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -701,37 +780,41 @@ GPU_SHADER_CREATE_INFO(overlay_edit_curves_handle_clipped) * \{ */ GPU_SHADER_CREATE_INFO(overlay_edit_lattice_point) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::UINT, "data") - .vertex_out(overlay_edit_flat_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_lattice_point_vert.glsl") - .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, UINT, data) +VERTEX_OUT(overlay_edit_flat_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_lattice_point_vert.glsl") +FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_lattice_point_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_lattice_point") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_lattice_point) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_lattice_wire) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::FLOAT, "weight") - .sampler(0, ImageType::FLOAT_1D, "weightTex") - .vertex_out(overlay_edit_smooth_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_lattice_wire_vert.glsl") - .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, FLOAT, weight) +SAMPLER(0, FLOAT_1D, weightTex) +VERTEX_OUT(overlay_edit_smooth_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_lattice_wire_vert.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_lattice_wire_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_lattice_wire") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_lattice_wire) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -740,42 +823,46 @@ GPU_SHADER_CREATE_INFO(overlay_edit_lattice_wire_clipped) * \{ */ GPU_SHADER_CREATE_INFO(overlay_edit_particle_strand) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::FLOAT, "selection") - .sampler(0, ImageType::FLOAT_1D, "weightTex") - .push_constant(Type::BOOL, "useWeight") - .push_constant(Type::BOOL, "useGreasePencil") - .vertex_out(overlay_edit_smooth_color_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_particle_strand_vert.glsl") - .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, FLOAT, selection) +SAMPLER(0, FLOAT_1D, weightTex) +PUSH_CONSTANT(BOOL, useWeight) +PUSH_CONSTANT(BOOL, useGreasePencil) +VERTEX_OUT(overlay_edit_smooth_color_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_particle_strand_vert.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_particle_strand_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_particle_strand") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_particle_strand) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_particle_point) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::FLOAT, "selection") - .vertex_out(overlay_edit_flat_color_iface) - .sampler(0, ImageType::FLOAT_1D, "weightTex") - .push_constant(Type::BOOL, "useWeight") - .push_constant(Type::BOOL, "useGreasePencil") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_particle_point_vert.glsl") - .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, FLOAT, selection) +VERTEX_OUT(overlay_edit_flat_color_iface) +SAMPLER(0, FLOAT_1D, weightTex) +PUSH_CONSTANT(BOOL, useWeight) +PUSH_CONSTANT(BOOL, useGreasePencil) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_particle_point_vert.glsl") +FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_particle_point_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_particle_point") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_particle_point) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -784,66 +871,73 @@ GPU_SHADER_CREATE_INFO(overlay_edit_particle_point_clipped) * \{ */ GPU_SHADER_CREATE_INFO(overlay_edit_gpencil) - .typedef_source("overlay_shader_shared.h") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::INT, "ma") - .vertex_in(2, Type::UINT, "vflag") - .vertex_in(3, Type::FLOAT, "weight") - .push_constant(Type::FLOAT, "normalSize") - .push_constant(Type::BOOL, "doMultiframe") - .push_constant(Type::BOOL, "doStrokeEndpoints") - .push_constant(Type::BOOL, "hideSelect") - .push_constant(Type::BOOL, "doWeightColor") - .push_constant(Type::FLOAT, "gpEditOpacity") - .push_constant(Type::VEC4, "gpEditColor") - .sampler(0, ImageType::FLOAT_1D, "weightTex") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_gpencil_vert.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +TYPEDEF_SOURCE("overlay_shader_shared.h") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, INT, ma) +VERTEX_IN(2, UINT, vflag) +VERTEX_IN(3, FLOAT, weight) +PUSH_CONSTANT(FLOAT, normalSize) +PUSH_CONSTANT(BOOL, doMultiframe) +PUSH_CONSTANT(BOOL, doStrokeEndpoints) +PUSH_CONSTANT(BOOL, hideSelect) +PUSH_CONSTANT(BOOL, doWeightColor) +PUSH_CONSTANT(FLOAT, gpEditOpacity) +PUSH_CONSTANT(VEC4, gpEditColor) +SAMPLER(0, FLOAT_1D, weightTex) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_gpencil_vert.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_wire) - .do_static_compilation(true) - .vertex_out(overlay_edit_smooth_color_iface) - .fragment_source("overlay_varying_color.glsl") - .additional_info("overlay_edit_gpencil"); +DO_STATIC_COMPILATION() +VERTEX_OUT(overlay_edit_smooth_color_iface) +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(overlay_edit_gpencil) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_wire_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_gpencil_wire") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_gpencil_wire) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_point) - .do_static_compilation(true) - .define("USE_POINTS") - .vertex_out(overlay_edit_flat_color_iface) - .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("overlay_edit_gpencil"); +DO_STATIC_COMPILATION() +DEFINE("USE_POINTS") +VERTEX_OUT(overlay_edit_flat_color_iface) +FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") +ADDITIONAL_INFO(overlay_edit_gpencil) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_point_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_gpencil_point") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_gpencil_point) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /* TODO(fclem): Refactor this to take list of point instead of drawing 1 point per drawcall. */ GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_guide_point) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::UINT, "data") - .vertex_out(overlay_edit_flat_color_iface) - .push_constant(Type::VEC3, "pPosition") - .push_constant(Type::FLOAT, "pSize") - .push_constant(Type::VEC4, "pColor") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_gpencil_guide_vert.glsl") - .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, UINT, data) +VERTEX_OUT(overlay_edit_flat_color_iface) +PUSH_CONSTANT(VEC3, pPosition) +PUSH_CONSTANT(FLOAT, pSize) +PUSH_CONSTANT(VEC4, pColor) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_gpencil_guide_vert.glsl") +FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_guide_point_clipped) - .do_static_compilation(true) - .additional_info("overlay_edit_gpencil_guide_point") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_edit_gpencil_guide_point) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -854,83 +948,92 @@ GPU_SHADER_CREATE_INFO(overlay_edit_gpencil_guide_point_clipped) * \{ */ GPU_SHADER_CREATE_INFO(overlay_depth_only) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_source("overlay_depth_only_vert.glsl") - .fragment_source("overlay_depth_only_frag.glsl") - .additional_info("draw_mesh"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_SOURCE("overlay_depth_only_vert.glsl") +FRAGMENT_SOURCE("overlay_depth_only_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_depth_only_clipped) - .do_static_compilation(true) - .additional_info("overlay_depth_only") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_depth_only) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_depth_mesh) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_source("basic_depth_vert.glsl") - .fragment_source("overlay_depth_only_frag.glsl") - .additional_info("draw_globals") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_SOURCE("basic_depth_vert.glsl") +FRAGMENT_SOURCE("overlay_depth_only_frag.glsl") +ADDITIONAL_INFO(draw_globals) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_depth_mesh_conservative) - .do_static_compilation(true) - .storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY) - .push_constant(Type::IVEC2, "gpu_attr_0") - .vertex_source("overlay_depth_only_mesh_conservative_vert.glsl") - .fragment_source("overlay_depth_only_frag.glsl") - .additional_info("draw_globals") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("gpu_index_load") - .additional_info("draw_resource_handle_new"); +DO_STATIC_COMPILATION() +STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY) +PUSH_CONSTANT(IVEC2, gpu_attr_0) +VERTEX_SOURCE("overlay_depth_only_mesh_conservative_vert.glsl") +FRAGMENT_SOURCE("overlay_depth_only_frag.glsl") +ADDITIONAL_INFO(draw_globals) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(gpu_index_load) +ADDITIONAL_INFO(draw_resource_handle_new) +GPU_SHADER_CREATE_END() GPU_SHADER_NAMED_INTERFACE_INFO(overlay_depth_only_gpencil_flat_iface, gp_interp_flat) - .flat(Type::VEC2, "aspect") - .flat(Type::VEC4, "sspos"); +FLAT(VEC2, aspect) +FLAT(VEC4, sspos) +GPU_SHADER_NAMED_INTERFACE_END(gp_interp_flat) GPU_SHADER_NAMED_INTERFACE_INFO(overlay_depth_only_gpencil_noperspective_iface, gp_interp_noperspective) - .no_perspective(Type::VEC2, "thickness") - .no_perspective(Type::FLOAT, "hardness"); +NO_PERSPECTIVE(VEC2, thickness) +NO_PERSPECTIVE(FLOAT, hardness) +GPU_SHADER_NAMED_INTERFACE_END(gp_interp_noperspective) GPU_SHADER_CREATE_INFO(overlay_depth_gpencil) - .do_static_compilation(true) - .typedef_source("gpencil_shader_shared.h") - .vertex_out(overlay_depth_only_gpencil_flat_iface) - .vertex_out(overlay_depth_only_gpencil_noperspective_iface) - .vertex_source("overlay_depth_only_gpencil_vert.glsl") - .fragment_source("overlay_depth_only_gpencil_frag.glsl") - .depth_write(DepthWrite::ANY) - .push_constant(Type::BOOL, "gpStrokeOrder3d") /* TODO(fclem): Move to a GPencil object UBO. */ - .push_constant(Type::VEC4, "gpDepthPlane") /* TODO(fclem): Move to a GPencil object UBO. */ - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new") - .additional_info("draw_globals") - .additional_info("draw_gpencil_new") - .additional_info("draw_object_infos_new"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("gpencil_shader_shared.h") +VERTEX_OUT(overlay_depth_only_gpencil_flat_iface) +VERTEX_OUT(overlay_depth_only_gpencil_noperspective_iface) +VERTEX_SOURCE("overlay_depth_only_gpencil_vert.glsl") +FRAGMENT_SOURCE("overlay_depth_only_gpencil_frag.glsl") +DEPTH_WRITE(DepthWrite::ANY) +PUSH_CONSTANT(BOOL, gpStrokeOrder3d) /* TODO(fclem): Move to a GPencil object UBO. */ +PUSH_CONSTANT(VEC4, gpDepthPlane) /* TODO(fclem): Move to a GPencil object UBO. */ +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(draw_globals) +ADDITIONAL_INFO(draw_gpencil_new) +ADDITIONAL_INFO(draw_object_infos_new) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_depth_pointcloud) - .do_static_compilation(true) - .vertex_source("basic_depth_pointcloud_vert.glsl") - .fragment_source("overlay_depth_only_frag.glsl") - .additional_info("draw_pointcloud_new") - .additional_info("draw_globals") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new"); +DO_STATIC_COMPILATION() +VERTEX_SOURCE("basic_depth_pointcloud_vert.glsl") +FRAGMENT_SOURCE("overlay_depth_only_frag.glsl") +ADDITIONAL_INFO(draw_pointcloud_new) +ADDITIONAL_INFO(draw_globals) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_depth_curves) - .do_static_compilation(true) - .vertex_source("basic_depth_curves_vert.glsl") - .fragment_source("overlay_depth_only_frag.glsl") - .additional_info("draw_hair_new") - .additional_info("draw_globals") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new"); +DO_STATIC_COMPILATION() +VERTEX_SOURCE("basic_depth_curves_vert.glsl") +FRAGMENT_SOURCE("overlay_depth_only_frag.glsl") +ADDITIONAL_INFO(draw_hair_new) +ADDITIONAL_INFO(draw_globals) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +GPU_SHADER_CREATE_END() /** \} */ @@ -939,30 +1042,34 @@ GPU_SHADER_CREATE_INFO(overlay_depth_curves) * \{ */ GPU_SHADER_CREATE_INFO(overlay_uniform_color) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .push_constant(Type::VEC4, "ucolor") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_depth_only_vert.glsl") - .fragment_source("overlay_uniform_color_frag.glsl") - .additional_info("draw_mesh"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +PUSH_CONSTANT(VEC4, ucolor) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_depth_only_vert.glsl") +FRAGMENT_SOURCE("overlay_uniform_color_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_uniform_color_pointcloud) - .do_static_compilation(true) - .push_constant(Type::VEC4, "ucolor") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_pointcloud_only_vert.glsl") - .fragment_source("overlay_uniform_color_frag.glsl") - .additional_info("draw_pointcloud"); +DO_STATIC_COMPILATION() +PUSH_CONSTANT(VEC4, ucolor) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_pointcloud_only_vert.glsl") +FRAGMENT_SOURCE("overlay_uniform_color_frag.glsl") +ADDITIONAL_INFO(draw_pointcloud) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_uniform_color_clipped) - .do_static_compilation(true) - .additional_info("overlay_uniform_color") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_uniform_color) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_uniform_color_pointcloud_clipped) - .do_static_compilation(true) - .additional_info("overlay_uniform_color_pointcloud") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_uniform_color_pointcloud) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_extra_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_extra_info.hh index bc7269ed9ea..c4aba12ca50 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_extra_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_extra_info.hh @@ -9,40 +9,45 @@ * \{ */ GPU_SHADER_INTERFACE_INFO(overlay_extra_iface) - .no_perspective(Type::VEC2, "edgePos") - .flat(Type::VEC2, "edgeStart") - .flat(Type::VEC4, "finalColor"); +NO_PERSPECTIVE(VEC2, edgePos) +FLAT(VEC2, edgeStart) +FLAT(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_extra) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::INT, "vclass") - /* Instance attributes. */ - .vertex_in(2, Type::VEC4, "color") - .vertex_in(3, Type::MAT4, "inst_obmat") - .vertex_out(overlay_extra_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "lineOutput") - .vertex_source("overlay_extra_vert.glsl") - .fragment_source("overlay_extra_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, INT, vclass) +/* Instance attributes. */ +VERTEX_IN(2, VEC4, color) +VERTEX_IN(3, MAT4, inst_obmat) +VERTEX_OUT(overlay_extra_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, lineOutput) +VERTEX_SOURCE("overlay_extra_vert.glsl") +FRAGMENT_SOURCE("overlay_extra_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_extra_select) - .do_static_compilation(true) - .define("SELECT_EDGES") - .additional_info("overlay_extra"); +DO_STATIC_COMPILATION() +DEFINE("SELECT_EDGES") +ADDITIONAL_INFO(overlay_extra) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_extra_clipped) - .do_static_compilation(true) - .additional_info("overlay_extra") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_extra) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_extra_select_clipped) - .do_static_compilation(true) - .additional_info("overlay_extra_select") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_extra_select) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -50,24 +55,28 @@ GPU_SHADER_CREATE_INFO(overlay_extra_select_clipped) /** \name Irradiance Grid * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_extra_grid_iface).flat(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_extra_grid_iface) +FLAT(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_extra_grid) - .do_static_compilation(true) - .sampler(0, ImageType::DEPTH_2D, "depthBuffer") - .push_constant(Type::MAT4, "gridModelMatrix") - .push_constant(Type::BOOL, "isTransform") - .vertex_out(overlay_extra_grid_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_extra_lightprobe_grid_vert.glsl") - .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +SAMPLER(0, DEPTH_2D, depthBuffer) +PUSH_CONSTANT(MAT4, gridModelMatrix) +PUSH_CONSTANT(BOOL, isTransform) +VERTEX_OUT(overlay_extra_grid_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_extra_lightprobe_grid_vert.glsl") +FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_extra_grid_clipped) - .do_static_compilation(true) - .additional_info("overlay_extra_grid") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_extra_grid) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -76,22 +85,24 @@ GPU_SHADER_CREATE_INFO(overlay_extra_grid_clipped) * \{ */ GPU_SHADER_CREATE_INFO(overlay_extra_groundline) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - /* Instance attributes. */ - .vertex_in(1, Type::VEC3, "inst_pos") - .vertex_out(overlay_extra_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "lineOutput") - .vertex_source("overlay_extra_groundline_vert.glsl") - .fragment_source("overlay_extra_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +/* Instance attributes. */ +VERTEX_IN(1, VEC3, inst_pos) +VERTEX_OUT(overlay_extra_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, lineOutput) +VERTEX_SOURCE("overlay_extra_groundline_vert.glsl") +FRAGMENT_SOURCE("overlay_extra_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_extra_groundline_clipped) - .do_static_compilation(true) - .additional_info("overlay_extra_groundline") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_extra_groundline) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -100,48 +111,55 @@ GPU_SHADER_CREATE_INFO(overlay_extra_groundline_clipped) * \{ */ GPU_SHADER_INTERFACE_INFO(overlay_extra_wire_iface) - .no_perspective(Type::VEC2, "stipple_coord") - .flat(Type::VEC2, "stipple_start") - .flat(Type::VEC4, "finalColor"); +NO_PERSPECTIVE(VEC2, stipple_coord) +FLAT(VEC2, stipple_start) +FLAT(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_extra_wire) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC4, "color") - /* If colorid is equal to 0 (i.e: Not specified) use color attribute and stippling. */ - .vertex_in(2, Type::INT, "colorid") - .vertex_out(overlay_extra_wire_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "lineOutput") - .vertex_source("overlay_extra_wire_vert.glsl") - .fragment_source("overlay_extra_wire_frag.glsl") - .additional_info("draw_modelmat") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC4, color) +/* If colorid is equal to 0 (i.e: Not specified) use color attribute and stippling. */ +VERTEX_IN(2, INT, colorid) +VERTEX_OUT(overlay_extra_wire_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, lineOutput) +VERTEX_SOURCE("overlay_extra_wire_vert.glsl") +FRAGMENT_SOURCE("overlay_extra_wire_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_extra_wire_select) - .do_static_compilation(true) - .define("SELECT_EDGES") - .additional_info("overlay_extra_wire"); +DO_STATIC_COMPILATION() +DEFINE("SELECT_EDGES") +ADDITIONAL_INFO(overlay_extra_wire) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_extra_wire_object) - .do_static_compilation(true) - .define("OBJECT_WIRE") - .additional_info("overlay_extra_wire"); +DO_STATIC_COMPILATION() +DEFINE("OBJECT_WIRE") +ADDITIONAL_INFO(overlay_extra_wire) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_extra_wire_select_clipped) - .do_static_compilation(true) - .additional_info("overlay_extra_wire_select") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_extra_wire_select) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_extra_wire_object_clipped) - .do_static_compilation(true) - .additional_info("overlay_extra_wire_object") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_extra_wire_object) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_extra_wire_clipped) - .do_static_compilation(true) - .additional_info("overlay_extra_wire") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_extra_wire) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -150,46 +168,53 @@ GPU_SHADER_CREATE_INFO(overlay_extra_wire_clipped) * \{ */ GPU_SHADER_INTERFACE_INFO(overlay_extra_point_iface) - .flat(Type::VEC4, "radii") - .flat(Type::VEC4, "fillColor") - .flat(Type::VEC4, "outlineColor"); +FLAT(VEC4, radii) +FLAT(VEC4, fillColor) +FLAT(VEC4, outlineColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_extra_point) - .do_static_compilation(true) - /* TODO(fclem): Move the vertex shader to Overlay engine and remove this bypass. */ - .define("blender_srgb_to_framebuffer_space(a)", "a") - .vertex_in(0, Type::VEC3, "pos") - .push_constant(Type::VEC4, "ucolor") - .vertex_out(overlay_extra_point_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_extra_point_vert.glsl") - .fragment_source("overlay_point_varying_color_varying_outline_aa_frag.glsl") - .additional_info("draw_modelmat") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +/* TODO(fclem): Move the vertex shader to Overlay engine and remove this bypass. */ +DEFINE_VALUE("blender_srgb_to_framebuffer_space(a)", "a") +VERTEX_IN(0, VEC3, pos) +PUSH_CONSTANT(VEC4, ucolor) +VERTEX_OUT(overlay_extra_point_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_extra_point_vert.glsl") +FRAGMENT_SOURCE("overlay_point_varying_color_varying_outline_aa_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_extra_point_clipped) - .do_static_compilation(true) - .additional_info("overlay_extra_point") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_extra_point) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() -GPU_SHADER_INTERFACE_INFO(overlay_extra_loose_point_iface).smooth(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_extra_loose_point_iface) +SMOOTH(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_extra_loose_point) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC4, "vertex_color") - .vertex_out(overlay_extra_loose_point_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "lineOutput") - .vertex_source("overlay_extra_loose_point_vert.glsl") - .fragment_source("overlay_extra_loose_point_frag.glsl") - .additional_info("draw_modelmat") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC4, vertex_color) +VERTEX_OUT(overlay_extra_loose_point_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, lineOutput) +VERTEX_SOURCE("overlay_extra_loose_point_vert.glsl") +FRAGMENT_SOURCE("overlay_extra_loose_point_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_extra_loose_point_clipped) - .do_static_compilation(true) - .additional_info("overlay_extra_loose_point") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_extra_loose_point) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -198,98 +223,109 @@ GPU_SHADER_CREATE_INFO(overlay_extra_loose_point_clipped) * \{ */ GPU_SHADER_NAMED_INTERFACE_INFO(overlay_motion_path_line_iface, interp) - .smooth(Type::VEC4, "color"); +SMOOTH(VEC4, color) +GPU_SHADER_NAMED_INTERFACE_END(interp) GPU_SHADER_NAMED_INTERFACE_INFO(overlay_motion_path_line_flat_iface, interp_flat) - .flat(Type::VEC2, "ss_pos"); +FLAT(VEC2, ss_pos) +GPU_SHADER_NAMED_INTERFACE_END(interp_flat) GPU_SHADER_CREATE_INFO(overlay_motion_path_line) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .push_constant(Type::IVEC4, "mpathLineSettings") - .push_constant(Type::BOOL, "selected") - .push_constant(Type::VEC3, "customColorPre") - .push_constant(Type::VEC3, "customColorPost") - .push_constant(Type::INT, "lineThickness") /* In pixels. */ - .push_constant(Type::MAT4, "camera_space_matrix") - .vertex_out(overlay_motion_path_line_iface) - .vertex_out(overlay_motion_path_line_flat_iface) - .geometry_out(overlay_motion_path_line_iface) - .geometry_layout(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_motion_path_line_vert.glsl") - .geometry_source("overlay_motion_path_line_geom.glsl") - .fragment_source("overlay_motion_path_line_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +PUSH_CONSTANT(IVEC4, mpathLineSettings) +PUSH_CONSTANT(BOOL, selected) +PUSH_CONSTANT(VEC3, customColorPre) +PUSH_CONSTANT(VEC3, customColorPost) +PUSH_CONSTANT(INT, lineThickness) /* In pixels. */ +PUSH_CONSTANT(MAT4, camera_space_matrix) +VERTEX_OUT(overlay_motion_path_line_iface) +VERTEX_OUT(overlay_motion_path_line_flat_iface) +GEOMETRY_OUT(overlay_motion_path_line_iface) +GEOMETRY_LAYOUT(PrimitiveIn::LINES, PrimitiveOut::TRIANGLE_STRIP, 4) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_motion_path_line_vert.glsl") +GEOMETRY_SOURCE("overlay_motion_path_line_geom.glsl") +FRAGMENT_SOURCE("overlay_motion_path_line_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_motion_path_line_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .push_constant(Type::IVEC4, "mpathLineSettings") - .push_constant(Type::BOOL, "selected") - .push_constant(Type::VEC3, "customColorPre") - .push_constant(Type::VEC3, "customColorPost") - .push_constant(Type::INT, "lineThickness") /* In pixels. */ - .vertex_out(overlay_motion_path_line_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_motion_path_line_vert_no_geom.glsl") - .fragment_source("overlay_motion_path_line_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_globals"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +PUSH_CONSTANT(IVEC4, mpathLineSettings) +PUSH_CONSTANT(BOOL, selected) +PUSH_CONSTANT(VEC3, customColorPre) +PUSH_CONSTANT(VEC3, customColorPost) +PUSH_CONSTANT(INT, lineThickness) /* In pixels. */ +VERTEX_OUT(overlay_motion_path_line_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_motion_path_line_vert_no_geom.glsl") +FRAGMENT_SOURCE("overlay_motion_path_line_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_motion_path_line_next) - .do_static_compilation(true) - .storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY) - .push_constant(Type::IVEC2, "gpu_attr_0") - .push_constant(Type::IVEC4, "mpathLineSettings") - .push_constant(Type::BOOL, "selected") - .push_constant(Type::VEC3, "customColorPre") - .push_constant(Type::VEC3, "customColorPost") - .push_constant(Type::INT, "lineThickness") /* In pixels. */ - .push_constant(Type::MAT4, "camera_space_matrix") - .vertex_out(overlay_motion_path_line_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_motion_path_line_next_vert.glsl") - .fragment_source("overlay_motion_path_line_frag.glsl") - .additional_info("draw_view") - .additional_info("gpu_index_load") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY) +PUSH_CONSTANT(IVEC2, gpu_attr_0) +PUSH_CONSTANT(IVEC4, mpathLineSettings) +PUSH_CONSTANT(BOOL, selected) +PUSH_CONSTANT(VEC3, customColorPre) +PUSH_CONSTANT(VEC3, customColorPost) +PUSH_CONSTANT(INT, lineThickness) /* In pixels. */ +PUSH_CONSTANT(MAT4, camera_space_matrix) +VERTEX_OUT(overlay_motion_path_line_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_motion_path_line_next_vert.glsl") +FRAGMENT_SOURCE("overlay_motion_path_line_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(gpu_index_load) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_motion_path_line_clipped) - .do_static_compilation(true) - .additional_info("overlay_motion_path_line") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_motion_path_line) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_motion_path_line_clipped_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .additional_info("overlay_motion_path_line_no_geom") - .additional_info("drw_clipped"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_motion_path_line_no_geom) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() -GPU_SHADER_INTERFACE_INFO(overlay_motion_path_point_iface).flat(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_motion_path_point_iface) +FLAT(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_motion_path_point) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::INT, "flag") - .push_constant(Type::IVEC4, "mpathPointSettings") - .push_constant(Type::BOOL, "showKeyFrames") - .push_constant(Type::VEC3, "customColorPre") - .push_constant(Type::VEC3, "customColorPost") - .push_constant(Type::MAT4, "camera_space_matrix") - .vertex_out(overlay_motion_path_point_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_motion_path_point_vert.glsl") - .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, INT, flag) +PUSH_CONSTANT(IVEC4, mpathPointSettings) +PUSH_CONSTANT(BOOL, showKeyFrames) +PUSH_CONSTANT(VEC3, customColorPre) +PUSH_CONSTANT(VEC3, customColorPost) +PUSH_CONSTANT(MAT4, camera_space_matrix) +VERTEX_OUT(overlay_motion_path_point_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_motion_path_point_vert.glsl") +FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_motion_path_point_clipped) - .do_static_compilation(true) - .additional_info("overlay_motion_path_point") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_motion_path_point) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -297,27 +333,31 @@ GPU_SHADER_CREATE_INFO(overlay_motion_path_point_clipped) /** \name Image Empty * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_image_iface).smooth(Type::VEC2, "uvs"); +GPU_SHADER_INTERFACE_INFO(overlay_image_iface) +SMOOTH(VEC2, uvs) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_image) - .do_static_compilation(true) - .push_constant(Type::BOOL, "depthSet") - .push_constant(Type::BOOL, "isCameraBackground") - .push_constant(Type::BOOL, "imgPremultiplied") - .push_constant(Type::BOOL, "imgAlphaBlend") - .push_constant(Type::VEC4, "ucolor") - .vertex_in(0, Type::VEC3, "pos") - .vertex_out(overlay_image_iface) - .sampler(0, ImageType::FLOAT_2D, "imgTexture") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_image_vert.glsl") - .fragment_source("overlay_image_frag.glsl") - .additional_info("draw_mesh"); +DO_STATIC_COMPILATION() +PUSH_CONSTANT(BOOL, depthSet) +PUSH_CONSTANT(BOOL, isCameraBackground) +PUSH_CONSTANT(BOOL, imgPremultiplied) +PUSH_CONSTANT(BOOL, imgAlphaBlend) +PUSH_CONSTANT(VEC4, ucolor) +VERTEX_IN(0, VEC3, pos) +VERTEX_OUT(overlay_image_iface) +SAMPLER(0, FLOAT_2D, imgTexture) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_image_vert.glsl") +FRAGMENT_SOURCE("overlay_image_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_image_clipped) - .do_static_compilation(true) - .additional_info("overlay_image") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_image) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -326,24 +366,26 @@ GPU_SHADER_CREATE_INFO(overlay_image_clipped) * \{ */ GPU_SHADER_CREATE_INFO(overlay_gpencil_canvas) - .do_static_compilation(true) - .vertex_out(overlay_extra_iface) - .push_constant(Type::VEC4, "color") - .push_constant(Type::VEC3, "xAxis") - .push_constant(Type::VEC3, "yAxis") - .push_constant(Type::VEC3, "origin") - .push_constant(Type::INT, "halfLineCount") - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "lineOutput") - .vertex_source("overlay_edit_gpencil_canvas_vert.glsl") - .fragment_source("overlay_extra_frag.glsl") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_OUT(overlay_extra_iface) +PUSH_CONSTANT(VEC4, color) +PUSH_CONSTANT(VEC3, xAxis) +PUSH_CONSTANT(VEC3, yAxis) +PUSH_CONSTANT(VEC3, origin) +PUSH_CONSTANT(INT, halfLineCount) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, lineOutput) +VERTEX_SOURCE("overlay_edit_gpencil_canvas_vert.glsl") +FRAGMENT_SOURCE("overlay_extra_frag.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_gpencil_canvas_clipped) - .do_static_compilation(true) - .additional_info("overlay_gpencil_canvas") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_gpencil_canvas) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -351,85 +393,94 @@ GPU_SHADER_CREATE_INFO(overlay_gpencil_canvas_clipped) /** \name Particle * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_particle_iface).flat(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_particle_iface) +FLAT(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_particle) - .sampler(0, ImageType::FLOAT_1D, "weightTex") - .push_constant(Type::VEC4, "ucolor") /* Draw-size packed in alpha. */ - .vertex_in(0, Type::VEC3, "part_pos") - .vertex_in(1, Type::VEC4, "part_rot") - .vertex_in(2, Type::FLOAT, "part_val") - .vertex_out(overlay_particle_iface) - .vertex_source("overlay_particle_vert.glsl") - .additional_info("draw_globals"); +SAMPLER(0, FLOAT_1D, weightTex) +PUSH_CONSTANT(VEC4, ucolor) /* Draw-size packed in alpha. */ +VERTEX_IN(0, VEC3, part_pos) +VERTEX_IN(1, VEC4, part_rot) +VERTEX_IN(2, FLOAT, part_val) +VERTEX_OUT(overlay_particle_iface) +VERTEX_SOURCE("overlay_particle_vert.glsl") +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_particle_dot) - .do_static_compilation(true) - .define("USE_DOTS") - .define("vclass", "0") - .define("pos", "vec3(0.0)") - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "lineOutput") - .fragment_source("overlay_particle_frag.glsl") - .additional_info("overlay_particle") - .additional_info("draw_mesh"); +DO_STATIC_COMPILATION() +DEFINE("USE_DOTS") +DEFINE_VALUE("vclass", "0") +DEFINE_VALUE("pos", "vec3(0.0)") +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, lineOutput) +FRAGMENT_SOURCE("overlay_particle_frag.glsl") +ADDITIONAL_INFO(overlay_particle) +ADDITIONAL_INFO(draw_mesh) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_particle_dot_clipped) - .do_static_compilation(true) - .additional_info("overlay_particle_dot") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_particle_dot) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_particle_shape) - .do_static_compilation(true) - /* Instantiated Attrs. */ - .vertex_in(3, Type::VEC3, "pos") - .vertex_in(4, Type::INT, "vclass") - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_source("overlay_varying_color.glsl") - .additional_info("overlay_particle") - .additional_info("draw_modelmat") - .additional_info("draw_resource_id_uniform"); +DO_STATIC_COMPILATION() +/* Instantiated Attrs. */ +VERTEX_IN(3, VEC3, pos) +VERTEX_IN(4, INT, vclass) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(overlay_particle) +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(draw_resource_id_uniform) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_particle_shape_next) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - .sampler(0, ImageType::FLOAT_1D, "weightTex") - .push_constant(Type::VEC4, "ucolor") /* Draw-size packed in alpha. */ - .push_constant(Type::INT, "shape_type") - /* Use first attribute to only bind one buffer. */ - .storage_buf(0, Qualifier::READ, "ParticlePointData", "part_pos[]", Frequency::GEOMETRY) - .vertex_out(overlay_extra_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "lineOutput") - .vertex_source("overlay_particle_shape_vert.glsl") - .fragment_source("overlay_particle_shape_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +SAMPLER(0, FLOAT_1D, weightTex) +PUSH_CONSTANT(VEC4, ucolor) /* Draw-size packed in alpha. */ +PUSH_CONSTANT(INT, shape_type) +/* Use first attribute to only bind one buffer. */ +STORAGE_BUF_FREQ(0, READ, ParticlePointData, part_pos[], GEOMETRY) +VERTEX_OUT(overlay_extra_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, lineOutput) +VERTEX_SOURCE("overlay_particle_shape_vert.glsl") +FRAGMENT_SOURCE("overlay_particle_shape_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_particle_hair_next) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC3, "nor") - .push_constant(Type::INT, "colorType") - .push_constant(Type::BOOL, "isTransform") - .push_constant(Type::BOOL, "useColoring") - .vertex_out(overlay_extra_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "lineOutput") - .vertex_source("overlay_particle_hair_vert.glsl") - .fragment_source("overlay_particle_shape_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_object_infos_new") - .additional_info("draw_resource_handle_new") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC3, nor) +PUSH_CONSTANT(INT, colorType) +PUSH_CONSTANT(BOOL, isTransform) +PUSH_CONSTANT(BOOL, useColoring) +VERTEX_OUT(overlay_extra_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, lineOutput) +VERTEX_SOURCE("overlay_particle_hair_vert.glsl") +FRAGMENT_SOURCE("overlay_particle_shape_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_object_infos_new) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_particle_shape_clipped) - .do_static_compilation(true) - .additional_info("overlay_particle_shape") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_particle_shape) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_facing_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_facing_info.hh index a37d8d764ea..1b9188727df 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_facing_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_facing_info.hh @@ -5,15 +5,17 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(overlay_facing) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_source("overlay_facing_vert.glsl") - .fragment_source("overlay_facing_frag.glsl") - .fragment_out(0, Type::VEC4, "fragColor") - .additional_info("draw_mesh") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_SOURCE("overlay_facing_vert.glsl") +FRAGMENT_SOURCE("overlay_facing_frag.glsl") +FRAGMENT_OUT(0, VEC4, fragColor) +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_facing_clipped) - .do_static_compilation(true) - .additional_info("overlay_facing") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_facing) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_grid_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_grid_info.hh index 2424f7298f2..47b34ee010a 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_grid_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_grid_info.hh @@ -5,38 +5,43 @@ #include "gpu_shader_create_info.hh" /* We use the normalized local position to avoid precision loss during interpolation. */ -GPU_SHADER_INTERFACE_INFO(overlay_grid_iface).smooth(Type::VEC3, "local_pos"); +GPU_SHADER_INTERFACE_INFO(overlay_grid_iface) +SMOOTH(VEC3, local_pos) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_grid) - .do_static_compilation(true) - .typedef_source("overlay_shader_shared.h") - .vertex_in(0, Type::VEC3, "pos") - .vertex_out(overlay_grid_iface) - .fragment_out(0, Type::VEC4, "out_color") - .sampler(0, ImageType::DEPTH_2D, "depth_tx") - .uniform_buf(3, "OVERLAY_GridData", "grid_buf") - .push_constant(Type::VEC3, "plane_axes") - .push_constant(Type::INT, "grid_flag") - .vertex_source("overlay_grid_vert.glsl") - .fragment_source("overlay_grid_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("overlay_shader_shared.h") +VERTEX_IN(0, VEC3, pos) +VERTEX_OUT(overlay_grid_iface) +FRAGMENT_OUT(0, VEC4, out_color) +SAMPLER(0, DEPTH_2D, depth_tx) +UNIFORM_BUF(3, OVERLAY_GridData, grid_buf) +PUSH_CONSTANT(VEC3, plane_axes) +PUSH_CONSTANT(INT, grid_flag) +VERTEX_SOURCE("overlay_grid_vert.glsl") +FRAGMENT_SOURCE("overlay_grid_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_grid_background) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .sampler(0, ImageType::DEPTH_2D, "depthBuffer") - .push_constant(Type::VEC4, "ucolor") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_uv_tiled_image_borders_vert.glsl") - .fragment_source("overlay_grid_background_frag.glsl") - .additional_info("draw_modelmat"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +SAMPLER(0, DEPTH_2D, depthBuffer) +PUSH_CONSTANT(VEC4, ucolor) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_uv_tiled_image_borders_vert.glsl") +FRAGMENT_SOURCE("overlay_grid_background_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_grid_image) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .push_constant(Type::VEC4, "ucolor") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_edit_uv_tiled_image_borders_vert.glsl") - .fragment_source("overlay_uniform_color_frag.glsl") - .additional_info("draw_modelmat"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +PUSH_CONSTANT(VEC4, ucolor) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_edit_uv_tiled_image_borders_vert.glsl") +FRAGMENT_SOURCE("overlay_uniform_color_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_outline_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_outline_info.hh index 3ef4afbed4b..ee7312dfced 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_outline_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_outline_info.hh @@ -8,128 +8,147 @@ /** \name Outline Pre-pass * \{ */ -GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_iface, interp).flat(Type::UINT, "ob_id"); +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_iface, interp) +FLAT(UINT, ob_id) +GPU_SHADER_NAMED_INTERFACE_END(interp) GPU_SHADER_CREATE_INFO(overlay_outline_prepass) - .push_constant(Type::BOOL, "isTransform") - .vertex_out(overlay_outline_prepass_iface) - /* Using uint because 16bit uint can contain more ids than int. */ - .fragment_out(0, Type::UINT, "out_object_id") - .fragment_source("overlay_outline_prepass_frag.glsl") - .additional_info("draw_globals"); +PUSH_CONSTANT(BOOL, isTransform) +VERTEX_OUT(overlay_outline_prepass_iface) +/* Using uint because 16bit uint can contain more ids than int. */ +FRAGMENT_OUT(0, UINT, out_object_id) +FRAGMENT_SOURCE("overlay_outline_prepass_frag.glsl") +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_outline_prepass_mesh) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_source("overlay_outline_prepass_vert.glsl") - .additional_info("draw_mesh") - .additional_info("draw_resource_handle") - .additional_info("overlay_outline_prepass") - .additional_info("draw_object_infos"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_SOURCE("overlay_outline_prepass_vert.glsl") +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_resource_handle) +ADDITIONAL_INFO(overlay_outline_prepass) +ADDITIONAL_INFO(draw_object_infos) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_outline_prepass_mesh_clipped) - .do_static_compilation(true) - .additional_info("overlay_outline_prepass_mesh") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_outline_prepass_mesh) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() -GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_wire_iface, vert).flat(Type::VEC3, "pos"); +GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_wire_iface, vert) +FLAT(VEC3, pos) +GPU_SHADER_NAMED_INTERFACE_END(vert) GPU_SHADER_CREATE_INFO(overlay_outline_prepass_curves) - .do_static_compilation(true) - .vertex_source("overlay_outline_prepass_curves_vert.glsl") - .additional_info("draw_hair") - .additional_info("draw_resource_handle") - .additional_info("overlay_outline_prepass") - .additional_info("draw_object_infos"); +DO_STATIC_COMPILATION() +VERTEX_SOURCE("overlay_outline_prepass_curves_vert.glsl") +ADDITIONAL_INFO(draw_hair) +ADDITIONAL_INFO(draw_resource_handle) +ADDITIONAL_INFO(overlay_outline_prepass) +ADDITIONAL_INFO(draw_object_infos) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_outline_prepass_curves_clipped) - .do_static_compilation(true) - .additional_info("overlay_outline_prepass_curves") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_outline_prepass_curves) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_outline_prepass_wire) - .do_static_compilation(true) - .additional_info("overlay_outline_prepass") - .additional_info("draw_object_infos") - .additional_info("draw_mesh") - .additional_info("draw_resource_handle") - .vertex_in(0, Type::VEC3, "pos") - .define("USE_GEOM") - .vertex_out(overlay_outline_prepass_wire_iface) - .geometry_layout(PrimitiveIn::LINES_ADJACENCY, PrimitiveOut::LINE_STRIP, 2) - .geometry_out(overlay_outline_prepass_iface) - .vertex_source("overlay_outline_prepass_vert.glsl") - .geometry_source("overlay_outline_prepass_geom.glsl"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_outline_prepass) +ADDITIONAL_INFO(draw_object_infos) +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_resource_handle) +VERTEX_IN(0, VEC3, pos) +DEFINE("USE_GEOM") +VERTEX_OUT(overlay_outline_prepass_wire_iface) +GEOMETRY_LAYOUT(PrimitiveIn::LINES_ADJACENCY, PrimitiveOut::LINE_STRIP, 2) +GEOMETRY_OUT(overlay_outline_prepass_iface) +VERTEX_SOURCE("overlay_outline_prepass_vert.glsl") +GEOMETRY_SOURCE("overlay_outline_prepass_geom.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_outline_prepass_wire_next) - .do_static_compilation(true) - .additional_info("overlay_outline_prepass") - .additional_info("draw_view") - .additional_info("draw_mesh_new") - .additional_info("draw_object_infos_new") - .additional_info("draw_resource_handle_new") - .additional_info("gpu_index_load") - .storage_buf(0, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY) - .push_constant(Type::IVEC2, "gpu_attr_0") - .vertex_source("overlay_outline_prepass_wire_vert.glsl"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_outline_prepass) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_mesh_new) +ADDITIONAL_INFO(draw_object_infos_new) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(gpu_index_load) +STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY) +PUSH_CONSTANT(IVEC2, gpu_attr_0) +VERTEX_SOURCE("overlay_outline_prepass_wire_vert.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_outline_prepass_wire_no_geom) - .metal_backend_only(true) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .additional_info("overlay_outline_prepass") - .additional_info("draw_object_infos") - .additional_info("draw_mesh") - .additional_info("draw_resource_handle") - .vertex_source("overlay_outline_prepass_vert_no_geom.glsl"); +METAL_BACKEND_ONLY() +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +ADDITIONAL_INFO(overlay_outline_prepass) +ADDITIONAL_INFO(draw_object_infos) +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_resource_handle) +VERTEX_SOURCE("overlay_outline_prepass_vert_no_geom.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_outline_prepass_wire_clipped) - .do_static_compilation(true) - .additional_info("overlay_outline_prepass_wire") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_outline_prepass_wire) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_gpencil_flat_iface, gp_interp_flat) - .flat(Type::VEC2, "aspect") - .flat(Type::VEC4, "sspos"); +FLAT(VEC2, aspect) +FLAT(VEC4, sspos) +GPU_SHADER_NAMED_INTERFACE_END(gp_interp_flat) GPU_SHADER_NAMED_INTERFACE_INFO(overlay_outline_prepass_gpencil_noperspective_iface, gp_interp_noperspective) - .no_perspective(Type::VEC2, "thickness") - .no_perspective(Type::FLOAT, "hardness"); +NO_PERSPECTIVE(VEC2, thickness) +NO_PERSPECTIVE(FLOAT, hardness) +GPU_SHADER_NAMED_INTERFACE_END(gp_interp_noperspective) GPU_SHADER_CREATE_INFO(overlay_outline_prepass_gpencil) - .do_static_compilation(true) - .push_constant(Type::BOOL, "isTransform") - .vertex_out(overlay_outline_prepass_iface) - .vertex_out(overlay_outline_prepass_gpencil_flat_iface) - .vertex_out(overlay_outline_prepass_gpencil_noperspective_iface) - .vertex_source("overlay_outline_prepass_gpencil_vert.glsl") - .push_constant(Type::BOOL, "gpStrokeOrder3d") /* TODO(fclem): Move to a GPencil object UBO. */ - .push_constant(Type::VEC4, "gpDepthPlane") /* TODO(fclem): Move to a GPencil object UBO. */ - /* Using uint because 16bit uint can contain more ids than int. */ - .fragment_out(0, Type::UINT, "out_object_id") - .fragment_source("overlay_outline_prepass_gpencil_frag.glsl") - .depth_write(DepthWrite::ANY) - .additional_info("draw_gpencil") - .additional_info("draw_resource_handle") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +PUSH_CONSTANT(BOOL, isTransform) +VERTEX_OUT(overlay_outline_prepass_iface) +VERTEX_OUT(overlay_outline_prepass_gpencil_flat_iface) +VERTEX_OUT(overlay_outline_prepass_gpencil_noperspective_iface) +VERTEX_SOURCE("overlay_outline_prepass_gpencil_vert.glsl") +PUSH_CONSTANT(BOOL, gpStrokeOrder3d) /* TODO(fclem): Move to a GPencil object UBO. */ +PUSH_CONSTANT(VEC4, gpDepthPlane) /* TODO(fclem): Move to a GPencil object UBO. */ +/* Using uint because 16bit uint can contain more ids than int. */ +FRAGMENT_OUT(0, UINT, out_object_id) +FRAGMENT_SOURCE("overlay_outline_prepass_gpencil_frag.glsl") +DEPTH_WRITE(DepthWrite::ANY) +ADDITIONAL_INFO(draw_gpencil) +ADDITIONAL_INFO(draw_resource_handle) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_outline_prepass_gpencil_clipped) - .do_static_compilation(true) - .additional_info("overlay_outline_prepass_gpencil") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_outline_prepass_gpencil) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_outline_prepass_pointcloud) - .do_static_compilation(true) - .vertex_source("overlay_outline_prepass_pointcloud_vert.glsl") - .additional_info("draw_pointcloud") - .additional_info("draw_resource_handle") - .additional_info("overlay_outline_prepass") - .additional_info("draw_object_infos"); +DO_STATIC_COMPILATION() +VERTEX_SOURCE("overlay_outline_prepass_pointcloud_vert.glsl") +ADDITIONAL_INFO(draw_pointcloud) +ADDITIONAL_INFO(draw_resource_handle) +ADDITIONAL_INFO(overlay_outline_prepass) +ADDITIONAL_INFO(draw_object_infos) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_outline_prepass_pointcloud_clipped) - .do_static_compilation(true) - .additional_info("overlay_outline_prepass_pointcloud") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_outline_prepass_pointcloud) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() /** \} */ @@ -138,19 +157,20 @@ GPU_SHADER_CREATE_INFO(overlay_outline_prepass_pointcloud_clipped) * \{ */ GPU_SHADER_CREATE_INFO(overlay_outline_detect) - .do_static_compilation(true) - .push_constant(Type::FLOAT, "alphaOcclu") - .push_constant(Type::BOOL, "isXrayWires") - .push_constant(Type::BOOL, "doAntiAliasing") - .push_constant(Type::BOOL, "doThickOutlines") - .sampler(0, ImageType::UINT_2D, "outlineId") - .sampler(1, ImageType::DEPTH_2D, "outlineDepth") - .sampler(2, ImageType::DEPTH_2D, "sceneDepth") - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "lineOutput") - .fragment_source("overlay_outline_detect_frag.glsl") - .additional_info("draw_fullscreen") - .additional_info("draw_view") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +PUSH_CONSTANT(FLOAT, alphaOcclu) +PUSH_CONSTANT(BOOL, isXrayWires) +PUSH_CONSTANT(BOOL, doAntiAliasing) +PUSH_CONSTANT(BOOL, doThickOutlines) +SAMPLER(0, UINT_2D, outlineId) +SAMPLER(1, DEPTH_2D, outlineDepth) +SAMPLER(2, DEPTH_2D, sceneDepth) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, lineOutput) +FRAGMENT_SOURCE("overlay_outline_detect_frag.glsl") +ADDITIONAL_INFO(draw_fullscreen) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_paint_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_paint_info.hh index aa82105c6ef..22c1ad5cd5b 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_paint_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_paint_info.hh @@ -11,19 +11,21 @@ * \{ */ GPU_SHADER_CREATE_INFO(overlay_paint_face) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC4, "nor") /* Select flag on the 4th component. */ - .push_constant(Type::VEC4, "ucolor") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_paint_face_vert.glsl") - .fragment_source("overlay_uniform_color_frag.glsl") - .additional_info("draw_modelmat"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC4, nor) /* Select flag on the 4th component. */ +PUSH_CONSTANT(VEC4, ucolor) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_paint_face_vert.glsl") +FRAGMENT_SOURCE("overlay_uniform_color_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_paint_face_clipped) - .additional_info("overlay_paint_face") - .additional_info("drw_clipped") - .do_static_compilation(true); +ADDITIONAL_INFO(overlay_paint_face) +ADDITIONAL_INFO(drw_clipped) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /** \} */ @@ -33,23 +35,27 @@ GPU_SHADER_CREATE_INFO(overlay_paint_face_clipped) * Used for vertex selection mode in Weight and Vertex Paint. * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_overlay_paint_point_iface).smooth(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_overlay_paint_point_iface) +SMOOTH(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_paint_point) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC4, "nor") /* Select flag on the 4th component. */ - .vertex_out(overlay_overlay_paint_point_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_paint_point_vert.glsl") - .fragment_source("overlay_point_varying_color_frag.glsl") - .additional_info("draw_modelmat") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC4, nor) /* Select flag on the 4th component. */ +VERTEX_OUT(overlay_overlay_paint_point_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_paint_point_vert.glsl") +FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_paint_point_clipped) - .additional_info("overlay_paint_point") - .additional_info("drw_clipped") - .do_static_compilation(true); +ADDITIONAL_INFO(overlay_paint_point) +ADDITIONAL_INFO(drw_clipped) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /** \} */ @@ -59,27 +65,31 @@ GPU_SHADER_CREATE_INFO(overlay_paint_point_clipped) * Used in Texture Paint mode for the Stencil Image Masking. * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_paint_texture_iface).smooth(Type::VEC2, "uv_interp"); +GPU_SHADER_INTERFACE_INFO(overlay_paint_texture_iface) +SMOOTH(VEC2, uv_interp) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_paint_texture) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC2, "mu") /* Masking uv map. */ - .vertex_out(overlay_paint_texture_iface) - .sampler(0, ImageType::FLOAT_2D, "maskImage") - .push_constant(Type::VEC3, "maskColor") - .push_constant(Type::FLOAT, "opacity") /* `1.0` by default. */ - .push_constant(Type::BOOL, "maskInvertStencil") - .push_constant(Type::BOOL, "maskImagePremultiplied") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_paint_texture_vert.glsl") - .fragment_source("overlay_paint_texture_frag.glsl") - .additional_info("draw_modelmat"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC2, mu) /* Masking uv map. */ +VERTEX_OUT(overlay_paint_texture_iface) +SAMPLER(0, FLOAT_2D, maskImage) +PUSH_CONSTANT(VEC3, maskColor) +PUSH_CONSTANT(FLOAT, opacity) /* `1.0` by default. */ +PUSH_CONSTANT(BOOL, maskInvertStencil) +PUSH_CONSTANT(BOOL, maskImagePremultiplied) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_paint_texture_vert.glsl") +FRAGMENT_SOURCE("overlay_paint_texture_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_paint_texture_clipped) - .additional_info("overlay_paint_texture") - .additional_info("drw_clipped") - .do_static_compilation(true); +ADDITIONAL_INFO(overlay_paint_texture) +ADDITIONAL_INFO(drw_clipped) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /** \} */ @@ -89,24 +99,28 @@ GPU_SHADER_CREATE_INFO(overlay_paint_texture_clipped) * It should be used to draw a Vertex Paint overlay. But it is currently unreachable. * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_paint_vertcol_iface).smooth(Type::VEC3, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_paint_vertcol_iface) +SMOOTH(VEC3, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_paint_vertcol) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC3, "ac") /* Active color. */ - .vertex_out(overlay_paint_vertcol_iface) - .push_constant(Type::FLOAT, "opacity") /* `1.0` by default. */ - .push_constant(Type::BOOL, "useAlphaBlend") /* `false` by default. */ - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_paint_vertcol_vert.glsl") - .fragment_source("overlay_paint_vertcol_frag.glsl") - .additional_info("draw_modelmat"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC3, ac) /* Active color. */ +VERTEX_OUT(overlay_paint_vertcol_iface) +PUSH_CONSTANT(FLOAT, opacity) /* `1.0` by default. */ +PUSH_CONSTANT(BOOL, useAlphaBlend) /* `false` by default. */ +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_paint_vertcol_vert.glsl") +FRAGMENT_SOURCE("overlay_paint_vertcol_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_paint_vertcol_clipped) - .additional_info("overlay_paint_vertcol") - .additional_info("drw_clipped") - .do_static_compilation(true); +ADDITIONAL_INFO(overlay_paint_vertcol) +ADDITIONAL_INFO(drw_clipped) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /** \} */ @@ -118,39 +132,44 @@ GPU_SHADER_CREATE_INFO(overlay_paint_vertcol_clipped) * \{ */ GPU_SHADER_INTERFACE_INFO(overlay_paint_weight_iface) - .smooth(Type::VEC2, "weight_interp") /* (weight, alert) */ - .smooth(Type::FLOAT, "color_fac"); +SMOOTH(VEC2, weight_interp) /* (weight, alert) */ +SMOOTH(FLOAT, color_fac) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_paint_weight) - .do_static_compilation(true) - .vertex_in(0, Type::FLOAT, "weight") - .vertex_in(1, Type::VEC3, "pos") - .vertex_in(2, Type::VEC3, "nor") - .vertex_out(overlay_paint_weight_iface) - .sampler(0, ImageType::FLOAT_1D, "colorramp") - .push_constant(Type::FLOAT, "opacity") /* `1.0` by default. */ - .push_constant(Type::BOOL, "drawContours") /* `false` by default. */ - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_paint_weight_vert.glsl") - .fragment_source("overlay_paint_weight_frag.glsl") - .additional_info("draw_modelmat") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, FLOAT, weight) +VERTEX_IN(1, VEC3, pos) +VERTEX_IN(2, VEC3, nor) +VERTEX_OUT(overlay_paint_weight_iface) +SAMPLER(0, FLOAT_1D, colorramp) +PUSH_CONSTANT(FLOAT, opacity) /* `1.0` by default. */ +PUSH_CONSTANT(BOOL, drawContours) /* `false` by default. */ +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_paint_weight_vert.glsl") +FRAGMENT_SOURCE("overlay_paint_weight_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_paint_weight_fake_shading) - .additional_info("overlay_paint_weight") - .define("FAKE_SHADING") - .push_constant(Type::VEC3, "light_dir") - .do_static_compilation(true); +ADDITIONAL_INFO(overlay_paint_weight) +DEFINE("FAKE_SHADING") +PUSH_CONSTANT(VEC3, light_dir) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_paint_weight_clipped) - .additional_info("overlay_paint_weight") - .additional_info("drw_clipped") - .do_static_compilation(true); +ADDITIONAL_INFO(overlay_paint_weight) +ADDITIONAL_INFO(drw_clipped) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_paint_weight_fake_shading_clipped) - .additional_info("overlay_paint_weight_fake_shading") - .additional_info("drw_clipped") - .do_static_compilation(true); +ADDITIONAL_INFO(overlay_paint_weight_fake_shading) +ADDITIONAL_INFO(drw_clipped) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /** \} */ @@ -161,23 +180,27 @@ GPU_SHADER_CREATE_INFO(overlay_paint_weight_fake_shading_clipped) * paint modes. * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_paint_wire_iface).flat(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_paint_wire_iface) +FLAT(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_paint_wire) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC4, "nor") /* flag stored in w */ - .vertex_out(overlay_paint_wire_iface) - .push_constant(Type::BOOL, "useSelect") - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_paint_wire_vert.glsl") - .fragment_source("overlay_varying_color.glsl") - .additional_info("draw_modelmat") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC4, nor) /* flag stored in w */ +VERTEX_OUT(overlay_paint_wire_iface) +PUSH_CONSTANT(BOOL, useSelect) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_paint_wire_vert.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_paint_wire_clipped) - .additional_info("overlay_paint_vertcol") - .additional_info("drw_clipped") - .do_static_compilation(true); +ADDITIONAL_INFO(overlay_paint_vertcol) +ADDITIONAL_INFO(drw_clipped) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_curves_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_curves_info.hh index 75d79357c93..4dba29d13af 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_curves_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_curves_info.hh @@ -5,45 +5,51 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_INTERFACE_INFO(overlay_sculpt_curves_selection_iface) - .smooth(Type::FLOAT, "mask_weight"); +SMOOTH(FLOAT, mask_weight) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_sculpt_curves_selection) - .do_static_compilation(true) - .push_constant(Type::BOOL, "is_point_domain") - .push_constant(Type::FLOAT, "selection_opacity") - .sampler(1, ImageType::FLOAT_BUFFER, "selection_tx") - .vertex_out(overlay_sculpt_curves_selection_iface) - .vertex_source("overlay_sculpt_curves_selection_vert.glsl") - .fragment_source("overlay_sculpt_curves_selection_frag.glsl") - .fragment_out(0, Type::VEC4, "out_color") - .additional_info("draw_hair") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +PUSH_CONSTANT(BOOL, is_point_domain) +PUSH_CONSTANT(FLOAT, selection_opacity) +SAMPLER(1, FLOAT_BUFFER, selection_tx) +VERTEX_OUT(overlay_sculpt_curves_selection_iface) +VERTEX_SOURCE("overlay_sculpt_curves_selection_vert.glsl") +FRAGMENT_SOURCE("overlay_sculpt_curves_selection_frag.glsl") +FRAGMENT_OUT(0, VEC4, out_color) +ADDITIONAL_INFO(draw_hair) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_sculpt_curves_selection_clipped) - .do_static_compilation(true) - .additional_info("overlay_sculpt_curves_selection") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_sculpt_curves_selection) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(overlay_sculpt_curves_cage_iface) - .no_perspective(Type::VEC2, "edgePos") - .flat(Type::VEC2, "edgeStart") - .smooth(Type::VEC4, "finalColor"); +NO_PERSPECTIVE(VEC2, edgePos) +FLAT(VEC2, edgeStart) +SMOOTH(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_sculpt_curves_cage) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::FLOAT, "selection") - .vertex_out(overlay_sculpt_curves_cage_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "lineOutput") - .push_constant(Type::FLOAT, "opacity") - .vertex_source("overlay_sculpt_curves_cage_vert.glsl") - .fragment_source("overlay_extra_frag.glsl") - .additional_info("draw_modelmat") - .additional_info("draw_view") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, FLOAT, selection) +VERTEX_OUT(overlay_sculpt_curves_cage_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, lineOutput) +PUSH_CONSTANT(FLOAT, opacity) +VERTEX_SOURCE("overlay_sculpt_curves_cage_vert.glsl") +FRAGMENT_SOURCE("overlay_extra_frag.glsl") +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_sculpt_curves_cage_clipped) - .do_static_compilation(true) - .additional_info("overlay_sculpt_curves_cage") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_sculpt_curves_cage) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_info.hh index 8a8b266779e..28f737c2cc6 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_sculpt_info.hh @@ -5,26 +5,29 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_INTERFACE_INFO(overlay_sculpt_mask_iface) - .flat(Type::VEC3, "faceset_color") - .smooth(Type::FLOAT, "mask_color") - .smooth(Type::VEC4, "finalColor"); +FLAT(VEC3, faceset_color) +SMOOTH(FLOAT, mask_color) +SMOOTH(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_sculpt_mask) - .do_static_compilation(true) - .push_constant(Type::FLOAT, "maskOpacity") - .push_constant(Type::FLOAT, "faceSetsOpacity") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC3, "fset") - .vertex_in(2, Type::FLOAT, "msk") - .vertex_out(overlay_sculpt_mask_iface) - .vertex_source("overlay_sculpt_mask_vert.glsl") - .fragment_source("overlay_sculpt_mask_frag.glsl") - .fragment_out(0, Type::VEC4, "fragColor") - .additional_info("draw_mesh") - .additional_info("draw_object_infos") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +PUSH_CONSTANT(FLOAT, maskOpacity) +PUSH_CONSTANT(FLOAT, faceSetsOpacity) +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC3, fset) +VERTEX_IN(2, FLOAT, msk) +VERTEX_OUT(overlay_sculpt_mask_iface) +VERTEX_SOURCE("overlay_sculpt_mask_vert.glsl") +FRAGMENT_SOURCE("overlay_sculpt_mask_frag.glsl") +FRAGMENT_OUT(0, VEC4, fragColor) +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_object_infos) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_sculpt_mask_clipped) - .do_static_compilation(true) - .additional_info("overlay_sculpt_mask") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_sculpt_mask) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_viewer_attribute_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_viewer_attribute_info.hh index a9d4771523f..dde4663d503 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_viewer_attribute_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_viewer_attribute_info.hh @@ -4,74 +4,86 @@ #include "gpu_shader_create_info.hh" -GPU_SHADER_INTERFACE_INFO(overlay_viewer_attribute_iface).smooth(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_viewer_attribute_iface) +SMOOTH(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() -GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_common).push_constant(Type::FLOAT, "opacity"); +GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_common) +PUSH_CONSTANT(FLOAT, opacity) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_mesh) - .do_static_compilation(true) - .vertex_source("overlay_viewer_attribute_mesh_vert.glsl") - .fragment_source("overlay_viewer_attribute_frag.glsl") - .fragment_out(0, Type::VEC4, "out_color") - .fragment_out(1, Type::VEC4, "lineOutput") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC4, "attribute_value") - .vertex_out(overlay_viewer_attribute_iface) - .additional_info("overlay_viewer_attribute_common") - .additional_info("draw_mesh"); +DO_STATIC_COMPILATION() +VERTEX_SOURCE("overlay_viewer_attribute_mesh_vert.glsl") +FRAGMENT_SOURCE("overlay_viewer_attribute_frag.glsl") +FRAGMENT_OUT(0, VEC4, out_color) +FRAGMENT_OUT(1, VEC4, lineOutput) +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC4, attribute_value) +VERTEX_OUT(overlay_viewer_attribute_iface) +ADDITIONAL_INFO(overlay_viewer_attribute_common) +ADDITIONAL_INFO(draw_mesh) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_mesh_clipped) - .do_static_compilation(true) - .additional_info("overlay_viewer_attribute_mesh") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_viewer_attribute_mesh) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_pointcloud) - .do_static_compilation(true) - .vertex_source("overlay_viewer_attribute_pointcloud_vert.glsl") - .fragment_source("overlay_viewer_attribute_frag.glsl") - .fragment_out(0, Type::VEC4, "out_color") - .fragment_out(1, Type::VEC4, "lineOutput") - .sampler(3, ImageType::FLOAT_BUFFER, "attribute_tx") - .vertex_out(overlay_viewer_attribute_iface) - .additional_info("overlay_viewer_attribute_common") - .additional_info("draw_pointcloud"); +DO_STATIC_COMPILATION() +VERTEX_SOURCE("overlay_viewer_attribute_pointcloud_vert.glsl") +FRAGMENT_SOURCE("overlay_viewer_attribute_frag.glsl") +FRAGMENT_OUT(0, VEC4, out_color) +FRAGMENT_OUT(1, VEC4, lineOutput) +SAMPLER(3, FLOAT_BUFFER, attribute_tx) +VERTEX_OUT(overlay_viewer_attribute_iface) +ADDITIONAL_INFO(overlay_viewer_attribute_common) +ADDITIONAL_INFO(draw_pointcloud) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_pointcloud_clipped) - .do_static_compilation(true) - .additional_info("overlay_viewer_attribute_pointcloud") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_viewer_attribute_pointcloud) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_curve) - .do_static_compilation(true) - .vertex_source("overlay_viewer_attribute_curve_vert.glsl") - .fragment_source("overlay_viewer_attribute_frag.glsl") - .fragment_out(0, Type::VEC4, "out_color") - .fragment_out(1, Type::VEC4, "lineOutput") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC4, "attribute_value") - .vertex_out(overlay_viewer_attribute_iface) - .additional_info("overlay_viewer_attribute_common") - .additional_info("draw_modelmat") - .additional_info("draw_resource_id"); +DO_STATIC_COMPILATION() +VERTEX_SOURCE("overlay_viewer_attribute_curve_vert.glsl") +FRAGMENT_SOURCE("overlay_viewer_attribute_frag.glsl") +FRAGMENT_OUT(0, VEC4, out_color) +FRAGMENT_OUT(1, VEC4, lineOutput) +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC4, attribute_value) +VERTEX_OUT(overlay_viewer_attribute_iface) +ADDITIONAL_INFO(overlay_viewer_attribute_common) +ADDITIONAL_INFO(draw_modelmat) +ADDITIONAL_INFO(draw_resource_id) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_curve_clipped) - .do_static_compilation(true) - .additional_info("overlay_viewer_attribute_curve") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_viewer_attribute_curve) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_curves) - .do_static_compilation(true) - .vertex_source("overlay_viewer_attribute_curves_vert.glsl") - .fragment_source("overlay_viewer_attribute_frag.glsl") - .fragment_out(0, Type::VEC4, "out_color") - .fragment_out(1, Type::VEC4, "lineOutput") - .sampler(0, ImageType::FLOAT_BUFFER, "color_tx") - .push_constant(Type::BOOL, "is_point_domain") - .vertex_out(overlay_viewer_attribute_iface) - .additional_info("overlay_viewer_attribute_common") - .additional_info("draw_hair"); +DO_STATIC_COMPILATION() +VERTEX_SOURCE("overlay_viewer_attribute_curves_vert.glsl") +FRAGMENT_SOURCE("overlay_viewer_attribute_frag.glsl") +FRAGMENT_OUT(0, VEC4, out_color) +FRAGMENT_OUT(1, VEC4, lineOutput) +SAMPLER(0, FLOAT_BUFFER, color_tx) +PUSH_CONSTANT(BOOL, is_point_domain) +VERTEX_OUT(overlay_viewer_attribute_iface) +ADDITIONAL_INFO(overlay_viewer_attribute_common) +ADDITIONAL_INFO(draw_hair) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_curves_clipped) - .do_static_compilation(true) - .additional_info("overlay_viewer_attribute_curves") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_viewer_attribute_curves) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_volume_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_volume_info.hh index aec5ec31523..2bd30a709ed 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_volume_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_volume_info.hh @@ -8,48 +8,54 @@ /** \name Volume Velocity * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_volume_velocity_iface).smooth(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_volume_velocity_iface) +SMOOTH(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_volume_velocity) - .sampler(0, ImageType::FLOAT_3D, "velocityX") - .sampler(1, ImageType::FLOAT_3D, "velocityY") - .sampler(2, ImageType::FLOAT_3D, "velocityZ") - .push_constant(Type::FLOAT, "displaySize") - .push_constant(Type::FLOAT, "slicePosition") - .push_constant(Type::INT, "sliceAxis") - .push_constant(Type::BOOL, "scaleWithMagnitude") - .push_constant(Type::BOOL, "isCellCentered") - /* FluidDomainSettings.cell_size */ - .push_constant(Type::VEC3, "cellSize") - /* FluidDomainSettings.p0 */ - .push_constant(Type::VEC3, "domainOriginOffset") - /* FluidDomainSettings.res_min */ - .push_constant(Type::IVEC3, "adaptiveCellOffset") - .push_constant(Type::INT, "in_select_id") - .vertex_out(overlay_volume_velocity_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_volume_velocity_vert.glsl") - .fragment_source("overlay_varying_color.glsl"); +SAMPLER(0, FLOAT_3D, velocityX) +SAMPLER(1, FLOAT_3D, velocityY) +SAMPLER(2, FLOAT_3D, velocityZ) +PUSH_CONSTANT(FLOAT, displaySize) +PUSH_CONSTANT(FLOAT, slicePosition) +PUSH_CONSTANT(INT, sliceAxis) +PUSH_CONSTANT(BOOL, scaleWithMagnitude) +PUSH_CONSTANT(BOOL, isCellCentered) +/* FluidDomainSettings.cell_size */ +PUSH_CONSTANT(VEC3, cellSize) +/* FluidDomainSettings.p0 */ +PUSH_CONSTANT(VEC3, domainOriginOffset) +/* FluidDomainSettings.res_min */ +PUSH_CONSTANT(IVEC3, adaptiveCellOffset) +PUSH_CONSTANT(INT, in_select_id) +VERTEX_OUT(overlay_volume_velocity_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_volume_velocity_vert.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_volume_velocity_streamline) - .do_static_compilation(true) - .additional_info("draw_volume") - .additional_info("overlay_volume_velocity"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(draw_volume) +ADDITIONAL_INFO(overlay_volume_velocity) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_volume_velocity_mac) - .do_static_compilation(true) - .define("USE_MAC") - .push_constant(Type::BOOL, "drawMACX") - .push_constant(Type::BOOL, "drawMACY") - .push_constant(Type::BOOL, "drawMACZ") - .additional_info("draw_volume") - .additional_info("overlay_volume_velocity"); +DO_STATIC_COMPILATION() +DEFINE("USE_MAC") +PUSH_CONSTANT(BOOL, drawMACX) +PUSH_CONSTANT(BOOL, drawMACY) +PUSH_CONSTANT(BOOL, drawMACZ) +ADDITIONAL_INFO(draw_volume) +ADDITIONAL_INFO(overlay_volume_velocity) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_volume_velocity_needle) - .do_static_compilation(true) - .define("USE_NEEDLE") - .additional_info("draw_volume") - .additional_info("overlay_volume_velocity"); +DO_STATIC_COMPILATION() +DEFINE("USE_NEEDLE") +ADDITIONAL_INFO(draw_volume) +ADDITIONAL_INFO(overlay_volume_velocity) +GPU_SHADER_CREATE_END() /** \} */ @@ -57,47 +63,53 @@ GPU_SHADER_CREATE_INFO(overlay_volume_velocity_needle) /** \name Volume Grid-Lines * \{ */ -GPU_SHADER_INTERFACE_INFO(overlay_volume_gridlines_iface).flat(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(overlay_volume_gridlines_iface) +FLAT(VEC4, finalColor) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_volume_gridlines) - .push_constant(Type::FLOAT, "slicePosition") - .push_constant(Type::INT, "sliceAxis") - /* FluidDomainSettings.res */ - .push_constant(Type::IVEC3, "volumeSize") - /* FluidDomainSettings.cell_size */ - .push_constant(Type::VEC3, "cellSize") - /* FluidDomainSettings.p0 */ - .push_constant(Type::VEC3, "domainOriginOffset") - /* FluidDomainSettings.res_min */ - .push_constant(Type::IVEC3, "adaptiveCellOffset") - .push_constant(Type::INT, "in_select_id") - .vertex_out(overlay_volume_gridlines_iface) - .fragment_out(0, Type::VEC4, "fragColor") - .vertex_source("overlay_volume_gridlines_vert.glsl") - .fragment_source("overlay_varying_color.glsl"); +PUSH_CONSTANT(FLOAT, slicePosition) +PUSH_CONSTANT(INT, sliceAxis) +/* FluidDomainSettings.res */ +PUSH_CONSTANT(IVEC3, volumeSize) +/* FluidDomainSettings.cell_size */ +PUSH_CONSTANT(VEC3, cellSize) +/* FluidDomainSettings.p0 */ +PUSH_CONSTANT(VEC3, domainOriginOffset) +/* FluidDomainSettings.res_min */ +PUSH_CONSTANT(IVEC3, adaptiveCellOffset) +PUSH_CONSTANT(INT, in_select_id) +VERTEX_OUT(overlay_volume_gridlines_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +VERTEX_SOURCE("overlay_volume_gridlines_vert.glsl") +FRAGMENT_SOURCE("overlay_varying_color.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_volume_gridlines_flat) - .do_static_compilation(true) - .additional_info("draw_volume") - .additional_info("overlay_volume_gridlines"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(draw_volume) +ADDITIONAL_INFO(overlay_volume_gridlines) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_volume_gridlines_flags) - .do_static_compilation(true) - .define("SHOW_FLAGS") - .sampler(0, ImageType::UINT_3D, "flagTexture") - .additional_info("draw_volume") - .additional_info("overlay_volume_gridlines"); +DO_STATIC_COMPILATION() +DEFINE("SHOW_FLAGS") +SAMPLER(0, UINT_3D, flagTexture) +ADDITIONAL_INFO(draw_volume) +ADDITIONAL_INFO(overlay_volume_gridlines) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_volume_gridlines_range) - .do_static_compilation(true) - .define("SHOW_RANGE") - .push_constant(Type::FLOAT, "lowerBound") - .push_constant(Type::FLOAT, "upperBound") - .push_constant(Type::VEC4, "rangeColor") - .push_constant(Type::INT, "cellFilter") - .sampler(0, ImageType::UINT_3D, "flagTexture") - .sampler(1, ImageType::FLOAT_3D, "fieldTexture") - .additional_info("draw_volume") - .additional_info("overlay_volume_gridlines"); +DO_STATIC_COMPILATION() +DEFINE("SHOW_RANGE") +PUSH_CONSTANT(FLOAT, lowerBound) +PUSH_CONSTANT(FLOAT, upperBound) +PUSH_CONSTANT(VEC4, rangeColor) +PUSH_CONSTANT(INT, cellFilter) +SAMPLER(0, UINT_3D, flagTexture) +SAMPLER(1, FLOAT_3D, fieldTexture) +ADDITIONAL_INFO(draw_volume) +ADDITIONAL_INFO(overlay_volume_gridlines) +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_wireframe_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_wireframe_info.hh index 861c6b4b783..1e44ffe6c47 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_wireframe_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_wireframe_info.hh @@ -5,117 +5,128 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_INTERFACE_INFO(overlay_wireframe_iface) - .smooth(Type::VEC4, "finalColor") - .flat(Type::VEC2, "edgeStart") - .no_perspective(Type::VEC2, "edgePos"); +SMOOTH(VEC4, finalColor) +FLAT(VEC2, edgeStart) +NO_PERSPECTIVE(VEC2, edgePos) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_wireframe) - .do_static_compilation(true) - .push_constant(Type::FLOAT, "wireStepParam") - .push_constant(Type::FLOAT, "wireOpacity") - .push_constant(Type::BOOL, "useColoring") - .push_constant(Type::BOOL, "isTransform") - .push_constant(Type::INT, "colorType") - .push_constant(Type::BOOL, "isHair") - .push_constant(Type::MAT4, "hairDupliMatrix") - /* Scene Depth texture copy for manual depth test. */ - .sampler(0, ImageType::DEPTH_2D, "depthTex") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC3, "nor") - .vertex_in(2, Type::FLOAT, "wd") /* wire-data. */ - .vertex_out(overlay_wireframe_iface) - .vertex_source("overlay_wireframe_vert.glsl") - .fragment_source("overlay_wireframe_frag.glsl") - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "lineOutput") - .depth_write(DepthWrite::ANY) - .additional_info("draw_mesh") - .additional_info("draw_object_infos") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +PUSH_CONSTANT(FLOAT, wireStepParam) +PUSH_CONSTANT(FLOAT, wireOpacity) +PUSH_CONSTANT(BOOL, useColoring) +PUSH_CONSTANT(BOOL, isTransform) +PUSH_CONSTANT(INT, colorType) +PUSH_CONSTANT(BOOL, isHair) +PUSH_CONSTANT(MAT4, hairDupliMatrix) +/* Scene Depth texture copy for manual depth test. */ +SAMPLER(0, DEPTH_2D, depthTex) +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC3, nor) +VERTEX_IN(2, FLOAT, wd) /* wire-data. */ +VERTEX_OUT(overlay_wireframe_iface) +VERTEX_SOURCE("overlay_wireframe_vert.glsl") +FRAGMENT_SOURCE("overlay_wireframe_frag.glsl") +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, lineOutput) +DEPTH_WRITE(DepthWrite::ANY) +ADDITIONAL_INFO(draw_mesh) +ADDITIONAL_INFO(draw_object_infos) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_wireframe_curve) - .do_static_compilation(true) - .define("CURVES") - .push_constant(Type::FLOAT, "wireOpacity") - .push_constant(Type::BOOL, "useColoring") - .push_constant(Type::BOOL, "isTransform") - .push_constant(Type::INT, "colorType") - .vertex_in(0, Type::VEC3, "pos") - .vertex_out(overlay_wireframe_iface) - .vertex_source("overlay_wireframe_vert.glsl") - .fragment_source("overlay_wireframe_frag.glsl") - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "lineOutput") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new") - .additional_info("draw_object_infos_new") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +DEFINE("CURVES") +PUSH_CONSTANT(FLOAT, wireOpacity) +PUSH_CONSTANT(BOOL, useColoring) +PUSH_CONSTANT(BOOL, isTransform) +PUSH_CONSTANT(INT, colorType) +VERTEX_IN(0, VEC3, pos) +VERTEX_OUT(overlay_wireframe_iface) +VERTEX_SOURCE("overlay_wireframe_vert.glsl") +FRAGMENT_SOURCE("overlay_wireframe_frag.glsl") +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, lineOutput) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(draw_object_infos_new) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(overlay_wireframe_points_iface) - .flat(Type::VEC4, "finalColor") - .flat(Type::VEC4, "finalColorInner"); +FLAT(VEC4, finalColor) +FLAT(VEC4, finalColorInner) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(overlay_wireframe_points) - .do_static_compilation(true) - .define("POINTS") - .push_constant(Type::BOOL, "useColoring") - .push_constant(Type::BOOL, "isTransform") - .push_constant(Type::INT, "colorType") - .vertex_in(0, Type::VEC3, "pos") - .vertex_out(overlay_wireframe_points_iface) - .vertex_source("overlay_wireframe_vert.glsl") - .fragment_source("overlay_wireframe_frag.glsl") - .fragment_out(0, Type::VEC4, "fragColor") - .fragment_out(1, Type::VEC4, "lineOutput") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new") - .additional_info("draw_object_infos_new") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +DEFINE("POINTS") +PUSH_CONSTANT(BOOL, useColoring) +PUSH_CONSTANT(BOOL, isTransform) +PUSH_CONSTANT(INT, colorType) +VERTEX_IN(0, VEC3, pos) +VERTEX_OUT(overlay_wireframe_points_iface) +VERTEX_SOURCE("overlay_wireframe_vert.glsl") +FRAGMENT_SOURCE("overlay_wireframe_frag.glsl") +FRAGMENT_OUT(0, VEC4, fragColor) +FRAGMENT_OUT(1, VEC4, lineOutput) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(draw_object_infos_new) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_wireframe_clipped) - .do_static_compilation(true) - .additional_info("overlay_wireframe") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_wireframe) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_wireframe_custom_depth) - .do_static_compilation(true) - .define("CUSTOM_DEPTH_BIAS") - .additional_info("overlay_wireframe"); +DO_STATIC_COMPILATION() +DEFINE("CUSTOM_DEPTH_BIAS") +ADDITIONAL_INFO(overlay_wireframe) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_wireframe_custom_depth_clipped) - .do_static_compilation(true) - .additional_info("overlay_wireframe_custom_depth") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_wireframe_custom_depth) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_wireframe_select) - .do_static_compilation(true) - .define("SELECT_EDGES") - .additional_info("overlay_wireframe"); +DO_STATIC_COMPILATION() +DEFINE("SELECT_EDGES") +ADDITIONAL_INFO(overlay_wireframe) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_wireframe_select_clipped) - .do_static_compilation(true) - .additional_info("overlay_wireframe_select") - .additional_info("drw_clipped"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_wireframe_select) +ADDITIONAL_INFO(drw_clipped) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(overlay_wireframe_uv) - .do_static_compilation(true) - .define("WIREFRAME") - .storage_buf(0, Qualifier::READ, "float", "au[]", Frequency::GEOMETRY) - .push_constant(Type::IVEC2, "gpu_attr_0") - .define("lineStyle", "4" /* OVERLAY_UV_LINE_STYLE_SHADOW */) - .define("dashLength", "1" /* Not used by this line style */) - .define("use_edge_select", "false") - .push_constant(Type::BOOL, "doSmoothWire") - .push_constant(Type::FLOAT, "alpha") - .vertex_out(overlay_edit_uv_next_iface) - .fragment_out(0, Type::VEC4, "fragColor") - /* Note: Reuse edit mode shader as it is mostly the same. */ - .vertex_source("overlay_edit_uv_edges_next_vert.glsl") - .fragment_source("overlay_edit_uv_edges_next_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_modelmat_new") - .additional_info("draw_resource_handle_new") - .additional_info("gpu_index_load") - .additional_info("draw_globals"); +DO_STATIC_COMPILATION() +DEFINE("WIREFRAME") +STORAGE_BUF_FREQ(0, READ, float, au[], GEOMETRY) +PUSH_CONSTANT(IVEC2, gpu_attr_0) +DEFINE_VALUE("lineStyle", "4" /* OVERLAY_UV_LINE_STYLE_SHADOW */) +DEFINE_VALUE("dashLength", "1" /* Not used by this line style */) +DEFINE_VALUE("use_edge_select", "false") +PUSH_CONSTANT(BOOL, doSmoothWire) +PUSH_CONSTANT(FLOAT, alpha) +VERTEX_OUT(overlay_edit_uv_next_iface) +FRAGMENT_OUT(0, VEC4, fragColor) +/* Note: Reuse edit mode shader as it is mostly the same. */ +VERTEX_SOURCE("overlay_edit_uv_edges_next_vert.glsl") +FRAGMENT_SOURCE("overlay_edit_uv_edges_next_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_resource_handle_new) +ADDITIONAL_INFO(gpu_index_load) +ADDITIONAL_INFO(draw_globals) +GPU_SHADER_CREATE_END() -- 2.30.2 From b64ba8b71962830c67ebac2536074ee6e896330b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 18:28:15 +0200 Subject: [PATCH 85/90] Enable ovelray infos --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index a45f42402c0..eff1ebab28a 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -928,20 +928,20 @@ void groupMemoryBarrier() {} #include "infos/gpu_shader_simple_lighting_info.hh" #include "infos/gpu_shader_text_info.hh" #include "infos/gpu_srgb_to_framebuffer_space_info.hh" -// #include "infos/overlay_antialiasing_info.hh" -// #include "infos/overlay_armature_info.hh" -// #include "infos/overlay_background_info.hh" -// #include "infos/overlay_edit_mode_info.hh" -// #include "infos/overlay_extra_info.hh" -// #include "infos/overlay_facing_info.hh" -// #include "infos/overlay_grid_info.hh" -// #include "infos/overlay_outline_info.hh" -// #include "infos/overlay_paint_info.hh" -// #include "infos/overlay_sculpt_curves_info.hh" -// #include "infos/overlay_sculpt_info.hh" -// #include "infos/overlay_viewer_attribute_info.hh" -// #include "infos/overlay_volume_info.hh" -// #include "infos/overlay_wireframe_info.hh" +#include "infos/overlay_antialiasing_info.hh" +#include "infos/overlay_armature_info.hh" +#include "infos/overlay_background_info.hh" +#include "infos/overlay_edit_mode_info.hh" +#include "infos/overlay_extra_info.hh" +#include "infos/overlay_facing_info.hh" +#include "infos/overlay_grid_info.hh" +#include "infos/overlay_outline_info.hh" +#include "infos/overlay_paint_info.hh" +#include "infos/overlay_sculpt_curves_info.hh" +#include "infos/overlay_sculpt_info.hh" +#include "infos/overlay_viewer_attribute_info.hh" +#include "infos/overlay_volume_info.hh" +#include "infos/overlay_wireframe_info.hh" #include "infos/select_id_info.hh" #include "infos/workbench_composite_info.hh" #include "infos/workbench_depth_info.hh" -- 2.30.2 From 4aa10287d20c8fa5b14ae0c10cbb857cf7c1b9bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 19:24:15 +0200 Subject: [PATCH 86/90] Remove macro for buffer types --- .../shaders/infos/eevee_shadow_info.hh | 52 ++++++++----------- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_shadow_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_shadow_info.hh index 4d3826daca6..aec620956c0 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_shadow_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_shadow_info.hh @@ -10,12 +10,6 @@ /** \name Shadow pipeline * \{ */ -/* NOTE(Metal): As this is implemented using a fundamental data type, this needs to be specified - * explicitly as uint for code generation, as the MSLShaderGenerator needs to be able to - * distinguish between classes and fundamental types during code generation. */ -#define SHADOW_TILE_DATA_PACKED "uint" -#define SHADOW_PAGE_PACKED "uint" - GPU_SHADER_CREATE_INFO(eevee_shadow_clipmap_clear) .do_static_compilation(true) .local_group_size(SHADOW_CLIPMAP_GROUP_SIZE) @@ -42,7 +36,7 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_tilemap_init) .do_static_compilation(true) .local_group_size(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) .storage_buf(0, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(1, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") + .storage_buf(1, Qualifier::READ_WRITE, "uint", "tiles_buf[]") .storage_buf(2, Qualifier::READ_WRITE, "ShadowTileMapClip", "tilemaps_clip_buf[]") .storage_buf(4, Qualifier::READ_WRITE, "uvec2", "pages_cached_buf[]") .additional_info("eevee_shared") @@ -52,7 +46,7 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_tag_update) .do_static_compilation(true) .local_group_size(1, 1, 1) .storage_buf(0, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(1, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") + .storage_buf(1, Qualifier::READ_WRITE, "uint", "tiles_buf[]") .storage_buf(5, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .storage_buf(6, Qualifier::READ, "uint", "resource_ids_buf[]") .additional_info("eevee_shared") @@ -64,7 +58,7 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_tag_usage_opaque) .do_static_compilation(true) .local_group_size(SHADOW_DEPTH_SCAN_GROUP_SIZE, SHADOW_DEPTH_SCAN_GROUP_SIZE) .storage_buf(5, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(6, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") + .storage_buf(6, Qualifier::READ_WRITE, "uint", "tiles_buf[]") .push_constant(Type::IVEC2, "input_depth_extent") .additional_info( "eevee_shared", "draw_view", "draw_view_culling", "eevee_hiz_data", "eevee_light_data") @@ -74,7 +68,7 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_tag_usage_surfels) .do_static_compilation(true) .local_group_size(SURFEL_GROUP_SIZE) .storage_buf(6, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(7, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") + .storage_buf(7, Qualifier::READ_WRITE, "uint", "tiles_buf[]") .push_constant(Type::INT, "directional_level") .additional_info("eevee_shared") .additional_info("draw_view") @@ -96,7 +90,7 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_tag_usage_transparent) .vertex_in(0, Type::VEC3, "pos") .storage_buf(4, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .storage_buf(5, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(6, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") + .storage_buf(6, Qualifier::READ_WRITE, "uint", "tiles_buf[]") .push_constant(Type::IVEC2, "fb_resolution") .push_constant(Type::INT, "fb_lod") .vertex_out(eevee_shadow_tag_transparent_iface) @@ -115,7 +109,7 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_tag_usage_volume) .do_static_compilation(true) .local_group_size(VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE) .storage_buf(4, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(5, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") + .storage_buf(5, Qualifier::READ_WRITE, "uint", "tiles_buf[]") .additional_info("eevee_volume_properties_data") .additional_info("eevee_shared") .additional_info("draw_view") @@ -130,7 +124,7 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_page_mask) .local_group_size(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) .push_constant(Type::INT, "max_view_per_tilemap") .storage_buf(0, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(1, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") + .storage_buf(1, Qualifier::READ_WRITE, "uint", "tiles_buf[]") .additional_info("eevee_shared") .compute_source("eevee_shadow_page_mask_comp.glsl"); @@ -138,7 +132,7 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_page_free) .do_static_compilation(true) .local_group_size(SHADOW_TILEMAP_LOD0_LEN) .storage_buf(0, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(1, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") + .storage_buf(1, Qualifier::READ_WRITE, "uint", "tiles_buf[]") .storage_buf(2, Qualifier::READ_WRITE, "ShadowPagesInfoData", "pages_infos_buf") .storage_buf(3, Qualifier::READ_WRITE, "uint", "pages_free_buf[]") .storage_buf(4, Qualifier::READ_WRITE, "uvec2", "pages_cached_buf[]") @@ -149,7 +143,7 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_page_defrag) .do_static_compilation(true) .local_group_size(1) .typedef_source("draw_shader_shared.hh") - .storage_buf(1, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") + .storage_buf(1, Qualifier::READ_WRITE, "uint", "tiles_buf[]") .storage_buf(2, Qualifier::READ_WRITE, "ShadowPagesInfoData", "pages_infos_buf") .storage_buf(3, Qualifier::READ_WRITE, "uint", "pages_free_buf[]") .storage_buf(4, Qualifier::READ_WRITE, "uvec2", "pages_cached_buf[]") @@ -164,7 +158,7 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_page_allocate) .local_group_size(SHADOW_TILEMAP_LOD0_LEN) .typedef_source("draw_shader_shared.hh") .storage_buf(0, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(1, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") + .storage_buf(1, Qualifier::READ_WRITE, "uint", "tiles_buf[]") .storage_buf(2, Qualifier::READ_WRITE, "ShadowPagesInfoData", "pages_infos_buf") .storage_buf(3, Qualifier::READ_WRITE, "uint", "pages_free_buf[]") .storage_buf(4, Qualifier::READ_WRITE, "uvec2", "pages_cached_buf[]") @@ -177,7 +171,7 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_tilemap_finalize) .typedef_source("draw_shader_shared.hh") .local_group_size(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) .storage_buf(0, Qualifier::READ, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(1, Qualifier::READ, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") + .storage_buf(1, Qualifier::READ, "uint", "tiles_buf[]") .storage_buf(2, Qualifier::READ_WRITE, "ShadowPagesInfoData", "pages_infos_buf") .storage_buf(3, Qualifier::READ_WRITE, "ShadowStatistics", "statistics_buf") .storage_buf(4, Qualifier::WRITE, "ViewMatrices", "view_infos_buf[SHADOW_VIEW_MAX]") @@ -193,12 +187,12 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_tilemap_rendermap) .local_group_size(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) .storage_buf(0, Qualifier::READ_WRITE, "ShadowStatistics", "statistics_buf") .storage_buf(1, Qualifier::READ, "ShadowRenderView", "render_view_buf[SHADOW_VIEW_MAX]") - .storage_buf(2, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") + .storage_buf(2, Qualifier::READ_WRITE, "uint", "tiles_buf[]") .storage_buf(3, Qualifier::READ_WRITE, "DispatchCommand", "clear_dispatch_buf") .storage_buf(4, Qualifier::READ_WRITE, "DrawCommand", "tile_draw_buf") - .storage_buf(5, Qualifier::WRITE, SHADOW_PAGE_PACKED, "dst_coord_buf[SHADOW_RENDER_MAP_SIZE]") - .storage_buf(6, Qualifier::WRITE, SHADOW_PAGE_PACKED, "src_coord_buf[SHADOW_RENDER_MAP_SIZE]") - .storage_buf(7, Qualifier::WRITE, SHADOW_PAGE_PACKED, "render_map_buf[SHADOW_RENDER_MAP_SIZE]") + .storage_buf(5, Qualifier::WRITE, "uint", "dst_coord_buf[SHADOW_RENDER_MAP_SIZE]") + .storage_buf(6, Qualifier::WRITE, "uint", "src_coord_buf[SHADOW_RENDER_MAP_SIZE]") + .storage_buf(7, Qualifier::WRITE, "uint", "render_map_buf[SHADOW_RENDER_MAP_SIZE]") .additional_info("eevee_shared") .compute_source("eevee_shadow_tilemap_rendermap_comp.glsl"); @@ -219,7 +213,7 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_page_clear) .do_static_compilation(true) .local_group_size(SHADOW_PAGE_CLEAR_GROUP_SIZE, SHADOW_PAGE_CLEAR_GROUP_SIZE) .storage_buf(2, Qualifier::READ, "ShadowPagesInfoData", "pages_infos_buf") - .storage_buf(6, Qualifier::READ, SHADOW_PAGE_PACKED, "dst_coord_buf[SHADOW_RENDER_MAP_SIZE]") + .storage_buf(6, Qualifier::READ, "uint", "dst_coord_buf[SHADOW_RENDER_MAP_SIZE]") .additional_info("eevee_shared") .compute_source("eevee_shadow_page_clear_comp.glsl") .image(SHADOW_ATLAS_IMG_SLOT, @@ -234,16 +228,16 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_page_tile_clear) .define("PASS_CLEAR") .additional_info("eevee_shared") .builtins(BuiltinBits::VIEWPORT_INDEX | BuiltinBits::LAYER) - .storage_buf(8, Qualifier::READ, SHADOW_PAGE_PACKED, "src_coord_buf[SHADOW_RENDER_MAP_SIZE]") + .storage_buf(8, Qualifier::READ, "uint", "src_coord_buf[SHADOW_RENDER_MAP_SIZE]") .vertex_source("eevee_shadow_page_tile_vert.glsl") .fragment_source("eevee_shadow_page_tile_frag.glsl") .fragment_out(0, Type::FLOAT, "out_tile_depth", DualBlend::NONE, SHADOW_ROG_ID); #ifdef APPLE /* Metal supports USHORT which saves a bit of performance here. */ -# define PAGE_Z_TYPE Type::USHORT +# define PAGE_Z_TYPE USHORT #else -# define PAGE_Z_TYPE Type::UINT +# define PAGE_Z_TYPE UINT #endif /* Interface for passing precalculated values in accumulation vertex to frag. */ @@ -251,7 +245,7 @@ GPU_SHADER_NAMED_INTERFACE_INFO(eevee_shadow_page_tile_store_noperspective_iface interp_noperspective) .no_perspective(Type::VEC2, "out_texel_xy"); GPU_SHADER_NAMED_INTERFACE_INFO(eevee_shadow_page_tile_store_flat_iface, interp_flat) - .flat(PAGE_Z_TYPE, "out_page_z"); + .flat(Type::PAGE_Z_TYPE, "out_page_z"); #undef PAGE_Z_TYPE @@ -261,8 +255,8 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_page_tile_store) .define("PASS_DEPTH_STORE") .additional_info("eevee_shared") .builtins(BuiltinBits::VIEWPORT_INDEX | BuiltinBits::LAYER) - .storage_buf(7, Qualifier::READ, SHADOW_PAGE_PACKED, "dst_coord_buf[SHADOW_RENDER_MAP_SIZE]") - .storage_buf(8, Qualifier::READ, SHADOW_PAGE_PACKED, "src_coord_buf[SHADOW_RENDER_MAP_SIZE]") + .storage_buf(7, Qualifier::READ, "uint", "dst_coord_buf[SHADOW_RENDER_MAP_SIZE]") + .storage_buf(8, Qualifier::READ, "uint", "src_coord_buf[SHADOW_RENDER_MAP_SIZE]") .subpass_in(0, Type::FLOAT, "in_tile_depth", SHADOW_ROG_ID) .image(SHADOW_ATLAS_IMG_SLOT, GPU_R32UI, @@ -302,7 +296,7 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_debug) .do_static_compilation(true) .additional_info("eevee_shared") .storage_buf(5, Qualifier::READ, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(6, Qualifier::READ, SHADOW_TILE_DATA_PACKED, "tiles_buf[]") + .storage_buf(6, Qualifier::READ, "uint", "tiles_buf[]") .fragment_out(0, Type::VEC4, "out_color_add", DualBlend::SRC_0) .fragment_out(0, Type::VEC4, "out_color_mul", DualBlend::SRC_1) .push_constant(Type::INT, "debug_mode") -- 2.30.2 From 89794ba18d894d49ac7106708a4097bf4e1afb97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 19:31:25 +0200 Subject: [PATCH 87/90] Mass rename eevee infos --- .../infos/eevee_ambient_occlusion_info.hh | 33 +- .../shaders/infos/eevee_deferred_info.hh | 275 ++++----- .../infos/eevee_depth_of_field_info.hh | 358 ++++++------ .../shaders/infos/eevee_film_info.hh | 195 ++++--- .../shaders/infos/eevee_hiz_info.hh | 61 +- .../shaders/infos/eevee_light_culling_info.hh | 128 +++-- .../infos/eevee_lightprobe_sphere_info.hh | 169 +++--- .../infos/eevee_lightprobe_volume_info.hh | 387 +++++++------ .../shaders/infos/eevee_lookdev_info.hh | 28 +- .../shaders/infos/eevee_lut_info.hh | 15 +- .../shaders/infos/eevee_material_info.hh | 537 +++++++++--------- .../shaders/infos/eevee_motion_blur_info.hh | 77 +-- .../shaders/infos/eevee_shadow_info.hh | 467 +++++++-------- .../shaders/infos/eevee_subsurface_info.hh | 61 +- .../shaders/infos/eevee_tracing_info.hh | 456 ++++++++------- .../shaders/infos/eevee_velocity_info.hh | 53 +- .../shaders/infos/eevee_volume_info.hh | 164 +++--- 17 files changed, 1786 insertions(+), 1678 deletions(-) diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_ambient_occlusion_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_ambient_occlusion_info.hh index f64dc5c3bbd..7150b22a7b8 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_ambient_occlusion_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_ambient_occlusion_info.hh @@ -6,19 +6,20 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(eevee_ambient_occlusion_pass) - .define("HORIZON_OCCLUSION") - .compute_source("eevee_ambient_occlusion_pass_comp.glsl") - .local_group_size(AMBIENT_OCCLUSION_PASS_TILE_SIZE, AMBIENT_OCCLUSION_PASS_TILE_SIZE) - .image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D_ARRAY, "in_normal_img") - .push_constant(Type::INT, "in_normal_img_layer_index") - .image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_ao_img") - .push_constant(Type::INT, "out_ao_img_layer_index") - .specialization_constant(Type::INT, "ao_slice_count", 2) - .specialization_constant(Type::INT, "ao_step_count", 8) - .additional_info("draw_view") - .additional_info("eevee_shared") - .additional_info("eevee_hiz_data") - .additional_info("eevee_sampling_data") - .additional_info("eevee_utility_texture") - .additional_info("eevee_global_ubo") - .do_static_compilation(true); +DEFINE("HORIZON_OCCLUSION") +COMPUTE_SOURCE("eevee_ambient_occlusion_pass_comp.glsl") +LOCAL_GROUP_SIZE(AMBIENT_OCCLUSION_PASS_TILE_SIZE, AMBIENT_OCCLUSION_PASS_TILE_SIZE) +IMAGE(0, GPU_RGBA16F, READ, FLOAT_2D_ARRAY, in_normal_img) +PUSH_CONSTANT(INT, in_normal_img_layer_index) +IMAGE(1, GPU_R16F, WRITE, FLOAT_2D_ARRAY, out_ao_img) +PUSH_CONSTANT(INT, out_ao_img_layer_index) +SPECIALIZATION_CONSTANT(INT, ao_slice_count, 2) +SPECIALIZATION_CONSTANT(INT, ao_step_count, 8) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_hiz_data) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_utility_texture) +ADDITIONAL_INFO(eevee_global_ubo) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_deferred_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_deferred_info.hh index b1647c786a0..48a7e3eb4e7 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_deferred_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_deferred_info.hh @@ -19,149 +19,159 @@ * \{ */ GPU_SHADER_CREATE_INFO(eevee_deferred_thickness_amend) - .do_static_compilation(true) - .define("GBUFFER_LOAD") - .sampler(0, ImageType::UINT_2D, "gbuf_header_tx") - .image(0, GPU_RG16, Qualifier::READ_WRITE, ImageType::FLOAT_2D_ARRAY, "gbuf_normal_img") - /* Early fragment test is needed to discard fragment that do not need this processing. */ - .early_fragment_test(true) - .fragment_source("eevee_deferred_thickness_amend_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_fullscreen") - .additional_info("eevee_sampling_data") - .additional_info("eevee_shared") - .additional_info("eevee_light_data") - .additional_info("eevee_shadow_data") - .additional_info("eevee_hiz_data"); +DO_STATIC_COMPILATION() +DEFINE("GBUFFER_LOAD") +SAMPLER(0, UINT_2D, gbuf_header_tx) +IMAGE(0, GPU_RG16, READ_WRITE, FLOAT_2D_ARRAY, gbuf_normal_img) +/* Early fragment test is needed to discard fragment that do not need this processing. */ +EARLY_FRAGMENT_TEST(true) +FRAGMENT_SOURCE("eevee_deferred_thickness_amend_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_fullscreen) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_light_data) +ADDITIONAL_INFO(eevee_shadow_data) +ADDITIONAL_INFO(eevee_hiz_data) +GPU_SHADER_CREATE_END() /** \} */ GPU_SHADER_CREATE_INFO(eevee_gbuffer_data) - .define("GBUFFER_LOAD") - .sampler(12, ImageType::UINT_2D, "gbuf_header_tx") - .sampler(13, ImageType::FLOAT_2D_ARRAY, "gbuf_closure_tx") - .sampler(14, ImageType::FLOAT_2D_ARRAY, "gbuf_normal_tx"); +DEFINE("GBUFFER_LOAD") +SAMPLER(12, UINT_2D, gbuf_header_tx) +SAMPLER(13, FLOAT_2D_ARRAY, gbuf_closure_tx) +SAMPLER(14, FLOAT_2D_ARRAY, gbuf_normal_tx) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_deferred_tile_classify) - .fragment_source("eevee_deferred_tile_classify_frag.glsl") - .additional_info("eevee_shared") - .additional_info("draw_fullscreen") - .subpass_in(1, Type::UINT, "in_gbuffer_header", DEFERRED_GBUFFER_ROG_ID) - .typedef_source("draw_shader_shared.hh") - .push_constant(Type::INT, "current_bit") - .do_static_compilation(true); +FRAGMENT_SOURCE("eevee_deferred_tile_classify_frag.glsl") +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_fullscreen) +SUBPASS_IN(1, UINT, in_gbuffer_header, DEFERRED_GBUFFER_ROG_ID) +TYPEDEF_SOURCE("draw_shader_shared.hh") +PUSH_CONSTANT(INT, current_bit) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_deferred_light) - .fragment_source("eevee_deferred_light_frag.glsl") - /* Early fragment test is needed to avoid processing background fragments. */ - .early_fragment_test(true) - .fragment_out(0, Type::VEC4, "out_combined") - /* Chaining to next pass. */ - .uimage_out(2, DEFERRED_RADIANCE_FORMAT, "direct_radiance_1_img") - .uimage_out(3, DEFERRED_RADIANCE_FORMAT, "direct_radiance_2_img") - .uimage_out(4, DEFERRED_RADIANCE_FORMAT, "direct_radiance_3_img") - /* Optimized out if use_split_indirect is false. */ - .image_out(5, RAYTRACE_RADIANCE_FORMAT, "indirect_radiance_1_img") - .image_out(6, RAYTRACE_RADIANCE_FORMAT, "indirect_radiance_2_img") - .image_out(7, RAYTRACE_RADIANCE_FORMAT, "indirect_radiance_3_img") - .specialization_constant(Type::BOOL, "use_split_indirect", false) - .specialization_constant(Type::BOOL, "use_lightprobe_eval", false) - .specialization_constant(Type::BOOL, "use_transmission", false) - .specialization_constant(Type::INT, "render_pass_shadow_id", -1) - .define("SPECIALIZED_SHADOW_PARAMS") - .specialization_constant(Type::INT, "shadow_ray_count", 1) - .specialization_constant(Type::INT, "shadow_ray_step_count", 6) - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data") - .additional_info("eevee_utility_texture") - .additional_info("eevee_sampling_data") - .additional_info("eevee_light_data") - .additional_info("eevee_shadow_data") - .additional_info("eevee_hiz_data") - .additional_info("eevee_lightprobe_data") - .additional_info("eevee_render_pass_out") - .additional_info("draw_fullscreen") - .additional_info("draw_view"); +FRAGMENT_SOURCE("eevee_deferred_light_frag.glsl") +/* Early fragment test is needed to avoid processing background fragments. */ +EARLY_FRAGMENT_TEST(true) +FRAGMENT_OUT(0, VEC4, out_combined) +/* Chaining to next pass. */ +IMAGE_FREQ(2, DEFERRED_RADIANCE_FORMAT, WRITE, UINT_2D, direct_radiance_1_img, PASS) +IMAGE_FREQ(3, DEFERRED_RADIANCE_FORMAT, WRITE, UINT_2D, direct_radiance_2_img, PASS) +IMAGE_FREQ(4, DEFERRED_RADIANCE_FORMAT, WRITE, UINT_2D, direct_radiance_3_img, PASS) +/* Optimized out if use_split_indirect is false. */ +IMAGE_FREQ(5, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, indirect_radiance_1_img, PASS) +IMAGE_FREQ(6, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, indirect_radiance_2_img, PASS) +IMAGE_FREQ(7, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, indirect_radiance_3_img, PASS) +SPECIALIZATION_CONSTANT(BOOL, use_split_indirect, false) +SPECIALIZATION_CONSTANT(BOOL, use_lightprobe_eval, false) +SPECIALIZATION_CONSTANT(BOOL, use_transmission, false) +SPECIALIZATION_CONSTANT(INT, render_pass_shadow_id, -1) +DEFINE("SPECIALIZED_SHADOW_PARAMS") +SPECIALIZATION_CONSTANT(INT, shadow_ray_count, 1) +SPECIALIZATION_CONSTANT(INT, shadow_ray_step_count, 6) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(eevee_utility_texture) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_light_data) +ADDITIONAL_INFO(eevee_shadow_data) +ADDITIONAL_INFO(eevee_hiz_data) +ADDITIONAL_INFO(eevee_lightprobe_data) +ADDITIONAL_INFO(eevee_render_pass_out) +ADDITIONAL_INFO(draw_fullscreen) +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_deferred_light_single) - .additional_info("eevee_deferred_light") - .define("LIGHT_CLOSURE_EVAL_COUNT", "1") - .do_static_compilation(true); +ADDITIONAL_INFO(eevee_deferred_light) +DEFINE_VALUE("LIGHT_CLOSURE_EVAL_COUNT", "1") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_deferred_light_double) - .additional_info("eevee_deferred_light") - .define("LIGHT_CLOSURE_EVAL_COUNT", "2") - .do_static_compilation(true); +ADDITIONAL_INFO(eevee_deferred_light) +DEFINE_VALUE("LIGHT_CLOSURE_EVAL_COUNT", "2") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_deferred_light_triple) - .additional_info("eevee_deferred_light") - .define("LIGHT_CLOSURE_EVAL_COUNT", "3") - .do_static_compilation(true); +ADDITIONAL_INFO(eevee_deferred_light) +DEFINE_VALUE("LIGHT_CLOSURE_EVAL_COUNT", "3") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_deferred_combine) - /* Early fragment test is needed to avoid processing fragments background fragments. */ - .early_fragment_test(true) - /* Inputs. */ - .sampler(2, ImageType::UINT_2D, "direct_radiance_1_tx") - .sampler(3, ImageType::UINT_2D, "direct_radiance_2_tx") - .sampler(4, ImageType::UINT_2D, "direct_radiance_3_tx") - .sampler(5, ImageType::FLOAT_2D, "indirect_radiance_1_tx") - .sampler(6, ImageType::FLOAT_2D, "indirect_radiance_2_tx") - .sampler(7, ImageType::FLOAT_2D, "indirect_radiance_3_tx") - .image(5, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "radiance_feedback_img") - .fragment_out(0, Type::VEC4, "out_combined") - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data") - .additional_info("eevee_render_pass_out") - .additional_info("draw_fullscreen") - .fragment_source("eevee_deferred_combine_frag.glsl") - /* NOTE: Both light IDs have a valid specialized assignment of '-1' so only when default is - * present will we instead dynamically look-up ID from the uniform buffer. */ - .specialization_constant(Type::BOOL, "render_pass_diffuse_light_enabled", true) - .specialization_constant(Type::BOOL, "render_pass_specular_light_enabled", true) - .specialization_constant(Type::BOOL, "render_pass_normal_enabled", true) - .specialization_constant(Type::BOOL, "use_radiance_feedback", false) - .specialization_constant(Type::BOOL, "use_split_radiance", false) - .do_static_compilation(true); +/* Early fragment test is needed to avoid processing fragments background fragments. */ +EARLY_FRAGMENT_TEST(true) +/* Inputs. */ +SAMPLER(2, UINT_2D, direct_radiance_1_tx) +SAMPLER(3, UINT_2D, direct_radiance_2_tx) +SAMPLER(4, UINT_2D, direct_radiance_3_tx) +SAMPLER(5, FLOAT_2D, indirect_radiance_1_tx) +SAMPLER(6, FLOAT_2D, indirect_radiance_2_tx) +SAMPLER(7, FLOAT_2D, indirect_radiance_3_tx) +IMAGE(5, GPU_RGBA16F, READ_WRITE, FLOAT_2D, radiance_feedback_img) +FRAGMENT_OUT(0, VEC4, out_combined) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(eevee_render_pass_out) +ADDITIONAL_INFO(draw_fullscreen) +FRAGMENT_SOURCE("eevee_deferred_combine_frag.glsl") +/* NOTE: Both light IDs have a valid specialized assignment of '-1' so only when default is + * present will we instead dynamically look-up ID from the uniform buffer. */ +SPECIALIZATION_CONSTANT(BOOL, render_pass_diffuse_light_enabled, true) +SPECIALIZATION_CONSTANT(BOOL, render_pass_specular_light_enabled, true) +SPECIALIZATION_CONSTANT(BOOL, render_pass_normal_enabled, true) +SPECIALIZATION_CONSTANT(BOOL, use_radiance_feedback, false) +SPECIALIZATION_CONSTANT(BOOL, use_split_radiance, false) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_deferred_capture_eval) - /* Early fragment test is needed to avoid processing fragments without correct GBuffer data. */ - .early_fragment_test(true) - /* Inputs. */ - .fragment_out(0, Type::VEC4, "out_radiance") - .define("LIGHT_CLOSURE_EVAL_COUNT", "1") - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data") - .additional_info("eevee_utility_texture") - .additional_info("eevee_sampling_data") - .additional_info("eevee_light_data") - .additional_info("eevee_shadow_data") - .additional_info("eevee_hiz_data") - .additional_info("eevee_volume_probe_data") - .additional_info("draw_view") - .additional_info("draw_fullscreen") - .fragment_source("eevee_deferred_capture_frag.glsl") - .do_static_compilation(true); +/* Early fragment test is needed to avoid processing fragments without correct GBuffer data. */ +EARLY_FRAGMENT_TEST(true) +/* Inputs. */ +FRAGMENT_OUT(0, VEC4, out_radiance) +DEFINE_VALUE("LIGHT_CLOSURE_EVAL_COUNT", "1") +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(eevee_utility_texture) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_light_data) +ADDITIONAL_INFO(eevee_shadow_data) +ADDITIONAL_INFO(eevee_hiz_data) +ADDITIONAL_INFO(eevee_volume_probe_data) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_fullscreen) +FRAGMENT_SOURCE("eevee_deferred_capture_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_deferred_planar_eval) - /* Early fragment test is needed to avoid processing fragments without correct GBuffer data. */ - .early_fragment_test(true) - /* Inputs. */ - .fragment_out(0, Type::VEC4, "out_radiance") - .define("SPHERE_PROBE") - .define("LIGHT_CLOSURE_EVAL_COUNT", "1") - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data") - .additional_info("eevee_utility_texture") - .additional_info("eevee_sampling_data") - .additional_info("eevee_light_data") - .additional_info("eevee_lightprobe_data") - .additional_info("eevee_shadow_data") - .additional_info("eevee_hiz_data") - .additional_info("draw_view") - .additional_info("draw_fullscreen") - .fragment_source("eevee_deferred_planar_frag.glsl") - .do_static_compilation(true); +/* Early fragment test is needed to avoid processing fragments without correct GBuffer data. */ +EARLY_FRAGMENT_TEST(true) +/* Inputs. */ +FRAGMENT_OUT(0, VEC4, out_radiance) +DEFINE("SPHERE_PROBE") +DEFINE_VALUE("LIGHT_CLOSURE_EVAL_COUNT", "1") +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(eevee_utility_texture) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_light_data) +ADDITIONAL_INFO(eevee_lightprobe_data) +ADDITIONAL_INFO(eevee_shadow_data) +ADDITIONAL_INFO(eevee_hiz_data) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_fullscreen) +FRAGMENT_SOURCE("eevee_deferred_planar_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() #undef image_array_out #undef image_out @@ -172,14 +182,15 @@ GPU_SHADER_CREATE_INFO(eevee_deferred_planar_eval) * \{ */ GPU_SHADER_CREATE_INFO(eevee_debug_gbuffer) - .do_static_compilation(true) - .fragment_out(0, Type::VEC4, "out_color_add", DualBlend::SRC_0) - .fragment_out(0, Type::VEC4, "out_color_mul", DualBlend::SRC_1) - .push_constant(Type::INT, "debug_mode") - .fragment_source("eevee_debug_gbuffer_frag.glsl") - .additional_info("draw_view") - .additional_info("draw_fullscreen") - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data"); +DO_STATIC_COMPILATION() +FRAGMENT_OUT_DUAL(0, VEC4, out_color_add, SRC_0) +FRAGMENT_OUT_DUAL(0, VEC4, out_color_mul, SRC_1) +PUSH_CONSTANT(INT, debug_mode) +FRAGMENT_SOURCE("eevee_debug_gbuffer_frag.glsl") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_fullscreen) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_depth_of_field_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_depth_of_field_info.hh index 8421cb23caf..bd8814b44c7 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_depth_of_field_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_depth_of_field_info.hh @@ -10,76 +10,81 @@ * \{ */ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_bokeh_lut) - .do_static_compilation(true) - .local_group_size(DOF_BOKEH_LUT_SIZE, DOF_BOKEH_LUT_SIZE) - .additional_info("eevee_shared") - .additional_info("draw_view") - .uniform_buf(6, "DepthOfFieldData", "dof_buf") - .image(0, GPU_RG16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_gather_lut_img") - .image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_scatter_lut_img") - .image(2, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_resolve_lut_img") - .compute_source("eevee_depth_of_field_bokeh_lut_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(DOF_BOKEH_LUT_SIZE, DOF_BOKEH_LUT_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +UNIFORM_BUF(6, DepthOfFieldData, dof_buf) +IMAGE(0, GPU_RG16F, WRITE, FLOAT_2D, out_gather_lut_img) +IMAGE(1, GPU_R16F, WRITE, FLOAT_2D, out_scatter_lut_img) +IMAGE(2, GPU_R16F, WRITE, FLOAT_2D, out_resolve_lut_img) +COMPUTE_SOURCE("eevee_depth_of_field_bokeh_lut_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_depth_of_field_setup) - .do_static_compilation(true) - .local_group_size(DOF_DEFAULT_GROUP_SIZE, DOF_DEFAULT_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("draw_view") - .uniform_buf(6, "DepthOfFieldData", "dof_buf") - .sampler(0, ImageType::FLOAT_2D, "color_tx") - .sampler(1, ImageType::DEPTH_2D, "depth_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img") - .image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_coc_img") - .compute_source("eevee_depth_of_field_setup_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(DOF_DEFAULT_GROUP_SIZE, DOF_DEFAULT_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +UNIFORM_BUF(6, DepthOfFieldData, dof_buf) +SAMPLER(0, FLOAT_2D, color_tx) +SAMPLER(1, DEPTH_2D, depth_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_img) +IMAGE(1, GPU_R16F, WRITE, FLOAT_2D, out_coc_img) +COMPUTE_SOURCE("eevee_depth_of_field_setup_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_depth_of_field_stabilize) - .do_static_compilation(true) - .local_group_size(DOF_STABILIZE_GROUP_SIZE, DOF_STABILIZE_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("draw_view") - .additional_info("eevee_velocity_camera") - .uniform_buf(6, "DepthOfFieldData", "dof_buf") - .sampler(0, ImageType::FLOAT_2D, "coc_tx") - .sampler(1, ImageType::FLOAT_2D, "color_tx") - .sampler(2, ImageType::FLOAT_2D, "velocity_tx") - .sampler(3, ImageType::FLOAT_2D, "in_history_tx") - .sampler(4, ImageType::DEPTH_2D, "depth_tx") - .push_constant(Type::BOOL, "u_use_history") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img") - .image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_coc_img") - .image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_history_img") - .compute_source("eevee_depth_of_field_stabilize_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(DOF_STABILIZE_GROUP_SIZE, DOF_STABILIZE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_velocity_camera) +UNIFORM_BUF(6, DepthOfFieldData, dof_buf) +SAMPLER(0, FLOAT_2D, coc_tx) +SAMPLER(1, FLOAT_2D, color_tx) +SAMPLER(2, FLOAT_2D, velocity_tx) +SAMPLER(3, FLOAT_2D, in_history_tx) +SAMPLER(4, DEPTH_2D, depth_tx) +PUSH_CONSTANT(BOOL, u_use_history) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_img) +IMAGE(1, GPU_R16F, WRITE, FLOAT_2D, out_coc_img) +IMAGE(2, GPU_RGBA16F, WRITE, FLOAT_2D, out_history_img) +COMPUTE_SOURCE("eevee_depth_of_field_stabilize_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_depth_of_field_downsample) - .do_static_compilation(true) - .local_group_size(DOF_DEFAULT_GROUP_SIZE, DOF_DEFAULT_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("draw_view") - .sampler(0, ImageType::FLOAT_2D, "color_tx") - .sampler(1, ImageType::FLOAT_2D, "coc_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img") - .compute_source("eevee_depth_of_field_downsample_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(DOF_DEFAULT_GROUP_SIZE, DOF_DEFAULT_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +SAMPLER(0, FLOAT_2D, color_tx) +SAMPLER(1, FLOAT_2D, coc_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_img) +COMPUTE_SOURCE("eevee_depth_of_field_downsample_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_depth_of_field_reduce) - .do_static_compilation(true) - .local_group_size(DOF_REDUCE_GROUP_SIZE, DOF_REDUCE_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("draw_view") - .uniform_buf(6, "DepthOfFieldData", "dof_buf") - .sampler(0, ImageType::FLOAT_2D, "downsample_tx") - .storage_buf(0, Qualifier::WRITE, "ScatterRect", "scatter_fg_list_buf[]") - .storage_buf(1, Qualifier::WRITE, "ScatterRect", "scatter_bg_list_buf[]") - .storage_buf(2, Qualifier::READ_WRITE, "DrawCommand", "scatter_fg_indirect_buf") - .storage_buf(3, Qualifier::READ_WRITE, "DrawCommand", "scatter_bg_indirect_buf") - .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "inout_color_lod0_img") - .image(1, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_lod1_img") - .image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_lod2_img") - .image(3, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_lod3_img") - .image(4, GPU_R16F, Qualifier::READ, ImageType::FLOAT_2D, "in_coc_lod0_img") - .image(5, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_coc_lod1_img") - .image(6, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_coc_lod2_img") - .image(7, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_coc_lod3_img") - .compute_source("eevee_depth_of_field_reduce_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(DOF_REDUCE_GROUP_SIZE, DOF_REDUCE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +UNIFORM_BUF(6, DepthOfFieldData, dof_buf) +SAMPLER(0, FLOAT_2D, downsample_tx) +STORAGE_BUF(0, WRITE, ScatterRect, scatter_fg_list_buf[]) +STORAGE_BUF(1, WRITE, ScatterRect, scatter_bg_list_buf[]) +STORAGE_BUF(2, READ_WRITE, DrawCommand, scatter_fg_indirect_buf) +STORAGE_BUF(3, READ_WRITE, DrawCommand, scatter_bg_indirect_buf) +IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, inout_color_lod0_img) +IMAGE(1, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_lod1_img) +IMAGE(2, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_lod2_img) +IMAGE(3, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_lod3_img) +IMAGE(4, GPU_R16F, READ, FLOAT_2D, in_coc_lod0_img) +IMAGE(5, GPU_R16F, WRITE, FLOAT_2D, out_coc_lod1_img) +IMAGE(6, GPU_R16F, WRITE, FLOAT_2D, out_coc_lod2_img) +IMAGE(7, GPU_R16F, WRITE, FLOAT_2D, out_coc_lod3_img) +COMPUTE_SOURCE("eevee_depth_of_field_reduce_comp.glsl") +GPU_SHADER_CREATE_END() /** \} */ @@ -88,39 +93,44 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_reduce) * \{ */ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_tiles_flatten) - .do_static_compilation(true) - .local_group_size(DOF_TILES_FLATTEN_GROUP_SIZE, DOF_TILES_FLATTEN_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("draw_view") - .sampler(0, ImageType::FLOAT_2D, "coc_tx") - .image(2, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_tiles_fg_img") - .image(3, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_tiles_bg_img") - .compute_source("eevee_depth_of_field_tiles_flatten_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(DOF_TILES_FLATTEN_GROUP_SIZE, DOF_TILES_FLATTEN_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +SAMPLER(0, FLOAT_2D, coc_tx) +IMAGE(2, GPU_R11F_G11F_B10F, WRITE, FLOAT_2D, out_tiles_fg_img) +IMAGE(3, GPU_R11F_G11F_B10F, WRITE, FLOAT_2D, out_tiles_bg_img) +COMPUTE_SOURCE("eevee_depth_of_field_tiles_flatten_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_depth_of_field_tiles_dilate) - .additional_info("eevee_shared") - .additional_info("draw_view") - .additional_info("eevee_depth_of_field_tiles_common") - .local_group_size(DOF_TILES_DILATE_GROUP_SIZE, DOF_TILES_DILATE_GROUP_SIZE) - .image(2, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_tiles_fg_img") - .image(3, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_tiles_bg_img") - .push_constant(Type::INT, "ring_count") - .push_constant(Type::INT, "ring_width_multiplier") - .compute_source("eevee_depth_of_field_tiles_dilate_comp.glsl"); +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_depth_of_field_tiles_common) +LOCAL_GROUP_SIZE(DOF_TILES_DILATE_GROUP_SIZE, DOF_TILES_DILATE_GROUP_SIZE) +IMAGE(2, GPU_R11F_G11F_B10F, WRITE, FLOAT_2D, out_tiles_fg_img) +IMAGE(3, GPU_R11F_G11F_B10F, WRITE, FLOAT_2D, out_tiles_bg_img) +PUSH_CONSTANT(INT, ring_count) +PUSH_CONSTANT(INT, ring_width_multiplier) +COMPUTE_SOURCE("eevee_depth_of_field_tiles_dilate_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_depth_of_field_tiles_dilate_minabs) - .do_static_compilation(true) - .define("DILATE_MODE_MIN_MAX", "false") - .additional_info("eevee_depth_of_field_tiles_dilate"); +DO_STATIC_COMPILATION() +DEFINE_VALUE("DILATE_MODE_MIN_MAX", "false") +ADDITIONAL_INFO(eevee_depth_of_field_tiles_dilate) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_depth_of_field_tiles_dilate_minmax) - .do_static_compilation(true) - .define("DILATE_MODE_MIN_MAX", "true") - .additional_info("eevee_depth_of_field_tiles_dilate"); +DO_STATIC_COMPILATION() +DEFINE_VALUE("DILATE_MODE_MIN_MAX", "true") +ADDITIONAL_INFO(eevee_depth_of_field_tiles_dilate) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_depth_of_field_tiles_common) - .image(0, GPU_R11F_G11F_B10F, Qualifier::READ, ImageType::FLOAT_2D, "in_tiles_fg_img") - .image(1, GPU_R11F_G11F_B10F, Qualifier::READ, ImageType::FLOAT_2D, "in_tiles_bg_img"); +IMAGE(0, GPU_R11F_G11F_B10F, READ, FLOAT_2D, in_tiles_fg_img) +IMAGE(1, GPU_R11F_G11F_B10F, READ, FLOAT_2D, in_tiles_bg_img) +GPU_SHADER_CREATE_END() /** \} */ @@ -129,19 +139,25 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_tiles_common) * \{ */ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_no_lut) - .define("DOF_BOKEH_TEXTURE", "false") - /** - * WORKAROUND(@fclem): This is to keep the code as is for now. The bokeh_lut_tx is referenced - * even if not used after optimization. But we don't want to include it in the create infos. - */ - .define("bokeh_lut_tx", "color_tx"); +DEFINE_VALUE("DOF_BOKEH_TEXTURE", "false") +/** + * WORKAROUND(@fclem): This is to keep the code as is for now. The bokeh_lut_tx is referenced + * even if not used after optimization. But we don't want to include it in the create infos. + */ +DEFINE_VALUE("bokeh_lut_tx", "color_tx") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_depth_of_field_lut) - .define("DOF_BOKEH_TEXTURE", "true") - .sampler(5, ImageType::FLOAT_2D, "bokeh_lut_tx"); +DEFINE_VALUE("DOF_BOKEH_TEXTURE", "true") +SAMPLER(5, FLOAT_2D, bokeh_lut_tx) +GPU_SHADER_CREATE_END() -GPU_SHADER_CREATE_INFO(eevee_depth_of_field_background).define("DOF_FOREGROUND_PASS", "false"); -GPU_SHADER_CREATE_INFO(eevee_depth_of_field_foreground).define("DOF_FOREGROUND_PASS", "true"); +GPU_SHADER_CREATE_INFO(eevee_depth_of_field_background) +DEFINE_VALUE("DOF_FOREGROUND_PASS", "false") +GPU_SHADER_CREATE_END() +GPU_SHADER_CREATE_INFO(eevee_depth_of_field_foreground) +DEFINE_VALUE("DOF_FOREGROUND_PASS", "true") +GPU_SHADER_CREATE_END() #define EEVEE_DOF_LUT_VARIATIONS(prefix, ...) \ CREATE_INFO_VARIANT(prefix##_lut, eevee_depth_of_field_lut, __VA_ARGS__) \ @@ -158,40 +174,44 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_foreground).define("DOF_FOREGROUND_P * \{ */ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_gather_common) - .additional_info("eevee_shared") - .additional_info("draw_view") - .additional_info("eevee_depth_of_field_tiles_common") - .additional_info("eevee_sampling_data") - .uniform_buf(6, "DepthOfFieldData", "dof_buf") - .local_group_size(DOF_GATHER_GROUP_SIZE, DOF_GATHER_GROUP_SIZE) - .sampler(0, ImageType::FLOAT_2D, "color_tx") - .sampler(1, ImageType::FLOAT_2D, "color_bilinear_tx") - .sampler(2, ImageType::FLOAT_2D, "coc_tx") - .image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img") - .image(3, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_weight_img"); +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_depth_of_field_tiles_common) +ADDITIONAL_INFO(eevee_sampling_data) +UNIFORM_BUF(6, DepthOfFieldData, dof_buf) +LOCAL_GROUP_SIZE(DOF_GATHER_GROUP_SIZE, DOF_GATHER_GROUP_SIZE) +SAMPLER(0, FLOAT_2D, color_tx) +SAMPLER(1, FLOAT_2D, color_bilinear_tx) +SAMPLER(2, FLOAT_2D, coc_tx) +IMAGE(2, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_img) +IMAGE(3, GPU_R16F, WRITE, FLOAT_2D, out_weight_img) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_depth_of_field_gather) - .image(4, GPU_RG16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_occlusion_img") - .compute_source("eevee_depth_of_field_gather_comp.glsl") - .additional_info("eevee_depth_of_field_gather_common"); +IMAGE(4, GPU_RG16F, WRITE, FLOAT_2D, out_occlusion_img) +COMPUTE_SOURCE("eevee_depth_of_field_gather_comp.glsl") +ADDITIONAL_INFO(eevee_depth_of_field_gather_common) +GPU_SHADER_CREATE_END() EEVEE_DOF_GROUND_VARIATIONS(eevee_depth_of_field_gather, eevee_depth_of_field_gather) GPU_SHADER_CREATE_INFO(eevee_depth_of_field_hole_fill) - .do_static_compilation(true) - .compute_source("eevee_depth_of_field_hole_fill_comp.glsl") - .additional_info("eevee_depth_of_field_gather_common") - .additional_info("eevee_depth_of_field_no_lut"); +DO_STATIC_COMPILATION() +COMPUTE_SOURCE("eevee_depth_of_field_hole_fill_comp.glsl") +ADDITIONAL_INFO(eevee_depth_of_field_gather_common) +ADDITIONAL_INFO(eevee_depth_of_field_no_lut) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_depth_of_field_filter) - .do_static_compilation(true) - .local_group_size(DOF_FILTER_GROUP_SIZE, DOF_FILTER_GROUP_SIZE) - .additional_info("eevee_shared") - .sampler(0, ImageType::FLOAT_2D, "color_tx") - .sampler(1, ImageType::FLOAT_2D, "weight_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img") - .image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_weight_img") - .compute_source("eevee_depth_of_field_filter_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(DOF_FILTER_GROUP_SIZE, DOF_FILTER_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +SAMPLER(0, FLOAT_2D, color_tx) +SAMPLER(1, FLOAT_2D, weight_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_img) +IMAGE(1, GPU_R16F, WRITE, FLOAT_2D, out_weight_img) +COMPUTE_SOURCE("eevee_depth_of_field_filter_comp.glsl") +GPU_SHADER_CREATE_END() /** \} */ @@ -200,35 +220,38 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_filter) * \{ */ GPU_SHADER_NAMED_INTERFACE_INFO(eevee_depth_of_field_scatter_flat_iface, interp_flat) - /** Colors, weights, and Circle of confusion radii for the 4 pixels to scatter. */ - .flat(Type::VEC4, "color_and_coc1") - .flat(Type::VEC4, "color_and_coc2") - .flat(Type::VEC4, "color_and_coc3") - .flat(Type::VEC4, "color_and_coc4") - /** Scaling factor for the bokeh distance. */ - .flat(Type::FLOAT, "distance_scale"); +/** Colors, weights, and Circle of confusion radii for the 4 pixels to scatter. */ +FLAT(VEC4, color_and_coc1) +FLAT(VEC4, color_and_coc2) +FLAT(VEC4, color_and_coc3) +FLAT(VEC4, color_and_coc4) +/** Scaling factor for the bokeh distance. */ +FLAT(FLOAT, distance_scale) +GPU_SHADER_NAMED_INTERFACE_END(interp_flat) GPU_SHADER_NAMED_INTERFACE_INFO(eevee_depth_of_field_scatter_noperspective_iface, interp_noperspective) - /** Sprite pixel position with origin at sprite center. In pixels. */ - .no_perspective(Type::VEC2, "rect_uv1") - .no_perspective(Type::VEC2, "rect_uv2") - .no_perspective(Type::VEC2, "rect_uv3") - .no_perspective(Type::VEC2, "rect_uv4"); +/** Sprite pixel position with origin at sprite center. In pixels. */ +NO_PERSPECTIVE(VEC2, rect_uv1) +NO_PERSPECTIVE(VEC2, rect_uv2) +NO_PERSPECTIVE(VEC2, rect_uv3) +NO_PERSPECTIVE(VEC2, rect_uv4) +GPU_SHADER_NAMED_INTERFACE_END(interp_noperspective) GPU_SHADER_CREATE_INFO(eevee_depth_of_field_scatter) - .do_static_compilation(true) - .additional_info("eevee_shared") - .additional_info("draw_view") - .sampler(0, ImageType::FLOAT_2D, "occlusion_tx") - .sampler(1, ImageType::FLOAT_2D, "bokeh_lut_tx") - .uniform_buf(6, "DepthOfFieldData", "dof_buf") - .storage_buf(0, Qualifier::READ, "ScatterRect", "scatter_list_buf[]") - .fragment_out(0, Type::VEC4, "out_color") - .push_constant(Type::BOOL, "use_bokeh_lut") - .vertex_out(eevee_depth_of_field_scatter_flat_iface) - .vertex_out(eevee_depth_of_field_scatter_noperspective_iface) - .vertex_source("eevee_depth_of_field_scatter_vert.glsl") - .fragment_source("eevee_depth_of_field_scatter_frag.glsl"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +SAMPLER(0, FLOAT_2D, occlusion_tx) +SAMPLER(1, FLOAT_2D, bokeh_lut_tx) +UNIFORM_BUF(6, DepthOfFieldData, dof_buf) +STORAGE_BUF(0, READ, ScatterRect, scatter_list_buf[]) +FRAGMENT_OUT(0, VEC4, out_color) +PUSH_CONSTANT(BOOL, use_bokeh_lut) +VERTEX_OUT(eevee_depth_of_field_scatter_flat_iface) +VERTEX_OUT(eevee_depth_of_field_scatter_noperspective_iface) +VERTEX_SOURCE("eevee_depth_of_field_scatter_vert.glsl") +FRAGMENT_SOURCE("eevee_depth_of_field_scatter_frag.glsl") +GPU_SHADER_CREATE_END() /** \} */ @@ -237,25 +260,26 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_scatter) * \{ */ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_resolve) - .define("DOF_RESOLVE_PASS", "true") - .local_group_size(DOF_RESOLVE_GROUP_SIZE, DOF_RESOLVE_GROUP_SIZE) - .specialization_constant(Type::BOOL, "do_debug_color", false) - .additional_info("eevee_shared") - .additional_info("draw_view") - .additional_info("eevee_depth_of_field_tiles_common") - .additional_info("eevee_sampling_data") - .uniform_buf(6, "DepthOfFieldData", "dof_buf") - .sampler(0, ImageType::DEPTH_2D, "depth_tx") - .sampler(1, ImageType::FLOAT_2D, "color_tx") - .sampler(2, ImageType::FLOAT_2D, "color_bg_tx") - .sampler(3, ImageType::FLOAT_2D, "color_fg_tx") - .sampler(4, ImageType::FLOAT_2D, "color_hole_fill_tx") - .sampler(7, ImageType::FLOAT_2D, "weight_bg_tx") - .sampler(8, ImageType::FLOAT_2D, "weight_fg_tx") - .sampler(9, ImageType::FLOAT_2D, "weight_hole_fill_tx") - .sampler(10, ImageType::FLOAT_2D, "stable_color_tx") - .image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img") - .compute_source("eevee_depth_of_field_resolve_comp.glsl"); +DEFINE_VALUE("DOF_RESOLVE_PASS", "true") +LOCAL_GROUP_SIZE(DOF_RESOLVE_GROUP_SIZE, DOF_RESOLVE_GROUP_SIZE) +SPECIALIZATION_CONSTANT(BOOL, do_debug_color, false) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_depth_of_field_tiles_common) +ADDITIONAL_INFO(eevee_sampling_data) +UNIFORM_BUF(6, DepthOfFieldData, dof_buf) +SAMPLER(0, DEPTH_2D, depth_tx) +SAMPLER(1, FLOAT_2D, color_tx) +SAMPLER(2, FLOAT_2D, color_bg_tx) +SAMPLER(3, FLOAT_2D, color_fg_tx) +SAMPLER(4, FLOAT_2D, color_hole_fill_tx) +SAMPLER(7, FLOAT_2D, weight_bg_tx) +SAMPLER(8, FLOAT_2D, weight_fg_tx) +SAMPLER(9, FLOAT_2D, weight_hole_fill_tx) +SAMPLER(10, FLOAT_2D, stable_color_tx) +IMAGE(2, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_img) +COMPUTE_SOURCE("eevee_depth_of_field_resolve_comp.glsl") +GPU_SHADER_CREATE_END() EEVEE_DOF_LUT_VARIATIONS(eevee_depth_of_field_resolve, eevee_depth_of_field_resolve) diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_film_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_film_info.hh index fda797d9833..091e80993a0 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_film_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_film_info.hh @@ -6,120 +6,131 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(eevee_film_base) - .sampler(0, ImageType::DEPTH_2D, "depth_tx") - .sampler(1, ImageType::FLOAT_2D, "combined_tx") - .sampler(2, ImageType::FLOAT_2D, "vector_tx") - .sampler(3, ImageType::FLOAT_2D_ARRAY, "rp_color_tx") - .sampler(4, ImageType::FLOAT_2D_ARRAY, "rp_value_tx") - /* Color History for TAA needs to be sampler to leverage bilinear sampling. */ - .sampler(5, ImageType::FLOAT_2D, "in_combined_tx") - .sampler(6, ImageType::FLOAT_2D, "cryptomatte_tx") - .image(0, GPU_R32F, Qualifier::READ, ImageType::FLOAT_2D_ARRAY, "in_weight_img") - .image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_weight_img") - .specialization_constant(Type::UINT, "enabled_categories", 0) - .specialization_constant(Type::INT, "samples_len", 0) - .specialization_constant(Type::BOOL, "use_reprojection", false) - .specialization_constant(Type::INT, "scaling_factor", 1) - .specialization_constant(Type::INT, "combined_id", 0) - .specialization_constant(Type::INT, "display_id", -1) - .specialization_constant(Type::INT, "normal_id", -1) - .additional_info("eevee_shared") - .additional_info("eevee_global_ubo") - .additional_info("eevee_velocity_camera") - .additional_info("draw_view"); +SAMPLER(0, DEPTH_2D, depth_tx) +SAMPLER(1, FLOAT_2D, combined_tx) +SAMPLER(2, FLOAT_2D, vector_tx) +SAMPLER(3, FLOAT_2D_ARRAY, rp_color_tx) +SAMPLER(4, FLOAT_2D_ARRAY, rp_value_tx) +/* Color History for TAA needs to be sampler to leverage bilinear sampling. */ +SAMPLER(5, FLOAT_2D, in_combined_tx) +SAMPLER(6, FLOAT_2D, cryptomatte_tx) +IMAGE(0, GPU_R32F, READ, FLOAT_2D_ARRAY, in_weight_img) +IMAGE(1, GPU_R32F, WRITE, FLOAT_2D_ARRAY, out_weight_img) +SPECIALIZATION_CONSTANT(UINT, enabled_categories, 0) +SPECIALIZATION_CONSTANT(INT, samples_len, 0) +SPECIALIZATION_CONSTANT(BOOL, use_reprojection, false) +SPECIALIZATION_CONSTANT(INT, scaling_factor, 1) +SPECIALIZATION_CONSTANT(INT, combined_id, 0) +SPECIALIZATION_CONSTANT(INT, display_id, -1) +SPECIALIZATION_CONSTANT(INT, normal_id, -1) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_velocity_camera) +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_film) - /* Color History for TAA needs to be sampler to leverage bilinear sampling. */ - //.image(2, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "in_combined_img") - .image(3, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_combined_img") - .image(4, GPU_R32F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "depth_img") - .image(5, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D_ARRAY, "color_accum_img") - .image(6, GPU_R16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D_ARRAY, "value_accum_img") - .image(7, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_2D_ARRAY, "cryptomatte_img") - .additional_info("eevee_film_base"); +/* Color History for TAA needs to be sampler to leverage bilinear sampling. */ +// IMAGE(2, GPU_RGBA16F, READ, FLOAT_2D, in_combined_img) +IMAGE(3, GPU_RGBA16F, WRITE, FLOAT_2D, out_combined_img) +IMAGE(4, GPU_R32F, READ_WRITE, FLOAT_2D, depth_img) +IMAGE(5, GPU_RGBA16F, READ_WRITE, FLOAT_2D_ARRAY, color_accum_img) +IMAGE(6, GPU_R16F, READ_WRITE, FLOAT_2D_ARRAY, value_accum_img) +IMAGE(7, GPU_RGBA32F, READ_WRITE, FLOAT_2D_ARRAY, cryptomatte_img) +ADDITIONAL_INFO(eevee_film_base) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_film_frag) - .do_static_compilation(true) - .fragment_out(0, Type::VEC4, "out_color") - .fragment_source("eevee_film_frag.glsl") - .additional_info("draw_fullscreen") - .additional_info("eevee_film") - .depth_write(DepthWrite::ANY); +DO_STATIC_COMPILATION() +FRAGMENT_OUT(0, VEC4, out_color) +FRAGMENT_SOURCE("eevee_film_frag.glsl") +ADDITIONAL_INFO(draw_fullscreen) +ADDITIONAL_INFO(eevee_film) +DEPTH_WRITE(DepthWrite::ANY) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_film_comp) - .do_static_compilation(true) - .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE) - .compute_source("eevee_film_comp.glsl") - .additional_info("eevee_film"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) +COMPUTE_SOURCE("eevee_film_comp.glsl") +ADDITIONAL_INFO(eevee_film) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_film_cryptomatte_post) - .do_static_compilation(true) - .image(0, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_2D_ARRAY, "cryptomatte_img") - .push_constant(Type::INT, "cryptomatte_layer_len") - .push_constant(Type::INT, "cryptomatte_samples_per_layer") - .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE) - .compute_source("eevee_film_cryptomatte_post_comp.glsl") - .additional_info("eevee_global_ubo") - .additional_info("eevee_shared"); +DO_STATIC_COMPILATION() +IMAGE(0, GPU_RGBA32F, READ_WRITE, FLOAT_2D_ARRAY, cryptomatte_img) +PUSH_CONSTANT(INT, cryptomatte_layer_len) +PUSH_CONSTANT(INT, cryptomatte_samples_per_layer) +LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) +COMPUTE_SOURCE("eevee_film_cryptomatte_post_comp.glsl") +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_shared) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_film_copy_frag) - .do_static_compilation(true) - .image(3, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "out_combined_img") - .image(4, GPU_R32F, Qualifier::READ, ImageType::FLOAT_2D, "depth_img") - .image(5, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D_ARRAY, "color_accum_img") - .image(6, GPU_R16F, Qualifier::READ, ImageType::FLOAT_2D_ARRAY, "value_accum_img") - .image(7, GPU_RGBA32F, Qualifier::READ, ImageType::FLOAT_2D_ARRAY, "cryptomatte_img") - .depth_write(DepthWrite::ANY) - .fragment_out(0, Type::VEC4, "out_color") - .fragment_source("eevee_film_copy_frag.glsl") - .define("FILM_COPY") - .additional_info("draw_fullscreen") - .additional_info("eevee_film_base"); +DO_STATIC_COMPILATION() +IMAGE(3, GPU_RGBA16F, READ, FLOAT_2D, out_combined_img) +IMAGE(4, GPU_R32F, READ, FLOAT_2D, depth_img) +IMAGE(5, GPU_RGBA16F, READ, FLOAT_2D_ARRAY, color_accum_img) +IMAGE(6, GPU_R16F, READ, FLOAT_2D_ARRAY, value_accum_img) +IMAGE(7, GPU_RGBA32F, READ, FLOAT_2D_ARRAY, cryptomatte_img) +DEPTH_WRITE(DepthWrite::ANY) +FRAGMENT_OUT(0, VEC4, out_color) +FRAGMENT_SOURCE("eevee_film_copy_frag.glsl") +DEFINE("FILM_COPY") +ADDITIONAL_INFO(draw_fullscreen) +ADDITIONAL_INFO(eevee_film_base) +GPU_SHADER_CREATE_END() /* The combined pass is stored into its own 2D texture with a format of GPU_RGBA16F. */ GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_combined) - .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE) - .push_constant(Type::IVEC2, "offset") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("eevee_film_pass_convert_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) +PUSH_CONSTANT(IVEC2, offset) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("eevee_film_pass_convert_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* The depth pass is stored into its own 2D texture with a format of GPU_R32F. */ GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_depth) - .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE) - .push_constant(Type::IVEC2, "offset") - .sampler(0, ImageType::FLOAT_2D, "input_tx") - .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("eevee_film_pass_convert_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) +PUSH_CONSTANT(IVEC2, offset) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("eevee_film_pass_convert_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* Value passes are stored in a slice of a 2D texture array with a format of GPU_R16F. */ GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_value) - .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE) - .push_constant(Type::IVEC2, "offset") - .define("IS_ARRAY_INPUT") - .sampler(0, ImageType::FLOAT_2D_ARRAY, "input_tx") - .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("eevee_film_pass_convert_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) +PUSH_CONSTANT(IVEC2, offset) +DEFINE("IS_ARRAY_INPUT") +SAMPLER(0, FLOAT_2D_ARRAY, input_tx) +IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("eevee_film_pass_convert_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* Color passes are stored in a slice of a 2D texture array with a format of GPU_RGBA16F. */ GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_color) - .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE) - .push_constant(Type::IVEC2, "offset") - .define("IS_ARRAY_INPUT") - .sampler(0, ImageType::FLOAT_2D_ARRAY, "input_tx") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("eevee_film_pass_convert_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) +PUSH_CONSTANT(IVEC2, offset) +DEFINE("IS_ARRAY_INPUT") +SAMPLER(0, FLOAT_2D_ARRAY, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("eevee_film_pass_convert_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /* Cryptomatte passes are stored in a slice of a 2D texture array with a format of GPU_RGBA32F. */ GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_cryptomatte) - .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE) - .push_constant(Type::IVEC2, "offset") - .define("IS_ARRAY_INPUT") - .sampler(0, ImageType::FLOAT_2D_ARRAY, "input_tx") - .image(0, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img") - .compute_source("eevee_film_pass_convert_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) +PUSH_CONSTANT(IVEC2, offset) +DEFINE("IS_ARRAY_INPUT") +SAMPLER(0, FLOAT_2D_ARRAY, input_tx) +IMAGE(0, GPU_RGBA32F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("eevee_film_pass_convert_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_hiz_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_hiz_info.hh index 8cf9d74d78a..751b2f20631 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_hiz_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_hiz_info.hh @@ -6,39 +6,44 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(eevee_hiz_data) - .sampler(HIZ_TEX_SLOT, ImageType::FLOAT_2D, "hiz_tx") - .additional_info("eevee_global_ubo"); +SAMPLER(HIZ_TEX_SLOT, FLOAT_2D, hiz_tx) +ADDITIONAL_INFO(eevee_global_ubo) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_hiz_update_base) - .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE) - .storage_buf(0, Qualifier::READ_WRITE, "uint", "finished_tile_counter") - .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_mip_0") - .image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_mip_1") - .image(2, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_mip_2") - .image(3, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_mip_3") - .image(4, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_mip_4") - .image(5, GPU_R32F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "out_mip_5") - .image(6, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_mip_6") - .specialization_constant(Type::BOOL, "update_mip_0", true) - .compute_source("eevee_hiz_update_comp.glsl"); +LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) +STORAGE_BUF(0, READ_WRITE, uint, finished_tile_counter) +IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, out_mip_0) +IMAGE(1, GPU_R32F, WRITE, FLOAT_2D, out_mip_1) +IMAGE(2, GPU_R32F, WRITE, FLOAT_2D, out_mip_2) +IMAGE(3, GPU_R32F, WRITE, FLOAT_2D, out_mip_3) +IMAGE(4, GPU_R32F, WRITE, FLOAT_2D, out_mip_4) +IMAGE(5, GPU_R32F, READ_WRITE, FLOAT_2D, out_mip_5) +IMAGE(6, GPU_R32F, WRITE, FLOAT_2D, out_mip_6) +SPECIALIZATION_CONSTANT(BOOL, update_mip_0, true) +COMPUTE_SOURCE("eevee_hiz_update_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_hiz_update) - .do_static_compilation(true) - .sampler(0, ImageType::DEPTH_2D, "depth_tx") - .additional_info("eevee_hiz_update_base"); +DO_STATIC_COMPILATION() +SAMPLER(0, DEPTH_2D, depth_tx) +ADDITIONAL_INFO(eevee_hiz_update_base) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_hiz_update_layer) - .do_static_compilation(true) - .define("HIZ_LAYER") - .sampler(1, ImageType::DEPTH_2D_ARRAY, "depth_layered_tx") - .push_constant(Type::INT, "layer_id") - .additional_info("eevee_hiz_update_base"); +DO_STATIC_COMPILATION() +DEFINE("HIZ_LAYER") +SAMPLER(1, DEPTH_2D_ARRAY, depth_layered_tx) +PUSH_CONSTANT(INT, layer_id) +ADDITIONAL_INFO(eevee_hiz_update_base) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_hiz_debug) - .do_static_compilation(true) - .fragment_out(0, Type::VEC4, "out_debug_color_add", DualBlend::SRC_0) - .fragment_out(0, Type::VEC4, "out_debug_color_mul", DualBlend::SRC_1) - .fragment_source("eevee_hiz_debug_frag.glsl") - .additional_info("eevee_shared") - .additional_info("eevee_hiz_data") - .additional_info("draw_fullscreen"); +DO_STATIC_COMPILATION() +FRAGMENT_OUT_DUAL(0, VEC4, out_debug_color_add, SRC_0) +FRAGMENT_OUT_DUAL(0, VEC4, out_debug_color_mul, SRC_1) +FRAGMENT_SOURCE("eevee_hiz_debug_frag.glsl") +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_hiz_data) +ADDITIONAL_INFO(draw_fullscreen) +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_light_culling_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_light_culling_info.hh index f2170dc6e76..14d884da5f3 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_light_culling_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_light_culling_info.hh @@ -10,10 +10,11 @@ * \{ */ GPU_SHADER_CREATE_INFO(eevee_light_data) - .storage_buf(LIGHT_CULL_BUF_SLOT, Qualifier::READ, "LightCullingData", "light_cull_buf") - .storage_buf(LIGHT_BUF_SLOT, Qualifier::READ, "LightData", "light_buf[]") - .storage_buf(LIGHT_ZBIN_BUF_SLOT, Qualifier::READ, "uint", "light_zbin_buf[]") - .storage_buf(LIGHT_TILE_BUF_SLOT, Qualifier::READ, "uint", "light_tile_buf[]"); +STORAGE_BUF(LIGHT_CULL_BUF_SLOT, READ, LightCullingData, light_cull_buf) +STORAGE_BUF(LIGHT_BUF_SLOT, READ, LightData, light_buf[]) +STORAGE_BUF(LIGHT_ZBIN_BUF_SLOT, READ, uint, light_zbin_buf[]) +STORAGE_BUF(LIGHT_TILE_BUF_SLOT, READ, uint, light_tile_buf[]) +GPU_SHADER_CREATE_END() /** \} */ @@ -22,63 +23,68 @@ GPU_SHADER_CREATE_INFO(eevee_light_data) * \{ */ GPU_SHADER_CREATE_INFO(eevee_light_culling_select) - .do_static_compilation(true) - .additional_info("eevee_shared") - .additional_info("draw_view") - .additional_info("draw_view_culling") - .local_group_size(CULLING_SELECT_GROUP_SIZE) - .storage_buf(0, Qualifier::READ_WRITE, "LightCullingData", "light_cull_buf") - .storage_buf(1, Qualifier::READ, "LightData", "in_light_buf[]") - .storage_buf(2, Qualifier::WRITE, "LightData", "out_light_buf[]") - .storage_buf(3, Qualifier::WRITE, "float", "out_zdist_buf[]") - .storage_buf(4, Qualifier::WRITE, "uint", "out_key_buf[]") - .uniform_buf(0, "LightData", "sunlight_buf") - .compute_source("eevee_light_culling_select_comp.glsl"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_view_culling) +LOCAL_GROUP_SIZE(CULLING_SELECT_GROUP_SIZE) +STORAGE_BUF(0, READ_WRITE, LightCullingData, light_cull_buf) +STORAGE_BUF(1, READ, LightData, in_light_buf[]) +STORAGE_BUF(2, WRITE, LightData, out_light_buf[]) +STORAGE_BUF(3, WRITE, float, out_zdist_buf[]) +STORAGE_BUF(4, WRITE, uint, out_key_buf[]) +UNIFORM_BUF(0, LightData, sunlight_buf) +COMPUTE_SOURCE("eevee_light_culling_select_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_light_culling_sort) - .do_static_compilation(true) - .additional_info("eevee_shared") - .additional_info("draw_view") - .storage_buf(0, Qualifier::READ, "LightCullingData", "light_cull_buf") - .storage_buf(1, Qualifier::READ, "LightData", "in_light_buf[]") - .storage_buf(2, Qualifier::WRITE, "LightData", "out_light_buf[]") - .storage_buf(3, Qualifier::READ, "float", "in_zdist_buf[]") - .storage_buf(4, Qualifier::READ, "uint", "in_key_buf[]") - .local_group_size(CULLING_SORT_GROUP_SIZE) - .compute_source("eevee_light_culling_sort_comp.glsl"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +STORAGE_BUF(0, READ, LightCullingData, light_cull_buf) +STORAGE_BUF(1, READ, LightData, in_light_buf[]) +STORAGE_BUF(2, WRITE, LightData, out_light_buf[]) +STORAGE_BUF(3, READ, float, in_zdist_buf[]) +STORAGE_BUF(4, READ, uint, in_key_buf[]) +LOCAL_GROUP_SIZE(CULLING_SORT_GROUP_SIZE) +COMPUTE_SOURCE("eevee_light_culling_sort_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_light_culling_zbin) - .do_static_compilation(true) - .additional_info("eevee_shared") - .additional_info("draw_view") - .local_group_size(CULLING_ZBIN_GROUP_SIZE) - .storage_buf(0, Qualifier::READ, "LightCullingData", "light_cull_buf") - .storage_buf(1, Qualifier::READ, "LightData", "light_buf[]") - .storage_buf(2, Qualifier::WRITE, "uint", "out_zbin_buf[]") - .compute_source("eevee_light_culling_zbin_comp.glsl"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +LOCAL_GROUP_SIZE(CULLING_ZBIN_GROUP_SIZE) +STORAGE_BUF(0, READ, LightCullingData, light_cull_buf) +STORAGE_BUF(1, READ, LightData, light_buf[]) +STORAGE_BUF(2, WRITE, uint, out_zbin_buf[]) +COMPUTE_SOURCE("eevee_light_culling_zbin_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_light_culling_tile) - .do_static_compilation(true) - .additional_info("eevee_shared") - .additional_info("draw_view") - .additional_info("draw_view_culling") - .local_group_size(CULLING_TILE_GROUP_SIZE) - .storage_buf(0, Qualifier::READ, "LightCullingData", "light_cull_buf") - .storage_buf(1, Qualifier::READ, "LightData", "light_buf[]") - .storage_buf(2, Qualifier::WRITE, "uint", "out_light_tile_buf[]") - .compute_source("eevee_light_culling_tile_comp.glsl"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_view_culling) +LOCAL_GROUP_SIZE(CULLING_TILE_GROUP_SIZE) +STORAGE_BUF(0, READ, LightCullingData, light_cull_buf) +STORAGE_BUF(1, READ, LightData, light_buf[]) +STORAGE_BUF(2, WRITE, uint, out_light_tile_buf[]) +COMPUTE_SOURCE("eevee_light_culling_tile_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_light_shadow_setup) - .do_static_compilation(true) - .additional_info("eevee_shared") - .additional_info("eevee_sampling_data") - .additional_info("eevee_global_ubo") - .local_group_size(CULLING_SELECT_GROUP_SIZE) - .storage_buf(0, Qualifier::READ, "LightCullingData", "light_cull_buf") - .storage_buf(1, Qualifier::READ_WRITE, "LightData", "light_buf[]") - .storage_buf(2, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(3, Qualifier::READ_WRITE, "ShadowTileMapClip", "tilemaps_clip_buf[]") - .compute_source("eevee_light_shadow_setup_comp.glsl"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_global_ubo) +LOCAL_GROUP_SIZE(CULLING_SELECT_GROUP_SIZE) +STORAGE_BUF(0, READ, LightCullingData, light_cull_buf) +STORAGE_BUF(1, READ_WRITE, LightData, light_buf[]) +STORAGE_BUF(2, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) +STORAGE_BUF(3, READ_WRITE, ShadowTileMapClip, tilemaps_clip_buf[]) +COMPUTE_SOURCE("eevee_light_shadow_setup_comp.glsl") +GPU_SHADER_CREATE_END() /** \} */ @@ -87,11 +93,15 @@ GPU_SHADER_CREATE_INFO(eevee_light_shadow_setup) * \{ */ GPU_SHADER_CREATE_INFO(eevee_light_culling_debug) - .do_static_compilation(true) - .fragment_out(0, Type::VEC4, "out_debug_color_add", DualBlend::SRC_0) - .fragment_out(0, Type::VEC4, "out_debug_color_mul", DualBlend::SRC_1) - .fragment_source("eevee_light_culling_debug_frag.glsl") - .additional_info( - "eevee_shared", "draw_view", "draw_fullscreen", "eevee_light_data", "eevee_hiz_data"); +DO_STATIC_COMPILATION() +FRAGMENT_OUT_DUAL(0, VEC4, out_debug_color_add, SRC_0) +FRAGMENT_OUT_DUAL(0, VEC4, out_debug_color_mul, SRC_1) +FRAGMENT_SOURCE("eevee_light_culling_debug_frag.glsl") +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_fullscreen) +ADDITIONAL_INFO(eevee_light_data) +ADDITIONAL_INFO(eevee_hiz_data) +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_sphere_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_sphere_info.hh index cc7db1ccb89..d046954a462 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_sphere_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_sphere_info.hh @@ -10,106 +10,111 @@ * \{ */ GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_data) - .define("SPHERE_PROBE") - .uniform_buf(SPHERE_PROBE_BUF_SLOT, - "SphereProbeData", - "lightprobe_sphere_buf[SPHERE_PROBE_MAX]") - .sampler(SPHERE_PROBE_TEX_SLOT, ImageType::FLOAT_2D_ARRAY, "lightprobe_spheres_tx"); +DEFINE("SPHERE_PROBE") +UNIFORM_BUF(SPHERE_PROBE_BUF_SLOT, SphereProbeData, lightprobe_sphere_buf[SPHERE_PROBE_MAX]) +SAMPLER(SPHERE_PROBE_TEX_SLOT, FLOAT_2D_ARRAY, lightprobe_spheres_tx) +GPU_SHADER_CREATE_END() /* Sample cubemap and remap into an octahedral texture. */ GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_remap) - .local_group_size(SPHERE_PROBE_REMAP_GROUP_SIZE, SPHERE_PROBE_REMAP_GROUP_SIZE) - .specialization_constant(Type::BOOL, "extract_sh", true) - .specialization_constant(Type::BOOL, "extract_sun", true) - .push_constant(Type::IVEC4, "probe_coord_packed") - .push_constant(Type::IVEC4, "write_coord_packed") - .push_constant(Type::IVEC4, "world_coord_packed") - .sampler(0, ImageType::FLOAT_CUBE, "cubemap_tx") - .sampler(1, ImageType::FLOAT_2D_ARRAY, "atlas_tx") - .storage_buf(0, Qualifier::WRITE, "SphereProbeHarmonic", "out_sh[]") - .storage_buf(1, Qualifier::WRITE, "SphereProbeSunLight", "out_sun[]") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "atlas_img") - .compute_source("eevee_lightprobe_sphere_remap_comp.glsl") - .additional_info("eevee_shared") - .additional_info("eevee_global_ubo") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(SPHERE_PROBE_REMAP_GROUP_SIZE, SPHERE_PROBE_REMAP_GROUP_SIZE) +SPECIALIZATION_CONSTANT(BOOL, extract_sh, true) +SPECIALIZATION_CONSTANT(BOOL, extract_sun, true) +PUSH_CONSTANT(IVEC4, probe_coord_packed) +PUSH_CONSTANT(IVEC4, write_coord_packed) +PUSH_CONSTANT(IVEC4, world_coord_packed) +SAMPLER(0, FLOAT_CUBE, cubemap_tx) +SAMPLER(1, FLOAT_2D_ARRAY, atlas_tx) +STORAGE_BUF(0, WRITE, SphereProbeHarmonic, out_sh[]) +STORAGE_BUF(1, WRITE, SphereProbeSunLight, out_sun[]) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D_ARRAY, atlas_img) +COMPUTE_SOURCE("eevee_lightprobe_sphere_remap_comp.glsl") +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_global_ubo) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_irradiance) - .local_group_size(SPHERE_PROBE_SH_GROUP_SIZE) - .push_constant(Type::IVEC3, "probe_remap_dispatch_size") - .storage_buf(0, Qualifier::READ, "SphereProbeHarmonic", "in_sh[]") - .storage_buf(1, Qualifier::WRITE, "SphereProbeHarmonic", "out_sh") - .additional_info("eevee_shared") - .do_static_compilation(true) - .compute_source("eevee_lightprobe_sphere_irradiance_comp.glsl"); +LOCAL_GROUP_SIZE(SPHERE_PROBE_SH_GROUP_SIZE) +PUSH_CONSTANT(IVEC3, probe_remap_dispatch_size) +STORAGE_BUF(0, READ, SphereProbeHarmonic, in_sh[]) +STORAGE_BUF(1, WRITE, SphereProbeHarmonic, out_sh) +ADDITIONAL_INFO(eevee_shared) +DO_STATIC_COMPILATION() +COMPUTE_SOURCE("eevee_lightprobe_sphere_irradiance_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_sunlight) - .local_group_size(SPHERE_PROBE_SH_GROUP_SIZE) - .push_constant(Type::IVEC3, "probe_remap_dispatch_size") - .storage_buf(0, Qualifier::READ, "SphereProbeSunLight", "in_sun[]") - .storage_buf(1, Qualifier::WRITE, "LightData", "sunlight_buf") - .additional_info("eevee_shared") - .do_static_compilation(true) - .compute_source("eevee_lightprobe_sphere_sunlight_comp.glsl"); +LOCAL_GROUP_SIZE(SPHERE_PROBE_SH_GROUP_SIZE) +PUSH_CONSTANT(IVEC3, probe_remap_dispatch_size) +STORAGE_BUF(0, READ, SphereProbeSunLight, in_sun[]) +STORAGE_BUF(1, WRITE, LightData, sunlight_buf) +ADDITIONAL_INFO(eevee_shared) +DO_STATIC_COMPILATION() +COMPUTE_SOURCE("eevee_lightprobe_sphere_sunlight_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_select) - .local_group_size(SPHERE_PROBE_SELECT_GROUP_SIZE) - .storage_buf(0, - Qualifier::READ_WRITE, - "SphereProbeData", - "lightprobe_sphere_buf[SPHERE_PROBE_MAX]") - .push_constant(Type::INT, "lightprobe_sphere_count") - .additional_info("eevee_shared") - .additional_info("eevee_sampling_data") - .additional_info("eevee_global_ubo") - .additional_info("eevee_volume_probe_data") - .compute_source("eevee_lightprobe_sphere_select_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(SPHERE_PROBE_SELECT_GROUP_SIZE) +STORAGE_BUF(0, READ_WRITE, SphereProbeData, lightprobe_sphere_buf[SPHERE_PROBE_MAX]) +PUSH_CONSTANT(INT, lightprobe_sphere_count) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_volume_probe_data) +COMPUTE_SOURCE("eevee_lightprobe_sphere_select_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_convolve) - .local_group_size(SPHERE_PROBE_GROUP_SIZE, SPHERE_PROBE_GROUP_SIZE) - .additional_info("eevee_shared") - .push_constant(Type::IVEC4, "probe_coord_packed") - .push_constant(Type::IVEC4, "write_coord_packed") - .push_constant(Type::IVEC4, "read_coord_packed") - .push_constant(Type::INT, "read_lod") - .sampler(0, ImageType::FLOAT_CUBE, "cubemap_tx") - .sampler(1, ImageType::FLOAT_2D_ARRAY, "in_atlas_mip_tx") - .image(1, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_atlas_mip_img") - .compute_source("eevee_lightprobe_sphere_convolve_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(SPHERE_PROBE_GROUP_SIZE, SPHERE_PROBE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +PUSH_CONSTANT(IVEC4, probe_coord_packed) +PUSH_CONSTANT(IVEC4, write_coord_packed) +PUSH_CONSTANT(IVEC4, read_coord_packed) +PUSH_CONSTANT(INT, read_lod) +SAMPLER(0, FLOAT_CUBE, cubemap_tx) +SAMPLER(1, FLOAT_2D_ARRAY, in_atlas_mip_tx) +IMAGE(1, GPU_RGBA16F, WRITE, FLOAT_2D_ARRAY, out_atlas_mip_img) +COMPUTE_SOURCE("eevee_lightprobe_sphere_convolve_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(eevee_display_lightprobe_sphere_iface) - .smooth(Type::VEC3, "P") - .smooth(Type::VEC2, "lP") - .flat(Type::INT, "probe_index"); +SMOOTH(VEC3, P) +SMOOTH(VEC2, lP) +FLAT(INT, probe_index) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(eevee_display_lightprobe_sphere) - .additional_info("eevee_shared") - .additional_info("draw_view") - .additional_info("eevee_lightprobe_sphere_data") - .storage_buf(0, Qualifier::READ, "SphereProbeDisplayData", "display_data_buf[]") - .vertex_source("eevee_display_lightprobe_sphere_vert.glsl") - .vertex_out(eevee_display_lightprobe_sphere_iface) - .fragment_source("eevee_display_lightprobe_sphere_frag.glsl") - .fragment_out(0, Type::VEC4, "out_color") - .do_static_compilation(true); +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_lightprobe_sphere_data) +STORAGE_BUF(0, READ, SphereProbeDisplayData, display_data_buf[]) +VERTEX_SOURCE("eevee_display_lightprobe_sphere_vert.glsl") +VERTEX_OUT(eevee_display_lightprobe_sphere_iface) +FRAGMENT_SOURCE("eevee_display_lightprobe_sphere_frag.glsl") +FRAGMENT_OUT(0, VEC4, out_color) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(eevee_display_lightprobe_planar_iface) - .flat(Type::VEC3, "probe_normal") - .flat(Type::INT, "probe_index"); +FLAT(VEC3, probe_normal) +FLAT(INT, probe_index) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(eevee_display_lightprobe_planar) - .push_constant(Type::IVEC4, "world_coord_packed") - .additional_info("eevee_shared") - .additional_info("draw_view") - .additional_info("eevee_lightprobe_planar_data") - .additional_info("eevee_lightprobe_sphere_data") - .storage_buf(0, Qualifier::READ, "PlanarProbeDisplayData", "display_data_buf[]") - .vertex_source("eevee_display_lightprobe_planar_vert.glsl") - .vertex_out(eevee_display_lightprobe_planar_iface) - .fragment_source("eevee_display_lightprobe_planar_frag.glsl") - .fragment_out(0, Type::VEC4, "out_color") - .do_static_compilation(true); +PUSH_CONSTANT(IVEC4, world_coord_packed) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_lightprobe_planar_data) +ADDITIONAL_INFO(eevee_lightprobe_sphere_data) +STORAGE_BUF(0, READ, PlanarProbeDisplayData, display_data_buf[]) +VERTEX_SOURCE("eevee_display_lightprobe_planar_vert.glsl") +VERTEX_OUT(eevee_display_lightprobe_planar_iface) +FRAGMENT_SOURCE("eevee_display_lightprobe_planar_frag.glsl") +FRAGMENT_OUT(0, VEC4, out_color) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_volume_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_volume_info.hh index 9efe18ed10c..3221e6a465c 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_volume_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lightprobe_volume_info.hh @@ -10,58 +10,65 @@ * \{ */ GPU_SHADER_INTERFACE_INFO(eevee_debug_surfel_iface) - .smooth(Type::VEC3, "P") - .flat(Type::INT, "surfel_index"); +SMOOTH(VEC3, P) +FLAT(INT, surfel_index) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(eevee_debug_surfels) - .additional_info("eevee_shared") - .additional_info("draw_view") - .vertex_source("eevee_debug_surfels_vert.glsl") - .vertex_out(eevee_debug_surfel_iface) - .fragment_source("eevee_debug_surfels_frag.glsl") - .fragment_out(0, Type::VEC4, "out_color") - .storage_buf(0, Qualifier::READ, "Surfel", "surfels_buf[]") - .push_constant(Type::FLOAT, "debug_surfel_radius") - .push_constant(Type::INT, "debug_mode") - .do_static_compilation(true); +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +VERTEX_SOURCE("eevee_debug_surfels_vert.glsl") +VERTEX_OUT(eevee_debug_surfel_iface) +FRAGMENT_SOURCE("eevee_debug_surfels_frag.glsl") +FRAGMENT_OUT(0, VEC4, out_color) +STORAGE_BUF(0, READ, Surfel, surfels_buf[]) +PUSH_CONSTANT(FLOAT, debug_surfel_radius) +PUSH_CONSTANT(INT, debug_mode) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() -GPU_SHADER_INTERFACE_INFO(eevee_debug_irradiance_grid_iface).smooth(Type::VEC4, "interp_color"); +GPU_SHADER_INTERFACE_INFO(eevee_debug_irradiance_grid_iface) +SMOOTH(VEC4, interp_color) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(eevee_debug_irradiance_grid) - .additional_info("eevee_shared") - .additional_info("draw_view") - .fragment_out(0, Type::VEC4, "out_color") - .vertex_out(eevee_debug_irradiance_grid_iface) - .sampler(0, ImageType::FLOAT_3D, "debug_data_tx") - .push_constant(Type::MAT4, "grid_mat") - .push_constant(Type::INT, "debug_mode") - .push_constant(Type::FLOAT, "debug_value") - .vertex_source("eevee_debug_irradiance_grid_vert.glsl") - .fragment_source("eevee_debug_irradiance_grid_frag.glsl") - .do_static_compilation(true); +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +FRAGMENT_OUT(0, VEC4, out_color) +VERTEX_OUT(eevee_debug_irradiance_grid_iface) +SAMPLER(0, FLOAT_3D, debug_data_tx) +PUSH_CONSTANT(MAT4, grid_mat) +PUSH_CONSTANT(INT, debug_mode) +PUSH_CONSTANT(FLOAT, debug_value) +VERTEX_SOURCE("eevee_debug_irradiance_grid_vert.glsl") +FRAGMENT_SOURCE("eevee_debug_irradiance_grid_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_INTERFACE_INFO(eevee_display_lightprobe_volume_iface) - .smooth(Type::VEC2, "lP") - .flat(Type::IVEC3, "cell"); +SMOOTH(VEC2, lP) +FLAT(IVEC3, cell) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(eevee_display_lightprobe_volume) - .additional_info("eevee_shared") - .additional_info("draw_view") - .vertex_source("eevee_display_lightprobe_volume_vert.glsl") - .vertex_out(eevee_display_lightprobe_volume_iface) - .fragment_source("eevee_display_lightprobe_volume_frag.glsl") - .fragment_out(0, Type::VEC4, "out_color") - .push_constant(Type::FLOAT, "sphere_radius") - .push_constant(Type::IVEC3, "grid_resolution") - .push_constant(Type::MAT4, "grid_to_world") - .push_constant(Type::MAT4, "world_to_grid") - .push_constant(Type::BOOL, "display_validity") - .sampler(0, ImageType::FLOAT_3D, "irradiance_a_tx") - .sampler(1, ImageType::FLOAT_3D, "irradiance_b_tx") - .sampler(2, ImageType::FLOAT_3D, "irradiance_c_tx") - .sampler(3, ImageType::FLOAT_3D, "irradiance_d_tx") - .sampler(4, ImageType::FLOAT_3D, "validity_tx") - .do_static_compilation(true); +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +VERTEX_SOURCE("eevee_display_lightprobe_volume_vert.glsl") +VERTEX_OUT(eevee_display_lightprobe_volume_iface) +FRAGMENT_SOURCE("eevee_display_lightprobe_volume_frag.glsl") +FRAGMENT_OUT(0, VEC4, out_color) +PUSH_CONSTANT(FLOAT, sphere_radius) +PUSH_CONSTANT(IVEC3, grid_resolution) +PUSH_CONSTANT(MAT4, grid_to_world) +PUSH_CONSTANT(MAT4, world_to_grid) +PUSH_CONSTANT(BOOL, display_validity) +SAMPLER(0, FLOAT_3D, irradiance_a_tx) +SAMPLER(1, FLOAT_3D, irradiance_b_tx) +SAMPLER(2, FLOAT_3D, irradiance_c_tx) +SAMPLER(3, FLOAT_3D, irradiance_d_tx) +SAMPLER(4, FLOAT_3D, validity_tx) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /** \} */ @@ -70,108 +77,117 @@ GPU_SHADER_CREATE_INFO(eevee_display_lightprobe_volume) * \{ */ GPU_SHADER_CREATE_INFO(eevee_surfel_common) - .storage_buf(SURFEL_BUF_SLOT, Qualifier::READ_WRITE, "Surfel", "surfel_buf[]") - .storage_buf(CAPTURE_BUF_SLOT, Qualifier::READ, "CaptureInfoData", "capture_info_buf"); +STORAGE_BUF(SURFEL_BUF_SLOT, READ_WRITE, Surfel, surfel_buf[]) +STORAGE_BUF(CAPTURE_BUF_SLOT, READ, CaptureInfoData, capture_info_buf) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surfel_light) - .define("LIGHT_ITER_FORCE_NO_CULLING") - .define("LIGHT_CLOSURE_EVAL_COUNT", "1") - .local_group_size(SURFEL_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("draw_view") - .additional_info("eevee_global_ubo") - .additional_info("eevee_utility_texture") - .additional_info("eevee_surfel_common") - .additional_info("eevee_light_data") - .additional_info("eevee_shadow_data") - .compute_source("eevee_surfel_light_comp.glsl") - .do_static_compilation(true); +DEFINE("LIGHT_ITER_FORCE_NO_CULLING") +DEFINE_VALUE("LIGHT_CLOSURE_EVAL_COUNT", "1") +LOCAL_GROUP_SIZE(SURFEL_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_utility_texture) +ADDITIONAL_INFO(eevee_surfel_common) +ADDITIONAL_INFO(eevee_light_data) +ADDITIONAL_INFO(eevee_shadow_data) +COMPUTE_SOURCE("eevee_surfel_light_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surfel_cluster_build) - .local_group_size(SURFEL_GROUP_SIZE) - .builtins(BuiltinBits::TEXTURE_ATOMIC) - .additional_info("eevee_shared") - .additional_info("eevee_surfel_common") - .additional_info("draw_view") - .image(0, GPU_R32I, Qualifier::READ_WRITE, ImageType::INT_3D_ATOMIC, "cluster_list_img") - .compute_source("eevee_surfel_cluster_build_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(SURFEL_GROUP_SIZE) +BUILTINS(BuiltinBits::TEXTURE_ATOMIC) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_surfel_common) +ADDITIONAL_INFO(draw_view) +IMAGE(0, GPU_R32I, READ_WRITE, INT_3D_ATOMIC, cluster_list_img) +COMPUTE_SOURCE("eevee_surfel_cluster_build_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surfel_list_build) - .local_group_size(SURFEL_GROUP_SIZE) - .builtins(BuiltinBits::TEXTURE_ATOMIC) - .additional_info("eevee_shared") - .additional_info("eevee_surfel_common") - .additional_info("draw_view") - .storage_buf(0, Qualifier::READ_WRITE, "int", "list_start_buf[]") - .storage_buf(6, Qualifier::READ_WRITE, "SurfelListInfoData", "list_info_buf") - .compute_source("eevee_surfel_list_build_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(SURFEL_GROUP_SIZE) +BUILTINS(BuiltinBits::TEXTURE_ATOMIC) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_surfel_common) +ADDITIONAL_INFO(draw_view) +STORAGE_BUF(0, READ_WRITE, int, list_start_buf[]) +STORAGE_BUF(6, READ_WRITE, SurfelListInfoData, list_info_buf) +COMPUTE_SOURCE("eevee_surfel_list_build_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surfel_list_sort) - .local_group_size(SURFEL_LIST_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_surfel_common") - .additional_info("draw_view") - .storage_buf(0, Qualifier::READ_WRITE, "int", "list_start_buf[]") - .storage_buf(6, Qualifier::READ, "SurfelListInfoData", "list_info_buf") - .compute_source("eevee_surfel_list_sort_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(SURFEL_LIST_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_surfel_common) +ADDITIONAL_INFO(draw_view) +STORAGE_BUF(0, READ_WRITE, int, list_start_buf[]) +STORAGE_BUF(6, READ, SurfelListInfoData, list_info_buf) +COMPUTE_SOURCE("eevee_surfel_list_sort_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surfel_ray) - .local_group_size(SURFEL_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_surfel_common") - .additional_info("eevee_lightprobe_sphere_data") - .additional_info("draw_view") - .push_constant(Type::INT, "radiance_src") - .push_constant(Type::INT, "radiance_dst") - .compute_source("eevee_surfel_ray_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(SURFEL_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_surfel_common) +ADDITIONAL_INFO(eevee_lightprobe_sphere_data) +ADDITIONAL_INFO(draw_view) +PUSH_CONSTANT(INT, radiance_src) +PUSH_CONSTANT(INT, radiance_dst) +COMPUTE_SOURCE("eevee_surfel_ray_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_bounds) - .do_static_compilation(true) - .local_group_size(IRRADIANCE_BOUNDS_GROUP_SIZE) - .storage_buf(0, Qualifier::READ_WRITE, "CaptureInfoData", "capture_info_buf") - .storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") - .push_constant(Type::INT, "resource_len") - .typedef_source("draw_shader_shared.hh") - .additional_info("eevee_shared") - .compute_source("eevee_lightprobe_volume_bounds_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(IRRADIANCE_BOUNDS_GROUP_SIZE) +STORAGE_BUF(0, READ_WRITE, CaptureInfoData, capture_info_buf) +STORAGE_BUF(1, READ, ObjectBounds, bounds_buf[]) +PUSH_CONSTANT(INT, resource_len) +TYPEDEF_SOURCE("draw_shader_shared.hh") +ADDITIONAL_INFO(eevee_shared) +COMPUTE_SOURCE("eevee_lightprobe_volume_bounds_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_ray) - .local_group_size(IRRADIANCE_GRID_GROUP_SIZE, - IRRADIANCE_GRID_GROUP_SIZE, - IRRADIANCE_GRID_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_surfel_common") - .additional_info("eevee_lightprobe_sphere_data") - .additional_info("draw_view") - .push_constant(Type::INT, "radiance_src") - .storage_buf(0, Qualifier::READ, "int", "list_start_buf[]") - .storage_buf(6, Qualifier::READ, "SurfelListInfoData", "list_info_buf") - .image(0, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "irradiance_L0_img") - .image(1, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "irradiance_L1_a_img") - .image(2, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "irradiance_L1_b_img") - .image(3, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "irradiance_L1_c_img") - .image(4, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_3D, "virtual_offset_img") - .image(5, GPU_R32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "validity_img") - .compute_source("eevee_lightprobe_volume_ray_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(IRRADIANCE_GRID_GROUP_SIZE, + IRRADIANCE_GRID_GROUP_SIZE, + IRRADIANCE_GRID_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_surfel_common) +ADDITIONAL_INFO(eevee_lightprobe_sphere_data) +ADDITIONAL_INFO(draw_view) +PUSH_CONSTANT(INT, radiance_src) +STORAGE_BUF(0, READ, int, list_start_buf[]) +STORAGE_BUF(6, READ, SurfelListInfoData, list_info_buf) +IMAGE(0, GPU_RGBA32F, READ_WRITE, FLOAT_3D, irradiance_L0_img) +IMAGE(1, GPU_RGBA32F, READ_WRITE, FLOAT_3D, irradiance_L1_a_img) +IMAGE(2, GPU_RGBA32F, READ_WRITE, FLOAT_3D, irradiance_L1_b_img) +IMAGE(3, GPU_RGBA32F, READ_WRITE, FLOAT_3D, irradiance_L1_c_img) +IMAGE(4, GPU_RGBA16F, READ, FLOAT_3D, virtual_offset_img) +IMAGE(5, GPU_R32F, READ_WRITE, FLOAT_3D, validity_img) +COMPUTE_SOURCE("eevee_lightprobe_volume_ray_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_offset) - .local_group_size(IRRADIANCE_GRID_GROUP_SIZE, - IRRADIANCE_GRID_GROUP_SIZE, - IRRADIANCE_GRID_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_surfel_common") - .additional_info("draw_view") - .storage_buf(0, Qualifier::READ, "int", "list_start_buf[]") - .storage_buf(6, Qualifier::READ, "SurfelListInfoData", "list_info_buf") - .image(0, GPU_R32I, Qualifier::READ, ImageType::INT_3D_ATOMIC, "cluster_list_img") - .image(1, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "virtual_offset_img") - .compute_source("eevee_lightprobe_volume_offset_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(IRRADIANCE_GRID_GROUP_SIZE, + IRRADIANCE_GRID_GROUP_SIZE, + IRRADIANCE_GRID_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_surfel_common) +ADDITIONAL_INFO(draw_view) +STORAGE_BUF(0, READ, int, list_start_buf[]) +STORAGE_BUF(6, READ, SurfelListInfoData, list_info_buf) +IMAGE(0, GPU_R32I, READ, INT_3D_ATOMIC, cluster_list_img) +IMAGE(1, GPU_RGBA16F, READ_WRITE, FLOAT_3D, virtual_offset_img) +COMPUTE_SOURCE("eevee_lightprobe_volume_offset_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /** \} */ @@ -180,68 +196,71 @@ GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_offset) * \{ */ GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_world) - .local_group_size(IRRADIANCE_GRID_BRICK_SIZE, - IRRADIANCE_GRID_BRICK_SIZE, - IRRADIANCE_GRID_BRICK_SIZE) - .define("IRRADIANCE_GRID_UPLOAD") - .additional_info("eevee_shared") - .additional_info("eevee_global_ubo") - .push_constant(Type::INT, "grid_index") - .storage_buf(0, Qualifier::READ, "uint", "bricks_infos_buf[]") - .storage_buf(1, Qualifier::READ, "SphereProbeHarmonic", "harmonic_buf") - .uniform_buf(0, "VolumeProbeData", "grids_infos_buf[IRRADIANCE_GRID_MAX]") - .image(0, VOLUME_PROBE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_3D, "irradiance_atlas_img") - .compute_source("eevee_lightprobe_volume_world_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(IRRADIANCE_GRID_BRICK_SIZE, + IRRADIANCE_GRID_BRICK_SIZE, + IRRADIANCE_GRID_BRICK_SIZE) +DEFINE("IRRADIANCE_GRID_UPLOAD") +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_global_ubo) +PUSH_CONSTANT(INT, grid_index) +STORAGE_BUF(0, READ, uint, bricks_infos_buf[]) +STORAGE_BUF(1, READ, SphereProbeHarmonic, harmonic_buf) +UNIFORM_BUF(0, VolumeProbeData, grids_infos_buf[IRRADIANCE_GRID_MAX]) +IMAGE(0, VOLUME_PROBE_FORMAT, WRITE, FLOAT_3D, irradiance_atlas_img) +COMPUTE_SOURCE("eevee_lightprobe_volume_world_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_load) - .local_group_size(IRRADIANCE_GRID_BRICK_SIZE, - IRRADIANCE_GRID_BRICK_SIZE, - IRRADIANCE_GRID_BRICK_SIZE) - .define("IRRADIANCE_GRID_UPLOAD") - .additional_info("eevee_shared") - .additional_info("eevee_global_ubo") - .push_constant(Type::MAT4, "grid_local_to_world") - .push_constant(Type::INT, "grid_index") - .push_constant(Type::INT, "grid_start_index") - .push_constant(Type::FLOAT, "validity_threshold") - .push_constant(Type::FLOAT, "dilation_threshold") - .push_constant(Type::FLOAT, "dilation_radius") - .push_constant(Type::FLOAT, "grid_intensity_factor") - .uniform_buf(0, "VolumeProbeData", "grids_infos_buf[IRRADIANCE_GRID_MAX]") - .storage_buf(0, Qualifier::READ, "uint", "bricks_infos_buf[]") - .sampler(0, ImageType::FLOAT_3D, "irradiance_a_tx") - .sampler(1, ImageType::FLOAT_3D, "irradiance_b_tx") - .sampler(2, ImageType::FLOAT_3D, "irradiance_c_tx") - .sampler(3, ImageType::FLOAT_3D, "irradiance_d_tx") - .sampler(4, ImageType::FLOAT_3D, "visibility_a_tx") - .sampler(5, ImageType::FLOAT_3D, "visibility_b_tx") - .sampler(6, ImageType::FLOAT_3D, "visibility_c_tx") - .sampler(7, ImageType::FLOAT_3D, "visibility_d_tx") - .sampler(8, ImageType::FLOAT_3D, "irradiance_atlas_tx") - .sampler(9, ImageType::FLOAT_3D, "validity_tx") - .image(0, VOLUME_PROBE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_3D, "irradiance_atlas_img") - .compute_source("eevee_lightprobe_volume_load_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(IRRADIANCE_GRID_BRICK_SIZE, + IRRADIANCE_GRID_BRICK_SIZE, + IRRADIANCE_GRID_BRICK_SIZE) +DEFINE("IRRADIANCE_GRID_UPLOAD") +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_global_ubo) +PUSH_CONSTANT(MAT4, grid_local_to_world) +PUSH_CONSTANT(INT, grid_index) +PUSH_CONSTANT(INT, grid_start_index) +PUSH_CONSTANT(FLOAT, validity_threshold) +PUSH_CONSTANT(FLOAT, dilation_threshold) +PUSH_CONSTANT(FLOAT, dilation_radius) +PUSH_CONSTANT(FLOAT, grid_intensity_factor) +UNIFORM_BUF(0, VolumeProbeData, grids_infos_buf[IRRADIANCE_GRID_MAX]) +STORAGE_BUF(0, READ, uint, bricks_infos_buf[]) +SAMPLER(0, FLOAT_3D, irradiance_a_tx) +SAMPLER(1, FLOAT_3D, irradiance_b_tx) +SAMPLER(2, FLOAT_3D, irradiance_c_tx) +SAMPLER(3, FLOAT_3D, irradiance_d_tx) +SAMPLER(4, FLOAT_3D, visibility_a_tx) +SAMPLER(5, FLOAT_3D, visibility_b_tx) +SAMPLER(6, FLOAT_3D, visibility_c_tx) +SAMPLER(7, FLOAT_3D, visibility_d_tx) +SAMPLER(8, FLOAT_3D, irradiance_atlas_tx) +SAMPLER(9, FLOAT_3D, validity_tx) +IMAGE(0, VOLUME_PROBE_FORMAT, WRITE, FLOAT_3D, irradiance_atlas_img) +COMPUTE_SOURCE("eevee_lightprobe_volume_load_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_volume_probe_data) - .uniform_buf(IRRADIANCE_GRID_BUF_SLOT, - "VolumeProbeData", - "grids_infos_buf[IRRADIANCE_GRID_MAX]") - /* NOTE: Use uint instead of IrradianceBrickPacked because Metal needs to know the exact type. - */ - .storage_buf(IRRADIANCE_BRICK_BUF_SLOT, Qualifier::READ, "uint", "bricks_infos_buf[]") - .sampler(VOLUME_PROBE_TEX_SLOT, ImageType::FLOAT_3D, "irradiance_atlas_tx") - .define("IRRADIANCE_GRID_SAMPLING"); +UNIFORM_BUF(IRRADIANCE_GRID_BUF_SLOT, VolumeProbeData, grids_infos_buf[IRRADIANCE_GRID_MAX]) +/* NOTE: Use uint instead of IrradianceBrickPacked because Metal needs to know the exact type. + */ +STORAGE_BUF(IRRADIANCE_BRICK_BUF_SLOT, READ, uint, bricks_infos_buf[]) +SAMPLER(VOLUME_PROBE_TEX_SLOT, FLOAT_3D, irradiance_atlas_tx) +DEFINE("IRRADIANCE_GRID_SAMPLING") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_lightprobe_data) - .additional_info("eevee_lightprobe_sphere_data") - .additional_info("eevee_volume_probe_data"); +ADDITIONAL_INFO(eevee_lightprobe_sphere_data) +ADDITIONAL_INFO(eevee_volume_probe_data) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_lightprobe_planar_data) - .define("SPHERE_PROBE") - .uniform_buf(PLANAR_PROBE_BUF_SLOT, "PlanarProbeData", "probe_planar_buf[PLANAR_PROBE_MAX]") - .sampler(PLANAR_PROBE_RADIANCE_TEX_SLOT, ImageType::FLOAT_2D_ARRAY, "planar_radiance_tx") - .sampler(PLANAR_PROBE_DEPTH_TEX_SLOT, ImageType::DEPTH_2D_ARRAY, "planar_depth_tx"); +DEFINE("SPHERE_PROBE") +UNIFORM_BUF(PLANAR_PROBE_BUF_SLOT, PlanarProbeData, probe_planar_buf[PLANAR_PROBE_MAX]) +SAMPLER(PLANAR_PROBE_RADIANCE_TEX_SLOT, FLOAT_2D_ARRAY, planar_radiance_tx) +SAMPLER(PLANAR_PROBE_DEPTH_TEX_SLOT, DEPTH_2D_ARRAY, planar_depth_tx) +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lookdev_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lookdev_info.hh index d56bf371eb5..d56e6fb841d 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lookdev_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lookdev_info.hh @@ -6,18 +6,20 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_INTERFACE_INFO(eevee_lookdev_display_iface) - .smooth(Type::VEC2, "uv_coord") - .flat(Type::UINT, "sphere_id"); +SMOOTH(VEC2, uv_coord) +FLAT(UINT, sphere_id) +GPU_SHADER_INTERFACE_END() GPU_SHADER_CREATE_INFO(eevee_lookdev_display) - .vertex_source("eevee_lookdev_display_vert.glsl") - .vertex_out(eevee_lookdev_display_iface) - .push_constant(Type::VEC2, "viewportSize") - .push_constant(Type::VEC2, "invertedViewportSize") - .push_constant(Type::IVEC2, "anchor") - .sampler(0, ImageType::FLOAT_2D, "metallic_tx") - .sampler(1, ImageType::FLOAT_2D, "diffuse_tx") - .fragment_out(0, Type::VEC4, "out_color") - .fragment_source("eevee_lookdev_display_frag.glsl") - .depth_write(DepthWrite::ANY) - .do_static_compilation(true); +VERTEX_SOURCE("eevee_lookdev_display_vert.glsl") +VERTEX_OUT(eevee_lookdev_display_iface) +PUSH_CONSTANT(VEC2, viewportSize) +PUSH_CONSTANT(VEC2, invertedViewportSize) +PUSH_CONSTANT(IVEC2, anchor) +SAMPLER(0, FLOAT_2D, metallic_tx) +SAMPLER(1, FLOAT_2D, diffuse_tx) +FRAGMENT_OUT(0, VEC4, out_color) +FRAGMENT_SOURCE("eevee_lookdev_display_frag.glsl") +DEPTH_WRITE(DepthWrite::ANY) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lut_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lut_info.hh index 421f1fd65e4..16c838a1ace 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lut_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_lut_info.hh @@ -5,10 +5,11 @@ #include "eevee_defines.hh" GPU_SHADER_CREATE_INFO(eevee_lut) - .local_group_size(LUT_WORKGROUP_SIZE, LUT_WORKGROUP_SIZE, 1) - .push_constant(Type::INT, "table_type") - .push_constant(Type::IVEC3, "table_extent") - .image(0, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "table_img") - .additional_info("eevee_shared") - .compute_source("eevee_lut_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(LUT_WORKGROUP_SIZE, LUT_WORKGROUP_SIZE, 1) +PUSH_CONSTANT(INT, table_type) +PUSH_CONSTANT(IVEC3, table_extent) +IMAGE(0, GPU_RGBA32F, READ_WRITE, FLOAT_3D, table_img) +ADDITIONAL_INFO(eevee_shared) +COMPUTE_SOURCE("eevee_lut_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh index bcefa36be8c..b025a2d7ec5 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh @@ -11,28 +11,34 @@ /* TODO(@fclem): This is a bit out of place at the moment. */ GPU_SHADER_CREATE_INFO(eevee_shared) - .typedef_source("eevee_defines.hh") - .typedef_source("eevee_shader_shared.hh"); +TYPEDEF_SOURCE("eevee_defines.hh") +TYPEDEF_SOURCE("eevee_shader_shared.hh") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_global_ubo) - .uniform_buf(UNIFORM_BUF_SLOT, "UniformData", "uniform_buf"); +UNIFORM_BUF(UNIFORM_BUF_SLOT, UniformData, uniform_buf) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_sampling_data) - .define("EEVEE_SAMPLING_DATA") - .additional_info("eevee_shared") - .storage_buf(SAMPLING_BUF_SLOT, Qualifier::READ, "SamplingData", "sampling_buf"); +DEFINE("EEVEE_SAMPLING_DATA") +ADDITIONAL_INFO(eevee_shared) +STORAGE_BUF(SAMPLING_BUF_SLOT, READ, SamplingData, sampling_buf) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_utility_texture) - .define("EEVEE_UTILITY_TX") - .sampler(RBUFS_UTILITY_TEX_SLOT, ImageType::FLOAT_2D_ARRAY, "utility_tx"); +DEFINE("EEVEE_UTILITY_TX") +SAMPLER(RBUFS_UTILITY_TEX_SLOT, FLOAT_2D_ARRAY, utility_tx) +GPU_SHADER_CREATE_END() GPU_SHADER_NAMED_INTERFACE_INFO(eevee_clip_plane_iface, clip_interp) - .smooth(Type::FLOAT, "clip_distance"); +SMOOTH(FLOAT, clip_distance) +GPU_SHADER_NAMED_INTERFACE_END(clip_interp) GPU_SHADER_CREATE_INFO(eevee_clip_plane) - .vertex_out(eevee_clip_plane_iface) - .uniform_buf(CLIP_PLANE_BUF, "ClipPlaneData", "clip_plane") - .define("MAT_CLIP_PLANE"); +VERTEX_OUT(eevee_clip_plane_iface) +UNIFORM_BUF(CLIP_PLANE_BUF, ClipPlaneData, clip_plane) +DEFINE("MAT_CLIP_PLANE") +GPU_SHADER_CREATE_END() /** \} */ @@ -42,99 +48,110 @@ GPU_SHADER_CREATE_INFO(eevee_clip_plane) /* Common interface */ GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_iface, interp) - /* World Position. */ - .smooth(Type::VEC3, "P") - /* World Normal. */ - .smooth(Type::VEC3, "N"); +/* World Position. */ +SMOOTH(VEC3, P) +/* World Normal. */ +SMOOTH(VEC3, N) +GPU_SHADER_NAMED_INTERFACE_END(interp) GPU_SHADER_CREATE_INFO(eevee_geom_mesh) - .additional_info("eevee_shared") - .define("MAT_GEOM_MESH") - .vertex_in(0, Type::VEC3, "pos") - .vertex_in(1, Type::VEC3, "nor") - .vertex_source("eevee_geom_mesh_vert.glsl") - .vertex_out(eevee_surf_iface) - .additional_info("draw_modelmat_new") - .additional_info("draw_object_infos_new") - .additional_info("draw_resource_id_varying") - .additional_info("draw_view"); +ADDITIONAL_INFO(eevee_shared) +DEFINE("MAT_GEOM_MESH") +VERTEX_IN(0, VEC3, pos) +VERTEX_IN(1, VEC3, nor) +VERTEX_SOURCE("eevee_geom_mesh_vert.glsl") +VERTEX_OUT(eevee_surf_iface) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_object_infos_new) +ADDITIONAL_INFO(draw_resource_id_varying) +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_point_cloud_iface, point_cloud_interp) - .smooth(Type::FLOAT, "radius") - .smooth(Type::VEC3, "position"); +SMOOTH(FLOAT, radius) +SMOOTH(VEC3, position) +GPU_SHADER_NAMED_INTERFACE_END(point_cloud_interp) GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_point_cloud_flat_iface, point_cloud_interp_flat) - .flat(Type::INT, "id"); +FLAT(INT, id) +GPU_SHADER_NAMED_INTERFACE_END(point_cloud_interp_flat) GPU_SHADER_CREATE_INFO(eevee_geom_point_cloud) - .additional_info("eevee_shared") - .define("MAT_GEOM_POINT_CLOUD") - .vertex_source("eevee_geom_point_cloud_vert.glsl") - .vertex_out(eevee_surf_iface) - .vertex_out(eevee_surf_point_cloud_iface) - .vertex_out(eevee_surf_point_cloud_flat_iface) - .additional_info("draw_pointcloud_new") - .additional_info("draw_modelmat_new") - .additional_info("draw_object_infos_new") - .additional_info("draw_resource_id_varying") - .additional_info("draw_view"); +ADDITIONAL_INFO(eevee_shared) +DEFINE("MAT_GEOM_POINT_CLOUD") +VERTEX_SOURCE("eevee_geom_point_cloud_vert.glsl") +VERTEX_OUT(eevee_surf_iface) +VERTEX_OUT(eevee_surf_point_cloud_iface) +VERTEX_OUT(eevee_surf_point_cloud_flat_iface) +ADDITIONAL_INFO(draw_pointcloud_new) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_object_infos_new) +ADDITIONAL_INFO(draw_resource_id_varying) +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_geom_volume) - .additional_info("eevee_shared") - .define("MAT_GEOM_VOLUME") - .vertex_in(0, Type::VEC3, "pos") - .vertex_out(eevee_surf_iface) - .vertex_source("eevee_geom_volume_vert.glsl") - .additional_info("draw_modelmat_new") - .additional_info("draw_object_infos_new") - .additional_info("draw_resource_id_varying") - .additional_info("draw_volume_infos") - .additional_info("draw_view"); +ADDITIONAL_INFO(eevee_shared) +DEFINE("MAT_GEOM_VOLUME") +VERTEX_IN(0, VEC3, pos) +VERTEX_OUT(eevee_surf_iface) +VERTEX_SOURCE("eevee_geom_volume_vert.glsl") +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_object_infos_new) +ADDITIONAL_INFO(draw_resource_id_varying) +ADDITIONAL_INFO(draw_volume_infos) +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_geom_gpencil) - .additional_info("eevee_shared") - .define("MAT_GEOM_GPENCIL") - .vertex_source("eevee_geom_gpencil_vert.glsl") - .vertex_out(eevee_surf_iface) - .additional_info("draw_gpencil_new") - .additional_info("draw_modelmat_new") - .additional_info("draw_object_infos_new") - .additional_info("draw_resource_id_varying") - .additional_info("draw_resource_id_new"); +ADDITIONAL_INFO(eevee_shared) +DEFINE("MAT_GEOM_GPENCIL") +VERTEX_SOURCE("eevee_geom_gpencil_vert.glsl") +VERTEX_OUT(eevee_surf_iface) +ADDITIONAL_INFO(draw_gpencil_new) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_object_infos_new) +ADDITIONAL_INFO(draw_resource_id_varying) +ADDITIONAL_INFO(draw_resource_id_new) +GPU_SHADER_CREATE_END() GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_curve_iface, curve_interp) - .smooth(Type::VEC2, "barycentric_coords") - .smooth(Type::VEC3, "tangent") - .smooth(Type::VEC3, "binormal") - .smooth(Type::FLOAT, "time") - .smooth(Type::FLOAT, "time_width") - .smooth(Type::FLOAT, "thickness"); +SMOOTH(VEC2, barycentric_coords) +SMOOTH(VEC3, tangent) +SMOOTH(VEC3, binormal) +SMOOTH(FLOAT, time) +SMOOTH(FLOAT, time_width) +SMOOTH(FLOAT, thickness) +GPU_SHADER_NAMED_INTERFACE_END(curve_interp) GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_curve_flat_iface, curve_interp_flat) - .flat(Type::INT, "strand_id"); +FLAT(INT, strand_id) +GPU_SHADER_NAMED_INTERFACE_END(curve_interp_flat) GPU_SHADER_CREATE_INFO(eevee_geom_curves) - .additional_info("eevee_shared") - .define("MAT_GEOM_CURVES") - .vertex_source("eevee_geom_curves_vert.glsl") - .vertex_out(eevee_surf_iface) - .vertex_out(eevee_surf_curve_iface) - .vertex_out(eevee_surf_curve_flat_iface) - .additional_info("draw_modelmat_new") - .additional_info("draw_object_infos_new") - .additional_info("draw_resource_id_varying") - .additional_info("draw_view") - .additional_info("draw_hair_new") - .additional_info("draw_curves_infos"); +ADDITIONAL_INFO(eevee_shared) +DEFINE("MAT_GEOM_CURVES") +VERTEX_SOURCE("eevee_geom_curves_vert.glsl") +VERTEX_OUT(eevee_surf_iface) +VERTEX_OUT(eevee_surf_curve_iface) +VERTEX_OUT(eevee_surf_curve_flat_iface) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_object_infos_new) +ADDITIONAL_INFO(draw_resource_id_varying) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_hair_new) +ADDITIONAL_INFO(draw_curves_infos) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_geom_world) - .additional_info("eevee_shared") - .define("MAT_GEOM_WORLD") - .builtins(BuiltinBits::VERTEX_ID) - .vertex_source("eevee_geom_world_vert.glsl") - .vertex_out(eevee_surf_iface) - .additional_info("draw_modelmat_new") - .additional_info("draw_object_infos_new") /* Unused, but allow debug compilation. */ - .additional_info("draw_resource_id_varying") - .additional_info("draw_view"); +ADDITIONAL_INFO(eevee_shared) +DEFINE("MAT_GEOM_WORLD") +BUILTINS(BuiltinBits::VERTEX_ID) +VERTEX_SOURCE("eevee_geom_world_vert.glsl") +VERTEX_OUT(eevee_surf_iface) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(draw_object_infos_new) /* Unused, but allow debug compilation. */ +ADDITIONAL_INFO(draw_resource_id_varying) +ADDITIONAL_INFO(draw_view) +GPU_SHADER_CREATE_END() /** \} */ @@ -148,156 +165,161 @@ GPU_SHADER_CREATE_INFO(eevee_geom_world) image(slot, format, qualifier, ImageType::FLOAT_2D_ARRAY, name, Frequency::PASS) GPU_SHADER_CREATE_INFO(eevee_render_pass_out) - .define("MAT_RENDER_PASS_SUPPORT") - .additional_info("eevee_global_ubo") - .image_array_out(RBUFS_COLOR_SLOT, Qualifier::WRITE, GPU_RGBA16F, "rp_color_img") - .image_array_out(RBUFS_VALUE_SLOT, Qualifier::WRITE, GPU_R16F, "rp_value_img"); +DEFINE("MAT_RENDER_PASS_SUPPORT") +ADDITIONAL_INFO(eevee_global_ubo) +IMAGE_FREQ(RBUFS_COLOR_SLOT, GPU_RGBA16F, WRITE, FLOAT_2D, rp_color_img, PASS) +IMAGE_FREQ(RBUFS_VALUE_SLOT, GPU_R16F, WRITE, FLOAT_2D, rp_value_img, PASS) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_cryptomatte_out) - .storage_buf(CRYPTOMATTE_BUF_SLOT, Qualifier::READ, "vec2", "cryptomatte_object_buf[]") - .image_out(RBUFS_CRYPTOMATTE_SLOT, Qualifier::WRITE, GPU_RGBA32F, "rp_cryptomatte_img"); +STORAGE_BUF(CRYPTOMATTE_BUF_SLOT, READ, vec2, cryptomatte_object_buf[]) +IMAGE_FREQ(RBUFS_CRYPTOMATTE_SLOT, GPU_RGBA32F, WRITE, FLOAT_2D, rp_cryptomatte_img, PASS) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surf_deferred_base) - .define("MAT_DEFERRED") - .define("GBUFFER_WRITE") - /* NOTE: This removes the possibility of using gl_FragDepth. */ - .early_fragment_test(true) - /* Direct output. (Emissive, Holdout) */ - .fragment_out(0, Type::VEC4, "out_radiance") - .fragment_out(1, Type::UINT, "out_gbuf_header", DualBlend::NONE, DEFERRED_GBUFFER_ROG_ID) - .fragment_out(2, Type::VEC2, "out_gbuf_normal") - .fragment_out(3, Type::VEC4, "out_gbuf_closure1") - .fragment_out(4, Type::VEC4, "out_gbuf_closure2") - /* Everything is stored inside a two layered target, one for each format. This is to fit the - * limitation of the number of images we can bind on a single shader. */ - .image_array_out(GBUF_CLOSURE_SLOT, Qualifier::WRITE, GPU_RGB10_A2, "out_gbuf_closure_img") - .image_array_out(GBUF_NORMAL_SLOT, Qualifier::WRITE, GPU_RG16, "out_gbuf_normal_img") - /* Added at runtime because of test shaders not having `node_tree`. */ - // .additional_info("eevee_render_pass_out") - // .additional_info("eevee_cryptomatte_out") - .additional_info("eevee_global_ubo") - .additional_info("eevee_utility_texture") - .additional_info("eevee_sampling_data") - .additional_info("eevee_hiz_data"); +DEFINE("MAT_DEFERRED") +DEFINE("GBUFFER_WRITE") +/* NOTE: This removes the possibility of using gl_FragDepth. */ +EARLY_FRAGMENT_TEST(true) +/* Direct output. (Emissive, Holdout) */ +FRAGMENT_OUT(0, VEC4, out_radiance) +FRAGMENT_OUT_ROG(1, UINT, out_gbuf_header, DEFERRED_GBUFFER_ROG_ID) +FRAGMENT_OUT(2, VEC2, out_gbuf_normal) +FRAGMENT_OUT(3, VEC4, out_gbuf_closure1) +FRAGMENT_OUT(4, VEC4, out_gbuf_closure2) +/* Everything is stored inside a two layered target, one for each format. This is to fit the + * limitation of the number of images we can bind on a single shader. */ +IMAGE_FREQ(GBUF_CLOSURE_SLOT, GPU_RGB10_A2, WRITE, FLOAT_2D, out_gbuf_closure_img, PASS) +IMAGE_FREQ(GBUF_NORMAL_SLOT, GPU_RG16, WRITE, FLOAT_2D, out_gbuf_normal_img, PASS) +/* Added at runtime because of test shaders not having `node_tree`. */ +// ADDITIONAL_INFO(eevee_render_pass_out) +// ADDITIONAL_INFO(eevee_cryptomatte_out) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_utility_texture) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_hiz_data) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surf_deferred) - .fragment_source("eevee_surf_deferred_frag.glsl") - .additional_info("eevee_surf_deferred_base"); +FRAGMENT_SOURCE("eevee_surf_deferred_frag.glsl") +ADDITIONAL_INFO(eevee_surf_deferred_base) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surf_deferred_hybrid) - .fragment_source("eevee_surf_hybrid_frag.glsl") - .additional_info("eevee_surf_deferred_base") - .additional_info("eevee_light_data") - .additional_info("eevee_lightprobe_data") - .additional_info("eevee_shadow_data"); +FRAGMENT_SOURCE("eevee_surf_hybrid_frag.glsl") +ADDITIONAL_INFO(eevee_surf_deferred_base) +ADDITIONAL_INFO(eevee_light_data) +ADDITIONAL_INFO(eevee_lightprobe_data) +ADDITIONAL_INFO(eevee_shadow_data) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surf_forward) - .define("MAT_FORWARD") - /* Early fragment test is needed for render passes support for forward surfaces. */ - /* NOTE: This removes the possibility of using gl_FragDepth. */ - .early_fragment_test(true) - .fragment_out(0, Type::VEC4, "out_radiance", DualBlend::SRC_0) - .fragment_out(0, Type::VEC4, "out_transmittance", DualBlend::SRC_1) - .fragment_source("eevee_surf_forward_frag.glsl") - /* Optionally added depending on the material. */ - // .additional_info("eevee_render_pass_out") - // .additional_info("eevee_cryptomatte_out") - .additional_info("eevee_global_ubo") - .additional_info("eevee_light_data") - .additional_info("eevee_lightprobe_data") - .additional_info("eevee_utility_texture") - .additional_info("eevee_sampling_data") - .additional_info("eevee_shadow_data") - .additional_info("eevee_hiz_data") - .additional_info("eevee_volume_lib"); +DEFINE("MAT_FORWARD") +/* Early fragment test is needed for render passes support for forward surfaces. */ +/* NOTE: This removes the possibility of using gl_FragDepth. */ +EARLY_FRAGMENT_TEST(true) +FRAGMENT_OUT_DUAL(0, VEC4, out_radiance, SRC_0) +FRAGMENT_OUT_DUAL(0, VEC4, out_transmittance, SRC_1) +FRAGMENT_SOURCE("eevee_surf_forward_frag.glsl") +/* Optionally added depending on the material. */ +// ADDITIONAL_INFO(eevee_render_pass_out) +// ADDITIONAL_INFO(eevee_cryptomatte_out) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_light_data) +ADDITIONAL_INFO(eevee_lightprobe_data) +ADDITIONAL_INFO(eevee_utility_texture) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_shadow_data) +ADDITIONAL_INFO(eevee_hiz_data) +ADDITIONAL_INFO(eevee_volume_lib) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surf_capture) - .define("MAT_CAPTURE") - .storage_buf(SURFEL_BUF_SLOT, Qualifier::WRITE, "Surfel", "surfel_buf[]") - .storage_buf(CAPTURE_BUF_SLOT, Qualifier::READ_WRITE, "CaptureInfoData", "capture_info_buf") - .push_constant(Type::BOOL, "is_double_sided") - .fragment_source("eevee_surf_capture_frag.glsl") - .additional_info("eevee_global_ubo") - .additional_info("eevee_utility_texture"); +DEFINE("MAT_CAPTURE") +STORAGE_BUF(SURFEL_BUF_SLOT, WRITE, Surfel, surfel_buf[]) +STORAGE_BUF(CAPTURE_BUF_SLOT, READ_WRITE, CaptureInfoData, capture_info_buf) +PUSH_CONSTANT(BOOL, is_double_sided) +FRAGMENT_SOURCE("eevee_surf_capture_frag.glsl") +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_utility_texture) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surf_depth) - .define("MAT_DEPTH") - .fragment_source("eevee_surf_depth_frag.glsl") - .additional_info("eevee_global_ubo") - .additional_info("eevee_sampling_data") - .additional_info("eevee_utility_texture"); +DEFINE("MAT_DEPTH") +FRAGMENT_SOURCE("eevee_surf_depth_frag.glsl") +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_utility_texture) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surf_world) - .push_constant(Type::FLOAT, "world_opacity_fade") - .push_constant(Type::FLOAT, "world_background_blur") - .push_constant(Type::IVEC4, "world_coord_packed") - .early_fragment_test(true) - .fragment_out(0, Type::VEC4, "out_background") - .fragment_source("eevee_surf_world_frag.glsl") - .additional_info("eevee_global_ubo") - .additional_info("eevee_lightprobe_sphere_data") - .additional_info("eevee_volume_probe_data") - .additional_info("eevee_sampling_data") - /* Optionally added depending on the material. */ - // .additional_info("eevee_render_pass_out") - // .additional_info("eevee_cryptomatte_out") - .additional_info("eevee_utility_texture"); +PUSH_CONSTANT(FLOAT, world_opacity_fade) +PUSH_CONSTANT(FLOAT, world_background_blur) +PUSH_CONSTANT(IVEC4, world_coord_packed) +EARLY_FRAGMENT_TEST(true) +FRAGMENT_OUT(0, VEC4, out_background) +FRAGMENT_SOURCE("eevee_surf_world_frag.glsl") +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_lightprobe_sphere_data) +ADDITIONAL_INFO(eevee_volume_probe_data) +ADDITIONAL_INFO(eevee_sampling_data) +/* Optionally added depending on the material. */ +// ADDITIONAL_INFO(eevee_render_pass_out) +// ADDITIONAL_INFO(eevee_cryptomatte_out) +ADDITIONAL_INFO(eevee_utility_texture) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_renderpass_clear) - .fragment_out(0, Type::VEC4, "out_background") - .fragment_source("eevee_renderpass_clear_frag.glsl") - .additional_info("draw_fullscreen") - .additional_info("eevee_global_ubo") - .additional_info("eevee_render_pass_out") - .additional_info("eevee_cryptomatte_out") - .additional_info("eevee_shared") - .do_static_compilation(true); +FRAGMENT_OUT(0, VEC4, out_background) +FRAGMENT_SOURCE("eevee_renderpass_clear_frag.glsl") +ADDITIONAL_INFO(draw_fullscreen) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_render_pass_out) +ADDITIONAL_INFO(eevee_cryptomatte_out) +ADDITIONAL_INFO(eevee_shared) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_shadow_atomic_iface, shadow_iface) - .flat(Type::INT, "shadow_view_id"); +FLAT(INT, shadow_view_id) +GPU_SHADER_NAMED_INTERFACE_END(shadow_iface) GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_shadow_clipping_iface, shadow_clip) - .smooth(Type::VEC3, "position") - .smooth(Type::VEC3, "vector"); +SMOOTH(VEC3, position) +SMOOTH(VEC3, vector) +GPU_SHADER_NAMED_INTERFACE_END(shadow_clip) GPU_SHADER_CREATE_INFO(eevee_surf_shadow) - .define("DRW_VIEW_LEN", STRINGIFY(SHADOW_VIEW_MAX)) - .define("MAT_SHADOW") - .builtins(BuiltinBits::VIEWPORT_INDEX) - .vertex_out(eevee_surf_shadow_clipping_iface) - .storage_buf(SHADOW_RENDER_VIEW_BUF_SLOT, - Qualifier::READ, - "ShadowRenderView", - "render_view_buf[SHADOW_VIEW_MAX]") - .fragment_source("eevee_surf_shadow_frag.glsl") - .additional_info("eevee_global_ubo") - .additional_info("eevee_utility_texture") - .additional_info("eevee_sampling_data"); +DEFINE_VALUE("DRW_VIEW_LEN", STRINGIFY(SHADOW_VIEW_MAX)) +DEFINE("MAT_SHADOW") +BUILTINS(BuiltinBits::VIEWPORT_INDEX) +VERTEX_OUT(eevee_surf_shadow_clipping_iface) +STORAGE_BUF(SHADOW_RENDER_VIEW_BUF_SLOT, READ, ShadowRenderView, render_view_buf[SHADOW_VIEW_MAX]) +FRAGMENT_SOURCE("eevee_surf_shadow_frag.glsl") +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_utility_texture) +ADDITIONAL_INFO(eevee_sampling_data) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surf_shadow_atomic) - .additional_info("eevee_surf_shadow") - .define("SHADOW_UPDATE_ATOMIC_RASTER") - .builtins(BuiltinBits::TEXTURE_ATOMIC) - .vertex_out(eevee_surf_shadow_atomic_iface) - .storage_buf(SHADOW_RENDER_MAP_BUF_SLOT, - Qualifier::READ, - "uint", - "render_map_buf[SHADOW_RENDER_MAP_SIZE]") - .image(SHADOW_ATLAS_IMG_SLOT, - GPU_R32UI, - Qualifier::READ_WRITE, - ImageType::UINT_2D_ARRAY_ATOMIC, - "shadow_atlas_img"); +ADDITIONAL_INFO(eevee_surf_shadow) +DEFINE("SHADOW_UPDATE_ATOMIC_RASTER") +BUILTINS(BuiltinBits::TEXTURE_ATOMIC) +VERTEX_OUT(eevee_surf_shadow_atomic_iface) +STORAGE_BUF(SHADOW_RENDER_MAP_BUF_SLOT, READ, uint, render_map_buf[SHADOW_RENDER_MAP_SIZE]) +IMAGE(SHADOW_ATLAS_IMG_SLOT, GPU_R32UI, READ_WRITE, UINT_2D_ARRAY_ATOMIC, shadow_atlas_img) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surf_shadow_tbdr) - .additional_info("eevee_surf_shadow") - .define("SHADOW_UPDATE_TBDR") - .builtins(BuiltinBits::LAYER) - /* Use greater depth write to avoid loosing the early Z depth test but ensure correct fragment - * ordering after slope bias. */ - .depth_write(DepthWrite::GREATER) - /* F32 color attachment for on-tile depth accumulation without atomics. */ - .fragment_out(0, Type::FLOAT, "out_depth", DualBlend::NONE, SHADOW_ROG_ID); +ADDITIONAL_INFO(eevee_surf_shadow) +DEFINE("SHADOW_UPDATE_TBDR") +BUILTINS(BuiltinBits::LAYER) +/* Use greater depth write to avoid loosing the early Z depth test but ensure correct fragment + * ordering after slope bias. */ +DEPTH_WRITE(DepthWrite::GREATER) +/* F32 color attachment for on-tile depth accumulation without atomics. */ +FRAGMENT_OUT_ROG(0, FLOAT, out_depth, SHADOW_ROG_ID) +GPU_SHADER_CREATE_END() #undef image_out #undef image_array_out @@ -309,67 +331,39 @@ GPU_SHADER_CREATE_INFO(eevee_surf_shadow_tbdr) * \{ */ GPU_SHADER_CREATE_INFO(eevee_surf_volume) - .define("MAT_VOLUME") - /* Only the front fragments have to be invoked. */ - .early_fragment_test(true) - .image(VOLUME_PROP_SCATTERING_IMG_SLOT, - GPU_R11F_G11F_B10F, - Qualifier::READ_WRITE, - ImageType::FLOAT_3D, - "out_scattering_img") - .image(VOLUME_PROP_EXTINCTION_IMG_SLOT, - GPU_R11F_G11F_B10F, - Qualifier::READ_WRITE, - ImageType::FLOAT_3D, - "out_extinction_img") - .image(VOLUME_PROP_EMISSION_IMG_SLOT, - GPU_R11F_G11F_B10F, - Qualifier::READ_WRITE, - ImageType::FLOAT_3D, - "out_emissive_img") - .image(VOLUME_PROP_PHASE_IMG_SLOT, - GPU_R16F, - Qualifier::READ_WRITE, - ImageType::FLOAT_3D, - "out_phase_img") - .image(VOLUME_PROP_PHASE_WEIGHT_IMG_SLOT, - GPU_R16F, - Qualifier::READ_WRITE, - ImageType::FLOAT_3D, - "out_phase_weight_img") - .image(VOLUME_OCCUPANCY_SLOT, - GPU_R32UI, - Qualifier::READ, - ImageType::UINT_3D_ATOMIC, - "occupancy_img") - .fragment_source("eevee_surf_volume_frag.glsl") - .additional_info("draw_modelmat_new_common") - .additional_info("draw_view") - .additional_info("eevee_shared") - .additional_info("eevee_global_ubo") - .additional_info("eevee_sampling_data") - .additional_info("eevee_utility_texture"); +DEFINE("MAT_VOLUME") +/* Only the front fragments have to be invoked. */ +EARLY_FRAGMENT_TEST(true) +IMAGE( + VOLUME_PROP_SCATTERING_IMG_SLOT, GPU_R11F_G11F_B10F, READ_WRITE, FLOAT_3D, out_scattering_img) +IMAGE( + VOLUME_PROP_EXTINCTION_IMG_SLOT, GPU_R11F_G11F_B10F, READ_WRITE, FLOAT_3D, out_extinction_img) +IMAGE(VOLUME_PROP_EMISSION_IMG_SLOT, GPU_R11F_G11F_B10F, READ_WRITE, FLOAT_3D, out_emissive_img) +IMAGE(VOLUME_PROP_PHASE_IMG_SLOT, GPU_R16F, READ_WRITE, FLOAT_3D, out_phase_img) +IMAGE(VOLUME_PROP_PHASE_WEIGHT_IMG_SLOT, GPU_R16F, READ_WRITE, FLOAT_3D, out_phase_weight_img) +IMAGE(VOLUME_OCCUPANCY_SLOT, GPU_R32UI, READ, UINT_3D_ATOMIC, occupancy_img) +FRAGMENT_SOURCE("eevee_surf_volume_frag.glsl") +ADDITIONAL_INFO(draw_modelmat_new_common) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_utility_texture) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surf_occupancy) - .define("MAT_OCCUPANCY") - /* All fragments need to be invoked even if we write to the depth buffer. */ - .early_fragment_test(false) - .builtins(BuiltinBits::TEXTURE_ATOMIC) - .push_constant(Type::BOOL, "use_fast_method") - .image(VOLUME_HIT_DEPTH_SLOT, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_3D, "hit_depth_img") - .image(VOLUME_HIT_COUNT_SLOT, - GPU_R32UI, - Qualifier::READ_WRITE, - ImageType::UINT_2D_ATOMIC, - "hit_count_img") - .image(VOLUME_OCCUPANCY_SLOT, - GPU_R32UI, - Qualifier::READ_WRITE, - ImageType::UINT_3D_ATOMIC, - "occupancy_img") - .fragment_source("eevee_surf_occupancy_frag.glsl") - .additional_info("eevee_global_ubo") - .additional_info("eevee_sampling_data"); +DEFINE("MAT_OCCUPANCY") +/* All fragments need to be invoked even if we write to the depth buffer. */ +EARLY_FRAGMENT_TEST(false) +BUILTINS(BuiltinBits::TEXTURE_ATOMIC) +PUSH_CONSTANT(BOOL, use_fast_method) +IMAGE(VOLUME_HIT_DEPTH_SLOT, GPU_R32F, WRITE, FLOAT_3D, hit_depth_img) +IMAGE(VOLUME_HIT_COUNT_SLOT, GPU_R32UI, READ_WRITE, UINT_2D_ATOMIC, hit_count_img) +IMAGE(VOLUME_OCCUPANCY_SLOT, GPU_R32UI, READ_WRITE, UINT_3D_ATOMIC, occupancy_img) +FRAGMENT_SOURCE("eevee_surf_occupancy_frag.glsl") +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_sampling_data) +GPU_SHADER_CREATE_END() /** \} */ @@ -383,9 +377,10 @@ GPU_SHADER_CREATE_INFO(eevee_surf_occupancy) /* Stub functions defined by the material evaluation. */ GPU_SHADER_CREATE_INFO(eevee_material_stub) - .define("EEVEE_MATERIAL_STUBS") - /* Dummy uniform buffer to detect overlap with material node-tree. */ - .uniform_buf(0, "int", "node_tree"); +DEFINE("EEVEE_MATERIAL_STUBS") +/* Dummy uniform buffer to detect overlap with material node-tree. */ +UNIFORM_BUF(0, int, node_tree) +GPU_SHADER_CREATE_END() # define EEVEE_MAT_GEOM_VARIATIONS(prefix, ...) \ CREATE_INFO_VARIANT(prefix##_world, eevee_geom_world, __VA_ARGS__) \ diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_motion_blur_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_motion_blur_info.hh index e5f53a5bdaa..abccab4170c 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_motion_blur_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_motion_blur_info.hh @@ -6,47 +6,52 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(eevee_motion_blur_tiles_flatten) - .local_group_size(MOTION_BLUR_GROUP_SIZE, MOTION_BLUR_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("draw_view") - .additional_info("eevee_velocity_camera") - .uniform_buf(6, "MotionBlurData", "motion_blur_buf") - .sampler(0, ImageType::DEPTH_2D, "depth_tx") - .image(1, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_tiles_img") - .compute_source("eevee_motion_blur_flatten_comp.glsl"); +LOCAL_GROUP_SIZE(MOTION_BLUR_GROUP_SIZE, MOTION_BLUR_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_velocity_camera) +UNIFORM_BUF(6, MotionBlurData, motion_blur_buf) +SAMPLER(0, DEPTH_2D, depth_tx) +IMAGE(1, GPU_RGBA16F, WRITE, FLOAT_2D, out_tiles_img) +COMPUTE_SOURCE("eevee_motion_blur_flatten_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_motion_blur_tiles_flatten_rg) - .do_static_compilation(true) - .define("FLATTEN_RG") - .image(0, GPU_RG16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "velocity_img") - .additional_info("eevee_motion_blur_tiles_flatten"); +DO_STATIC_COMPILATION() +DEFINE("FLATTEN_RG") +IMAGE(0, GPU_RG16F, READ_WRITE, FLOAT_2D, velocity_img) +ADDITIONAL_INFO(eevee_motion_blur_tiles_flatten) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_motion_blur_tiles_flatten_rgba) - .do_static_compilation(true) - .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "velocity_img") - .additional_info("eevee_motion_blur_tiles_flatten"); +DO_STATIC_COMPILATION() +IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, velocity_img) +ADDITIONAL_INFO(eevee_motion_blur_tiles_flatten) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_motion_blur_tiles_dilate) - .do_static_compilation(true) - .local_group_size(MOTION_BLUR_GROUP_SIZE, MOTION_BLUR_GROUP_SIZE) - .additional_info("eevee_shared") - /* NOTE: See MotionBlurTileIndirection. */ - .storage_buf(0, Qualifier::READ_WRITE, "uint", "tile_indirection_buf[]") - .image(1, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "in_tiles_img") - .compute_source("eevee_motion_blur_dilate_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(MOTION_BLUR_GROUP_SIZE, MOTION_BLUR_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +/* NOTE: See MotionBlurTileIndirection. */ +STORAGE_BUF(0, READ_WRITE, uint, tile_indirection_buf[]) +IMAGE(1, GPU_RGBA16F, READ, FLOAT_2D, in_tiles_img) +COMPUTE_SOURCE("eevee_motion_blur_dilate_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_motion_blur_gather) - .do_static_compilation(true) - .local_group_size(MOTION_BLUR_GROUP_SIZE, MOTION_BLUR_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("draw_view") - .additional_info("eevee_sampling_data") - .uniform_buf(6, "MotionBlurData", "motion_blur_buf") - .sampler(0, ImageType::DEPTH_2D, "depth_tx") - .sampler(1, ImageType::FLOAT_2D, "velocity_tx") - .sampler(2, ImageType::FLOAT_2D, "in_color_tx") - /* NOTE: See MotionBlurTileIndirection. */ - .storage_buf(0, Qualifier::READ, "uint", "tile_indirection_buf[]") - .image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "in_tiles_img") - .image(1, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img") - .compute_source("eevee_motion_blur_gather_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(MOTION_BLUR_GROUP_SIZE, MOTION_BLUR_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_sampling_data) +UNIFORM_BUF(6, MotionBlurData, motion_blur_buf) +SAMPLER(0, DEPTH_2D, depth_tx) +SAMPLER(1, FLOAT_2D, velocity_tx) +SAMPLER(2, FLOAT_2D, in_color_tx) +/* NOTE: See MotionBlurTileIndirection. */ +STORAGE_BUF(0, READ, uint, tile_indirection_buf[]) +IMAGE(0, GPU_RGBA16F, READ, FLOAT_2D, in_tiles_img) +IMAGE(1, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_img) +COMPUTE_SOURCE("eevee_motion_blur_gather_comp.glsl") +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_shadow_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_shadow_info.hh index aec620956c0..27e06e702b5 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_shadow_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_shadow_info.hh @@ -11,227 +11,245 @@ * \{ */ GPU_SHADER_CREATE_INFO(eevee_shadow_clipmap_clear) - .do_static_compilation(true) - .local_group_size(SHADOW_CLIPMAP_GROUP_SIZE) - .storage_buf(0, Qualifier::WRITE, "ShadowTileMapClip", "tilemaps_clip_buf[]") - .push_constant(Type::INT, "tilemaps_clip_buf_len") - .additional_info("eevee_shared") - .compute_source("eevee_shadow_clipmap_clear_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(SHADOW_CLIPMAP_GROUP_SIZE) +STORAGE_BUF(0, WRITE, ShadowTileMapClip, tilemaps_clip_buf[]) +PUSH_CONSTANT(INT, tilemaps_clip_buf_len) +ADDITIONAL_INFO(eevee_shared) +COMPUTE_SOURCE("eevee_shadow_clipmap_clear_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_tilemap_bounds) - .do_static_compilation(true) - .local_group_size(SHADOW_BOUNDS_GROUP_SIZE) - .storage_buf(LIGHT_BUF_SLOT, Qualifier::READ_WRITE, "LightData", "light_buf[]") - .storage_buf(LIGHT_CULL_BUF_SLOT, Qualifier::READ, "LightCullingData", "light_cull_buf") - .storage_buf(4, Qualifier::READ, "uint", "casters_id_buf[]") - .storage_buf(5, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(6, Qualifier::READ, "ObjectBounds", "bounds_buf[]") - .storage_buf(7, Qualifier::READ_WRITE, "ShadowTileMapClip", "tilemaps_clip_buf[]") - .push_constant(Type::INT, "resource_len") - .typedef_source("draw_shader_shared.hh") - .additional_info("eevee_shared") - .compute_source("eevee_shadow_tilemap_bounds_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(SHADOW_BOUNDS_GROUP_SIZE) +STORAGE_BUF(LIGHT_BUF_SLOT, READ_WRITE, LightData, light_buf[]) +STORAGE_BUF(LIGHT_CULL_BUF_SLOT, READ, LightCullingData, light_cull_buf) +STORAGE_BUF(4, READ, uint, casters_id_buf[]) +STORAGE_BUF(5, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) +STORAGE_BUF(6, READ, ObjectBounds, bounds_buf[]) +STORAGE_BUF(7, READ_WRITE, ShadowTileMapClip, tilemaps_clip_buf[]) +PUSH_CONSTANT(INT, resource_len) +TYPEDEF_SOURCE("draw_shader_shared.hh") +ADDITIONAL_INFO(eevee_shared) +COMPUTE_SOURCE("eevee_shadow_tilemap_bounds_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_tilemap_init) - .do_static_compilation(true) - .local_group_size(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) - .storage_buf(0, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(1, Qualifier::READ_WRITE, "uint", "tiles_buf[]") - .storage_buf(2, Qualifier::READ_WRITE, "ShadowTileMapClip", "tilemaps_clip_buf[]") - .storage_buf(4, Qualifier::READ_WRITE, "uvec2", "pages_cached_buf[]") - .additional_info("eevee_shared") - .compute_source("eevee_shadow_tilemap_init_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) +STORAGE_BUF(0, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) +STORAGE_BUF(1, READ_WRITE, uint, tiles_buf[]) +STORAGE_BUF(2, READ_WRITE, ShadowTileMapClip, tilemaps_clip_buf[]) +STORAGE_BUF(4, READ_WRITE, uvec2, pages_cached_buf[]) +ADDITIONAL_INFO(eevee_shared) +COMPUTE_SOURCE("eevee_shadow_tilemap_init_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_tag_update) - .do_static_compilation(true) - .local_group_size(1, 1, 1) - .storage_buf(0, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(1, Qualifier::READ_WRITE, "uint", "tiles_buf[]") - .storage_buf(5, Qualifier::READ, "ObjectBounds", "bounds_buf[]") - .storage_buf(6, Qualifier::READ, "uint", "resource_ids_buf[]") - .additional_info("eevee_shared") - .additional_info("draw_view") - .additional_info("draw_view_culling") - .compute_source("eevee_shadow_tag_update_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(1, 1, 1) +STORAGE_BUF(0, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) +STORAGE_BUF(1, READ_WRITE, uint, tiles_buf[]) +STORAGE_BUF(5, READ, ObjectBounds, bounds_buf[]) +STORAGE_BUF(6, READ, uint, resource_ids_buf[]) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_view_culling) +COMPUTE_SOURCE("eevee_shadow_tag_update_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_tag_usage_opaque) - .do_static_compilation(true) - .local_group_size(SHADOW_DEPTH_SCAN_GROUP_SIZE, SHADOW_DEPTH_SCAN_GROUP_SIZE) - .storage_buf(5, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(6, Qualifier::READ_WRITE, "uint", "tiles_buf[]") - .push_constant(Type::IVEC2, "input_depth_extent") - .additional_info( - "eevee_shared", "draw_view", "draw_view_culling", "eevee_hiz_data", "eevee_light_data") - .compute_source("eevee_shadow_tag_usage_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(SHADOW_DEPTH_SCAN_GROUP_SIZE, SHADOW_DEPTH_SCAN_GROUP_SIZE) +STORAGE_BUF(5, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) +STORAGE_BUF(6, READ_WRITE, uint, tiles_buf[]) +PUSH_CONSTANT(IVEC2, input_depth_extent) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_view_culling) +ADDITIONAL_INFO(eevee_hiz_data) +ADDITIONAL_INFO(eevee_light_data) +COMPUTE_SOURCE("eevee_shadow_tag_usage_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_tag_usage_surfels) - .do_static_compilation(true) - .local_group_size(SURFEL_GROUP_SIZE) - .storage_buf(6, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(7, Qualifier::READ_WRITE, "uint", "tiles_buf[]") - .push_constant(Type::INT, "directional_level") - .additional_info("eevee_shared") - .additional_info("draw_view") - .additional_info("draw_view_culling") - .additional_info("eevee_light_data") - .additional_info("eevee_global_ubo") - .additional_info("eevee_surfel_common") - .compute_source("eevee_shadow_tag_usage_surfels_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(SURFEL_GROUP_SIZE) +STORAGE_BUF(6, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) +STORAGE_BUF(7, READ_WRITE, uint, tiles_buf[]) +PUSH_CONSTANT(INT, directional_level) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_view_culling) +ADDITIONAL_INFO(eevee_light_data) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_surfel_common) +COMPUTE_SOURCE("eevee_shadow_tag_usage_surfels_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_NAMED_INTERFACE_INFO(eevee_shadow_tag_transparent_iface, interp) - .smooth(Type::VEC3, "P") - .smooth(Type::VEC3, "vP"); +SMOOTH(VEC3, P) +SMOOTH(VEC3, vP) +GPU_SHADER_NAMED_INTERFACE_END(interp) GPU_SHADER_NAMED_INTERFACE_INFO(eevee_shadow_tag_transparent_flat_iface, interp_flat) - .flat(Type::VEC3, "ls_aabb_min") - .flat(Type::VEC3, "ls_aabb_max"); +FLAT(VEC3, ls_aabb_min) +FLAT(VEC3, ls_aabb_max) +GPU_SHADER_NAMED_INTERFACE_END(interp_flat) GPU_SHADER_CREATE_INFO(eevee_shadow_tag_usage_transparent) - .do_static_compilation(true) - .vertex_in(0, Type::VEC3, "pos") - .storage_buf(4, Qualifier::READ, "ObjectBounds", "bounds_buf[]") - .storage_buf(5, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(6, Qualifier::READ_WRITE, "uint", "tiles_buf[]") - .push_constant(Type::IVEC2, "fb_resolution") - .push_constant(Type::INT, "fb_lod") - .vertex_out(eevee_shadow_tag_transparent_iface) - .vertex_out(eevee_shadow_tag_transparent_flat_iface) - .additional_info("eevee_shared") - .additional_info("draw_resource_id_varying") - .additional_info("draw_view") - .additional_info("draw_view_culling") - .additional_info("draw_modelmat_new") - .additional_info("eevee_hiz_data") - .additional_info("eevee_light_data") - .vertex_source("eevee_shadow_tag_usage_vert.glsl") - .fragment_source("eevee_shadow_tag_usage_frag.glsl"); +DO_STATIC_COMPILATION() +VERTEX_IN(0, VEC3, pos) +STORAGE_BUF(4, READ, ObjectBounds, bounds_buf[]) +STORAGE_BUF(5, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) +STORAGE_BUF(6, READ_WRITE, uint, tiles_buf[]) +PUSH_CONSTANT(IVEC2, fb_resolution) +PUSH_CONSTANT(INT, fb_lod) +VERTEX_OUT(eevee_shadow_tag_transparent_iface) +VERTEX_OUT(eevee_shadow_tag_transparent_flat_iface) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_resource_id_varying) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_view_culling) +ADDITIONAL_INFO(draw_modelmat_new) +ADDITIONAL_INFO(eevee_hiz_data) +ADDITIONAL_INFO(eevee_light_data) +VERTEX_SOURCE("eevee_shadow_tag_usage_vert.glsl") +FRAGMENT_SOURCE("eevee_shadow_tag_usage_frag.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_tag_usage_volume) - .do_static_compilation(true) - .local_group_size(VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE) - .storage_buf(4, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(5, Qualifier::READ_WRITE, "uint", "tiles_buf[]") - .additional_info("eevee_volume_properties_data") - .additional_info("eevee_shared") - .additional_info("draw_view") - .additional_info("draw_view_culling") - .additional_info("eevee_hiz_data") - .additional_info("eevee_light_data") - .additional_info("eevee_sampling_data") - .compute_source("eevee_shadow_tag_usage_volume_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE) +STORAGE_BUF(4, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) +STORAGE_BUF(5, READ_WRITE, uint, tiles_buf[]) +ADDITIONAL_INFO(eevee_volume_properties_data) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(draw_view_culling) +ADDITIONAL_INFO(eevee_hiz_data) +ADDITIONAL_INFO(eevee_light_data) +ADDITIONAL_INFO(eevee_sampling_data) +COMPUTE_SOURCE("eevee_shadow_tag_usage_volume_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_page_mask) - .do_static_compilation(true) - .local_group_size(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) - .push_constant(Type::INT, "max_view_per_tilemap") - .storage_buf(0, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(1, Qualifier::READ_WRITE, "uint", "tiles_buf[]") - .additional_info("eevee_shared") - .compute_source("eevee_shadow_page_mask_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) +PUSH_CONSTANT(INT, max_view_per_tilemap) +STORAGE_BUF(0, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) +STORAGE_BUF(1, READ_WRITE, uint, tiles_buf[]) +ADDITIONAL_INFO(eevee_shared) +COMPUTE_SOURCE("eevee_shadow_page_mask_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_page_free) - .do_static_compilation(true) - .local_group_size(SHADOW_TILEMAP_LOD0_LEN) - .storage_buf(0, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(1, Qualifier::READ_WRITE, "uint", "tiles_buf[]") - .storage_buf(2, Qualifier::READ_WRITE, "ShadowPagesInfoData", "pages_infos_buf") - .storage_buf(3, Qualifier::READ_WRITE, "uint", "pages_free_buf[]") - .storage_buf(4, Qualifier::READ_WRITE, "uvec2", "pages_cached_buf[]") - .additional_info("eevee_shared") - .compute_source("eevee_shadow_page_free_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(SHADOW_TILEMAP_LOD0_LEN) +STORAGE_BUF(0, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) +STORAGE_BUF(1, READ_WRITE, uint, tiles_buf[]) +STORAGE_BUF(2, READ_WRITE, ShadowPagesInfoData, pages_infos_buf) +STORAGE_BUF(3, READ_WRITE, uint, pages_free_buf[]) +STORAGE_BUF(4, READ_WRITE, uvec2, pages_cached_buf[]) +ADDITIONAL_INFO(eevee_shared) +COMPUTE_SOURCE("eevee_shadow_page_free_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_page_defrag) - .do_static_compilation(true) - .local_group_size(1) - .typedef_source("draw_shader_shared.hh") - .storage_buf(1, Qualifier::READ_WRITE, "uint", "tiles_buf[]") - .storage_buf(2, Qualifier::READ_WRITE, "ShadowPagesInfoData", "pages_infos_buf") - .storage_buf(3, Qualifier::READ_WRITE, "uint", "pages_free_buf[]") - .storage_buf(4, Qualifier::READ_WRITE, "uvec2", "pages_cached_buf[]") - .storage_buf(5, Qualifier::WRITE, "DispatchCommand", "clear_dispatch_buf") - .storage_buf(6, Qualifier::WRITE, "DrawCommand", "tile_draw_buf") - .storage_buf(7, Qualifier::READ_WRITE, "ShadowStatistics", "statistics_buf") - .additional_info("eevee_shared") - .compute_source("eevee_shadow_page_defrag_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(1) +TYPEDEF_SOURCE("draw_shader_shared.hh") +STORAGE_BUF(1, READ_WRITE, uint, tiles_buf[]) +STORAGE_BUF(2, READ_WRITE, ShadowPagesInfoData, pages_infos_buf) +STORAGE_BUF(3, READ_WRITE, uint, pages_free_buf[]) +STORAGE_BUF(4, READ_WRITE, uvec2, pages_cached_buf[]) +STORAGE_BUF(5, WRITE, DispatchCommand, clear_dispatch_buf) +STORAGE_BUF(6, WRITE, DrawCommand, tile_draw_buf) +STORAGE_BUF(7, READ_WRITE, ShadowStatistics, statistics_buf) +ADDITIONAL_INFO(eevee_shared) +COMPUTE_SOURCE("eevee_shadow_page_defrag_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_page_allocate) - .do_static_compilation(true) - .local_group_size(SHADOW_TILEMAP_LOD0_LEN) - .typedef_source("draw_shader_shared.hh") - .storage_buf(0, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(1, Qualifier::READ_WRITE, "uint", "tiles_buf[]") - .storage_buf(2, Qualifier::READ_WRITE, "ShadowPagesInfoData", "pages_infos_buf") - .storage_buf(3, Qualifier::READ_WRITE, "uint", "pages_free_buf[]") - .storage_buf(4, Qualifier::READ_WRITE, "uvec2", "pages_cached_buf[]") - .storage_buf(6, Qualifier::READ_WRITE, "ShadowStatistics", "statistics_buf") - .additional_info("eevee_shared") - .compute_source("eevee_shadow_page_allocate_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(SHADOW_TILEMAP_LOD0_LEN) +TYPEDEF_SOURCE("draw_shader_shared.hh") +STORAGE_BUF(0, READ_WRITE, ShadowTileMapData, tilemaps_buf[]) +STORAGE_BUF(1, READ_WRITE, uint, tiles_buf[]) +STORAGE_BUF(2, READ_WRITE, ShadowPagesInfoData, pages_infos_buf) +STORAGE_BUF(3, READ_WRITE, uint, pages_free_buf[]) +STORAGE_BUF(4, READ_WRITE, uvec2, pages_cached_buf[]) +STORAGE_BUF(6, READ_WRITE, ShadowStatistics, statistics_buf) +ADDITIONAL_INFO(eevee_shared) +COMPUTE_SOURCE("eevee_shadow_page_allocate_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_tilemap_finalize) - .do_static_compilation(true) - .typedef_source("draw_shader_shared.hh") - .local_group_size(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) - .storage_buf(0, Qualifier::READ, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(1, Qualifier::READ, "uint", "tiles_buf[]") - .storage_buf(2, Qualifier::READ_WRITE, "ShadowPagesInfoData", "pages_infos_buf") - .storage_buf(3, Qualifier::READ_WRITE, "ShadowStatistics", "statistics_buf") - .storage_buf(4, Qualifier::WRITE, "ViewMatrices", "view_infos_buf[SHADOW_VIEW_MAX]") - .storage_buf(5, Qualifier::WRITE, "ShadowRenderView", "render_view_buf[SHADOW_VIEW_MAX]") - .storage_buf(6, Qualifier::READ, "ShadowTileMapClip", "tilemaps_clip_buf[]") - .image(0, GPU_R32UI, Qualifier::WRITE, ImageType::UINT_2D, "tilemaps_img") - .additional_info("eevee_shared") - .compute_source("eevee_shadow_tilemap_finalize_comp.glsl"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("draw_shader_shared.hh") +LOCAL_GROUP_SIZE(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) +STORAGE_BUF(0, READ, ShadowTileMapData, tilemaps_buf[]) +STORAGE_BUF(1, READ, uint, tiles_buf[]) +STORAGE_BUF(2, READ_WRITE, ShadowPagesInfoData, pages_infos_buf) +STORAGE_BUF(3, READ_WRITE, ShadowStatistics, statistics_buf) +STORAGE_BUF(4, WRITE, ViewMatrices, view_infos_buf[SHADOW_VIEW_MAX]) +STORAGE_BUF(5, WRITE, ShadowRenderView, render_view_buf[SHADOW_VIEW_MAX]) +STORAGE_BUF(6, READ, ShadowTileMapClip, tilemaps_clip_buf[]) +IMAGE(0, GPU_R32UI, WRITE, UINT_2D, tilemaps_img) +ADDITIONAL_INFO(eevee_shared) +COMPUTE_SOURCE("eevee_shadow_tilemap_finalize_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_tilemap_rendermap) - .do_static_compilation(true) - .typedef_source("draw_shader_shared.hh") - .local_group_size(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) - .storage_buf(0, Qualifier::READ_WRITE, "ShadowStatistics", "statistics_buf") - .storage_buf(1, Qualifier::READ, "ShadowRenderView", "render_view_buf[SHADOW_VIEW_MAX]") - .storage_buf(2, Qualifier::READ_WRITE, "uint", "tiles_buf[]") - .storage_buf(3, Qualifier::READ_WRITE, "DispatchCommand", "clear_dispatch_buf") - .storage_buf(4, Qualifier::READ_WRITE, "DrawCommand", "tile_draw_buf") - .storage_buf(5, Qualifier::WRITE, "uint", "dst_coord_buf[SHADOW_RENDER_MAP_SIZE]") - .storage_buf(6, Qualifier::WRITE, "uint", "src_coord_buf[SHADOW_RENDER_MAP_SIZE]") - .storage_buf(7, Qualifier::WRITE, "uint", "render_map_buf[SHADOW_RENDER_MAP_SIZE]") - .additional_info("eevee_shared") - .compute_source("eevee_shadow_tilemap_rendermap_comp.glsl"); +DO_STATIC_COMPILATION() +TYPEDEF_SOURCE("draw_shader_shared.hh") +LOCAL_GROUP_SIZE(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) +STORAGE_BUF(0, READ_WRITE, ShadowStatistics, statistics_buf) +STORAGE_BUF(1, READ, ShadowRenderView, render_view_buf[SHADOW_VIEW_MAX]) +STORAGE_BUF(2, READ_WRITE, uint, tiles_buf[]) +STORAGE_BUF(3, READ_WRITE, DispatchCommand, clear_dispatch_buf) +STORAGE_BUF(4, READ_WRITE, DrawCommand, tile_draw_buf) +STORAGE_BUF(5, WRITE, uint, dst_coord_buf[SHADOW_RENDER_MAP_SIZE]) +STORAGE_BUF(6, WRITE, uint, src_coord_buf[SHADOW_RENDER_MAP_SIZE]) +STORAGE_BUF(7, WRITE, uint, render_map_buf[SHADOW_RENDER_MAP_SIZE]) +ADDITIONAL_INFO(eevee_shared) +COMPUTE_SOURCE("eevee_shadow_tilemap_rendermap_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_tilemap_amend) - .do_static_compilation(true) - .local_group_size(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) - .image(0, GPU_R32UI, Qualifier::READ_WRITE, ImageType::UINT_2D, "tilemaps_img") - .storage_buf(LIGHT_CULL_BUF_SLOT, Qualifier::READ, "LightCullingData", "light_cull_buf") - .storage_buf(LIGHT_BUF_SLOT, Qualifier::READ_WRITE, "LightData", "light_buf[]") - /* The call bind_resources(lights) also uses LIGHT_ZBIN_BUF_SLOT and LIGHT_TILE_BUF_SLOT. */ - .storage_buf(4, Qualifier::READ, "ShadowTileMapData", "tilemaps_buf[]") - .additional_info("eevee_shared") - .additional_info("draw_view") - .compute_source("eevee_shadow_tilemap_amend_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) +IMAGE(0, GPU_R32UI, READ_WRITE, UINT_2D, tilemaps_img) +STORAGE_BUF(LIGHT_CULL_BUF_SLOT, READ, LightCullingData, light_cull_buf) +STORAGE_BUF(LIGHT_BUF_SLOT, READ_WRITE, LightData, light_buf[]) +/* The call bind_resources(lights) also uses LIGHT_ZBIN_BUF_SLOT and LIGHT_TILE_BUF_SLOT. */ +STORAGE_BUF(4, READ, ShadowTileMapData, tilemaps_buf[]) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(draw_view) +COMPUTE_SOURCE("eevee_shadow_tilemap_amend_comp.glsl") +GPU_SHADER_CREATE_END() /* AtomicMin clear implementation. */ GPU_SHADER_CREATE_INFO(eevee_shadow_page_clear) - .do_static_compilation(true) - .local_group_size(SHADOW_PAGE_CLEAR_GROUP_SIZE, SHADOW_PAGE_CLEAR_GROUP_SIZE) - .storage_buf(2, Qualifier::READ, "ShadowPagesInfoData", "pages_infos_buf") - .storage_buf(6, Qualifier::READ, "uint", "dst_coord_buf[SHADOW_RENDER_MAP_SIZE]") - .additional_info("eevee_shared") - .compute_source("eevee_shadow_page_clear_comp.glsl") - .image(SHADOW_ATLAS_IMG_SLOT, - GPU_R32UI, - Qualifier::READ_WRITE, - ImageType::UINT_2D_ARRAY_ATOMIC, - "shadow_atlas_img"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(SHADOW_PAGE_CLEAR_GROUP_SIZE, SHADOW_PAGE_CLEAR_GROUP_SIZE) +STORAGE_BUF(2, READ, ShadowPagesInfoData, pages_infos_buf) +STORAGE_BUF(6, READ, uint, dst_coord_buf[SHADOW_RENDER_MAP_SIZE]) +ADDITIONAL_INFO(eevee_shared) +COMPUTE_SOURCE("eevee_shadow_page_clear_comp.glsl") +IMAGE(SHADOW_ATLAS_IMG_SLOT, GPU_R32UI, READ_WRITE, UINT_2D_ARRAY_ATOMIC, shadow_atlas_img) +GPU_SHADER_CREATE_END() /* TBDR clear implementation. */ GPU_SHADER_CREATE_INFO(eevee_shadow_page_tile_clear) - .do_static_compilation(true) - .define("PASS_CLEAR") - .additional_info("eevee_shared") - .builtins(BuiltinBits::VIEWPORT_INDEX | BuiltinBits::LAYER) - .storage_buf(8, Qualifier::READ, "uint", "src_coord_buf[SHADOW_RENDER_MAP_SIZE]") - .vertex_source("eevee_shadow_page_tile_vert.glsl") - .fragment_source("eevee_shadow_page_tile_frag.glsl") - .fragment_out(0, Type::FLOAT, "out_tile_depth", DualBlend::NONE, SHADOW_ROG_ID); +DO_STATIC_COMPILATION() +DEFINE("PASS_CLEAR") +ADDITIONAL_INFO(eevee_shared) +BUILTINS(BuiltinBits::VIEWPORT_INDEX | BuiltinBits::LAYER) +STORAGE_BUF(8, READ, uint, src_coord_buf[SHADOW_RENDER_MAP_SIZE]) +VERTEX_SOURCE("eevee_shadow_page_tile_vert.glsl") +FRAGMENT_SOURCE("eevee_shadow_page_tile_frag.glsl") +FRAGMENT_OUT_ROG(0, FLOAT, out_tile_depth, SHADOW_ROG_ID) +GPU_SHADER_CREATE_END() #ifdef APPLE /* Metal supports USHORT which saves a bit of performance here. */ @@ -243,30 +261,29 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_page_tile_clear) /* Interface for passing precalculated values in accumulation vertex to frag. */ GPU_SHADER_NAMED_INTERFACE_INFO(eevee_shadow_page_tile_store_noperspective_iface, interp_noperspective) - .no_perspective(Type::VEC2, "out_texel_xy"); +NO_PERSPECTIVE(VEC2, out_texel_xy) +GPU_SHADER_NAMED_INTERFACE_END(interp_noperspective) GPU_SHADER_NAMED_INTERFACE_INFO(eevee_shadow_page_tile_store_flat_iface, interp_flat) - .flat(Type::PAGE_Z_TYPE, "out_page_z"); +FLAT(PAGE_Z_TYPE, out_page_z) +GPU_SHADER_NAMED_INTERFACE_END(interp_flat) #undef PAGE_Z_TYPE /* 2nd tile pass to store shadow depths in atlas. */ GPU_SHADER_CREATE_INFO(eevee_shadow_page_tile_store) - .do_static_compilation(true) - .define("PASS_DEPTH_STORE") - .additional_info("eevee_shared") - .builtins(BuiltinBits::VIEWPORT_INDEX | BuiltinBits::LAYER) - .storage_buf(7, Qualifier::READ, "uint", "dst_coord_buf[SHADOW_RENDER_MAP_SIZE]") - .storage_buf(8, Qualifier::READ, "uint", "src_coord_buf[SHADOW_RENDER_MAP_SIZE]") - .subpass_in(0, Type::FLOAT, "in_tile_depth", SHADOW_ROG_ID) - .image(SHADOW_ATLAS_IMG_SLOT, - GPU_R32UI, - Qualifier::READ_WRITE, - ImageType::UINT_2D_ARRAY, - "shadow_atlas_img") - .vertex_out(eevee_shadow_page_tile_store_noperspective_iface) - .vertex_out(eevee_shadow_page_tile_store_flat_iface) - .vertex_source("eevee_shadow_page_tile_vert.glsl") - .fragment_source("eevee_shadow_page_tile_frag.glsl"); +DO_STATIC_COMPILATION() +DEFINE("PASS_DEPTH_STORE") +ADDITIONAL_INFO(eevee_shared) +BUILTINS(BuiltinBits::VIEWPORT_INDEX | BuiltinBits::LAYER) +STORAGE_BUF(7, READ, uint, dst_coord_buf[SHADOW_RENDER_MAP_SIZE]) +STORAGE_BUF(8, READ, uint, src_coord_buf[SHADOW_RENDER_MAP_SIZE]) +SUBPASS_IN(0, FLOAT, in_tile_depth, SHADOW_ROG_ID) +IMAGE(SHADOW_ATLAS_IMG_SLOT, GPU_R32UI, READ_WRITE, UINT_2D_ARRAY, shadow_atlas_img) +VERTEX_OUT(eevee_shadow_page_tile_store_noperspective_iface) +VERTEX_OUT(eevee_shadow_page_tile_store_flat_iface) +VERTEX_SOURCE("eevee_shadow_page_tile_vert.glsl") +FRAGMENT_SOURCE("eevee_shadow_page_tile_frag.glsl") +GPU_SHADER_CREATE_END() /** \} */ @@ -275,16 +292,18 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_page_tile_store) * \{ */ GPU_SHADER_CREATE_INFO(eevee_shadow_data) - /* SHADOW_READ_ATOMIC macro indicating shadow functions should use `usampler2DArrayAtomic` as - * the atlas type. */ - .define("SHADOW_READ_ATOMIC") - .builtins(BuiltinBits::TEXTURE_ATOMIC) - .sampler(SHADOW_ATLAS_TEX_SLOT, ImageType::UINT_2D_ARRAY_ATOMIC, "shadow_atlas_tx") - .sampler(SHADOW_TILEMAPS_TEX_SLOT, ImageType::UINT_2D, "shadow_tilemaps_tx"); +/* SHADOW_READ_ATOMIC macro indicating shadow functions should use `usampler2DArrayAtomic` as + * the atlas type. */ +DEFINE("SHADOW_READ_ATOMIC") +BUILTINS(BuiltinBits::TEXTURE_ATOMIC) +SAMPLER(SHADOW_ATLAS_TEX_SLOT, UINT_2D_ARRAY_ATOMIC, shadow_atlas_tx) +SAMPLER(SHADOW_TILEMAPS_TEX_SLOT, UINT_2D, shadow_tilemaps_tx) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_data_non_atomic) - .sampler(SHADOW_ATLAS_TEX_SLOT, ImageType::UINT_2D_ARRAY, "shadow_atlas_tx") - .sampler(SHADOW_TILEMAPS_TEX_SLOT, ImageType::UINT_2D, "shadow_tilemaps_tx"); +SAMPLER(SHADOW_ATLAS_TEX_SLOT, UINT_2D_ARRAY, shadow_atlas_tx) +SAMPLER(SHADOW_TILEMAPS_TEX_SLOT, UINT_2D, shadow_tilemaps_tx) +GPU_SHADER_CREATE_END() /** \} */ @@ -293,17 +312,21 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_data_non_atomic) * \{ */ GPU_SHADER_CREATE_INFO(eevee_shadow_debug) - .do_static_compilation(true) - .additional_info("eevee_shared") - .storage_buf(5, Qualifier::READ, "ShadowTileMapData", "tilemaps_buf[]") - .storage_buf(6, Qualifier::READ, "uint", "tiles_buf[]") - .fragment_out(0, Type::VEC4, "out_color_add", DualBlend::SRC_0) - .fragment_out(0, Type::VEC4, "out_color_mul", DualBlend::SRC_1) - .push_constant(Type::INT, "debug_mode") - .push_constant(Type::INT, "debug_tilemap_index") - .depth_write(DepthWrite::ANY) - .fragment_source("eevee_shadow_debug_frag.glsl") - .additional_info( - "draw_fullscreen", "draw_view", "eevee_hiz_data", "eevee_light_data", "eevee_shadow_data"); +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(eevee_shared) +STORAGE_BUF(5, READ, ShadowTileMapData, tilemaps_buf[]) +STORAGE_BUF(6, READ, uint, tiles_buf[]) +FRAGMENT_OUT_DUAL(0, VEC4, out_color_add, SRC_0) +FRAGMENT_OUT_DUAL(0, VEC4, out_color_mul, SRC_1) +PUSH_CONSTANT(INT, debug_mode) +PUSH_CONSTANT(INT, debug_tilemap_index) +DEPTH_WRITE(DepthWrite::ANY) +FRAGMENT_SOURCE("eevee_shadow_debug_frag.glsl") +ADDITIONAL_INFO(draw_fullscreen) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_hiz_data) +ADDITIONAL_INFO(eevee_light_data) +ADDITIONAL_INFO(eevee_shadow_data) +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_subsurface_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_subsurface_info.hh index a6ea8f6b4e6..9cbf7912e55 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_subsurface_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_subsurface_info.hh @@ -6,37 +6,34 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(eevee_subsurface_setup) - .do_static_compilation(true) - .local_group_size(SUBSURFACE_GROUP_SIZE, SUBSURFACE_GROUP_SIZE) - .typedef_source("draw_shader_shared.hh") - .additional_info("draw_view") - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data") - .sampler(2, ImageType::DEPTH_2D, "depth_tx") - .image(0, DEFERRED_RADIANCE_FORMAT, Qualifier::READ, ImageType::UINT_2D, "direct_light_img") - .image(1, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "indirect_light_img") - .image(2, SUBSURFACE_OBJECT_ID_FORMAT, Qualifier::WRITE, ImageType::UINT_2D, "object_id_img") - .image(3, SUBSURFACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "radiance_img") - .storage_buf(0, Qualifier::WRITE, "uint", "convolve_tile_buf[]") - .storage_buf(1, Qualifier::READ_WRITE, "DispatchCommand", "convolve_dispatch_buf") - .compute_source("eevee_subsurface_setup_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(SUBSURFACE_GROUP_SIZE, SUBSURFACE_GROUP_SIZE) +TYPEDEF_SOURCE("draw_shader_shared.hh") +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +SAMPLER(2, DEPTH_2D, depth_tx) +IMAGE(0, DEFERRED_RADIANCE_FORMAT, READ, UINT_2D, direct_light_img) +IMAGE(1, RAYTRACE_RADIANCE_FORMAT, READ, FLOAT_2D, indirect_light_img) +IMAGE(2, SUBSURFACE_OBJECT_ID_FORMAT, WRITE, UINT_2D, object_id_img) +IMAGE(3, SUBSURFACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, radiance_img) +STORAGE_BUF(0, WRITE, uint, convolve_tile_buf[]) +STORAGE_BUF(1, READ_WRITE, DispatchCommand, convolve_dispatch_buf) +COMPUTE_SOURCE("eevee_subsurface_setup_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_subsurface_convolve) - .do_static_compilation(true) - .local_group_size(SUBSURFACE_GROUP_SIZE, SUBSURFACE_GROUP_SIZE) - .additional_info("draw_view") - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data") - .additional_info("eevee_global_ubo") - .sampler(2, ImageType::FLOAT_2D, "radiance_tx") - .sampler(3, ImageType::DEPTH_2D, "depth_tx") - .sampler(4, ImageType::UINT_2D, "object_id_tx") - .storage_buf(0, Qualifier::READ, "uint", "tiles_coord_buf[]") - .image( - 0, DEFERRED_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::UINT_2D, "out_direct_light_img") - .image(1, - RAYTRACE_RADIANCE_FORMAT, - Qualifier::WRITE, - ImageType::FLOAT_2D, - "out_indirect_light_img") - .compute_source("eevee_subsurface_convolve_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(SUBSURFACE_GROUP_SIZE, SUBSURFACE_GROUP_SIZE) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(eevee_global_ubo) +SAMPLER(2, FLOAT_2D, radiance_tx) +SAMPLER(3, DEPTH_2D, depth_tx) +SAMPLER(4, UINT_2D, object_id_tx) +STORAGE_BUF(0, READ, uint, tiles_coord_buf[]) +IMAGE(0, DEFERRED_RADIANCE_FORMAT, WRITE, UINT_2D, out_direct_light_img) +IMAGE(1, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, out_indirect_light_img) +COMPUTE_SOURCE("eevee_subsurface_convolve_comp.glsl") +GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_tracing_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_tracing_info.hh index ff8f1a26084..ff2a2acd6a7 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_tracing_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_tracing_info.hh @@ -15,250 +15,266 @@ image(slot, format, Qualifier::READ, type, name, Frequency::PASS) GPU_SHADER_CREATE_INFO(eevee_ray_tile_classify) - .do_static_compilation(true) - .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data") - .additional_info("eevee_global_ubo") - .typedef_source("draw_shader_shared.hh") - .image_out(0, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_raytrace_denoise_img") - .image_out(1, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_raytrace_tracing_img") - .image_out(2, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_horizon_denoise_img") - .image_out(3, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_horizon_tracing_img") - .compute_source("eevee_ray_tile_classify_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(eevee_global_ubo) +TYPEDEF_SOURCE("draw_shader_shared.hh") +IMAGE_FREQ(0, RAYTRACE_TILEMASK_FORMAT, WRITE, UINT_2D_ARRAY, tile_raytrace_denoise_img, PASS) +IMAGE_FREQ(1, RAYTRACE_TILEMASK_FORMAT, WRITE, UINT_2D_ARRAY, tile_raytrace_tracing_img, PASS) +IMAGE_FREQ(2, RAYTRACE_TILEMASK_FORMAT, WRITE, UINT_2D_ARRAY, tile_horizon_denoise_img, PASS) +IMAGE_FREQ(3, RAYTRACE_TILEMASK_FORMAT, WRITE, UINT_2D_ARRAY, tile_horizon_tracing_img, PASS) +COMPUTE_SOURCE("eevee_ray_tile_classify_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_ray_tile_compact) - .do_static_compilation(true) - .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_global_ubo") - .typedef_source("draw_shader_shared.hh") - .image_in(0, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_raytrace_denoise_img") - .image_in(1, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_raytrace_tracing_img") - .storage_buf(0, Qualifier::READ_WRITE, "DispatchCommand", "raytrace_tracing_dispatch_buf") - .storage_buf(1, Qualifier::READ_WRITE, "DispatchCommand", "raytrace_denoise_dispatch_buf") - .storage_buf(4, Qualifier::WRITE, "uint", "raytrace_tracing_tiles_buf[]") - .storage_buf(5, Qualifier::WRITE, "uint", "raytrace_denoise_tiles_buf[]") - .specialization_constant(Type::INT, "closure_index", 0) - .specialization_constant(Type::INT, "resolution_scale", 2) - .compute_source("eevee_ray_tile_compact_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_global_ubo) +TYPEDEF_SOURCE("draw_shader_shared.hh") +IMAGE_FREQ(0, RAYTRACE_TILEMASK_FORMAT, READ, UINT_2D_ARRAY, tile_raytrace_denoise_img, PASS) +IMAGE_FREQ(1, RAYTRACE_TILEMASK_FORMAT, READ, UINT_2D_ARRAY, tile_raytrace_tracing_img, PASS) +STORAGE_BUF(0, READ_WRITE, DispatchCommand, raytrace_tracing_dispatch_buf) +STORAGE_BUF(1, READ_WRITE, DispatchCommand, raytrace_denoise_dispatch_buf) +STORAGE_BUF(4, WRITE, uint, raytrace_tracing_tiles_buf[]) +STORAGE_BUF(5, WRITE, uint, raytrace_denoise_tiles_buf[]) +SPECIALIZATION_CONSTANT(INT, closure_index, 0) +SPECIALIZATION_CONSTANT(INT, resolution_scale, 2) +COMPUTE_SOURCE("eevee_ray_tile_compact_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_ray_generate) - .do_static_compilation(true) - .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data") - .additional_info("eevee_global_ubo") - .additional_info("eevee_sampling_data") - .additional_info("draw_view") - .additional_info("eevee_utility_texture") - .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_ray_data_img") - .storage_buf(4, Qualifier::READ, "uint", "tiles_coord_buf[]") - .specialization_constant(Type::INT, "closure_index", 0) - .compute_source("eevee_ray_generate_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_utility_texture) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, out_ray_data_img) +STORAGE_BUF(4, READ, uint, tiles_coord_buf[]) +SPECIALIZATION_CONSTANT(INT, closure_index, 0) +COMPUTE_SOURCE("eevee_ray_generate_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_ray_trace_fallback) - .do_static_compilation(true) - .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data") - .additional_info("eevee_global_ubo") - .additional_info("draw_view") - .additional_info("eevee_sampling_data") - .additional_info("eevee_lightprobe_data") - .image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "ray_data_img") - .image(1, RAYTRACE_RAYTIME_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_time_img") - .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_radiance_img") - .sampler(1, ImageType::DEPTH_2D, "depth_tx") - .storage_buf(5, Qualifier::READ, "uint", "tiles_coord_buf[]") - .specialization_constant(Type::INT, "closure_index", 0) - .compute_source("eevee_ray_trace_fallback_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_lightprobe_data) +IMAGE(0, GPU_RGBA16F, READ, FLOAT_2D, ray_data_img) +IMAGE(1, RAYTRACE_RAYTIME_FORMAT, WRITE, FLOAT_2D, ray_time_img) +IMAGE(2, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, ray_radiance_img) +SAMPLER(1, DEPTH_2D, depth_tx) +STORAGE_BUF(5, READ, uint, tiles_coord_buf[]) +SPECIALIZATION_CONSTANT(INT, closure_index, 0) +COMPUTE_SOURCE("eevee_ray_trace_fallback_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_ray_trace_planar) - .do_static_compilation(true) - .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .define("PLANAR_PROBES") - .additional_info("eevee_shared") - .additional_info("eevee_global_ubo") - .additional_info("eevee_sampling_data") - .additional_info("eevee_gbuffer_data") - .additional_info("draw_view") - .additional_info("eevee_lightprobe_data") - .additional_info("eevee_lightprobe_planar_data") - .image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "ray_data_img") - .image(1, RAYTRACE_RAYTIME_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_time_img") - .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_radiance_img") - .sampler(2, ImageType::DEPTH_2D, "depth_tx") - .storage_buf(5, Qualifier::READ, "uint", "tiles_coord_buf[]") - .specialization_constant(Type::INT, "closure_index", 0) - .compute_source("eevee_ray_trace_planar_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) +DEFINE("PLANAR_PROBES") +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_lightprobe_data) +ADDITIONAL_INFO(eevee_lightprobe_planar_data) +IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, ray_data_img) +IMAGE(1, RAYTRACE_RAYTIME_FORMAT, WRITE, FLOAT_2D, ray_time_img) +IMAGE(2, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, ray_radiance_img) +SAMPLER(2, DEPTH_2D, depth_tx) +STORAGE_BUF(5, READ, uint, tiles_coord_buf[]) +SPECIALIZATION_CONSTANT(INT, closure_index, 0) +COMPUTE_SOURCE("eevee_ray_trace_planar_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_ray_trace_screen) - .do_static_compilation(true) - .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_global_ubo") - .additional_info("eevee_sampling_data") - .additional_info("eevee_gbuffer_data") - .additional_info("draw_view") - .additional_info("eevee_hiz_data") - .additional_info("eevee_lightprobe_data") - .image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "ray_data_img") - .image(1, RAYTRACE_RAYTIME_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_time_img") - .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_radiance_img") - .sampler(0, ImageType::DEPTH_2D, "depth_tx") - .sampler(1, ImageType::FLOAT_2D, "radiance_front_tx") - .sampler(2, ImageType::FLOAT_2D, "radiance_back_tx") - .sampler(4, ImageType::FLOAT_2D, "hiz_front_tx") - .sampler(5, ImageType::FLOAT_2D, "hiz_back_tx") - .storage_buf(5, Qualifier::READ, "uint", "tiles_coord_buf[]") - .compute_source("eevee_ray_trace_screen_comp.glsl") - /* Metal: Provide compiler with hint to tune per-thread resource allocation. */ - .mtl_max_total_threads_per_threadgroup(400) - .specialization_constant(Type::BOOL, "trace_refraction", true) - .specialization_constant(Type::INT, "closure_index", 0) - .compute_source("eevee_ray_trace_screen_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_hiz_data) +ADDITIONAL_INFO(eevee_lightprobe_data) +IMAGE(0, GPU_RGBA16F, READ, FLOAT_2D, ray_data_img) +IMAGE(1, RAYTRACE_RAYTIME_FORMAT, WRITE, FLOAT_2D, ray_time_img) +IMAGE(2, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, ray_radiance_img) +SAMPLER(0, DEPTH_2D, depth_tx) +SAMPLER(1, FLOAT_2D, radiance_front_tx) +SAMPLER(2, FLOAT_2D, radiance_back_tx) +SAMPLER(4, FLOAT_2D, hiz_front_tx) +SAMPLER(5, FLOAT_2D, hiz_back_tx) +STORAGE_BUF(5, READ, uint, tiles_coord_buf[]) +COMPUTE_SOURCE("eevee_ray_trace_screen_comp.glsl") +/* Metal: Provide compiler with hint to tune per-thread resource allocation. */ +MTL_MAX_TOTAL_THREADS_PER_THREADGROUP(400) +SPECIALIZATION_CONSTANT(BOOL, trace_refraction, true) +SPECIALIZATION_CONSTANT(INT, closure_index, 0) +COMPUTE_SOURCE("eevee_ray_trace_screen_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_ray_denoise_spatial) - .do_static_compilation(true) - .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data") - .additional_info("eevee_global_ubo") - .additional_info("eevee_sampling_data") - .additional_info("draw_view") - .additional_info("eevee_utility_texture") - .sampler(3, ImageType::DEPTH_2D, "depth_tx") - .image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "ray_data_img") - .image(1, RAYTRACE_RAYTIME_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "ray_time_img") - .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "ray_radiance_img") - .image(3, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_radiance_img") - .image(4, RAYTRACE_VARIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_variance_img") - .image(5, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_hit_depth_img") - .image(6, RAYTRACE_TILEMASK_FORMAT, Qualifier::READ, ImageType::UINT_2D_ARRAY, "tile_mask_img") - .storage_buf(4, Qualifier::READ, "uint", "tiles_coord_buf[]") - /* Metal: Provide compiler with hint to tune per-thread resource allocation. */ - .mtl_max_total_threads_per_threadgroup(316) - .specialization_constant(Type::INT, "raytrace_resolution_scale", 2) - .specialization_constant(Type::BOOL, "skip_denoise", false) - .specialization_constant(Type::INT, "closure_index", 0) - .compute_source("eevee_ray_denoise_spatial_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_utility_texture) +SAMPLER(3, DEPTH_2D, depth_tx) +IMAGE(0, GPU_RGBA16F, READ, FLOAT_2D, ray_data_img) +IMAGE(1, RAYTRACE_RAYTIME_FORMAT, READ, FLOAT_2D, ray_time_img) +IMAGE(2, RAYTRACE_RADIANCE_FORMAT, READ, FLOAT_2D, ray_radiance_img) +IMAGE(3, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, out_radiance_img) +IMAGE(4, RAYTRACE_VARIANCE_FORMAT, WRITE, FLOAT_2D, out_variance_img) +IMAGE(5, GPU_R32F, WRITE, FLOAT_2D, out_hit_depth_img) +IMAGE(6, RAYTRACE_TILEMASK_FORMAT, READ, UINT_2D_ARRAY, tile_mask_img) +STORAGE_BUF(4, READ, uint, tiles_coord_buf[]) +/* Metal: Provide compiler with hint to tune per-thread resource allocation. */ +MTL_MAX_TOTAL_THREADS_PER_THREADGROUP(316) +SPECIALIZATION_CONSTANT(INT, raytrace_resolution_scale, 2) +SPECIALIZATION_CONSTANT(BOOL, skip_denoise, false) +SPECIALIZATION_CONSTANT(INT, closure_index, 0) +COMPUTE_SOURCE("eevee_ray_denoise_spatial_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_ray_denoise_temporal) - .do_static_compilation(true) - .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_global_ubo") - .additional_info("draw_view") - .sampler(0, ImageType::FLOAT_2D, "radiance_history_tx") - .sampler(1, ImageType::FLOAT_2D, "variance_history_tx") - .sampler(2, ImageType::UINT_2D_ARRAY, "tilemask_history_tx") - .sampler(3, ImageType::DEPTH_2D, "depth_tx") - .image(0, GPU_R32F, Qualifier::READ, ImageType::FLOAT_2D, "hit_depth_img") - .image(1, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "in_radiance_img") - .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_radiance_img") - .image(3, RAYTRACE_VARIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "in_variance_img") - .image(4, RAYTRACE_VARIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_variance_img") - .storage_buf(4, Qualifier::READ, "uint", "tiles_coord_buf[]") - .compute_source("eevee_ray_denoise_temporal_comp.glsl") - /* Metal: Provide compiler with hint to tune per-thread resource allocation. */ - .mtl_max_total_threads_per_threadgroup(512) - .specialization_constant(Type::INT, "closure_index", 0) - .compute_source("eevee_ray_denoise_temporal_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(draw_view) +SAMPLER(0, FLOAT_2D, radiance_history_tx) +SAMPLER(1, FLOAT_2D, variance_history_tx) +SAMPLER(2, UINT_2D_ARRAY, tilemask_history_tx) +SAMPLER(3, DEPTH_2D, depth_tx) +IMAGE(0, GPU_R32F, READ, FLOAT_2D, hit_depth_img) +IMAGE(1, RAYTRACE_RADIANCE_FORMAT, READ, FLOAT_2D, in_radiance_img) +IMAGE(2, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, out_radiance_img) +IMAGE(3, RAYTRACE_VARIANCE_FORMAT, READ, FLOAT_2D, in_variance_img) +IMAGE(4, RAYTRACE_VARIANCE_FORMAT, WRITE, FLOAT_2D, out_variance_img) +STORAGE_BUF(4, READ, uint, tiles_coord_buf[]) +COMPUTE_SOURCE("eevee_ray_denoise_temporal_comp.glsl") +/* Metal: Provide compiler with hint to tune per-thread resource allocation. */ +MTL_MAX_TOTAL_THREADS_PER_THREADGROUP(512) +SPECIALIZATION_CONSTANT(INT, closure_index, 0) +COMPUTE_SOURCE("eevee_ray_denoise_temporal_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_ray_denoise_bilateral) - .do_static_compilation(true) - .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data") - .additional_info("eevee_global_ubo") - .additional_info("eevee_sampling_data") - .additional_info("draw_view") - .sampler(1, ImageType::DEPTH_2D, "depth_tx") - .image(1, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "in_radiance_img") - .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_radiance_img") - .image(3, RAYTRACE_VARIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "in_variance_img") - .image(6, RAYTRACE_TILEMASK_FORMAT, Qualifier::READ, ImageType::UINT_2D_ARRAY, "tile_mask_img") - .storage_buf(4, Qualifier::READ, "uint", "tiles_coord_buf[]") - .specialization_constant(Type::INT, "closure_index", 0) - .compute_source("eevee_ray_denoise_bilateral_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(draw_view) +SAMPLER(1, DEPTH_2D, depth_tx) +IMAGE(1, RAYTRACE_RADIANCE_FORMAT, READ, FLOAT_2D, in_radiance_img) +IMAGE(2, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, out_radiance_img) +IMAGE(3, RAYTRACE_VARIANCE_FORMAT, READ, FLOAT_2D, in_variance_img) +IMAGE(6, RAYTRACE_TILEMASK_FORMAT, READ, UINT_2D_ARRAY, tile_mask_img) +STORAGE_BUF(4, READ, uint, tiles_coord_buf[]) +SPECIALIZATION_CONSTANT(INT, closure_index, 0) +COMPUTE_SOURCE("eevee_ray_denoise_bilateral_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_horizon_setup) - .do_static_compilation(true) - .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data") - .additional_info("eevee_global_ubo") - .additional_info("draw_view") - .sampler(0, ImageType::DEPTH_2D, "depth_tx") - .sampler(1, ImageType::FLOAT_2D, "in_radiance_tx") - .image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_radiance_img") - .image(3, GPU_RGB10_A2, Qualifier::WRITE, ImageType::FLOAT_2D, "out_normal_img") - .compute_source("eevee_horizon_setup_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(draw_view) +SAMPLER(0, DEPTH_2D, depth_tx) +SAMPLER(1, FLOAT_2D, in_radiance_tx) +IMAGE(2, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, out_radiance_img) +IMAGE(3, GPU_RGB10_A2, WRITE, FLOAT_2D, out_normal_img) +COMPUTE_SOURCE("eevee_horizon_setup_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_horizon_scan) - .do_static_compilation(true) - .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data") - .additional_info("eevee_global_ubo") - .additional_info("eevee_sampling_data") - .additional_info("eevee_utility_texture") - .additional_info("eevee_hiz_data") - .additional_info("draw_view") - .specialization_constant(Type::INT, "fast_gi_slice_count", 2) - .specialization_constant(Type::INT, "fast_gi_step_count", 8) - .specialization_constant(Type::BOOL, "fast_gi_ao_only", false) - .sampler(0, ImageType::FLOAT_2D, "screen_radiance_tx") - .sampler(1, ImageType::FLOAT_2D, "screen_normal_tx") - .image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "horizon_radiance_0_img") - .image(3, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "horizon_radiance_1_img") - .image(4, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "horizon_radiance_2_img") - .image(5, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "horizon_radiance_3_img") - .storage_buf(7, Qualifier::READ, "uint", "tiles_coord_buf[]") - /* Metal: Provide compiler with hint to tune per-thread resource allocation. */ - .mtl_max_total_threads_per_threadgroup(400) - .compute_source("eevee_horizon_scan_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_utility_texture) +ADDITIONAL_INFO(eevee_hiz_data) +ADDITIONAL_INFO(draw_view) +SPECIALIZATION_CONSTANT(INT, fast_gi_slice_count, 2) +SPECIALIZATION_CONSTANT(INT, fast_gi_step_count, 8) +SPECIALIZATION_CONSTANT(BOOL, fast_gi_ao_only, false) +SAMPLER(0, FLOAT_2D, screen_radiance_tx) +SAMPLER(1, FLOAT_2D, screen_normal_tx) +IMAGE(2, GPU_RGBA16F, WRITE, FLOAT_2D, horizon_radiance_0_img) +IMAGE(3, GPU_RGBA8, WRITE, FLOAT_2D, horizon_radiance_1_img) +IMAGE(4, GPU_RGBA8, WRITE, FLOAT_2D, horizon_radiance_2_img) +IMAGE(5, GPU_RGBA8, WRITE, FLOAT_2D, horizon_radiance_3_img) +STORAGE_BUF(7, READ, uint, tiles_coord_buf[]) +/* Metal: Provide compiler with hint to tune per-thread resource allocation. */ +MTL_MAX_TOTAL_THREADS_PER_THREADGROUP(400) +COMPUTE_SOURCE("eevee_horizon_scan_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_horizon_denoise) - .do_static_compilation(true) - .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info( - "eevee_shared", "eevee_global_ubo", "eevee_sampling_data", "eevee_hiz_data", "draw_view") - .sampler(2, ImageType::FLOAT_2D, "in_sh_0_tx") - .sampler(4, ImageType::FLOAT_2D, "in_sh_1_tx") - .sampler(5, ImageType::FLOAT_2D, "in_sh_2_tx") - .sampler(6, ImageType::FLOAT_2D, "in_sh_3_tx") - .sampler(7, ImageType::FLOAT_2D, "screen_normal_tx") - .image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_sh_0_img") - .image(3, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "out_sh_1_img") - .image(4, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "out_sh_2_img") - .image(5, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "out_sh_3_img") - .storage_buf(7, Qualifier::READ, "uint", "tiles_coord_buf[]") - .compute_source("eevee_horizon_denoise_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_hiz_data) +ADDITIONAL_INFO(draw_view) +SAMPLER(2, FLOAT_2D, in_sh_0_tx) +SAMPLER(4, FLOAT_2D, in_sh_1_tx) +SAMPLER(5, FLOAT_2D, in_sh_2_tx) +SAMPLER(6, FLOAT_2D, in_sh_3_tx) +SAMPLER(7, FLOAT_2D, screen_normal_tx) +IMAGE(2, GPU_RGBA16F, WRITE, FLOAT_2D, out_sh_0_img) +IMAGE(3, GPU_RGBA8, WRITE, FLOAT_2D, out_sh_1_img) +IMAGE(4, GPU_RGBA8, WRITE, FLOAT_2D, out_sh_2_img) +IMAGE(5, GPU_RGBA8, WRITE, FLOAT_2D, out_sh_3_img) +STORAGE_BUF(7, READ, uint, tiles_coord_buf[]) +COMPUTE_SOURCE("eevee_horizon_denoise_comp.glsl") +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_horizon_resolve) - .do_static_compilation(true) - .local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_gbuffer_data") - .additional_info("eevee_global_ubo") - .additional_info("eevee_sampling_data") - .additional_info("eevee_lightprobe_data") - .additional_info("draw_view") - .sampler(1, ImageType::DEPTH_2D, "depth_tx") - .sampler(2, ImageType::FLOAT_2D, "horizon_radiance_0_tx") - .sampler(3, ImageType::FLOAT_2D, "horizon_radiance_1_tx") - .sampler(4, ImageType::FLOAT_2D, "horizon_radiance_2_tx") - .sampler(5, ImageType::FLOAT_2D, "horizon_radiance_3_tx") - .sampler(8, ImageType::FLOAT_2D, "screen_normal_tx") - .image(3, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "closure0_img") - .image(4, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "closure1_img") - .image(5, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "closure2_img") - .storage_buf(7, Qualifier::READ, "uint", "tiles_coord_buf[]") - /* Metal: Provide compiler with hint to tune per-thread resource allocation. */ - .mtl_max_total_threads_per_threadgroup(400) - .compute_source("eevee_horizon_resolve_comp.glsl"); +DO_STATIC_COMPILATION() +LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_gbuffer_data) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_lightprobe_data) +ADDITIONAL_INFO(draw_view) +SAMPLER(1, DEPTH_2D, depth_tx) +SAMPLER(2, FLOAT_2D, horizon_radiance_0_tx) +SAMPLER(3, FLOAT_2D, horizon_radiance_1_tx) +SAMPLER(4, FLOAT_2D, horizon_radiance_2_tx) +SAMPLER(5, FLOAT_2D, horizon_radiance_3_tx) +SAMPLER(8, FLOAT_2D, screen_normal_tx) +IMAGE(3, RAYTRACE_RADIANCE_FORMAT, READ_WRITE, FLOAT_2D, closure0_img) +IMAGE(4, RAYTRACE_RADIANCE_FORMAT, READ_WRITE, FLOAT_2D, closure1_img) +IMAGE(5, RAYTRACE_RADIANCE_FORMAT, READ_WRITE, FLOAT_2D, closure2_img) +STORAGE_BUF(7, READ, uint, tiles_coord_buf[]) +/* Metal: Provide compiler with hint to tune per-thread resource allocation. */ +MTL_MAX_TOTAL_THREADS_PER_THREADGROUP(400) +COMPUTE_SOURCE("eevee_horizon_resolve_comp.glsl") +GPU_SHADER_CREATE_END() #undef image_out #undef image_in diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_velocity_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_velocity_info.hh index 4a2f8a15c05..4886ee77149 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_velocity_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_velocity_info.hh @@ -15,37 +15,38 @@ /* Pass world space deltas to the fragment shader. * This is to make sure that the resulting motion vectors are valid even with displacement. */ GPU_SHADER_NAMED_INTERFACE_INFO(eevee_velocity_surface_iface, motion) - .smooth(Type::VEC3, "prev") - .smooth(Type::VEC3, "next"); +SMOOTH(VEC3, prev) +SMOOTH(VEC3, next) +GPU_SHADER_NAMED_INTERFACE_END(motion) GPU_SHADER_CREATE_INFO(eevee_velocity_camera) - .define("VELOCITY_CAMERA") - .uniform_buf(VELOCITY_CAMERA_PREV_BUF, "CameraData", "camera_prev") - .uniform_buf(VELOCITY_CAMERA_CURR_BUF, "CameraData", "camera_curr") - .uniform_buf(VELOCITY_CAMERA_NEXT_BUF, "CameraData", "camera_next"); +DEFINE("VELOCITY_CAMERA") +UNIFORM_BUF(VELOCITY_CAMERA_PREV_BUF, CameraData, camera_prev) +UNIFORM_BUF(VELOCITY_CAMERA_CURR_BUF, CameraData, camera_curr) +UNIFORM_BUF(VELOCITY_CAMERA_NEXT_BUF, CameraData, camera_next) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_velocity_geom) - .define("MAT_VELOCITY") - .storage_buf(VELOCITY_OBJ_PREV_BUF_SLOT, Qualifier::READ, "mat4", "velocity_obj_prev_buf[]") - .storage_buf(VELOCITY_OBJ_NEXT_BUF_SLOT, Qualifier::READ, "mat4", "velocity_obj_next_buf[]") - .storage_buf(VELOCITY_GEO_PREV_BUF_SLOT, Qualifier::READ, "vec4", "velocity_geo_prev_buf[]") - .storage_buf(VELOCITY_GEO_NEXT_BUF_SLOT, Qualifier::READ, "vec4", "velocity_geo_next_buf[]") - .storage_buf(VELOCITY_INDIRECTION_BUF_SLOT, - Qualifier::READ, - "VelocityIndex", - "velocity_indirection_buf[]") - .vertex_out(eevee_velocity_surface_iface) - .fragment_out(0, Type::VEC4, "out_velocity") - .additional_info("eevee_velocity_camera"); +DEFINE("MAT_VELOCITY") +STORAGE_BUF(VELOCITY_OBJ_PREV_BUF_SLOT, READ, mat4, velocity_obj_prev_buf[]) +STORAGE_BUF(VELOCITY_OBJ_NEXT_BUF_SLOT, READ, mat4, velocity_obj_next_buf[]) +STORAGE_BUF(VELOCITY_GEO_PREV_BUF_SLOT, READ, vec4, velocity_geo_prev_buf[]) +STORAGE_BUF(VELOCITY_GEO_NEXT_BUF_SLOT, READ, vec4, velocity_geo_next_buf[]) +STORAGE_BUF(VELOCITY_INDIRECTION_BUF_SLOT, READ, VelocityIndex, velocity_indirection_buf[]) +VERTEX_OUT(eevee_velocity_surface_iface) +FRAGMENT_OUT(0, VEC4, out_velocity) +ADDITIONAL_INFO(eevee_velocity_camera) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_vertex_copy) - .compute_source("eevee_vertex_copy_comp.glsl") - .local_group_size(VERTEX_COPY_GROUP_SIZE) - .storage_buf(0, Qualifier::READ, "float", "in_buf[]") - .storage_buf(1, Qualifier::WRITE, "vec4", "out_buf[]") - .push_constant(Type::INT, "start_offset") - .push_constant(Type::INT, "vertex_stride") - .push_constant(Type::INT, "vertex_count") - .do_static_compilation(true); +COMPUTE_SOURCE("eevee_vertex_copy_comp.glsl") +LOCAL_GROUP_SIZE(VERTEX_COPY_GROUP_SIZE) +STORAGE_BUF(0, READ, float, in_buf[]) +STORAGE_BUF(1, WRITE, vec4, out_buf[]) +PUSH_CONSTANT(INT, start_offset) +PUSH_CONSTANT(INT, vertex_stride) +PUSH_CONSTANT(INT, vertex_count) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_volume_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_volume_info.hh index ea7c2c6908d..d49d0a27267 100644 --- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_volume_info.hh +++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_volume_info.hh @@ -8,106 +8,88 @@ /* Used for shaders that need the final accumulated volume transmittance and scattering. */ GPU_SHADER_CREATE_INFO(eevee_volume_lib) - .additional_info("eevee_shared") - .additional_info("eevee_global_ubo") - .additional_info("draw_view") - .sampler(VOLUME_SCATTERING_TEX_SLOT, ImageType::FLOAT_3D, "volume_scattering_tx") - .sampler(VOLUME_TRANSMITTANCE_TEX_SLOT, ImageType::FLOAT_3D, "volume_transmittance_tx"); +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(draw_view) +SAMPLER(VOLUME_SCATTERING_TEX_SLOT, FLOAT_3D, volume_scattering_tx) +SAMPLER(VOLUME_TRANSMITTANCE_TEX_SLOT, FLOAT_3D, volume_transmittance_tx) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_volume_properties_data) - .additional_info("eevee_global_ubo") - .image(VOLUME_PROP_SCATTERING_IMG_SLOT, - GPU_R11F_G11F_B10F, - Qualifier::READ, - ImageType::FLOAT_3D, - "in_scattering_img") - .image(VOLUME_PROP_EXTINCTION_IMG_SLOT, - GPU_R11F_G11F_B10F, - Qualifier::READ, - ImageType::FLOAT_3D, - "in_extinction_img") - .image(VOLUME_PROP_EMISSION_IMG_SLOT, - GPU_R11F_G11F_B10F, - Qualifier::READ, - ImageType::FLOAT_3D, - "in_emission_img") - .image( - VOLUME_PROP_PHASE_IMG_SLOT, GPU_R16F, Qualifier::READ, ImageType::FLOAT_3D, "in_phase_img") - .image(VOLUME_PROP_PHASE_WEIGHT_IMG_SLOT, - GPU_R16F, - Qualifier::READ, - ImageType::FLOAT_3D, - "in_phase_weight_img"); +ADDITIONAL_INFO(eevee_global_ubo) +IMAGE(VOLUME_PROP_SCATTERING_IMG_SLOT, GPU_R11F_G11F_B10F, READ, FLOAT_3D, in_scattering_img) +IMAGE(VOLUME_PROP_EXTINCTION_IMG_SLOT, GPU_R11F_G11F_B10F, READ, FLOAT_3D, in_extinction_img) +IMAGE(VOLUME_PROP_EMISSION_IMG_SLOT, GPU_R11F_G11F_B10F, READ, FLOAT_3D, in_emission_img) +IMAGE(VOLUME_PROP_PHASE_IMG_SLOT, GPU_R16F, READ, FLOAT_3D, in_phase_img) +IMAGE(VOLUME_PROP_PHASE_WEIGHT_IMG_SLOT, GPU_R16F, READ, FLOAT_3D, in_phase_weight_img) +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_volume_scatter) - .local_group_size(VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE) - .additional_info("eevee_shared") - .additional_info("eevee_global_ubo") - .additional_info("draw_resource_id_varying") - .additional_info("draw_view") - .additional_info("eevee_light_data") - .additional_info("eevee_lightprobe_data") - .additional_info("eevee_shadow_data") - .additional_info("eevee_sampling_data") - .additional_info("eevee_utility_texture") - .additional_info("eevee_volume_properties_data") - .sampler(0, ImageType::FLOAT_3D, "scattering_history_tx") - .sampler(1, ImageType::FLOAT_3D, "extinction_history_tx") - .image(5, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_3D, "out_scattering_img") - .image(6, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_3D, "out_extinction_img") - .compute_source("eevee_volume_scatter_comp.glsl") - .do_static_compilation(true); +LOCAL_GROUP_SIZE(VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE) +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(draw_resource_id_varying) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_light_data) +ADDITIONAL_INFO(eevee_lightprobe_data) +ADDITIONAL_INFO(eevee_shadow_data) +ADDITIONAL_INFO(eevee_sampling_data) +ADDITIONAL_INFO(eevee_utility_texture) +ADDITIONAL_INFO(eevee_volume_properties_data) +SAMPLER(0, FLOAT_3D, scattering_history_tx) +SAMPLER(1, FLOAT_3D, extinction_history_tx) +IMAGE(5, GPU_R11F_G11F_B10F, WRITE, FLOAT_3D, out_scattering_img) +IMAGE(6, GPU_R11F_G11F_B10F, WRITE, FLOAT_3D, out_extinction_img) +COMPUTE_SOURCE("eevee_volume_scatter_comp.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_volume_scatter_with_lights) - .additional_info("eevee_volume_scatter") - .define("VOLUME_LIGHTING") - .define("VOLUME_IRRADIANCE") - .define("VOLUME_SHADOW") - .sampler(9, ImageType::FLOAT_3D, "extinction_tx") - .do_static_compilation(true); +ADDITIONAL_INFO(eevee_volume_scatter) +DEFINE("VOLUME_LIGHTING") +DEFINE("VOLUME_IRRADIANCE") +DEFINE("VOLUME_SHADOW") +SAMPLER(9, FLOAT_3D, extinction_tx) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_volume_occupancy_convert) - .additional_info("eevee_shared") - .additional_info("eevee_global_ubo") - .additional_info("draw_fullscreen") - .builtins(BuiltinBits::TEXTURE_ATOMIC) - .image(VOLUME_HIT_DEPTH_SLOT, GPU_R32F, Qualifier::READ, ImageType::FLOAT_3D, "hit_depth_img") - .image(VOLUME_HIT_COUNT_SLOT, - GPU_R32UI, - Qualifier::READ_WRITE, - ImageType::UINT_2D, - "hit_count_img") - .image(VOLUME_OCCUPANCY_SLOT, - GPU_R32UI, - Qualifier::READ_WRITE, - ImageType::UINT_3D_ATOMIC, - "occupancy_img") - .fragment_source("eevee_occupancy_convert_frag.glsl") - .do_static_compilation(true); +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(draw_fullscreen) +BUILTINS(BuiltinBits::TEXTURE_ATOMIC) +IMAGE(VOLUME_HIT_DEPTH_SLOT, GPU_R32F, READ, FLOAT_3D, hit_depth_img) +IMAGE(VOLUME_HIT_COUNT_SLOT, GPU_R32UI, READ_WRITE, UINT_2D, hit_count_img) +IMAGE(VOLUME_OCCUPANCY_SLOT, GPU_R32UI, READ_WRITE, UINT_3D_ATOMIC, occupancy_img) +FRAGMENT_SOURCE("eevee_occupancy_convert_frag.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_volume_integration) - .additional_info("eevee_shared") - .additional_info("eevee_global_ubo") - .additional_info("draw_view") - .additional_info("eevee_sampling_data") - .compute_source("eevee_volume_integration_comp.glsl") - .local_group_size(VOLUME_INTEGRATION_GROUP_SIZE, VOLUME_INTEGRATION_GROUP_SIZE, 1) - /* Inputs. */ - .sampler(0, ImageType::FLOAT_3D, "in_scattering_tx") - .sampler(1, ImageType::FLOAT_3D, "in_extinction_tx") - /* Outputs. */ - .image(0, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_3D, "out_scattering_img") - .image(1, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_3D, "out_transmittance_img") - .do_static_compilation(true); +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_global_ubo) +ADDITIONAL_INFO(draw_view) +ADDITIONAL_INFO(eevee_sampling_data) +COMPUTE_SOURCE("eevee_volume_integration_comp.glsl") +LOCAL_GROUP_SIZE(VOLUME_INTEGRATION_GROUP_SIZE, VOLUME_INTEGRATION_GROUP_SIZE, 1) +/* Inputs. */ +SAMPLER(0, FLOAT_3D, in_scattering_tx) +SAMPLER(1, FLOAT_3D, in_extinction_tx) +/* Outputs. */ +IMAGE(0, GPU_R11F_G11F_B10F, WRITE, FLOAT_3D, out_scattering_img) +IMAGE(1, GPU_R11F_G11F_B10F, WRITE, FLOAT_3D, out_transmittance_img) +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_volume_resolve) - .additional_info("eevee_shared") - .additional_info("eevee_volume_lib") - .additional_info("draw_fullscreen") - .additional_info("eevee_render_pass_out") - .additional_info("eevee_hiz_data") - .fragment_source("eevee_volume_resolve_frag.glsl") - .fragment_out(0, Type::VEC4, "out_radiance", DualBlend::SRC_0) - .fragment_out(0, Type::VEC4, "out_transmittance", DualBlend::SRC_1) - /** TODO(Miguel Pozo): Volume RenderPasses. */ - .do_static_compilation(true); +ADDITIONAL_INFO(eevee_shared) +ADDITIONAL_INFO(eevee_volume_lib) +ADDITIONAL_INFO(draw_fullscreen) +ADDITIONAL_INFO(eevee_render_pass_out) +ADDITIONAL_INFO(eevee_hiz_data) +FRAGMENT_SOURCE("eevee_volume_resolve_frag.glsl") +FRAGMENT_OUT_DUAL(0, VEC4, out_radiance, SRC_0) +FRAGMENT_OUT_DUAL(0, VEC4, out_transmittance, SRC_1) +/** TODO(Miguel Pozo): Volume RenderPasses. */ +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() -- 2.30.2 From 9e190764c7163023611becca79f40792d198e9c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 19:32:58 +0200 Subject: [PATCH 88/90] Enable EEVEE infos --- .../blender/gpu/shaders/gpu_glsl_cpp_stubs.hh | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh index eff1ebab28a..9e0ebe7710d 100644 --- a/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh +++ b/source/blender/gpu/shaders/gpu_glsl_cpp_stubs.hh @@ -809,7 +809,6 @@ void groupMemoryBarrier() {} /* Include all create infos here so that they don't need to be individually included * inside shaders. */ -/* TODO(fclem): Enable the ones ported to the macro Create infos. */ #include "draw_debug_info.hh" #include "draw_fullscreen_info.hh" #include "draw_hair_refine_info.hh" @@ -874,23 +873,23 @@ void groupMemoryBarrier() {} #include "infos/compositor_van_vliet_gaussian_blur_info.hh" #include "infos/compositor_write_output_info.hh" #include "infos/compositor_z_combine_info.hh" -// #include "infos/eevee_ambient_occlusion_info.hh" -// #include "infos/eevee_deferred_info.hh" -// #include "infos/eevee_depth_of_field_info.hh" -// #include "infos/eevee_film_info.hh" -// #include "infos/eevee_hiz_info.hh" -// #include "infos/eevee_light_culling_info.hh" -// #include "infos/eevee_lightprobe_sphere_info.hh" -// #include "infos/eevee_lightprobe_volume_info.hh" -// #include "infos/eevee_lookdev_info.hh" -// #include "infos/eevee_lut_info.hh" -// #include "infos/eevee_material_info.hh" -// #include "infos/eevee_motion_blur_info.hh" -// #include "infos/eevee_shadow_info.hh" -// #include "infos/eevee_subsurface_info.hh" -// #include "infos/eevee_tracing_info.hh" -// #include "infos/eevee_velocity_info.hh" -// #include "infos/eevee_volume_info.hh" +#include "infos/eevee_ambient_occlusion_info.hh" +#include "infos/eevee_deferred_info.hh" +#include "infos/eevee_depth_of_field_info.hh" +#include "infos/eevee_film_info.hh" +#include "infos/eevee_hiz_info.hh" +#include "infos/eevee_light_culling_info.hh" +#include "infos/eevee_lightprobe_sphere_info.hh" +#include "infos/eevee_lightprobe_volume_info.hh" +#include "infos/eevee_lookdev_info.hh" +#include "infos/eevee_lut_info.hh" +#include "infos/eevee_material_info.hh" +#include "infos/eevee_motion_blur_info.hh" +#include "infos/eevee_shadow_info.hh" +#include "infos/eevee_subsurface_info.hh" +#include "infos/eevee_tracing_info.hh" +#include "infos/eevee_velocity_info.hh" +#include "infos/eevee_volume_info.hh" #include "infos/engine_image_info.hh" #include "infos/gpencil_info.hh" #include "infos/gpencil_vfx_info.hh" -- 2.30.2 From 152852e877b6d5f7533be655d4b2028fe79641c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 19:47:09 +0200 Subject: [PATCH 89/90] Fix interface types not being defined --- source/blender/gpu/GPU_shader_shared_utils.hh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/blender/gpu/GPU_shader_shared_utils.hh b/source/blender/gpu/GPU_shader_shared_utils.hh index 244d877c57e..7308a53cf51 100644 --- a/source/blender/gpu/GPU_shader_shared_utils.hh +++ b/source/blender/gpu/GPU_shader_shared_utils.hh @@ -29,7 +29,13 @@ */ #ifdef GLSL_CPP_STUBS -/* Do nothing. */ +# pragma once +using bool32_t = bool; +/** Packed types are needed for MSL which have different alignment rules for float3. */ +using packed_float3 = float3; +using packed_int3 = int3; +using packed_uint3 = uint3; + #elif defined(GPU_SHADER) /* Silence macros when compiling for shaders. */ # define BLI_STATIC_ASSERT(cond, msg) -- 2.30.2 From 20112f00beb9669b15e0a415917a0a5315c67fc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Sat, 28 Sep 2024 19:47:29 +0200 Subject: [PATCH 90/90] EEVEE: Fix samplerGBuffer macros --- .../draw/engines/eevee_next/shaders/eevee_gbuffer_lib.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/draw/engines/eevee_next/shaders/eevee_gbuffer_lib.glsl b/source/blender/draw/engines/eevee_next/shaders/eevee_gbuffer_lib.glsl index ee98a9a99af..256e254c36c 100644 --- a/source/blender/draw/engines/eevee_next/shaders/eevee_gbuffer_lib.glsl +++ b/source/blender/draw/engines/eevee_next/shaders/eevee_gbuffer_lib.glsl @@ -113,7 +113,7 @@ ClosureType gbuffer_mode_to_closure_type(uint mode) * This allows for writing unit tests that read and write during the same shader invocation. * \{ */ -#ifdef GBUFFER_LOAD +#if defined(GBUFFER_LOAD) || defined(GLSL_CPP_STUBS) /* Read only shader. Use correct types and functions. */ # define samplerGBufferHeader usampler2D # define samplerGBufferClosure sampler2DArray -- 2.30.2