[Bf-blender-cvs] [4047715af3e] blender2.8: Cleanup: use pre-defined STRINGIFY macro

Campbell Barton noreply at git.blender.org
Thu May 18 03:22:47 CEST 2017


Commit: 4047715af3ed65ed350e68bb2b45296b1325b1c5
Author: Campbell Barton
Date:   Thu May 18 11:20:54 2017 +1000
Branches: blender2.8
https://developer.blender.org/rB4047715af3ed65ed350e68bb2b45296b1325b1c5

Cleanup: use pre-defined STRINGIFY macro

===================================================================

M	source/blender/draw/engines/clay/clay_engine.c
M	source/blender/draw/engines/eevee/eevee_engine.c

===================================================================

diff --git a/source/blender/draw/engines/clay/clay_engine.c b/source/blender/draw/engines/clay/clay_engine.c
index 9ce4cc4cd84..ee1516bf030 100644
--- a/source/blender/draw/engines/clay/clay_engine.c
+++ b/source/blender/draw/engines/clay/clay_engine.c
@@ -43,6 +43,14 @@
 
 #define CLAY_ENGINE "BLENDER_CLAY"
 
+#define MAX_CLAY_MAT 512 /* 512 = 9 bit material id */
+
+#define SHADER_DEFINES \
+	"#define MAX_MATERIAL " STRINGIFY(MAX_CLAY_MAT) "\n" \
+	"#define USE_ROTATION\n" \
+	"#define USE_AO\n" \
+	"#define USE_HSV\n"
+
 extern char datatoc_clay_frag_glsl[];
 extern char datatoc_clay_vert_glsl[];
 extern char datatoc_ssao_alchemy_glsl[];
@@ -73,8 +81,6 @@ typedef struct CLAY_HAIR_UBO_Material {
 } CLAY_HAIR_UBO_Material; /* 32 bytes */
 BLI_STATIC_ASSERT_ALIGN(CLAY_UBO_Material, 16)
 
-#define MAX_CLAY_MAT 512 /* 512 = 9 bit material id */
-
 typedef struct CLAY_UBO_Storage {
 	CLAY_UBO_Material materials[MAX_CLAY_MAT];
 } CLAY_UBO_Storage;
@@ -327,10 +333,7 @@ static void CLAY_engine_init(void *vedata)
 	if (!e_data.clay_sh) {
 		DynStr *ds = BLI_dynstr_new();
 		const char *max_mat =
-			"#define MAX_MATERIAL 512\n"
-			"#define USE_ROTATION\n"
-			"#define USE_AO\n"
-			"#define USE_HSV\n";
+			SHADER_DEFINES;
 		char *matcap_with_ao;
 
 		BLI_dynstr_append(ds, datatoc_clay_frag_glsl);
diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c
index 783ac87e608..209584426bf 100644
--- a/source/blender/draw/engines/eevee/eevee_engine.c
+++ b/source/blender/draw/engines/eevee/eevee_engine.c
@@ -39,16 +39,13 @@
 
 #define EEVEE_ENGINE "BLENDER_EEVEE"
 
-#define STR_HELPER(x) #x
-#define STR(x) STR_HELPER(x)
-
 #define SHADER_DEFINES \
 	"#define EEVEE_ENGINE\n" \
-	"#define MAX_LIGHT " STR(MAX_LIGHT) "\n" \
-	"#define MAX_SHADOW_CUBE " STR(MAX_SHADOW_CUBE) "\n" \
-	"#define MAX_SHADOW_MAP " STR(MAX_SHADOW_MAP) "\n" \
-	"#define MAX_SHADOW_CASCADE " STR(MAX_SHADOW_CASCADE) "\n" \
-	"#define MAX_CASCADE_NUM " STR(MAX_CASCADE_NUM) "\n"
+	"#define MAX_LIGHT " STRINGIFY(MAX_LIGHT) "\n" \
+	"#define MAX_SHADOW_CUBE " STRINGIFY(MAX_SHADOW_CUBE) "\n" \
+	"#define MAX_SHADOW_MAP " STRINGIFY(MAX_SHADOW_MAP) "\n" \
+	"#define MAX_SHADOW_CASCADE " STRINGIFY(MAX_SHADOW_CASCADE) "\n" \
+	"#define MAX_CASCADE_NUM " STRINGIFY(MAX_CASCADE_NUM) "\n"
 
 /* *********** STATIC *********** */
 static struct {




More information about the Bf-blender-cvs mailing list