mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-23 17:35:34 +00:00
Fixed bug 3361 - Texture color modulation doesn't work with active NONE blend mode (opengl and opengles)
Simon Hug The GL_SetBlendMode and GLES_SetBlendMode functions of the opengl and opengles renderers call the glTexEnvf to set the texture env mode to either GL_MODULATE (the default) or GL_REPLACE for the NONE blend mode. Using GL_REPLACE disables color and alpha modulation for textures. These glTexEnv calls were put in the SetBlendMode function back in 2006 [1], but there the NONE code still used the GL_DECAL mode. The GL_REPLACE mode came in 2008 [2]. I'm a bit confused why that wasn't always GL_MODULATE and a bit surprised nobody reported that yet (unless I missed it). I guess only a few use the gles renderer and the newish shaders mask the issue.
This commit is contained in:
parent
3f1b1629c4
commit
a42c396a57
|
@ -1098,21 +1098,17 @@ GL_SetBlendMode(GL_RenderData * data, int blendMode)
|
||||||
if (blendMode != data->current.blendMode) {
|
if (blendMode != data->current.blendMode) {
|
||||||
switch (blendMode) {
|
switch (blendMode) {
|
||||||
case SDL_BLENDMODE_NONE:
|
case SDL_BLENDMODE_NONE:
|
||||||
data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
|
||||||
data->glDisable(GL_BLEND);
|
data->glDisable(GL_BLEND);
|
||||||
break;
|
break;
|
||||||
case SDL_BLENDMODE_BLEND:
|
case SDL_BLENDMODE_BLEND:
|
||||||
data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
|
||||||
data->glEnable(GL_BLEND);
|
data->glEnable(GL_BLEND);
|
||||||
data->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
data->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
break;
|
break;
|
||||||
case SDL_BLENDMODE_ADD:
|
case SDL_BLENDMODE_ADD:
|
||||||
data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
|
||||||
data->glEnable(GL_BLEND);
|
data->glEnable(GL_BLEND);
|
||||||
data->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE, GL_ZERO, GL_ONE);
|
data->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE, GL_ZERO, GL_ONE);
|
||||||
break;
|
break;
|
||||||
case SDL_BLENDMODE_MOD:
|
case SDL_BLENDMODE_MOD:
|
||||||
data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
|
||||||
data->glEnable(GL_BLEND);
|
data->glEnable(GL_BLEND);
|
||||||
data->glBlendFuncSeparate(GL_ZERO, GL_SRC_COLOR, GL_ZERO, GL_ONE);
|
data->glBlendFuncSeparate(GL_ZERO, GL_SRC_COLOR, GL_ZERO, GL_ONE);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -734,11 +734,9 @@ GLES_SetBlendMode(GLES_RenderData * data, int blendMode)
|
||||||
if (blendMode != data->current.blendMode) {
|
if (blendMode != data->current.blendMode) {
|
||||||
switch (blendMode) {
|
switch (blendMode) {
|
||||||
case SDL_BLENDMODE_NONE:
|
case SDL_BLENDMODE_NONE:
|
||||||
data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
|
||||||
data->glDisable(GL_BLEND);
|
data->glDisable(GL_BLEND);
|
||||||
break;
|
break;
|
||||||
case SDL_BLENDMODE_BLEND:
|
case SDL_BLENDMODE_BLEND:
|
||||||
data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
|
||||||
data->glEnable(GL_BLEND);
|
data->glEnable(GL_BLEND);
|
||||||
if (data->GL_OES_blend_func_separate_supported) {
|
if (data->GL_OES_blend_func_separate_supported) {
|
||||||
data->glBlendFuncSeparateOES(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
data->glBlendFuncSeparateOES(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
@ -747,7 +745,6 @@ GLES_SetBlendMode(GLES_RenderData * data, int blendMode)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_BLENDMODE_ADD:
|
case SDL_BLENDMODE_ADD:
|
||||||
data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
|
||||||
data->glEnable(GL_BLEND);
|
data->glEnable(GL_BLEND);
|
||||||
if (data->GL_OES_blend_func_separate_supported) {
|
if (data->GL_OES_blend_func_separate_supported) {
|
||||||
data->glBlendFuncSeparateOES(GL_SRC_ALPHA, GL_ONE, GL_ZERO, GL_ONE);
|
data->glBlendFuncSeparateOES(GL_SRC_ALPHA, GL_ONE, GL_ZERO, GL_ONE);
|
||||||
|
@ -756,7 +753,6 @@ GLES_SetBlendMode(GLES_RenderData * data, int blendMode)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_BLENDMODE_MOD:
|
case SDL_BLENDMODE_MOD:
|
||||||
data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
|
||||||
data->glEnable(GL_BLEND);
|
data->glEnable(GL_BLEND);
|
||||||
if (data->GL_OES_blend_func_separate_supported) {
|
if (data->GL_OES_blend_func_separate_supported) {
|
||||||
data->glBlendFuncSeparateOES(GL_ZERO, GL_SRC_COLOR, GL_ZERO, GL_ONE);
|
data->glBlendFuncSeparateOES(GL_ZERO, GL_SRC_COLOR, GL_ZERO, GL_ONE);
|
||||||
|
|
Loading…
Reference in a new issue