minor cleanup - don't leak so many fragment shaders :p also fix address range for the Generate Symbol Map feature

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3379 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2009-06-08 18:34:24 +00:00
parent e384c91313
commit fd5a4ee71a
4 changed files with 29 additions and 10 deletions

View File

@ -160,7 +160,7 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event)
break;
case IDM_SCANFUNCTIONS:
{
PPCAnalyst::FindFunctions(0x81300000, 0x81800000, &g_symbolDB);
PPCAnalyst::FindFunctions(0x80000000, 0x80400000, &g_symbolDB);
SignatureDB db;
if (db.Load((File::GetSysDirectory() + TOTALDB).c_str()))
db.Apply(&g_symbolDB);

View File

@ -27,6 +27,14 @@
struct FRAGMENTSHADER
{
FRAGMENTSHADER() : glprogid(0) { }
void Destroy()
{
if (glprogid)
{
glDeleteProgramsARB(1, &glprogid);
glprogid = 0;
}
}
GLuint glprogid; // opengl program id
#if defined(_DEBUG) || defined(DEBUGFAST)
std::string strprog;
@ -41,10 +49,9 @@ class PixelShaderCache
int frameCount;
PSCacheEntry() : frameCount(0) {}
~PSCacheEntry() {}
void Destroy() {
// printf("Destroying ps %i\n", shader.glprogid);
glDeleteProgramsARB(1, &shader.glprogid);
shader.glprogid = 0;
void Destroy()
{
shader.Destroy();
}
};

View File

@ -893,11 +893,12 @@ void Renderer::Swap(const TRectangle& rc)
// Tell the OSD Menu about the current internal resolution
OSDInternalW = rc.right; OSDInternalH = rc.bottom;
// ---------------------------------------------------------------------
// Apply AA
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
// Make sure that the wireframe setting doesn't screw up the screen copy.
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
// ---------------------------------------------------------------------
// Resolve the multisampled rendertarget into the normal one.
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
if (/*s_bHaveFramebufferBlit*/ s_MSAASamples > 1)
{
// Use framebuffer blit to stretch screen.
@ -953,6 +954,8 @@ void Renderer::Swap(const TRectangle& rc)
glDrawArrays(GL_QUADS, 0, 4);
*/
// Here's an opportunity to bind a fragment shader to do post processing.
glBegin(GL_QUADS);
glTexCoord2f(0, v_min); glVertex2f(-1, -1);
glTexCoord2f(0, v_max); glVertex2f(-1, 1);

View File

@ -40,13 +40,15 @@ const int renderBufferHeight = 1024;
static FRAGMENTSHADER s_rgbToYuyvProgram;
static FRAGMENTSHADER s_yuyvToRgbProgram;
// todo - store shaders in a smarter way - there are not 64 different copy texture formats
// Not all slots are taken - but who cares.
const u32 NUM_ENCODING_PROGRAMS = 64;
static FRAGMENTSHADER s_encodingPrograms[NUM_ENCODING_PROGRAMS];
void CreateRgbToYuyvProgram()
{
// output is BGRA because that is slightly faster than RGBA
// Output is BGRA because that is slightly faster than RGBA.
// TODO: Use the dot() function for faster dot products. Probably mostly helps ATI (nvidia is scalar anyway).
const char *FProgram =
"uniform samplerRECT samp0 : register(s0);\n"
"void main(\n"
@ -152,6 +154,13 @@ void Shutdown()
glDeleteTextures(1, &s_srcTexture);
glDeleteRenderbuffersEXT(1, &s_dstRenderBuffer);
glDeleteFramebuffersEXT(1, &s_texConvFrameBuffer);
s_rgbToYuyvProgram.Destroy();
s_yuyvToRgbProgram.Destroy();
for (int i = 0; i < NUM_ENCODING_PROGRAMS; i++)
s_encodingPrograms[i].Destroy();
s_srcTexture = 0;
s_dstRenderBuffer = 0;
s_texConvFrameBuffer = 0;