From 6f318ad14914f2b405e256810fd5933c62783b7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Freitas=20de=20Almeida?= Date: Sun, 2 Jul 2023 23:56:49 -0300 Subject: [PATCH 1/4] now using Bgra8Unorm as texture format @ swapchain --- src/app.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/app.rs b/src/app.rs index 6cfbbe6..4241e88 100644 --- a/src/app.rs +++ b/src/app.rs @@ -61,6 +61,7 @@ impl App { .await .unwrap(); println!("Adapter: {:?}", adapter.get_info()); + println!("Surface: {:?}", surface.get_capabilities(&adapter)); //device and queue let (device, queue) = adapter .request_device( @@ -83,8 +84,10 @@ impl App { .get_default_config(&adapter, size.width, size.height) .expect("Surface isn't supported by the adapter."); config.present_mode = wgpu::PresentMode::Fifo; + config.format = wgpu::TextureFormat::Bgra8Unorm; let surface_view_format = config.format.add_srgb_suffix(); config.view_formats.push(surface_view_format); + println!("Config: {:?}", config); surface.configure(&device, &config); // ------ GPU Compute config ------ From e43ea3810a36daf85437ef355c018c3cd38a075a Mon Sep 17 00:00:00 2001 From: Vinicius Date: Mon, 3 Jul 2023 00:04:06 -0300 Subject: [PATCH 2/4] bump PATCH to v0.2.1 --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b438387..e982548 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -682,7 +682,7 @@ dependencies = [ [[package]] name = "heat-wgpu" -version = "0.2.0" +version = "0.2.1" dependencies = [ "bytemuck", "env_logger", diff --git a/Cargo.toml b/Cargo.toml index 554feb2..cfea81b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "heat-wgpu" -version = "0.2.0" +version = "0.2.1" edition = "2021" [dependencies] From 7058742f53f731c6b9ecc5b422374f1714cc50ee Mon Sep 17 00:00:00 2001 From: Vinicius Date: Mon, 3 Jul 2023 00:22:14 -0300 Subject: [PATCH 3/4] docs: credit Turbo colormap --- README.md | 1 + src/shaders/render.wgsl | 2 ++ 2 files changed, 3 insertions(+) diff --git a/README.md b/README.md index da64338..6e528dd 100644 --- a/README.md +++ b/README.md @@ -53,4 +53,5 @@ cargo run --release - Shewchuk, J. R. (1994). [*An introduction to the conjugate gradient method without the agonizing pain*](https://www.cs.cmu.edu/~quake-papers/painless-conjugate-gradient.pdf). - Bell, N., & Garland, M. (2008). *Efficient sparse matrix-vector multiplication on CUDA (Vol. 2, No. 5). Nvidia Technical Report NVR-2008-004, Nvidia Corporation*. - Harris, M. (2007). *Optimizing parallel reduction in CUDA. Nvidia developer technology, 2*(4), 70. +- Mikhailov, A. (2019). [Turbo, An Improved Rainbow Colormap for Visualization](https://ai.googleblog.com/2019/08/turbo-improved-rainbow-colormap-for.html). - [WebGPU specification](https://gpuweb.github.io/gpuweb/). diff --git a/src/shaders/render.wgsl b/src/shaders/render.wgsl index 1ed383a..aa2784e 100644 --- a/src/shaders/render.wgsl +++ b/src/shaders/render.wgsl @@ -36,6 +36,8 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4 { // Turbo colormap (polynomial approximation) // reference: https://ai.googleblog.com/2019/08/turbo-improved-rainbow-colormap-for.html +// Original LUT: https://gist.github.com/mikhailov-work/ee72ba4191942acecc03fe6da94fc73f +// Authors: Anton Mikhailov (mikhailov@google.com), Ruofei Du (ruofei@google.com) fn TurboColormap(x: f32) -> vec3 { let kRedVec4: vec4 = vec4(0.13572138, 4.61539260, -42.66032258, 132.13108234); let kGreenVec4: vec4 = vec4(0.09140261, 2.19418839, 4.84296658, -14.18503333); From 432f066135abf2a3d2116e45abc3b9f1eb050cae Mon Sep 17 00:00:00 2001 From: Vinicius Date: Mon, 3 Jul 2023 00:30:49 -0300 Subject: [PATCH 4/4] docs: added GPU Gems to references --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 6e528dd..6519412 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,10 @@ cargo run --release - LeVeque, R. J. (2007). *Finite difference methods for ordinary and partial differential equations: steady-state and time-dependent problems. Society for Industrial and Applied Mathematics*. - Shewchuk, J. R. (1994). [*An introduction to the conjugate gradient method without the agonizing pain*](https://www.cs.cmu.edu/~quake-papers/painless-conjugate-gradient.pdf). - Bell, N., & Garland, M. (2008). *Efficient sparse matrix-vector multiplication on CUDA (Vol. 2, No. 5). Nvidia Technical Report NVR-2008-004, Nvidia Corporation*. +- GPU Gems 2: Programming Techniques for High-Performance Graphics and General-Purpose Computation. 2005. Addison-Wesley Professional. + - Specifically [*Chapter 44: A GPU Framework for Solving Systems of Linear Equations*](https://developer.nvidia.com/gpugems/gpugems2/part-vi-simulation-and-numerical-algorithms/chapter-44-gpu-framework-solving), which also cites the following papers: + - Bolz, J., I. Farmer, E. Grinspun, and P. Schröder. 2003. "Sparse Matrix Solvers on the GPU: Conjugate Gradients and Multigrid." *ACM Transactions on Graphics (Proceedings of SIGGRAPH 2003)* 22(3), pp. 917–924. + - Krüger, Jens, and Rüdiger Westermann. 2003. "Linear Algebra Operators for GPU Implementation of Numerical Algorithms." *ACM Transactions on Graphics (Proceedings of SIGGRAPH 2003)* 22(3), pp. 908–916. - Harris, M. (2007). *Optimizing parallel reduction in CUDA. Nvidia developer technology, 2*(4), 70. - Mikhailov, A. (2019). [Turbo, An Improved Rainbow Colormap for Visualization](https://ai.googleblog.com/2019/08/turbo-improved-rainbow-colormap-for.html). - [WebGPU specification](https://gpuweb.github.io/gpuweb/).