mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-03-29 19:20:36 +00:00
More cleanup again I hope I didn't break anything, please check
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1593 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
db15121b5d
commit
b5dcdcf779
@ -97,7 +97,7 @@ vars.AddVariables(
|
|||||||
BoolVariable('nowx', 'Set For Building with no WX libs (WIP)', False),
|
BoolVariable('nowx', 'Set For Building with no WX libs (WIP)', False),
|
||||||
BoolVariable('wxgl', 'Set For Building with WX GL libs (WIP)', False),
|
BoolVariable('wxgl', 'Set For Building with WX GL libs (WIP)', False),
|
||||||
BoolVariable('sdlgl', 'Set For Building with SDL GL libs (WIP)', False),
|
BoolVariable('sdlgl', 'Set For Building with SDL GL libs (WIP)', False),
|
||||||
BoolVariable('gltext', 'temp don\'t use (WIP)', False),
|
BoolVariable('gltest', 'temp don\'t use (WIP)', False),
|
||||||
EnumVariable('flavor', 'Choose a build flavor', 'release',
|
EnumVariable('flavor', 'Choose a build flavor', 'release',
|
||||||
allowed_values = ('release', 'devel', 'debug', 'fastlog'),
|
allowed_values = ('release', 'devel', 'debug', 'fastlog'),
|
||||||
ignorecase = 2
|
ignorecase = 2
|
||||||
@ -234,7 +234,7 @@ if env['sdlgl']:
|
|||||||
env['USE_WX'] = 0
|
env['USE_WX'] = 0
|
||||||
|
|
||||||
env['GLTEST'] = 0
|
env['GLTEST'] = 0
|
||||||
if env['gltext']:
|
if env['gltest']:
|
||||||
env['GLTEST'] = 1
|
env['GLTEST'] = 1
|
||||||
|
|
||||||
conf.Define('GLTEST', env['GLTEST'])
|
conf.Define('GLTEST', env['GLTEST'])
|
||||||
|
@ -67,6 +67,28 @@ void OpenGL_SwapBuffers()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int OpenGL_GetXoff() {
|
||||||
|
return nXoff;
|
||||||
|
}
|
||||||
|
|
||||||
|
int OpenGL_GetYoff() {
|
||||||
|
return nYoff;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 OpenGL_GetWidth() {
|
||||||
|
return nBackbufferWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 OpenGL_GetHeight() {
|
||||||
|
return nBackbufferHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenGL_SetSize(u32 width, u32 height) {
|
||||||
|
nBackbufferWidth = width;
|
||||||
|
nBackbufferHeight = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void OpenGL_SetWindowText(const char *text)
|
void OpenGL_SetWindowText(const char *text)
|
||||||
{
|
{
|
||||||
#if USE_SDL
|
#if USE_SDL
|
||||||
|
@ -118,9 +118,14 @@ extern GLWindow GLWin;
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int OpenGL_GetXoff();
|
||||||
|
int OpenGL_GetYoff();
|
||||||
|
u32 OpenGL_GetWidth();
|
||||||
|
u32 OpenGL_GetHeight();
|
||||||
|
void OpenGL_SetSize(u32 width, u32 height);
|
||||||
// yeah yeah, these should be hidden
|
// yeah yeah, these should be hidden
|
||||||
extern int nBackbufferWidth, nBackbufferHeight;
|
//extern int nBackbufferWidth, nBackbufferHeight;
|
||||||
extern int nXoff, nYoff;
|
//extern int nXoff, nYoff;
|
||||||
|
|
||||||
bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _width, int _height);
|
bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _width, int _height);
|
||||||
bool OpenGL_MakeCurrent();
|
bool OpenGL_MakeCurrent();
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
class GLWindow {
|
class GLWindow {
|
||||||
private:
|
private:
|
||||||
u32 width, height;
|
u32 width, height;
|
||||||
|
int yOffset, xOffset;
|
||||||
public:
|
public:
|
||||||
/* int screen;
|
/* int screen;
|
||||||
int x, y;
|
int x, y;
|
||||||
@ -30,11 +31,18 @@ class GLWindow {
|
|||||||
virtual void SetSize(u32 newWidth, u32 newHeight) {
|
virtual void SetSize(u32 newWidth, u32 newHeight) {
|
||||||
width = newWidth;
|
width = newWidth;
|
||||||
height = newHeight;
|
height = newHeight;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
void SetOffset(int x, int y) {
|
||||||
|
yOffset = y;
|
||||||
|
xOffset = x;
|
||||||
|
}
|
||||||
|
|
||||||
u32 GetWidth() {return width;}
|
u32 GetWidth() {return width;}
|
||||||
u32 GetHeight() {return height;}
|
u32 GetHeight() {return height;}
|
||||||
|
int GetYoff() {return yOffset;}
|
||||||
|
int GetXoff() {return xOffset;}
|
||||||
|
|
||||||
virtual bool valid() { return false; }
|
virtual bool valid() { return false; }
|
||||||
// bool GLwindow(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight) {};
|
// bool GLwindow(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight) {};
|
||||||
// setResolution
|
// setResolution
|
||||||
|
@ -172,6 +172,9 @@ bool Renderer::Create2()
|
|||||||
_assert_( glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) == GL_FRAMEBUFFER_COMPLETE_EXT );
|
_assert_( glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) == GL_FRAMEBUFFER_COMPLETE_EXT );
|
||||||
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, s_uFramebuffer );
|
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, s_uFramebuffer );
|
||||||
|
|
||||||
|
int nBackbufferWidth = (int)OpenGL_GetWidth();
|
||||||
|
int nBackbufferHeight = (int)OpenGL_GetHeight();
|
||||||
|
|
||||||
// create the framebuffer targets
|
// create the framebuffer targets
|
||||||
glGenTextures(ARRAYSIZE(s_RenderTargets), (GLuint *)s_RenderTargets);
|
glGenTextures(ARRAYSIZE(s_RenderTargets), (GLuint *)s_RenderTargets);
|
||||||
for(u32 i = 0; i < ARRAYSIZE(s_RenderTargets); ++i) {
|
for(u32 i = 0; i < ARRAYSIZE(s_RenderTargets); ++i) {
|
||||||
@ -378,7 +381,7 @@ bool Renderer::Initialize()
|
|||||||
|
|
||||||
glDisable(GL_STENCIL_TEST);
|
glDisable(GL_STENCIL_TEST);
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
glScissor(0, 0, nBackbufferWidth, nBackbufferHeight);
|
glScissor(0, 0, (int)OpenGL_GetWidth(), (int)OpenGL_GetHeight());
|
||||||
glBlendColorEXT(0, 0, 0, 0.5f);
|
glBlendColorEXT(0, 0, 0, 0.5f);
|
||||||
glClearDepth(1.0f);
|
glClearDepth(1.0f);
|
||||||
|
|
||||||
@ -442,6 +445,8 @@ void Renderer::ProcessMessages()
|
|||||||
|
|
||||||
void Renderer::RenderText(const char* pstr, int left, int top, u32 color)
|
void Renderer::RenderText(const char* pstr, int left, int top, u32 color)
|
||||||
{
|
{
|
||||||
|
int nBackbufferWidth = (int)OpenGL_GetWidth();
|
||||||
|
int nBackbufferHeight = (int)OpenGL_GetHeight();
|
||||||
glColor4f(
|
glColor4f(
|
||||||
((color>>16) & 0xff)/255.0f,
|
((color>>16) & 0xff)/255.0f,
|
||||||
((color>> 8) & 0xff)/255.0f,
|
((color>> 8) & 0xff)/255.0f,
|
||||||
@ -461,7 +466,8 @@ void Renderer::ReinitView(int nNewWidth, int nNewHeight)
|
|||||||
int oldscreen = s_bFullscreen;
|
int oldscreen = s_bFullscreen;
|
||||||
|
|
||||||
OpenGL_Shutdown();
|
OpenGL_Shutdown();
|
||||||
int oldwidth = nBackbufferWidth, oldheight = nBackbufferHeight;
|
int oldwidth = (int)OpenGL_GetWidth,
|
||||||
|
oldheight = (int)OpenGL_GetHeight();
|
||||||
if (!OpenGL_Create(g_VideoInitialize, nNewWidth, nNewHeight)) {//nNewWidth&~7, nNewHeight&~7) ) {
|
if (!OpenGL_Create(g_VideoInitialize, nNewWidth, nNewHeight)) {//nNewWidth&~7, nNewHeight&~7) ) {
|
||||||
ERROR_LOG("Failed to recreate, reverting to old settings\n");
|
ERROR_LOG("Failed to recreate, reverting to old settings\n");
|
||||||
if (!OpenGL_Create(g_VideoInitialize, oldwidth, oldheight)) {
|
if (!OpenGL_Create(g_VideoInitialize, oldwidth, oldheight)) {
|
||||||
@ -491,23 +497,17 @@ void Renderer::ReinitView(int nNewWidth, int nNewHeight)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
nBackbufferWidth = nNewWidth > 16 ? nNewWidth : 16;
|
OpenGL_SetSize(nNewWidth > 16 ? nNewWidth : 16,
|
||||||
nBackbufferHeight = nNewHeight > 16 ? nNewHeight : 16;
|
nNewHeight > 16 ? nNewHeight : 16);
|
||||||
}
|
}
|
||||||
int Renderer::GetTargetWidth()
|
int Renderer::GetTargetWidth()
|
||||||
{
|
{
|
||||||
if(g_Config.bStretchToFit)
|
return (g_Config.bStretchToFit?640:(int)OpenGL_GetWidth());
|
||||||
return 640;
|
|
||||||
else
|
|
||||||
return nBackbufferWidth; // return the actual window width
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Renderer::GetTargetHeight()
|
int Renderer::GetTargetHeight()
|
||||||
{
|
{
|
||||||
if(g_Config.bStretchToFit)
|
return (g_Config.bStretchToFit?480:(int)OpenGL_GetHeight());
|
||||||
return 480;
|
|
||||||
else
|
|
||||||
return nBackbufferHeight; // return the actual window height
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Renderer::CanBlendLogicOp()
|
bool Renderer::CanBlendLogicOp()
|
||||||
@ -673,8 +673,8 @@ void Renderer::FlushZBufferAlphaToTarget()
|
|||||||
if(g_Config.bStretchToFit)
|
if(g_Config.bStretchToFit)
|
||||||
{
|
{
|
||||||
//TODO: Do Correctly in a bit
|
//TODO: Do Correctly in a bit
|
||||||
float FactorW = (float)640 / (float)nBackbufferWidth;
|
float FactorW = (float)640 / (float)OpenGL_GetWidth();
|
||||||
float FactorH = (float)480 / (float)nBackbufferHeight;
|
float FactorH = (float)480 / (float)OpenGL_GetHeight();
|
||||||
|
|
||||||
float Max = (FactorW < FactorH) ? FactorH : FactorW;
|
float Max = (FactorW < FactorH) ? FactorH : FactorW;
|
||||||
float Temp = 1 / Max;
|
float Temp = 1 / Max;
|
||||||
@ -793,7 +793,7 @@ void Renderer::Swap(const TRectangle& rc)
|
|||||||
#else
|
#else
|
||||||
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 ); // switch to the backbuffer
|
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 ); // switch to the backbuffer
|
||||||
#endif
|
#endif
|
||||||
glViewport(nXoff, nYoff, nBackbufferWidth, nBackbufferHeight);
|
glViewport(OpenGL_GetXoff(),OpenGL_GetYoff() , (int)OpenGL_GetWidth(), (int)OpenGL_GetHeight());
|
||||||
|
|
||||||
ResetGLState();
|
ResetGLState();
|
||||||
|
|
||||||
@ -951,6 +951,9 @@ void Renderer::SwapBuffers()
|
|||||||
bool Renderer::SaveRenderTarget(const char* filename, int jpeg)
|
bool Renderer::SaveRenderTarget(const char* filename, int jpeg)
|
||||||
{
|
{
|
||||||
bool bflip = true;
|
bool bflip = true;
|
||||||
|
int nBackbufferHeight = (int)OpenGL_GetHeight();
|
||||||
|
int nBackbufferWidth = (int)OpenGL_GetWidth();
|
||||||
|
|
||||||
std::vector<u32> data(nBackbufferWidth * nBackbufferHeight);
|
std::vector<u32> data(nBackbufferWidth * nBackbufferHeight);
|
||||||
glReadPixels(0, 0, nBackbufferWidth, nBackbufferHeight, GL_BGRA, GL_UNSIGNED_BYTE, &data[0]);
|
glReadPixels(0, 0, nBackbufferWidth, nBackbufferHeight, GL_BGRA, GL_UNSIGNED_BYTE, &data[0]);
|
||||||
if (glGetError() != GL_NO_ERROR)
|
if (glGetError() != GL_NO_ERROR)
|
||||||
|
@ -56,6 +56,7 @@ void XFB_Shutdown()
|
|||||||
|
|
||||||
void XFB_Write(u8 *xfb_in_ram, const TRectangle& sourceRc, u32 dstWd, u32 dstHt)
|
void XFB_Write(u8 *xfb_in_ram, const TRectangle& sourceRc, u32 dstWd, u32 dstHt)
|
||||||
{
|
{
|
||||||
|
u32 nBackbufferHeight = OpenGL_GetHeight();
|
||||||
TRectangle renderSrcRc;
|
TRectangle renderSrcRc;
|
||||||
renderSrcRc.left = sourceRc.left;
|
renderSrcRc.left = sourceRc.left;
|
||||||
renderSrcRc.right = sourceRc.right;
|
renderSrcRc.right = sourceRc.right;
|
||||||
@ -79,7 +80,8 @@ void XFB_Draw(u8 *xfb_in_ram, u32 width, u32 height, s32 yOffset)
|
|||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, xfb_decoded_texture);
|
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, xfb_decoded_texture);
|
||||||
|
|
||||||
glViewport(nXoff, nYoff, nBackbufferWidth, nBackbufferHeight);
|
glViewport(OpenGL_GetXoff(), OpenGL_GetYoff(),
|
||||||
|
(int)OpenGL_GetWidth(), (int)OpenGL_GetHeight);
|
||||||
GL_REPORT_ERRORD();
|
GL_REPORT_ERRORD();
|
||||||
|
|
||||||
float w = (float)width;
|
float w = (float)width;
|
||||||
@ -228,4 +230,4 @@ void XFB_Draw(u8 *xfb_in_ram, u32 width, u32 height, s32 yOffset)
|
|||||||
GL_REPORT_ERRORD();
|
GL_REPORT_ERRORD();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -86,5 +86,24 @@ void OpenGL_Update()
|
|||||||
// ----------------
|
// ----------------
|
||||||
void OpenGL_Shutdown()
|
void OpenGL_Shutdown()
|
||||||
{
|
{
|
||||||
glWin->Shutdown();
|
delete glWin;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 OpenGL_GetWidth() {
|
||||||
|
return glWin->GetHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 OpenGL_GetHeight() {
|
||||||
|
return glWin->GetWidth();
|
||||||
|
|
||||||
|
void OpenGL_SetSize(u32 width, u32 height) {
|
||||||
|
glWin->SetSize(width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
int OpenGL_GetXoff() {
|
||||||
|
return glWin->GetXoff();
|
||||||
|
}
|
||||||
|
|
||||||
|
int OpenGL_GetYoff() {
|
||||||
|
return glWin->GetYoff();
|
||||||
}
|
}
|
||||||
|
@ -40,11 +40,18 @@
|
|||||||
#else
|
#else
|
||||||
#define GL_REPORT_ERRORD()
|
#define GL_REPORT_ERRORD()
|
||||||
#endif
|
#endif
|
||||||
// OLD interface todo remove
|
|
||||||
|
// TODO old interface removal
|
||||||
bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _width, int _height);
|
bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _width, int _height);
|
||||||
bool OpenGL_MakeCurrent();
|
bool OpenGL_MakeCurrent();
|
||||||
void OpenGL_SwapBuffers();
|
void OpenGL_SwapBuffers();
|
||||||
void OpenGL_SetWindowText(const char *text);
|
void OpenGL_SetWindowText(const char *text);
|
||||||
void OpenGL_Shutdown();
|
void OpenGL_Shutdown();
|
||||||
void OpenGL_Update();
|
void OpenGL_Update();
|
||||||
|
u32 OpenGL_GetWidth();
|
||||||
|
u32 OpenGL_GetHeight();
|
||||||
|
void OpenGL_SetSize(u32 width, u32 height);
|
||||||
|
int OpenGL_GetXoff();
|
||||||
|
int OpenGL_GetYoff();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user