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
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…
7
votes
1 answer

Rendering data in OpenGL: Vertices and Compute shaders

I want to be able to input a bunch of vertices to my graphics program and then I want to be able to do the following on them: Use them in the graphics part of OpenGL, especially in the Vertex Shader. Do physics calculations on them in a Compute…
skiwi
  • 66,971
  • 31
  • 131
  • 216
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
  • 2,106
  • 4
  • 32
  • 58
6
votes
2 answers

Is there any performance difference between Buffer, StructuredBuffer and ByteAddressBuffer (also their RW variants)?

I tried looking this up on various websites, including MS Docs on DirectX 11 Compute Shader types; but I haven't found anything mentioning performance differences of these buffer types. Are they exactly the same performance-wise ? If no, what is the…
6
votes
0 answers

"portable" way to determine GPU core occupancy with Vulkan

For writing GPU computation kernels (aka "compute shaders" in GL/Vulkan), it is useful to query various shader parameters such as register usage and shared memory usage that determine how much individual threads may get scheduled to a single…
exa
  • 859
  • 7
  • 27
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,474
  • 6
  • 36
  • 48
6
votes
1 answer

Calculating mean value in the metal kernel

Anyone knows a proper way to calculate mean value of the buffer with random float numbers in the metal kernel? Dispatching work on the compute command encoder: threadsPerGroup = MTLSizeMake(1, 1, inputTexture.arrayLength); numThreadGroups =…
Vahan Babayan
  • 723
  • 7
  • 21
6
votes
1 answer

Mipmapping with compute shader

I have 3D textures of colors, normals and other data of my voxelized scene and because some of this data can't be just averaged i need to calculate mip levels by my own. The 3D texture sizes are (128+64) x 128 x 128, the additional 64 x 128 x 128…
FamZ
  • 461
  • 3
  • 13
6
votes
1 answer

Compute Shader write to texture

I have implemented CPU code that copies a projected texture to a larger texture on a 3d object, 'decal baking' if you will, but now I need to implement it on the GPU. To do this I hope to use compute shader as its quite difficult to add an FBO in my…
mike
  • 194
  • 1
  • 2
  • 18
6
votes
2 answers

DirectCompute optimal numthreads setup

I've recently been playing with compute shaders and I'm trying to determine the most optimal way to setup my [numthreads(x,y,z)] and dispatch calls. My demo window is 800x600 and I am launching 1 thread per pixel. I am performing 2D texture…
Valentin
  • 1,731
  • 2
  • 19
  • 29
6
votes
2 answers

OpenGL Compute Shader Invocations

I got a question related to the new compute shaders. I am currently working on a particle system. I store all my particles in shader-storage-buffer to access them in the compute shader. Then I dispatch an one dimensional work group. #define…
Stan
  • 721
  • 10
  • 24
5
votes
2 answers

Difference Between Calling numthreads and Dispatch in a Unity Compute Shader

Hypothetically, say I wanted to use a compute shader to run Kernel_X using thread dimensions of (8, 1, 1). I could set it up as: In Script: Shader.Dispatch(Kernel_X, 8, 1, 1); In Shader: [numthreads(1,1,1)] void Kernel_X(uint id :…
5
votes
0 answers

Metal SIMD Min and Max operations fail for floats

Question in short Why am I getting undefined behavior from simd_min and simd_max functions in Metal 2.1 with floats? Update: Seems this only occurs on the Radeon Pro 560X GPU, but not on the Intel UHD Graphics 630. Background According to Metal…
TToi
  • 133
  • 5
5
votes
0 answers

Compute shader: typing function argument with Image2D

I'm writing a framework which needs to offer a few functions defined on the image2D type. But it seems a bit difficult to get this right and I can't find any documentation on passing an image2D to a function. Here is a minimal example of my…
Simon Danisch
  • 554
  • 3
  • 8
5
votes
1 answer

Compute shader shared memory contains artifacts

I've been trying to write a general compute shader Gaussian blur implemenation. It basically works, however it contains artifacts which change every frame even when the scene is static. I've spent the past few hours trying to debug this. I've gone…
Robadob
  • 5,319
  • 2
  • 23
  • 32
1
2
3
36 37