From b4fe073653da9e27bf486b1b4366fe44b6138bb4 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 10 Oct 2021 15:50:43 +0300 Subject: [PATCH] Move the frag_color output from msp_interface to common This allows creating shaders without a fragment stage which use the interface. --- builtin_data/_occluder.glsl | 5 ----- builtin_data/_sky_backdrop.glsl | 1 + shaderlib/common.glsl | 2 ++ shaderlib/msp_interface.glsl | 3 --- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/builtin_data/_occluder.glsl b/builtin_data/_occluder.glsl index 488d4120..b8846c47 100644 --- a/builtin_data/_occluder.glsl +++ b/builtin_data/_occluder.glsl @@ -4,8 +4,3 @@ void main() { gl_Position = clip_eye_matrix*eye_world_matrix*world_obj_matrix*vertex; } -#pragma MSP stage(fragment) -void main() -{ - frag_color = vec4(1.0); -} diff --git a/builtin_data/_sky_backdrop.glsl b/builtin_data/_sky_backdrop.glsl index fa28663c..fa8f1be5 100644 --- a/builtin_data/_sky_backdrop.glsl +++ b/builtin_data/_sky_backdrop.glsl @@ -13,6 +13,7 @@ void main() } #pragma MSP stage(fragment) +layout(location=0) out vec4 frag_color; void main() { vec3 nview = normalize(view_dir.xyz); diff --git a/shaderlib/common.glsl b/shaderlib/common.glsl index 33fefe88..03cfd5af 100644 --- a/shaderlib/common.glsl +++ b/shaderlib/common.glsl @@ -77,6 +77,8 @@ struct IncomingLight vec3 color; }; +layout(location=0) out vec4 frag_color; + virtual vec3 get_fragment_normal() { if(use_normal_map) diff --git a/shaderlib/msp_interface.glsl b/shaderlib/msp_interface.glsl index b0f8a410..3fdd606b 100644 --- a/shaderlib/msp_interface.glsl +++ b/shaderlib/msp_interface.glsl @@ -49,6 +49,3 @@ layout(location=7) in vec4 texcoord1; layout(location=8) in vec4 texcoord2; layout(location=9) in vec4 texcoord3; layout(location=13) in vec4 instance_transform[3]; - -#pragma MSP stage(fragment) -layout(location=0) out vec4 frag_color; -- 2.43.0