diff options
Diffstat (limited to 'src/gpu')
| -rw-r--r-- | src/gpu/post_process_helper.cc | 6 | ||||
| -rw-r--r-- | src/gpu/post_process_helper.h | 4 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/gpu/post_process_helper.cc b/src/gpu/post_process_helper.cc index b0121e4..79fda20 100644 --- a/src/gpu/post_process_helper.cc +++ b/src/gpu/post_process_helper.cc @@ -67,6 +67,12 @@ create_post_process_pipeline_simple(WGPUDevice device, WGPUTextureFormat format, return pipeline; } +void gpu_upload_mat4(WGPUQueue queue, WGPUBuffer buffer, size_t offset, + const mat4& m) { + const mat4 t = mat4::transpose(m); + wgpuQueueWriteBuffer(queue, buffer, offset, &t, sizeof(mat4)); +} + // --- PostProcess Implementation Helper --- static GpuBuffer g_dummy_buffer = {nullptr, 0}; 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); |
