mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-06-18 00:27:02 +08:00
perf: optimize text rendering performance
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
#version 460
|
||||
|
||||
in vec2 texCoord;
|
||||
out vec4 color;
|
||||
in vec2 tc;
|
||||
flat in int tex_layer;
|
||||
|
||||
layout (binding = 0) uniform sampler2D text;
|
||||
layout (binding = 0) uniform sampler2DArray text;
|
||||
uniform vec3 textColor;
|
||||
|
||||
out vec4 color;
|
||||
|
||||
void main(void) {
|
||||
vec4 smapled = vec4(1.0, 1.0, 1.0, texture(text, texCoord).r);
|
||||
vec4 smapled = vec4(1.0, 1.0, 1.0, texture(text, vec3(tc, tex_layer)).r);
|
||||
color = vec4(textColor, 1.0) * smapled;
|
||||
}
|
||||
@@ -1,11 +1,15 @@
|
||||
#version 460
|
||||
|
||||
layout (location = 0) in vec4 vertex;
|
||||
out vec2 texCoord;
|
||||
layout (location = 0) in vec2 pos;
|
||||
layout (location = 1) in vec2 texCoord;
|
||||
layout (location = 2) in float layer;
|
||||
|
||||
out vec2 tc;
|
||||
flat out int tex_layer;
|
||||
uniform mat4 projection;
|
||||
|
||||
void main(void) {
|
||||
gl_Position = projection * vec4(vertex.xy, 0.0, 1.0);
|
||||
texCoord = vec2(vertex.zw);
|
||||
gl_Position = projection * vec4(pos, 0.0, 1.0);
|
||||
tc = texCoord;
|
||||
tex_layer = int(layer);
|
||||
}
|
||||
Reference in New Issue
Block a user