mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-11 18:50:30 +00:00
i know still a lot to fix and much work to do but sometimes experiments are fun :)
for all the plugins implemented per pixel lighting, this will make games that uses lighting a lot nice. (just look at mario sunshine and compare :)) for dx9: implemented temporal anaglyph stereo: just grab your red-cyan glasses and enjoy. stereo calibration: use stereo separation ( distance of the point from you are looking) and Focal Angle: the angle necessary to focus in one particular object. this settings are different in every games as they use different depth ranges. please for any regression and bug introduced by this commit. if you ask why i did not implement stereo in dx11 and opengl the reason is one: they don't work right when i have more time will try to find a way to make them work. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6224 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
5e806eb7b2
commit
e641323de2
30 changed files with 558 additions and 79 deletions
|
@ -92,6 +92,8 @@ struct TabDirect3D : public W32Util::Tab
|
|||
Button_SetCheck(GetDlgItem(hDlg, IDC_VSYNC), g_Config.bVSync);
|
||||
Button_SetCheck(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE), g_Config.bSafeTextureCache);
|
||||
Button_SetCheck(GetDlgItem(hDlg, IDC_DLIST_CACHING), g_Config.bDlistCachingEnable);
|
||||
Button_SetCheck(GetDlgItem(hDlg, IDC_ENABLEPIXELLIGHTING), g_Config.bEnablePixelLigting);
|
||||
|
||||
|
||||
|
||||
if (g_Config.iSafeTextureCache_ColorSamples == 0)
|
||||
|
@ -141,6 +143,9 @@ struct TabDirect3D : public W32Util::Tab
|
|||
case IDC_DLIST_CACHING:
|
||||
g_Config.bDlistCachingEnable = Button_GetCheck(GetDlgItem(hDlg, IDC_DLIST_CACHING)) == 0 ? false : true;
|
||||
break;
|
||||
case IDC_ENABLEPIXELLIGHTING:
|
||||
g_Config.bEnablePixelLigting = Button_GetCheck(GetDlgItem(hDlg, IDC_ENABLEPIXELLIGHTING)) == 0 ? false : true;
|
||||
break;
|
||||
case IDC_EFB_ACCESS_ENABLE:
|
||||
g_Config.bEFBAccessEnable = Button_GetCheck(GetDlgItem(hDlg, IDC_EFB_ACCESS_ENABLE)) == 0 ? false : true;
|
||||
break;
|
||||
|
|
|
@ -125,6 +125,16 @@ unsigned int ps_constant_offset_table[] = {
|
|||
76, 80, // C_INDTEXSCALE, 8
|
||||
84, 88, 92, 96, 100, 104, // C_INDTEXMTX, 24
|
||||
108, 112, // C_FOG, 8
|
||||
116, 120, 124 ,128, // C_COLORMATRIX, 16
|
||||
132, 136, 140, 144, 148, // C_PLIGHTS0, 20
|
||||
152, 156, 160, 164, 168, // C_PLIGHTS1, 20
|
||||
172, 176, 180, 184, 188, // C_PLIGHTS2, 20
|
||||
192, 196, 200, 204, 208, // C_PLIGHTS3, 20
|
||||
212, 216, 220, 224, 228, // C_PLIGHTS4, 20
|
||||
232, 236, 240, 244, 248, // C_PLIGHTS5, 20
|
||||
252, 256, 260, 264, 268, // C_PLIGHTS6, 20
|
||||
272, 276, 280, 284, 288, // C_PLIGHTS7, 20
|
||||
292, 296, 300, 304, // C_PMATERIALS, 16
|
||||
};
|
||||
void SetPSConstant4f(unsigned int const_number, float f1, float f2, float f3, float f4)
|
||||
{
|
||||
|
@ -215,7 +225,7 @@ void PixelShaderCache::Shutdown()
|
|||
g_ps_disk_cache.Close();
|
||||
}
|
||||
|
||||
bool PixelShaderCache::SetShader(bool dstAlpha)
|
||||
bool PixelShaderCache::SetShader(bool dstAlpha,u32 components)
|
||||
{
|
||||
PIXELSHADERUID uid;
|
||||
GetPixelShaderId(&uid, dstAlpha);
|
||||
|
@ -243,7 +253,7 @@ bool PixelShaderCache::SetShader(bool dstAlpha)
|
|||
}
|
||||
|
||||
// need to compile a new shader
|
||||
const char* code = GeneratePixelShaderCode(dstAlpha, API_D3D11);
|
||||
const char* code = GeneratePixelShaderCode(dstAlpha, API_D3D11,components);
|
||||
|
||||
D3DBlob* pbytecode;
|
||||
if (!D3D::CompilePixelShader(code, strlen(code), &pbytecode))
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
static void Init();
|
||||
static void Clear();
|
||||
static void Shutdown();
|
||||
static bool SetShader(bool dstAlpha);
|
||||
static bool SetShader(bool dstAlpha,u32 components);
|
||||
static bool InsertByteCode(const PIXELSHADERUID &uid, void* bytecode, unsigned int bytecodelen);
|
||||
|
||||
static ID3D11PixelShader* GetColorMatrixProgram();
|
||||
|
|
|
@ -341,7 +341,7 @@ void Flush()
|
|||
VertexShaderManager::SetConstants();
|
||||
PixelShaderManager::SetConstants();
|
||||
|
||||
if (!PixelShaderCache::SetShader(false))
|
||||
if (!PixelShaderCache::SetShader(false,g_nativeVertexFmt->m_components))
|
||||
goto shader_fail;
|
||||
if (!VertexShaderCache::SetShader(g_nativeVertexFmt->m_components))
|
||||
goto shader_fail;
|
||||
|
@ -354,7 +354,7 @@ void Flush()
|
|||
if (bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate)
|
||||
{
|
||||
DWORD write = 0;
|
||||
if (!PixelShaderCache::SetShader(true))
|
||||
if (!PixelShaderCache::SetShader(true,g_nativeVertexFmt->m_components))
|
||||
goto shader_fail;
|
||||
|
||||
// update alpha only
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#define IDC_RADIO3 1043
|
||||
#define IDC_SAFE_TEXTURE_CACHE_FAST 1043
|
||||
#define IDC_DLIST_CACHING 1044
|
||||
#define IDC_ENABLEPIXELLIGHTING 1045
|
||||
#define IDC_STATIC -1
|
||||
|
||||
// Next default values for new objects
|
||||
|
@ -39,7 +40,7 @@
|
|||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 106
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1045
|
||||
#define _APS_NEXT_CONTROL_VALUE 1046
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -52,6 +52,7 @@ BEGIN
|
|||
CONTROL "Normal",IDC_SAFE_TEXTURE_CACHE_NORMAL,"Button",BS_AUTORADIOBUTTON,52,87,40,10
|
||||
CONTROL "Fast",IDC_SAFE_TEXTURE_CACHE_FAST,"Button",BS_AUTORADIOBUTTON,92,87,32,10
|
||||
CONTROL "Enable Dlist Caching",IDC_DLIST_CACHING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,98,80,10
|
||||
CONTROL "Enable Pixel Lighting",IDC_ENABLEPIXELLIGHTING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,112,81,10
|
||||
END
|
||||
|
||||
IDD_ADVANCED DIALOGEX 0, 0, 244, 200
|
||||
|
|
|
@ -55,6 +55,11 @@ BEGIN_EVENT_TABLE(GFXConfigDialogDX,wxDialog)
|
|||
EVT_CHECKBOX(ID_FORCEANISOTROPY, GFXConfigDialogDX::EnhancementsSettingsChanged)
|
||||
EVT_CHECKBOX(ID_LOADHIRESTEXTURES, GFXConfigDialogDX::EnhancementsSettingsChanged)
|
||||
EVT_CHECKBOX(ID_EFBSCALEDCOPY, GFXConfigDialogDX::EnhancementsSettingsChanged)
|
||||
EVT_CHECKBOX(ID_PIXELLIGHTING, GFXConfigDialogDX::EnhancementsSettingsChanged)
|
||||
EVT_CHECKBOX(ID_ANAGLYPH, GFXConfigDialogDX::EnhancementsSettingsChanged)
|
||||
EVT_SLIDER(ID_ANAGLYPHSEPARATION, GFXConfigDialogDX::EnhancementsSettingsChanged)
|
||||
EVT_SLIDER(ID_ANAGLYPHFOCALANGLE, GFXConfigDialogDX::EnhancementsSettingsChanged)
|
||||
|
||||
|
||||
//Advanced Tab
|
||||
EVT_CHECKBOX(ID_DISABLEFOG, GFXConfigDialogDX::AdvancedSettingsChanged)
|
||||
|
@ -133,7 +138,10 @@ void GFXConfigDialogDX::InitializeGUIValues()
|
|||
m_HiresTextures->SetValue(g_Config.bHiresTextures);
|
||||
m_MSAAModeCB->SetSelection(g_Config.iMultisampleMode);
|
||||
m_EFBScaledCopy->SetValue(g_Config.bCopyEFBScaled);
|
||||
|
||||
m_Anaglyph->SetValue(g_Config.bAnaglyphStereo);
|
||||
m_PixelLighting->SetValue(g_Config.bEnablePixelLigting);
|
||||
m_AnaglyphSeparation->SetValue(g_Config.iAnaglyphStereoSeparation);
|
||||
m_AnaglyphFocalAngle->SetValue(g_Config.iAnaglyphFocalAngle);
|
||||
//Advance
|
||||
m_DisableFog->SetValue(g_Config.bDisableFog);
|
||||
m_OverlayFPS->SetValue(g_Config.bShowFPS);
|
||||
|
@ -267,6 +275,12 @@ void GFXConfigDialogDX::CreateGUIControls()
|
|||
wxStaticBoxSizer* sbEFBHacks;
|
||||
sbEFBHacks = new wxStaticBoxSizer( new wxStaticBox( m_PageEnhancements, wxID_ANY, wxT("EFB hacks") ), wxVERTICAL );
|
||||
m_EFBScaledCopy = new wxCheckBox( m_PageEnhancements, ID_EFBSCALEDCOPY, wxT("EFB scaled copy"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_Anaglyph = new wxCheckBox( m_PageEnhancements, ID_ANAGLYPH, wxT("Enable Anaglyph Stereo"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_PixelLighting = new wxCheckBox( m_PageEnhancements, ID_PIXELLIGHTING, wxT("Enable Pixel Lighting"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_AnaglyphSeparation = new wxSlider( m_PageEnhancements, ID_ANAGLYPHSEPARATION,2000,1,10000, wxDefaultPosition, wxDefaultSize, wxHORIZONTAL,wxDefaultValidator, wxT("Stereo separation") );
|
||||
m_AnaglyphFocalAngle = new wxSlider( m_PageEnhancements, ID_ANAGLYPHFOCALANGLE,0,-1000,1000, wxDefaultPosition, wxDefaultSize, wxHORIZONTAL,wxDefaultValidator, wxT("Stereo Focal Angle") );
|
||||
m_AnaglyphSeparationText = new wxStaticText( m_PageEnhancements, wxID_ANY, wxT("Stereo Separation:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_AnaglyphFocalAngleText= new wxStaticText( m_PageEnhancements, wxID_ANY, wxT("Focal Angle:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
||||
// Sizers
|
||||
wxBoxSizer* sEnhancements;
|
||||
|
@ -289,6 +303,21 @@ void GFXConfigDialogDX::CreateGUIControls()
|
|||
sbEFBHacks->Add( sEFBHacks, 1, wxEXPAND, 5 );
|
||||
sEnhancements->Add( sbEFBHacks, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbImprovements;
|
||||
sbImprovements = new wxStaticBoxSizer( new wxStaticBox( m_PageEnhancements, wxID_ANY, wxT("Improvements") ), wxVERTICAL );
|
||||
wxGridBagSizer* sImprovements;
|
||||
sImprovements = new wxGridBagSizer( 0, 0 );
|
||||
sImprovements->SetFlexibleDirection( wxBOTH );
|
||||
sImprovements->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
sImprovements->Add( m_Anaglyph, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 );
|
||||
sImprovements->Add( m_AnaglyphSeparationText, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 );
|
||||
sImprovements->Add( m_AnaglyphFocalAngleText, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALL, 5 );
|
||||
sImprovements->Add( m_AnaglyphSeparation, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 );
|
||||
sImprovements->Add( m_AnaglyphFocalAngle, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALL, 5 );
|
||||
sImprovements->Add( m_PixelLighting, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 );
|
||||
sbImprovements->Add( sImprovements, 1, wxEXPAND, 5 );
|
||||
sEnhancements->Add( sbImprovements, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
m_PageEnhancements->SetSizer( sEnhancements );
|
||||
m_PageEnhancements->Layout();
|
||||
sEnhancements->Fit( m_PageEnhancements );
|
||||
|
@ -447,7 +476,19 @@ void GFXConfigDialogDX::EnhancementsSettingsChanged(wxCommandEvent& event)
|
|||
g_Config.bHiresTextures = m_HiresTextures->IsChecked();
|
||||
break;
|
||||
case ID_EFBSCALEDCOPY:
|
||||
g_Config.bCopyEFBScaled = m_EFBScaledCopy->IsChecked();
|
||||
g_Config.bCopyEFBScaled = m_EFBScaledCopy->IsChecked();
|
||||
break;
|
||||
case ID_PIXELLIGHTING:
|
||||
g_Config.bEnablePixelLigting = m_PixelLighting->IsChecked();
|
||||
break;
|
||||
case ID_ANAGLYPH:
|
||||
g_Config.bAnaglyphStereo = m_Anaglyph->IsChecked();
|
||||
break;
|
||||
case ID_ANAGLYPHSEPARATION:
|
||||
g_Config.iAnaglyphStereoSeparation = m_AnaglyphSeparation->GetValue();
|
||||
break;
|
||||
case ID_ANAGLYPHFOCALANGLE:
|
||||
g_Config.iAnaglyphFocalAngle = m_AnaglyphFocalAngle->GetValue();
|
||||
break;
|
||||
}
|
||||
UpdateGUI();
|
||||
|
|
|
@ -106,7 +106,12 @@ class GFXConfigDialogDX : public wxDialog
|
|||
wxCheckBox *m_MaxAnisotropy;
|
||||
wxCheckBox *m_HiresTextures;
|
||||
wxCheckBox *m_EFBScaledCopy;
|
||||
|
||||
wxCheckBox *m_Anaglyph;
|
||||
wxCheckBox *m_PixelLighting;
|
||||
wxStaticText* m_AnaglyphSeparationText;
|
||||
wxSlider *m_AnaglyphSeparation;
|
||||
wxStaticText* m_AnaglyphFocalAngleText;
|
||||
wxSlider *m_AnaglyphFocalAngle;
|
||||
//Advanced Tab
|
||||
wxCheckBox *m_DisableFog;
|
||||
wxCheckBox *m_OverlayFPS;
|
||||
|
@ -173,7 +178,11 @@ class GFXConfigDialogDX : public wxDialog
|
|||
ID_ABOUT,
|
||||
ID_DIRERCT3D,
|
||||
ID_PAGEENHANCEMENTS,
|
||||
ID_PAGEADVANCED
|
||||
ID_PAGEADVANCED,
|
||||
ID_PIXELLIGHTING,
|
||||
ID_ANAGLYPH,
|
||||
ID_ANAGLYPHSEPARATION,
|
||||
ID_ANAGLYPHFOCALANGLE,
|
||||
};
|
||||
void InitializeAdapters();
|
||||
void OnClose(wxCloseEvent& event);
|
||||
|
|
|
@ -274,7 +274,7 @@ void PixelShaderCache::Shutdown()
|
|||
unique_shaders.clear();
|
||||
}
|
||||
|
||||
bool PixelShaderCache::SetShader(bool dstAlpha)
|
||||
bool PixelShaderCache::SetShader(bool dstAlpha,u32 components)
|
||||
{
|
||||
PIXELSHADERUID uid;
|
||||
GetPixelShaderId(&uid, dstAlpha);
|
||||
|
@ -312,7 +312,7 @@ bool PixelShaderCache::SetShader(bool dstAlpha)
|
|||
}
|
||||
|
||||
// OK, need to generate and compile it.
|
||||
const char *code = GeneratePixelShaderCode(dstAlpha, API_D3D9);
|
||||
const char *code = GeneratePixelShaderCode(dstAlpha, API_D3D9,components);
|
||||
|
||||
u32 code_hash = HashAdler32((const u8 *)code, strlen(code));
|
||||
unique_shaders.insert(code_hash);
|
||||
|
|
|
@ -60,7 +60,7 @@ private:
|
|||
public:
|
||||
static void Init();
|
||||
static void Shutdown();
|
||||
static bool SetShader(bool dstAlpha);
|
||||
static bool SetShader(bool dstAlpha, u32 componets);
|
||||
static bool InsertByteCode(const PIXELSHADERUID &uid, const u8 *bytecode, int bytecodelen, bool activate);
|
||||
static LPDIRECT3DPIXELSHADER9 GetColorMatrixProgram(int SSAAMode);
|
||||
static LPDIRECT3DPIXELSHADER9 GetColorCopyProgram(int SSAAMode);
|
||||
|
|
|
@ -977,7 +977,7 @@ void Renderer::SetBlendMode(bool forceUpdate)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static bool RightFrame = false;
|
||||
|
||||
void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,const EFBRectangle& rc)
|
||||
{
|
||||
|
@ -1000,6 +1000,25 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
|||
}
|
||||
|
||||
Renderer::ResetAPIState();
|
||||
if(g_ActiveConfig.bAnaglyphStereo)
|
||||
{
|
||||
if(RightFrame)
|
||||
{
|
||||
D3D::SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_GREEN);
|
||||
VertexShaderManager::ResetView();
|
||||
VertexShaderManager::TranslateView(-0.001f * g_ActiveConfig.iAnaglyphStereoSeparation,0.0f);
|
||||
VertexShaderManager::RotateView(-0.0001 *g_ActiveConfig.iAnaglyphFocalAngle,0.0f);
|
||||
RightFrame = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
D3D::SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_RED);
|
||||
VertexShaderManager::ResetView();
|
||||
VertexShaderManager::TranslateView(0.001f *g_ActiveConfig.iAnaglyphStereoSeparation,0.0f);
|
||||
VertexShaderManager::RotateView(0.0001 * g_ActiveConfig.iAnaglyphFocalAngle,0.0f);
|
||||
RightFrame = true;
|
||||
}
|
||||
}
|
||||
// Set the backbuffer as the rendering target
|
||||
D3D::dev->SetDepthStencilSurface(NULL);
|
||||
D3D::dev->SetRenderTarget(0, D3D::GetBackBufferSurface());
|
||||
|
@ -1014,7 +1033,8 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
|||
vp.MinZ = 0.0f;
|
||||
vp.MaxZ = 1.0f;
|
||||
D3D::dev->SetViewport(&vp);
|
||||
D3D::dev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
|
||||
//D3D::dev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
|
||||
D3D::drawClearQuad(0, 1.0, PixelShaderCache::GetClearProgram(), VertexShaderCache::GetClearVertexShader());
|
||||
|
||||
int X = dst_rect.left;
|
||||
int Y = dst_rect.top;
|
||||
|
@ -1102,6 +1122,11 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
|||
}
|
||||
D3D::RefreshSamplerState(0, D3DSAMP_MINFILTER);
|
||||
D3D::RefreshSamplerState(0, D3DSAMP_MAGFILTER);
|
||||
if(g_ActiveConfig.bAnaglyphStereo)
|
||||
{
|
||||
DWORD color_mask = D3DCOLORWRITEENABLE_ALPHA | D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE;
|
||||
D3D::SetRenderState(D3DRS_COLORWRITEENABLE, color_mask);
|
||||
}
|
||||
vp.X = 0;
|
||||
vp.Y = 0;
|
||||
vp.Width = s_backbuffer_width;
|
||||
|
|
|
@ -274,7 +274,7 @@ void Flush()
|
|||
VertexShaderManager::SetConstants();
|
||||
PixelShaderManager::SetConstants();
|
||||
|
||||
if (!PixelShaderCache::SetShader(false))
|
||||
if (!PixelShaderCache::SetShader(false,g_nativeVertexFmt->m_components))
|
||||
{
|
||||
DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");});
|
||||
goto shader_fail;
|
||||
|
@ -294,7 +294,7 @@ void Flush()
|
|||
if (bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate)
|
||||
{
|
||||
DWORD write = 0;
|
||||
if (!PixelShaderCache::SetShader(true))
|
||||
if (!PixelShaderCache::SetShader(true,g_nativeVertexFmt->m_components))
|
||||
{
|
||||
DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");});
|
||||
goto shader_fail;
|
||||
|
@ -304,7 +304,6 @@ void Flush()
|
|||
D3D::ChangeRenderState(D3DRS_ALPHABLENDENABLE, false);
|
||||
|
||||
Draw(stride);
|
||||
|
||||
D3D::RefreshRenderState(D3DRS_COLORWRITEENABLE);
|
||||
D3D::RefreshRenderState(D3DRS_ALPHABLENDENABLE);
|
||||
}
|
||||
|
|
|
@ -132,6 +132,16 @@ unsigned int ps_constant_offset_table[] = {
|
|||
76, 80, // C_INDTEXSCALE, 8
|
||||
84, 88, 92, 96, 100, 104, // C_INDTEXMTX, 24
|
||||
108, 112, // C_FOG, 8
|
||||
116, 120, 124 ,128, // C_COLORMATRIX, 16
|
||||
132, 136, 140, 144, 148, // C_PLIGHTS0, 20
|
||||
152, 156, 160, 164, 168, // C_PLIGHTS1, 20
|
||||
172, 176, 180, 184, 188, // C_PLIGHTS2, 20
|
||||
192, 196, 200, 204, 208, // C_PLIGHTS3, 20
|
||||
212, 216, 220, 224, 228, // C_PLIGHTS4, 20
|
||||
232, 236, 240, 244, 248, // C_PLIGHTS5, 20
|
||||
252, 256, 260, 264, 268, // C_PLIGHTS6, 20
|
||||
272, 276, 280, 284, 288, // C_PLIGHTS7, 20
|
||||
292, 296, 300, 304, // C_PMATERIALS, 16
|
||||
};
|
||||
void PixelShaderCache::SetPSConstant4f(unsigned int const_number, float f1, float f2, float f3, float f4)
|
||||
{
|
||||
|
|
|
@ -74,6 +74,7 @@ BEGIN_EVENT_TABLE(GFXConfigDialogOGL,wxDialog)
|
|||
EVT_RADIOBUTTON(ID_RADIO_SAFETEXTURECACHE_FAST, GFXConfigDialogOGL::AdvancedSettingsChanged)
|
||||
EVT_CHECKBOX(ID_DSTALPHAPASS,GFXConfigDialogOGL::AdvancedSettingsChanged)
|
||||
EVT_CHECKBOX(ID_CHECKBOX_DISABLECOPYEFB, GFXConfigDialogOGL::AdvancedSettingsChanged)
|
||||
EVT_CHECKBOX(ID_PIXELLIGHTING, GFXConfigDialogOGL::AdvancedSettingsChanged)
|
||||
EVT_RADIOBUTTON(ID_RADIO_COPYEFBTORAM, GFXConfigDialogOGL::AdvancedSettingsChanged)
|
||||
EVT_RADIOBUTTON(ID_RADIO_COPYEFBTOGL, GFXConfigDialogOGL::AdvancedSettingsChanged)
|
||||
EVT_CHECKBOX(ID_DLISTCACHING, GFXConfigDialogOGL::AdvancedSettingsChanged)
|
||||
|
@ -240,7 +241,8 @@ void GFXConfigDialogOGL::InitializeGUIValues()
|
|||
m_HiresTextures->SetValue(g_Config.bHiresTextures);
|
||||
m_DumpEFBTarget->SetValue(g_Config.bDumpEFBTarget);
|
||||
m_DumpFrames->SetValue(g_Config.bDumpFrames);
|
||||
m_FreeLook->SetValue(g_Config.bFreeLook);
|
||||
m_FreeLook->SetValue(g_Config.bFreeLook);
|
||||
m_PixelLighting->SetValue(g_Config.bEnablePixelLigting);;
|
||||
|
||||
// Hacks controls
|
||||
m_PhackvalueCB->SetSelection(g_Config.iPhackvalue);
|
||||
|
@ -308,6 +310,8 @@ void GFXConfigDialogOGL::InitializeGUITooltips()
|
|||
m_FreeLook->SetToolTip(
|
||||
wxT("Use WASD to move around, 0 and 9 to move faster or slower, and the")
|
||||
wxT(" left mouse button to pan the view."));
|
||||
m_PixelLighting->SetToolTip(
|
||||
wxT("Enables Pixel ligting to improve Ilumination."));
|
||||
|
||||
// Hacks controls
|
||||
m_SafeTextureCache->SetToolTip(wxT("This is useful to prevent Metroid Prime from crashing, but can cause problems in other games.")
|
||||
|
@ -450,6 +454,7 @@ void GFXConfigDialogOGL::CreateGUIControls()
|
|||
m_DisableTexturing = new wxCheckBox(m_PageAdvanced, ID_DISABLETEXTURING, wxT("Disable Texturing"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_DstAlphaPass = new wxCheckBox(m_PageAdvanced, ID_DSTALPHAPASS, wxT("Disable Destination Alpha Pass"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_DisableFog = new wxCheckBox(m_PageAdvanced, ID_DISABLEFOG, wxT("Disable Fog"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_PixelLighting = new wxCheckBox(m_PageAdvanced, ID_PIXELLIGHTING, wxT("Enable Pixel Lighting"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
|
||||
m_StaticBox_EFB = new wxStaticBox(m_PageAdvanced, ID_STATICBOX_EFB, wxT("EFB Copy"));
|
||||
m_CheckBox_DisableCopyEFB = new wxCheckBox(m_PageAdvanced, ID_CHECKBOX_DISABLECOPYEFB, wxT("Disable"));
|
||||
|
@ -462,7 +467,7 @@ void GFXConfigDialogOGL::CreateGUIControls()
|
|||
m_HiresTextures = new wxCheckBox(m_PageAdvanced, ID_HIRESTEXTURES, wxT("Load Hires textures"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_DumpEFBTarget = new wxCheckBox(m_PageAdvanced, ID_DUMPEFBTARGET, wxT("Dump EFB Target"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_DumpFrames = new wxCheckBox(m_PageAdvanced, ID_DUMPFRAMES, wxT("Dump Rendered Frames"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_FreeLook = new wxCheckBox(m_PageAdvanced, ID_FREELOOK, wxT("Free Look"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_FreeLook = new wxCheckBox(m_PageAdvanced, ID_FREELOOK, wxT("Free Look"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
|
||||
// Hacks controls
|
||||
sHacks = new wxStaticBoxSizer(wxVERTICAL, m_PageAdvanced, wxT("Hacks"));
|
||||
|
@ -503,6 +508,7 @@ void GFXConfigDialogOGL::CreateGUIControls()
|
|||
sRendering->Add(m_DstAlphaPass, wxGBPosition(3, 0), wxGBSpan(1, 1), wxALL, 4);
|
||||
sRendering->Add(m_DisableFog, wxGBPosition(4, 0), wxGBSpan(1, 1), wxALL, 4);
|
||||
sRendering->Add(m_DlistCaching, wxGBPosition(5, 0), wxGBSpan(1, 1), wxALL, 4);
|
||||
sRendering->Add(m_PixelLighting, wxGBPosition(6, 0), wxGBSpan(1, 1), wxALL, 4);
|
||||
|
||||
sRenderBoxRow1->Add(sRendering, 0, wxALL|wxEXPAND, 1);
|
||||
wxStaticBoxSizer *sSBox = new wxStaticBoxSizer(m_StaticBox_EFB, wxVERTICAL);
|
||||
|
@ -683,6 +689,9 @@ void GFXConfigDialogOGL::AdvancedSettingsChanged(wxCommandEvent& event)
|
|||
case ID_DISABLEFOG:
|
||||
g_Config.bDisableFog = m_DisableFog->IsChecked();
|
||||
break;
|
||||
case ID_PIXELLIGHTING:
|
||||
g_Config.bEnablePixelLigting = m_PixelLighting->IsChecked();
|
||||
break;
|
||||
case ID_DSTALPHAPASS:
|
||||
g_Config.bDstAlphaPass = m_DstAlphaPass->IsChecked();
|
||||
break;
|
||||
|
|
|
@ -119,6 +119,7 @@ class GFXConfigDialogOGL : public wxDialog
|
|||
wxCheckBox *m_DumpEFBTarget;
|
||||
wxCheckBox *m_DumpFrames;
|
||||
wxCheckBox *m_FreeLook;
|
||||
wxCheckBox *m_PixelLighting;
|
||||
wxStaticBox * m_StaticBox_EFB;
|
||||
wxCheckBox *m_CheckBox_DisableCopyEFB;
|
||||
wxRadioButton *m_Radio_CopyEFBToRAM, *m_Radio_CopyEFBToGL;
|
||||
|
@ -174,6 +175,7 @@ class GFXConfigDialogOGL : public wxDialog
|
|||
|
||||
ID_WIREFRAME,
|
||||
ID_DISABLELIGHTING,
|
||||
ID_PIXELLIGHTING,
|
||||
ID_DISABLETEXTURING,
|
||||
ID_DISABLEFOG,
|
||||
ID_STATICBOX_EFB,
|
||||
|
|
|
@ -155,8 +155,9 @@ void FreeLookInput( UINT iMsg, WPARAM wParam )
|
|||
{
|
||||
static float debugSpeed = 1.0f;
|
||||
static bool mouseLookEnabled = false;
|
||||
static bool mouseMoveEnabled = false;
|
||||
static float lastMouse[2];
|
||||
|
||||
POINT point;
|
||||
switch( iMsg )
|
||||
{
|
||||
case WM_USER_KEYDOWN:
|
||||
|
@ -189,24 +190,38 @@ void FreeLookInput( UINT iMsg, WPARAM wParam )
|
|||
|
||||
case WM_MOUSEMOVE:
|
||||
if (mouseLookEnabled) {
|
||||
POINT point;
|
||||
GetCursorPos(&point);
|
||||
VertexShaderManager::RotateView((point.x - lastMouse[0]) / 200.0f, (point.y - lastMouse[1]) / 200.0f);
|
||||
lastMouse[0] = point.x;
|
||||
lastMouse[1] = point.y;
|
||||
}
|
||||
|
||||
if (mouseMoveEnabled) {
|
||||
GetCursorPos(&point);
|
||||
VertexShaderManager::TranslateView((point.x - lastMouse[0]) / 50.0f, (point.y - lastMouse[1]) / 50.0f);
|
||||
lastMouse[0] = point.x;
|
||||
lastMouse[1] = point.y;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_RBUTTONDOWN:
|
||||
POINT point;
|
||||
GetCursorPos(&point);
|
||||
lastMouse[0] = point.x;
|
||||
lastMouse[1] = point.y;
|
||||
mouseLookEnabled= true;
|
||||
break;
|
||||
case WM_MBUTTONDOWN:
|
||||
GetCursorPos(&point);
|
||||
lastMouse[0] = point.x;
|
||||
lastMouse[1] = point.y;
|
||||
mouseMoveEnabled= true;
|
||||
break;
|
||||
case WM_RBUTTONUP:
|
||||
mouseLookEnabled = false;
|
||||
break;
|
||||
case WM_MBUTTONUP:
|
||||
mouseMoveEnabled = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ GLuint PixelShaderCache::GetDepthMatrixProgram()
|
|||
}
|
||||
|
||||
|
||||
FRAGMENTSHADER* PixelShaderCache::GetShader(bool dstAlphaEnable)
|
||||
FRAGMENTSHADER* PixelShaderCache::GetShader(bool dstAlphaEnable,u32 components)
|
||||
{
|
||||
DVSTARTPROFILE();
|
||||
PIXELSHADERUID uid;
|
||||
|
@ -214,7 +214,7 @@ FRAGMENTSHADER* PixelShaderCache::GetShader(bool dstAlphaEnable)
|
|||
PSCacheEntry& newentry = pshaders[uid];
|
||||
newentry.frameCount = frameCount;
|
||||
pShaderLast = &newentry.shader;
|
||||
const char *code = GeneratePixelShaderCode(dstAlphaEnable,API_OPENGL);
|
||||
const char *code = GeneratePixelShaderCode(dstAlphaEnable,API_OPENGL,components);
|
||||
|
||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||
if (g_ActiveConfig.iLog & CONF_SAVESHADERS && code) {
|
||||
|
|
|
@ -71,7 +71,7 @@ public:
|
|||
static void Init();
|
||||
static void Shutdown();
|
||||
|
||||
static FRAGMENTSHADER* GetShader(bool dstAlphaEnable);
|
||||
static FRAGMENTSHADER* GetShader(bool dstAlphaEnable,u32 components);
|
||||
static bool CompilePixelShader(FRAGMENTSHADER& ps, const char* pstrprogram);
|
||||
|
||||
static GLuint GetColorMatrixProgram();
|
||||
|
|
|
@ -894,7 +894,6 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
|||
DVSTARTPROFILE();
|
||||
|
||||
ResetAPIState();
|
||||
|
||||
TargetRectangle back_rc;
|
||||
ComputeDrawRectangle(m_CustomWidth, m_CustomHeight, true, &back_rc);
|
||||
|
||||
|
@ -1083,7 +1082,8 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
|||
}
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
|
||||
TextureMngr::DisableStage(0);
|
||||
|
||||
if(g_ActiveConfig.bAnaglyphStereo)
|
||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
// Wireframe
|
||||
if (g_ActiveConfig.bWireFrame)
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
|
@ -1305,8 +1305,11 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
|||
GL_REPORT_ERRORD();
|
||||
|
||||
// Clear framebuffer
|
||||
glClearColor(0, 0, 0, 0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
if(!g_ActiveConfig.bAnaglyphStereo)
|
||||
{
|
||||
glClearColor(0, 0, 0, 0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
|
|
|
@ -289,7 +289,7 @@ void Flush()
|
|||
}
|
||||
}
|
||||
|
||||
FRAGMENTSHADER* ps = PixelShaderCache::GetShader(false);
|
||||
FRAGMENTSHADER* ps = PixelShaderCache::GetShader(false,g_nativeVertexFmt->m_components);
|
||||
VERTEXSHADER* vs = VertexShaderCache::GetShader(g_nativeVertexFmt->m_components);
|
||||
|
||||
// set global constants
|
||||
|
@ -306,7 +306,7 @@ void Flush()
|
|||
// run through vertex groups again to set alpha
|
||||
if (!g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate)
|
||||
{
|
||||
ps = PixelShaderCache::GetShader(true);
|
||||
ps = PixelShaderCache::GetShader(true,g_nativeVertexFmt->m_components);
|
||||
|
||||
if (ps)PixelShaderCache::SetCurrentShader(ps->glprogid);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue