GPU: Fix invalid rectangle passed to glScissor
This commit is contained in:
parent
c2baa7e834
commit
431313156a
|
@ -141,10 +141,10 @@ void GPU_HW::LoadVertices(RenderCommand rc, u32 num_vertices)
|
||||||
|
|
||||||
void GPU_HW::CalcScissorRect(int* left, int* top, int* right, int* bottom)
|
void GPU_HW::CalcScissorRect(int* left, int* top, int* right, int* bottom)
|
||||||
{
|
{
|
||||||
*left = m_drawing_area.left * s32(m_resolution_scale);
|
*left = m_drawing_area.left * m_resolution_scale;
|
||||||
*right = (m_drawing_area.right + 1) * s32(m_resolution_scale);
|
*right = std::max<u32>((m_drawing_area.right + 1) * m_resolution_scale, *left + 1);
|
||||||
*top = m_drawing_area.top * s32(m_resolution_scale);
|
*top = m_drawing_area.top * m_resolution_scale;
|
||||||
*bottom = (m_drawing_area.bottom + 1) * s32(m_resolution_scale);
|
*bottom = std::max<u32>((m_drawing_area.bottom + 1) * m_resolution_scale, *top + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DefineMacro(std::stringstream& ss, const char* name, bool enabled)
|
static void DefineMacro(std::stringstream& ss, const char* name, bool enabled)
|
||||||
|
|
|
@ -396,10 +396,11 @@ void GPU_HW_OpenGL::SetDrawState()
|
||||||
glBlendFuncSeparate(GL_ONE, GL_SRC_ALPHA, GL_ONE, GL_ZERO);
|
glBlendFuncSeparate(GL_ONE, GL_SRC_ALPHA, GL_ONE, GL_ZERO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void GPU_HW_OpenGL::UpdateDrawingArea()
|
if (m_drawing_area_changed)
|
||||||
{
|
{
|
||||||
|
m_drawing_area_changed = false;
|
||||||
|
|
||||||
int left, top, right, bottom;
|
int left, top, right, bottom;
|
||||||
CalcScissorRect(&left, &top, &right, &bottom);
|
CalcScissorRect(&left, &top, &right, &bottom);
|
||||||
|
|
||||||
|
@ -411,6 +412,12 @@ void GPU_HW_OpenGL::UpdateDrawingArea()
|
||||||
Log_DebugPrintf("SetScissor: (%d-%d, %d-%d)", x, x + width, y, y + height);
|
Log_DebugPrintf("SetScissor: (%d-%d, %d-%d)", x, x + width, y, y + height);
|
||||||
glScissor(x, y, width, height);
|
glScissor(x, y, width, height);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GPU_HW_OpenGL::UpdateDrawingArea()
|
||||||
|
{
|
||||||
|
m_drawing_area_changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
void GPU_HW_OpenGL::UpdateDisplay()
|
void GPU_HW_OpenGL::UpdateDisplay()
|
||||||
{
|
{
|
||||||
|
|
|
@ -73,6 +73,7 @@ private:
|
||||||
bool m_vram_read_texture_dirty = true;
|
bool m_vram_read_texture_dirty = true;
|
||||||
bool m_last_transparency_enable = false;
|
bool m_last_transparency_enable = false;
|
||||||
TransparencyMode m_last_transparency_mode = TransparencyMode::BackgroundMinusForeground;
|
TransparencyMode m_last_transparency_mode = TransparencyMode::BackgroundMinusForeground;
|
||||||
|
bool m_drawing_area_changed = true;
|
||||||
|
|
||||||
std::array<std::array<std::array<std::array<GL::Program, 2>, 3>, 2>, 2> m_render_programs;
|
std::array<std::array<std::array<std::array<GL::Program, 2>, 3>, 2>, 2> m_render_programs;
|
||||||
GL::Program m_reinterpret_rgb8_program;
|
GL::Program m_reinterpret_rgb8_program;
|
||||||
|
|
|
@ -98,12 +98,14 @@ bool SDLInterface::CreateGLContext()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (GLAD_GL_KHR_debug)
|
if (GLAD_GL_KHR_debug)
|
||||||
{
|
{
|
||||||
glad_glDebugMessageCallbackKHR(GLDebugCallback, nullptr);
|
glad_glDebugMessageCallbackKHR(GLDebugCallback, nullptr);
|
||||||
// glEnable(GL_DEBUG_OUTPUT);
|
glEnable(GL_DEBUG_OUTPUT);
|
||||||
// glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
SDL_GL_SetSwapInterval(0);
|
SDL_GL_SetSwapInterval(0);
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue