19
votes
When is a compute shader more efficient than a pixel shader for image filtering?
John has already written a great answer so consider this answer an extension of his.
I'm currently working a lot with compute shaders for different algorithms. In general, I've found that compute ...
17
votes
Accepted
Performance of Compute Shaders vs. Fragment Shaders for Deferred Rendering
After more analysis, the TL;DR here is that, yes, the slowdown is due to memory locality, and yes the pixel order is to blame. More interestingly, by writing the shader differently, we can greatly ...
7
votes
Accepted
OpenGL Compute Shader generating triangle indices: How to get correct element count for glDrawElementsIndirect?
If you have access to glsl 4.3+ (or glsl ES 3.1) you can use atomicAdd
The next option is to use a barrier() after all vertices are generated in the compute and ...
7
votes
What's the point of "work groups" for OpenGL compute shaders?
I won't be discussing the usefulness of workgroups here as you can find it pretty much anywhere. However I am going to touch up on GPU architecture to understand why do we have workgroups in the first ...
7
votes
Compute Shader vs CUDA/OpenCL
It's not quite correct, today, to think of compute shaders as being "in the shader pipeline" in the same sense that your vertex and fragment shaders are literally hooked up into a pipeline. Compute ...
6
votes
Creating shared vertex normals on GPU
For an nVidia only solution you can use floating point atomic add intrinsics (like NvInterlockedAddFp32) Unlocking GPU Intrinsics in HLSL | NVIDIA Developer
I tried this on 80.000 vertex mesh and it'...
6
votes
Accepted
How to convert a thread ID into Screen Space Coord in an OpenGL Compute Shader?
The problem is actually in your fragment shader:
color_out = texture(source_image, gl_FragCoord.xy);
The texture() function accepts normalized coordinates which ...
5
votes
What's the point of "work groups" for OpenGL compute shaders?
Work groups share resources. The most notable resources they share are barriers and LDS (Local Data Storage aka shared memory in GL lingo, aka Thread Group Shared Memory).
See Efficient Compute Shader ...
5
votes
Accepted
Register pressure in Compute Shader
Lowering register pressure doesn't necessarily give you any performance boost though. I recently went through this exercise myself on GCN architectures (for a simple ray tracer) and reduced register ...
5
votes
Accepted
Threads per compute shader group
There shouldn't be any performance penalty inherent in using a 3D group over a 2D one, the dimensions are just an aid for programmers to map invocations on to memory locations (since you can read or ...
5
votes
When is a compute shader more efficient than a pixel shader for image filtering?
I stumbled on this blog:
Compute Shader Optimizations for AMD
Given what tricks can be done in compute shader (that are specific only to compute shaders) I was curious if parallel reduction on ...
5
votes
Compute shaders: one-time-only versus persistent buffers
Yes, it's totally possible, and in fact it's preferable to keep buffers in memory if you will be accessing them over the life of your program, rather than deallocating and reallocating them again.
I ...
5
votes
Accepted
Threads lockstep and conditions in compute shader
Not all threads will execute in lockstep but they are split into groups whose threads are locked to each other.
This means that if only 1 thread out of all threads enters a branch then only 1 group ...
5
votes
Accepted
Performance difference in OpenGL compute shader vs Vulkan Compute Shader vs Cuda/OpenCL and others
In general, you should not see significant performance differences running identical compute shaders via one API vs. another; in the end they’re running the same instructions on the same hardware. It’...
4
votes
Estimating the area of a triangle-circle intersection
Working Towards an Exact solution
Just some quick thought before I must run!
Ok, let us turn the problem on its head. What if one does not calculate the area of the triangle cut by the circle. ...
4
votes
Accepted
CUDA/OpenCL vs OpenGL compute shader for Path tracer
To first clear your confusion around the terms:
GPGPU stands for General Purpose computing on GPUs
CUDA is the specific NVIDIA API to perform GPGPU only on their hardware
OpenGL is a graphics ...
4
votes
Accepted
Can gl_WorkGroupSize be set outside the compute shader?
Core OpenGL has no mechanism for this. The ARB_compute_variable_group_size extension provides such a feature. It doesn't allow for indirect compute operations though.
It doesn't seem to have much AMD ...
4
votes
Accepted
Compute Shader shared average value
First of all, I don't think you need volatile or memory barriers if you're just using atomic operations. Atomic operations are always supposed to be atomic ...
3
votes
Accepted
Procedural terrain: What's the best approach to calculate noise in the GPU?
r a similar problem (a tree of combined noise functions, evaluated on the GPU), I found a good method is to generate a shader from the expression tree. Each predefined node corresponds to a single ...
3
votes
Accepted
Process of compute shader in OpenGL
The Opengl deals this problem automatically?
How could it? At no point do you inform OpenGL that you only want 900 invocations. You have exactly 2 mechanisms to control the number of invocations: ...
3
votes
Accepted
Controling order of execution of a (compute) shader on an array of vertices (data) in Vulkan
Vulkan is not really suited to at least some of the task you're trying to accomplish. It has no mechanism to declare from within a shader that some additional work should be invoked. Or at least, not ...
3
votes
Passing parameters in Metal Compute Kernel using Swift 4
The float2 type in the Metal structure requires an alignment of 8 bytes. The stride of the struct then becomes 24 so every value is aligned properly if you use it in an array. Your Swift structure ...
3
votes
Accepted
Buffer of arrays in HLSL compute shader
It looks to me like you want a buffer containing a single array of integers (not a buffer containing multiple arrays, whatever that would mean). So, you should be able to just do this:
...
3
votes
Accepted
GLSL Compute Shader doesn't run for large inputs
Operating systems cancel GPU program executions if they take too long. On Windows it is generally two seconds and on Linux it is five seconds most of the time, but it can vary.
This is to detect GPU ...
3
votes
Accepted
Sharing memory between compute shader and pixel shader
well, if anyone is stumbling across this and needs to know what solved it for me: We can bind a compute buffer to global shader memory if we just know what exactly we need to do
within the Compute ...
3
votes
Accepted
GLSL Compute Shader Setting "shared" memory buffer size
GLSL has no mechanism to change the "size" of shared memory. Indeed, GLSL is structurally incapable of such a thing.
You can't get a pointer to shared memory. Indeed, "shared memory&...
2
votes
Accepted
Raytracing in OpenGL using Compute Shaders
So i searched a lot after this and I think it was my confusion on FrameBuffer Objects.
I thought you could use FBO's just like a default FrameBuffer and display the texture image attached to it but ...
2
votes
UV Coordinate Interpolation in Compute Shader
You seem to do things more complicatedly than you need to, as adressed in the comments. What you actually want to do is simple the opposite of the normal render flow. Rather than drawing your mesh in ...
2
votes
Can I reuse glBindBufferBase in compute shaders to keep data on GPU?
I found it! The issue stems from a problem in the swap. When we swap buffers, the output buffer becomes the input and the input buffer becomes the output. However, the buffer that is now the output ...
2
votes
Compute shader not updating buffer, or vertex buffer unable to read the updates
Got help from someone over in the OpenGL subreddit. Apparently, as I trimmed the code for posting here and there, I changed the operation of the code.
What I trimmed to this:
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
compute-shader × 75opengl × 33
glsl × 12
shader × 9
gpu × 9
performance × 9
vulkan × 8
hlsl × 8
raytracing × 7
cuda × 6
buffers × 5
texture × 4
optimisation × 4
unity × 4
synchronization × 4
image-processing × 3
memory × 3
gpgpu × 3
rendering × 2
pathtracing × 2
c++ × 2
directx11 × 2
pixel-shader × 2
metal × 2
hardware × 2