37 questions
1
vote
1
answer
176
views
My Compute Shader doesn't have any outside effects
I'm trying to write a compute shader in GLSL with OpenGL, GLFW, GLEW, and GLM. The problem is that the compute shader either isn't running or isn't modifying any buffers. I have the latest NVIDIA 4060 ...
0
votes
1
answer
137
views
(Vulkan) Problem with limiting the maximum number of elements in the StorageBuffer
I'm having a problem with the size of my StorageBuffer, I currently have 4GB available on my GPU but I seem to be limited to a maximum size of 1GB.
I went to check the vulkan specifications of my GPU ...
0
votes
0
answers
254
views
OpenGL, SSBO std430 padding byte size
This is the fragment shader code which is including struct and buffer data:
struct Light
{
float range;
vec3 position;
vec3 color;
};
layout (std430) buffer LocalLights
{
uint ...
0
votes
0
answers
46
views
OpenGL, How to use dynamic struct array in glsl with Shader Storage Buffer Object [duplicate]
This is fragment shader which is using SSBO
struct Light
{
float range;
vec4 position;
vec4 color;
};
layout (std430) buffer LocalLights
{
uint activeLightCount;
Light light[];
}...
2
votes
2
answers
238
views
The intersection shader reads zeroes out of an SSBO
My intersection shader always reads just zeroes from the SSBO I have.
I tried using debugPrintEXT, but it wouldn't print out from within the intersection shader. However, when I try to output any ...
2
votes
0
answers
489
views
Vulkan StorageBuffer versus VertexBuffer
I'm experimenting with Vulkan rendering, and noticed that we can render using StorageBuffer + gl_VertexIndex instead of VertexBuffer. I've seen this in Metal API tutorials.
There are any benefits of ...
0
votes
1
answer
365
views
How to get shader storage block's variable offset when using layout(packed) or layout(shared) in OpenGL?
If I have a shader storage block defined in GLSL like this:
buffer test_block
{
type1 var1;
type2 var2;
type3 var3;
};
How to get the offset of one of the variable in this block?
We know ...
0
votes
1
answer
1k
views
Fastest way to get Storage Buffer to host from compute shader in Vulkan
I have a large Storage Buffer of ~4.6MB I am sending via compute buffer and then retrieving at the host at the end of the render loop. I was hoping someone could provide guidance on a possible optimal ...
0
votes
0
answers
712
views
Vulkan/GLSL shader best way to allocate buffer with previously unknown output length
I'm writing a compute shader that will output some unknown amount (there is a theoretical upper bound, but it is huge, compared to expected values) of data into a storage buffer.
I have found a way to ...
1
vote
1
answer
513
views
Async SSBO Readback
When I call GetBufferSubData with my Shader Storage Buffer Object there is typically a 4ms delay. Is it possible for my application to do work during that time?
// start GetBufferSubData
// do client/...
0
votes
1
answer
277
views
Ensuring endianness in moderngl buffers
I'm trying to learn moderngl for Python and I want to know if there is a way to make certain that when I read/write to a buffer (uniform or shader storage), the endianness agrees between guest and ...
2
votes
0
answers
1k
views
Is there an efficient way to append values in an SSB in a compute shader with GLSL?
I have an OpenGL compute shader that generates an undefined number of vertices and stores them in a shader storage buffer (SSB). The SSB capacity is big enough so that the compute shader never ...
0
votes
0
answers
531
views
Shader Storage Buffer Object element reading optimization
Im doing trillinear interpolation using Shader Storage Buffer Object.
So i access my ssbo in fragment shader like this:
layout(std430, binding = 0) buffer ColorSSBO { int value[]; };
int c000 = value[...
0
votes
1
answer
115
views
stream parallel load to Shader Storage Buffer Object
I am trying to load integer array in parallel, but i get an error:
int[][] colors;
...
IntStream.range(0, colors.length).parallel().forEach(i -> {
GL15.glBufferSubData(GL43....
7
votes
1
answer
1k
views
glGetBufferSubData and glMapBufferRange for GL_SHADER_STORAGE_BUFFER very slow on NVIDIA GTX960M
I've been having some issues with transfering a GPU buffer into CPU for performing sorting operations. The buffer is a GL_SHADER_STORAGE_BUFFER composed of 300.000 float values. The transfer operation ...
0
votes
1
answer
226
views
Having trouble with SSBO in JOGL
I've been trying to initialize an SSBO and pass it to a a compute shader.
int ssbo = glGenBuffers();
FloatBuffer buff = BufferUtils.createFloatBuffer(4);
buff.put(0.1f);
buff.put(0.4f);
buff.put(1....
0
votes
0
answers
43
views
Nondeterministic SSBO has GL_BUFFER_DATA_SIZE too small after glBufferData [duplicate]
I seem to have nondeterministic data in my Shader Storage Buffer.
I used apitrace to inspect the state machine and noticed the following sequence of function calls in the trace:
glBindBuffer (...
4
votes
1
answer
2k
views
Can I make a GLSL struct have std140 layout?
I just tried to do this
C++
struct PointLight
{
glm::vec4 position;
glm::vec4 colour;
};
std::vector <PointLight> lights_array;
GLSL 320 ES:
layout (std140) struct PointLight
{
...
4
votes
1
answer
11k
views
Dynamic-length arrays as Shader Storage Buffer Objects
Let's say I have a dynamic number of "balls" which I want to access in my OpenGL shaders. In C++ the data might be like this:
struct Ball
{
glm::vec3 position;
glm:vec3 colour;
float size;...
1
vote
1
answer
1k
views
Do I need a memory barrier between initializing an SSBO storage and filling it?
I've got code that looks like this:
uint ssboId;
glGenBuffers(1, &ssboId);
glBindBuffer(GL_SHADER_STORAGE_BUFFER, ssboId);
//initialize
glBufferData(GL_SHADER_STORAGE_BUFFER, size, 0, ...
4
votes
1
answer
1k
views
How do I query the alignment/stride for an SSBO struct?
I'm not sure which structure layout is most suited for my application: shared, packed,std140, std430. I'm not asking for an explanation of each, that information is easy to find, it's just hard to ...
3
votes
1
answer
2k
views
Make a shader storage buffer in different shader programs accessible
What layout and binding do i have to do to make a (working) shader storage buffer readable in a second shader program?
I set up and populated a SSBO which i bound successfully and used in a geometry ...
0
votes
1
answer
2k
views
read-only storage buffer in OpenGL ES and Spir-V
In OpenGL ES Shading Language, the shader storage buffer object (SSBO) can be decorated with qualifier readonly or writeonly.
Section 4.9 (Memory Access Qualifiers) of OpenGL ES Shading Language ...
1
vote
1
answer
2k
views
OpenGL: How is MAX_SHADER_STORAGE_BLOCK_SIZE related to the real limit of SSBO size?
From skimming through the OpenGL documentation I kinda assumed that MAX_SHADER_STORAGE_BLOCK_SIZE is the actual limit on the size an SSBO might have. On my GPU this value is reported as 128 MB. ...
3
votes
1
answer
2k
views
How to acquire the sampler2D type from a Shader Storage Buffer Object inside a shader?
I am trying to get a variable of type sampler2D into my shaders without using
an uniform variable.
Instead, I want to hand it over using a Shader Storage Buffer Object (SSBO).
What type of variable ...
0
votes
0
answers
184
views
How can multiple buffering make program faster
I have some question on multiple buffering in OpenGL. For example, I have a program. It does following things:
do a depth pre-pass, and write some information on the shader storage buffer.
use the ...
0
votes
1
answer
233
views
Vulkan Buffer WorkGroupID not returning actual value when large number of elements
Creating a buffer with pow(2, 24) and a local_size_x = 64 for the layout input qualifier will return WorkGroupID = 262143 which is all fine due to pow(2,24) / 64 - 1, it is zero indexed.
However if ...
2
votes
1
answer
1k
views
OpenGL 4.5 - Shader storage: write in vertex shader, read in fragment shader
Both my fragment and vertex shaders contain the following two guys:
struct Light {
mat4 view;
mat4 proj;
vec4 fragPos;
};
layout (std430, binding = 0) buffer Lights {
Light lights[];
};
My ...
6
votes
0
answers
4k
views
OpenGL 4.5 - Shader storage buffer objects layout
I'm trying my hand at shader storage buffer objects (aka Buffer Blocks) and there are a couple of things I don't fully grasp. What I'm trying to do is to store the (simplified) data of an ...
1
vote
1
answer
474
views
The size limitation of the resources per shader in OpenGL 4.5
I have encountered a weird problem: I have a fragment shader containing several uniform variables (mat4, vec4), a single sampler2D and a gigantic SSBO (1GB-2GB). For each type of variables, it does ...
0
votes
1
answer
2k
views
Pointer into input struct of Compute Shader
Once more I have a problem with my compute shader... I would like to pass a structure containing a pointer into a compute shader.
This is my structure example:
struct couleurStruct {
float r;
...
0
votes
1
answer
3k
views
Array of structures into Compute Shader
Writing a simple compute shader in OpenGL to understand how it works, I can't manage to obtain the wanted result.
I want to pass to my compute shader an array of structures colourStruct to color an ...
3
votes
1
answer
4k
views
Getting data back from compute shader
I'm fairly new to opengl and I found myself in situation where I need to get data from compute shader but as I miss some critical knowledge I can't get it to work. So I came here, so that maybe you ...
1
vote
1
answer
217
views
Giving C++ containers to OpenGL?
I created a shader storage buffer object to give information to my vertex shader. It is bound to a buffer containing a single structure. But there is a problem. The data I keep in this structure is ...
1
vote
1
answer
244
views
Only get garbage from Shader Storage Block?
I have bound the shader storage buffer to the shader storage block like so
GLuint index = glGetProgramResourceIndex(myprogram, GL_SHADER_STORAGE_BLOCK, name);
glShaderStorageBlockBinding(myprogram, ...
6
votes
0
answers
2k
views
GLSL: Passing variable length buffer array to function
I am interested in passing a variable length array (attached SSBO) to a function, i.e.:
layout(std430) buffer ssbo {
type buffer[];
};
void func(buffer) {
buffer[...]
}
func(buffer);
EDIT: ...
4
votes
1
answer
570
views
Is it legal to reuse Bindings for several Shader Storage Blocks
Suppose that I have one shader storage buffer and want to have several views into it, e.g. like this:
layout(std430,binding=0) buffer FloatView { float floats[]; };
layout(std430,binding=0) buffer ...