diff options
| author | skal <pascal.massimino@gmail.com> | 2026-03-08 10:38:19 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-03-08 10:38:19 +0100 |
| commit | 21b061b951ec3a65bc479fabeb2d9565e08a807e (patch) | |
| tree | 24755d905463c8a507a34624ab3edf7295c8e0c5 /src/gpu/post_process_helper.h | |
| parent | 5f64a20daa81a6182d4898dcd6f86870ad0bf9d5 (diff) | |
fix: transpose matrices on GPU upload (row-major → column-major)
mini_math mat4 is row-major; WGSL mat4x4f is column-major. Matrices
uploaded without transposing were interpreted as their own transpose on
the GPU, causing RotatingCube and Renderer3D to render upside-down.
- Add gpu_upload_mat4() to post_process_helper for standalone uploads
- Add Uniforms::make() to RotatingCube::Uniforms (handles transpose)
- Add GlobalUniforms::make() and ObjectData::make() to renderer.h
- Update renderer_draw.cc and visual_debug.cc to use make()
handoff(Gemini): matrix layout bug fixed across all rasterized effects.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/gpu/post_process_helper.h')
| -rw-r--r-- | src/gpu/post_process_helper.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gpu/post_process_helper.h b/src/gpu/post_process_helper.h index 811d0e4..178a4d5 100644 --- a/src/gpu/post_process_helper.h +++ b/src/gpu/post_process_helper.h @@ -25,3 +25,7 @@ WGPURenderPipeline create_post_process_pipeline_simple(WGPUDevice device, void pp_update_bind_group(WGPUDevice device, WGPURenderPipeline pipeline, WGPUBindGroup* bind_group, WGPUTextureView input_view, GpuBuffer uniforms, GpuBuffer effect_params); + +// Upload a mat4 to a GPU buffer, transposing from C++ row-major to WGSL column-major. +void gpu_upload_mat4(WGPUQueue queue, WGPUBuffer buffer, size_t offset, + const mat4& m); |
