Put some stuff in the gfx plugins into namespaces, so that the symbols won't collide if someone decides to merge the gfx plugins into dolphin too. still more things left to do though.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6972 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2011-01-29 20:16:51 +00:00
parent fb35a83d2c
commit 7f97ce79bb
55 changed files with 531 additions and 329 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
../../Binary/x64/DSPTool.exe -h dsp_code tests/mul_test.ds
mkdir emu
cp ../Core/DSPCore/Src/*.cpp emu
cp ../Core/DSPCore/Src/*.h emu
cp ../Core/Core/Src/DSP/Src/*.cpp emu
cp ../Core/Core/Src/DSP/Src/*.h emu
make
+3 -18
View File
@@ -8,7 +8,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Core", "Core\Core\Core.vcpr
{FBAFB369-07EB-4460-9CAD-08BE5789DAB6} = {FBAFB369-07EB-4460-9CAD-08BE5789DAB6}
{3E03C179-8251-46E4-81F4-466F114BAC63} = {3E03C179-8251-46E4-81F4-466F114BAC63}
{823DDC98-42D5-4A38-88CF-9DC06C788AE4} = {823DDC98-42D5-4A38-88CF-9DC06C788AE4}
{838A89A3-3AA0-4A45-ACBE-3D1E0980C2ED} = {838A89A3-3AA0-4A45-ACBE-3D1E0980C2ED}
{29C2ABC1-ADA5-42CD-A5FC-96022D52A510} = {29C2ABC1-ADA5-42CD-A5FC-96022D52A510}
{B807E8DB-4241-4754-BC2A-2F435BCA881A} = {B807E8DB-4241-4754-BC2A-2F435BCA881A}
{C573CAF7-EE6A-458E-8049-16C0BF34C2E9} = {C573CAF7-EE6A-458E-8049-16C0BF34C2E9}
@@ -85,7 +84,6 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Debugger", "Core\DebuggerWX\DebuggerWX.vcproj", "{4D3CD4C5-412B-4B49-9B1B-A68A2A129C77}"
ProjectSection(ProjectDependencies) = postProject
{F81AE75C-3D17-4D8C-A201-82FA5351C123} = {F81AE75C-3D17-4D8C-A201-82FA5351C123}
{838A89A3-3AA0-4A45-ACBE-3D1E0980C2ED} = {838A89A3-3AA0-4A45-ACBE-3D1E0980C2ED}
{29C2ABC1-ADA5-42CD-A5FC-96022D52A510} = {29C2ABC1-ADA5-42CD-A5FC-96022D52A510}
{F0B874CB-4476-4199-9315-8343D05AE684} = {F0B874CB-4476-4199-9315-8343D05AE684}
{B807E8DB-4241-4754-BC2A-2F435BCA881A} = {B807E8DB-4241-4754-BC2A-2F435BCA881A}
@@ -118,7 +116,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AudioCommon", "Core\AudioCo
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DSPTool", "DSPTool\DSPTool.vcproj", "{1970D175-3DE8-4738-942A-4D98D1CDBF64}"
ProjectSection(ProjectDependencies) = postProject
{838A89A3-3AA0-4A45-ACBE-3D1E0980C2ED} = {838A89A3-3AA0-4A45-ACBE-3D1E0980C2ED}
{F0B874CB-4476-4199-9315-8343D05AE684} = {F0B874CB-4476-4199-9315-8343D05AE684}
{B807E8DB-4241-4754-BC2A-2F435BCA881A} = {B807E8DB-4241-4754-BC2A-2F435BCA881A}
{C573CAF7-EE6A-458E-8049-16C0BF34C2E9} = {C573CAF7-EE6A-458E-8049-16C0BF34C2E9}
EndProjectSection
@@ -142,7 +140,6 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTests", "UnitTests\UnitTests.vcproj", "{40C636FA-B5BF-4D67-ABC8-376B524A7551}"
ProjectSection(ProjectDependencies) = postProject
{11F55366-12EC-4C44-A8CB-1D4E315D61ED} = {11F55366-12EC-4C44-A8CB-1D4E315D61ED}
{838A89A3-3AA0-4A45-ACBE-3D1E0980C2ED} = {838A89A3-3AA0-4A45-ACBE-3D1E0980C2ED}
{1C8436C9-DBAF-42BE-83BC-CF3EC9175ABE} = {1C8436C9-DBAF-42BE-83BC-CF3EC9175ABE}
{F0B874CB-4476-4199-9315-8343D05AE684} = {F0B874CB-4476-4199-9315-8343D05AE684}
{B807E8DB-4241-4754-BC2A-2F435BCA881A} = {B807E8DB-4241-4754-BC2A-2F435BCA881A}
@@ -388,18 +385,6 @@ Global
{FBAFB369-07EB-4460-9CAD-08BE5789DAB6}.Release|Win32.Build.0 = Release|Win32
{FBAFB369-07EB-4460-9CAD-08BE5789DAB6}.Release|x64.ActiveCfg = Release|x64
{FBAFB369-07EB-4460-9CAD-08BE5789DAB6}.Release|x64.Build.0 = Release|x64
{838A89A3-3AA0-4A45-ACBE-3D1E0980C2ED}.Debug|Win32.ActiveCfg = Debug|Win32
{838A89A3-3AA0-4A45-ACBE-3D1E0980C2ED}.Debug|Win32.Build.0 = Debug|Win32
{838A89A3-3AA0-4A45-ACBE-3D1E0980C2ED}.Debug|x64.ActiveCfg = Debug|x64
{838A89A3-3AA0-4A45-ACBE-3D1E0980C2ED}.Debug|x64.Build.0 = Debug|x64
{838A89A3-3AA0-4A45-ACBE-3D1E0980C2ED}.DebugFast|Win32.ActiveCfg = DebugFast|Win32
{838A89A3-3AA0-4A45-ACBE-3D1E0980C2ED}.DebugFast|Win32.Build.0 = DebugFast|Win32
{838A89A3-3AA0-4A45-ACBE-3D1E0980C2ED}.DebugFast|x64.ActiveCfg = DebugFast|x64
{838A89A3-3AA0-4A45-ACBE-3D1E0980C2ED}.DebugFast|x64.Build.0 = DebugFast|x64
{838A89A3-3AA0-4A45-ACBE-3D1E0980C2ED}.Release|Win32.ActiveCfg = Release|Win32
{838A89A3-3AA0-4A45-ACBE-3D1E0980C2ED}.Release|Win32.Build.0 = Release|Win32
{838A89A3-3AA0-4A45-ACBE-3D1E0980C2ED}.Release|x64.ActiveCfg = Release|x64
{838A89A3-3AA0-4A45-ACBE-3D1E0980C2ED}.Release|x64.Build.0 = Release|x64
{1970D175-3DE8-4738-942A-4D98D1CDBF64}.Debug|Win32.ActiveCfg = Debug|Win32
{1970D175-3DE8-4738-942A-4D98D1CDBF64}.Debug|Win32.Build.0 = Debug|Win32
{1970D175-3DE8-4738-942A-4D98D1CDBF64}.Debug|x64.ActiveCfg = Debug|x64
@@ -597,9 +582,9 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
AMDCaPersistentConfig = Release|x64
AMDCaPersistentStartup = Dolphin
AMDCaProjectFile = G:\Dolphin\Source\CodeAnalyst\Dolphin.caw
AMDCaPersistentStartup = Dolphin
AMDCaPersistentConfig = Release|x64
EndGlobalSection
GlobalSection(DPCodeReviewSolutionGUID) = preSolution
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
@@ -22,6 +22,9 @@
#include "D3DTexture.h"
#include "GfxState.h"
namespace DX11
{
HINSTANCE hD3DXDll = NULL;
D3DX11COMPILEFROMMEMORYTYPE PD3DX11CompileFromMemory = NULL;
D3DX11FILTERTEXTURETYPE PD3DX11FilterTexture = NULL;
@@ -468,4 +471,6 @@ void Present()
swapchain->Present((UINT)g_ActiveConfig.bVSync, 0);
}
} // namespace
} // namespace D3D
} // namespace DX11
@@ -21,12 +21,16 @@
#include "Common.h"
#include <vector>
namespace DX11
{
#define SAFE_RELEASE(x) { if (x) (x)->Release(); (x) = NULL; }
#define SAFE_DELETE(x) { delete (x); (x) = NULL; }
#define SAFE_DELETE_ARRAY(x) { delete[] (x); (x) = NULL; }
#define CHECK(cond, Message, ...) if (!(cond)) { PanicAlert(__FUNCTION__ "Failed in %s at line %d: " Message, __FILE__, __LINE__, __VA_ARGS__); }
class D3DTexture2D;
namespace D3D
{
@@ -100,3 +104,5 @@ typedef HRESULT (WINAPI* CREATEDXGIFACTORY)(REFIID, void**);
extern CREATEDXGIFACTORY PCreateDXGIFactory;
typedef HRESULT (WINAPI* D3D11CREATEDEVICE)(IDXGIAdapter*, D3D_DRIVER_TYPE, HMODULE, UINT, CONST D3D_FEATURE_LEVEL*, UINT, UINT, ID3D11Device**, D3D_FEATURE_LEVEL*, ID3D11DeviceContext**);
extern D3D11CREATEDEVICE PD3D11CreateDevice;
} // namespace DX11
@@ -18,6 +18,9 @@
#include <d3d11.h>
#include "D3DBlob.h"
namespace DX11
{
D3DBlob::D3DBlob(unsigned int blob_size, const u8* init_data) : ref(1), size(blob_size), blob(NULL)
{
data = new u8[blob_size];
@@ -62,3 +65,5 @@ u8* D3DBlob::Data()
{
return data;
}
} // namespace DX11
@@ -21,6 +21,9 @@
struct ID3D10Blob;
namespace DX11
{
// use this class instead ID3D10Blob or ID3D11Blob whenever possible
class D3DBlob
{
@@ -46,3 +49,5 @@ private:
u8* data;
ID3D10Blob* blob;
};
} // namespace
@@ -22,6 +22,9 @@
#include "D3DBase.h"
#include "D3DShader.h"
namespace DX11
{
namespace D3D
{
@@ -149,3 +152,5 @@ ID3D11PixelShader* CompileAndCreatePixelShader(const char* code, unsigned int le
}
} // namespace
} // namespace DX11
@@ -22,6 +22,9 @@
struct ID3D11PixelShader;
struct ID3D11VertexShader;
namespace DX11
{
namespace D3D
{
ID3D11VertexShader* CreateVertexShaderFromByteCode(const void* bytecode, unsigned int len);
@@ -39,4 +42,6 @@ namespace D3D
inline ID3D11PixelShader* CreatePixelShaderFromByteCode(D3DBlob* bytecode) { return CreatePixelShaderFromByteCode(bytecode->Data(), bytecode->Size()); }
inline ID3D11VertexShader* CompileAndCreateVertexShader(D3DBlob* code) { return CompileAndCreateVertexShader((const char*)code->Data(), code->Size()); }
inline ID3D11PixelShader* CompileAndCreatePixelShader(D3DBlob* code) { return CompileAndCreatePixelShader((const char*)code->Data(), code->Size()); }
}
}
} // namespace DX11
@@ -18,6 +18,9 @@
#include "D3DBase.h"
#include "D3DTexture.h"
namespace DX11
{
namespace D3D
{
@@ -113,3 +116,5 @@ D3DTexture2D::~D3DTexture2D()
SAFE_RELEASE(dsv);
SAFE_RELEASE(tex);
}
} // namespace DX11
@@ -17,7 +17,10 @@
#pragma once
#include "d3d11.h"
#include <d3d11.h>
namespace DX11
{
namespace D3D
{
@@ -53,3 +56,5 @@ private:
D3D11_BIND_FLAG bindflags;
UINT ref;
};
} // namespace DX11
@@ -24,6 +24,9 @@
#include "D3DShader.h"
#include "GfxState.h"
namespace DX11
{
namespace D3D
{
@@ -690,4 +693,6 @@ void drawClearQuad(u32 Color, float z, ID3D11PixelShader* PShader, ID3D11VertexS
context->Draw(4, clearq_offset);
}
} // namespace
} // namespace D3D
} // namespace DX11
@@ -17,9 +17,12 @@
#pragma once
#include "d3d11.h"
#include <d3d11.h>
#include <MathUtil.h>
namespace DX11
{
namespace D3D
{
// Font creation flags
@@ -83,3 +86,5 @@ namespace D3D
void drawClearQuad(u32 Color, float z, ID3D11PixelShader* PShader, ID3D11VertexShader* Vshader, ID3D11InputLayout* layout);
void drawColorQuad(u32 Color, float x1, float y1, float x2, float y2);
}
}
@@ -24,6 +24,8 @@
#include "Render.h"
#include "VertexShaderCache.h"
namespace DX11 {
FramebufferManager::Efb FramebufferManager::m_efb;
D3DTexture2D* &FramebufferManager::GetEFBColorTexture() { return m_efb.color_tex; }
@@ -204,3 +206,5 @@ void XFBSource::CopyEFB(float Gamma)
D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTexture()->GetRTV(),
FramebufferManager::GetEFBDepthTexture()->GetDSV());
}
} // namespace DX11
@@ -24,6 +24,8 @@
#include "D3DTexture.h"
namespace DX11 {
// On the GameCube, the game sends a request for the graphics processor to
// transfer its internal EFB (Embedded Framebuffer) to an area in GameCube RAM
// called the XFB (External Framebuffer). The size and location of the XFB is
@@ -105,4 +107,6 @@ private:
} m_efb;
};
} // namespace DX11
#endif
@@ -20,6 +20,9 @@
#include "D3DBase.h"
#include "GfxState.h"
namespace DX11
{
namespace D3D
{
@@ -86,3 +89,5 @@ void StateManager::Apply()
}
} // namespace
} // namespace DX11
@@ -23,6 +23,9 @@ struct ID3D11BlendState;
struct ID3D11DepthStencilState;
struct ID3D11RasterizerState;
namespace DX11
{
namespace D3D
{
@@ -73,3 +76,5 @@ private:
extern StateManager* stateman;
} // namespace
} // namespace DX11
@@ -27,7 +27,7 @@ class D3DVertexFormat : public NativeVertexFormat
D3D11_INPUT_ELEMENT_DESC m_elems[32];
UINT m_num_elems;
D3DBlob* m_vs_bytecode;
DX11::D3DBlob* m_vs_bytecode;
ID3D11InputLayout* m_layout;
public:
@@ -141,17 +141,17 @@ void D3DVertexFormat::Initialize(const PortableVertexDeclaration &_vtx_decl)
void D3DVertexFormat::SetupVertexPointers()
{
if (m_vs_bytecode != VertexShaderCache::GetActiveShaderBytecode())
if (m_vs_bytecode != DX11::VertexShaderCache::GetActiveShaderBytecode())
{
SAFE_RELEASE(m_vs_bytecode);
SAFE_RELEASE(m_layout);
m_vs_bytecode = VertexShaderCache::GetActiveShaderBytecode();
m_vs_bytecode = DX11::VertexShaderCache::GetActiveShaderBytecode();
m_vs_bytecode->AddRef();
HRESULT hr = D3D::device->CreateInputLayout(m_elems, m_num_elems, m_vs_bytecode->Data(), m_vs_bytecode->Size(), &m_layout);
HRESULT hr = DX11::D3D::device->CreateInputLayout(m_elems, m_num_elems, m_vs_bytecode->Data(), m_vs_bytecode->Size(), &m_layout);
if (FAILED(hr)) PanicAlert("Failed to create input layout, %s %d\n", __FILE__, __LINE__);
D3D::SetDebugObjectName((ID3D11DeviceChild*)m_layout, "input layout used to emulate the GX pipeline");
DX11::D3D::SetDebugObjectName((ID3D11DeviceChild*)m_layout, "input layout used to emulate the GX pipeline");
}
D3D::context->IASetInputLayout(m_layout);
DX11::D3D::context->IASetInputLayout(m_layout);
}
@@ -30,6 +30,14 @@
extern int frameCount;
// See comment near the bottom of this file.
float psconstants[C_PENVCONST_END*4];
bool pscbufchanged = true;
namespace DX11
{
PixelShaderCache::PSCache PixelShaderCache::PixelShaders;
const PixelShaderCache::PSCacheEntry* PixelShaderCache::last_entry;
@@ -39,9 +47,6 @@ ID3D11PixelShader* s_ColorMatrixProgram[2] = {NULL};
ID3D11PixelShader* s_ColorCopyProgram[2] = {NULL};
ID3D11PixelShader* s_DepthMatrixProgram[2] = {NULL};
ID3D11PixelShader* s_ClearProgram = NULL;
float psconstants[C_PENVCONST_END*4];
bool pscbufchanged = true;
ID3D11Buffer* pscbuf = NULL;
const char clear_program_code[] = {
@@ -205,49 +210,6 @@ ID3D11PixelShader* PixelShaderCache::GetClearProgram()
return s_ClearProgram;
}
// HACK to avoid some invasive VideoCommon changes
// these values are hardcoded, they depend on internal D3DCompile behavior; TODO: Solve this with D3DReflect or something
// offset given in floats, table index is float4
unsigned int ps_constant_offset_table[] = {
0, 4, 8, 12, // C_COLORS, 16
16, 20, 24, 28, // C_KCOLORS, 16
32, // C_ALPHA, 4
36, 40, 44, 48, 52, 56, 60, 64, // C_TEXDIMS, 32
68, 72, // C_ZBIAS, 8
76, 80, // C_INDTEXSCALE, 8
84, 88, 92, 96, 100, 104, // C_INDTEXMTX, 24
108, 112, 116, // C_FOG, 12
120, 124, 128, 132, 136, // C_PLIGHTS0, 20
140, 144, 148, 152, 156, // C_PLIGHTS1, 20
160, 164, 168, 172, 176, // C_PLIGHTS2, 20
180, 184, 188, 192, 196, // C_PLIGHTS3, 20
200, 204, 208, 212, 216, // C_PLIGHTS4, 20
220, 224, 228, 232, 236, // C_PLIGHTS5, 20
240, 244, 248, 252, 256, // C_PLIGHTS6, 20
260, 264, 268, 272, 276, // C_PLIGHTS7, 20
280, 284, 288, 292 // C_PMATERIALS, 16
};
void SetPSConstant4f(unsigned int const_number, float f1, float f2, float f3, float f4)
{
psconstants[ps_constant_offset_table[const_number] ] = f1;
psconstants[ps_constant_offset_table[const_number]+1] = f2;
psconstants[ps_constant_offset_table[const_number]+2] = f3;
psconstants[ps_constant_offset_table[const_number]+3] = f4;
pscbufchanged = true;
}
void SetPSConstant4fv(unsigned int const_number, const float* f)
{
memcpy(&psconstants[ps_constant_offset_table[const_number]], f, sizeof(float)*4);
pscbufchanged = true;
}
void SetMultiPSConstant4fv(unsigned int const_number, unsigned int count, const float* f)
{
memcpy(&psconstants[ps_constant_offset_table[const_number]], f, sizeof(float)*4*count);
pscbufchanged = true;
}
ID3D11Buffer* &PixelShaderCache::GetConstantBuffer()
{
// TODO: divide the global variables of the generated shaders into about 5 constant buffers to speed this up
@@ -422,4 +384,53 @@ bool PixelShaderCache::InsertByteCode(const PIXELSHADERUID &uid, const void* byt
INCSTAT(stats.numPixelShadersCreated);
SETSTAT(stats.numPixelShadersAlive, PixelShaders.size());
return true;
}
}
} // DX11
// These are "callbacks" from VideoCommon and thus must be outside namespace DX11.
// This will have to be changed when we merge.
// HACK to avoid some invasive VideoCommon changes
// these values are hardcoded, they depend on internal D3DCompile behavior; TODO: Solve this with D3DReflect or something
// offset given in floats, table index is float4
static const unsigned int ps_constant_offset_table[] = {
0, 4, 8, 12, // C_COLORS, 16
16, 20, 24, 28, // C_KCOLORS, 16
32, // C_ALPHA, 4
36, 40, 44, 48, 52, 56, 60, 64, // C_TEXDIMS, 32
68, 72, // C_ZBIAS, 8
76, 80, // C_INDTEXSCALE, 8
84, 88, 92, 96, 100, 104, // C_INDTEXMTX, 24
108, 112, 116, // C_FOG, 12
120, 124, 128, 132, 136, // C_PLIGHTS0, 20
140, 144, 148, 152, 156, // C_PLIGHTS1, 20
160, 164, 168, 172, 176, // C_PLIGHTS2, 20
180, 184, 188, 192, 196, // C_PLIGHTS3, 20
200, 204, 208, 212, 216, // C_PLIGHTS4, 20
220, 224, 228, 232, 236, // C_PLIGHTS5, 20
240, 244, 248, 252, 256, // C_PLIGHTS6, 20
260, 264, 268, 272, 276, // C_PLIGHTS7, 20
280, 284, 288, 292 // C_PMATERIALS, 16
};
void SetPSConstant4f(unsigned int const_number, float f1, float f2, float f3, float f4)
{
psconstants[ps_constant_offset_table[const_number] ] = f1;
psconstants[ps_constant_offset_table[const_number]+1] = f2;
psconstants[ps_constant_offset_table[const_number]+2] = f3;
psconstants[ps_constant_offset_table[const_number]+3] = f4;
pscbufchanged = true;
}
void SetPSConstant4fv(unsigned int const_number, const float* f)
{
memcpy(&psconstants[ps_constant_offset_table[const_number]], f, sizeof(float)*4);
pscbufchanged = true;
}
void SetMultiPSConstant4fv(unsigned int const_number, unsigned int count, const float* f)
{
memcpy(&psconstants[ps_constant_offset_table[const_number]], f, sizeof(float)*4*count);
pscbufchanged = true;
}
@@ -24,6 +24,8 @@
class PIXELSHADERUID;
enum DSTALPHA_MODE;
namespace DX11 {
class PixelShaderCache
{
public:
@@ -58,3 +60,5 @@ private:
static PSCache PixelShaders;
static const PSCacheEntry* last_entry;
};
} // namespace DX11
@@ -40,6 +40,9 @@
#include "VertexShaderCache.h"
namespace DX11
{
static int s_fps = 0;
static u32 s_LastAA = 0;
@@ -305,9 +308,6 @@ void TeardownDeviceObjects()
SAFE_RELEASE(resetraststate);
}
namespace DX11
{
Renderer::Renderer()
{
int x, y, w_temp, h_temp;
@@ -1340,4 +1340,4 @@ void Renderer::SetInterlacingMode()
// TODO
}
}
} // namespace DX11

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