Added more render control options, wireframe option works, added more hacks.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@988 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
omegadox 2008-10-28 08:14:17 +00:00
parent 09a0b34ce1
commit 46f0dd8f78
8 changed files with 173 additions and 28 deletions

View File

@ -54,9 +54,8 @@ static const GLenum glDestFactors[8] = {
GL_ZERO, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR,
GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA
};
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 };
};
static const GLenum glLogicOpCodes[16] = {
@ -90,7 +89,7 @@ void BPWritten(int addr, int changes, int newval)
bpmem.genMode.numindstages, bpmem.genMode.zfreeze);
// none, ccw, cw, ccw
if (bpmem.genMode.cullmode>0) {
if (bpmem.genMode.cullmode>0 && !g_Config.bDisableCulling) {
glEnable(GL_CULL_FACE);
glFrontFace(bpmem.genMode.cullmode == 2 ? GL_CCW : GL_CW);
}
@ -441,13 +440,18 @@ void BPWritten(int addr, int changes, int newval)
(int)((bpmem.copyTexSrcXY.y * MValueY + (bpmem.copyTexSrcWH.y + 1) * MValueY))
};
UPE_Copy PE_copy;
PE_copy.Hex = bpmem.triggerEFBCopy;
UPE_Copy PE_copy;
PE_copy.Hex = bpmem.triggerEFBCopy;
if (PE_copy.copy_to_xfb == 0) {
if(g_Config.bEBFToTextureDisable) {
glViewport(rc.left,rc.bottom,rc.right,rc.top);
glScissor(rc.left,rc.bottom,rc.right,rc.top);
}
else
// EFB to texture
// for some reason it sets bpmem.zcontrol.pixel_format to PIXELFMT_Z24 every time a zbuffer format is given as a dest to GXSetTexCopyDst
TextureMngr::CopyRenderTargetToTexture(bpmem.copyTexDest<<5, bpmem.zcontrol.pixel_format==PIXELFMT_Z24, PE_copy.intensity_fmt>0,
TextureMngr::CopyRenderTargetToTexture(bpmem.copyTexDest<<5, bpmem.zcontrol.pixel_format==PIXELFMT_Z24, PE_copy.intensity_fmt>0,
(PE_copy.target_pixel_format/2)+((PE_copy.target_pixel_format&1)*8), PE_copy.half_scale>0, &rc);
}
else {
@ -486,6 +490,7 @@ void BPWritten(int addr, int changes, int newval)
if (bpmem.blendmode.colorupdate || bpmem.blendmode.alphaupdate) {
u32 clearColor = (bpmem.clearcolorAR << 16) | bpmem.clearcolorGB;
glClearColor(((clearColor>>16) & 0xff)*(1/255.0f),
((clearColor>>8 ) & 0xff)*(1/255.0f),
((clearColor>>0 ) & 0xff)*(1/255.0f),
((clearColor>>24) & 0xff)*(1/255.0f));

View File

@ -67,6 +67,10 @@ void Config::Load()
iniFile.Get("Settings", "TexFmtOverlayEnable", &bTexFmtOverlayEnable, 0);
iniFile.Get("Settings", "TexFmtOverlayCenter", &bTexFmtOverlayCenter, 0);
iniFile.Get("Settings", "UseXFB", &bUseXFB, 0);
iniFile.Get("Settings", "WireFrame", &bWireFrame, 0);
iniFile.Get("Settings", "DisableLighting", &bDisableLighting, 0);
iniFile.Get("Settings", "DisableTexturing", &bDisableTexturing, 0);
iniFile.Get("Settings", "DisableCulling", &bDisableCulling, 0);
iniFile.Get("Enhancements", "ForceFiltering", &bForceFiltering, 0);
iniFile.Get("Enhancements", "ForceMaxAniso", &bForceMaxAniso, 0);
@ -74,6 +78,9 @@ void Config::Load()
iniFile.Get("Enhancements", "KeepAR", &bKeepAR, false);
iniFile.Get("Hacks", "InvertDepth", &bInvertDepth, 0);
iniFile.Get("Hacks", "ProjectionHax1", &bProjectionHax1, 0);
iniFile.Get("Hacks", "ProjectionHax2", &bProjectionHax2, 0);
iniFile.Get("Hacks", "EFBToTextureDisable", &bEBFToTextureDisable, 0);
}
void Config::Save()
@ -96,6 +103,10 @@ void Config::Save()
iniFile.Set("Settings", "TexFmtOverlayEnable", bTexFmtOverlayEnable);
iniFile.Set("Settings", "TexFmtOverlayCenter", bTexFmtOverlayCenter);
iniFile.Set("Settings", "UseXFB", bUseXFB);
iniFile.Set("Settings", "Wireframe", bWireFrame);
iniFile.Set("Settings", "DisableLighting", bDisableLighting);
iniFile.Set("Settings", "DisableTexturing", bDisableTexturing);
iniFile.Set("Settings", "DisableCulling", bDisableCulling);
iniFile.Set("Enhancements", "ForceFiltering", bForceFiltering);
iniFile.Set("Enhancements", "ForceMaxAniso", bForceMaxAniso);
@ -103,6 +114,9 @@ void Config::Save()
iniFile.Set("Enhancements", "KeepAR", bKeepAR);
iniFile.Set("Hacks", "InvertDepth", bInvertDepth);
iniFile.Set("Hacks", "ProjectionHax1", bProjectionHax1);
iniFile.Set("Hacks", "ProjectionHax2", bProjectionHax2);
iniFile.Set("Hacks", "EFBToTextureDisable", bEBFToTextureDisable);
iniFile.Save("gfx_opengl.ini");
}

View File

@ -51,6 +51,10 @@ struct Config
// Render
bool bUseXFB;
bool bWireFrame;
bool bDisableLighting;
bool bDisableTexturing;
bool bDisableCulling;
// Utility
char texDumpPath[280];
@ -58,16 +62,18 @@ struct Config
// Hacks
bool bInvertDepth;
bool bProjectionHax1;
bool bProjectionHax2;
bool bEBFToTextureDisable;
int iLog; // CONF_ bits
int iSaveTargetId;
//currently unused:
int iCompileDLsLevel;
bool bWireFrame;
bool bShowShaderErrors;
};
extern Config g_Config;
#endif // _CONFIG_H
#endif // _CONFIG_H

View File

@ -45,6 +45,12 @@ BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
EVT_CHECKBOX(ID_USEXFB,ConfigDialog::UseXFBChange)
EVT_CHECKBOX(ID_DUMPTEXTURES,ConfigDialog::DumpTexturesChange)
EVT_CHECKBOX(ID_INVERTDEPTH,ConfigDialog::InvertDepth)
EVT_CHECKBOX(ID_PROJECTIONHAX1,ConfigDialog::ProjectionHax1)
EVT_CHECKBOX(ID_PROJECTIONHAX2,ConfigDialog::ProjectionHax2)
EVT_CHECKBOX(ID_DISABLELIGHTING,ConfigDialog::DisableLighting)
EVT_CHECKBOX(ID_DISABLETEXTURING,ConfigDialog::DisableTexturing)
EVT_CHECKBOX(ID_EFBTOTEXTUREDISABLE,ConfigDialog::EFBToTextureDisable)
EVT_CHECKBOX(ID_DISABLECULLING,ConfigDialog::DisableCulling)
EVT_DIRPICKER_CHANGED(ID_TEXTUREPATH,ConfigDialog::TexturePathChange)
END_EVENT_TABLE()
@ -162,12 +168,24 @@ void ConfigDialog::CreateGUIControls()
m_TexFmtCenter->Enable(m_TexFmtOverlay->IsChecked());
// Page 4 "Render"
m_UseXFB = new wxCheckBox(m_PageRender, ID_USEXFB, wxT("Use XFB"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_UseXFB = new wxCheckBox(m_PageRender, ID_USEXFB, wxT("Use External Framebuffer (XFB)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_UseXFB->SetValue(g_Config.bUseXFB);
m_Wireframe = new wxCheckBox(m_PageRender, ID_WIREFRAME, wxT("Wireframe"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
//m_Wireframe->SetValue(g_Config.bWireFrame);
m_Wireframe->Enable(false);
m_Wireframe = new wxCheckBox(m_PageRender, ID_WIREFRAME, wxT("Enable Wireframe"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Wireframe->SetValue(g_Config.bWireFrame);
m_Wireframe->Enable(true);
m_DisableLighting = new wxCheckBox(m_PageRender, ID_DISABLELIGHTING, wxT("Disable Material Lighting"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_DisableLighting->SetValue(g_Config.bDisableLighting);
m_DisableLighting->Enable(true);
m_DisableTexturing = new wxCheckBox(m_PageRender, ID_DISABLETEXTURING, wxT("Disable Texturing"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_DisableTexturing->SetValue(g_Config.bDisableTexturing);
m_DisableTexturing->Enable(true);
m_DisableCulling = new wxCheckBox(m_PageRender, ID_DISABLECULLING, wxT("Disable Culling"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_DisableCulling->SetValue(g_Config.bDisableCulling);
m_DisableCulling->Enable(true);
// Page 5 "Utility"
m_DumpTextures = new wxCheckBox(m_PageUtility, ID_DUMPTEXTURES, wxT("Dump textures to:"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
@ -181,6 +199,18 @@ void ConfigDialog::CreateGUIControls()
m_InvertDepth->Enable(true);
m_InvertDepth->SetValue(g_Config.bInvertDepth);
m_EFBToTextureDisable = new wxCheckBox(m_PageHacks, ID_EFBTOTEXTUREDISABLE, wxT("Disable copy EFB to texture"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_EFBToTextureDisable->Enable(true);
m_EFBToTextureDisable->SetValue(g_Config.bEBFToTextureDisable);
m_ProjectionHax1 = new wxCheckBox(m_PageHacks, ID_PROJECTIONHAX1, wxT("Projection before R945"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_ProjectionHax1->Enable(true);
m_ProjectionHax1->SetValue(g_Config.bProjectionHax1);
m_ProjectionHax2 = new wxCheckBox(m_PageHacks, ID_PROJECTIONHAX2, wxT("Projection hack of R844"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_ProjectionHax2->Enable(true);
m_ProjectionHax2->SetValue(g_Config.bProjectionHax2);
//Put options in sizers within the notebook
wxGridBagSizer* sPage1;
sPage1 = new wxGridBagSizer(0, 0);
@ -226,6 +256,9 @@ void ConfigDialog::CreateGUIControls()
sPage4->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
sPage4->Add(m_UseXFB, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALL, 5);
sPage4->Add(m_Wireframe, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5);
sPage4->Add(m_DisableLighting, wxGBPosition(2, 0), wxGBSpan(1, 2), wxALL, 5);
sPage4->Add(m_DisableTexturing, wxGBPosition(3, 0), wxGBSpan(1, 2), wxALL, 5);
sPage4->Add(m_DisableCulling, wxGBPosition(4, 0), wxGBSpan(1, 2), wxALL, 5);
m_PageRender->SetSizer(sPage4);
sPage4->Layout();
@ -243,6 +276,9 @@ void ConfigDialog::CreateGUIControls()
sPage6->SetFlexibleDirection(wxBOTH);
sPage6->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
sPage6->Add(m_InvertDepth, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL, 5);
sPage6->Add(m_EFBToTextureDisable, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5);
sPage6->Add(m_ProjectionHax1, wxGBPosition(2, 0), wxGBSpan(1, 2), wxALL, 5);
sPage6->Add(m_ProjectionHax2, wxGBPosition(3, 0), wxGBSpan(1, 2), wxALL, 5);
m_PageHacks->SetSizer(sPage6);
sPage6->Layout();
@ -392,3 +428,28 @@ void ConfigDialog::InvertDepth(wxCommandEvent& event)
{
g_Config.bInvertDepth = m_InvertDepth->IsChecked();
}
void ConfigDialog::ProjectionHax1(wxCommandEvent& event)
{
g_Config.bProjectionHax1 = m_ProjectionHax1->IsChecked();
}
void ConfigDialog::ProjectionHax2(wxCommandEvent& event)
{
g_Config.bProjectionHax2 = m_ProjectionHax2->IsChecked();
}
void ConfigDialog::DisableLighting(wxCommandEvent &event)
{
g_Config.bDisableLighting = m_DisableLighting->IsChecked();
}
void ConfigDialog::DisableTexturing(wxCommandEvent &event)
{
g_Config.bDisableTexturing = m_DisableTexturing->IsChecked();
}
void ConfigDialog::EFBToTextureDisable(wxCommandEvent &event)
{
g_Config.bEBFToTextureDisable = m_EFBToTextureDisable->IsChecked();
}
void ConfigDialog::DisableCulling(wxCommandEvent &event)
{
g_Config.bDisableCulling = m_DisableCulling->IsChecked();
}

View File

@ -72,6 +72,9 @@ class ConfigDialog : public wxDialog
// Render
void WireframeCheck(wxCommandEvent& event);
void UseXFBChange(wxCommandEvent& event);
void DisableLighting(wxCommandEvent& event);
void DisableTexturing(wxCommandEvent& event);
void DisableCulling(wxCommandEvent& event);
// Util
void DumpTexturesChange(wxCommandEvent& event);
@ -79,6 +82,9 @@ class ConfigDialog : public wxDialog
// Hacks
void InvertDepth(wxCommandEvent& event);
void ProjectionHax1(wxCommandEvent& event);
void ProjectionHax2(wxCommandEvent& event);
void EFBToTextureDisable(wxCommandEvent& event);
private:
@ -103,7 +109,13 @@ class ConfigDialog : public wxDialog
wxComboBox *m_FullscreenCB;
wxCheckBox *m_RenderToMainWindow;
wxCheckBox *m_Fullscreen;
wxCheckBox *m_DisableLighting;
wxCheckBox *m_DisableTexturing;
wxCheckBox *m_InvertDepth;
wxCheckBox *m_ProjectionHax1;
wxCheckBox *m_ProjectionHax2;
wxCheckBox *m_EFBToTextureDisable;
wxCheckBox *m_DisableCulling;
wxPanel *m_PageGeneral;
wxPanel *m_PageEnhancements;
wxPanel *m_PageInformation;
@ -142,6 +154,12 @@ class ConfigDialog : public wxDialog
ID_FULLSCREEN,
ID_NOTEBOOK,
ID_INVERTDEPTH,
ID_PROJECTIONHAX1,
ID_PROJECTIONHAX2,
ID_DISABLELIGHTING,
ID_DISABLETEXTURING,
ID_EFBTOTEXTUREDISABLE,
ID_DISABLECULLING,
ID_PAGEGENERAL,
ID_PAGEENHANCEMENTS,
ID_PAGEINFORMATION,

View File

@ -705,12 +705,13 @@ void Renderer::Swap(const TRectangle& rc)
// texture map s_RenderTargets[s_curtarget] onto the main buffer
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, s_RenderTargets[s_nCurTarget]);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, s_RenderTargets[s_nCurTarget]);
TextureMngr::EnableTexRECT(0);
// disable all other stages
for(int i = 1; i < 8; ++i) TextureMngr::DisableStage(i);
GL_REPORT_ERRORD();
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex2f(-1,-1);
glTexCoord2f(0, (float)GetTargetHeight()); glVertex2f(-1,1);
@ -718,6 +719,9 @@ void Renderer::Swap(const TRectangle& rc)
glTexCoord2f((float)GetTargetWidth(), 0); glVertex2f(1,-1);
glEnd();
if (g_Config.bWireFrame)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
TextureMngr::DisableStage(0);

View File

@ -342,18 +342,37 @@ void EnableComponents(u32 components)
}
// tex
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);
}
}
if (!g_Config.bDisableTexturing) {
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) {
glClientActiveTexture(GL_TEXTURE0 + i);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
}
s_prevcomponents = components;
}
// Disable Lighting
// TODO - move to better spot
if (g_Config.bDisableLighting) {
for (int i = 0; i < xfregs.nNumChans; i++)
{
xfregs.colChans[i].alpha.enablelighting = false;
xfregs.colChans[i].color.enablelighting = false;
}
}
s_prevcomponents = components;
}
}
} // namespace

View File

@ -450,11 +450,20 @@ void VertexShaderMngr::SetConstants()
g_fProjectionMatrix[8] = 0.0f;
g_fProjectionMatrix[9] = 0.0f;
g_fProjectionMatrix[10] = xfregs.rawProjection[4];
if((!g_Config.bProjectionHax1 && !g_Config.bProjectionHax2) || (g_Config.bProjectionHax1 && g_Config.bProjectionHax2)) {
// Working bloom in ZTP
g_fProjectionMatrix[11] = -(0.0f - xfregs.rawProjection[5]); // Yes, it's important that it's done this way.
// Working projection in PSO
// g_fProjectionMatrix[11] = -(1.0f - rawProjection[5]);
// g_fProjectionMatrix[11] = -(1.0f - rawProjection[5]);
}
if(g_Config.bProjectionHax1 && !g_Config.bProjectionHax2) // Before R945
g_fProjectionMatrix[11] = -(1.0f - xfregs.rawProjection[5]);
if(!g_Config.bProjectionHax1 && g_Config.bProjectionHax2) // R844
g_fProjectionMatrix[11] = xfregs.rawProjection[5];
g_fProjectionMatrix[12] = 0.0f;
g_fProjectionMatrix[13] = 0.0f;
g_fProjectionMatrix[14] = -1.0f;
@ -474,10 +483,19 @@ void VertexShaderMngr::SetConstants()
g_fProjectionMatrix[8] = 0.0f;
g_fProjectionMatrix[9] = 0.0f;
g_fProjectionMatrix[10] = xfregs.rawProjection[4];
if((!g_Config.bProjectionHax1 && !g_Config.bProjectionHax2) || (g_Config.bProjectionHax1 && g_Config.bProjectionHax2)) {
// Working bloom in ZTP
//g_fProjectionMatrix[11] = -(-1.0f - rawProjection[5]); // Yes, it's important that it's done this way.
g_fProjectionMatrix[11] = -(-1.0f - xfregs.rawProjection[5]); // Yes, it's important that it's done this way.
// Working projection in PSO, working Super Monkey Ball
g_fProjectionMatrix[11] = -(0.0f - xfregs.rawProjection[5]);
// g_fProjectionMatrix[11] = -(0.0f - xfregs.rawProjection[5]);
}
if(g_Config.bProjectionHax1 && !g_Config.bProjectionHax2) // Before R945
g_fProjectionMatrix[11] = -(0.0f - xfregs.rawProjection[5]);
if(!g_Config.bProjectionHax1 && g_Config.bProjectionHax2) // R844
g_fProjectionMatrix[11] = -xfregs.rawProjection[5];
g_fProjectionMatrix[12] = 0;
g_fProjectionMatrix[13] = 0;