Compute shaders in Godot

Hello,

Let me please ask this question:

I read about compute shaders in Godot: https://docs.godotengine.org/en/stable/tutorials/shaders/compute_shaders.html

And it seems to me that whoever wrote this article wrote it specifically to be as incomprehensible as possible for the reader.

To be honest, I didn’t understand anything from this article.
For example: the article mentions:

#[compute]
#version 450
These two lines communicate two things:

The following code is a compute shader. This is a Godot-specific hint that is needed for the editor to properly import the shader file.

The code is using GLSL version 450.

After these lines in the article I IMMEDIATELY have QUESTIONS:
-If I have to specify a specific version of OpenGL, then Godot Compute Shaders Are Not Cross-Platform??
-Godot only works with OpenGL compute shaders? What then to do with the “Forward +” mode, which Vulcan uses or what to do when I export the game to MacOs/Ios - which neither Vulcan nor OpenGl supports.

In general, to be honest, nothing is clear at all :frowning:

If someone could explain it clearly, I would be very grateful.

Compute shaders are an advanced topic and is expected that the user have and advanced knowledge about shaders and how they work before being able to use them correctly.

You aren’t specifying a OpenGL version. You are specifying a GLSL version.

Vulkan and OpenGL can use GLSL shaders as they are compiled to SPIR-V

EDIT: The version of OpenGL Godot uses does not have support for compute shader and it does not use the RenderingDevice so it’s not possible to use compute shaders in the OpenGL compatibility rendering mode.

2 Likes

That’s a stretch now, isn’t it? :wink: We’re talking about someone who offers their work for free to everyone, and your questions are related to the underlying systems, not the section in the doc.

3 Likes

Ummm, so what? If someone does something for free, does that mean they have to do it poorly?

Please tell me, Judging by this article: https://docs.godotengine.org/ru/4.x/tutorials/shaders/converting_glsl_to_godot_shaders.html

Do I understand correctly that the Godot shader language is, roughly speaking, a single API over OpenGL, Vulkan and Metal shaders?

That is irrelevant to my point. My point is that the article itself is not a bad written one, and that saying that the author’s intention must have been to incomprehensible is nonsensical, and if they’re offering their work for free to everyone, maybe feedback should be better put.

And, again, your question seems to stem more from your lack of background knowledge, rather than the author or article being confusing.

Either way, did not mean to hijack your topic aside from the initial feedback, glad you’re getting good answers here.

1 Like

Godot shaders are based on GLSL more info here Introduction to shaders — Godot Engine (stable) documentation in English

Compute shaders are GLSL and are compiled to SPIR-V and then converted internally from SPIR-V to GLSL, HLSL, or whatever target shading language the converter supports.

2 Likes