opengl: apply transforms to rendering

This commit is contained in:
Ryan Fleury
2026-05-09 13:30:56 -07:00
parent a16716eff7
commit 0cfc113272
6 changed files with 12 additions and 6 deletions
+3 -3
View File
@@ -49,7 +49,7 @@ commands =
// .f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, }, // .f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
// .f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg debug telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, }, // .f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg debug telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
// .f1 = { .win = "raddbg_stable --ipc kill_all && build radbin", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, }, // .f1 = { .win = "raddbg_stable --ipc kill_all && build radbin", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.f1 = { .win = "build raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, }, .f1 = { .win = "build raddbg opengl", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
//- rjf: [raddbg wsl] //- rjf: [raddbg wsl]
// .f1 = { .win = "wsl ./build.sh raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, }, // .f1 = { .win = "wsl ./build.sh raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
@@ -67,8 +67,8 @@ commands =
// .f1 = { .win = "raddbg_stable --ipc kill_all && build radbin", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, }, // .f1 = { .win = "raddbg_stable --ipc kill_all && build radbin", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
//- rjf: running target //- rjf: running target
.f3 = { .win = "build torture", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, }, .f3 = { .win = "raddbg_stable --ipc run", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
// .f3 = { .win = "raddbg_stable --ipc run", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, }, // .f3 = { .win = "build torture", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
// .f3 = { .win = "wsl ./build/raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, }, // .f3 = { .win = "wsl ./build/raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
// .f3 = { .win = "pushd build && raddbg --user:dev.raddbg_user && popd", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, }, // .f3 = { .win = "pushd build && raddbg --user:dev.raddbg_user && popd", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
// .f3 = { .win = "C:/devel/raddebugger/build/raddbg.exe --capture --user:C:/devel/raddebugger/build/local_dev.raddbg_user --project:C:/devel/raddebugger/build/local_dev.raddbg_project", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, }, // .f3 = { .win = "C:/devel/raddebugger/build/raddbg.exe --capture --user:C:/devel/raddebugger/build/local_dev.raddbg_user --project:C:/devel/raddebugger/build/local_dev.raddbg_project", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
+1 -1
View File
@@ -3292,7 +3292,7 @@ dw_parse_cfa_inst(String8 data,
case DW_CFA_RememberState: {} break; case DW_CFA_RememberState: {} break;
case DW_CFA_RestoreState: {} break; case DW_CFA_RestoreState: {} break;
case DW_CFA_Nop: {} break; case DW_CFA_Nop: {} break;
default: { NotImplemented; goto exit; } break; default: { goto exit; } break;
} }
// fill out output // fill out output
@@ -43,6 +43,7 @@ str8_lit_comp(
"out float v2p_softness;\n" "out float v2p_softness;\n"
"out float v2p_omit_texture;\n" "out float v2p_omit_texture;\n"
"\n" "\n"
"uniform mat3 u_xform;\n"
"uniform sampler2D u_tex_color;\n" "uniform sampler2D u_tex_color;\n"
"uniform vec2 u_viewport_size_px;\n" "uniform vec2 u_viewport_size_px;\n"
"\n" "\n"
@@ -59,6 +60,7 @@ str8_lit_comp(
" vec2 dst_center = (c2v_dst_rect.zw + c2v_dst_rect.xy) / 2;\n" " vec2 dst_center = (c2v_dst_rect.zw + c2v_dst_rect.xy) / 2;\n"
" vec2 dst_position = vertices[gl_VertexID] * dst_half_size + dst_center;\n" " vec2 dst_position = vertices[gl_VertexID] * dst_half_size + dst_center;\n"
" dst_position.y += shears[gl_VertexID];\n" " dst_position.y += shears[gl_VertexID];\n"
" dst_position = (u_xform * vec3(dst_position.x, dst_position.y, 1)).xy;\n"
" \n" " \n"
" // rjf: find src position\n" " // rjf: find src position\n"
" vec2 src_half_size = (c2v_src_rect.zw - c2v_src_rect.xy) / 2;\n" " vec2 src_half_size = (c2v_src_rect.zw - c2v_src_rect.xy) / 2;\n"
+3 -2
View File
@@ -469,6 +469,7 @@ r_window_submit(WM_Window window, R_Handle window_equip, R_PassList *passes)
glUniformMatrix4fv(glGetUniformLocation(shader, "u_texture_sample_channel_map"), 1, 0, &texture_sample_channel_map.v[0][0]); glUniformMatrix4fv(glGetUniformLocation(shader, "u_texture_sample_channel_map"), 1, 0, &texture_sample_channel_map.v[0][0]);
glUniform2f(glGetUniformLocation(shader, "u_viewport_size_px"), viewport_dim.x, viewport_dim.y); glUniform2f(glGetUniformLocation(shader, "u_viewport_size_px"), viewport_dim.x, viewport_dim.y);
glUniform1f(glGetUniformLocation(shader, "u_opacity"), 1.f - group_params->transparency); glUniform1f(glGetUniformLocation(shader, "u_opacity"), 1.f - group_params->transparency);
glUniformMatrix3fv(glGetUniformLocation(shader, "u_xform"), 1, 0, &group_params->xform.v[0][0]);
} }
//- rjf: set up scissor //- rjf: set up scissor
@@ -499,8 +500,8 @@ r_window_submit(WM_Window window, R_Handle window_equip, R_PassList *passes)
case R_PassKind_Blur: case R_PassKind_Blur:
{ {
R_PassParams_Blur *params = pass->params_blur; R_PassParams_Blur *params = pass->params_blur;
GLuint shader = r_ogl_state->shaders[R_OGL_ShaderKind_Blur]; // GLuint shader = r_ogl_state->shaders[R_OGL_ShaderKind_Blur];
// TODO(rjf): glBindVertexArrayScope(r_ogl_state->all_purpose_vao) glUseProgramScope(shader) // glBindVertexArrayScope(r_ogl_state->all_purpose_vao) glUseProgramScope(shader)
{ {
// TODO(rjf) // TODO(rjf)
} }
+1
View File
@@ -141,6 +141,7 @@ X(glUniform1f, void, (GLint location, GLfloat v0))\
X(glUniform2f, void, (GLint location, GLfloat v0, GLfloat v1))\ X(glUniform2f, void, (GLint location, GLfloat v0, GLfloat v1))\
X(glUniform3f, void, (GLint location, GLfloat v0, GLfloat v1, GLfloat v2))\ X(glUniform3f, void, (GLint location, GLfloat v0, GLfloat v1, GLfloat v2))\
X(glUniform4f, void, (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3))\ X(glUniform4f, void, (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3))\
X(glUniformMatrix3fv, void, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))\
X(glUniformMatrix4fv, void, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))\ X(glUniformMatrix4fv, void, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))\
X(glUniform1i, void, (GLint location, GLint v0))\ X(glUniform1i, void, (GLint location, GLint v0))\
X(glTexImage3D, void, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels))\ X(glTexImage3D, void, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels))\
+2
View File
@@ -68,6 +68,7 @@ out float v2p_border_thickness;
out float v2p_softness; out float v2p_softness;
out float v2p_omit_texture; out float v2p_omit_texture;
uniform mat3 u_xform;
uniform sampler2D u_tex_color; uniform sampler2D u_tex_color;
uniform vec2 u_viewport_size_px; uniform vec2 u_viewport_size_px;
@@ -84,6 +85,7 @@ void main(void)
vec2 dst_center = (c2v_dst_rect.zw + c2v_dst_rect.xy) / 2; vec2 dst_center = (c2v_dst_rect.zw + c2v_dst_rect.xy) / 2;
vec2 dst_position = vertices[gl_VertexID] * dst_half_size + dst_center; vec2 dst_position = vertices[gl_VertexID] * dst_half_size + dst_center;
dst_position.y += shears[gl_VertexID]; dst_position.y += shears[gl_VertexID];
dst_position = (u_xform * vec3(dst_position.x, dst_position.y, 1)).xy;
// rjf: find src position // rjf: find src position
vec2 src_half_size = (c2v_src_rect.zw - c2v_src_rect.xy) / 2; vec2 src_half_size = (c2v_src_rect.zw - c2v_src_rect.xy) / 2;