What is the "set" param in GLSL in godot's compute shader layout

Godot Version

4.2

Question

I’m reading the compute shader tutorial that describes an input data buffer like this,

layout(set = 0, binding = 0, std430) restrict buffer MyDataBuffer { ...

The docs say compute shaders are directly written in GLSL, so I’m referencing keywords with the GLSL docs.

I’ve found and understand:

But I cannot for the life of me find the docs for layout(set = 0).

The closest I’ve come are opaque references in the Vulkan docs.
IIUC, GLSL compiles to SPIR-V which then uses the Vulkan API, so Vulkan docs don’t exactly apply.

set basically seems like a way of specifying memory layout, but what does it mean at a driver/hardware level?
What’s the difference between set and binding? When does set need to increment?
Where can I learn more?

https://www.reddit.com/r/vulkan/comments/zt87pv/confused_about_vulkan_binding_and_set_rules_in/

Thanks for the link. Does that imply there are multiple versions of GLSL? One targeting Vulkan and one targeting OpenGL? It also seems to imply Godot is using the Vulkan-targeted one.

For anyone following- the reddit thread references the GLSL language doc here - https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.pdf

Yes but GLSL is only a language.

Not for Godot. As I believe we are still on Opengl3… And that doesn’t support compute shaders. So It’s only Vulkan. I think the Godot shader language is probably a derivative of GLSL.

Yes it’s because compute shaders are a feature of the Vulkan sdk. Opengl does not support compute shaders in 3.x. And didnt until 4.3.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.