rip 9nth texture

This commit is contained in:
2025-09-18 22:59:47 +02:00
parent f15d737e48
commit cd0d67441e
5 changed files with 16 additions and 20 deletions
-1
View File
@@ -22,7 +22,6 @@ uniform sampler2D tex4;
uniform sampler2D tex5;
uniform sampler2D tex6;
uniform sampler2D tex7;
uniform sampler2D tex8;
// 3. definitions
// --------------
-7
View File
@@ -5,13 +5,6 @@ UNIFORM_RESOLUTION=iResolution
FRAG_COUNT=6
FRAG_OUT_1=2
FRAG_OUT_2=5
FRAG_OUT_3=3
FRAG_OUT_4=6
FRAG_OUT_5=7
FRAG_OUT_6=0
SUB_TYPE_COUNT=3
SUB_1_PREFIX=src_
SUB_1_COUNT=16
+1 -1
View File
@@ -10,7 +10,7 @@
#endif /* VERSION */
#ifndef TEX_COUNT
#define TEX_COUNT 9
#define TEX_COUNT 8
#endif /* TEXT_COUNT */
#ifndef SUB_COUNT
+3 -4
View File
@@ -24,6 +24,7 @@ static char *output_shader_text = "#version 460\n"
" fragColor = texture(tex0, vUV);\n"
"}";
// TODO monitor should have special shader to use full capacity
static char *monitor_shader_text =
"#version 460\n"
"uniform sampler2D tex0;\n"
@@ -34,7 +35,6 @@ static char *monitor_shader_text =
"uniform sampler2D tex5;\n"
"uniform sampler2D tex6;\n"
"uniform sampler2D tex7;\n"
"uniform sampler2D tex8;\n"
"in vec2 vUV;\n"
"out vec4 fragColor;\n"
"float s(vec2 uv, float x0, float y0) {\n"
@@ -50,9 +50,8 @@ static char *monitor_shader_text =
" fragColor += s(uv,0,1) * texture(tex4, uv);\n"
" fragColor += s(uv,1,1) * texture(tex5, uv);\n"
" fragColor += s(uv,2,1) * texture(tex6, uv);\n"
" fragColor += s(uv,0,0) * texture(tex7, uv);\n"
" fragColor += s(uv,1,0) * texture(tex8, uv);\n"
" fragColor += s(uv,2,0) * texture(tex0, uv);\n"
" fragColor += s(uv,0.5,0) * texture(tex7, uv-vec2(0.5,0));\n"
" fragColor += s(uv,1.5,0) * texture(tex0, uv-vec2(0.5,0));\n"
"}";
static const Vertex vertices[6] = {{{0.0f, 0.0f}}, {{0.0f, 1.0f}},
+12 -7
View File
@@ -1,6 +1,7 @@
#include <glad/gl.h>
#include <linmath.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include "config.h"
@@ -147,7 +148,7 @@ static void init_single_program(ShaderProgram *program, unsigned int i,
glAttachShader(program->programs[i], program->vertex_shader);
if (output) {
glAttachShader(program->programs[i], program->monitor_shader); // TODO tmp
glAttachShader(program->programs[i], program->monitor_shader);
} else {
glAttachShader(program->programs[i], program->fragment_shaders[i]);
}
@@ -225,9 +226,16 @@ static void init_programs(ShaderProgram *program, ConfigFile shader_config) {
}
}
static void init_drawbuffers(ShaderProgram *program) {
unsigned int i;
for (i = 0; i < TEX_COUNT; i++) {
program->draw_buffers[i] = GL_COLOR_ATTACHMENT0 + i;
}
}
ShaderProgram shaders_init(File *fragment_shaders, ConfigFile shader_config,
Context context) {
unsigned int i;
ShaderProgram program;
program.error = false;
@@ -249,10 +257,7 @@ ShaderProgram shaders_init(File *fragment_shaders, ConfigFile shader_config,
init_programs(&program, shader_config);
// TODO each for each frag
for (i = 0; i < TEX_COUNT; i++) {
program.draw_buffers[i] = GL_COLOR_ATTACHMENT0 + i;
}
init_drawbuffers(&program);
return program;
}
@@ -327,7 +332,7 @@ void shaders_apply(ShaderProgram program, Context context) {
glUniform1i(program.textures_locations[j][i], j);
}
glDrawBuffers(TEX_COUNT - 1, program.draw_buffers);
glDrawBuffers(TEX_COUNT, program.draw_buffers);
// draw output
glDrawArrays(GL_TRIANGLES, 0, 6);