From 48e45ce2d75588703339089eb15e01fa5cc32069 Mon Sep 17 00:00:00 2001 From: jk20012001 Date: Mon, 14 Mar 2022 17:53:06 +0800 Subject: [PATCH] fix compiling error with merged code (#10332) * fix compiling error with merged code * code style --- editor/assets/chunks/cc-local-batch.chunk | 12 +++++++++++- editor/assets/chunks/cc-local.chunk | 8 -------- editor/assets/chunks/standard-surface-entry.chunk | 3 ++- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/editor/assets/chunks/cc-local-batch.chunk b/editor/assets/chunks/cc-local-batch.chunk index a9c8a58584..fe81194985 100644 --- a/editor/assets/chunks/cc-local-batch.chunk +++ b/editor/assets/chunks/cc-local-batch.chunk @@ -3,7 +3,17 @@ #pragma define-meta USE_INSTANCING editor(elevated: true) #pragma define-meta USE_BATCHING editor(elevated: true) -#include +#if !USE_INSTANCING + #if USE_BATCHING + #pragma define BATCHING_COUNT 10 + #pragma builtin(local) + layout(set = 2, binding = 0) uniform CCLocalBatched { + highp mat4 cc_matWorlds[BATCHING_COUNT]; + }; + #else + #include + #endif +#endif void CCGetWorldMatrix(out mat4 matWorld) { diff --git a/editor/assets/chunks/cc-local.chunk b/editor/assets/chunks/cc-local.chunk index 8128f86ad9..a2bfe24071 100644 --- a/editor/assets/chunks/cc-local.chunk +++ b/editor/assets/chunks/cc-local.chunk @@ -1,13 +1,5 @@ // Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd. -#if USE_BATCHING - #pragma define BATCHING_COUNT 10 - #pragma builtin(local) - layout(set = 2, binding = 0) uniform CCLocalBatched { - highp mat4 cc_matWorlds[BATCHING_COUNT]; - }; -#endif - #pragma builtin(local) layout(set = 2, binding = 0) uniform CCLocal { highp mat4 cc_matWorld; diff --git a/editor/assets/chunks/standard-surface-entry.chunk b/editor/assets/chunks/standard-surface-entry.chunk index 14f2b8d54d..220d4fbbfb 100644 --- a/editor/assets/chunks/standard-surface-entry.chunk +++ b/editor/assets/chunks/standard-surface-entry.chunk @@ -43,6 +43,7 @@ layout(location = 0) out vec4 fragColor0; \ layout(location = 1) out vec4 fragColor1; \ layout(location = 2) out vec4 fragColor2; \ + layout(location = 3) out vec4 fragColor3; \ \ void main () { \ StandardSurface s; surf(s); \ @@ -50,7 +51,7 @@ vec3 position; \ HIGHP_VALUE_FROM_STRUCT_DEFINED(position, s.position); \ fragColor1 = vec4(position, s.roughness); \ - fragColor1 = vec4(float32x3_to_oct(s.normal), s.roughness, s.metallic); \ + fragColor2 = vec4(float32x3_to_oct(s.normal), s.roughness, s.metallic); \ fragColor3 = vec4(s.emissive, s.occlusion); \ } \ \