Implement rlSetBlendMode/rlSetBlendFactors for GRAPHICS_API_OPENGL_11 - #19
Open
gingerbeardman wants to merge 1 commit into
Open
Conversation
Both functions were gated behind OPENGL_33/ES2 and compiled to empty bodies on the OpenGL 1.1 path, so BeginBlendMode()/EndBlendMode() were silent no-ops on PLATFORM_DREAMCAST - every draw stayed at the init-time glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA). Adds a GL 1.1 arm that programs blend factors with plain glBlendFunc(). Blend state is tracked in small file-scope statics because the RLGL state-shadow global is only compiled for 3.3/ES2. The blend equation is not programmed: GLdc (the Dreamcast GL driver) exposes no glBlendEquation and the PVR is FUNC_ADD-only, so RL_BLEND_SUBTRACT_COLORS and RL_BLEND_CUSTOM_SEPARATE remain unsupported on this path. rlSetBlendFactors() stores factors and marks them modified, applied on the next BeginBlendMode(RL_BLEND_CUSTOM), matching the 3.3/ES2 contract. Verified on PLATFORM_DREAMCAST under Flycast: ALPHA, ADDITIVE, MULTIPLIED, CUSTOM (screen: GL_ONE, GL_ONE_MINUS_SRC_COLOR), and blend-disabled rendering all behave correctly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
rlSetBlendMode()andrlSetBlendFactors()are gated behindOPENGL_33/ES2and compile to empty bodies on the OpenGL 1.1 path — so onPLATFORM_DREAMCAST,BeginBlendMode()/EndBlendMode()are silent no-ops and every draw is stuck at the init-timeglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA).This adds a GL 1.1 arm to both functions:
glBlendFunc(); state is tracked in file-scope statics since theRLGLstate-shadow global is only compiled for 3.3/ES2.glBlendEquationand the PVR is FUNC_ADD-only.RL_BLEND_SUBTRACT_COLORS/RL_BLEND_CUSTOM_SEPARATEremain unsupported on this path.rlSetBlendFactors()stores factors and marks them modified; they apply on the nextBeginBlendMode(RL_BLEND_CUSTOM)— same contract as the 3.3/ES2 path.Verified on
PLATFORM_DREAMCASTunder Flycast with an overlapping-shapes test: ALPHA, ADDITIVE, MULTIPLIED, CUSTOM (screen viaGL_ONE, GL_ONE_MINUS_SRC_COLOR), and blending-disabled all render correctly. Happy to attach the verification screenshot.