Avoid trying to setup uniform for invalid locations
This commit is contained in:
parent
39f9045703
commit
73234d2a28
27
src/rcore.c
27
src/rcore.c
@ -2525,25 +2525,34 @@ void SetShaderValue(Shader shader, int locIndex, const void *value, int uniformT
|
||||
// Set shader uniform value vector
|
||||
void SetShaderValueV(Shader shader, int locIndex, const void *value, int uniformType, int count)
|
||||
{
|
||||
rlEnableShader(shader.id);
|
||||
rlSetUniform(locIndex, value, uniformType, count);
|
||||
//rlDisableShader(); // Avoid reseting current shader program, in case other uniforms are set
|
||||
if (locIndex > -1)
|
||||
{
|
||||
rlEnableShader(shader.id);
|
||||
rlSetUniform(locIndex, value, uniformType, count);
|
||||
//rlDisableShader(); // Avoid reseting current shader program, in case other uniforms are set
|
||||
}
|
||||
}
|
||||
|
||||
// Set shader uniform value (matrix 4x4)
|
||||
void SetShaderValueMatrix(Shader shader, int locIndex, Matrix mat)
|
||||
{
|
||||
rlEnableShader(shader.id);
|
||||
rlSetUniformMatrix(locIndex, mat);
|
||||
//rlDisableShader();
|
||||
if (locIndex > -1)
|
||||
{
|
||||
rlEnableShader(shader.id);
|
||||
rlSetUniformMatrix(locIndex, mat);
|
||||
//rlDisableShader();
|
||||
}
|
||||
}
|
||||
|
||||
// Set shader uniform value for texture
|
||||
void SetShaderValueTexture(Shader shader, int locIndex, Texture2D texture)
|
||||
{
|
||||
rlEnableShader(shader.id);
|
||||
rlSetUniformSampler(locIndex, texture.id);
|
||||
//rlDisableShader();
|
||||
if (locIndex > -1)
|
||||
{
|
||||
rlEnableShader(shader.id);
|
||||
rlSetUniformSampler(locIndex, texture.id);
|
||||
//rlDisableShader();
|
||||
}
|
||||
}
|
||||
|
||||
// Get a ray trace from mouse position
|
||||
|
Loading…
Reference in New Issue
Block a user