Open
Description
I tried to use this package for a simple triangle example and failed to load my shader. my code looks like
const vertexShader = gl.createShader(.vertex);
const vertexSource = @embedFile("vertex.glsl");
gl.shaderSource(vertexShader, &[_] [*:0]const u8{vertexSource}, null);
I struggled to get my second argument right, but the last one seems wrong to me.
Here is the documentation of the function : https://docs.gl/gl4/glShaderSource
The sources have to either be null terminated or have their length represented in the last argument. In my case, @embedFile
makes a null terminated string.
I started zig recently, and I don't really know what should be done here, so I could do it if you can give me some input on that.
My solutions are either:
- we make the last argument optional and if null then send null pointer
- don't take a third argument (after all, it's a wrapper) as the second argument already knows its size with
src_ptrs.len
. Currently, it seems that the wrapper still uses the same function signature but "translated" so this might not be desirable - don't change anything and tell me the secret to tricking zig in sending a null pointer
- don't change anything, and I create an array of the size manually.
Lines 2759 to 2776 in 27f5f22
Metadata
Metadata
Assignees
Labels
No labels