<p>yes, and no. Loading the floats into the SSBO <em>is</em> loading them for the shader so yes you still have to iterate over them. And GPU's generally are good at latency hiding so whether or not you read floats or vec4's the GPU should be able to read them in just as fast. But processing them as vec4's instead of 1 float at a time <em>will</em> be faster since the code is taking advantage of the GPU's vector processing.</p>

CC BY-SA 4.0
2021-04-28T11:44:45.300Z
2021-04-28T11:44:45.300Z
pmw1234
<p>I have a mesh, each face (triangle) of the mesh needs to read some information out of a SSBO object.
Is there a way to read out a block (lets say 100 floats) at once? Or do I need to iterate over the 100 floats? The number of floats is not fixed. They vary for each triangle.
During this stage the 100 floats are not changing at all... So to iterate over them would make no change in the logic. But I think it takes to mush time to read them after each other.</p>
<p>I also have a second question:
when reading lets say 128 floats from SSBO iteratively does it takes longer than reading 32 vec4 iteratively? in principle both is the same (128 floats)</p>

<glsl>
SSBO get block of data instead of iterating
Thomas
# SSBO get block of data instead of iterating

(Asked by: username_0 on 2021-04-28)

I have a mesh, each face (triangle) of the mesh needs to read some information out of a SSBO object.
Is there a way to read out a block (lets say 100 floats) at once? Or do I need to iterate over the 100 floats? The number of floats is not fixed. They vary for each triangle.
During this stage the 100 floats are not changing at all... So to iterate over them would make no change in the logic. But I think it takes to mush time to read them after each other.

I also have a second question:
when reading lets say 128 floats from SSBO iteratively does it takes longer than reading 32 vec4 iteratively? in principle both is the same (128 floats)

**Tags:** glsl


---

## 1 answers

### Answer by username_1 on 2021-04-28. Score: 1 | Accepted answer

yes, and no. Loading the floats into the SSBO *is* loading them for the shader so yes you still have to iterate over them. And GPU's generally are good at latency hiding so whether or not you read floats or vec4's the GPU should be able to read them in just as fast. But processing them as vec4's instead of 1 float at a time *will* be faster since the code is taking advantage of the GPU's vector processing.


---

