BoyBaykiller / Newtonian-Particle-Simulator

C# OpenGL Particle Simulation, GPU accelerated

Home Page:https://youtu.be/NhnoNYqIhTI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SSBO vs VBO

raaavioli opened this issue · comments

Hi, I didn't find any way contact info, so I'll just drop it here.

Did you find any resources on SSBO vs VBO performance for rendering?

I see you chose to store all particle data in SSBO to be able to read and write data in the VS for all particles directly. Have you found any resources suggesting this approach is faster, or have you done any comparisons with a pipeline completely compute shader driven or doing simulation in CS and rendering by passing the particle data as a VBO to the VS?

I'm just curious, but your choice seems to work fine as you can both simulate and render in the same render pass.

Hey. Good question.

This project did indeed rely on a Compute Shader in the past. I removed it in commit 2d99a79.
Before that particles were updated inside the CS and then read from a VS through a SSBO.
I also tried what I think you mentioned - streaming the SSBO as Vertex Attributes into the VS. That resulted in exactly the same performance.

However as you noticed I am now calculating and rendering in the same pass. I cant remember exact numbers, but I dont think splitting it into compute + render pass was any faster. Its also cleaner from a code style perspective and has less driver overhead.

Makes sense, I can’t find any numbers showing that using ssbos would be slower than using vbos and attributes, and your solution is indeed very clean!

The only reason I could see where it would be slow is if ssbos by spec are synchronized between gpu/cpu memory each frame. If the buffer just stays in gpu-memory only, this should be as efficient as it gets, as you only have to set a few uniforms. :)