Merge branch 'arb_framebuffer' into GLSL-master

Conflicts:
	Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp
	Source/Plugins/Plugin_VideoOGL/Src/RasterFont.cpp
	Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
	Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp
	Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.cpp
This commit is contained in:
degasus 2013-01-09 11:00:26 +01:00
commit bff02b3b73
34 changed files with 300 additions and 431 deletions

View file

@ -158,7 +158,7 @@ public:
case MODE_READ: x = (wchar_t*)*ptr; break;
case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break;
case MODE_MEASURE: break;
case MODE_VERIFY: _dbg_assert_msg_(COMMON, x == (wchar_t*)*ptr, "Savestate verification failure: \"%s\" != \"%s\" (at %p).\n", x.c_str(), (wchar_t*)*ptr, ptr); break;
case MODE_VERIFY: _dbg_assert_msg_(COMMON, x == (wchar_t*)*ptr, "Savestate verification failure: \"%ls\" != \"%ls\" (at %p).\n", x.c_str(), (wchar_t*)*ptr, ptr); break;
}
(*ptr) += stringLen;
}

View file

@ -1068,8 +1068,10 @@ void XEmitter::XOR (int bits, const OpArg &a1, const OpArg &a2) {WriteNormalOp(t
void XEmitter::MOV (int bits, const OpArg &a1, const OpArg &a2)
{
#ifdef _DEBUG
#ifndef _M_X64
_assert_msg_(DYNA_REC, !a1.IsSimpleReg() || !a2.IsSimpleReg() || a1.GetSimpleReg() != a2.GetSimpleReg(), "Redundant MOV @ %p - bug in JIT?",
code);
code);
#endif
#endif
WriteNormalOp(this, bits, nrmMOV, a1, a2);
}

View file

@ -218,13 +218,12 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit)
do {
movcnt = 0;
for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) {
if (cache.regs[i].loc.GetSimpleReg() !=
regs[i].loc.GetSimpleReg() &&
xregs[cache.regs[i].loc.GetSimpleReg()].guest_reg == DSP_REG_NONE)
X64Reg simple = regs[i].loc.GetSimpleReg();
X64Reg simple_cache = cache.regs[i].loc.GetSimpleReg();
if (simple_cache != simple
&& xregs[simple_cache].guest_reg == DSP_REG_NONE)
{
movToHostReg(i,
cache.regs[i].loc.GetSimpleReg(),
true);
movToHostReg(i, simple_cache, true);
movcnt++;
}
}

View file

@ -290,7 +290,7 @@ bool CEXIETHERNET::IsWriteCommand(u32 const data)
return IsMXCommand(data) ? !!(data & (1 << 30)) : !!(data & (1 << 14));
}
char const * const CEXIETHERNET::GetRegisterName() const
const char* CEXIETHERNET::GetRegisterName() const
{
#define STR_RETURN(x) case x: return #x;

View file

@ -297,7 +297,7 @@ public:
bool IsMXCommand(u32 const data);
bool IsWriteCommand(u32 const data);
char const * const GetRegisterName() const;
const char* GetRegisterName() const;
void MXHardReset();
void MXCommandHandler(u32 data, u32 size);
void DirectFIFOWrite(u8 *data, u32 size);

View file

@ -78,7 +78,7 @@ private:
virtual void TransferByte(u8 &_uByte);
bool IsWriteCommand() const { return !!(m_uAddress & (1 << 31)); }
u32 const CommandRegion() const { return (m_uAddress & ~(1 << 31)) >> 8; }
const u32 CommandRegion() const { return (m_uAddress & ~(1 << 31)) >> 8; }
void LoadFileToIPL(std::string filename, u32 offset);
};

View file

@ -132,14 +132,12 @@ bool CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
if(Movie::IsPlayingInput())
{
Movie::PlayController(&PadStatus, ISIDevice::m_iDeviceNumber);
if(!Movie::IsUsingWiimote(0))
Movie::InputUpdate();
Movie::InputUpdate();
}
else if(Movie::IsRecordingInput())
{
Movie::RecordInput(&PadStatus, ISIDevice::m_iDeviceNumber);
if(!Movie::IsUsingWiimote(0))
Movie::InputUpdate();
Movie::InputUpdate();
}
else
Movie::CheckPadStatus(&PadStatus, ISIDevice::m_iDeviceNumber);

