Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore rlLoadShaderCode behavour #2281

Merged
merged 1 commit into from
Jan 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/rlgl.h
Original file line number Diff line number Diff line change
Expand Up @@ -3544,8 +3544,16 @@ unsigned int rlLoadShaderCode(const char *vsCode, const char *fsCode)
unsigned int vertexShaderId = 0;
unsigned int fragmentShaderId = 0;

if (vsCode != NULL) vertexShaderId = rlCompileShader(vsCode, GL_VERTEX_SHADER);
if (fsCode != NULL) fragmentShaderId = rlCompileShader(fsCode, GL_FRAGMENT_SHADER);
if (vsCode != NULL) {
vertexShaderId = rlCompileShader(vsCode, GL_VERTEX_SHADER);
} else {
vertexShaderId = RLGL.State.defaultVShaderId;
}
if (fsCode != NULL) {
fragmentShaderId = rlCompileShader(fsCode, GL_FRAGMENT_SHADER);
} else {
fragmentShaderId = RLGL.State.defaultFShaderId;
}

// Load shader program if provided vertex/fragment shaders compile successfully
if ((vertexShaderId != 0) && (fragmentShaderId != 0)) id = rlLoadShaderProgram(vertexShaderId, fragmentShaderId);
Expand Down