As the title says, they aren’t supported. However, after searches, OpenGL does support them, which caused great confusion.
When being discussed in those very hardcore C++ game/software development videos (often talked alongside SDL and SFML), OpenGL is like a superpower that can make everything efficient. But in the Godot documentation, OpenGL looks weak and slow, and many features are unsupported.
I don’t know how to code GLSL, but I’m sure it stands for OpenGL Shading Language. It has features like layout buffer, which can be used for compute shaders, glBufferData for dynamic-sized buffers, and so on.
All in all, the disabled features in the compatibility mode confused me very much.
There are a variety of versions of OpenGL, and compute shaders have only been in core since OpenGL 4.3; before that they were an extension, and not guaranteed to be available. Depending on the base version of OpenGL Godot requires, they may not be able to rely on the presence of compute shaders.
MacOS deprecated OpenGL a long time ago and (AFAIK) never got past OpenGL 4.1, so if Godot’s requirements are set up for baseline cross-platform support, compute shaders are off the table.
Ok, the compute shader introduced in OpenGL 4.3 is unsupported, which is reasonable. But the dynamic buffer has been there since OpenGL 1.5, it’s a pretty fundamental and indispensable feature.
Generally, you’ll be advised to work with Image and ImageTexture, but it does redundant copying. Godot didn’t support other texture classes that allow pointing to custom data, so I thought of deriving the Image class and setting its data pointer (or again, derive the Vector to have a direct pointing version) directly to my data address. The reality is you can’t do it, the core methods aren’t virtual as they’re supposed to be.
It just feels like Godot shuts all the doors to what originally could be done easily, like implementing an ImageView, or at least make the methods virtual, leaving it to the developers.
. But the dynamic buffer has been there since OpenGL 1.5,
I don’t know what a “dynamic buffer” is in the context of OpenGL, but if you’re referring to SSBOs (i.e. buffers you can arbitrarily write to and read from in shaders) those have only been in core since 4.3. As far as I can tell Godot compatibility mode uses OpenGL 3. It’s called “compatibility” for a reason, it’s supposed to support old hardware, not new features.
The dynamic buffer I meant is an API or language feature provided in GDScript or GDShader, but apparently, Godot didn’t offer such a feature. You mentioned the compatibility mode uses OpenGL 3, so technically it should be available.
I’m a Godot newbie, but I can assure you OpenGL 3 does not support GPU-writeable buffers. You have array buffers (to which you can upload vertex data that the GPU will render), uniform buffers (which can contain arbitrary data, but can only be read by shaders, not written to, and have size limitations) and textures (which are allocated differently and don’t go through the usual glBufferData api for data uploading). There are a few others, none of which support writing from the GPU as far as I know. GPGPU capabilities are a fairly recent addition to OpenGL, which started out purely as a 3d graphics API, with fixed-function shading. To be clear, all those capabilities require OpenGL 4.3 or newer, and they will not work on OpenGL 3.
I don’t know what got the idea into your head that “dynamic buffers”, whatever those are, have been supported since OpenGL 1.5. If you’re talking about GL_DYNAMIC_DRAW, that’s a usage hint that’s passed to glBufferData as part of the CPU-GPU data transfer, and has nothing to do with compute shaders.
Please excuse me if I misinterpreted your question and you’re actually asking about something different, but you come across to me as very misinformed about how OpenGL works, so I wanted to weigh in. If you’re asking whether Godot can provide software emulation for unsupported features, I’m afraid I don’t know, and will let the pros talk
@coderjo my bad. I won’t reply again to not clutter the thread. In OpenGL3 you can map a buffer in pinned memory to avoid a redundant copy before the DMA transfer, but I don’t know if you can do that with textures. But I get that your complaint is about the Godot APIs.
Compute shaders. @hexgrid said it’s an OpenGL 4.3 feature, apparently not available on compatibility mode.
Dynamic buffers. This topic is simply about transferring data to VRAM while avoiding redundant copying.
To solve the latter, I tried to define a uniform, but there’s a max size of 65536=2^16 bytes, and you can only use statically sized arrays.
Therefore, I focused on ImageTexture and Image. The problem became avoiding double copies: my data on RAM -> image data on RAM -> VRAM, so the idea became how to let the Image.get_data() directly return the address of my data, as in the post section below.
Hmm, there is a way to avoid copying, which is directly using the memory from Image::ptrw, but it somewhat sounds like an unsafe workaround. With this method, I came across an allocator (used for a 2D grid container) that returns the ptrw of a given Image.
I’m still sorry that compatibility mode doesn’t support compute shaders.