mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Merge branch 'clearscreen-kill-immediate-mode'
This commit is contained in:
commit
575814895c
@ -595,7 +595,7 @@ void Renderer::RenderText(const char *text, int left, int top, u32 color)
|
|||||||
{
|
{
|
||||||
const int nBackbufferWidth = (int)OpenGL_GetBackbufferWidth();
|
const int nBackbufferWidth = (int)OpenGL_GetBackbufferWidth();
|
||||||
const int nBackbufferHeight = (int)OpenGL_GetBackbufferHeight();
|
const int nBackbufferHeight = (int)OpenGL_GetBackbufferHeight();
|
||||||
|
|
||||||
glColor4f(((color>>16) & 0xff)/255.0f, ((color>> 8) & 0xff)/255.0f,
|
glColor4f(((color>>16) & 0xff)/255.0f, ((color>> 8) & 0xff)/255.0f,
|
||||||
((color>> 0) & 0xff)/255.0f, ((color>>24) & 0xFF)/255.0f);
|
((color>> 0) & 0xff)/255.0f, ((color>>24) & 0xFF)/255.0f);
|
||||||
|
|
||||||
@ -872,39 +872,31 @@ void Renderer::ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaE
|
|||||||
{
|
{
|
||||||
ResetAPIState();
|
ResetAPIState();
|
||||||
|
|
||||||
GLenum ColorMask = GL_FALSE, AlphaMask = GL_FALSE;
|
// color
|
||||||
if (colorEnable) ColorMask = GL_TRUE;
|
GLboolean const
|
||||||
if (alphaEnable) AlphaMask = GL_TRUE;
|
color_mask = colorEnable ? GL_TRUE : GL_FALSE,
|
||||||
glColorMask(ColorMask, ColorMask, ColorMask, AlphaMask);
|
alpha_mask = alphaEnable ? GL_TRUE : GL_FALSE;
|
||||||
|
glColorMask(color_mask, color_mask, color_mask, alpha_mask);
|
||||||
|
|
||||||
if (zEnable)
|
glClearColor(
|
||||||
{
|
float((color >> 16) & 0xFF) / 255.0f,
|
||||||
glEnable(GL_DEPTH_TEST);
|
float((color >> 8) & 0xFF) / 255.0f,
|
||||||
glDepthMask(GL_TRUE);
|
float((color >> 0) & 0xFF) / 255.0f,
|
||||||
glDepthFunc(GL_ALWAYS);
|
float((color >> 24) & 0xFF) / 255.0f);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
|
||||||
glDepthMask(GL_FALSE);
|
|
||||||
glDepthFunc(GL_NEVER);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update viewport for clearing the picture
|
// depth
|
||||||
TargetRectangle targetRc = ConvertEFBRectangle(rc);
|
glDepthMask(zEnable ? GL_TRUE : GL_FALSE);
|
||||||
glViewport(targetRc.left, targetRc.bottom, targetRc.GetWidth(), targetRc.GetHeight());
|
|
||||||
glDepthRange(0.0, (float)(z & 0xFFFFFF) / float(0xFFFFFF));
|
|
||||||
|
|
||||||
glColor4f((float)((color >> 16) & 0xFF) / 255.0f,
|
glClearDepth(float(z & 0xFFFFFF) / float(0xFFFFFF));
|
||||||
(float)((color >> 8) & 0xFF) / 255.0f,
|
|
||||||
(float)(color & 0xFF) / 255.0f,
|
// Update rect for clearing the picture
|
||||||
(float)((color >> 24) & 0xFF) / 255.0f);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
glBegin(GL_QUADS);
|
|
||||||
glVertex3f(-1.f, -1.f, 1.f);
|
TargetRectangle const targetRc = ConvertEFBRectangle(rc);
|
||||||
glVertex3f(-1.f, 1.f, 1.f);
|
glScissor(targetRc.left, targetRc.bottom, targetRc.GetWidth(), targetRc.GetHeight());
|
||||||
glVertex3f( 1.f, 1.f, 1.f);
|
|
||||||
glVertex3f( 1.f, -1.f, 1.f);
|
// glColorMask/glDepthMask/glScissor affect glClear (glViewport does not)
|
||||||
glEnd();
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
RestoreAPIState();
|
RestoreAPIState();
|
||||||
|
|
||||||
@ -1435,9 +1427,6 @@ void Renderer::ResetAPIState()
|
|||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
glDepthMask(GL_FALSE);
|
glDepthMask(GL_FALSE);
|
||||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||||
|
|
||||||
// make sure to disable wireframe when drawing the clear quad
|
|
||||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::RestoreAPIState()
|
void Renderer::RestoreAPIState()
|
||||||
@ -1451,8 +1440,7 @@ void Renderer::RestoreAPIState()
|
|||||||
SetBlendMode(true);
|
SetBlendMode(true);
|
||||||
VertexShaderManager::SetViewportChanged();
|
VertexShaderManager::SetViewportChanged();
|
||||||
|
|
||||||
if (g_ActiveConfig.bWireFrame)
|
glPolygonMode(GL_FRONT_AND_BACK, g_ActiveConfig.bWireFrame ? GL_LINE : GL_FILL);
|
||||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
|
||||||
|
|
||||||
VertexShaderCache::SetCurrentShader(0);
|
VertexShaderCache::SetCurrentShader(0);
|
||||||
PixelShaderCache::SetCurrentShader(0);
|
PixelShaderCache::SetCurrentShader(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user