add debug info
This commit is contained in:
+3
-5
@@ -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);
|
||||
}
|
||||
for (i = 0; i < size; i++) {
|
||||
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