diff --git a/GPU/GLES/FBO.cpp b/GPU/GLES/FBO.cpp index d9890fa68a..49ed9ee3ba 100644 --- a/GPU/GLES/FBO.cpp +++ b/GPU/GLES/FBO.cpp @@ -373,23 +373,23 @@ void fbo_copy_image(FBO *src, int srcLevel, int srcX, int srcY, int srcZ, FBO *d #if defined(USING_GLES2) #ifndef IOS glCopyImageSubDataOES( - fbo_get_color_texture(src), GL_TEXTURE_2D, srcLevel, srcX, srcY, srcZ, - fbo_get_color_texture(dst), GL_TEXTURE_2D, dstLevel, dstX, dstY, dstZ, + src->color_texture, GL_TEXTURE_2D, srcLevel, srcX, srcY, srcZ, + dst->color_texture, GL_TEXTURE_2D, dstLevel, dstX, dstY, dstZ, width, height, depth); return; #endif #else if (gl_extensions.ARB_copy_image) { glCopyImageSubData( - fbo_get_color_texture(src), GL_TEXTURE_2D, srcLevel, srcX, srcY, srcZ, - fbo_get_color_texture(dst), GL_TEXTURE_2D, dstLevel, dstX, dstY, dstZ, + src->color_texture, GL_TEXTURE_2D, srcLevel, srcX, srcY, srcZ, + dst->color_texture, GL_TEXTURE_2D, dstLevel, dstX, dstY, dstZ, width, height, depth); return; } else if (gl_extensions.NV_copy_image) { // Older, pre GL 4.x NVIDIA cards. glCopyImageSubDataNV( - fbo_get_color_texture(src), GL_TEXTURE_2D, srcLevel, srcX, srcY, srcZ, - fbo_get_color_texture(dst), GL_TEXTURE_2D, dstLevel, dstX, dstY, dstZ, + src->color_texture, GL_TEXTURE_2D, srcLevel, srcX, srcY, srcZ, + dst->color_texture, GL_TEXTURE_2D, dstLevel, dstX, dstY, dstZ, width, height, depth); return; } @@ -458,15 +458,3 @@ void fbo_get_dimensions(FBO *fbo, int *w, int *h) { *w = fbo->width; *h = fbo->height; } - -int fbo_get_color_texture(FBO *fbo) { - return fbo->color_texture; -} - -int fbo_get_depth_buffer(FBO *fbo) { - return fbo->z_buffer; -} - -int fbo_get_stencil_buffer(FBO *fbo) { - return fbo->stencil_buffer; -} diff --git a/GPU/GLES/FBO.h b/GPU/GLES/FBO.h index a45607f367..f652dcb212 100644 --- a/GPU/GLES/FBO.h +++ b/GPU/GLES/FBO.h @@ -69,7 +69,3 @@ void fbo_unbind(); void fbo_unbind_render_target(); void fbo_destroy(FBO *fbo); void fbo_get_dimensions(FBO *fbo, int *w, int *h); - -int fbo_get_color_texture(FBO *fbo); -int fbo_get_depth_buffer(FBO *fbo); -int fbo_get_stencil_buffer(FBO *fbo); diff --git a/GPU/GLES/FramebufferManagerGLES.cpp b/GPU/GLES/FramebufferManagerGLES.cpp index 1fdf6d4037..2b4c5139f4 100644 --- a/GPU/GLES/FramebufferManagerGLES.cpp +++ b/GPU/GLES/FramebufferManagerGLES.cpp @@ -1014,7 +1014,7 @@ void FramebufferManagerGLES::CopyDisplayToOutput() { DEBUG_LOG(SCEGE, "Displaying FBO %08x", vfb->fb_address); DisableState(); - GLuint colorTexture = fbo_get_color_texture(vfb->fbo); + fbo_bind_color_as_texture(vfb->fbo, 0); int uvRotation = (g_Config.iRenderingMode != FB_NON_BUFFERED_MODE) ? g_Config.iInternalScreenRotation : ROTATION_LOCKED_HORIZONTAL; @@ -1036,15 +1036,15 @@ void FramebufferManagerGLES::CopyDisplayToOutput() { if (cardboardSettings.enabled) { // Left Eye Image glstate.viewport.set(cardboardSettings.leftEyeXPosition, cardboardSettings.screenYPosition, cardboardSettings.screenWidth, cardboardSettings.screenHeight); - DrawActiveTexture(colorTexture, x, y, w, h, (float)pixelWidth_, (float)pixelHeight_, u0, v0, u1, v1, nullptr, ROTATION_LOCKED_HORIZONTAL); + DrawActiveTexture(0, x, y, w, h, (float)pixelWidth_, (float)pixelHeight_, u0, v0, u1, v1, nullptr, ROTATION_LOCKED_HORIZONTAL); // Right Eye Image glstate.viewport.set(cardboardSettings.rightEyeXPosition, cardboardSettings.screenYPosition, cardboardSettings.screenWidth, cardboardSettings.screenHeight); - DrawActiveTexture(colorTexture, x, y, w, h, (float)pixelWidth_, (float)pixelHeight_, u0, v0, u1, v1, nullptr, ROTATION_LOCKED_HORIZONTAL); + DrawActiveTexture(0, x, y, w, h, (float)pixelWidth_, (float)pixelHeight_, u0, v0, u1, v1, nullptr, ROTATION_LOCKED_HORIZONTAL); } else { // Fullscreen Image glstate.viewport.set(0, 0, pixelWidth_, pixelHeight_); - DrawActiveTexture(colorTexture, x, y, w, h, (float)pixelWidth_, (float)pixelHeight_, u0, v0, u1, v1, nullptr, uvRotation); + DrawActiveTexture(0, x, y, w, h, (float)pixelWidth_, (float)pixelHeight_, u0, v0, u1, v1, nullptr, uvRotation); } } else if (usePostShader_ && extraFBOs_.size() == 1 && !postShaderAtOutputResolution_) { // An additional pass, post-processing shader to the extra FBO. @@ -1055,7 +1055,7 @@ void FramebufferManagerGLES::CopyDisplayToOutput() { shaderManager_->DirtyLastShader(); // dirty lastShader_ glsl_bind(postShaderProgram_); UpdatePostShaderUniforms(vfb->bufferWidth, vfb->bufferHeight, renderWidth_, renderHeight_); - DrawActiveTexture(colorTexture, 0, 0, fbo_w, fbo_h, fbo_w, fbo_h, 0.0f, 0.0f, 1.0f, 1.0f, postShaderProgram_, ROTATION_LOCKED_HORIZONTAL); + DrawActiveTexture(0, 0, 0, fbo_w, fbo_h, fbo_w, fbo_h, 0.0f, 0.0f, 1.0f, 1.0f, postShaderProgram_, ROTATION_LOCKED_HORIZONTAL); fbo_unbind(); @@ -1065,7 +1065,7 @@ void FramebufferManagerGLES::CopyDisplayToOutput() { ERROR_LOG(G3D, "WTF?"); return; } - colorTexture = fbo_get_color_texture(extraFBOs_[0]); + fbo_bind_color_as_texture(extraFBOs_[0], 0); // We are doing the DrawActiveTexture call directly to the backbuffer after here. Hence, we must // flip V. @@ -1074,15 +1074,15 @@ void FramebufferManagerGLES::CopyDisplayToOutput() { if (g_Config.bEnableCardboard) { // Left Eye Image glstate.viewport.set(cardboardSettings.leftEyeXPosition, cardboardSettings.screenYPosition, cardboardSettings.screenWidth, cardboardSettings.screenHeight); - DrawActiveTexture(colorTexture, x, y, w, h, (float)pixelWidth_, (float)pixelHeight_, u0, v0, u1, v1, nullptr, ROTATION_LOCKED_HORIZONTAL); + DrawActiveTexture(0, x, y, w, h, (float)pixelWidth_, (float)pixelHeight_, u0, v0, u1, v1, nullptr, ROTATION_LOCKED_HORIZONTAL); // Right Eye Image glstate.viewport.set(cardboardSettings.rightEyeXPosition, cardboardSettings.screenYPosition, cardboardSettings.screenWidth, cardboardSettings.screenHeight); - DrawActiveTexture(colorTexture, x, y, w, h, (float)pixelWidth_, (float)pixelHeight_, u0, v0, u1, v1, nullptr, ROTATION_LOCKED_HORIZONTAL); + DrawActiveTexture(0, x, y, w, h, (float)pixelWidth_, (float)pixelHeight_, u0, v0, u1, v1, nullptr, ROTATION_LOCKED_HORIZONTAL); } else { // Fullscreen Image glstate.viewport.set(0, 0, pixelWidth_, pixelHeight_); - DrawActiveTexture(colorTexture, x, y, w, h, (float)pixelWidth_, (float)pixelHeight_, u0, v0, u1, v1, nullptr, uvRotation); + DrawActiveTexture(0, x, y, w, h, (float)pixelWidth_, (float)pixelHeight_, u0, v0, u1, v1, nullptr, uvRotation); } if (gl_extensions.GLES3 && glInvalidateFramebuffer != nullptr) { @@ -1101,15 +1101,15 @@ void FramebufferManagerGLES::CopyDisplayToOutput() { if (g_Config.bEnableCardboard) { // Left Eye Image glstate.viewport.set(cardboardSettings.leftEyeXPosition, cardboardSettings.screenYPosition, cardboardSettings.screenWidth, cardboardSettings.screenHeight); - DrawActiveTexture(colorTexture, x, y, w, h, (float)pixelWidth_, (float)pixelHeight_, u0, v0, u1, v1, nullptr, ROTATION_LOCKED_HORIZONTAL); + DrawActiveTexture(0, x, y, w, h, (float)pixelWidth_, (float)pixelHeight_, u0, v0, u1, v1, nullptr, ROTATION_LOCKED_HORIZONTAL); // Right Eye Image glstate.viewport.set(cardboardSettings.rightEyeXPosition, cardboardSettings.screenYPosition, cardboardSettings.screenWidth, cardboardSettings.screenHeight); - DrawActiveTexture(colorTexture, x, y, w, h, (float)pixelWidth_, (float)pixelHeight_, u0, v0, u1, v1, nullptr, ROTATION_LOCKED_HORIZONTAL); + DrawActiveTexture(0, x, y, w, h, (float)pixelWidth_, (float)pixelHeight_, u0, v0, u1, v1, nullptr, ROTATION_LOCKED_HORIZONTAL); } else { // Fullscreen Image glstate.viewport.set(0, 0, pixelWidth_, pixelHeight_); - DrawActiveTexture(colorTexture, x, y, w, h, (float)pixelWidth_, (float)pixelHeight_, u0, v0, u1, v1, postShaderProgram_, uvRotation); + DrawActiveTexture(0, x, y, w, h, (float)pixelWidth_, (float)pixelHeight_, u0, v0, u1, v1, postShaderProgram_, uvRotation); } }