[HN Gopher] Compute Shader 101 [video]
       ___________________________________________________________________
        
       Compute Shader 101 [video]
        
       Author : raphlinus
       Score  : 160 points
       Date   : 2021-06-04 17:58 UTC (1 days ago)
        
 (HTM) web link (www.youtube.com)
 (TXT) w3m dump (www.youtube.com)
        
       | IdiocyInAction wrote:
       | I wrote a path tracer in a compute shader. It was quite fun and
       | much faster than the CPU version. Not trivial though; even such
       | simple things as generating noise take at least some thought.
        
       | raphlinus wrote:
       | This is a talk I've been working on for a while. It starts off
       | motivating _why_ you might want to write compute shaders (tl;dr
       | you can exploit the impressive compute power of GPUs but
       | portably), then explains the basics of _how,_ including some
       | sample code to help get people started.
       | 
       | Slides:
       | https://docs.google.com/presentation/d/1dVSXORW6JurLUcx5UhE1...
       | 
       | Sample code: https://github.com/googlefonts/compute-shader-101
       | 
       | Feedback is welcome (please file issues against the open source
       | repo), and AMA in this thread.
        
         | pjmlp wrote:
         | I will watch the talk later, but I think it is pretty obvious
         | why to write compute shaders. :)
         | 
         | https://home.otoy.com/render/octane-render/
        
         | pjmlp wrote:
         | Just watched it now, quite interesting how you presented
         | everything.
        
         | enos_feedler wrote:
         | This is fantastic. I worked on nvidia CUDA compiler from
         | 2008-2012 so I am familiar with GPU architecture, but not the
         | state of the art programming tools. You did a great job
         | providing continuity between what I know and what I need to
         | know now. I am really excited about WebGPU and IREE and have
         | been following these projects closely. Thank you!
        
         | ripley12 wrote:
         | I found this talk incredibly useful as a newbie, and I'm
         | looking forward to playing with the sample code.
         | 
         | I've been in a "don't understand the GPU compute landscape well
         | enough to decide what to get started on" limbo for a while, and
         | this talk was exactly what I needed. Thanks!
        
         | ninepoints wrote:
         | Is the audience mainly folks in the scientific computing or
         | academic world (aka folks that use CUDA mainly)? I went into it
         | as a graphics engineer and started to get that sense haha (good
         | job putting it together though)
        
           | raphlinus wrote:
           | I'm actually not 100% sure what audience would find this most
           | compelling, it's something of an experiment. I'm personally
           | motivated by 2D vector graphics rendering, but that's a
           | pretty small world, and I wouldn't be surprised if the main
           | applications for compute shaders ended up being scientific
           | and machine learning.
        
       | nodesocket wrote:
       | Such an amazing video, though I will admit a lot of it went
       | straight right over my head. I recently stumbled and have been
       | fascinated by the demoscene culture and specially timed head-to-
       | head competitions[1]. Shader programming boggles my mind, it
       | still feels insanely complex, verbose, and hard to grok.
       | 
       | [1] https://m.youtube.com/watch?v=O-1zEo7DD8w&t=1723s
        
       | bschwindHN wrote:
       | Really cool to see this being written with Rust/WGPU! I really
       | hope it has a strong future ahead of it - being able to target
       | multiple native graphics APIs with one codebase is very alluring.
       | 
       | A friend and I adapted a wgpu-rs "boids" example to render
       | strange attractors with compute shaders, though we basically
       | haven't applied _any_ polish to it yet:
       | 
       | https://github.com/bschwind/strange-attractors
        
         | [deleted]
        
       | brink wrote:
       | I started going through rust's wgpu tutorial last week.
       | 
       | Despite feeling overwhelmed with boilerplate, it really is
       | incredible what you can do; Vulkan, Metal, and DirectX
       | compatibility, and you only need to write it once.
        
       | Berg0X00 wrote:
       | Thanks for sharing this! I have not watched the full video yet
       | but definitely will. Recently got interested in compute shaders
       | thanks to this video: https://youtu.be/X-iSQQgOd1A?t=616 and can
       | recommend it to those that want to see a bit of what is possible
       | with compute shaders.
        
         | raphlinus wrote:
         | That's a great motivating example for compute shaders, and I'm
         | sure very fun to play with. It should be reasonably
         | straightforward to put the ant-like agent simulation logic on
         | top of the infrastructure in my sample code (either wgpu or the
         | lightweight abstraction layer), and I'd love to see that.
        
       ___________________________________________________________________
       (page generated 2021-06-05 23:02 UTC)