Skip to content

Conversation

@joshuang321
Copy link

Implemented type_of_file for windows and fixed shader bug where it fails to compile on load

Description of bug:
Programs abnormally terminates when it is ran.

Explanation and Solution:
TLDR: Shader is not compiled properly due to garbage values. String is not terminated properly.

File is loaded as a text file, so \r\n gets translated to \n, meaning string count > characters read, leading to glShaderSource reading uninitialized memory on Windows. Also, null was passed to the last argument of glShaderSource meaning the string is read as a null terminated (was supposed to be a counted), fixed by passing String_Builder to pass .count. Still works (unexpectedly), but you shouldn't count the os to give you zeroed out memory (unless you use os specific calls that give you that, eg. VirtualAlloc). Following is a hex dump of both text and binary mode on Windows.

nl

Implemented type_of_file for windows and fixed shader bug when it fails to compile on load
Fixed file opening for 'normal' files in type_of_file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant