OpenGL Plugin: code cleanup trying to follow code style wiki and updated copyright date

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2850 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
omegadox 2009-04-03 14:35:49 +00:00
parent 41058700c9
commit 6736898486
38 changed files with 329 additions and 282 deletions

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -15,9 +15,6 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// ---------------------------------------------------------------------------------------
// includes
// -------------
#include "Globals.h" #include "Globals.h"
#include "Profiler.h" #include "Profiler.h"
#include "Config.h" #include "Config.h"
@ -37,9 +34,10 @@
#include "XFB.h" #include "XFB.h"
#include "main.h" #include "main.h"
// --------------------------------------------------------------------------------------- // ----------------------------------------------
// State translation lookup tables // State translation lookup tables
// ------------- // Reference: Yet Another Gamecube Documentation
// ----------------------------------------------
static const GLenum glCmpFuncs[8] = { static const GLenum glCmpFuncs[8] = {
GL_NEVER, GL_LESS, GL_EQUAL, GL_LEQUAL, GL_GREATER, GL_NOTEQUAL, GL_GEQUAL, GL_ALWAYS GL_NEVER, GL_LESS, GL_EQUAL, GL_LEQUAL, GL_GREATER, GL_NOTEQUAL, GL_GEQUAL, GL_ALWAYS
@ -56,16 +54,16 @@ void BPInit()
bpmem.bpMask = 0xFFFFFF; bpmem.bpMask = 0xFFFFFF;
} }
////////////////////////////////////////////////////////////////////////////////////// // ----------------------------------------------------------------------------------------------------------
// Write to bpmem // Write to the BreakPoint Memory
/* ------------------ /* ------------------
Called: Called:
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) DisplayList (DL) jit can then call the functions directly,
getting rid of dynamic dispatch. Unfortunately, few games use DLs properly - most\ getting rid of dynamic dispatch. Unfortunately, few games use DLs properly - most\
just stuff geometry in them and don't put state changes there. 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)
{ {
switch (addr) switch (addr)
@ -183,48 +181,28 @@ void BPWritten(int addr, int changes, int newval)
bpmem.blendmode.blendenable, bpmem.blendmode.logicopenable, bpmem.blendmode.colorupdate, bpmem.blendmode.alphaupdate, bpmem.blendmode.blendenable, bpmem.blendmode.logicopenable, bpmem.blendmode.colorupdate, bpmem.blendmode.alphaupdate,
bpmem.blendmode.dstfactor, bpmem.blendmode.srcfactor, bpmem.blendmode.subtract, bpmem.blendmode.logicmode); bpmem.blendmode.dstfactor, bpmem.blendmode.srcfactor, bpmem.blendmode.subtract, bpmem.blendmode.logicmode);
/* // Set LogicOp Blending Mode
Logic Operation Blend Modes if (changes & 2)
-------------------- {
0: GL_CLEAR
1: GL_AND
2: GL_AND_REVERSE
3: GL_COPY [Super Smash. Bro. Melee, NES Zelda I, NES Zelda II]
4: GL_AND_INVERTED
5: GL_NOOP
6: GL_XOR
7: GL_OR [Zelda: TP]
8: GL_NOR
9: GL_EQUIV
10: GL_INVERT
11: GL_OR_REVERSE
12: GL_COPY_INVERTED
13: GL_OR_INVERTED
14: GL_NAND
15: GL_SET
*/
// LogicOp Blending
if (changes & 2) {
SETSTAT(stats.logicOpMode, bpmem.blendmode.logicopenable != 0 ? bpmem.blendmode.logicmode : stats.logicOpMode); SETSTAT(stats.logicOpMode, bpmem.blendmode.logicopenable != 0 ? bpmem.blendmode.logicmode : stats.logicOpMode);
if (bpmem.blendmode.logicopenable) if (bpmem.blendmode.logicopenable)
{ {
glEnable(GL_COLOR_LOGIC_OP); glEnable(GL_COLOR_LOGIC_OP);
// PanicAlert("Logic Op Blend : %i", bpmem.blendmode.logicmode);
glLogicOp(glLogicOpCodes[bpmem.blendmode.logicmode]); glLogicOp(glLogicOpCodes[bpmem.blendmode.logicmode]);
} }
else else
glDisable(GL_COLOR_LOGIC_OP); glDisable(GL_COLOR_LOGIC_OP);
} }
// Dithering // Set Dithering Mode
if (changes & 4) { if (changes & 4)
{
SETSTAT(stats.dither, bpmem.blendmode.dither); SETSTAT(stats.dither, bpmem.blendmode.dither);
if (bpmem.blendmode.dither) glEnable(GL_DITHER); if (bpmem.blendmode.dither) glEnable(GL_DITHER);
else glDisable(GL_DITHER); else glDisable(GL_DITHER);
} }
// Blending // Set Blending Mode
if (changes & 0xFE1) if (changes & 0xFE1)
{ {
SETSTAT(stats.srcFactor, bpmem.blendmode.srcfactor); SETSTAT(stats.srcFactor, bpmem.blendmode.srcfactor);
@ -232,7 +210,7 @@ void BPWritten(int addr, int changes, int newval)
Renderer::SetBlendMode(false); Renderer::SetBlendMode(false);
} }
// Color Mask // Set Color Mask
if (changes & 0x18) if (changes & 0x18)
{ {
SETSTAT(stats.alphaUpdate, bpmem.blendmode.alphaupdate); SETSTAT(stats.alphaUpdate, bpmem.blendmode.alphaupdate);

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -15,8 +15,8 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _BPSTRUCTS_H #ifndef _BPSTRUCTS_H_
#define _BPSTRUCTS_H #define _BPSTRUCTS_H_
#include "BPMemory.h" #include "BPMemory.h"
@ -24,4 +24,4 @@ void BPInit();
void LoadBPReg(u32 value0); void LoadBPReg(u32 value0);
void BPReload(); void BPReload();
#endif #endif // _BPSTRUCTS_H_

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -15,8 +15,8 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _PLUGIN_VIDEOOGL_CONFIG_H #ifndef _PLUGIN_VIDEOOGL_CONFIG_H_
#define _PLUGIN_VIDEOOGL_CONFIG_H #define _PLUGIN_VIDEOOGL_CONFIG_H_
#include "Common.h" #include "Common.h"
@ -107,4 +107,4 @@ private:
extern Config g_Config; extern Config g_Config;
#endif // _PLUGIN_VIDEOOGL_CONFIG_H #endif // _PLUGIN_VIDEOOGL_CONFIG_H_

View File

@ -15,17 +15,17 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "../Globals.h" // The precompiled header
#include "IniFile.h" // Common #include "IniFile.h"
#include "../Config.h" // Config settings
#include "Debugger.h" #include "Debugger.h"
#include "../Config.h"
#include "../Globals.h"
extern int gPreset; extern int g_Preset;
BEGIN_EVENT_TABLE(CDebugger,wxDialog) BEGIN_EVENT_TABLE(CDebugger,wxDialog)
EVT_CLOSE(CDebugger::OnClose) EVT_CLOSE(CDebugger::OnClose)
EVT_CHECKBOX(ID_SAVETOFILE,CDebugger::GeneralSettings) EVT_CHECKBOX(ID_SAVETOFILE,CDebugger::GeneralSettings)
EVT_CHECKBOX(ID_SHOWCONSOLE,CDebugger::GeneralSettings) EVT_CHECKBOX(ID_SHOWCONSOLE,CDebugger::GeneralSettings)
EVT_CHECKBOX(ID_INFOLOG,CDebugger::GeneralSettings) EVT_CHECKBOX(ID_INFOLOG,CDebugger::GeneralSettings)
@ -61,7 +61,7 @@ void CDebugger::OnClose(wxCloseEvent& event)
void CDebugger::DoShowConsole() void CDebugger::DoShowConsole()
{ {
ConsoleListener* console = LogManager::GetInstance()->getConsoleListener(); ConsoleListener* console = LogManager::GetInstance()->getConsoleListener();
if(m_Check[1]->IsChecked() && console->IsOpen()) if (m_Check[1]->IsChecked() && console->IsOpen())
console->Open(); console->Open();
else else
console->Close(); console->Close();
@ -75,21 +75,25 @@ void CDebugger::SaveSettings() const
// TODO: make this work when we close the entire program too, currently on total close we get // TODO: make this work when we close the entire program too, currently on total close we get
// weird values, perhaps because of some conflict with the rendering window // weird values, perhaps because of some conflict with the rendering window
// TODO: get the screen resolution and make limits from that // TODO: get the screen resolution and make limits from that
if(GetPosition().x < 1000 && GetPosition().y < 1000 if (GetPosition().x < 1000 && GetPosition().y < 1000
&& GetSize().GetWidth() < 1000 && GetSize().GetHeight() < 1000) && GetSize().GetWidth() < 1000
&& GetSize().GetHeight() < 1000)
{ {
file.Set("VideoWindow", "x", GetPosition().x); file.Set("VideoWindow", "x", GetPosition().x);
file.Set("VideoWindow", "y", GetPosition().y); file.Set("VideoWindow", "y", GetPosition().y);
file.Set("VideoWindow", "w", GetSize().GetWidth()); file.Set("VideoWindow", "w", GetSize().GetWidth());
file.Set("VideoWindow", "h", GetSize().GetHeight()); file.Set("VideoWindow", "h", GetSize().GetHeight());
} }
file.Set("VideoWindow", "WriteToFile", m_Check[0]->IsChecked()); file.Set("VideoWindow", "WriteToFile", m_Check[0]->IsChecked());
file.Set("VideoWindow", "Console", m_Check[1]->IsChecked()); file.Set("VideoWindow", "Console", m_Check[1]->IsChecked());
g_Config.iLog = bInfoLog ? CONF_LOG : 0; g_Config.iLog = bInfoLog ? CONF_LOG : 0;
g_Config.iLog |= bPrimLog ? CONF_PRIMLOG : 0; g_Config.iLog |= bPrimLog ? CONF_PRIMLOG : 0;
g_Config.iLog |= bSaveTextures ? CONF_SAVETEXTURES : 0; g_Config.iLog |= bSaveTextures ? CONF_SAVETEXTURES : 0;
g_Config.iLog |= bSaveTargets ? CONF_SAVETARGETS : 0; g_Config.iLog |= bSaveTargets ? CONF_SAVETARGETS : 0;
g_Config.iLog |= bSaveShaders ? CONF_SAVESHADERS : 0; g_Config.iLog |= bSaveShaders ? CONF_SAVESHADERS : 0;
file.Set("VideoWindow", "ConfBits", g_Config.iLog); file.Set("VideoWindow", "ConfBits", g_Config.iLog);
file.Save(DEBUGGER_CONFIG_FILE); file.Save(DEBUGGER_CONFIG_FILE);
@ -142,6 +146,7 @@ void CDebugger::CreateGUIControls()
m_Check[4] = new wxCheckBox(m_MainPanel, ID_SAVETEXTURES, wxT("Save Textures"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_Check[4] = new wxCheckBox(m_MainPanel, ID_SAVETEXTURES, wxT("Save Textures"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[5] = new wxCheckBox(m_MainPanel, ID_SAVETARGETS, wxT("Save Targets"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_Check[5] = new wxCheckBox(m_MainPanel, ID_SAVETARGETS, wxT("Save Targets"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[6] = new wxCheckBox(m_MainPanel, ID_SAVESHADERS, wxT("Save Shaders"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_Check[6] = new wxCheckBox(m_MainPanel, ID_SAVESHADERS, wxT("Save Shaders"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
for (int i = 0; i < NUM_OPTIONS-ID_SAVETOFILE; ++i) for (int i = 0; i < NUM_OPTIONS-ID_SAVETOFILE; ++i)
sOptions->Add(m_Check[i], 0, 0, 5); sOptions->Add(m_Check[i], 0, 0, 5);
@ -153,7 +158,6 @@ void CDebugger::CreateGUIControls()
Fit(); Fit();
} }
//////////////////////////////////////////////////////////////////////////
// General settings // General settings
void CDebugger::GeneralSettings(wxCommandEvent& event) void CDebugger::GeneralSettings(wxCommandEvent& event)
{ {

View File

@ -15,8 +15,8 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef __CDebugger_h__ #ifndef _CDEBUGGER_H_
#define __CDebugger_h__ #define _CDEBUGGER_H_
#include <wx/wx.h> #include <wx/wx.h>
#include <wx/notebook.h> #include <wx/notebook.h>
@ -30,7 +30,7 @@ class CDebugger : public wxDialog
public: public:
CDebugger(wxWindow *parent, CDebugger(wxWindow *parent,
wxWindowID id = 1, wxWindowID id = 1,
const wxString &title = wxT("OGL Debug"), const wxString &title = wxT("OGL Debugguer"),
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE); long style = wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE);
@ -61,7 +61,6 @@ private:
enum enum
{ {
ID_MAINPANEL = 2000, ID_MAINPANEL = 2000,
ID_SAVETOFILE, ID_SAVETOFILE,
ID_SHOWCONSOLE, ID_SHOWCONSOLE,
ID_INFOLOG, ID_INFOLOG,
@ -76,4 +75,5 @@ private:
void OnClose(wxCloseEvent& event); void OnClose(wxCloseEvent& event);
void CreateGUIControls(); void CreateGUIControls();
}; };
#endif
#endif // _CDEBUGGER_H_

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -66,11 +66,13 @@ void OpenGL_SwapBuffers()
#endif #endif
} }
u32 OpenGL_GetBackbufferWidth() { u32 OpenGL_GetBackbufferWidth()
{
return s_backbuffer_width; return s_backbuffer_width;
} }
u32 OpenGL_GetBackbufferHeight() { u32 OpenGL_GetBackbufferHeight()
{
return s_backbuffer_height; return s_backbuffer_height;
} }

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -15,8 +15,8 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _GLINIT_H #ifndef _GLINIT_H_
#define _GLINIT_H #define _GLINIT_H_
#if defined GLTEST && GLTEST #if defined GLTEST && GLTEST
#include "nGLUtil.h" #include "nGLUtil.h"
@ -149,4 +149,4 @@ bool OpenGL_ReportFBOError(const char *function, const char *file, int line);
#endif // GLTEST ?? #endif // GLTEST ??
#endif // include braces #endif // _GLINIT_H_

View File

@ -1,5 +1,22 @@
#ifndef _GLWINDOW_H // Copyright (C) 2003-2009 Dolphin Project.
#define _GLWINDOW_H
// 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 _GLWINDOW_H_
#define _GLWINDOW_H_
#include <vector> #include <vector>
#include "Common.h" #include "Common.h"
@ -24,14 +41,16 @@
#else #else
#include <GL/gl.h> #include <GL/gl.h>
#endif #endif
enum OGL_Props { enum OGL_Props
{
OGL_FULLSCREEN, OGL_FULLSCREEN,
OGL_KEEPRATIO, OGL_KEEPRATIO,
OGL_HIDECURSOR, OGL_HIDECURSOR,
OGL_PROP_COUNT OGL_PROP_COUNT
}; };
struct res { struct res
{
u32 x; u32 x;
u32 y; u32 y;
}; };
@ -52,16 +71,19 @@ protected:
EventHandler* eventHandler; EventHandler* eventHandler;
res origRes, currFullRes, currWinRes; res origRes, currFullRes, currWinRes;
static std::vector<res> fullResolutions; static std::vector<res> fullResolutions;
virtual void SetRender(u32 x, u32 y) { virtual void SetRender(u32 x, u32 y)
{
xRender = x; xRender = x;
yRender = y; yRender = y;
} }
static const std::vector<res>& getFsResolutions() { static const std::vector<res>& getFsResolutions()
{
return fullResolutions; return fullResolutions;
} }
static void addFSResolution(res fsr) { static void addFSResolution(res fsr)
{
fullResolutions.push_back(fsr); fullResolutions.push_back(fsr);
} }
public: public:
@ -98,19 +120,22 @@ public:
u32 GetXwin() {return xWin;} u32 GetXwin() {return xWin;}
u32 GetYwin() {return yWin;} u32 GetYwin() {return yWin;}
void SetWinSize(u32 x, u32 y) { void SetWinSize(u32 x, u32 y)
{
xWin = x; xWin = x;
yWin = y; yWin = y;
} }
int GetYoff() {return yOffset;} int GetYoff() {return yOffset;}
int GetXoff() {return xOffset;} int GetXoff() {return xOffset;}
void SetOffset(int x, int y) { void SetOffset(int x, int y)
{
yOffset = y; yOffset = y;
xOffset = x; xOffset = x;
} }
void SetMax(float x, float y) { void SetMax(float x, float y)
{
yMax = y; yMax = y;
xMax = x; xMax = x;
} }
@ -142,4 +167,4 @@ public:
// resolution iter // resolution iter
}; };
#endif #endif // _GLWINDOW_H_

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -15,8 +15,8 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef __OGL_CONFIGDIALOG_h__ #ifndef _OGL_CONFIGDIALOG_H_
#define __OGL_CONFIGDIALOG_h__ #define _OGL_CONFIGDIALOG_H_
#include <wx/wx.h> #include <wx/wx.h>
#include <wx/dialog.h> #include <wx/dialog.h>
@ -183,4 +183,4 @@ class ConfigDialog : public wxDialog
void AdvancedSettingsChanged(wxCommandEvent& event); void AdvancedSettingsChanged(wxCommandEvent& event);
}; };
#endif #endif // _OGL_CONFIGDIALOG_H_

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -15,8 +15,8 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _GLOBALS_H #ifndef _GLOBALS_H_
#define _GLOBALS_H #define _GLOBALS_H_
#include "Common.h" #include "Common.h"
#include "Config.h" #include "Config.h"
@ -27,4 +27,4 @@
// A global plugin specification // A global plugin specification
extern PLUGIN_GLOBALS* globals; extern PLUGIN_GLOBALS* globals;
#endif // _GLOBALS_H #endif // _GLOBALS_H_

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -77,9 +77,8 @@ GLVertexFormat::GLVertexFormat()
{ {
#ifdef USE_JIT #ifdef USE_JIT
m_compiledCode = (u8 *)AllocateExecutableMemory(COMPILED_CODE_SIZE, false); m_compiledCode = (u8 *)AllocateExecutableMemory(COMPILED_CODE_SIZE, false);
if (m_compiledCode) { if (m_compiledCode)
memset(m_compiledCode, 0, COMPILED_CODE_SIZE); memset(m_compiledCode, 0, COMPILED_CODE_SIZE);
}
#endif #endif
} }
@ -102,10 +101,9 @@ void GLVertexFormat::Initialize(const PortableVertexDeclaration &_vtx_decl)
vertex_stride = _vtx_decl.stride; vertex_stride = _vtx_decl.stride;
using namespace Gen; using namespace Gen;
if (_vtx_decl.stride & 3) { // We will not allow vertex components causing uneven strides.
// We will not allow vertex components causing uneven strides. if (_vtx_decl.stride & 3)
PanicAlert("Uneven vertex stride: %i", _vtx_decl.stride); PanicAlert("Uneven vertex stride: %i", _vtx_decl.stride);
}
#ifdef USE_JIT #ifdef USE_JIT
Gen::XEmitter emit(m_compiledCode); Gen::XEmitter emit(m_compiledCode);
@ -114,7 +112,8 @@ void GLVertexFormat::Initialize(const PortableVertexDeclaration &_vtx_decl)
emit.CallCdeclFunction4_I(glVertexPointer, 3, GL_FLOAT, _vtx_decl.stride, 0); emit.CallCdeclFunction4_I(glVertexPointer, 3, GL_FLOAT, _vtx_decl.stride, 0);
if (_vtx_decl.num_normals >= 1) { if (_vtx_decl.num_normals >= 1)
{
emit.CallCdeclFunction3_I(glNormalPointer, VarToGL(_vtx_decl.normal_gl_type), _vtx_decl.stride, _vtx_decl.normal_offset[0]); emit.CallCdeclFunction3_I(glNormalPointer, VarToGL(_vtx_decl.normal_gl_type), _vtx_decl.stride, _vtx_decl.normal_offset[0]);
if (_vtx_decl.num_normals == 3) { if (_vtx_decl.num_normals == 3) {
emit.CallCdeclFunction6((void *)glVertexAttribPointer, SHADER_NORM1_ATTRIB, _vtx_decl.normal_gl_size, VarToGL(_vtx_decl.normal_gl_type), GL_TRUE, _vtx_decl.stride, _vtx_decl.normal_offset[1]); emit.CallCdeclFunction6((void *)glVertexAttribPointer, SHADER_NORM1_ATTRIB, _vtx_decl.normal_gl_size, VarToGL(_vtx_decl.normal_gl_type), GL_TRUE, _vtx_decl.stride, _vtx_decl.normal_offset[1]);
@ -122,8 +121,10 @@ void GLVertexFormat::Initialize(const PortableVertexDeclaration &_vtx_decl)
} }
} }
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++)
if (_vtx_decl.color_offset[i] != -1) { {
if (_vtx_decl.color_offset[i] != -1)
{
if (i == 0) if (i == 0)
emit.CallCdeclFunction4_I(glColorPointer, 4, GL_UNSIGNED_BYTE, _vtx_decl.stride, _vtx_decl.color_offset[i]); emit.CallCdeclFunction4_I(glColorPointer, 4, GL_UNSIGNED_BYTE, _vtx_decl.stride, _vtx_decl.color_offset[i]);
else else
@ -160,15 +161,13 @@ void GLVertexFormat::Initialize(const PortableVertexDeclaration &_vtx_decl)
} }
} }
if (_vtx_decl.posmtx_offset != -1) { if (_vtx_decl.posmtx_offset != -1)
emit.CallCdeclFunction6((void *)glVertexAttribPointer, SHADER_POSMTX_ATTRIB, 4, GL_UNSIGNED_BYTE, GL_FALSE, _vtx_decl.stride, _vtx_decl.posmtx_offset); emit.CallCdeclFunction6((void *)glVertexAttribPointer, SHADER_POSMTX_ATTRIB, 4, GL_UNSIGNED_BYTE, GL_FALSE, _vtx_decl.stride, _vtx_decl.posmtx_offset);
}
emit.ABI_EmitEpilogue(6); emit.ABI_EmitEpilogue(6);
if (emit.GetCodePtr() - (u8*)m_compiledCode > COMPILED_CODE_SIZE) if (emit.GetCodePtr() - (u8*)m_compiledCode > COMPILED_CODE_SIZE)
{
Crash(); Crash();
}
#endif #endif
this->vtx_decl = _vtx_decl; this->vtx_decl = _vtx_decl;
@ -215,11 +214,13 @@ void GLVertexFormat::SetupVertexPointers() const {
void GLVertexFormat::EnableComponents(u32 components) void GLVertexFormat::EnableComponents(u32 components)
{ {
if (s_prevcomponents != components) { if (s_prevcomponents != components)
{
VertexManager::Flush(); VertexManager::Flush();
// matrices // matrices
if ((components & VB_HAS_POSMTXIDX) != (s_prevcomponents & VB_HAS_POSMTXIDX)) { if ((components & VB_HAS_POSMTXIDX) != (s_prevcomponents & VB_HAS_POSMTXIDX))
{
if (components & VB_HAS_POSMTXIDX) if (components & VB_HAS_POSMTXIDX)
glEnableVertexAttribArray(SHADER_POSMTX_ATTRIB); glEnableVertexAttribArray(SHADER_POSMTX_ATTRIB);
else else
@ -227,13 +228,15 @@ void GLVertexFormat::EnableComponents(u32 components)
} }
// normals // normals
if ((components & VB_HAS_NRM0) != (s_prevcomponents & VB_HAS_NRM0)) { if ((components & VB_HAS_NRM0) != (s_prevcomponents & VB_HAS_NRM0))
{
if (components & VB_HAS_NRM0) if (components & VB_HAS_NRM0)
glEnableClientState(GL_NORMAL_ARRAY); glEnableClientState(GL_NORMAL_ARRAY);
else else
glDisableClientState(GL_NORMAL_ARRAY); glDisableClientState(GL_NORMAL_ARRAY);
} }
if ((components & VB_HAS_NRM1) != (s_prevcomponents & VB_HAS_NRM1)) { if ((components & VB_HAS_NRM1) != (s_prevcomponents & VB_HAS_NRM1))
{
if (components & VB_HAS_NRM1) { if (components & VB_HAS_NRM1) {
glEnableVertexAttribArray(SHADER_NORM1_ATTRIB); glEnableVertexAttribArray(SHADER_NORM1_ATTRIB);
glEnableVertexAttribArray(SHADER_NORM2_ATTRIB); glEnableVertexAttribArray(SHADER_NORM2_ATTRIB);
@ -245,8 +248,10 @@ void GLVertexFormat::EnableComponents(u32 components)
} }
// color // color
for (int i = 0; i < 2; ++i) { for (int i = 0; i < 2; ++i)
if ((components & (VB_HAS_COL0 << i)) != (s_prevcomponents & (VB_HAS_COL0 << i))) { {
if ((components & (VB_HAS_COL0 << i)) != (s_prevcomponents & (VB_HAS_COL0 << i)))
{
if (components & (VB_HAS_COL0 << 0)) if (components & (VB_HAS_COL0 << 0))
glEnableClientState(i ? GL_SECONDARY_COLOR_ARRAY : GL_COLOR_ARRAY); glEnableClientState(i ? GL_SECONDARY_COLOR_ARRAY : GL_COLOR_ARRAY);
else else
@ -255,34 +260,34 @@ void GLVertexFormat::EnableComponents(u32 components)
} }
// tex // tex
if (!g_Config.bDisableTexturing) { for (int i = 0; i < 8; ++i)
for (int i = 0; i < 8; ++i) {
if ((components & (VB_HAS_UV0 << i)) != (s_prevcomponents & (VB_HAS_UV0 << i))) {
glClientActiveTexture(GL_TEXTURE0 + i);
if (components & (VB_HAS_UV0 << i))
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
else
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
}
}
else // Disable Texturing
{ {
for (int i = 0; i < 8; ++i) { if ((components & (VB_HAS_UV0 << i)) != (s_prevcomponents & (VB_HAS_UV0 << i)) && !g_Config.bDisableTexturing)
{
glClientActiveTexture(GL_TEXTURE0 + i);
if (components & (VB_HAS_UV0 << i))
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
else
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
else
{
glClientActiveTexture(GL_TEXTURE0 + i); glClientActiveTexture(GL_TEXTURE0 + i);
glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY);
} }
} }
// Disable Lighting // Disable Lighting
// TODO - move to better spot // TODO - Is this a good spot for this code?
if (g_Config.bDisableLighting) { if (g_Config.bDisableLighting)
{
for (int i = 0; i < xfregs.nNumChans; i++) for (int i = 0; i < xfregs.nNumChans; i++)
{ {
xfregs.colChans[i].alpha.enablelighting = false; xfregs.colChans[i].alpha.enablelighting = false;
xfregs.colChans[i].color.enablelighting = false; xfregs.colChans[i].color.enablelighting = false;
} }
} }
s_prevcomponents = components; s_prevcomponents = components;
} }
} }

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -15,11 +15,6 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
//////////////////////////////////////////////////////////////////////////////////////////
// Include
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
#include <windows.h> #include <windows.h>
#include <wx/wx.h> #include <wx/wx.h>
@ -28,27 +23,19 @@
#include <wx/dialog.h> #include <wx/dialog.h>
#include <wx/aboutdlg.h> #include <wx/aboutdlg.h>
#include "../Globals.h" // Local #include "../Globals.h"
#include "../Config.h" #include "../Config.h"
#include "main.h" #include "main.h"
#include "Win32.h" #include "Win32.h"
#include "OnScreenDisplay.h" // for AddMessage #include "OnScreenDisplay.h"
#include "StringUtil.h" // Common: For StringFromFormat #include "StringUtil.h"
//////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Declarations and definitions
// ¯¯¯¯¯¯¯¯¯¯
//void OpenConsole(); //void OpenConsole();
//void CloseConsole(); //void CloseConsole();
HINSTANCE g_hInstance; HINSTANCE g_hInstance;
// ------------------------------------------------------
// WxWidgets
// ---------------
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
class wxDLLApp : public wxApp class wxDLLApp : public wxApp
{ {
@ -106,12 +93,10 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
void DoDllDebugger(); void DoDllDebugger();
extern bool gShowDebugger; extern bool gShowDebugger;
//////////////////////////////////
// ----------------------
//////////////////////////////////////////////////////////////////////////////////////////
// The rendering window // The rendering window
// ¯¯¯¯¯¯¯¯¯¯ // ----------------------
namespace EmuWindow namespace EmuWindow
{ {
@ -373,7 +358,7 @@ void Close()
// ------------------------------------------ // ------------------------------------------
// Set the size of the child or main window // Set the size of the child or main window
// ------------------ // ------------------------------------------
void SetSize(int width, int height) void SetSize(int width, int height)
{ {
RECT rc = {0, 0, width, height}; RECT rc = {0, 0, width, height};
@ -391,4 +376,3 @@ void SetSize(int width, int height)
} }
} // EmuWindow } // EmuWindow
////////////////////////////////////

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -15,6 +15,9 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _WIN32_H_
#define _WIN32_H_
#pragma once #pragma once
#include "stdafx.h" #include "stdafx.h"
@ -31,3 +34,5 @@ namespace EmuWindow
void Close(); void Close();
void SetSize(int displayWidth, int displayHeight); void SetSize(int displayWidth, int displayHeight);
} }
#endif // _WIN32_H_

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -15,8 +15,8 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _OSD_H #ifndef _OSD_H_
#define _OSD_H #define _OSD_H_
namespace OSD namespace OSD
{ {
@ -27,5 +27,5 @@ void DrawMessages(); // draw the current messages on the screen. Only call once
} // namespace } // namespace
#endif #endif // _OSD_H_

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -15,6 +15,9 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _PIXELSHADERCACHE_H_
#define _PIXELSHADERCACHE_H_
#include <map> #include <map>
#include <string> #include <string>
@ -63,3 +66,5 @@ public:
static GLuint GetColorMatrixProgram(); static GLuint GetColorMatrixProgram();
}; };
#endif // _PIXELSHADERCACHE_H_

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -1120,26 +1120,32 @@ void Renderer::Swap(const TRectangle& rc)
u8 *data = (u8 *) malloc(3 * w * h); u8 *data = (u8 *) malloc(3 * w * h);
glPixelStorei(GL_PACK_ALIGNMENT, 1); glPixelStorei(GL_PACK_ALIGNMENT, 1);
glReadPixels(0, 0, w, h, GL_BGR, GL_UNSIGNED_BYTE, data); glReadPixels(0, 0, w, h, GL_BGR, GL_UNSIGNED_BYTE, data);
if (glGetError() == GL_NO_ERROR) { if (glGetError() == GL_NO_ERROR)
if (!s_bLastFrameDumped) { {
if (!s_bLastFrameDumped)
{
s_bAVIDumping = AVIDump::Start(EmuWindow::GetChildParentWnd(), w, h); s_bAVIDumping = AVIDump::Start(EmuWindow::GetChildParentWnd(), w, h);
if (!s_bAVIDumping) { if (!s_bAVIDumping)
PanicAlert("Error dumping frames to AVI."); PanicAlert("Error dumping frames to AVI.");
} else { else
{
char msg [255]; char msg [255];
sprintf(msg, "Dumping Frames to \"%s/framedump0.avi\" (%dx%d RGB24)", FULL_FRAMES_DIR, w, h); sprintf(msg, "Dumping Frames to \"%s/framedump0.avi\" (%dx%d RGB24)", FULL_FRAMES_DIR, w, h);
OSD::AddMessage(msg, 2000); OSD::AddMessage(msg, 2000);
} }
} }
if (s_bAVIDumping) { if (s_bAVIDumping)
AVIDump::AddFrame((char *) data); AVIDump::AddFrame((char *) data);
}
s_bLastFrameDumped = true; s_bLastFrameDumped = true;
} }
free(data); free(data);
s_criticalScreenshot.Leave(); s_criticalScreenshot.Leave();
} else { }
if(s_bLastFrameDumped && s_bAVIDumping) { else
{
if(s_bLastFrameDumped && s_bAVIDumping)
{
AVIDump::Stop(); AVIDump::Stop();
s_bAVIDumping = false; s_bAVIDumping = false;
} }
@ -1199,8 +1205,6 @@ void Renderer::Swap(const TRectangle& rc)
// Renderer::SetZBufferRender(); // Renderer::SetZBufferRender();
// SaveTexture("tex.tga", GL_TEXTURE_RECTANGLE_ARB, s_FakeZTarget, GetTargetWidth(), GetTargetHeight()); // SaveTexture("tex.tga", GL_TEXTURE_RECTANGLE_ARB, s_FakeZTarget, GetTargetWidth(), GetTargetHeight());
} }
////////////////////////////////////////////////
void Renderer::DrawDebugText() void Renderer::DrawDebugText()
{ {
@ -1210,10 +1214,9 @@ void Renderer::DrawDebugText()
char debugtext_buffer[8192]; char debugtext_buffer[8192];
char *p = debugtext_buffer; char *p = debugtext_buffer;
p[0] = 0; p[0] = 0;
if (g_Config.bShowFPS) if (g_Config.bShowFPS)
{
p+=sprintf(p, "FPS: %d\n", s_fps); p+=sprintf(p, "FPS: %d\n", s_fps);
}
if (g_Config.bShowEFBCopyRegions) if (g_Config.bShowEFBCopyRegions)
{ {
@ -1331,9 +1334,9 @@ void Renderer::DrawDebugText()
Renderer::RenderText(debugtext_buffer, 20, 20, 0xFF00FFFF); Renderer::RenderText(debugtext_buffer, 20, 20, 0xFF00FFFF);
} }
////////////////////////////////////////////////////////////////////////////////////// // -------------------------------------------------------------------------------------------------------
// We can now draw whatever we want on top of the picture. Then we copy the final picture to the output. // We can now draw whatever we want on top of the picture. Then we copy the final picture to the output.
// ---------------------- // -------------------------------------------------------------------------------------------------------
void Renderer::SwapBuffers() void Renderer::SwapBuffers()
{ {
// Count FPS. // Count FPS.
@ -1357,7 +1360,6 @@ void Renderer::SwapBuffers()
DrawDebugText(); DrawDebugText();
OSD::DrawMessages(); OSD::DrawMessages();
// -----------------------------
#if defined(DVPROFILE) #if defined(DVPROFILE)
if (g_bWriteProfile) { if (g_bWriteProfile) {
@ -1391,8 +1393,10 @@ void Renderer::SwapBuffers()
// Render to the framebuffer. // Render to the framebuffer.
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, s_uFramebuffer); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, s_uFramebuffer);
if (nZBufferRender > 0) { if (nZBufferRender > 0)
if (--nZBufferRender == 0) { {
if (--nZBufferRender == 0)
{
// turn off // turn off
nZBufferRender = 0; nZBufferRender = 0;
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
@ -1400,6 +1404,7 @@ void Renderer::SwapBuffers()
Renderer::SetRenderMode(RM_Normal); // turn off any zwrites Renderer::SetRenderMode(RM_Normal); // turn off any zwrites
} }
} }
GL_REPORT_ERRORD(); GL_REPORT_ERRORD();
} }
@ -1456,15 +1461,15 @@ void Renderer::FlipImageData(u8 *data, int w, int h)
} }
} }
////////////////////////////////////////////////////////////////////////////////////// // ------------------------------------------------------------------------------------------------------------
// Function: This function does not have the final picture. Use Renderer::Swap() to adjust the final picture. // Function: This function does not have the final picture. Use Renderer::Swap() to adjust the final picture.
// Call schedule: Called from VertexShaderManager // Call schedule: Called from VertexShaderManager
// ---------------------- // ------------------------------------------------------------------------------------------------------------
void UpdateViewport() void UpdateViewport()
{ {
// ----------------------------------------------------------------------- // ---------
// Logging // Logging
// ------------------ // ---------
// reversed gxsetviewport(xorig, yorig, width, height, nearz, farz) // reversed gxsetviewport(xorig, yorig, width, height, nearz, farz)
// [0] = width/2 // [0] = width/2
// [1] = height/2 // [1] = height/2
@ -1477,7 +1482,7 @@ void UpdateViewport()
rawViewport[3]-rawViewport[0]-342, rawViewport[4]+rawViewport[1]-342, rawViewport[3]-rawViewport[0]-342, rawViewport[4]+rawViewport[1]-342,
2 * rawViewport[0], 2 * rawViewport[1], 2 * rawViewport[0], 2 * rawViewport[1],
(rawViewport[5] - rawViewport[2]) / 16777215.0f, rawViewport[5] / 16777215.0f);*/ (rawViewport[5] - rawViewport[2]) / 16777215.0f, rawViewport[5] / 16777215.0f);*/
// -------------------------- // --------
int scissorXOff = bpmem.scissorOffset.x * 2 - 342; int scissorXOff = bpmem.scissorOffset.x * 2 - 342;
int scissorYOff = bpmem.scissorOffset.y * 2 - 342; int scissorYOff = bpmem.scissorOffset.y * 2 - 342;
@ -1485,14 +1490,12 @@ void UpdateViewport()
float MValueX = Renderer::GetTargetScaleX(); float MValueX = Renderer::GetTargetScaleX();
float MValueY = Renderer::GetTargetScaleY(); float MValueY = Renderer::GetTargetScaleY();
// -----------------------------------------------------------------------
// Stretch picture with increased internal resolution // Stretch picture with increased internal resolution
// ------------------
int GLx = (int)ceil((xfregs.rawViewport[3] - xfregs.rawViewport[0] - 342 - scissorXOff) * MValueX); int GLx = (int)ceil((xfregs.rawViewport[3] - xfregs.rawViewport[0] - 342 - scissorXOff) * MValueX);
int GLy = (int)ceil(Renderer::GetTargetHeight() - ((int)(xfregs.rawViewport[4] - xfregs.rawViewport[1] - 342 - scissorYOff)) * MValueY); int GLy = (int)ceil(Renderer::GetTargetHeight() - ((int)(xfregs.rawViewport[4] - xfregs.rawViewport[1] - 342 - scissorYOff)) * MValueY);
int GLWidth = (int)ceil(abs((int)(2 * xfregs.rawViewport[0])) * MValueX); int GLWidth = (int)ceil(abs((int)(2 * xfregs.rawViewport[0])) * MValueX);
int GLHeight = (int)ceil(abs((int)(2 * xfregs.rawViewport[1])) * MValueY); int GLHeight = (int)ceil(abs((int)(2 * xfregs.rawViewport[1])) * MValueY);
// -------------------------------------
// Update the view port // Update the view port
glViewport(GLx, GLy, GLWidth, GLHeight); glViewport(GLx, GLy, GLWidth, GLHeight);

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -16,16 +16,18 @@
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// ---------------------------------------------------------------------------------------------
// GC graphics pipeline // GC graphics pipeline
// ---------------------------------------------------------------------------------------------
// 3d commands are issued through the fifo. The gpu draws to the 2MB EFB. // 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 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. // 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. // 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. // Next frame, that one is scanned out and the other one gets the copy. = double buffering.
// ---------------------------------------------------------------------------------------------
#ifndef GCOGL_RENDER #ifndef _GCOGL_RENDER_H_
#define GCOGL_RENDER #define _GCOGL_RENDER_H_
#include "TextureMngr.h" #include "TextureMngr.h"
@ -109,4 +111,4 @@ public:
void ComputeBackbufferRectangle(TRectangle *rc); void ComputeBackbufferRectangle(TRectangle *rc);
#endif #endif // _GCOGL_RENDER_H_

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2000 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -15,8 +15,8 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _TEXTURECONVERSIONSHADER_H #ifndef _TEXTURECONVERSIONSHADER_H_
#define _TEXTURECONVERSIONSHADER_H #define _TEXTURECONVERSIONSHADER_H_
#include "Common.h" #include "Common.h"
#include "TextureDecoder.h" #include "TextureDecoder.h"
@ -35,5 +35,5 @@ void SetShaderParameters(float width, float height, float offsetX, float offsetY
} }
#endif #endif // _TEXTURECONVERSIONSHADER_H_

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -234,10 +234,8 @@ void EncodeToRam(u32 address, bool bFromZBuffer, bool bIsIntensityFmt, u32 copyf
format |= _GX_TF_CTF; format |= _GX_TF_CTF;
} }
else else
{
if (copyfmt > GX_TF_RGBA8 || (copyfmt < GX_TF_RGB565 && !bIsIntensityFmt)) if (copyfmt > GX_TF_RGBA8 || (copyfmt < GX_TF_RGB565 && !bIsIntensityFmt))
format |= _GX_TF_CTF; format |= _GX_TF_CTF;
}
FRAGMENTSHADER& texconv_shader = GetOrCreateEncodingShader(format); FRAGMENTSHADER& texconv_shader = GetOrCreateEncodingShader(format);
if (texconv_shader.glprogid == 0) if (texconv_shader.glprogid == 0)

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -15,8 +15,8 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _TEXTURECONVERTER_H #ifndef _TEXTURECONVERTER_H_
#define _TEXTURECONVERTER_H #define _TEXTURECONVERTER_H_
#include "VideoCommon.h" #include "VideoCommon.h"
#include "GLUtil.h" #include "GLUtil.h"
@ -39,4 +39,4 @@ void DecodeToTexture(u8* srcAddr, int srcWidth, int srcHeight, GLuint destTextur
} }
#endif #endif // _TEXTURECONVERTER_H_

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -103,7 +103,8 @@ bool TextureMngr::TCacheEntry::IntersectsMemoryRange(u32 range_address, u32 rang
void TextureMngr::TCacheEntry::SetTextureParameters(TexMode0 &newmode) void TextureMngr::TCacheEntry::SetTextureParameters(TexMode0 &newmode)
{ {
mode = newmode; mode = newmode;
if (isNonPow2) { if (isNonPow2)
{
// very limited! // very limited!
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER,
(newmode.mag_filter || g_Config.bForceFiltering) ? GL_LINEAR : GL_NEAREST); (newmode.mag_filter || g_Config.bForceFiltering) ? GL_LINEAR : GL_NEAREST);
@ -116,7 +117,8 @@ void TextureMngr::TCacheEntry::SetTextureParameters(TexMode0 &newmode)
if (newmode.wrap_s == 1 || newmode.wrap_t == 1) if (newmode.wrap_s == 1 || newmode.wrap_t == 1)
DEBUG_LOG(VIDEO, "cannot support repeat mode"); DEBUG_LOG(VIDEO, "cannot support repeat mode");
} }
else { else
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
(newmode.mag_filter || g_Config.bForceFiltering) ? GL_LINEAR : GL_NEAREST); (newmode.mag_filter || g_Config.bForceFiltering) ? GL_LINEAR : GL_NEAREST);
@ -134,9 +136,7 @@ void TextureMngr::TCacheEntry::SetTextureParameters(TexMode0 &newmode)
} }
if (g_Config.iMaxAnisotropy >= 1) if (g_Config.iMaxAnisotropy >= 1)
{
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, (float)(1 << g_Config.iMaxAnisotropy)); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, (float)(1 << g_Config.iMaxAnisotropy));
}
} }
void TextureMngr::TCacheEntry::Destroy(bool shutdown) void TextureMngr::TCacheEntry::Destroy(bool shutdown)
@ -214,9 +214,8 @@ void TextureMngr::ProgressiveCleanup()
std::map<u32, DEPTHTARGET>::iterator itdepth = mapDepthTargets.begin(); std::map<u32, DEPTHTARGET>::iterator itdepth = mapDepthTargets.begin();
while (itdepth != mapDepthTargets.end()) while (itdepth != mapDepthTargets.end())
{ {
if (frameCount > 20 + itdepth->second.framecount) { if (frameCount > 20 + itdepth->second.framecount)
ERASE_THROUGH_ITERATOR(mapDepthTargets, itdepth); ERASE_THROUGH_ITERATOR(mapDepthTargets, itdepth);
}
else ++itdepth; else ++itdepth;
} }
} }

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -15,8 +15,8 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _TextureMngr_H #ifndef _TEXTUREMNGR_H_
#define _TextureMngr_H #define _TEXTUREMNGR_H_
#include <map> #include <map>
@ -86,4 +86,4 @@ public:
bool SaveTexture(const char* filename, u32 textarget, u32 tex, int width, int height); bool SaveTexture(const char* filename, u32 textarget, u32 tex, int width, int height);
#endif #endif // _TEXTUREMNGR_H_

