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:
parent
fd06a656f5
commit
baede3a7f3
|
@ -18,7 +18,6 @@
|
|||
#include <list>
|
||||
|
||||
#include "Common.h"
|
||||
#include "GLUtil.h"
|
||||
|
||||
#include "OnScreenDisplay.h"
|
||||
#include "Render.h"
|
||||
|
@ -48,11 +47,6 @@ void AddMessage(const char* pstr, u32 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;
|
||||
|
@ -80,14 +74,6 @@ void DrawMessages()
|
|||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
if (enabled)
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
}
|
||||
|
||||
} // namespace
|
|
@ -26,16 +26,12 @@
|
|||
// Next frame, that one is scanned out and the other one gets the copy. = double buffering.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
|
||||
#ifndef _GCOGL_RENDER_H_
|
||||
#define _GCOGL_RENDER_H_
|
||||
#ifndef _COMMON_RENDER_H_
|
||||
#define _COMMON_RENDER_H_
|
||||
|
||||
#include "TextureMngr.h"
|
||||
|
||||
#include <Cg/cg.h>
|
||||
#include <Cg/cgGL.h>
|
||||
|
||||
extern CGcontext g_cgcontext;
|
||||
extern CGprofile g_cgvProf, g_cgfProf;
|
||||
#include "VideoCommon.h"
|
||||
#include "MathUtil.h"
|
||||
#include "pluginspecs_video.h"
|
||||
|
||||
extern int frameCount;
|
||||
extern int OSDChoice, OSDTime, OSDInternalW, OSDInternalH;
|
||||
|
@ -50,6 +46,8 @@ public:
|
|||
static void ResetAPIState();
|
||||
static void RestoreAPIState();
|
||||
|
||||
static void ReinitView();
|
||||
|
||||
static void SwapBuffers();
|
||||
|
||||
static void SetColorMask();
|
||||
|
@ -66,20 +64,8 @@ public:
|
|||
|
||||
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();
|
||||
|
@ -94,4 +80,4 @@ public:
|
|||
static void Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight);
|
||||
};
|
||||
|
||||
#endif // _GCOGL_RENDER_H_
|
||||
#endif // _COMMON_RENDER_H_
|
|
@ -31,6 +31,7 @@ files = [
|
|||
'Fifo.cpp',
|
||||
'VideoState.cpp',
|
||||
'Profiler.cpp',
|
||||
'OnScreenDisplay.cpp',
|
||||
'HiresTextures.cpp',
|
||||
]
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include "CommonTypes.h"
|
||||
#include "VideoCommon.h"
|
||||
#include "Render.h" // for EFBRectangle.h, unfortunately.
|
||||
#include <vector>
|
||||
|
||||
#ifndef _STATISTICS_H
|
||||
|
|
|
@ -104,16 +104,25 @@ inline float Memory_Read_Float(u32 _uAddress)
|
|||
return temp.f;
|
||||
}
|
||||
|
||||
|
||||
// Logging
|
||||
// ¯¯¯¯¯¯¯¯¯¯
|
||||
void HandleGLError();
|
||||
|
||||
|
||||
// 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>
|
||||
{};
|
||||
|
||||
// This structure should only be used to represent a rectangle in EFB
|
||||
// coordinates, where the origin is at the upper left and the frame dimensions
|
||||
// are 640 x 528.
|
||||
struct EFBRectangle : public MathUtil::Rectangle<int>
|
||||
{};
|
||||
|
||||
// Logging
|
||||
// ¯¯¯¯¯¯¯¯¯¯
|
||||
void HandleGLError();
|
||||
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -548,6 +548,14 @@
|
|||
RelativePath=".\Src\NativeVertexWriter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\OnScreenDisplay.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\OnScreenDisplay.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\Profiler.cpp"
|
||||
>
|
||||
|
@ -697,6 +705,10 @@
|
|||
RelativePath=".\Src\NativeVertexFormat.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\Render.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\SConscript"
|
||||
>
|
||||
|
|
|
@ -1206,10 +1206,6 @@
|
|||
RelativePath=".\Src\Render.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\Render.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\TextureCache.cpp"
|
||||
>
|
||||
|
|
|
@ -37,35 +37,27 @@
|
|||
#include "Utils.h"
|
||||
#include "EmuWindow.h"
|
||||
#include "AVIDump.h"
|
||||
#include "OnScreenDisplay.h"
|
||||
|
||||
#include "debugger/debugger.h"
|
||||
|
||||
float Renderer::m_x;
|
||||
float Renderer::m_y;
|
||||
float Renderer::m_width;
|
||||
float Renderer::m_height;
|
||||
float Renderer::xScale;
|
||||
float Renderer::yScale;
|
||||
static float m_x;
|
||||
static float m_y;
|
||||
static float m_width;
|
||||
static float m_height;
|
||||
static float xScale;
|
||||
static float yScale;
|
||||
|
||||
int Renderer::m_recordWidth;
|
||||
int Renderer::m_recordHeight;
|
||||
static int m_recordWidth;
|
||||
static int m_recordHeight;
|
||||
|
||||
bool Renderer::m_LastFrameDumped;
|
||||
bool Renderer::m_AVIDumping;
|
||||
static bool m_LastFrameDumped;
|
||||
static bool m_AVIDumping;
|
||||
|
||||
#define NUMWNDRES 6
|
||||
extern int g_Res[NUMWNDRES][2];
|
||||
|
||||
struct Message
|
||||
{
|
||||
Message(const std::string &msg, u32 dw) : message(msg), dwTimeStamp(dw) { }
|
||||
std::string message;
|
||||
u32 dwTimeStamp;
|
||||
};
|
||||
|
||||
static std::list<Message> s_listMsgs;
|
||||
|
||||
void Renderer::Init(SVideoInitialize &_VideoInitialize)
|
||||
bool Renderer::Init()
|
||||
{
|
||||
EmuWindow::SetSize(g_Res[g_Config.iWindowedRes][0], g_Res[g_Config.iWindowedRes][1]);
|
||||
|
||||
|
@ -91,7 +83,13 @@ void Renderer::Init(SVideoInitialize &_VideoInitialize)
|
|||
D3D::dev->SetTransform(D3DTS_VIEW, &mtx);
|
||||
D3D::dev->SetTransform(D3DTS_WORLD, &mtx);
|
||||
D3D::font.Init();
|
||||
Initialize();
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
D3D::dev->SetSamplerState(i, D3DSAMP_MAXANISOTROPY, 16);
|
||||
|
||||
D3D::BeginFrame(true, 0);
|
||||
VertexManager::BeginFrame();
|
||||
return true;
|
||||
}
|
||||
|
||||
void Renderer::Shutdown()
|
||||
|
@ -100,54 +98,20 @@ void Renderer::Shutdown()
|
|||
D3D::EndFrame();
|
||||
D3D::Close();
|
||||
|
||||
if(m_AVIDumping) {
|
||||
if (m_AVIDumping)
|
||||
{
|
||||
AVIDump::Stop();
|
||||
}
|
||||
}
|
||||
|
||||
void Renderer::Initialize()
|
||||
float Renderer::GetTargetScaleX()
|
||||
{
|
||||
for (int i = 0; i < 8; i++)
|
||||
D3D::dev->SetSamplerState(i, D3DSAMP_MAXANISOTROPY, 16);
|
||||
|
||||
D3D::BeginFrame(true, 0);
|
||||
VertexManager::BeginFrame();
|
||||
return xScale;
|
||||
}
|
||||
|
||||
void Renderer::AddMessage(const std::string &message, u32 ms)
|
||||
float Renderer::GetTargetScaleY()
|
||||
{
|
||||
s_listMsgs.push_back(Message(message, timeGetTime()+ms));
|
||||
}
|
||||
|
||||
void Renderer::ProcessMessages()
|
||||
{
|
||||
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;
|
||||
|
||||
RenderText(it->message.c_str(), left+1, top+1, 0x000000|alpha);
|
||||
RenderText(it->message.c_str(), left, top, 0xffff30|alpha);
|
||||
top += 15;
|
||||
|
||||
if (time_left <= 0)
|
||||
it = s_listMsgs.erase(it);
|
||||
else ++it;
|
||||
}
|
||||
}
|
||||
return yScale;
|
||||
}
|
||||
|
||||
void Renderer::RenderText(const char *text, int left, int top, u32 color)
|
||||
|
@ -208,7 +172,7 @@ void Renderer::SwapBuffers()
|
|||
} else {
|
||||
char msg [255];
|
||||
sprintf(msg, "Dumping Frames to \"%s/framedump0.avi\" (%dx%d RGB24)", FULL_FRAMES_DIR, m_recordWidth, m_recordHeight);
|
||||
AddMessage(msg, 2000);
|
||||
OSD::AddMessage(msg, 2000);
|
||||
}
|
||||
}
|
||||
if (m_AVIDumping) {
|
||||
|
@ -254,7 +218,7 @@ void Renderer::SwapBuffers()
|
|||
D3D::font.DrawTextScaled(0,30,20,20,0.0f,0xFF00FFFF,st,false);
|
||||
}
|
||||
|
||||
ProcessMessages();
|
||||
OSD::DrawMessages();
|
||||
|
||||
#if defined(DVPROFILE)
|
||||
if (g_bWriteProfile) {
|
||||
|
|
|
@ -1,73 +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 __H_RENDER__
|
||||
#define __H_RENDER__
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "pluginspecs_video.h"
|
||||
#include "D3DBase.h"
|
||||
|
||||
class Renderer
|
||||
{
|
||||
public:
|
||||
static void Init(SVideoInitialize &_VideoInitialize);
|
||||
static void Shutdown();
|
||||
|
||||
static void Initialize();
|
||||
|
||||
// must be called if the window size has changed
|
||||
static void ReinitView();
|
||||
|
||||
static void SwapBuffers();
|
||||
|
||||
static void SetColorMask();
|
||||
static void SetBlendMode(bool forceUpdate);
|
||||
static bool SetScissorRect();
|
||||
|
||||
static float GetTargetScaleX() { return xScale; }
|
||||
static float GetTargetScaleY() { return yScale; }
|
||||
static float GetTargetWidth() { return m_width; }
|
||||
static float GetTargetHeight() { return m_height; }
|
||||
|
||||
// static void SetProjection(float* _pProjection, int constantIndex = -1);
|
||||
static u32 AccessEFB(EFBAccessType type, int x, int y);
|
||||
|
||||
// The little status display.
|
||||
static void AddMessage(const std::string &message, unsigned int ms);
|
||||
static void ProcessMessages();
|
||||
|
||||
static void RenderText(const char *pstr, int left, int top, unsigned int color);
|
||||
|
||||
private:
|
||||
// screen offset
|
||||
static float m_x;
|
||||
static float m_y;
|
||||
static float m_width;
|
||||
static float m_height;
|
||||
static float xScale;
|
||||
static float yScale;
|
||||
static bool m_LastFrameDumped;
|
||||
static bool m_AVIDumping;
|
||||
static int m_recordWidth;
|
||||
static int m_recordHeight;
|
||||
static std::vector<LPDIRECT3DBASETEXTURE9> m_Textures;
|
||||
};
|
||||
|
||||
#endif // __H_RENDER__
|
|
@ -43,6 +43,7 @@ GFXDebuggerDX9 *m_DebuggerFrame = NULL;
|
|||
#include "PixelShaderManager.h"
|
||||
#include "VertexShaderCache.h"
|
||||
#include "PixelShaderCache.h"
|
||||
#include "OnScreenDisplay.h"
|
||||
#include "DlgSettings.h"
|
||||
#include "D3DTexture.h"
|
||||
#include "D3DUtil.h"
|
||||
|
@ -271,8 +272,7 @@ void Initialize(void *init)
|
|||
_pVideoInitialize->pUpdateFPSDisplay = g_VideoInitialize.pUpdateFPSDisplay;
|
||||
_pVideoInitialize->pWindowHandle = g_VideoInitialize.pWindowHandle;
|
||||
|
||||
Renderer::AddMessage("Dolphin Direct3D9 Video Plugin.",5000);
|
||||
|
||||
OSD::AddMessage("Dolphin Direct3D9 Video Plugin.",5000);
|
||||
}
|
||||
|
||||
void DoState(unsigned char **ptr, int mode) {
|
||||
|
@ -300,7 +300,7 @@ void Video_SetRendering(bool bEnabled) {
|
|||
|
||||
void Video_Prepare(void)
|
||||
{
|
||||
Renderer::Init(g_VideoInitialize);
|
||||
Renderer::Init();
|
||||
|
||||
TextureCache::Init();
|
||||
|
||||
|
@ -368,7 +368,7 @@ void Video_EndField()
|
|||
|
||||
void Video_AddMessage(const char* pstr, u32 milliseconds)
|
||||
{
|
||||
Renderer::AddMessage(pstr,milliseconds);
|
||||
OSD::AddMessage(pstr,milliseconds);
|
||||
}
|
||||
|
||||
HRESULT ScreenShot(const char *File)
|
||||
|
@ -409,7 +409,7 @@ void Video_Screenshot(const char *_szFilename)
|
|||
else {
|
||||
std::string message = "Saved ";
|
||||
message += _szFilename;
|
||||
Renderer::AddMessage(message, 2000);
|
||||
OSD::AddMessage(message.c_str(), 2000);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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_
|
||||
|
|
|
@ -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
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
// 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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue