Fixed LogicOp Blending and Dithering support enabled.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2249 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
71d9832004
commit
72cf7a5a42
|
@ -45,8 +45,8 @@ static const GLenum glCmpFuncs[8] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const GLenum glLogicOpCodes[16] = {
|
static const GLenum glLogicOpCodes[16] = {
|
||||||
GL_CLEAR, GL_SET, GL_COPY, GL_COPY_INVERTED, GL_NOOP, GL_INVERT, GL_AND, GL_NAND,
|
GL_CLEAR, GL_AND, GL_AND_REVERSE, GL_COPY, GL_AND_INVERTED, GL_NOOP, GL_XOR,
|
||||||
GL_OR, GL_NOR, GL_XOR, GL_EQUIV, GL_AND_REVERSE, GL_AND_INVERTED, GL_OR_REVERSE, GL_OR_INVERTED
|
GL_OR, GL_NOR, GL_EQUIV, GL_INVERT, GL_OR_REVERSE, GL_COPY_INVERTED, GL_OR_INVERTED, GL_NAND, GL_SET
|
||||||
};
|
};
|
||||||
|
|
||||||
void BPInit()
|
void BPInit()
|
||||||
|
@ -173,68 +173,49 @@ void BPWritten(int addr, int changes, int newval)
|
||||||
|
|
||||||
VertexManager::Flush();
|
VertexManager::Flush();
|
||||||
((u32*)&bpmem)[addr] = newval;
|
((u32*)&bpmem)[addr] = newval;
|
||||||
|
|
||||||
PRIM_LOG("blendmode: en=%d, open=%d, colupd=%d, alphaupd=%d, dst=%d, src=%d, sub=%d, mode=%d\n",
|
PRIM_LOG("blendmode: en=%d, open=%d, colupd=%d, alphaupd=%d, dst=%d, src=%d, sub=%d, mode=%d\n",
|
||||||
bpmem.blendmode.blendenable, bpmem.blendmode.logicopenable, bpmem.blendmode.colorupdate, bpmem.blendmode.alphaupdate,
|
bpmem.blendmode.blendenable, bpmem.blendmode.logicopenable, bpmem.blendmode.colorupdate, bpmem.blendmode.alphaupdate,
|
||||||
bpmem.blendmode.dstfactor, bpmem.blendmode.srcfactor, bpmem.blendmode.subtract, bpmem.blendmode.logicmode);
|
bpmem.blendmode.dstfactor, bpmem.blendmode.srcfactor, bpmem.blendmode.subtract, bpmem.blendmode.logicmode);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Logic Operation Blend Modes
|
||||||
|
--------------------
|
||||||
|
0: GL_CLEAR
|
||||||
|
1: GL_AND
|
||||||
|
2: GL_AND_REVERSE
|
||||||
|
3: GL_COPY [Super Smash. Bro. Melee, NES Zelda I, NES Zelda II]
|
||||||
|
4: GL_AND_INVERTED
|
||||||
|
5: GL_NOOP
|
||||||
|
6: GL_XOR
|
||||||
|
7: GL_OR [Zelda: TP]
|
||||||
|
8: GL_NOR
|
||||||
|
9: GL_EQUIV
|
||||||
|
10: GL_INVERT
|
||||||
|
11: GL_OR_REVERSE
|
||||||
|
12: GL_COPY_INVERTED
|
||||||
|
13: GL_OR_INVERTED
|
||||||
|
14: GL_NAND
|
||||||
|
15: GL_SET
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Do LogicOp Blending
|
||||||
if (changes & 2) {
|
if (changes & 2) {
|
||||||
if (Renderer::CanBlendLogicOp()) {
|
if (bpmem.blendmode.logicopenable)
|
||||||
if (bpmem.blendmode.logicopenable) {
|
{
|
||||||
glEnable(GL_COLOR_LOGIC_OP);
|
glEnable(GL_COLOR_LOGIC_OP);
|
||||||
PanicAlert("Logic Op Blend : %i", bpmem.blendmode.logicmode);
|
// PanicAlert("Logic Op Blend : %i", bpmem.blendmode.logicmode);
|
||||||
glLogicOp(glLogicOpCodes[bpmem.blendmode.logicmode]);
|
glLogicOp(glLogicOpCodes[bpmem.blendmode.logicmode]);
|
||||||
}
|
}
|
||||||
else glDisable(GL_COLOR_LOGIC_OP);
|
else
|
||||||
|
glDisable(GL_COLOR_LOGIC_OP);
|
||||||
}
|
}
|
||||||
//else {
|
|
||||||
// if (bpmem.blendmode.logicopenable) {
|
|
||||||
// switch(bpmem.blendmode.logicmode) {
|
|
||||||
// case 0: // clear dst to 0
|
|
||||||
// glEnable(GL_BLEND);
|
|
||||||
// glBlendFunc(GL_ZERO, GL_ZERO);
|
|
||||||
// break;
|
|
||||||
// case 1: // set dst to 1
|
|
||||||
// glEnable(GL_BLEND);
|
|
||||||
// glBlendFunc(GL_ONE, GL_ONE);
|
|
||||||
// break;
|
|
||||||
// case 2: // set dst to src
|
|
||||||
// glDisable(GL_BLEND);
|
|
||||||
// break;
|
|
||||||
// case 3: // set dst to ~src
|
|
||||||
// glEnable(GL_BLEND);
|
|
||||||
// glBlendFunc(GL_ONE_MINUS_SRC_COLOR, GL_ZERO); //?
|
|
||||||
// break;
|
|
||||||
// case 4: // set dst to dst
|
|
||||||
// glEnable(GL_BLEND);
|
|
||||||
// glBlendFunc(GL_ZERO, GL_ONE); //?
|
|
||||||
// break;
|
|
||||||
// case 5: // set dst to ~dst
|
|
||||||
// glEnable(GL_BLEND);
|
|
||||||
// glBlendFunc(GL_ZERO, GL_ONE_MINUS_DST_COLOR); //?
|
|
||||||
// break;
|
|
||||||
// case 6: // set dst to src&dst
|
|
||||||
// case 7: // set dst to ~(src&dst)
|
|
||||||
// case 8: // set dst to src|dst
|
|
||||||
// case 9: // set dst to ~(src|dst)
|
|
||||||
// case 10: // set dst to src xor dst
|
|
||||||
// case 11: // set dst to ~(src xor dst)
|
|
||||||
// case 12: // set dst to src&~dst
|
|
||||||
// case 13: // set dst to ~src&dst
|
|
||||||
// case 14: // set dst to src|~dst
|
|
||||||
// case 15: // set dst to ~src|dst
|
|
||||||
// ERROR_LOG("logicopenable %d not supported\n", bpmem.blendmode.logicmode);
|
|
||||||
// break;
|
|
||||||
|
|
||||||
// }
|
if (changes & 4) {
|
||||||
// }
|
if (bpmem.blendmode.dither) glEnable(GL_DITHER);
|
||||||
//}
|
else glDisable(GL_DITHER);
|
||||||
}
|
}
|
||||||
/*if (changes & 4) {
|
|
||||||
// pointless
|
|
||||||
//if (bpmem.blendmode.dither) glEnable(GL_DITHER);
|
|
||||||
//else glDisable(GL_DITHER);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (changes & 0xFE1)
|
if (changes & 0xFE1)
|
||||||
Renderer::SetBlendMode(false);
|
Renderer::SetBlendMode(false);
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,6 @@ static bool s_bATIDrawBuffers = false;
|
||||||
static bool s_bHaveStencilBuffer = false;
|
static bool s_bHaveStencilBuffer = false;
|
||||||
|
|
||||||
static Renderer::RenderMode s_RenderMode = Renderer::RM_Normal;
|
static Renderer::RenderMode s_RenderMode = Renderer::RM_Normal;
|
||||||
bool g_bBlendLogicOp = false;
|
|
||||||
bool g_bBlendSeparate = false;
|
bool g_bBlendSeparate = false;
|
||||||
int frameCount;
|
int frameCount;
|
||||||
|
|
||||||
|
@ -134,8 +133,6 @@ bool Renderer::Init()
|
||||||
INFO_LOG(ptoken); // write to the log file
|
INFO_LOG(ptoken); // write to the log file
|
||||||
INFO_LOG("\n");
|
INFO_LOG("\n");
|
||||||
|
|
||||||
if (strstr(ptoken, "GL_EXT_blend_logic_op") != NULL)
|
|
||||||
g_bBlendLogicOp = true;
|
|
||||||
if (strstr(ptoken, "GL_EXT_blend_func_separate") != NULL && strstr(ptoken, "GL_EXT_blend_equation_separate") != NULL)
|
if (strstr(ptoken, "GL_EXT_blend_func_separate") != NULL && strstr(ptoken, "GL_EXT_blend_equation_separate") != NULL)
|
||||||
g_bBlendSeparate = true;
|
g_bBlendSeparate = true;
|
||||||
if (strstr(ptoken, "ATI_draw_buffers") != NULL && strstr(ptoken, "ARB_draw_buffers") == NULL)
|
if (strstr(ptoken, "ATI_draw_buffers") != NULL && strstr(ptoken, "ARB_draw_buffers") == NULL)
|
||||||
|
@ -340,7 +337,6 @@ bool Renderer::Init()
|
||||||
XFB_Init();
|
XFB_Init();
|
||||||
return glGetError() == GL_NO_ERROR && bSuccess;
|
return glGetError() == GL_NO_ERROR && bSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::Shutdown(void)
|
void Renderer::Shutdown(void)
|
||||||
{
|
{
|
||||||
delete s_pfont;
|
delete s_pfont;
|
||||||
|
@ -515,12 +511,6 @@ int Renderer::GetTargetHeight()
|
||||||
{
|
{
|
||||||
return (g_Config.bStretchToFit ? 480 : (int)OpenGL_GetHeight());
|
return (g_Config.bStretchToFit ? 480 : (int)OpenGL_GetHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Renderer::CanBlendLogicOp()
|
|
||||||
{
|
|
||||||
return g_bBlendLogicOp;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Renderer::SetRenderTarget(GLuint targ)
|
void Renderer::SetRenderTarget(GLuint targ)
|
||||||
{
|
{
|
||||||
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_ARB,
|
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_ARB,
|
||||||
|
@ -543,7 +533,6 @@ GLuint Renderer::GetRenderTarget()
|
||||||
{
|
{
|
||||||
return s_RenderTarget;
|
return s_RenderTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint Renderer::GetZBufferTarget()
|
GLuint Renderer::GetZBufferTarget()
|
||||||
{
|
{
|
||||||
return nZBufferRender > 0 ? s_ZBufferTarget : 0;
|
return nZBufferRender > 0 ? s_ZBufferTarget : 0;
|
||||||
|
|
|
@ -104,7 +104,6 @@ public:
|
||||||
|
|
||||||
static int GetTargetWidth();
|
static int GetTargetWidth();
|
||||||
static int GetTargetHeight();
|
static int GetTargetHeight();
|
||||||
static bool CanBlendLogicOp();
|
|
||||||
static void SetCgErrorOutput(bool bOutput);
|
static void SetCgErrorOutput(bool bOutput);
|
||||||
|
|
||||||
static void ResetGLState();
|
static void ResetGLState();
|
||||||
|
|
Loading…
Reference in New Issue