From ac104e6f413eab0f192cc8330432e99ee316fcc0 Mon Sep 17 00:00:00 2001 From: bjorn Date: Sun, 31 Jul 2022 13:26:35 -0700 Subject: [PATCH] WIP stereo blit shader; --- etc/shaders.h | 1 + src/modules/graphics/graphics.c | 7 ++++++- src/modules/graphics/graphics.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/etc/shaders.h b/etc/shaders.h index f0b54eb3..a91b5ba9 100644 --- a/etc/shaders.h +++ b/etc/shaders.h @@ -5,6 +5,7 @@ #include "shaders/cubemap.vert.h" #include "shaders/cubemap.frag.h" #include "shaders/equirect.frag.h" +#include "shaders/stereoblit.frag.h" #include "shaders/animator.comp.h" #include "shaders/timewizard.comp.h" diff --git a/src/modules/graphics/graphics.c b/src/modules/graphics/graphics.c index c3927f59..3cbd2e62 100644 --- a/src/modules/graphics/graphics.c +++ b/src/modules/graphics/graphics.c @@ -1499,6 +1499,11 @@ Shader* lovrGraphicsGetDefaultShader(DefaultShader type) { info.source[1] = (ShaderSource) { lovr_shader_font_frag, sizeof(lovr_shader_font_frag) }; info.label = "font"; break; + case SHADER_STEREOBLIT: + info.source[0] = (ShaderSource) { lovr_shader_fill_vert, sizeof(lovr_shader_fill_vert) }; + info.source[1] = (ShaderSource) { lovr_shader_stereoblit_frag, sizeof(lovr_shader_stereoblit_frag) }; + info.label = "stereoblit"; + break; default: lovrUnreachable(); } @@ -4733,7 +4738,7 @@ void lovrPassSkybox(Pass* pass, Texture* texture) { void lovrPassFill(Pass* pass, Texture* texture) { lovrPassDraw(pass, &(Draw) { .mode = MESH_TRIANGLES, - .shader = SHADER_FILL, + .shader = texture->info.layers == 2 ? SHADER_STEREOBLIT : SHADER_FILL, .material = texture ? lovrTextureGetMaterial(texture) : NULL, .vertex.format = VERTEX_EMPTY, .count = 3 diff --git a/src/modules/graphics/graphics.h b/src/modules/graphics/graphics.h index 81766329..9808024f 100644 --- a/src/modules/graphics/graphics.h +++ b/src/modules/graphics/graphics.h @@ -266,6 +266,7 @@ typedef enum { SHADER_PANO, SHADER_FILL, SHADER_FONT, + SHADER_STEREOBLIT, DEFAULT_SHADER_COUNT } DefaultShader;