View file

@ -173,7 +173,7 @@ bool Wiimote::Read()
return true;
}
delete rpt.first;
delete[] rpt.first;
return false;
}

View file

@ -387,7 +387,7 @@ void ExecuteCommand(u32 _Address)
INFO_LOG(WII_IPC_FILEIO, "IOP: Open File (Device=%s, ID=%08x, Mode=%i)",
pDevice->GetDeviceName().c_str(), DeviceID, Mode);
if (Memory::Read_U32(_Address + 4) == DeviceID)
if (Memory::Read_U32(_Address + 4) == (u32)DeviceID)
{
g_FdMap[DeviceID] = pDevice;
}

View file

@ -196,7 +196,7 @@ bool CWII_IPC_HLE_Device_FileIO::Seek(u32 _CommandAddress)
switch (Mode){
case 0:
{
if (SeekPosition >=0 && SeekPosition <= fileSize)
if (SeekPosition <= fileSize)
{
m_SeekPos = SeekPosition;
ReturnValue = m_SeekPos;
@ -206,7 +206,7 @@ bool CWII_IPC_HLE_Device_FileIO::Seek(u32 _CommandAddress)
case 1:
{
u32 wantedPos = SeekPosition+m_SeekPos;
if (wantedPos >=0 && wantedPos <= fileSize)
if (wantedPos <= fileSize)
{
m_SeekPos = wantedPos;
ReturnValue = m_SeekPos;
@ -216,7 +216,7 @@ bool CWII_IPC_HLE_Device_FileIO::Seek(u32 _CommandAddress)
case 2:
{
u64 wantedPos = fileSize+m_SeekPos;
if (wantedPos >=0 && wantedPos <= fileSize)
if (wantedPos <= fileSize)
{
m_SeekPos = wantedPos;
ReturnValue = m_SeekPos;

View file

@ -789,8 +789,8 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
{
static CWII_IPC_HLE_Device_usb_oh1_57e_305* s_Usb = GetUsbPointer();
bool* wiiMoteConnected = new bool[s_Usb->m_WiiMotes.size()];
for(unsigned int i = 0; i < s_Usb->m_WiiMotes.size();
i++) wiiMoteConnected[i] = s_Usb->m_WiiMotes[i].IsConnected();
for (unsigned int i = 0; i < s_Usb->m_WiiMotes.size(); i++)
wiiMoteConnected[i] = s_Usb->m_WiiMotes[i].IsConnected();
std::string tContentFile(m_ContentFile.c_str());
WII_IPC_HLE_Interface::Reset(true);

View file

@ -31,7 +31,7 @@ struct NANDStat
};
enum {
FS_RESULT_OK = 0,
FS_RESULT_OK = 0,
FS_INVALID = -4,
FS_DIRFILE_NOT_FOUND = -6,
FS_RESULT_FATAL = -101,

View file

@ -116,26 +116,26 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::DoState(PointerWrap &p)
p.Do(m_EventQueue);
m_acl_pool.DoState(p);
for (unsigned int i = 0; i < 4; i++)
m_WiiMotes[i].DoState(p);
// Reset the connection of real and hybrid wiimotes
if (p.GetMode() == PointerWrap::MODE_READ && SConfig::GetInstance().m_WiimoteReconnectOnLoad)
{
for (unsigned int i = 0; i < 4; i++)
{
if (WIIMOTE_SRC_EMU == g_wiimote_sources[i] || WIIMOTE_SRC_NONE == g_wiimote_sources[i])
continue;
// TODO: Selectively clear real wiimote messages if possible. Or create a real wiimote channel and reporting mode pre-setup to vacate the need for m_WiimoteReconnectOnLoad.
m_EventQueue.clear();
if (!m_WiiMotes[i].IsInactive())
{
m_WiiMotes[i].Activate(false);
m_WiiMotes[i].Activate(true);
}
else
m_WiiMotes[i].Activate(false);
}
for (unsigned int i = 0; i < 4; i++)
m_WiiMotes[i].DoState(p);
// Reset the connection of real and hybrid wiimotes
if (p.GetMode() == PointerWrap::MODE_READ && SConfig::GetInstance().m_WiimoteReconnectOnLoad)
{
for (unsigned int i = 0; i < 4; i++)
{
if (WIIMOTE_SRC_EMU == g_wiimote_sources[i] || WIIMOTE_SRC_NONE == g_wiimote_sources[i])
continue;
// TODO: Selectively clear real wiimote messages if possible. Or create a real wiimote channel and reporting mode pre-setup to vacate the need for m_WiimoteReconnectOnLoad.
m_EventQueue.clear();
if (!m_WiiMotes[i].IsInactive())
{
m_WiiMotes[i].Activate(false);
m_WiiMotes[i].Activate(true);
}
else
m_WiiMotes[i].Activate(false);
}
}
}

View file

@ -36,6 +36,7 @@
#include "HW/DVDInterface.h"
#include "../../Common/Src/NandPaths.h"
#include "Crypto/md5.h"
#include "scmrev.h"
// The chunk to allocate movie data in multiples of.
#define DTM_BASE_LENGTH (1024)
@ -72,6 +73,7 @@ std::string author = "";
u64 g_titleID = 0;
unsigned char MD5[16];
u8 bongos;
u8 revision[20];
bool g_bRecordingFromSaveState = false;
bool g_bPolled = false;
@ -687,6 +689,7 @@ void ReadHeader()
g_bClearSave = tmpHeader.bClearSave;
bMemcard = tmpHeader.bMemcard;
bongos = tmpHeader.bongos;
memcpy(revision, tmpHeader.revision, ARRAYSIZE(revision));
}
else
{
@ -1132,6 +1135,7 @@ void SaveRecording(const char *filename)
strncpy((char *)header.author, author.c_str(),ARRAYSIZE(header.author));
memcpy(header.md5,MD5,16);
header.bongos = bongos;
memcpy(header.revision, revision, ARRAYSIZE(header.revision));
// TODO
header.uniqueID = 0;
@ -1189,6 +1193,10 @@ void GetSettings()
if (!Core::g_CoreStartupParameter.bWii)
g_bClearSave = !File::Exists(SConfig::GetInstance().m_strMemoryCardA);
bMemcard = SConfig::GetInstance().m_EXIDevice[0] == EXIDEVICE_MEMORYCARD;
std::stringstream ss;
ss << std::hex << SCM_REV_STR;
ss >> revision;
}
void CheckMD5()

View file

@ -121,7 +121,8 @@ struct DTMHeader {
u8 bongos;
u8 reserved[15]; // Padding for any new config options
u8 discChange[40]; // Name of iso file to switch to, for two disc games.
u8 reserved2[47]; // Make heading 256 bytes, just because we can
u8 revision[20]; // Git hash
u8 reserved2[27]; // Make heading 256 bytes, just because we can
};
static_assert(sizeof(DTMHeader) == 256, "DTMHeader should be 256 bytes");

View file

@ -365,8 +365,6 @@ CFrame::CFrame(wxFrame* parent,
// ---------------
// Manager
// wxAUI_MGR_LIVE_RESIZE does not exist in the wxWidgets 2.8.9 that comes with Ubuntu 9.04
// Could just check for wxWidgets version if it becomes a problem.
m_Mgr = new wxAuiManager(this, wxAUI_MGR_DEFAULT | wxAUI_MGR_LIVE_RESIZE);
m_Mgr->AddPane(m_Panel, wxAuiPaneInfo()

View file

@ -50,6 +50,7 @@ Core::GetWindowHandle().
#include "LogConfigWindow.h"
#include "FifoPlayerDlg.h"
#include "WxUtils.h"
#include "Host.h"
#include "ConfigManager.h" // Core
#include "Core.h"
@ -96,6 +97,8 @@ extern "C" {
#include "../resources/KDE.h"
};
bool confirmStop = false;
// Create menu items
// ---------------------
void CFrame::CreateMenu()
@ -1070,6 +1073,9 @@ void CFrame::DoPause()
// Stop the emulation
void CFrame::DoStop()
{
if (confirmStop)
return;
m_bGameLoading = false;
if (Core::GetState() != Core::CORE_UNINITIALIZED ||
m_RenderParent != NULL)
@ -1082,17 +1088,23 @@ void CFrame::DoStop()
// Ask for confirmation in case the user accidentally clicked Stop / Escape
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop)
{
wxMessageDialog *m_StopDlg = new wxMessageDialog(
Core::EState state = Core::GetState();
confirmStop = true;
Core::SetState(Core::CORE_PAUSE);
wxMessageDialog m_StopDlg(
this,
_("Do you want to stop the current emulation?"),
_("Please confirm..."),
wxYES_NO | wxSTAY_ON_TOP | wxICON_EXCLAMATION,
wxDefaultPosition);
int Ret = m_StopDlg->ShowModal();
m_StopDlg->Destroy();
int Ret = m_StopDlg.ShowModal();
confirmStop = false;
if (Ret != wxID_YES)
{
Core::SetState(state);
return;
}
}
// TODO: Show the author/description dialog here
@ -1457,12 +1469,17 @@ void CFrame::ConnectWiimote(int wm_idx, bool connect)
wxString msg(wxString::Format(wxT("Wiimote %i %s"), wm_idx + 1,
connect ? wxT("Connected") : wxT("Disconnected")));
Core::DisplayMessage(msg.ToAscii(), 3000);
// Wait for the wiimote to connect
while (GetUsbPointer()->AccessWiiMote(wm_idx | 0x100)->IsConnected() != connect)
{}
Host_UpdateMainFrame();
}
}
void CFrame::OnConnectWiimote(wxCommandEvent& event)
{
ConnectWiimote(event.GetId() - IDM_CONNECT_WIIMOTE1, event.IsChecked());
ConnectWiimote(event.GetId() - IDM_CONNECT_WIIMOTE1, !GetUsbPointer()->AccessWiiMote((event.GetId() - IDM_CONNECT_WIIMOTE1) | 0x100)->IsConnected());
}
// Toogle fullscreen. In Windows the fullscreen mode is accomplished by expanding the m_Panel to cover

View file

@ -60,8 +60,6 @@ bool cInterfaceGLX::Create(void *&window_handle)
GLX_GREEN_SIZE, 8,
GLX_BLUE_SIZE, 8,
GLX_DEPTH_SIZE, 24,
GLX_SAMPLE_BUFFERS_ARB, g_Config.iMultisampleMode != MULTISAMPLE_OFF?1:0,
GLX_SAMPLES_ARB, g_Config.iMultisampleMode != MULTISAMPLE_OFF?1:0,
None };
int attrListDefault[] = {

View file

@ -50,6 +50,7 @@ bool cInterfaceWX::Create(void *&window_handle)
GLWin.glCanvas->Show(true);
if (GLWin.glCtxt == NULL) // XXX dirty hack
GLWin.glCtxt = new wxGLContext(GLWin.glCanvas);
return true;
}
bool cInterfaceWX::MakeCurrent()

View file

@ -45,6 +45,10 @@
#include <wx/intl.h>
#ifdef _WIN32
#include <shellapi.h>
#endif
// Nvidia drivers >= v302 will check if the application exports a global
// variable named NvOptimusEnablement to know if it should run the app in high
// performance graphics mode or using the IGP.
@ -264,6 +268,19 @@ bool DolphinApp::OnInit()
int w = SConfig::GetInstance().m_LocalCoreStartupParameter.iWidth;
int h = SConfig::GetInstance().m_LocalCoreStartupParameter.iHeight;
#ifdef _WIN32
if (File::Exists("www.dolphin-emulator.com.txt"))
{
File::Delete("www.dolphin-emulator.com.txt");
MessageBox(NULL,
L"This version of Dolphin was downloaded from a website stealing money from developers of the emulator. Please "
L"download Dolphin from the official website instead: http://dolphin-emu.org/",
L"Unofficial version detected", MB_OK | MB_ICONWARNING);
ShellExecute(NULL, L"open", L"http://dolphin-emu.org/?ref=badver", NULL, NULL, SW_SHOWDEFAULT);
exit(0);
}
#endif
// The following is not needed with X11, where window managers
// do not allow windows to be created off the desktop.
#ifdef _WIN32

View file

@ -405,6 +405,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
_3d_vision = CreateCheckBox(page_enh, _("3D Vision"), wxGetTranslation(_3d_vision_desc), vconfig.b3DVision);
_3d_vision->Show(vconfig.backend_info.bSupports3DVision);
szr_enh->Add(_3d_vision);
szr_enh->Add(CreateCheckBox(page_enh, _("Widescreen Hack"), wxGetTranslation(ws_hack_desc), vconfig.bWidescreenHack));
// TODO: Add anaglyph 3d here
wxStaticBoxSizer* const group_enh = new wxStaticBoxSizer(wxVERTICAL, page_enh, _("Enhancements"));
@ -553,8 +554,6 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
szr_misc->Add(CreateCheckBox(page_advanced, _("Crop"), wxGetTranslation(crop_desc), vconfig.bCrop));
szr_misc->Add(CreateCheckBox(page_advanced, _("Enable Hotkeys"), wxGetTranslation(hotkeys_desc), vconfig.bOSDHotKey));
szr_misc->Add(CreateCheckBox(page_advanced, _("Widescreen Hack"), wxGetTranslation(ws_hack_desc), vconfig.bWidescreenHack));
// Progressive Scan
{
wxCheckBox* const cb_prog_scan = new wxCheckBox(page_advanced, wxID_ANY, _("Enable Progressive Scan"));

View file

@ -304,8 +304,7 @@ void PixelShaderManager::SetConstants()
float GC_ALIGNED16(material[4]);
float NormalizationCoef = 1 / 255.0f;
// TODO: This code is wrong. i goes out of range for xfregs.ambColor.
for (int i = 0; i < 4; ++i)
for (int i = 0; i < 2; ++i)
{
if (nMaterialsChanged & (1 << i))
{
@ -319,6 +318,21 @@ void PixelShaderManager::SetConstants()
SetPSConstant4fv(C_PMATERIALS + i, material);
}
}
for (int i = 0; i < 2; ++i)
{
if (nMaterialsChanged & (1 << (i + 2)))
{
u32 data = *(xfregs.matColor + i);
material[0] = ((data >> 24) & 0xFF) * NormalizationCoef;
material[1] = ((data >> 16) & 0xFF) * NormalizationCoef;
material[2] = ((data >> 8) & 0xFF) * NormalizationCoef;
material[3] = ( data & 0xFF) * NormalizationCoef;
SetPSConstant4fv(C_PMATERIALS + i + 2, material);
}
}
nMaterialsChanged = 0;
}

View file

@ -253,8 +253,7 @@ void VertexShaderManager::SetConstants()
float GC_ALIGNED16(material[4]);
float NormalizationCoef = 1 / 255.0f;
// TODO: This code is wrong. i goes out of range for xfregs.ambColor.
for (int i = 0; i < 4; ++i)
for (int i = 0; i < 2; ++i)
{
if (nMaterialsChanged & (1 << i))
{
@ -268,6 +267,21 @@ void VertexShaderManager::SetConstants()
SetVSConstant4fv(C_MATERIALS + i, material);
}
}
for (int i = 0; i < 2; ++i)
{
if (nMaterialsChanged & (1 << (i + 2)))
{
u32 data = *(xfregs.matColor + i);
material[0] = ((data >> 24) & 0xFF) * NormalizationCoef;
material[1] = ((data >> 16) & 0xFF) * NormalizationCoef;
material[2] = ((data >> 8) & 0xFF) * NormalizationCoef;
material[3] = ( data & 0xFF) * NormalizationCoef;
SetVSConstant4fv(C_MATERIALS + i + 2, material);
}
}
nMaterialsChanged = 0;
}

View file

@ -44,17 +44,14 @@ enum
EFB_HEIGHT = 528,
};
enum
{
// XFB width is decided by EFB copy operation. The VI can do horizontal
// scaling (TODO: emulate).
MAX_XFB_WIDTH = EFB_WIDTH,
// XFB width is decided by EFB copy operation. The VI can do horizontal
// scaling (TODO: emulate).
const u32 MAX_XFB_WIDTH = EFB_WIDTH;
// Although EFB height is 528, 574-line XFB's can be created either with
// vertical scaling by the EFB copy operation or copying to multiple XFB's
// that are next to each other in memory (TODO: handle that situation).
MAX_XFB_HEIGHT = 574
};
// Although EFB height is 528, 574-line XFB's can be created either with
// vertical scaling by the EFB copy operation or copying to multiple XFB's
// that are next to each other in memory (TODO: handle that situation).
const u32 MAX_XFB_HEIGHT = 574;
// Logging
// ----------