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:

396 questions
61
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,531
  • 3
  • 16
  • 23
12
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,593
  • 11
  • 28
11
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
  • 1,656
  • 4
  • 28
  • 50
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
  • 701
  • 10
  • 23
9
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_
  • 616
  • 4
  • 13
8
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
  • 101
  • 3
8
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…
user45681
  • 180
  • 2
  • 9
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
  • 780
  • 10
  • 24
8
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
  • 1,902
  • 1
  • 23
  • 35
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…
Turmolt
  • 93
  • 9
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…
7
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,012
  • 5
  • 15
7
votes
1 answer

DirectCompute atomic counter

In a compute shader (with Unity) I have a raycast finding intersections with mesh triangles. At some point I would like to return how many intersections are found. I can clearly see how many intersections there are by marking the pixels, however if…
Aaron Krajeski
  • 757
  • 5
  • 18
7
votes
2 answers

DirectX Shader Resource View in Shaders

I'm a bit confused right now and just want to ask you all to help me get a few ideas clarfied. In a HLSL shader (compute shader for example) I can declare a StructuredBuffer sb, right? Do I HAVE to bind it to a register, such as : register(t0)?…
l3utterfly
  • 1,656
  • 4
  • 28
  • 50
6
votes
1 answer

DirectX11: Pass data from ComputeShader to VertexShader?

Is it possible to apply a filter to the geometry data that is to be rendered using Compute Shader and then use the result as an input buffer in the Vertex Shader? That would save me the trouble (&time) of reading back the data. Any help is much…
testalino
  • 5,274
  • 6
  • 31
  • 45
1
2 3
26 27