mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-11 00:29:11 +01:00
More cleanup in gl plugin
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2337 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
b211200460
commit
3331a024c0
@ -64,16 +64,11 @@ void BPInit()
|
|||||||
At the end of every: OpcodeDecoding.cpp ExecuteDisplayList > Decode() > LoadBPReg
|
At the end of every: OpcodeDecoding.cpp ExecuteDisplayList > Decode() > LoadBPReg
|
||||||
TODO:
|
TODO:
|
||||||
Turn into function table. The (future) DL jit can then call the functions directly,
|
Turn into function table. The (future) DL jit can then call the functions directly,
|
||||||
getting rid of dynamic dispatch.
|
getting rid of dynamic dispatch. Unfortunately, few games use DLs properly - most\
|
||||||
|
just stuff geometry in them and don't put state changes there.
|
||||||
// ------------------ */
|
// ------------------ */
|
||||||
void BPWritten(int addr, int changes, int newval)
|
void BPWritten(int addr, int changes, int newval)
|
||||||
{
|
{
|
||||||
//static int count = 0;
|
|
||||||
//ERROR_LOG("(%d) %x: %x\n", count++, addr, newval);
|
|
||||||
|
|
||||||
//Console::Print("BPWritten: 0x%02x %i %i %i\n", addr, changes, newval, (int)bpmem.copyTexSrcWH.y);
|
|
||||||
//if(addr == 0x49) PanicAlert("0x49");
|
|
||||||
|
|
||||||
switch (addr)
|
switch (addr)
|
||||||
{
|
{
|
||||||
case BPMEM_GENMODE:
|
case BPMEM_GENMODE:
|
||||||
@ -173,8 +168,8 @@ void BPWritten(int addr, int changes, int newval)
|
|||||||
glPointSize((float)bpmem.lineptwidth.pointsize * fratio / 6.0f);
|
glPointSize((float)bpmem.lineptwidth.pointsize * fratio / 6.0f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0x43:
|
case 0x43: // ????
|
||||||
if (changes) {
|
if (changes) {
|
||||||
VertexManager::Flush();
|
VertexManager::Flush();
|
||||||
((u32*)&bpmem)[addr] = newval;
|
((u32*)&bpmem)[addr] = newval;
|
||||||
@ -368,13 +363,13 @@ void BPWritten(int addr, int changes, int newval)
|
|||||||
DebugLog("SetPEToken + INT 0x%04x", (newval & 0xFFFF));
|
DebugLog("SetPEToken + INT 0x%04x", (newval & 0xFFFF));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x67: // Set gp metric?
|
case BPMEM_SETGPMETRIC: // Set gp metric?
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// ===============================================================
|
// ===============================================================
|
||||||
// This case writes to bpmem.triggerEFBCopy and may apparently prompt us to update glScissor()
|
// This case writes to bpmem.triggerEFBCopy and may apparently prompt us to update glScissor()
|
||||||
// ------------------------
|
// ------------------------
|
||||||
case 0x52:
|
case BPMEM_TRIGGER_EFB_COPY:
|
||||||
{
|
{
|
||||||
DVSTARTSUBPROFILE("LoadBPReg:swap");
|
DVSTARTSUBPROFILE("LoadBPReg:swap");
|
||||||
VertexManager::Flush();
|
VertexManager::Flush();
|
||||||
@ -416,7 +411,10 @@ void BPWritten(int addr, int changes, int newval)
|
|||||||
glViewport(rc.left,rc.bottom, rc.right,rc.top);
|
glViewport(rc.left,rc.bottom, rc.right,rc.top);
|
||||||
glScissor(rc.left,rc.bottom, rc.right,rc.top);
|
glScissor(rc.left,rc.bottom, rc.right,rc.top);
|
||||||
// Logging
|
// Logging
|
||||||
GLScissorX = rc.left; GLScissorY = rc.bottom; GLScissorW = rc.right; GLScissorH = rc.top;
|
GLScissorX = rc.left;
|
||||||
|
GLScissorY = rc.bottom;
|
||||||
|
GLScissorW = rc.right;
|
||||||
|
GLScissorH = rc.top;
|
||||||
}
|
}
|
||||||
else if (g_Config.bCopyEFBToRAM)
|
else if (g_Config.bCopyEFBToRAM)
|
||||||
{
|
{
|
||||||
@ -451,7 +449,7 @@ void BPWritten(int addr, int changes, int newval)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Renderer::Swap(multirc);
|
Renderer::Swap();
|
||||||
}
|
}
|
||||||
g_VideoInitialize.pCopiedToXFB();
|
g_VideoInitialize.pCopiedToXFB();
|
||||||
}
|
}
|
||||||
@ -535,8 +533,7 @@ void BPWritten(int addr, int changes, int newval)
|
|||||||
break;
|
break;
|
||||||
// ==================================
|
// ==================================
|
||||||
|
|
||||||
|
case BPMEM_LOADTLUT:
|
||||||
case 0x65: //GXLoadTlut
|
|
||||||
{
|
{
|
||||||
DVSTARTSUBPROFILE("LoadBPReg:GXLoadTlut");
|
DVSTARTSUBPROFILE("LoadBPReg:GXLoadTlut");
|
||||||
VertexManager::Flush();
|
VertexManager::Flush();
|
||||||
@ -563,7 +560,6 @@ void BPWritten(int addr, int changes, int newval)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
switch(addr & 0xFC) //texture sampler filter
|
switch(addr & 0xFC) //texture sampler filter
|
||||||
{
|
{
|
||||||
|
@ -804,3 +804,65 @@ void OpenGL_Shutdown()
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HandleGLError()
|
||||||
|
{
|
||||||
|
const GLubyte* pstr = glGetString(GL_PROGRAM_ERROR_STRING_ARB);
|
||||||
|
if (pstr != NULL && pstr[0] != 0)
|
||||||
|
{
|
||||||
|
GLint loc = 0;
|
||||||
|
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &loc);
|
||||||
|
ERROR_LOG("program error at %d: ", loc);
|
||||||
|
ERROR_LOG((char*)pstr);
|
||||||
|
ERROR_LOG("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// check the error status of this framebuffer */
|
||||||
|
GLenum error = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
||||||
|
|
||||||
|
// if error != GL_FRAMEBUFFER_COMPLETE_EXT, there's an error of some sort
|
||||||
|
if (!error)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch(error)
|
||||||
|
{
|
||||||
|
case GL_FRAMEBUFFER_COMPLETE_EXT:
|
||||||
|
break;
|
||||||
|
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
|
||||||
|
ERROR_LOG("Error! missing a required image/buffer attachment!\n");
|
||||||
|
break;
|
||||||
|
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT:
|
||||||
|
ERROR_LOG("Error! has no images/buffers attached!\n");
|
||||||
|
break;
|
||||||
|
// case GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT:
|
||||||
|
// ERROR_LOG("Error! has an image/buffer attached in multiple locations!\n");
|
||||||
|
// break;
|
||||||
|
case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT:
|
||||||
|
ERROR_LOG("Error! has mismatched image/buffer dimensions!\n");
|
||||||
|
break;
|
||||||
|
case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT:
|
||||||
|
ERROR_LOG("Error! colorbuffer attachments have different types!\n");
|
||||||
|
break;
|
||||||
|
case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT:
|
||||||
|
ERROR_LOG("Error! trying to draw to non-attached color buffer!\n");
|
||||||
|
break;
|
||||||
|
case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT:
|
||||||
|
ERROR_LOG("Error! trying to read from a non-attached color buffer!\n");
|
||||||
|
break;
|
||||||
|
case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
|
||||||
|
ERROR_LOG("Error! format is not supported by current graphics card/driver!\n");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ERROR_LOG("*UNKNOWN ERROR* reported from glCheckFramebufferStatusEXT()!\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleCgError(CGcontext ctx, CGerror err, void* appdata)
|
||||||
|
{
|
||||||
|
ERROR_LOG("Cg error: %s\n", cgGetErrorString(err));
|
||||||
|
const char* listing = cgGetLastListing(g_cgcontext);
|
||||||
|
if (listing != NULL) {
|
||||||
|
ERROR_LOG(" last listing: %s\n", listing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -65,7 +65,6 @@ CGprofile g_cgfProf;
|
|||||||
RasterFont* s_pfont = NULL;
|
RasterFont* s_pfont = NULL;
|
||||||
|
|
||||||
static bool s_bFullscreen = false;
|
static bool s_bFullscreen = false;
|
||||||
static bool s_bOutputCgErrors = true;
|
|
||||||
|
|
||||||
static int nZBufferRender = 0; // if > 0, then use zbuffer render, and count down.
|
static int nZBufferRender = 0; // if > 0, then use zbuffer render, and count down.
|
||||||
|
|
||||||
@ -776,7 +775,7 @@ Renderer::RenderMode Renderer::GetRenderMode()
|
|||||||
return s_RenderMode;
|
return s_RenderMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::Swap(const TRectangle& rc)
|
void Renderer::Swap()
|
||||||
{
|
{
|
||||||
OpenGL_Update(); // just updates the render window position and the backbuffer size
|
OpenGL_Update(); // just updates the render window position and the backbuffer size
|
||||||
|
|
||||||
@ -1011,76 +1010,6 @@ bool Renderer::SaveRenderTarget(const char* filename, int jpeg)
|
|||||||
return SaveTGA(filename, nBackbufferWidth, nBackbufferHeight, &data[0]);
|
return SaveTGA(filename, nBackbufferWidth, nBackbufferHeight, &data[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::SetCgErrorOutput(bool bOutput)
|
|
||||||
{
|
|
||||||
s_bOutputCgErrors = bOutput;
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleGLError()
|
|
||||||
{
|
|
||||||
const GLubyte* pstr = glGetString(GL_PROGRAM_ERROR_STRING_ARB);
|
|
||||||
if (pstr != NULL && pstr[0] != 0)
|
|
||||||
{
|
|
||||||
GLint loc = 0;
|
|
||||||
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &loc);
|
|
||||||
ERROR_LOG("program error at %d: ", loc);
|
|
||||||
ERROR_LOG((char*)pstr);
|
|
||||||
ERROR_LOG("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// check the error status of this framebuffer */
|
|
||||||
GLenum error = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
|
||||||
|
|
||||||
// if error != GL_FRAMEBUFFER_COMPLETE_EXT, there's an error of some sort
|
|
||||||
if (!error)
|
|
||||||
return;
|
|
||||||
|
|
||||||
switch(error)
|
|
||||||
{
|
|
||||||
case GL_FRAMEBUFFER_COMPLETE_EXT:
|
|
||||||
break;
|
|
||||||
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
|
|
||||||
ERROR_LOG("Error! missing a required image/buffer attachment!\n");
|
|
||||||
break;
|
|
||||||
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT:
|
|
||||||
ERROR_LOG("Error! has no images/buffers attached!\n");
|
|
||||||
break;
|
|
||||||
// case GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT:
|
|
||||||
// ERROR_LOG("Error! has an image/buffer attached in multiple locations!\n");
|
|
||||||
// break;
|
|
||||||
case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT:
|
|
||||||
ERROR_LOG("Error! has mismatched image/buffer dimensions!\n");
|
|
||||||
break;
|
|
||||||
case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT:
|
|
||||||
ERROR_LOG("Error! colorbuffer attachments have different types!\n");
|
|
||||||
break;
|
|
||||||
case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT:
|
|
||||||
ERROR_LOG("Error! trying to draw to non-attached color buffer!\n");
|
|
||||||
break;
|
|
||||||
case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT:
|
|
||||||
ERROR_LOG("Error! trying to read from a non-attached color buffer!\n");
|
|
||||||
break;
|
|
||||||
case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
|
|
||||||
ERROR_LOG("Error! format is not supported by current graphics card/driver!\n");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ERROR_LOG("*UNKNOWN ERROR* reported from glCheckFramebufferStatusEXT()!\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleCgError(CGcontext ctx, CGerror err, void* appdata)
|
|
||||||
{
|
|
||||||
if (s_bOutputCgErrors)
|
|
||||||
{
|
|
||||||
ERROR_LOG("Cg error: %s\n", cgGetErrorString(err));
|
|
||||||
const char* listing = cgGetLastListing(g_cgcontext);
|
|
||||||
if (listing != NULL) {
|
|
||||||
ERROR_LOG(" last listing: %s\n", listing);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Called from VertexShaderManager
|
// Called from VertexShaderManager
|
||||||
// ----------------------
|
// ----------------------
|
||||||
|
@ -96,11 +96,12 @@ public:
|
|||||||
// initialize opengl standard values (like viewport)
|
// initialize opengl standard values (like viewport)
|
||||||
static bool InitializeGL();
|
static bool InitializeGL();
|
||||||
|
|
||||||
static void SetCgErrorOutput(bool bOutput);
|
|
||||||
|
|
||||||
static void ResetGLState();
|
static void ResetGLState();
|
||||||
static void RestoreGLState();
|
static void RestoreGLState();
|
||||||
static bool IsUsingATIDrawBuffers();
|
|
||||||
|
static void SwapBuffers();
|
||||||
|
|
||||||
|
static bool IsUsingATIDrawBuffers();
|
||||||
static bool HaveStencilBuffer();
|
static bool HaveStencilBuffer();
|
||||||
|
|
||||||
static void SetColorMask();
|
static void SetColorMask();
|
||||||
@ -127,10 +128,7 @@ public:
|
|||||||
static bool SaveRenderTarget(const char* filename, int jpeg);
|
static bool SaveRenderTarget(const char* filename, int jpeg);
|
||||||
|
|
||||||
// Finish up the current frame, print some stats
|
// Finish up the current frame, print some stats
|
||||||
static void Swap(const TRectangle& rc);
|
static void Swap();
|
||||||
|
|
||||||
static void SwapBuffers();
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user