mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-03-23 21:55:12 +00:00
Support MIN/MAX blend on OpenGL + ES
This commit is contained in:
parent
ea179abdb7
commit
9670f233cc
|
@ -375,6 +375,10 @@ static GLenum GetBlendEquation(SDL_BlendOperation operation)
|
||||||
return GL_FUNC_SUBTRACT;
|
return GL_FUNC_SUBTRACT;
|
||||||
case SDL_BLENDOPERATION_REV_SUBTRACT:
|
case SDL_BLENDOPERATION_REV_SUBTRACT:
|
||||||
return GL_FUNC_REVERSE_SUBTRACT;
|
return GL_FUNC_REVERSE_SUBTRACT;
|
||||||
|
case SDL_BLENDOPERATION_MINIMUM:
|
||||||
|
return GL_MIN;
|
||||||
|
case SDL_BLENDOPERATION_MAXIMUM:
|
||||||
|
return GL_MAX;
|
||||||
default:
|
default:
|
||||||
return GL_INVALID_ENUM;
|
return GL_INVALID_ENUM;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,6 +97,7 @@ typedef struct
|
||||||
SDL_bool GL_OES_blend_func_separate_supported;
|
SDL_bool GL_OES_blend_func_separate_supported;
|
||||||
SDL_bool GL_OES_blend_equation_separate_supported;
|
SDL_bool GL_OES_blend_equation_separate_supported;
|
||||||
SDL_bool GL_OES_blend_subtract_supported;
|
SDL_bool GL_OES_blend_subtract_supported;
|
||||||
|
SDL_bool GL_EXT_blend_minmax_supported;
|
||||||
|
|
||||||
GLES_DrawStateCache drawstate;
|
GLES_DrawStateCache drawstate;
|
||||||
} GLES_RenderData;
|
} GLES_RenderData;
|
||||||
|
@ -263,6 +264,10 @@ static GLenum GetBlendEquation(SDL_BlendOperation operation)
|
||||||
return GL_FUNC_SUBTRACT_OES;
|
return GL_FUNC_SUBTRACT_OES;
|
||||||
case SDL_BLENDOPERATION_REV_SUBTRACT:
|
case SDL_BLENDOPERATION_REV_SUBTRACT:
|
||||||
return GL_FUNC_REVERSE_SUBTRACT_OES;
|
return GL_FUNC_REVERSE_SUBTRACT_OES;
|
||||||
|
case SDL_BLENDOPERATION_MINIMUM:
|
||||||
|
return GL_MIN_EXT;
|
||||||
|
case SDL_BLENDOPERATION_MAXIMUM:
|
||||||
|
return GL_MAX_EXT;
|
||||||
default:
|
default:
|
||||||
return GL_INVALID_ENUM;
|
return GL_INVALID_ENUM;
|
||||||
}
|
}
|
||||||
|
@ -295,6 +300,12 @@ static SDL_bool GLES_SupportsBlendMode(SDL_Renderer *renderer, SDL_BlendMode ble
|
||||||
if (colorOperation != SDL_BLENDOPERATION_ADD && !data->GL_OES_blend_subtract_supported) {
|
if (colorOperation != SDL_BLENDOPERATION_ADD && !data->GL_OES_blend_subtract_supported) {
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
if (colorOperation == SDL_BLENDOPERATION_MINIMUM && !data->GL_EXT_blend_minmax_supported) {
|
||||||
|
return SDL_FALSE;
|
||||||
|
}
|
||||||
|
if (colorOperation == SDL_BLENDOPERATION_MAXIMUM && !data->GL_EXT_blend_minmax_supported) {
|
||||||
|
return SDL_FALSE;
|
||||||
|
}
|
||||||
return SDL_TRUE;
|
return SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1161,6 +1172,9 @@ static SDL_Renderer *GLES_CreateRenderer(SDL_Window *window, Uint32 flags)
|
||||||
if (SDL_GL_ExtensionSupported("GL_OES_blend_subtract")) {
|
if (SDL_GL_ExtensionSupported("GL_OES_blend_subtract")) {
|
||||||
data->GL_OES_blend_subtract_supported = SDL_TRUE;
|
data->GL_OES_blend_subtract_supported = SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
if (SDL_GL_ExtensionSupported("GL_EXT_blend_minmax")) {
|
||||||
|
data->GL_EXT_blend_minmax_supported = SDL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Set up parameters for rendering */
|
/* Set up parameters for rendering */
|
||||||
data->glDisable(GL_DEPTH_TEST);
|
data->glDisable(GL_DEPTH_TEST);
|
||||||
|
|
Loading…
Reference in a new issue