Skip to content

Commit

Permalink
Make GLSL go upside down
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDangerous committed Mar 1, 2025
1 parent c799695 commit 939bd5e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sources/backends/glsl.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,11 @@ static void write_functions(char *code, size_t *offset, shader_stage stage, type
indent(code, offset, indentation + 1);
*offset += sprintf(&code[*offset], "gl_Position.x = _%" PRIu64 ".%s.x;\n", o->op_return.var.index, get_name(t->members.m[0].name));
indent(code, offset, indentation + 1);
*offset += sprintf(&code[*offset], "gl_Position.y = _%" PRIu64 ".%s.y;\n", o->op_return.var.index, get_name(t->members.m[0].name));
*offset +=
sprintf(&code[*offset], "gl_Position.y = 1.0 - _%" PRIu64 ".%s.y;\n", o->op_return.var.index, get_name(t->members.m[0].name));
indent(code, offset, indentation + 1);
*offset +=
sprintf(&code[*offset], "gl_Position.z = (_%" PRIu64 ".%s.z * 2.0) - _%" PRIu64 ".%s.w; // OpenGL clip space z is from -1 to 1\n",
sprintf(&code[*offset], "gl_Position.z = (_%" PRIu64 ".%s.z * 2.0) - _%" PRIu64 ".%s.w; // OpenGL clip space z is from -w to w\n",
o->op_return.var.index, get_name(t->members.m[0].name), o->op_return.var.index, get_name(t->members.m[0].name));
indent(code, offset, indentation + 1);
*offset += sprintf(&code[*offset], "gl_Position.w = _%" PRIu64 ".%s.w;\n", o->op_return.var.index, get_name(t->members.m[0].name));
Expand Down

0 comments on commit 939bd5e

Please sign in to comment.