Questions tagged [compute-shader]

A Compute Shader is a Shader Stage that is used entirely for computing arbitrary information. While it can do rendering, it is generally used for tasks not directly related to drawing triangles and pixels.

Resources:

556 questions
66
votes
2 answers

What is the difference between OpenCL and OpenGL's compute shader?

I know OpenCL gives control of the GPU's memory architecture and thus allows better optimization, but, leaving this aside, can we use Compute Shaders for vector operations (addition, multiplication, inversion, etc.)?
Maiss
  • 1,641
  • 4
  • 18
  • 23
14
votes
1 answer

GLSL memoryBarrierShared() usefulness?

I am wondering about the usefulness of memoryBarrierShared. Indeed, when I am looking the documentation for barrier function : I read : For any given static instance of barrier in a compute shader, all invocations within a single work group must…
Antoine Morrier
  • 3,930
  • 16
  • 37
13
votes
1 answer

Rendering to multiple textures with one pass in directx 11

I'm trying to render to two textures with one pass using C++ directx 11 SDK. I want one texture to contain the color of each pixel of the result image (what I normally see on the screen when rendering a 3D scene), and another texture to contain the…
l3utterfly
  • 2,106
  • 4
  • 32
  • 58
11
votes
1 answer

How Do I Use an HTML5 Canvas as a WebGL Texture

I want to: Set Uniform values for case i. Render compute shader for case i to an HTML5 tag. Use the contents (case i render output) as a texture in the next render pass. Repeat for all cases. Extract answers into JS from color…
Adrian Seeley
  • 2,262
  • 2
  • 29
  • 37
10
votes
1 answer

SSBO as bigger UBO?

i am currently doing so rendering in OpenGL 4.3 using UBOs to store all my constant data on the GPU. (Stuff like material descriptions, matrices, ...). It works however the small size of UBO (64kB on my implementation) forces me to switch buffers…
gan_
  • 656
  • 5
  • 15
10
votes
1 answer

Raytracing in OpenGL via compute shader

I am trying to do some raytracing in OpenGL via the compute shader and I came across a weird problem. At the moment I just want to display a sphere without any shading. My compute shader launches a ray for every pixel and looks like this: #version…
Stan
  • 721
  • 10
  • 24
9
votes
1 answer

Applying compute/kernel function to vertex buffer before vertex shader

I would like to use a compute shader to modify my vertices before they are passed to the vertex shader. I can’t find any examples or explanations of this, except that it seems to be mentioned here: Metal emulate geometry shaders using compute…
Nils Nielsen
  • 131
  • 5
9
votes
1 answer

How do GPUs handle random access?

I read some tutorials on how to implement a raytracer in opengl 4.3 compute shaders, and it made me think about something that had been bugging me for a while. How exactly do GPUs handle the massive amount of random access reads necessary for…
Errata - C
  • 190
  • 2
  • 9
8
votes
1 answer

Metal makeComputeCommandEncoder assertion failure

I am trying to setup and execute a compute kernel and submit it's output to MTKView to draw. But I get the following crash: -[MTLDebugCommandBuffer computeCommandEncoder]:889: failed assertion `encoding in progress' What is wrong with the code…
Deepak Sharma
  • 5,577
  • 7
  • 55
  • 131
8
votes
3 answers

OpenGL compute shader - strange results

I'm trying to implement a multipass compute shader for image processing. There is an input image and an output image in each pass. The next pass' input image is the previous ones' output. This is the first time for me using compute shader in OpenGL…
Gábor Fekete
  • 1,343
  • 8
  • 16
8
votes
1 answer

DirectX 11 - Compute shader: Writing to an output resource

I've just started using the Compute shader stage in DirectX 11 and encountered some unwanted behaviour when writing to an output resource in the Compute shader. I seem to get only zeroes as output which, to my understanding, means that out-of-bound…
SvinSimpe
  • 850
  • 1
  • 12
  • 28
7
votes
2 answers

How to execute parallel compute shaders across multiple compute queues in Vulkan?

Update: This has been solved, you can find further details here: https://stackoverflow.com/a/64405505/1889253 A similar question was asked previously, but that question was initially focused around using multiple command buffers, and triggering the…
axsauze
  • 343
  • 4
  • 14
7
votes
1 answer

Debugging Metal compute shaders with Xcode

In Apple's 2018 WWDC session "Metal Shader Debugging and Profiling," the speakers detail what was then a new Metal debug workflow. However, they didn't go very far with compute shaders in the demo, only briefly mentioning the options that would…
7
votes
1 answer

Odd behavior in fluid simulation when converting from my working shadertoy to unity compute shaders

I am trying to replicate my working 2d fluid shadertoy in a compute shader in Unity, with the hopes of moving it to 3D soon. When I replicate the algorithm the same way, I get some very weird behavior (seen in this video I took). I have tried to…
7
votes
2 answers

Ray tracing via Compute Shader vs Screen Quad

I was recently looking for ray tracing via opengl tutorials. Most of tutorials prefer compute shaders. I wonder why don't they just render to texture, then render the texture to screen as quad. What is the advantages and disadvantages of compute…
1
2 3
36 37