Fix the video software backend. (closes issue 4269)

Some warning fixes and cleanup.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7361 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
sl1nk3.s
2011-03-16 22:48:17 +00:00
parent bca4f94b47
commit 571013acd8
32 changed files with 213 additions and 629 deletions
+3 -6
View File
@@ -23,9 +23,8 @@
#include "../../../Plugins/Plugin_VideoDX11/Src/VideoBackend.h"
#endif
#include "../../../Plugins/Plugin_VideoOGL/Src/VideoBackend.h"
#ifndef _WIN32
#include "../../../Plugins/Plugin_VideoSoftware/Src/VideoBackend.h"
#endif
std::vector<VideoBackend*> g_available_video_backends;
VideoBackend* g_video_backend = NULL;
@@ -37,11 +36,9 @@ void VideoBackend::PopulateList()
g_available_video_backends.push_back(new DX11::VideoBackend);
#endif
g_available_video_backends.push_back(new OGL::VideoBackend);
#ifndef _WIN32
g_available_video_backends.push_back(new SW::VideoBackend);
#endif
g_video_backend = g_available_video_backends.front();
g_available_video_backends.push_back(new SW::VideoSoftware);
g_video_backend = g_available_video_backends.front();
}
void VideoBackend::ClearList()
+20 -8
View File
@@ -23,6 +23,11 @@
#include "ChunkFile.h"
typedef void (*writeFn16)(const u16,const u32);
typedef void (*writeFn32)(const u32,const u32);
typedef void (*readFn16)(u16&, const u32);
enum FieldType
{
FIELD_PROGRESSIVE = 0,
@@ -97,7 +102,6 @@ public:
virtual void ShowConfig(void*) {}
virtual void Video_Prepare() = 0;
virtual void Video_EnterLoop() = 0;
virtual void Video_ExitLoop() = 0;
@@ -112,11 +116,17 @@ public:
virtual void Video_SetRendering(bool bEnabled) = 0;
static void Video_GatherPipeBursted();
virtual void Video_GatherPipeBursted() = 0;
virtual bool Video_IsPossibleWaitingSetDrawDone() = 0;
virtual void Video_AbortFrame() = 0;
virtual readFn16 Video_CPRead16() = 0;
virtual writeFn16 Video_CPWrite16() = 0;
virtual readFn16 Video_PERead16() = 0;
virtual writeFn16 Video_PEWrite16() = 0;
virtual writeFn32 Video_PEWrite32() = 0;
static void PopulateList();
static void ClearList();
static void ActivateBackend(const std::string& name);
@@ -126,7 +136,7 @@ extern std::vector<VideoBackend*> g_available_video_backends;
extern VideoBackend* g_video_backend;
// inherited by dx9/dx11/ogl backends
class VideoBackendHLE : public VideoBackend
class VideoBackendHardware : public VideoBackend
{
void DoState(PointerWrap &p);
void RunLoop(bool enable);
@@ -145,14 +155,16 @@ class VideoBackendHLE : public VideoBackend
void Video_SetRendering(bool bEnabled);
void Video_GatherPipeBursted();
bool Video_IsPossibleWaitingSetDrawDone();
void Video_AbortFrame();
};
// inherited by software renderer
class VideoBackendLLE : public VideoBackend
{
readFn16 Video_CPRead16();
writeFn16 Video_CPWrite16();
readFn16 Video_PERead16();
writeFn16 Video_PEWrite16();
writeFn32 Video_PEWrite32();
};
#endif
+11 -12
View File
@@ -45,8 +45,7 @@ may be redirected here (for example to Read_U32()).
#include "WII_IPC.h"
#include "../ConfigManager.h"
#include "../Debugger/Debugger_SymbolMap.h"
#include "CommandProcessor.h"
#include "PixelEngine.h"
#include "VideoBackendBase.h"
namespace Memory
{
@@ -180,12 +179,12 @@ void InitHWMemFuncs()
for (int i = 0; i < BLOCKSIZE; i++)
{
hwRead16 [CP_START+i] = CommandProcessor::Read16;
hwWrite16[CP_START+i] = CommandProcessor::Write16;
hwRead16 [CP_START+i] = g_video_backend->Video_CPRead16();
hwWrite16[CP_START+i] = g_video_backend->Video_CPWrite16();
hwRead16 [PE_START+i] = PixelEngine::Read16;
hwWrite16[PE_START+i] = PixelEngine::Write16;
hwWrite32[PE_START+i] = PixelEngine::Write32;
hwRead16 [PE_START+i] = g_video_backend->Video_PERead16();
hwWrite16[PE_START+i] = g_video_backend->Video_PEWrite16();
hwWrite32[PE_START+i] = g_video_backend->Video_PEWrite32();
hwRead8 [VI_START+i] = VideoInterface::Read8;
hwRead16 [VI_START+i] = VideoInterface::Read16;
@@ -253,12 +252,12 @@ void InitHWMemFuncsWii()
// MI, PI, DSP are still mapped to 0xCCxxxxxx
for (int i = 0; i < BLOCKSIZE; i++)
{
hwRead16 [CP_START+i] = CommandProcessor::Read16;
hwWrite16[CP_START+i] = CommandProcessor::Write16;
hwRead16 [CP_START+i] = g_video_backend->Video_CPRead16();
hwWrite16[CP_START+i] = g_video_backend->Video_CPWrite16();
hwRead16 [PE_START+i] = PixelEngine::Read16;
hwWrite16[PE_START+i] = PixelEngine::Write16;
hwWrite32[PE_START+i] = PixelEngine::Write32;
hwRead16 [PE_START+i] = g_video_backend->Video_PERead16();
hwWrite16[PE_START+i] = g_video_backend->Video_PEWrite16();
hwWrite32[PE_START+i] = g_video_backend->Video_PEWrite32();
hwRead16 [PI_START+i] = ProcessorInterface::Read16;
hwRead32 [PI_START+i] = ProcessorInterface::Read32;
+4 -1
View File
@@ -359,6 +359,9 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /
<ProjectReference Include="..\..\Plugins\Plugin_VideoOGL\Plugin_VideoOGL.vcxproj">
<Project>{1909cd2d-1707-456f-86ca-0df42a727c99}</Project>
</ProjectReference>
<ProjectReference Include="..\..\Plugins\Plugin_VideoSoftware\Plugin_VideoSoftware.vcxproj">
<Project>{9e9da440-e9ad-413c-b648-91030e792211}</Project>
</ProjectReference>
<ProjectReference Include="..\AudioCommon\AudioCommon.vcxproj">
<Project>{37d007bd-d66c-4eaf-b56c-bd1aac340a05}</Project>
</ProjectReference>
@@ -384,4 +387,4 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
+1 -1
View File
@@ -199,7 +199,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
if (wParam == WM_USER_KEYDOWN)
{
OnKeyDown(lParam);
FreeLookInput(wParam, lParam);
FreeLookInput((u32)wParam, lParam);
}
else if (wParam == WIIMOTE_DISCONNECT)
{
+1 -1
View File
@@ -143,7 +143,7 @@ void RunGpuLoop()
if (!GpuRunningState) break;
fifo.isGpuReadingData = true;
CommandProcessor::isPossibleWaitingSetDrawDone = fifo.bFF_GPLinkEnable;
CommandProcessor::isPossibleWaitingSetDrawDone = fifo.bFF_GPLinkEnable ? true : false;
u32 readPtr = fifo.CPReadPointer;
u8 *uData = Memory::GetPointer(readPtr);
+37 -15
View File
@@ -39,24 +39,24 @@ static struct
static u32 s_AccessEFBResult = 0;
void VideoBackendHLE::EmuStateChange(EMUSTATE_CHANGE newState)
void VideoBackendHardware::EmuStateChange(EMUSTATE_CHANGE newState)
{
EmulatorState((newState == EMUSTATE_CHANGE_PLAY) ? true : false);
}
// Enter and exit the video loop
void VideoBackendHLE::Video_EnterLoop()
void VideoBackendHardware::Video_EnterLoop()
{
RunGpuLoop();
}
void VideoBackendHLE::Video_ExitLoop()
void VideoBackendHardware::Video_ExitLoop()
{
ExitGpuLoop();
s_FifoShuttingDown = true;
}
void VideoBackendHLE::Video_SetRendering(bool bEnabled)
void VideoBackendHardware::Video_SetRendering(bool bEnabled)
{
Fifo_SetRendering(bEnabled);
}
@@ -94,7 +94,7 @@ void VideoFifo_CheckSwapRequestAt(u32 xfbAddr, u32 fbWidth, u32 fbHeight)
}
// Run from the CPU thread (from VideoInterface.cpp)
void VideoBackendHLE::Video_BeginField(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
void VideoBackendHardware::Video_BeginField(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
{
if (s_BackendInitialized && g_ActiveConfig.bUseXFB)
{
@@ -108,7 +108,7 @@ void VideoBackendHLE::Video_BeginField(u32 xfbAddr, FieldType field, u32 fbWidth
}
// Run from the CPU thread (from VideoInterface.cpp)
void VideoBackendHLE::Video_EndField()
void VideoBackendHardware::Video_EndField()
{
if (s_BackendInitialized)
{
@@ -116,18 +116,18 @@ void VideoBackendHLE::Video_EndField()
}
}
void VideoBackendHLE::Video_AddMessage(const char* pstr, u32 milliseconds)
void VideoBackendHardware::Video_AddMessage(const char* pstr, u32 milliseconds)
{
OSD::AddMessage(pstr, milliseconds);
}
void VideoBackendHLE::Video_ClearMessages()
void VideoBackendHardware::Video_ClearMessages()
{
OSD::ClearMessages();
}
// Screenshot
bool VideoBackendHLE::Video_Screenshot(const char *_szFilename)
bool VideoBackendHardware::Video_Screenshot(const char *_szFilename)
{
Renderer::SetScreenshot(_szFilename);
return true;
@@ -143,7 +143,7 @@ void VideoFifo_CheckEFBAccess()
}
}
u32 VideoBackendHLE::Video_AccessEFB(EFBAccessType type, u32 x, u32 y, u32 InputData)
u32 VideoBackendHardware::Video_AccessEFB(EFBAccessType type, u32 x, u32 y, u32 InputData)
{
if (s_BackendInitialized)
{
@@ -202,7 +202,7 @@ void VideoFifo_CheckStateRequest()
}
// Run from the CPU thread
void VideoBackendHLE::DoState(PointerWrap& p)
void VideoBackendHardware::DoState(PointerWrap& p)
{
s_doStateArgs.ptr = p.ptr;
s_doStateArgs.mode = p.mode;
@@ -217,7 +217,7 @@ void VideoBackendHLE::DoState(PointerWrap& p)
VideoFifo_CheckStateRequest();
}
void VideoBackendHLE::RunLoop(bool enable)
void VideoBackendHardware::RunLoop(bool enable)
{
VideoCommon_RunLoop(enable);
}
@@ -228,17 +228,39 @@ void VideoFifo_CheckAsyncRequest()
VideoFifo_CheckEFBAccess();
}
void VideoBackend::Video_GatherPipeBursted()
void VideoBackendHardware::Video_GatherPipeBursted()
{
CommandProcessor::GatherPipeBursted();
}
bool VideoBackendHLE::Video_IsPossibleWaitingSetDrawDone()
bool VideoBackendHardware::Video_IsPossibleWaitingSetDrawDone()
{
return CommandProcessor::isPossibleWaitingSetDrawDone;
}
void VideoBackendHLE::Video_AbortFrame()
void VideoBackendHardware::Video_AbortFrame()
{
CommandProcessor::AbortFrame();
}
readFn16 VideoBackendHardware::Video_CPRead16()
{
return CommandProcessor::Read16;
}
writeFn16 VideoBackendHardware::Video_CPWrite16()
{
return CommandProcessor::Write16;
}
readFn16 VideoBackendHardware::Video_PERead16()
{
return PixelEngine::Read16;
}
writeFn16 VideoBackendHardware::Video_PEWrite16()
{
return PixelEngine::Write16;
}
writeFn32 VideoBackendHardware::Video_PEWrite32()
{
return PixelEngine::Write32;
}
+1 -1
View File
@@ -4,6 +4,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Dolphin", "Core\DolphinWX\D
ProjectSection(ProjectDependencies) = postProject
{8C60E805-0DA5-4E25-8F84-038DB504BB0D} = {8C60E805-0DA5-4E25-8F84-038DB504BB0D}
{69F00340-5C3D-449F-9A80-958435C6CF06} = {69F00340-5C3D-449F-9A80-958435C6CF06}
{9E9DA440-E9AD-413C-B648-91030E792211} = {9E9DA440-E9AD-413C-B648-91030E792211}
{93D73454-2512-424E-9CDA-4BB357FE13DD} = {93D73454-2512-424E-9CDA-4BB357FE13DD}
{B6398059-EBB6-4C34-B547-95F365B71FF4} = {B6398059-EBB6-4C34-B547-95F365B71FF4}
{AA862E5E-A993-497A-B6A0-0E8E94B10050} = {AA862E5E-A993-497A-B6A0-0E8E94B10050}
@@ -131,7 +132,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VideoOGL", "Plugins\Plugin_
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VideoSoftware", "Plugins\Plugin_VideoSoftware\Plugin_VideoSoftware.vcxproj", "{9E9DA440-E9AD-413C-B648-91030E792211}"
ProjectSection(ProjectDependencies) = postProject
{3E5C4E02-1BA9-4776-BDBE-E3F91FFA34CF} = {3E5C4E02-1BA9-4776-BDBE-E3F91FFA34CF}
{69F00340-5C3D-449F-9A80-958435C6CF06} = {69F00340-5C3D-449F-9A80-958435C6CF06}
EndProjectSection
EndProject
@@ -7,7 +7,7 @@
namespace DX11
{
class VideoBackend : public VideoBackendHLE
class VideoBackend : public VideoBackendHardware
{
bool Initialize(void *&);
void Shutdown();
@@ -7,7 +7,7 @@
namespace DX9
{
class VideoBackend : public VideoBackendHLE
class VideoBackend : public VideoBackendHardware
{
bool Initialize(void *&);
void Shutdown();
@@ -293,7 +293,7 @@ void GLVertexFormat::EnableComponents(u32 components)
// TODO - Is this a good spot for this code?
if (g_ActiveConfig.bDisableLighting)
{
for (int i = 0; i < xfregs.numChan.numColorChans; i++)
for (u32 i = 0; i < xfregs.numChan.numColorChans; i++)
{
xfregs.alpha[i].enablelighting = false;
xfregs.color[i].enablelighting = false;
@@ -7,7 +7,7 @@
namespace OGL
{
class VideoBackend : public VideoBackendHLE
class VideoBackend : public VideoBackendHardware
{
bool Initialize(void *&);
void Shutdown();
@@ -203,7 +203,6 @@
<ClCompile Include="Src\TransformUnit.cpp" />
<ClCompile Include="Src\SWVertexLoader.cpp" />
<ClCompile Include="Src\VideoConfigDialog.cpp" />
<ClCompile Include="Src\Win32.cpp" />
<ClCompile Include="Src\XFMemLoader.cpp" />
</ItemGroup>
<ItemGroup>
@@ -230,10 +229,8 @@
<ClInclude Include="Src\TransformUnit.h" />
<ClInclude Include="Src\Vec3.h" />
<ClInclude Include="Src\SWVertexLoader.h" />
<ClInclude Include="Src\VertexLoader_Position.h" />
<ClInclude Include="Src\VideoBackend.h" />
<ClInclude Include="Src\VideoConfigDialog.h" />
<ClInclude Include="Src\Win32.h" />
<ClInclude Include="Src\XFMemLoader.h" />
</ItemGroup>
<ItemGroup>
@@ -25,9 +25,6 @@
<ClCompile Include="Src\SWVertexLoader.cpp" />
<ClCompile Include="Src\VideoConfigDialog.cpp" />
<ClCompile Include="Src\XFMemLoader.cpp" />
<ClCompile Include="Src\Win32.cpp">
<Filter>Win32</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Src\BPMemLoader.h" />
@@ -56,12 +53,6 @@
<ClInclude Include="Src\VideoBackend.h" />
<ClInclude Include="Src\VideoConfigDialog.h" />
<ClInclude Include="Src\XFMemLoader.h" />
<ClInclude Include="Src\Win32.h">
<Filter>Win32</Filter>
</ClInclude>
<ClInclude Include="Src\VertexLoader_Position.h">
<Filter>Common</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="CMakeLists.txt" />
@@ -71,8 +62,5 @@
<Filter Include="Win32">
<UniqueIdentifier>{081288cb-a63b-4ae9-93eb-e668568520b8}</UniqueIdentifier>
</Filter>
<Filter Include="Common">
<UniqueIdentifier>{80e30848-1174-4168-a8f7-da2553f872b1}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>
</Project>
@@ -15,18 +15,17 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "../../../Core/VideoCommon/Src/VideoCommon.h"
#include "VideoCommon.h"
#include "TextureDecoder.h"
#include "BPMemLoader.h"
#include "EfbCopy.h"
#include "Rasterizer.h"
#include "SWPixelEngine.h"
#include "Tev.h"
#include "../../../Core/VideoCommon/Src/TextureDecoder.h"
#include "HW/Memmap.h"
#include "Core.h"
extern BPMemory bpmem;
void InitBPMemory()
{
@@ -20,8 +20,7 @@
#include "Common.h"
#include "../../../Core/VideoCommon/Src/BPMemory.h"
#include "BPMemory.h"
void InitBPMemory();
void SWBPWritten(int address, int newvalue);
@@ -19,62 +19,52 @@
#include "CPMemLoader.h"
#include "HW/Memmap.h"
// CP state
static u8 *_cached_arraybases[16];
// STATE_TO_SAVE
static u32 _arraybases[16];
static u32 _arraystrides[16];
static TMatrixIndexA _MatrixIndexA;
static TMatrixIndexB _MatrixIndexB;
static TVtxDesc _g_VtxDesc;
static VAT _g_VtxAttr[8];
void SWLoadCPReg(u32 sub_cmd, u32 value)
{
switch (sub_cmd & 0xF0)
{
case 0x30:
_MatrixIndexA.Hex = value;
MatrixIndexA.Hex = value;
break;
case 0x40:
_MatrixIndexB.Hex = value;
MatrixIndexB.Hex = value;
break;
case 0x50:
_g_VtxDesc.Hex &= ~0x1FFFF; // keep the Upper bits
_g_VtxDesc.Hex |= value;
g_VtxDesc.Hex &= ~0x1FFFF; // keep the Upper bits
g_VtxDesc.Hex |= value;
break;
case 0x60:
_g_VtxDesc.Hex &= 0x1FFFF; // keep the lower 17Bits
_g_VtxDesc.Hex |= (u64)value << 17;
g_VtxDesc.Hex &= 0x1FFFF; // keep the lower 17Bits
g_VtxDesc.Hex |= (u64)value << 17;
break;
case 0x70:
_assert_((sub_cmd & 0x0F) < 8);
_g_VtxAttr[sub_cmd & 7].g0.Hex = value;
g_VtxAttr[sub_cmd & 7].g0.Hex = value;
break;
case 0x80:
_assert_((sub_cmd & 0x0F) < 8);
_g_VtxAttr[sub_cmd & 7].g1.Hex = value;
g_VtxAttr[sub_cmd & 7].g1.Hex = value;
break;
case 0x90:
_assert_((sub_cmd & 0x0F) < 8);
_g_VtxAttr[sub_cmd & 7].g2.Hex = value;
g_VtxAttr[sub_cmd & 7].g2.Hex = value;
break;
// Pointers to vertex arrays in GC RAM
case 0xA0:
_arraybases[sub_cmd & 0xF] = value;
_cached_arraybases[sub_cmd & 0xF] = Memory::GetPointer(value);
arraybases[sub_cmd & 0xF] = value;
cached_arraybases[sub_cmd & 0xF] = Memory::GetPointer(value);
break;
case 0xB0:
_arraystrides[sub_cmd & 0xF] = value & 0xFF;
arraystrides[sub_cmd & 0xF] = value & 0xFF;
break;
}
}
@@ -20,8 +20,7 @@
#include "Common.h"
#include "../../../Core/VideoCommon/Src/CPMemory.h"
#include "CPMemory.h"
void SWLoadCPReg(u32 sub_cmd, u32 value);
@@ -26,7 +26,7 @@
#include "HwRasterizer.h"
#include "StringUtil.h"
#include "SWCommandProcessor.h"
#include "../../../Core/VideoCommon/Src/ImageWrite.h"
#include "ImageWrite.h"
#include "FileUtil.h"
namespace DebugUtil
@@ -19,7 +19,7 @@
#include "EfbInterface.h"
#include "BPMemLoader.h"
#include "../../../Core/VideoCommon/Src/LookUpTables.h"
#include "LookUpTables.h"
#include "SWPixelEngine.h"

Some files were not shown because too many files have changed in this diff Show More