add debug info
This commit is contained in:
+7
-2
@@ -1,6 +1,6 @@
|
||||
TARGET ?= forge
|
||||
INSTALL_DIR ?= $(HOME)/.local/bin
|
||||
TEST_ARGS ?= --hot-reload --frag=./shaders --frag-config=./config/shaders.cfg --demo --monitor --internal-size=480
|
||||
TEST_ARGS ?= --frag=./shaders --frag-config=./config/shaders.cfg --monitor --internal-size=480
|
||||
SHELL := /bin/bash
|
||||
|
||||
.PHONY: build
|
||||
@@ -18,8 +18,13 @@ build:
|
||||
-DGLFW_INCLUDE_NONE \
|
||||
-o build/$(TARGET)
|
||||
|
||||
.PHONY: run
|
||||
run: build
|
||||
./build/$(TARGET) $(TEST_ARGS)
|
||||
./build/$(TARGET) $(TEST_ARGS) --hot-reload
|
||||
|
||||
.PHONY: demo
|
||||
demo: build
|
||||
./build/$(TARGET) $(TEST_ARGS) --demo
|
||||
|
||||
.PHONY: install
|
||||
install: build
|
||||
|
||||
+3
-12
@@ -1137,16 +1137,7 @@ subroutine(src_stage_sub) vec4 src_9(vec2 vUV, int seed)
|
||||
|
||||
// logic
|
||||
|
||||
const int text[5] = {0x66, 0x70, 0x73, 0x00, 0x00};
|
||||
vec2 uv2 = uv1 * 20;
|
||||
|
||||
float v = 0;
|
||||
|
||||
v += write_int(uv2, vec2(0.5, 0.5), iFPS, 3);
|
||||
|
||||
v += write_5(uv2, vec2(4.0, 0.5), text);
|
||||
|
||||
return vec4(v);
|
||||
return texture(tex0, vUV);
|
||||
}
|
||||
|
||||
// TODO SRC 10
|
||||
@@ -1285,7 +1276,7 @@ subroutine(src_stage_sub) vec4 src_16(vec2 vUV, int seed)
|
||||
rect(uv2, vec2(0.55, 2), vec2(1.5, 0.1)) +
|
||||
rect(uv2, vec2(2, 1.55), vec2(0.1, 0.55)) +
|
||||
rect(uv2, vec2(7.5, 0), vec2(1.5, 0.1)) +
|
||||
h_rect(uv2, vec2(-9, 5.1), vec2(1), 0.1);
|
||||
h_rect(uv2, vec2(-9, -3.9), vec2(1), 0.1);
|
||||
|
||||
// show selected src/fx
|
||||
f += char_at(uv2, vec2(-5.4, 1.45), hex_chars[selected_srca]);
|
||||
@@ -1315,7 +1306,7 @@ subroutine(src_stage_sub) vec4 src_16(vec2 vUV, int seed)
|
||||
f += (selected_srcb == 0 || selected_srcb % 5 != 0 && selected_srcb >= 8) ? rect(uv2, vec2(-6.5, -2), vec2(0.5, 0.1)) + rect(uv2, vec2(0, -4), vec2(7, 0.1)) + rect(uv2, vec2(-7, -3), vec2(0.1, 1.1)) + rect(uv2, vec2(7, -2), vec2(0.1, 2.1)) : 0;
|
||||
|
||||
// show page
|
||||
f += char_at(uv2, vec2(-9.2, 4.3), hex_chars[page]);
|
||||
f += char_at(uv2, vec2(-9.2, -4.3), hex_chars[page]);
|
||||
|
||||
// show fx values
|
||||
f = mix(f, 1 - f, rect(uv2, vec2(-2, 1.1 + 0.9 * fxa_value), vec2(0.9, 0.9 * fxa_value)));
|
||||
|
||||
+13
-1
@@ -9,7 +9,7 @@ float s(vec2 uv, float x0, float y0) {
|
||||
step(-y0 - 1, -uv.y);
|
||||
}
|
||||
|
||||
const int texts[8][5] = {
|
||||
const int texts[11][5] = {
|
||||
{0x49, 0x4E, 0x20, 0x41, 0x00}, // IN A
|
||||
{0x49, 0x4E, 0x20, 0x42, 0x00}, // IN B
|
||||
{0x53, 0x52, 0x43, 0x20, 0x41}, // SRC A
|
||||
@@ -18,6 +18,9 @@ const int texts[8][5] = {
|
||||
{0x46, 0x58, 0x20, 0x42, 0x00}, // FX B
|
||||
{0x41, 0x2B, 0x42, 0x00, 0x00}, // A+B
|
||||
{0x4D, 0x46, 0x58, 0x00, 0x00}, // MFX
|
||||
{0x46, 0x50, 0x53, 0x00, 0x00}, // FPS
|
||||
{0x54, 0x45, 0x4D, 0x50, 0x4F}, // TEMPO
|
||||
{0x54, 0x49, 0x4D, 0x45, 0x00}, // TIME
|
||||
};
|
||||
|
||||
void main() {
|
||||
@@ -51,5 +54,14 @@ void main() {
|
||||
t += write_5(uv3, vec2(-17,8), texts[6]);
|
||||
t += write_5(uv3, vec2(19,8), texts[7]);
|
||||
|
||||
t += write_5(uv3, vec2(-23,8), texts[8]);
|
||||
t += write_int(uv3, vec2(-27,8), iFPS, 3);
|
||||
|
||||
t += write_5(uv3, vec2(-23,6), texts[9]);
|
||||
t += write_int(uv3, vec2(-27,6), int(iTempo), 3);
|
||||
|
||||
t += write_5(uv3, vec2(-23,4), texts[10]);
|
||||
t += write_int(uv3, vec2(-29,4), int(iTime), 5);
|
||||
|
||||
fragColor = mix(c, 1 - c, t);
|
||||
}
|
||||
+2
-4
@@ -54,12 +54,10 @@ static void init_context(ShaderProgram program, Context *context,
|
||||
|
||||
size = program.frag_count * program.sub_type_count;
|
||||
context->sub_state = malloc(size * sizeof(unsigned int));
|
||||
memset(context->sub_state, 0, sizeof(&context->sub_state));
|
||||
|
||||
if (params.demo) {
|
||||
for (i = 0; i < size; i++) {
|
||||
context->sub_state[i] = rand_uint(program.sub_variant_count);
|
||||
}
|
||||
context->sub_state[i] =
|
||||
params.demo ? rand_uint(program.sub_variant_count) : 0;
|
||||
}
|
||||
|
||||
context->seeds = malloc(program.frag_count * sizeof(unsigned int));
|
||||
|
||||
+7
-3
@@ -299,9 +299,6 @@ static void update_viewport(ShaderProgram program, Context context) {
|
||||
// viewport changed
|
||||
if (context.width != program.last_width ||
|
||||
context.height != program.last_height) {
|
||||
// update viewport
|
||||
glViewport(0, 0, context.width, context.height);
|
||||
|
||||
// clean and resize all textures
|
||||
for (i = 0; i < program.tex_count; i++) {
|
||||
glActiveTexture(GL_TEXTURE0 + i);
|
||||
@@ -327,12 +324,19 @@ static void use_program(ShaderProgram program, int i, bool output,
|
||||
glUseProgram(program.programs[i]);
|
||||
|
||||
if (output) {
|
||||
glViewport(0, 0, context.width, context.height);
|
||||
|
||||
// use default framebuffer (output)
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
|
||||
// clear buffer
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
} else {
|
||||
glViewport(
|
||||
0, 0,
|
||||
(int)(context.internal_size * (float)context.width / context.height),
|
||||
context.internal_size);
|
||||
|
||||
// use memory framebuffer
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, program.frame_buffers[i]);
|
||||
glDrawBuffer(GL_COLOR_ATTACHMENT0);
|
||||
|
||||
Reference in New Issue
Block a user