sokol
sokol copied to clipboard
sokol_gfx.h: Pipeline desc without attributes should be valid
Hello there,
It is perfectly valid to be able to call the draw functions without any vertex or index buffer bound. For example this vertex shader is a neat trick to draw a fullscreen pass without any vertex buffer:
#version 330 core
out vec2 uv;
void main()
{
uv = vec2((gl_VertexID << 1) & 2, gl_VertexID & 2);
gl_Position = vec4(uv * 2.0f + -1.0f, 0.0f, 1.0f);
}
Sokol pipeline validation though does not permit this, using the following validation: https://github.com/floooh/sokol/blob/master/sokol_gfx.h#L10440
This is not valid, and we should allow pipelines without any layout attributes to be created.
Hi, the reason why attribute-less rendering isn't allow in sokol_gfx.h is that this isn't supported by GLES2 and WebGL (gl_VertexID was only added to GLES3 and WebGL2).
It might make sense to declare this as an optional feature though, I'll think about it.
Thanks for writing the issue!
Just ran into the same issue, support for this would be great.
@floooh Why keep GLES2 and WebGL around? Can't they be replaced by GLES3 and WebGL2 across the board?
It's also required with WebGL2 and angle backend (d3d9)
@floooh Why keep GLES2 and WebGL around? Can't they be replaced by GLES3 and WebGL2 across the board?
Believe it or not, Apple has never moved beyond a mostly un-implemented webgl2 support on its devices. We'll have to wait until they bother with WebGPU, most likely, as that uses Metal underneath. I think that there should be a WebGL 1 extension for hacking-in some things optionally.
Apple has never moved beyond a mostly un-implemented webgl2 support
Safari Technology Review on macOS now actually has a working WebGL2 implementation based on ANGLE (it was just enabled by default a couple of days ago), I don't know how far along the iOS version is. But once this lands in the stable version I might indeed start plotting to remove the GLES2/WebGL1 support.
Upvoting this. Something like a feature flag would be greatly appreciated.
Closing this ticket in favour of: https://github.com/floooh/sokol/issues/922
(now that GLES2/WebGL1 has been dropped it's time to look into that topic again)
("closed as not planned" actually means "closed as duplicate"!)