mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Moving more things out of GL into VideoCommon...
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4187 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -752,14 +752,6 @@
|
||||
RelativePath=".\Src\FramebufferManager.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\OnScreenDisplay.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\OnScreenDisplay.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\PixelShaderCache.cpp"
|
||||
>
|
||||
@ -780,10 +772,6 @@
|
||||
RelativePath=".\Src\Render.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\Render.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\TextureMngr.cpp"
|
||||
>
|
||||
|
@ -494,7 +494,7 @@ bool HandleDisplayList(u32 address, u32 size)
|
||||
u64 dl_id = DLCache::CreateMapId(address, size);
|
||||
DLCache::DLMap::iterator iter = DLCache::dl_map.find(dl_id);
|
||||
|
||||
stats.numDListsAlive = DLCache::dl_map.size();
|
||||
stats.numDListsAlive = (int)DLCache::dl_map.size();
|
||||
if (iter != DLCache::dl_map.end())
|
||||
{
|
||||
DLCache::CachedDisplayList &dl = iter->second;
|
||||
|
@ -23,6 +23,8 @@
|
||||
|
||||
extern bool s_bHaveFramebufferBlit; // comes from Render.cpp
|
||||
|
||||
FramebufferManager g_framebufferManager;
|
||||
|
||||
void FramebufferManager::Init(int targetWidth, int targetHeight, int msaaSamples, int msaaCoverageSamples)
|
||||
{
|
||||
m_targetWidth = targetWidth;
|
||||
@ -457,3 +459,21 @@ const XFBSource* FramebufferManager::getVirtualXFBSource(u32 xfbAddr, u32 fbWidt
|
||||
|
||||
return &it->xfbSource;
|
||||
}
|
||||
|
||||
void FramebufferManager::SetFramebuffer(GLuint fb)
|
||||
{
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb != 0 ? fb : GetEFBFramebuffer());
|
||||
}
|
||||
|
||||
// Apply AA if enabled
|
||||
GLuint FramebufferManager::ResolveAndGetRenderTarget(const EFBRectangle &source_rect)
|
||||
{
|
||||
return GetEFBColorTexture(source_rect);
|
||||
}
|
||||
|
||||
GLuint FramebufferManager::ResolveAndGetDepthTarget(const EFBRectangle &source_rect)
|
||||
{
|
||||
return GetEFBDepthTexture(source_rect);
|
||||
}
|
||||
|
||||
|
||||
|
@ -74,9 +74,7 @@ struct XFBSource
|
||||
|
||||
class FramebufferManager
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
FramebufferManager() :
|
||||
m_efbFramebuffer(0),
|
||||
m_efbColor(0),
|
||||
@ -106,6 +104,18 @@ public:
|
||||
|
||||
TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) const;
|
||||
|
||||
void SetFramebuffer(GLuint fb);
|
||||
|
||||
// If in MSAA mode, this will perform a resolve of the specified rectangle, and return the resolve target as a texture ID.
|
||||
// Thus, this call may be expensive. Don't repeat it unnecessarily.
|
||||
// If not in MSAA mode, will just return the render target texture ID.
|
||||
// After calling this, before you render anything else, you MUST bind the framebuffer you want to draw to.
|
||||
GLuint ResolveAndGetRenderTarget(const EFBRectangle &rect);
|
||||
|
||||
// Same as above but for the depth Target.
|
||||
// After calling this, before you render anything else, you MUST bind the framebuffer you want to draw to.
|
||||
GLuint ResolveAndGetDepthTarget(const EFBRectangle &rect);
|
||||
|
||||
private:
|
||||
|
||||
struct VirtualXFB
|
||||
@ -144,7 +154,8 @@ private:
|
||||
GLuint m_xfbFramebuffer; // Only used in MSAA mode
|
||||
XFBSource m_realXFBSource; // Only used in Real XFB mode
|
||||
VirtualXFBListType m_virtualXFBList; // Only used in Virtual XFB mode
|
||||
|
||||
};
|
||||
|
||||
extern FramebufferManager g_framebufferManager;
|
||||
|
||||
#endif
|
||||
|
@ -113,13 +113,6 @@ extern GLWindow GLWin;
|
||||
|
||||
// Public OpenGL util
|
||||
|
||||
// This structure should only be used to represent a rectangle in OpenGL target
|
||||
// coordinates, where the origin is at the lower left and the frame dimensions
|
||||
// depend on the resolution settings. Use Renderer::ConvertEFBRectangle to
|
||||
// convert an EFBRectangle to a TargetRectangle.
|
||||
struct TargetRectangle : public MathUtil::Rectangle<int>
|
||||
{};
|
||||
|
||||
// Initialization / upkeep
|
||||
bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _width, int _height);
|
||||
void OpenGL_Shutdown();
|
||||
@ -157,4 +150,10 @@ bool OpenGL_ReportFBOError(const char *function, const char *file, int line);
|
||||
|
||||
#endif // GLTEST ??
|
||||
|
||||
#include <Cg/cg.h>
|
||||
#include <Cg/cgGL.h>
|
||||
|
||||
extern CGcontext g_cgcontext;
|
||||
extern CGprofile g_cgvProf, g_cgfProf;
|
||||
|
||||
#endif // _GLINIT_H_
|
||||
|
@ -1,93 +0,0 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include <list>
|
||||
|
||||
#include "Common.h"
|
||||
#include "GLUtil.h"
|
||||
|
||||
#include "OnScreenDisplay.h"
|
||||
#include "Render.h"
|
||||
#include "Timer.h"
|
||||
|
||||
namespace OSD
|
||||
{
|
||||
|
||||
struct MESSAGE
|
||||
{
|
||||
MESSAGE() {}
|
||||
MESSAGE(const char* p, u32 dw) {
|
||||
strncpy(str, p, 255);
|
||||
str[255] = '\0';
|
||||
dwTimeStamp = dw;
|
||||
}
|
||||
char str[256];
|
||||
u32 dwTimeStamp;
|
||||
};
|
||||
|
||||
static std::list<MESSAGE> s_listMsgs;
|
||||
|
||||
void AddMessage(const char* pstr, u32 ms)
|
||||
{
|
||||
s_listMsgs.push_back(MESSAGE(pstr, timeGetTime() + ms));
|
||||
}
|
||||
|
||||
void DrawMessages()
|
||||
{
|
||||
// Get the status of the Blend mode
|
||||
GLboolean enabled = glIsEnabled(GL_BLEND);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
if (s_listMsgs.size() > 0)
|
||||
{
|
||||
int left = 25, top = 15;
|
||||
std::list<MESSAGE>::iterator it = s_listMsgs.begin();
|
||||
while (it != s_listMsgs.end())
|
||||
{
|
||||
int time_left = (int)(it->dwTimeStamp - timeGetTime());
|
||||
int alpha = 255;
|
||||
|
||||
if (time_left < 1024)
|
||||
{
|
||||
alpha = time_left >> 2;
|
||||
if (time_left < 0) alpha = 0;
|
||||
}
|
||||
|
||||
alpha <<= 24;
|
||||
|
||||
Renderer::RenderText(it->str, left+1, top+1, 0x000000|alpha);
|
||||
Renderer::RenderText(it->str, left, top, 0xffff30|alpha);
|
||||
top += 15;
|
||||
|
||||
if (time_left <= 0)
|
||||
it = s_listMsgs.erase(it);
|
||||
else
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
if (enabled)
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
}
|
||||
|
||||
} // namespace
|
@ -1,31 +0,0 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _OSD_H_
|
||||
#define _OSD_H_
|
||||
|
||||
namespace OSD
|
||||
{
|
||||
|
||||
// On-screen message display
|
||||
void AddMessage(const char* str, u32 ms);
|
||||
void DrawMessages(); // draw the current messages on the screen. Only call once per frame.
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif // _OSD_H_
|
||||
|
@ -114,7 +114,6 @@ static int s_fps = 0;
|
||||
static int s_targetwidth; // Size of render buffer FBO.
|
||||
static int s_targetheight;
|
||||
|
||||
static FramebufferManager s_framebufferManager;
|
||||
static GLuint s_tempScreenshotFramebuffer = 0;
|
||||
|
||||
static bool s_skipSwap = false;
|
||||
@ -321,7 +320,7 @@ bool Renderer::Init()
|
||||
bSuccess = false;
|
||||
|
||||
// Initialize the FramebufferManager
|
||||
s_framebufferManager.Init(s_targetwidth, s_targetheight, s_MSAASamples, s_MSAACoverageSamples);
|
||||
g_framebufferManager.Init(s_targetwidth, s_targetheight, s_MSAASamples, s_MSAACoverageSamples);
|
||||
|
||||
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
|
||||
|
||||
@ -414,7 +413,7 @@ void Renderer::Shutdown(void)
|
||||
glDeleteFramebuffersEXT(1, &s_tempScreenshotFramebuffer);
|
||||
s_tempScreenshotFramebuffer = 0;
|
||||
|
||||
s_framebufferManager.Shutdown();
|
||||
g_framebufferManager.Shutdown();
|
||||
|
||||
#ifdef _WIN32
|
||||
if(s_bAVIDumping) {
|
||||
@ -450,12 +449,7 @@ float Renderer::GetTargetScaleY()
|
||||
|
||||
TargetRectangle Renderer::ConvertEFBRectangle(const EFBRectangle& rc)
|
||||
{
|
||||
return s_framebufferManager.ConvertEFBRectangle(rc);
|
||||
}
|
||||
|
||||
void Renderer::SetFramebuffer(GLuint fb)
|
||||
{
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb != 0 ? fb : s_framebufferManager.GetEFBFramebuffer());
|
||||
return g_framebufferManager.ConvertEFBRectangle(rc);
|
||||
}
|
||||
|
||||
void Renderer::ResetAPIState()
|
||||
@ -475,6 +469,11 @@ void Renderer::ResetAPIState()
|
||||
|
||||
void UpdateViewport();
|
||||
|
||||
void Renderer::ReinitView()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Renderer::RestoreAPIState()
|
||||
{
|
||||
// Gets us back into a more game-like state.
|
||||
@ -564,8 +563,8 @@ u32 Renderer::AccessEFB(EFBAccessType type, int x, int y)
|
||||
if (s_MSAASamples > 1)
|
||||
{
|
||||
// Resolve our rectangle.
|
||||
s_framebufferManager.GetEFBDepthTexture(efbPixelRc);
|
||||
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, s_framebufferManager.GetResolvedFramebuffer());
|
||||
g_framebufferManager.GetEFBDepthTexture(efbPixelRc);
|
||||
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, g_framebufferManager.GetResolvedFramebuffer());
|
||||
}
|
||||
|
||||
// Sample from the center of the target region.
|
||||
@ -597,8 +596,8 @@ u32 Renderer::AccessEFB(EFBAccessType type, int x, int y)
|
||||
if (s_MSAASamples > 1)
|
||||
{
|
||||
// Resolve our rectangle.
|
||||
s_framebufferManager.GetEFBColorTexture(efbPixelRc);
|
||||
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, s_framebufferManager.GetResolvedFramebuffer());
|
||||
g_framebufferManager.GetEFBColorTexture(efbPixelRc);
|
||||
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, g_framebufferManager.GetResolvedFramebuffer());
|
||||
}
|
||||
|
||||
// Sample from the center of the target region.
|
||||
@ -625,19 +624,6 @@ u32 Renderer::AccessEFB(EFBAccessType type, int x, int y)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Apply AA if enabled
|
||||
GLuint Renderer::ResolveAndGetRenderTarget(const EFBRectangle &source_rect)
|
||||
{
|
||||
return s_framebufferManager.GetEFBColorTexture(source_rect);
|
||||
}
|
||||
|
||||
GLuint Renderer::ResolveAndGetDepthTarget(const EFBRectangle &source_rect)
|
||||
{
|
||||
return s_framebufferManager.GetEFBDepthTexture(source_rect);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Function: This function handles the OpenGL glScissor() function
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// Call browser: OpcodeDecoding.cpp ExecuteDisplayList > Decode() > LoadBPReg()
|
||||
@ -794,7 +780,7 @@ void Renderer::RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRect
|
||||
// If we're about to write to a requested XFB, make sure the previous
|
||||
// contents make it to the screen first.
|
||||
VideoFifo_CheckSwapRequestAt(xfbAddr, fbWidth, fbHeight);
|
||||
s_framebufferManager.CopyToXFB(xfbAddr, fbWidth, fbHeight, sourceRc);
|
||||
g_framebufferManager.CopyToXFB(xfbAddr, fbWidth, fbHeight, sourceRc);
|
||||
|
||||
// XXX: Without the VI, how would we know what kind of field this is? So
|
||||
// just use progressive.
|
||||
@ -813,7 +799,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
|
||||
if(s_skipSwap)
|
||||
return;
|
||||
|
||||
const XFBSource* xfbSource = s_framebufferManager.GetXFBSource(xfbAddr, fbWidth, fbHeight);
|
||||
const XFBSource* xfbSource = g_framebufferManager.GetXFBSource(xfbAddr, fbWidth, fbHeight);
|
||||
if (!xfbSource)
|
||||
{
|
||||
WARN_LOG(VIDEO, "Failed to get video for this frame");
|
||||
@ -925,7 +911,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
|
||||
s_criticalScreenshot.Leave();
|
||||
|
||||
glFramebufferTexture2DEXT(GL_READ_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_ARB, 0, 0);
|
||||
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, s_framebufferManager.GetEFBFramebuffer());
|
||||
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, g_framebufferManager.GetEFBFramebuffer());
|
||||
}
|
||||
|
||||
// Frame dumps are handled a little differently in Windows
|
||||
@ -971,7 +957,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
|
||||
s_criticalScreenshot.Leave();
|
||||
|
||||
glFramebufferTexture2DEXT(GL_READ_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_ARB, 0, 0);
|
||||
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, s_framebufferManager.GetEFBFramebuffer());
|
||||
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, g_framebufferManager.GetEFBFramebuffer());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1071,8 +1057,12 @@ void Renderer::SwapBuffers()
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
// Get the status of the Blend mode
|
||||
GLboolean blend_enabled = glIsEnabled(GL_BLEND);
|
||||
glDisable(GL_BLEND);
|
||||
OSD::DrawMessages();
|
||||
|
||||
if (blend_enabled)
|
||||
glEnable(GL_BLEND);
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
#if defined(DVPROFILE)
|
||||
@ -1110,7 +1100,7 @@ void Renderer::SwapBuffers()
|
||||
stats.ResetFrame();
|
||||
|
||||
// Render to the framebuffer.
|
||||
SetFramebuffer(0);
|
||||
g_framebufferManager.SetFramebuffer(0);
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
}
|
||||
|
@ -1,97 +0,0 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// GC graphics pipeline
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// 3d commands are issued through the fifo. The gpu draws to the 2MB EFB.
|
||||
// The efb can be copied back into ram in two forms: as textures or as XFB.
|
||||
// The XFB is the region in RAM that the VI chip scans out to the television.
|
||||
// So, after all rendering to EFB is done, the image is copied into one of two XFBs in RAM.
|
||||
// Next frame, that one is scanned out and the other one gets the copy. = double buffering.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
|
||||
#ifndef _GCOGL_RENDER_H_
|
||||
#define _GCOGL_RENDER_H_
|
||||
|
||||
#include "TextureMngr.h"
|
||||
|
||||
#include <Cg/cg.h>
|
||||
#include <Cg/cgGL.h>
|
||||
|
||||
extern CGcontext g_cgcontext;
|
||||
extern CGprofile g_cgvProf, g_cgfProf;
|
||||
|
||||
extern int frameCount;
|
||||
extern int OSDChoice, OSDTime, OSDInternalW, OSDInternalH;
|
||||
|
||||
class Renderer
|
||||
{
|
||||
public:
|
||||
static bool Init();
|
||||
static void Shutdown();
|
||||
|
||||
// What's the real difference between these? Too similar names.
|
||||
static void ResetAPIState();
|
||||
static void RestoreAPIState();
|
||||
|
||||
static void SwapBuffers();
|
||||
|
||||
static void SetColorMask();
|
||||
static void SetBlendMode(bool forceUpdate);
|
||||
static bool SetScissorRect();
|
||||
|
||||
// Render target management
|
||||
static int GetTargetWidth();
|
||||
static int GetTargetHeight();
|
||||
|
||||
// Multiply any 2D EFB coordinates by these when rendering.
|
||||
static float GetTargetScaleX();
|
||||
static float GetTargetScaleY();
|
||||
|
||||
static TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc);
|
||||
|
||||
static void SetFramebuffer(GLuint fb);
|
||||
|
||||
static u32 AccessEFB(EFBAccessType type, int x, int y);
|
||||
|
||||
// If in MSAA mode, this will perform a resolve of the specified rectangle, and return the resolve target as a texture ID.
|
||||
// Thus, this call may be expensive. Don't repeat it unnecessarily.
|
||||
// If not in MSAA mode, will just return the render target texture ID.
|
||||
// After calling this, before you render anything else, you MUST bind the framebuffer you want to draw to.
|
||||
static GLuint ResolveAndGetRenderTarget(const EFBRectangle &rect);
|
||||
|
||||
// Same as above but for the depth Target.
|
||||
// After calling this, before you render anything else, you MUST bind the framebuffer you want to draw to.
|
||||
static GLuint ResolveAndGetDepthTarget(const EFBRectangle &rect);
|
||||
|
||||
// Random utilities
|
||||
static void RenderText(const char* pstr, int left, int top, u32 color);
|
||||
static void DrawDebugText();
|
||||
static void SetScreenshot(const char *filename);
|
||||
static void FlipImageData(u8 *data, int w, int h);
|
||||
static bool SaveRenderTarget(const char *filename, int w, int h, int YOffset = 0);
|
||||
|
||||
static void ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable, u32 color, u32 z);
|
||||
static void RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& sourceRc);
|
||||
|
||||
// Finish up the current frame, print some stats
|
||||
static void Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight);
|
||||
};
|
||||
|
||||
#endif // _GCOGL_RENDER_H_
|
@ -23,7 +23,6 @@ files = [
|
||||
'VertexManager.cpp',
|
||||
'VertexLoaderManager.cpp',
|
||||
'XFB.cpp',
|
||||
'OnScreenDisplay.cpp',
|
||||
'PostProcessing.cpp',
|
||||
'FramebufferManager.cpp',
|
||||
]
|
||||
|
@ -20,8 +20,10 @@
|
||||
|
||||
#include "TextureConverter.h"
|
||||
#include "TextureConversionShader.h"
|
||||
#include "TextureMngr.h"
|
||||
#include "PixelShaderCache.h"
|
||||
#include "VertexShaderManager.h"
|
||||
#include "FramebufferManager.h"
|
||||
#include "Globals.h"
|
||||
#include "Config.h"
|
||||
#include "ImageWrite.h"
|
||||
@ -173,7 +175,8 @@ void EncodeToRamUsingShader(FRAGMENTSHADER& shader, GLuint srcTexture, const Tar
|
||||
|
||||
// switch to texture converter frame buffer
|
||||
// attach render buffer as color destination
|
||||
Renderer::SetFramebuffer(s_texConvFrameBuffer);
|
||||
g_framebufferManager.SetFramebuffer(s_texConvFrameBuffer);
|
||||
|
||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, s_dstRenderBuffer);
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, s_dstRenderBuffer);
|
||||
GL_REPORT_ERRORD();
|
||||
@ -217,7 +220,7 @@ void EncodeToRamUsingShader(FRAGMENTSHADER& shader, GLuint srcTexture, const Tar
|
||||
glReadPixels(0, 0, (GLsizei)dstWidth, (GLsizei)dstHeight, GL_BGRA, GL_UNSIGNED_BYTE, destAddr);
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
Renderer::SetFramebuffer(0);
|
||||
g_framebufferManager.SetFramebuffer(0);
|
||||
Renderer::RestoreAPIState();
|
||||
VertexShaderManager::SetViewportChanged();
|
||||
|
||||
@ -250,7 +253,7 @@ void EncodeToRam(u32 address, bool bFromZBuffer, bool bIsIntensityFmt, u32 copyf
|
||||
|
||||
u8 *dest_ptr = Memory_GetPtr(address);
|
||||
|
||||
GLuint source_texture = bFromZBuffer ? Renderer::ResolveAndGetDepthTarget(source) : Renderer::ResolveAndGetRenderTarget(source);
|
||||
GLuint source_texture = bFromZBuffer ? g_framebufferManager.ResolveAndGetDepthTarget(source) : g_framebufferManager.ResolveAndGetRenderTarget(source);
|
||||
int width = source.right - source.left;
|
||||
int height = source.bottom - source.top;
|
||||
|
||||
@ -321,7 +324,7 @@ void DecodeToTexture(u32 xfbAddr, int srcWidth, int srcHeight, GLuint destTextur
|
||||
|
||||
// swich to texture converter frame buffer
|
||||
// attach destTexture as color destination
|
||||
Renderer::SetFramebuffer(s_texConvFrameBuffer);
|
||||
g_framebufferManager.SetFramebuffer(s_texConvFrameBuffer);
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, destTexture);
|
||||
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_ARB, destTexture, 0);
|
||||
|
||||
@ -360,7 +363,7 @@ void DecodeToTexture(u32 xfbAddr, int srcWidth, int srcHeight, GLuint destTextur
|
||||
|
||||
VertexShaderManager::SetViewportChanged();
|
||||
|
||||
Renderer::SetFramebuffer(0);
|
||||
g_framebufferManager.SetFramebuffer(0);
|
||||
|
||||
Renderer::RestoreAPIState();
|
||||
GL_REPORT_ERRORD();
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include "PixelShaderCache.h"
|
||||
#include "PixelShaderManager.h"
|
||||
#include "VertexShaderManager.h"
|
||||
#include "FramebufferManager.h"
|
||||
#include "FileUtil.h"
|
||||
#include "HiresTextures.h"
|
||||
|
||||
@ -681,7 +682,7 @@ void TextureMngr::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool
|
||||
}
|
||||
|
||||
// Make sure to resolve anything we need to read from.
|
||||
GLuint read_texture = bFromZBuffer ? Renderer::ResolveAndGetDepthTarget(source_rect) : Renderer::ResolveAndGetRenderTarget(source_rect);
|
||||
GLuint read_texture = bFromZBuffer ? g_framebufferManager.ResolveAndGetDepthTarget(source_rect) : g_framebufferManager.ResolveAndGetRenderTarget(source_rect);
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
@ -691,7 +692,7 @@ void TextureMngr::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool
|
||||
if (s_TempFramebuffer == 0)
|
||||
glGenFramebuffersEXT(1, (GLuint *)&s_TempFramebuffer);
|
||||
|
||||
Renderer::SetFramebuffer(s_TempFramebuffer);
|
||||
g_framebufferManager.SetFramebuffer(s_TempFramebuffer);
|
||||
// Bind texture to temporary framebuffer
|
||||
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_ARB, entry.texture, 0);
|
||||
GL_REPORT_FBO_ERROR();
|
||||
@ -724,7 +725,7 @@ void TextureMngr::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool
|
||||
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_ARB, 0, 0);
|
||||
|
||||
// Return to the EFB.
|
||||
Renderer::SetFramebuffer(0);
|
||||
g_framebufferManager.SetFramebuffer(0);
|
||||
Renderer::RestoreAPIState();
|
||||
VertexShaderManager::SetViewportChanged();
|
||||
TextureMngr::DisableStage(0);
|
||||
|
@ -28,9 +28,10 @@
|
||||
#include "XFB.h"
|
||||
#include "Render.h"
|
||||
#include "TextureConverter.h"
|
||||
#include "FramebufferManager.h"
|
||||
|
||||
void XFB_Write(u8 *xfb_in_ram, const EFBRectangle& sourceRc, u32 dstWd, u32 dstHt)
|
||||
{
|
||||
TargetRectangle targetRc = Renderer::ConvertEFBRectangle(sourceRc);
|
||||
TextureConverter::EncodeToRamYUYV(Renderer::ResolveAndGetRenderTarget(sourceRc), targetRc, xfb_in_ram, dstWd, dstHt);
|
||||
TextureConverter::EncodeToRamYUYV(g_framebufferManager.ResolveAndGetRenderTarget(sourceRc), targetRc, xfb_in_ram, dstWd, dstHt);
|
||||
}
|
||||
|
Reference in New Issue
Block a user