View File

@ -1,3 +1,20 @@
// Copyright (C) 2003-2009 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 "Globals.h" #include "Globals.h"
#include <fstream> #include <fstream>
@ -38,7 +55,7 @@ u32 s_vertexCount;
static const GLenum c_primitiveType[8] = static const GLenum c_primitiveType[8] =
{ {
GL_QUADS, GL_QUADS,
0, //nothing GL_ZERO, //nothing
GL_TRIANGLES, GL_TRIANGLES,
GL_TRIANGLE_STRIP, GL_TRIANGLE_STRIP,
GL_TRIANGLE_FAN, GL_TRIANGLE_FAN,
@ -140,14 +157,17 @@ void Flush()
PRIM_LOG("frame%d:\n texgen=%d, numchan=%d, dualtex=%d, ztex=%d, cole=%d, alpe=%d, ze=%d", g_Config.iSaveTargetId, xfregs.numTexGens, PRIM_LOG("frame%d:\n texgen=%d, numchan=%d, dualtex=%d, ztex=%d, cole=%d, alpe=%d, ze=%d", g_Config.iSaveTargetId, xfregs.numTexGens,
xfregs.nNumChans, (int)xfregs.bEnableDualTexTransform, bpmem.ztex2.op, xfregs.nNumChans, (int)xfregs.bEnableDualTexTransform, bpmem.ztex2.op,
bpmem.blendmode.colorupdate, bpmem.blendmode.alphaupdate, bpmem.zmode.updateenable); bpmem.blendmode.colorupdate, bpmem.blendmode.alphaupdate, bpmem.zmode.updateenable);
for (int i = 0; i < xfregs.nNumChans; ++i) {
for (int i = 0; i < xfregs.nNumChans; ++i)
{
LitChannel* ch = &xfregs.colChans[i].color; LitChannel* ch = &xfregs.colChans[i].color;
PRIM_LOG("colchan%d: matsrc=%d, light=0x%x, ambsrc=%d, diffunc=%d, attfunc=%d", i, ch->matsource, ch->GetFullLightMask(), ch->ambsource, ch->diffusefunc, ch->attnfunc); PRIM_LOG("colchan%d: matsrc=%d, light=0x%x, ambsrc=%d, diffunc=%d, attfunc=%d", i, ch->matsource, ch->GetFullLightMask(), ch->ambsource, ch->diffusefunc, ch->attnfunc);
ch = &xfregs.colChans[i].alpha; ch = &xfregs.colChans[i].alpha;
PRIM_LOG("alpchan%d: matsrc=%d, light=0x%x, ambsrc=%d, diffunc=%d, attfunc=%d", i, ch->matsource, ch->GetFullLightMask(), ch->ambsource, ch->diffusefunc, ch->attnfunc); PRIM_LOG("alpchan%d: matsrc=%d, light=0x%x, ambsrc=%d, diffunc=%d, attfunc=%d", i, ch->matsource, ch->GetFullLightMask(), ch->ambsource, ch->diffusefunc, ch->attnfunc);
} }
for (int i = 0; i < xfregs.numTexGens; ++i) { for (int i = 0; i < xfregs.numTexGens; ++i)
{
TexMtxInfo tinfo = xfregs.texcoords[i].texmtxinfo; TexMtxInfo tinfo = xfregs.texcoords[i].texmtxinfo;
if (tinfo.texgentype != XF_TEXGEN_EMBOSS_MAP) tinfo.hex &= 0x7ff; if (tinfo.texgentype != XF_TEXGEN_EMBOSS_MAP) tinfo.hex &= 0x7ff;
if (tinfo.texgentype != XF_TEXGEN_REGULAR) tinfo.projection = 0; if (tinfo.texgentype != XF_TEXGEN_REGULAR) tinfo.projection = 0;
@ -178,22 +198,20 @@ void Flush()
DVSTARTSUBPROFILE("VertexManager::Flush:textures"); DVSTARTSUBPROFILE("VertexManager::Flush:textures");
u32 usedtextures = 0; u32 usedtextures = 0;
for (u32 i = 0; i < (u32)bpmem.genMode.numtevstages + 1; ++i) { for (u32 i = 0; i < (u32)bpmem.genMode.numtevstages + 1; ++i)
if (bpmem.tevorders[i / 2].getEnable(i & 1)) if (bpmem.tevorders[i / 2].getEnable(i & 1))
usedtextures |= 1 << bpmem.tevorders[i/2].getTexMap(i & 1); usedtextures |= 1 << bpmem.tevorders[i/2].getTexMap(i & 1);
}
if (bpmem.genMode.numindstages > 0) { if (bpmem.genMode.numindstages > 0)
for (u32 i = 0; i < (u32)bpmem.genMode.numtevstages + 1; ++i) { for (u32 i = 0; i < (u32)bpmem.genMode.numtevstages + 1; ++i)
if (bpmem.tevind[i].IsActive() && bpmem.tevind[i].bt < bpmem.genMode.numindstages) { if (bpmem.tevind[i].IsActive() && bpmem.tevind[i].bt < bpmem.genMode.numindstages)
usedtextures |= 1 << bpmem.tevindref.getTexMap(bpmem.tevind[i].bt); usedtextures |= 1 << bpmem.tevindref.getTexMap(bpmem.tevind[i].bt);
}
}
}
u32 nonpow2tex = 0; u32 nonpow2tex = 0;
for (int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++)
if (usedtextures & (1 << i)) { {
if (usedtextures & (1 << i))
{
glActiveTexture(GL_TEXTURE0 + i); glActiveTexture(GL_TEXTURE0 + i);
FourTexUnits &tex = bpmem.tex[i >> 2]; FourTexUnits &tex = bpmem.tex[i >> 2];
@ -201,9 +219,11 @@ void Flush()
tex.texImage0[i&3].width + 1, tex.texImage0[i&3].height + 1, tex.texImage0[i&3].width + 1, tex.texImage0[i&3].height + 1,
tex.texImage0[i&3].format, tex.texTlut[i&3].tmem_offset<<9, tex.texTlut[i&3].tlut_format); tex.texImage0[i&3].format, tex.texTlut[i&3].tmem_offset<<9, tex.texTlut[i&3].tlut_format);
if (tentry != NULL) { if (tentry != NULL)
{
// texture loaded fine, set dims for pixel shader // texture loaded fine, set dims for pixel shader
if (tentry->isNonPow2) { if (tentry->isNonPow2)
{
PixelShaderManager::SetTexDims(i, tentry->w, tentry->h, tentry->mode.wrap_s, tentry->mode.wrap_t); PixelShaderManager::SetTexDims(i, tentry->w, tentry->h, tentry->mode.wrap_s, tentry->mode.wrap_t);
nonpow2tex |= 1 << i; nonpow2tex |= 1 << i;
if (tentry->mode.wrap_s > 0) nonpow2tex |= 1 << (8 + i); if (tentry->mode.wrap_s > 0) nonpow2tex |= 1 << (8 + i);
@ -216,16 +236,16 @@ void Flush()
// 0s are probably for no manual wrapping needed. // 0s are probably for no manual wrapping needed.
PixelShaderManager::SetTexDims(i, tentry->w, tentry->h, 0, 0); PixelShaderManager::SetTexDims(i, tentry->w, tentry->h, 0, 0);
} }
if (g_Config.iLog & CONF_SAVETEXTURES) { if (g_Config.iLog & CONF_SAVETEXTURES)
{
// save the textures // save the textures
char strfile[255]; char strfile[255];
sprintf(strfile, "%sframes/tex%.3d_%d.tga", FULL_DUMP_DIR, g_Config.iSaveTargetId, i); sprintf(strfile, "%sframes/tex%.3d_%d.tga", FULL_DUMP_DIR, g_Config.iSaveTargetId, i);
SaveTexture(strfile, tentry->isNonPow2?GL_TEXTURE_RECTANGLE_ARB:GL_TEXTURE_2D, tentry->texture, tentry->w, tentry->h); SaveTexture(strfile, tentry->isNonPow2?GL_TEXTURE_RECTANGLE_ARB:GL_TEXTURE_2D, tentry->texture, tentry->w, tentry->h);
} }
} }
else { else
ERROR_LOG(VIDEO, "error loading tex\n"); ERROR_LOG(VIDEO, "error loading tex\n");
}
} }
} }
@ -235,23 +255,27 @@ void Flush()
VERTEXSHADER* vs = VertexShaderCache::GetShader(g_nativeVertexFmt->m_components); VERTEXSHADER* vs = VertexShaderCache::GetShader(g_nativeVertexFmt->m_components);
bool bRestoreBuffers = false; bool bRestoreBuffers = false;
if (Renderer::UseFakeZTarget()) { if (Renderer::UseFakeZTarget())
if (bpmem.zmode.updateenable) { {
if (!bpmem.blendmode.colorupdate) { if (bpmem.zmode.updateenable)
{
if (!bpmem.blendmode.colorupdate)
{
Renderer::SetRenderMode(bpmem.blendmode.alphaupdate ? Renderer::SetRenderMode(bpmem.blendmode.alphaupdate ?
Renderer::RM_ZBufferAlpha : Renderer::RM_ZBufferAlpha :
Renderer::RM_ZBufferOnly); Renderer::RM_ZBufferOnly);
} }
} }
else { else
{
Renderer::SetRenderMode(Renderer::RM_Normal); Renderer::SetRenderMode(Renderer::RM_Normal);
// remove temporarily // remove temporarily
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
bRestoreBuffers = true; bRestoreBuffers = true;
} }
} else { }
else
Renderer::SetRenderMode(Renderer::RM_Normal); Renderer::SetRenderMode(Renderer::RM_Normal);
}
// set global constants // set global constants
VertexShaderManager::SetConstants(g_Config.bProjectionHax1); VertexShaderManager::SetConstants(g_Config.bProjectionHax1);
@ -280,7 +304,8 @@ void Flush()
} }
// run through vertex groups again to set alpha // run through vertex groups again to set alpha
if (!g_Config.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate) { if (!g_Config.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate)
{
ps = PixelShaderCache::GetShader(true); ps = PixelShaderCache::GetShader(true);
if (ps) glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, ps->glprogid); if (ps) glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, ps->glprogid);
@ -310,7 +335,8 @@ void Flush()
} }
#if defined(_DEBUG) || defined(DEBUGFAST) #if defined(_DEBUG) || defined(DEBUGFAST)
if (g_Config.iLog & CONF_SAVESHADERS) { if (g_Config.iLog & CONF_SAVESHADERS)
{
// save the shaders // save the shaders
char strfile[255]; char strfile[255];
sprintf(strfile, "%sframes/ps%.3d.txt", FULL_DUMP_DIR, g_Config.iSaveTargetId); sprintf(strfile, "%sframes/ps%.3d.txt", FULL_DUMP_DIR, g_Config.iSaveTargetId);
@ -321,7 +347,8 @@ void Flush()
fvs << vs->strprog.c_str(); fvs << vs->strprog.c_str();
} }
if (g_Config.iLog & CONF_SAVETARGETS) { if (g_Config.iLog & CONF_SAVETARGETS)
{
char str[128]; char str[128];
sprintf(str, "%sframes/targ%.3d.tga", FULL_DUMP_DIR, g_Config.iSaveTargetId); sprintf(str, "%sframes/targ%.3d.tga", FULL_DUMP_DIR, g_Config.iSaveTargetId);
Renderer::SaveRenderTarget(str, Renderer::GetTargetWidth(), Renderer::GetTargetHeight()); Renderer::SaveRenderTarget(str, Renderer::GetTargetWidth(), Renderer::GetTargetHeight());
@ -331,7 +358,8 @@ void Flush()
GL_REPORT_ERRORD(); GL_REPORT_ERRORD();
if (bRestoreBuffers) { if (bRestoreBuffers)
{
GLenum s_drawbuffers[2] = {GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT}; GLenum s_drawbuffers[2] = {GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT};
glDrawBuffers(2, s_drawbuffers); glDrawBuffers(2, s_drawbuffers);
Renderer::SetColorMask(); Renderer::SetColorMask();

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -15,8 +15,8 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _VERTEXMANAGER_H #ifndef _VERTEXMANAGER_H_
#define _VERTEXMANAGER_H #define _VERTEXMANAGER_H_
#include "CPMemory.h" #include "CPMemory.h"
#include "NativeVertexWriter.h" #include "NativeVertexWriter.h"
@ -33,4 +33,4 @@ void ResetBuffer();
}; };
#endif // _VERTEXMANAGER_H #endif // _VERTEXMANAGER_H_

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -15,6 +15,9 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _VERTEXSHADERCACHE_H_
#define _VERTEXSHADERCACHE_H_
#include <map> #include <map>
#include <string> #include <string>
@ -59,3 +62,5 @@ public:
static VERTEXSHADER* GetShader(u32 components); static VERTEXSHADER* GetShader(u32 components);
static bool CompileVertexShader(VERTEXSHADER& ps, const char* pstrprogram); static bool CompileVertexShader(VERTEXSHADER& ps, const char* pstrprogram);
}; };
#endif // _VERTEXSHADERCACHE_H_

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -16,17 +16,13 @@
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
///////////////////////////////////////////////////////////////////////// // ----------------------------------------------------------------------------------------------------------
// File description // This file handles the External Frame Buffer (XFB). The XFB is a storage point when the picture is resized
/* --------------- // by the system to the correct display format for output to the TV. In most cases its function can be
// supplemented by the equivalent adjustments in glScissor and glViewport (or their DirectX equivalents). But
This file handles the External Frame Buffer (XFB). The XFB is a storage point when the picture is resized // for some homebrew games these functions are necessary because the homebrew game communicate directly with
by the system to the correct display format for output to the TV. In most cases its function can be // them.
supplemented by the equivalent adjustments in glScissor and glViewport (or their DirectX equivalents). But // ----------------------------------------------------------------------------------------------------------
for some homebrew games these functions are necessary because the homebrew game communicate directly with
them.
///////////////////////////////////*/
#include "Globals.h" #include "Globals.h"
#include "GLUtil.h" #include "GLUtil.h"

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -15,8 +15,8 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _XFB_H #ifndef _XFB_H_
#define _XFB_H #define _XFB_H_
#include "TextureMngr.h" #include "TextureMngr.h"
@ -35,4 +35,4 @@ int XFB_isInit();
void XFB_SetUpdateArgs(u8* _pXFB, u32 _dwWidth, u32 _dwHeight, s32 _dwYOffset); void XFB_SetUpdateArgs(u8* _pXFB, u32 _dwWidth, u32 _dwHeight, s32 _dwYOffset);
#endif #endif // _XFB_H_

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -15,9 +15,6 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
///////////////////////////////////////////////////////////////////////////////////////////////////
// Include
// --------------------------
#include "Globals.h" #include "Globals.h"
#include <cstdarg> #include <cstdarg>
@ -53,17 +50,12 @@
#include "Setup.h" #include "Setup.h"
#include "VideoState.h" #include "VideoState.h"
///////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
// Definitions
// --------------------------
SVideoInitialize g_VideoInitialize; SVideoInitialize g_VideoInitialize;
PLUGIN_GLOBALS* globals = NULL; PLUGIN_GLOBALS* globals = NULL;
// Logging // Logging
int GLScissorX, GLScissorY, GLScissorW, GLScissorH; int GLScissorX, GLScissorY, GLScissorW, GLScissorH;
///////////////////////////////////////////////
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
void DllDebugger(HWND _hParent, bool Show) void DllDebugger(HWND _hParent, bool Show)
@ -307,10 +299,9 @@ void Shutdown(void)
OpenGL_Shutdown(); OpenGL_Shutdown();
} }
// -------------------------------
//////////////////////////////////////////////////////////////////////////////////////////
// Enter and exit the video loop // Enter and exit the video loop
// ¯¯¯¯¯¯¯¯¯¯¯¯¯ // -------------------------------
void Video_EnterLoop() void Video_EnterLoop()
{ {
Fifo_EnterLoop(g_VideoInitialize); Fifo_EnterLoop(g_VideoInitialize);
@ -320,7 +311,7 @@ void Video_ExitLoop()
{ {
Fifo_ExitLoop(); Fifo_ExitLoop();
} }
/////////////////////////
void Video_Screenshot(const char *_szFilename) void Video_Screenshot(const char *_szFilename)
{ {

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -15,11 +15,11 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _MAIN_H #ifndef _MAIN_H_
#define _MAIN_H #define _MAIN_H_
#include "pluginspecs_video.h" #include "pluginspecs_video.h"
extern SVideoInitialize g_VideoInitialize; extern SVideoInitialize g_VideoInitialize;
#endif #endif // _MAIN_H_

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -202,9 +202,8 @@ void RasterFont::printMultilineText(const char *text, double start_x, double sta
*t++ = ' '; *t++ = ' ';
} }
else else
{
*t++ = *text; *t++ = *text;
}
text++; text++;
} }

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -15,8 +15,8 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef RasterFont_Header #ifndef _RASTERFONT_H_
#define RasterFont_Header #define _RASTERFONT_H_
class RasterFont { class RasterFont {
protected: protected:
@ -38,4 +38,4 @@ public:
void printMultilineText(const char *text, double x, double y, double z, int bbWidth, int bbHeight); void printMultilineText(const char *text, double x, double y, double z, int bbWidth, int bbHeight);
}; };
#endif #endif // _RASTERFONT_H_

View File

@ -0,0 +1,18 @@
// Copyright (C) 2003-2009 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 "stdafx.h"