[Bf-blender-cvs] [e3444ba522a] tmp-gpu-shader-descriptor-2: Migrated GPU_SHADER_TEXT.

Jeroen Bakker noreply at git.blender.org
Fri Jan 7 08:54:33 CET 2022


Commit: e3444ba522a8d667ed3ceb9e3a85532fa99b27ad
Author: Jeroen Bakker
Date:   Fri Jan 7 08:54:01 2022 +0100
Branches: tmp-gpu-shader-descriptor-2
https://developer.blender.org/rBe3444ba522a8d667ed3ceb9e3a85532fa99b27ad

Migrated GPU_SHADER_TEXT.

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

M	source/blender/gpu/shaders/gpu_shader_text_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_text_vert.glsl
A	source/blender/gpu/shaders/infos/gpu_shader_text_info.hh
A	source/blender/gpu/shaders/infos/gpu_srgb_to_framebuffer_space_info.hh

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

diff --git a/source/blender/gpu/shaders/gpu_shader_text_frag.glsl b/source/blender/gpu/shaders/gpu_shader_text_frag.glsl
index 2568cd74445..1456bd0c732 100644
--- a/source/blender/gpu/shaders/gpu_shader_text_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_text_frag.glsl
@@ -1,4 +1,4 @@
-
+#ifndef USE_GPU_SHADER_CREATE_INFO
 flat in vec4 color_flat;
 noperspective in vec2 texCoord_interp;
 flat in int glyph_offset;
@@ -8,6 +8,7 @@ flat in int interp_size;
 out vec4 fragColor;
 
 uniform sampler2D glyph;
+#endif
 
 const vec2 offsets4[4] = vec2[4](
     vec2(-0.5, 0.5), vec2(0.5, 0.5), vec2(-0.5, -0.5), vec2(-0.5, -0.5));
diff --git a/source/blender/gpu/shaders/gpu_shader_text_vert.glsl b/source/blender/gpu/shaders/gpu_shader_text_vert.glsl
index 768638e5229..5b01fea5266 100644
--- a/source/blender/gpu/shaders/gpu_shader_text_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_text_vert.glsl
@@ -1,4 +1,4 @@
-
+#ifndef USE_GPU_SHADER_CREATE_INFO
 uniform mat4 ModelViewProjectionMatrix;
 
 in vec4 pos; /* rect */
@@ -11,6 +11,7 @@ noperspective out vec2 texCoord_interp;
 flat out int glyph_offset;
 flat out ivec2 glyph_dim;
 flat out int interp_size;
+#endif
 
 void main()
 {
diff --git a/source/blender/gpu/shaders/infos/gpu_shader_text_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_text_info.hh
new file mode 100644
index 00000000000..0e34966de73
--- /dev/null
+++ b/source/blender/gpu/shaders/infos/gpu_shader_text_info.hh
@@ -0,0 +1,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::IVEC2, "glyph_dim")
+    .flat(Type::INT, "interp_size");
+
+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_out(text_iface)
+    .fragment_out(0, Type::VEC4, "fragColor")
+    .push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
+    .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);
\ No newline at end of file
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
new file mode 100644
index 00000000000..c2d9bc2add8
--- /dev/null
+++ b/source/blender/gpu/shaders/infos/gpu_srgb_to_framebuffer_space_info.hh
@@ -0,0 +1,5 @@
+
+#include "gpu_shader_create_info.hh"
+
+GPU_SHADER_CREATE_INFO(gpu_srgb_to_framebuffer_space)
+    .define("blender_srgb_to_framebuffer_space(a) a");



More information about the Bf-blender-cvs mailing list