swap() by blitting
This commit is contained in:
parent
ecedf56eb4
commit
363ffd3a5f
|
@ -57,7 +57,7 @@ void OpenGL_ReportARBProgramError();
|
||||||
GLuint OpenGL_ReportGLError(const char *function, const char *file, int line);
|
GLuint OpenGL_ReportGLError(const char *function, const char *file, int line);
|
||||||
bool OpenGL_ReportFBOError(const char *function, const char *file, int line);
|
bool OpenGL_ReportFBOError(const char *function, const char *file, int line);
|
||||||
|
|
||||||
#if defined(_DEBUG) || defined(DEBUGFAST) || 1
|
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||||
#define GL_REPORT_ERROR() OpenGL_ReportGLError(__FUNCTION__, __FILE__, __LINE__)
|
#define GL_REPORT_ERROR() OpenGL_ReportGLError(__FUNCTION__, __FILE__, __LINE__)
|
||||||
#define GL_REPORT_ERRORD() OpenGL_ReportGLError(__FUNCTION__, __FILE__, __LINE__)
|
#define GL_REPORT_ERRORD() OpenGL_ReportGLError(__FUNCTION__, __FILE__, __LINE__)
|
||||||
#define GL_REPORT_FBO_ERROR() OpenGL_ReportFBOError(__FUNCTION__, __FILE__, __LINE__)
|
#define GL_REPORT_FBO_ERROR() OpenGL_ReportFBOError(__FUNCTION__, __FILE__, __LINE__)
|
||||||
|
|
|
@ -1254,50 +1254,58 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TargetRectangle targetRc = ConvertEFBRectangle(rc);
|
TargetRectangle targetRc = ConvertEFBRectangle(rc);
|
||||||
GLuint read_texture = FramebufferManager::ResolveAndGetRenderTarget(rc);
|
if(applyShader) {
|
||||||
// Render to the real buffer now.
|
GLuint read_texture = FramebufferManager::ResolveAndGetRenderTarget(rc);
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, 0); // switch to the window backbuffer
|
// Render to the real buffer now.
|
||||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, read_texture);
|
glBindFramebuffer(GL_FRAMEBUFFER, 0); // switch to the window backbuffer
|
||||||
|
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, read_texture);
|
||||||
|
|
||||||
if(!( s_cached_targetRc == targetRc)) {
|
if(!( s_cached_targetRc == targetRc)) {
|
||||||
GLfloat vertices[] = {
|
GLfloat vertices[] = {
|
||||||
-1.0f, -1.0f, 1.0f,
|
-1.0f, -1.0f, 1.0f,
|
||||||
(GLfloat)targetRc.left, (GLfloat)targetRc.bottom,
|
(GLfloat)targetRc.left, (GLfloat)targetRc.bottom,
|
||||||
0.0f, 0.0f,
|
0.0f, 0.0f,
|
||||||
|
|
||||||
|
-1.0f, 1.0f, 1.0f,
|
||||||
|
(GLfloat)targetRc.left, (GLfloat)targetRc.top,
|
||||||
|
0.0f, 1.0f,
|
||||||
|
|
||||||
|
1.0f, 1.0f, 1.0f,
|
||||||
|
(GLfloat)targetRc.right, (GLfloat)targetRc.top,
|
||||||
|
1.0f, 1.0f,
|
||||||
|
|
||||||
|
1.0f, -1.0f, 1.0f,
|
||||||
|
(GLfloat)targetRc.right, (GLfloat)targetRc.bottom,
|
||||||
|
1.0f, 0.0f
|
||||||
|
};
|
||||||
|
|
||||||
-1.0f, 1.0f, 1.0f,
|
glBindBuffer(GL_ARRAY_BUFFER, s_Swap_VBO);
|
||||||
(GLfloat)targetRc.left, (GLfloat)targetRc.top,
|
glBufferData(GL_ARRAY_BUFFER, 4*7*sizeof(GLfloat), vertices, GL_STREAM_DRAW);
|
||||||
0.0f, 1.0f,
|
|
||||||
|
|
||||||
1.0f, 1.0f, 1.0f,
|
|
||||||
(GLfloat)targetRc.right, (GLfloat)targetRc.top,
|
|
||||||
1.0f, 1.0f,
|
|
||||||
|
|
||||||
1.0f, -1.0f, 1.0f,
|
|
||||||
(GLfloat)targetRc.right, (GLfloat)targetRc.bottom,
|
|
||||||
1.0f, 0.0f
|
|
||||||
};
|
|
||||||
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, s_Swap_VBO);
|
s_cached_targetRc = targetRc;
|
||||||
glBufferData(GL_ARRAY_BUFFER, 4*7*sizeof(GLfloat), vertices, GL_STREAM_DRAW);
|
}
|
||||||
|
|
||||||
s_cached_targetRc = targetRc;
|
glBindVertexArray(s_Swap_VAO[applyShader]);
|
||||||
}
|
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
|
|
||||||
glBindVertexArray(s_Swap_VAO[applyShader]);
|
|
||||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: this after merging with graphic_update
|
// TODO: this after merging with graphic_update
|
||||||
glBindVertexArray(0);
|
glBindVertexArray(0);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
|
|
||||||
if(applyShader)
|
|
||||||
PixelShaderCache::DisableShader();
|
PixelShaderCache::DisableShader();
|
||||||
|
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
|
||||||
|
OGL::TextureCache::DisableStage(0);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||||
|
glBindFramebuffer(GL_READ_FRAMEBUFFER, FramebufferManager::GetEFBFramebuffer());
|
||||||
|
glBlitFramebuffer(targetRc.left, targetRc.bottom, targetRc.right, targetRc.top,
|
||||||
|
flipped_trc.left, flipped_trc.bottom, flipped_trc.right, flipped_trc.top,
|
||||||
|
GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
|
|
||||||
OGL::TextureCache::DisableStage(0);
|
|
||||||
|
|
||||||
// Save screenshot
|
// Save screenshot
|
||||||
if (s_bScreenshot)
|
if (s_bScreenshot)
|
||||||
|
|
Loading…
Reference in New Issue