Open GmosNM opened 1 year ago
I think this is due to the fact that the read_entire_file does not zero out the remaining space if for instance you load a shader of 100 bytes and after that a shader of 90 bytes the last 10 bytes will still be of the old shader. The count in the SB will be correctly set to 90, but only the .items pointer is passed to the compile_shader function https://github.com/tsoding/ded/blob/983c71135214353f6c6b7544ea112cd3afd696a9/src/simple_renderer.c#L55 which apparently does not take into account null terminators halfway in the chararray.
So memsetting the full SB to 0 before reading the file helps https://github.com/tsoding/ded/blob/983c71135214353f6c6b7544ea112cd3afd696a9/src/common.c#L105
Note there is a PR with a working windows build (both local and CI) if you're interested https://github.com/tsoding/ded/pull/42
I think this is due to the fact that the read_entire_file does not zero out the remaining space if for instance you load a shader of 100 bytes and after that a shader of 90 bytes the last 10 bytes will still be of the old shader. The count in the SB will be correctly set to 90, but only the .items pointer is passed to the compile_shader function
which apparently does not take into account null terminators halfway in the chararray. So memsetting the full SB to 0 before reading the file helps
https://github.com/tsoding/ded/blob/983c71135214353f6c6b7544ea112cd3afd696a9/src/common.c#L105
Note there is a PR with a working windows build (both local and CI) if you're interested #42
yo thank you but its not working for me
Are you trying to run the build_msvc file or the ded.exe?
The ded.exe needs the SDL2.dll and freetype.dll and it's the 64 bit version that is build maybe that's the issue.
Could you try to run from the commandline to see if there is some extra logging?
Weird indeed, the good news is it builds 👍 What machine are you trying to run it on? 32bit vs 64bit?
Maybe this will have some guidance? https://www.passfab.com/windows-10/this-app-cant-run-on-your-pc.html
I think this is due to the fact that the read_entire_file does not zero out the remaining space if for instance you load a shader of 100 bytes and after that a shader of 90 bytes the last 10 bytes will still be of the old shader. The count in the SB will be correctly set to 90, but only the .items pointer is passed to the compile_shader function
which apparently does not take into account null terminators halfway in the chararray. So memsetting the full SB to 0 before reading the file helps
https://github.com/tsoding/ded/blob/983c71135214353f6c6b7544ea112cd3afd696a9/src/common.c#L105
Note there is a PR with a working windows build (both local and CI) if you're interested #42
I am having the same issue as OP. I tried memset(sb, 0, size) before line 105 but I just get a crash. C isn't really my strength. Any thoughts on how to fix the shader compile error or am I just memsetting wrong?
Hi maybe you memset to early? I have it on line 109 and that seems to work https://github.com/tsoding/ded/pull/42/files#diff-f6c5883a603e481644b9ef028b158acace9eabf59598f164dbec7b97d8da231fL109
Hi maybe you memset to early? I have it on line 109 and that seems to work https://github.com/tsoding/ded/pull/42/files#diff-f6c5883a603e481644b9ef028b158acace9eabf59598f164dbec7b97d8da231fL109
That made it start working for me. I was memsetting the entire var, not just the items. Thanks!
GL version 3.3 GL CALLBACK: type = 0x8251, severity = 0x826b, message = Buffer detailed info: Buffer object 1 (bound to GL_ARRAY_BUFFER_ARB, usage hint is GL_STATIC_DRAW) will use VIDEO memory as the source for buffer object operations. ERROR: could not compile GL_VERTEX_SHADER 0(28) : error C0000: syntax error, unexpected $undefined at token ""
ERROR: failed to compile
./shaders/free_glyph.vert
shader file