From bf6053906dc6a3c7b0d40d5b097e745dce1f33bc Mon Sep 17 00:00:00 2001 From: Drew Lemmy Date: Wed, 21 Oct 2020 10:28:12 +0100 Subject: [PATCH] Fix TBO norm issues on old GPUs --- .../shared/peripheral/monitor/ClientMonitor.java | 2 +- .../resources/assets/computercraft/shaders/monitor.frag | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/dan200/computercraft/shared/peripheral/monitor/ClientMonitor.java b/src/main/java/dan200/computercraft/shared/peripheral/monitor/ClientMonitor.java index 856210908..6cb024469 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/monitor/ClientMonitor.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/monitor/ClientMonitor.java @@ -69,7 +69,7 @@ public final class ClientMonitor extends ClientTerminal GL15.glBufferData( GL31.GL_TEXTURE_BUFFER, 0, GL15.GL_STATIC_DRAW ); tboTexture = GlStateManager.genTexture(); GL11.glBindTexture( GL31.GL_TEXTURE_BUFFER, tboTexture ); - GL31.glTexBuffer( GL31.GL_TEXTURE_BUFFER, GL30.GL_R8, tboBuffer ); + GL31.glTexBuffer( GL31.GL_TEXTURE_BUFFER, GL30.GL_R8UI, tboBuffer ); GL11.glBindTexture( GL31.GL_TEXTURE_BUFFER, 0 ); GlStateManager.bindBuffer( GL31.GL_TEXTURE_BUFFER, 0 ); diff --git a/src/main/resources/assets/computercraft/shaders/monitor.frag b/src/main/resources/assets/computercraft/shaders/monitor.frag index b0b7b49ed..f19a6a9eb 100644 --- a/src/main/resources/assets/computercraft/shaders/monitor.frag +++ b/src/main/resources/assets/computercraft/shaders/monitor.frag @@ -6,7 +6,7 @@ uniform sampler2D u_font; uniform int u_width; uniform int u_height; -uniform samplerBuffer u_tbo; +uniform usamplerBuffer u_tbo; uniform vec3 u_palette[16]; in vec2 f_pos; @@ -30,9 +30,9 @@ void main() { vec2 outside = step(vec2(0.0, 0.0), vec2(cell)) * step(vec2(cell), vec2(float(u_width) - 1.0, float(u_height) - 1.0)); float mult = outside.x * outside.y; - int character = int(texelFetch(u_tbo, index).r * 255.0); - int fg = int(texelFetch(u_tbo, index + 1).r * 255.0); - int bg = int(texelFetch(u_tbo, index + 2).r * 255.0); + int character = int(texelFetch(u_tbo, index).r); + int fg = int(texelFetch(u_tbo, index + 1).r); + int bg = int(texelFetch(u_tbo, index + 2).r); vec2 pos = (term_pos - corner) * vec2(FONT_WIDTH, FONT_HEIGHT); vec4 img = texture(u_font, (texture_corner(character) + pos) / 256.0);