diff options
| author | Ray <[email protected]> | 2022-10-05 13:34:19 +0200 |
|---|---|---|
| committer | Ray <[email protected]> | 2022-10-05 13:34:19 +0200 |
| commit | 25d846aa9aeb195ebe1128174ff30a7d5396ed32 (patch) | |
| tree | 56a02df87e265001f2a25a06534ecda2322a930c /src | |
| parent | 9017be32596c1ac3847e04e750fcd482d3b2d9fc (diff) | |
| download | raylib-25d846aa9aeb195ebe1128174ff30a7d5396ed32.tar.gz raylib-25d846aa9aeb195ebe1128174ff30a7d5396ed32.zip | |
Avoid early return calls
Diffstat (limited to 'src')
| -rw-r--r-- | src/rlgl.h | 56 |
1 files changed, 29 insertions, 27 deletions
@@ -1832,41 +1832,43 @@ void rlSetBlendMode(int mode) #endif } -// Set blending mode factor and equation used by glBlendFuncSeparate and glBlendEquationSeparate -void rlSetBlendFactorsSeparate(int glSrcRGB, int glDstRGB, int glSrcAlpha, int glDstAlpha, int glEqRGB, int glEqAlpha) +// Set blending mode factor and equation +void rlSetBlendFactors(int glSrcFactor, int glDstFactor, int glEquation) { #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) - if ((RLGL.State.glBlendSrcFactorRGB == glSrcRGB) && - (RLGL.State.glBlendDestFactorRGB == glDstRGB) && - (RLGL.State.glBlendSrcFactorAlpha == glSrcAlpha) && - (RLGL.State.glBlendDestFactorAlpha == glDstAlpha) && - (RLGL.State.glBlendEquationRGB == glEqRGB) && - (RLGL.State.glBlendEquationAlpha == glEqAlpha)) return; + if ((RLGL.State.glBlendSrcFactor != glSrcFactor) || + (RLGL.State.glBlendDstFactor != glDstFactor) || + (RLGL.State.glBlendEquation != glEquation)) + { + RLGL.State.glBlendSrcFactor = glSrcFactor; + RLGL.State.glBlendDstFactor = glDstFactor; + RLGL.State.glBlendEquation = glEquation; - RLGL.State.glBlendSrcFactorRGB = glSrcRGB; - RLGL.State.glBlendDestFactorRGB = glDstRGB; - RLGL.State.glBlendSrcFactorAlpha = glSrcAlpha; - RLGL.State.glBlendDestFactorAlpha = glDstAlpha; - RLGL.State.glBlendEquationRGB = glEqRGB; - RLGL.State.glBlendEquationAlpha = glEqAlpha; - - RLGL.State.glCustomBlendModeModified = true; + RLGL.State.glCustomBlendModeModified = true; + } #endif } -// Set blending mode factor and equation -void rlSetBlendFactors(int glSrcFactor, int glDstFactor, int glEquation) +// Set blending mode factor and equation separately for RGB and alpha +void rlSetBlendFactorsSeparate(int glSrcRGB, int glDstRGB, int glSrcAlpha, int glDstAlpha, int glEqRGB, int glEqAlpha) { #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) - if ((RLGL.State.glBlendSrcFactor == glSrcFactor) && - (RLGL.State.glBlendDstFactor == glDstFactor) && - (RLGL.State.glBlendEquation == glEquation)) return; - - RLGL.State.glBlendSrcFactor = glSrcFactor; - RLGL.State.glBlendDstFactor = glDstFactor; - RLGL.State.glBlendEquation = glEquation; - - RLGL.State.glCustomBlendModeModified = true; + if ((RLGL.State.glBlendSrcFactorRGB != glSrcRGB) || + (RLGL.State.glBlendDestFactorRGB != glDstRGB) || + (RLGL.State.glBlendSrcFactorAlpha != glSrcAlpha) || + (RLGL.State.glBlendDestFactorAlpha != glDstAlpha) || + (RLGL.State.glBlendEquationRGB != glEqRGB) || + (RLGL.State.glBlendEquationAlpha != glEqAlpha)) + { + RLGL.State.glBlendSrcFactorRGB = glSrcRGB; + RLGL.State.glBlendDestFactorRGB = glDstRGB; + RLGL.State.glBlendSrcFactorAlpha = glSrcAlpha; + RLGL.State.glBlendDestFactorAlpha = glDstAlpha; + RLGL.State.glBlendEquationRGB = glEqRGB; + RLGL.State.glBlendEquationAlpha = glEqAlpha; + + RLGL.State.glCustomBlendModeModified = true; + } #endif } |
