mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-24 22:34:54 +00:00
apply some speedup to dx11 plugin + some minor stuff
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5721 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
980a2680be
commit
4f8a6a1573
13 changed files with 202 additions and 221 deletions
|
@ -366,7 +366,7 @@ void CConfigMain::InitializeGUITooltips()
|
||||||
void CConfigMain::CreateGUIControls()
|
void CConfigMain::CreateGUIControls()
|
||||||
{
|
{
|
||||||
InitializeGUILists();
|
InitializeGUILists();
|
||||||
|
|
||||||
// Create the notebook and pages
|
// Create the notebook and pages
|
||||||
Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize);
|
Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize);
|
||||||
GeneralPage = new wxPanel(Notebook, ID_GENERALPAGE, wxDefaultPosition, wxDefaultSize);
|
GeneralPage = new wxPanel(Notebook, ID_GENERALPAGE, wxDefaultPosition, wxDefaultSize);
|
||||||
|
|
|
@ -18,12 +18,12 @@
|
||||||
#include "IndexGenerator.h"
|
#include "IndexGenerator.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
QUAD simulator
|
QUAD simulator
|
||||||
|
|
||||||
0 2 4 6
|
0 2 4 6
|
||||||
1 3 5 7
|
1 3 5 7
|
||||||
021231 243453
|
021231 243453
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//Init
|
//Init
|
||||||
|
@ -36,7 +36,7 @@ u16 *IndexGenerator::BASEPptr = 0;
|
||||||
int IndexGenerator::numT = 0;
|
int IndexGenerator::numT = 0;
|
||||||
int IndexGenerator::numL = 0;
|
int IndexGenerator::numL = 0;
|
||||||
int IndexGenerator::numP = 0;
|
int IndexGenerator::numP = 0;
|
||||||
int IndexGenerator::index = 0;
|
int IndexGenerator::index = 0;
|
||||||
int IndexGenerator::Tadds = 0;
|
int IndexGenerator::Tadds = 0;
|
||||||
int IndexGenerator::Ladds = 0;
|
int IndexGenerator::Ladds = 0;
|
||||||
int IndexGenerator::Padds = 0;
|
int IndexGenerator::Padds = 0;
|
||||||
|
@ -45,7 +45,7 @@ IndexGenerator::IndexPrimitiveType IndexGenerator::LastLPrimitive = Prim_None;
|
||||||
bool IndexGenerator::used = false;
|
bool IndexGenerator::used = false;
|
||||||
|
|
||||||
void IndexGenerator::Start(u16 *Triangleptr,u16 *Lineptr,u16 *Pointptr)
|
void IndexGenerator::Start(u16 *Triangleptr,u16 *Lineptr,u16 *Pointptr)
|
||||||
{
|
{
|
||||||
Tptr = Triangleptr;
|
Tptr = Triangleptr;
|
||||||
Lptr = Lineptr;
|
Lptr = Lineptr;
|
||||||
Pptr = Pointptr;
|
Pptr = Pointptr;
|
||||||
|
@ -67,7 +67,7 @@ void IndexGenerator::AddList(int numVerts)
|
||||||
{
|
{
|
||||||
//if we have no vertices return
|
//if we have no vertices return
|
||||||
if(numVerts <= 0) return;
|
if(numVerts <= 0) return;
|
||||||
int numTris = numVerts / 3;
|
int numTris = numVerts / 3;
|
||||||
if (!numTris)
|
if (!numTris)
|
||||||
{
|
{
|
||||||
//if we have less than 3 verts
|
//if we have less than 3 verts
|
||||||
|
@ -84,7 +84,7 @@ void IndexGenerator::AddList(int numVerts)
|
||||||
*Tptr++ = index;
|
*Tptr++ = index;
|
||||||
*Tptr++ = index+1;
|
*Tptr++ = index+1;
|
||||||
*Tptr++ = index;
|
*Tptr++ = index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -130,7 +130,7 @@ void IndexGenerator::AddStrip(int numVerts)
|
||||||
//if we have less than 3 verts
|
//if we have less than 3 verts
|
||||||
if(numVerts == 1)
|
if(numVerts == 1)
|
||||||
{
|
{
|
||||||
//dicard
|
// discard
|
||||||
index++;
|
index++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ void IndexGenerator::AddStrip(int numVerts)
|
||||||
}
|
}
|
||||||
index += numVerts;
|
index += numVerts;
|
||||||
numT += numTris;
|
numT += numTris;
|
||||||
Tadds++;
|
Tadds++;
|
||||||
LastTPrimitive = Prim_Strip;
|
LastTPrimitive = Prim_Strip;
|
||||||
}
|
}
|
||||||
void IndexGenerator::AddFan(int numVerts)
|
void IndexGenerator::AddFan(int numVerts)
|
||||||
|
@ -192,7 +192,7 @@ void IndexGenerator::AddFan(int numVerts)
|
||||||
}
|
}
|
||||||
index += numVerts;
|
index += numVerts;
|
||||||
numT += numTris;
|
numT += numTris;
|
||||||
Tadds++;
|
Tadds++;
|
||||||
LastTPrimitive = Prim_Fan;
|
LastTPrimitive = Prim_Fan;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@ void IndexGenerator::AddQuads(int numVerts)
|
||||||
}
|
}
|
||||||
index += numVerts;
|
index += numVerts;
|
||||||
numT += numTris;
|
numT += numTris;
|
||||||
Tadds++;
|
Tadds++;
|
||||||
LastTPrimitive = Prim_List;
|
LastTPrimitive = Prim_List;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,7 +324,7 @@ void IndexGenerator::AddLineStrip(int numVerts)
|
||||||
}
|
}
|
||||||
index += numVerts;
|
index += numVerts;
|
||||||
numL += numLines;
|
numL += numLines;
|
||||||
Ladds++;
|
Ladds++;
|
||||||
LastLPrimitive = Prim_Strip;
|
LastLPrimitive = Prim_Strip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,15 +335,9 @@ void IndexGenerator::AddPoints(int numVerts)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < numVerts; i++)
|
for (int i = 0; i < numVerts; i++)
|
||||||
{
|
{
|
||||||
*Pptr++ = index+i;
|
*Pptr++ = index+i;
|
||||||
}
|
}
|
||||||
index += numVerts;
|
index += numVerts;
|
||||||
numP += numVerts;
|
numP += numVerts;
|
||||||
Padds++;
|
Padds++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -294,7 +294,7 @@ HRESULT Create(HWND wnd)
|
||||||
{
|
{
|
||||||
// try using the first one
|
// try using the first one
|
||||||
hr = factory->EnumAdapters(0, &adapter);
|
hr = factory->EnumAdapters(0, &adapter);
|
||||||
if (FAILED(hr)) MessageBox(wnd, _T("Failed to enumerate adapter"), _T("Dolphin Direct3D 11 plugin"), MB_OK | MB_ICONERROR);
|
if (FAILED(hr)) MessageBox(wnd, _T("Failed to enumerate adapters"), _T("Dolphin Direct3D 11 plugin"), MB_OK | MB_ICONERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Make this configurable
|
// TODO: Make this configurable
|
||||||
|
@ -303,7 +303,7 @@ HRESULT Create(HWND wnd)
|
||||||
{
|
{
|
||||||
// try using the first one
|
// try using the first one
|
||||||
hr = adapter->EnumOutputs(0, &output);
|
hr = adapter->EnumOutputs(0, &output);
|
||||||
if (FAILED(hr)) MessageBox(wnd, _T("Failed to enumerate output"), _T("Dolphin Direct3D 11 plugin"), MB_OK | MB_ICONERROR);
|
if (FAILED(hr)) MessageBox(wnd, _T("Failed to enumerate outputs"), _T("Dolphin Direct3D 11 plugin"), MB_OK | MB_ICONERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
// this will need to be changed once multisampling gets implemented
|
// this will need to be changed once multisampling gets implemented
|
||||||
|
|
|
@ -68,8 +68,8 @@ void ReplaceTexture2D(ID3D11Texture2D* pTexture, const u8* buffer, unsigned int
|
||||||
// TODO: Merge the conversions done here to VideoDecoder
|
// TODO: Merge the conversions done here to VideoDecoder
|
||||||
switch (pcfmt)
|
switch (pcfmt)
|
||||||
{
|
{
|
||||||
case PC_TEX_FMT_IA4_AS_IA8:
|
|
||||||
case PC_TEX_FMT_IA8:
|
case PC_TEX_FMT_IA8:
|
||||||
|
case PC_TEX_FMT_IA4_AS_IA8:
|
||||||
for (unsigned int y = 0; y < height; y++)
|
for (unsigned int y = 0; y < height; y++)
|
||||||
{
|
{
|
||||||
u16* in = (u16*)buffer + y * pitch;
|
u16* in = (u16*)buffer + y * pitch;
|
||||||
|
@ -78,43 +78,30 @@ void ReplaceTexture2D(ID3D11Texture2D* pTexture, const u8* buffer, unsigned int
|
||||||
{
|
{
|
||||||
const u8 I = (*in & 0xFF);
|
const u8 I = (*in & 0xFF);
|
||||||
const u8 A = (*in & 0xFF00) >> 8;
|
const u8 A = (*in & 0xFF00) >> 8;
|
||||||
*pBits = (A << 24) | (I << 16) | (I << 8) | I;
|
*(pBits++) = (A << 24) | (I << 16) | (I << 8) | I;
|
||||||
in++;
|
in++;
|
||||||
pBits++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PC_TEX_FMT_I8:
|
case PC_TEX_FMT_I8:
|
||||||
case PC_TEX_FMT_I4_AS_I8:
|
case PC_TEX_FMT_I4_AS_I8:
|
||||||
|
for (unsigned int y = 0; y < height; y++)
|
||||||
{
|
{
|
||||||
const u8 *pIn = buffer;
|
const u8* in = buffer + (y * pitch);
|
||||||
for (int y = 0; y < height; y++)
|
u32* pBits = (u32*)((u8*)outptr + (y * destPitch));
|
||||||
|
for(unsigned int i = 0; i < width; i++)
|
||||||
{
|
{
|
||||||
u8* pBits = ((u8*)outptr + (y * destPitch));
|
const u8 I = *(in++);
|
||||||
for(int i = 0; i < width * 4; i += 4)
|
memset( pBits++, I, 4 );
|
||||||
{
|
|
||||||
pBits[i] = pIn[i / 4];
|
|
||||||
pBits[i+1] = pIn[i / 4];
|
|
||||||
pBits[i+2] = pIn[i / 4];
|
|
||||||
pBits[i + 3] = pIn[i / 4];
|
|
||||||
}
|
|
||||||
pIn += pitch;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case PC_TEX_FMT_BGRA32:
|
case PC_TEX_FMT_BGRA32:
|
||||||
for (unsigned int y = 0; y < height; y++)
|
for (unsigned int y = 0; y < height; y++)
|
||||||
{
|
{
|
||||||
u32* in = (u32*)buffer + y * pitch;
|
u32* in = (u32*)buffer + y * pitch;
|
||||||
u32* pBits = (u32*)((u8*)outptr + y * destPitch);
|
u32* pBits = (u32*)((u8*)outptr + y * destPitch);
|
||||||
for (unsigned int x = 0; x < width; x++)
|
memcpy( pBits, in, destPitch );
|
||||||
{
|
|
||||||
const u32 col = *in;
|
|
||||||
*pBits = col;
|
|
||||||
in++;
|
|
||||||
pBits++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PC_TEX_FMT_RGB565:
|
case PC_TEX_FMT_RGB565:
|
||||||
|
@ -125,13 +112,11 @@ void ReplaceTexture2D(ID3D11Texture2D* pTexture, const u8* buffer, unsigned int
|
||||||
for (unsigned int x = 0; x < width; x++)
|
for (unsigned int x = 0; x < width; x++)
|
||||||
{
|
{
|
||||||
// we can't simply shift here, since e.g. 11111 must map to 11111111 and not 11111000
|
// we can't simply shift here, since e.g. 11111 must map to 11111111 and not 11111000
|
||||||
const u16 col = *in;
|
const u16 col = *(in++);
|
||||||
*pBits = 0xFF000000 | // alpha
|
*(pBits++) = 0xFF000000 | // alpha
|
||||||
((((col&0xF800) << 5) * 255 / 31) & 0xFF0000) | // red
|
((((col&0xF800) << 5) * 255 / 31) & 0xFF0000) | // red
|
||||||
((((col& 0x7e0) << 3) * 255 / 63) & 0xFF00) | // green
|
((((col& 0x7e0) << 3) * 255 / 63) & 0xFF00) | // green
|
||||||
(( (col& 0x1f) * 255 / 31)); // blue
|
(( (col& 0x1f) * 255 / 31)); // blue
|
||||||
pBits++;
|
|
||||||
in++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -183,7 +183,7 @@ static const D3D11_BLEND d3dLogicOpDestFactors[16] =
|
||||||
D3D11_BLEND_ONE//15
|
D3D11_BLEND_ONE//15
|
||||||
};
|
};
|
||||||
|
|
||||||
static const D3D11_CULL_MODE d3dCullModes[4] =
|
static const D3D11_CULL_MODE d3dCullModes[4] =
|
||||||
{
|
{
|
||||||
D3D11_CULL_NONE,
|
D3D11_CULL_NONE,
|
||||||
D3D11_CULL_BACK,
|
D3D11_CULL_BACK,
|
||||||
|
@ -191,7 +191,7 @@ static const D3D11_CULL_MODE d3dCullModes[4] =
|
||||||
D3D11_CULL_BACK
|
D3D11_CULL_BACK
|
||||||
};
|
};
|
||||||
|
|
||||||
static const D3D11_COMPARISON_FUNC d3dCmpFuncs[8] =
|
static const D3D11_COMPARISON_FUNC d3dCmpFuncs[8] =
|
||||||
{
|
{
|
||||||
D3D11_COMPARISON_NEVER,
|
D3D11_COMPARISON_NEVER,
|
||||||
D3D11_COMPARISON_LESS,
|
D3D11_COMPARISON_LESS,
|
||||||
|
@ -206,7 +206,7 @@ static const D3D11_COMPARISON_FUNC d3dCmpFuncs[8] =
|
||||||
#define TEXF_NONE 0
|
#define TEXF_NONE 0
|
||||||
#define TEXF_POINT 1
|
#define TEXF_POINT 1
|
||||||
#define TEXF_LINEAR 2
|
#define TEXF_LINEAR 2
|
||||||
static const unsigned int d3dMipFilters[4] =
|
static const unsigned int d3dMipFilters[4] =
|
||||||
{
|
{
|
||||||
TEXF_NONE,
|
TEXF_NONE,
|
||||||
TEXF_POINT,
|
TEXF_POINT,
|
||||||
|
@ -504,7 +504,7 @@ void Renderer::RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRect
|
||||||
VideoFifo_CheckEFBAccess();
|
VideoFifo_CheckEFBAccess();
|
||||||
VideoFifo_CheckSwapRequestAt(xfbAddr, fbWidth, fbHeight);
|
VideoFifo_CheckSwapRequestAt(xfbAddr, fbWidth, fbHeight);
|
||||||
FBManager.CopyToXFB(xfbAddr, fbWidth, fbHeight, sourceRc);
|
FBManager.CopyToXFB(xfbAddr, fbWidth, fbHeight, sourceRc);
|
||||||
XFBWrited = true;
|
XFBWrited = true;
|
||||||
|
|
||||||
// XXX: Without the VI, how would we know what kind of field this is? So
|
// XXX: Without the VI, how would we know what kind of field this is? So
|
||||||
// just use progressive.
|
// just use progressive.
|
||||||
|
@ -574,7 +574,7 @@ bool Renderer::SetScissorRect()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::SetColorMask()
|
void Renderer::SetColorMask()
|
||||||
{
|
{
|
||||||
UINT8 color_mask = 0;
|
UINT8 color_mask = 0;
|
||||||
if (bpmem.blendmode.alphaupdate) color_mask |= D3D11_COLOR_WRITE_ENABLE_ALPHA;
|
if (bpmem.blendmode.alphaupdate) color_mask |= D3D11_COLOR_WRITE_ENABLE_ALPHA;
|
||||||
|
@ -729,7 +729,7 @@ void UpdateViewport()
|
||||||
FBManager.Destroy();
|
FBManager.Destroy();
|
||||||
FBManager.Create();
|
FBManager.Create();
|
||||||
D3D::context->OMSetRenderTargets(1, &FBManager.GetEFBColorTexture()->GetRTV(), FBManager.GetEFBDepthTexture()->GetDSV());
|
D3D::context->OMSetRenderTargets(1, &FBManager.GetEFBColorTexture()->GetRTV(), FBManager.GetEFBDepthTexture()->GetDSV());
|
||||||
}
|
}
|
||||||
|
|
||||||
// some games set invalids values MinDepth and MaxDepth so fix them to the max an min allowed and let the shaders do this work
|
// some games set invalids values MinDepth and MaxDepth so fix them to the max an min allowed and let the shaders do this work
|
||||||
D3D11_VIEWPORT vp = CD3D11_VIEWPORT((float)X, (float)Y, (float)Width, (float)Height,
|
D3D11_VIEWPORT vp = CD3D11_VIEWPORT((float)X, (float)Y, (float)Width, (float)Height,
|
||||||
|
@ -739,16 +739,16 @@ void UpdateViewport()
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable, u32 color, u32 z)
|
void Renderer::ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable, u32 color, u32 z)
|
||||||
{
|
{
|
||||||
TargetRectangle targetRc = Renderer::ConvertEFBRectangle(rc);
|
TargetRectangle targetRc = Renderer::ConvertEFBRectangle(rc);
|
||||||
// update the view port for clearing the picture
|
// update the view port for clearing the picture
|
||||||
D3D11_VIEWPORT vp = CD3D11_VIEWPORT((float)targetRc.left, (float)targetRc.top, (float)targetRc.GetWidth(), (float)targetRc.GetHeight(),
|
D3D11_VIEWPORT vp = CD3D11_VIEWPORT((float)targetRc.left, (float)targetRc.top, (float)targetRc.GetWidth(), (float)targetRc.GetHeight(),
|
||||||
0.f,
|
0.f,
|
||||||
1.f);
|
1.f);
|
||||||
D3D::context->RSSetViewports(1, &vp);
|
D3D::context->RSSetViewports(1, &vp);
|
||||||
// always set the scissor in case it was set by the game and has not been reset
|
// always set the scissor in case it was set by the game and has not been reset
|
||||||
// TODO: Do we really need to set the scissor rect? Why not just disable scissor testing?
|
// TODO: Do we really need to set the scissor rect? Why not just disable scissor testing?
|
||||||
D3D11_RECT sirc = CD3D11_RECT(targetRc.left, targetRc.top, targetRc.right, targetRc.bottom);
|
D3D11_RECT sirc = CD3D11_RECT(targetRc.left, targetRc.top, targetRc.right, targetRc.bottom);
|
||||||
D3D::context->RSSetScissorRects(1, &sirc);
|
D3D::context->RSSetScissorRects(1, &sirc);
|
||||||
D3D::context->OMSetDepthStencilState(cleardepthstates[zEnable], 0);
|
D3D::context->OMSetDepthStencilState(cleardepthstates[zEnable], 0);
|
||||||
D3D::context->RSSetState(clearraststate);
|
D3D::context->RSSetState(clearraststate);
|
||||||
|
@ -807,7 +807,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
|
||||||
{
|
{
|
||||||
if (g_bSkipCurrentFrame || (!XFBWrited && !g_ActiveConfig.bUseRealXFB) || !fbWidth || !fbHeight)
|
if (g_bSkipCurrentFrame || (!XFBWrited && !g_ActiveConfig.bUseRealXFB) || !fbWidth || !fbHeight)
|
||||||
{
|
{
|
||||||
g_VideoInitialize.pCopiedToXFB(false);
|
g_VideoInitialize.pCopiedToXFB(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// this function is called after the XFB field is changed, not after
|
// this function is called after the XFB field is changed, not after
|
||||||
|
@ -819,9 +819,9 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
|
||||||
const XFBSource** xfbSourceList = FBManager.GetXFBSource(xfbAddr, fbWidth, fbHeight, xfbCount);
|
const XFBSource** xfbSourceList = FBManager.GetXFBSource(xfbAddr, fbWidth, fbHeight, xfbCount);
|
||||||
if (!xfbSourceList || xfbCount == 0)
|
if (!xfbSourceList || xfbCount == 0)
|
||||||
{
|
{
|
||||||
g_VideoInitialize.pCopiedToXFB(false);
|
g_VideoInitialize.pCopiedToXFB(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Renderer::ResetAPIState();
|
Renderer::ResetAPIState();
|
||||||
// set the backbuffer as the rendering target
|
// set the backbuffer as the rendering target
|
||||||
|
@ -857,13 +857,13 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
|
||||||
// draw each xfb source
|
// draw each xfb source
|
||||||
for (u32 i = 0; i < xfbCount; ++i)
|
for (u32 i = 0; i < xfbCount; ++i)
|
||||||
{
|
{
|
||||||
xfbSource = xfbSourceList[i];
|
xfbSource = xfbSourceList[i];
|
||||||
|
|
||||||
MathUtil::Rectangle<float> sourceRc;
|
MathUtil::Rectangle<float> sourceRc;
|
||||||
sourceRc.left = 0;
|
sourceRc.left = 0;
|
||||||
sourceRc.top = 0;
|
sourceRc.top = 0;
|
||||||
sourceRc.right = xfbSource->texWidth;
|
sourceRc.right = xfbSource->texWidth;
|
||||||
sourceRc.bottom = xfbSource->texHeight;
|
sourceRc.bottom = xfbSource->texHeight;
|
||||||
|
|
||||||
MathUtil::Rectangle<float> drawRc;
|
MathUtil::Rectangle<float> drawRc;
|
||||||
drawRc.top = -1;
|
drawRc.top = -1;
|
||||||
|
@ -1011,7 +1011,7 @@ void Renderer::SetDepthMode()
|
||||||
|
|
||||||
void Renderer::SetLogicOpMode()
|
void Renderer::SetLogicOpMode()
|
||||||
{
|
{
|
||||||
if (bpmem.blendmode.logicopenable && bpmem.blendmode.logicmode != 3)
|
if (bpmem.blendmode.logicopenable && bpmem.blendmode.logicmode != 3)
|
||||||
{
|
{
|
||||||
s_blendMode = 0;
|
s_blendMode = 0;
|
||||||
D3D::gfxstate->SetAlphaBlendEnable(true);
|
D3D::gfxstate->SetAlphaBlendEnable(true);
|
||||||
|
@ -1037,7 +1037,7 @@ void Renderer::SetLineWidth()
|
||||||
|
|
||||||
void Renderer::SetSamplerState(int stage, int texindex)
|
void Renderer::SetSamplerState(int stage, int texindex)
|
||||||
{
|
{
|
||||||
const FourTexUnits &tex = bpmem.tex[texindex];
|
const FourTexUnits &tex = bpmem.tex[texindex];
|
||||||
const TexMode0 &tm0 = tex.texMode0[stage];
|
const TexMode0 &tm0 = tex.texMode0[stage];
|
||||||
const TexMode1 &tm1 = tex.texMode1[stage];
|
const TexMode1 &tm1 = tex.texMode1[stage];
|
||||||
|
|
||||||
|
@ -1045,7 +1045,7 @@ void Renderer::SetSamplerState(int stage, int texindex)
|
||||||
mip = (tm0.min_filter == 8) ? TEXF_NONE:d3dMipFilters[tm0.min_filter & 3];
|
mip = (tm0.min_filter == 8) ? TEXF_NONE:d3dMipFilters[tm0.min_filter & 3];
|
||||||
if ((tm0.min_filter & 3) && (tm0.min_filter != 8) && ((tm1.max_lod >> 4) == 0)) mip = TEXF_NONE;
|
if ((tm0.min_filter & 3) && (tm0.min_filter != 8) && ((tm1.max_lod >> 4) == 0)) mip = TEXF_NONE;
|
||||||
|
|
||||||
if (texindex) stage += 4;
|
if (texindex) stage += 4;
|
||||||
|
|
||||||
// TODO: Clarify whether these values are correct
|
// TODO: Clarify whether these values are correct
|
||||||
// NOTE: since there's no "no filter" in DX11 we're using point filters in these cases
|
// NOTE: since there's no "no filter" in DX11 we're using point filters in these cases
|
||||||
|
|
|
@ -144,7 +144,7 @@ bool TextureCache::TCacheEntry::IntersectsMemoryRange(u32 range_address, u32 ran
|
||||||
void TextureCache::Shutdown()
|
void TextureCache::Shutdown()
|
||||||
{
|
{
|
||||||
Invalidate(true);
|
Invalidate(true);
|
||||||
FreeMemoryPages(temp, TEMP_SIZE);
|
FreeMemoryPages(temp, TEMP_SIZE);
|
||||||
temp = NULL;
|
temp = NULL;
|
||||||
|
|
||||||
SAFE_RELEASE(efbcopyblendstate);
|
SAFE_RELEASE(efbcopyblendstate);
|
||||||
|
@ -167,8 +167,8 @@ void TextureCache::Cleanup()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
iter++;
|
iter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ TextureCache::TCacheEntry* TextureCache::Load(unsigned int stage, u32 address, u
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Let's reload the new texture data into the same texture,
|
// Let's reload the new texture data into the same texture,
|
||||||
// instead of destroying it and having to create a new one.
|
// instead of destroying it and having to create a new one.
|
||||||
// Might speed up movie playback very, very slightly.
|
// Might speed up movie playback very, very slightly.
|
||||||
|
|
||||||
|
@ -281,7 +281,7 @@ TextureCache::TCacheEntry* TextureCache::Load(unsigned int stage, u32 address, u
|
||||||
if (entry.texture == NULL) PanicAlert("Failed to create texture at %s %d\n", __FILE__, __LINE__);
|
if (entry.texture == NULL) PanicAlert("Failed to create texture at %s %d\n", __FILE__, __LINE__);
|
||||||
D3D::ReplaceTexture2D(entry.texture->GetTex(), temp, width, height, expandedWidth, d3d_fmt, pcfmt, 0, usage);
|
D3D::ReplaceTexture2D(entry.texture->GetTex(), temp, width, height, expandedWidth, d3d_fmt, pcfmt, 0, usage);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
D3D::ReplaceTexture2D(entry.texture->GetTex(), temp, width, height, expandedWidth, d3d_fmt, pcfmt, 0, usage);
|
D3D::ReplaceTexture2D(entry.texture->GetTex(), temp, width, height, expandedWidth, d3d_fmt, pcfmt, 0, usage);
|
||||||
}
|
}
|
||||||
|
@ -329,8 +329,8 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, boo
|
||||||
int tex_w = (abs(source_rect.GetWidth()) >> bScaleByHalf);
|
int tex_w = (abs(source_rect.GetWidth()) >> bScaleByHalf);
|
||||||
int tex_h = (abs(source_rect.GetHeight()) >> bScaleByHalf);
|
int tex_h = (abs(source_rect.GetHeight()) >> bScaleByHalf);
|
||||||
|
|
||||||
int Scaledtex_w = (g_ActiveConfig.bCopyEFBScaled)?((int)(Renderer::GetTargetScaleX() * tex_w)):tex_w;
|
int Scaledtex_w = (g_ActiveConfig.bCopyEFBScaled) ? ((int)(Renderer::GetTargetScaleX() * tex_w)) : tex_w;
|
||||||
int Scaledtex_h = (g_ActiveConfig.bCopyEFBScaled)?((int)(Renderer::GetTargetScaleY() * tex_h)):tex_h;
|
int Scaledtex_h = (g_ActiveConfig.bCopyEFBScaled) ? ((int)(Renderer::GetTargetScaleY() * tex_h)) : tex_h;
|
||||||
|
|
||||||
TexCache::iterator iter;
|
TexCache::iterator iter;
|
||||||
D3DTexture2D* tex = NULL;
|
D3DTexture2D* tex = NULL;
|
||||||
|
@ -372,135 +372,135 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, boo
|
||||||
unsigned int cbufid = (unsigned int)-1;
|
unsigned int cbufid = (unsigned int)-1;
|
||||||
|
|
||||||
// TODO: Move this to TextureCache::Init()
|
// TODO: Move this to TextureCache::Init()
|
||||||
if (bFromZBuffer)
|
if (bFromZBuffer)
|
||||||
{
|
{
|
||||||
switch(copyfmt)
|
switch(copyfmt)
|
||||||
{
|
{
|
||||||
case 0: // Z4
|
case 0: // Z4
|
||||||
case 1: // Z8
|
case 1: // Z8
|
||||||
colmat[0] = colmat[4] = colmat[8] = colmat[12] =1.0f;
|
colmat[0] = colmat[4] = colmat[8] = colmat[12] = 1.0f;
|
||||||
cbufid = 12;
|
cbufid = 12;
|
||||||
break;
|
break;
|
||||||
case 3: // Z16 //?
|
case 3: // Z16 //?
|
||||||
colmat[1] = colmat[5] = colmat[9] = colmat[12] = 1.0f;
|
colmat[1] = colmat[5] = colmat[9] = colmat[12] = 1.0f;
|
||||||
cbufid = 13;
|
cbufid = 13;
|
||||||
case 11: // Z16 (reverse order)
|
case 11: // Z16 (reverse order)
|
||||||
colmat[0] = colmat[4] = colmat[8] = colmat[13] = 1.0f;
|
colmat[0] = colmat[4] = colmat[8] = colmat[13] = 1.0f;
|
||||||
cbufid = 14;
|
cbufid = 14;
|
||||||
break;
|
break;
|
||||||
case 6: // Z24X8
|
case 6: // Z24X8
|
||||||
colmat[0] = colmat[5] = colmat[10] = 1.0f;
|
colmat[0] = colmat[5] = colmat[10] = 1.0f;
|
||||||
cbufid = 15;
|
cbufid = 15;
|
||||||
break;
|
break;
|
||||||
case 9: // Z8M
|
case 9: // Z8M
|
||||||
colmat[1] = colmat[5] = colmat[9] = colmat[13] = 1.0f;
|
colmat[1] = colmat[5] = colmat[9] = colmat[13] = 1.0f;
|
||||||
cbufid = 16;
|
cbufid = 16;
|
||||||
break;
|
break;
|
||||||
case 10: // Z8L
|
case 10: // Z8L
|
||||||
colmat[2] = colmat[6] = colmat[10] = colmat[14] = 1.0f;
|
colmat[2] = colmat[6] = colmat[10] = colmat[14] = 1.0f;
|
||||||
cbufid = 17;
|
cbufid = 17;
|
||||||
break;
|
break;
|
||||||
case 12: // Z16L
|
case 12: // Z16L
|
||||||
colmat[2] = colmat[6] = colmat[10] = colmat[13] = 1.0f;
|
colmat[2] = colmat[6] = colmat[10] = colmat[13] = 1.0f;
|
||||||
cbufid = 18;
|
cbufid = 18;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ERROR_LOG(VIDEO, "Unknown copy zbuf format: 0x%x", copyfmt);
|
ERROR_LOG(VIDEO, "Unknown copy zbuf format: 0x%x", copyfmt);
|
||||||
colmat[2] = colmat[5] = colmat[8] = 1.0f;
|
colmat[2] = colmat[5] = colmat[8] = 1.0f;
|
||||||
cbufid = 19;
|
cbufid = 19;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (bIsIntensityFmt)
|
else if (bIsIntensityFmt)
|
||||||
{
|
{
|
||||||
colmat[16] = colmat[17] = colmat[18] = 16.0f/255.0f;
|
colmat[16] = colmat[17] = colmat[18] = 16.0f/255.0f;
|
||||||
switch (copyfmt)
|
switch (copyfmt)
|
||||||
{
|
{
|
||||||
case 0: // I4
|
case 0: // I4
|
||||||
case 1: // I8
|
case 1: // I8
|
||||||
case 2: // IA4
|
case 2: // IA4
|
||||||
case 3: // IA8
|
case 3: // IA8
|
||||||
// TODO - verify these coefficients
|
// TODO - verify these coefficients
|
||||||
colmat[0] = 0.257f; colmat[1] = 0.504f; colmat[2] = 0.098f;
|
colmat[0] = 0.257f; colmat[1] = 0.504f; colmat[2] = 0.098f;
|
||||||
colmat[4] = 0.257f; colmat[5] = 0.504f; colmat[6] = 0.098f;
|
colmat[4] = 0.257f; colmat[5] = 0.504f; colmat[6] = 0.098f;
|
||||||
colmat[8] = 0.257f; colmat[9] = 0.504f; colmat[10] = 0.098f;
|
colmat[8] = 0.257f; colmat[9] = 0.504f; colmat[10] = 0.098f;
|
||||||
|
|
||||||
if (copyfmt < 2)
|
if (copyfmt < 2)
|
||||||
{
|
{
|
||||||
colmat[19] = 16.0f / 255.0f;
|
colmat[19] = 16.0f / 255.0f;
|
||||||
colmat[12] = 0.257f; colmat[13] = 0.504f; colmat[14] = 0.098f;
|
colmat[12] = 0.257f; colmat[13] = 0.504f; colmat[14] = 0.098f;
|
||||||
cbufid = 0;
|
cbufid = 0;
|
||||||
}
|
}
|
||||||
else// alpha
|
else// alpha
|
||||||
{
|
{
|
||||||
colmat[15] = 1;
|
colmat[15] = 1;
|
||||||
cbufid = 1;
|
cbufid = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ERROR_LOG(VIDEO, "Unknown copy intensity format: 0x%x", copyfmt);
|
ERROR_LOG(VIDEO, "Unknown copy intensity format: 0x%x", copyfmt);
|
||||||
colmat[0] = colmat[5] = colmat[10] = colmat[15] = 1;
|
colmat[0] = colmat[5] = colmat[10] = colmat[15] = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (copyfmt)
|
switch (copyfmt)
|
||||||
{
|
{
|
||||||
case 0: // R4
|
case 0: // R4
|
||||||
case 8: // R8
|
case 8: // R8
|
||||||
colmat[0] = colmat[4] = colmat[8] = colmat[12] = 1;
|
colmat[0] = colmat[4] = colmat[8] = colmat[12] = 1;
|
||||||
cbufid = 2;
|
cbufid = 2;
|
||||||
break;
|
break;
|
||||||
case 2: // RA4
|
case 2: // RA4
|
||||||
case 3: // RA8
|
case 3: // RA8
|
||||||
colmat[0] = colmat[4] = colmat[8] = colmat[15] = 1;
|
colmat[0] = colmat[4] = colmat[8] = colmat[15] = 1;
|
||||||
cbufid = 3;
|
cbufid = 3;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7: // A8
|
case 7: // A8
|
||||||
colmat[3] = colmat[7] = colmat[11] = colmat[15] = 1;
|
colmat[3] = colmat[7] = colmat[11] = colmat[15] = 1;
|
||||||
cbufid = 4;
|
cbufid = 4;
|
||||||
break;
|
break;
|
||||||
case 9: // G8
|
case 9: // G8
|
||||||
colmat[1] = colmat[5] = colmat[9] = colmat[13] = 1;
|
colmat[1] = colmat[5] = colmat[9] = colmat[13] = 1;
|
||||||
cbufid = 5;
|
cbufid = 5;
|
||||||
break;
|
break;
|
||||||
case 10: // B8
|
case 10: // B8
|
||||||
colmat[2] = colmat[6] = colmat[10] = colmat[14] = 1;
|
colmat[2] = colmat[6] = colmat[10] = colmat[14] = 1;
|
||||||
cbufid = 6;
|
cbufid = 6;
|
||||||
break;
|
break;
|
||||||
case 11: // RG8
|
case 11: // RG8
|
||||||
colmat[0] = colmat[4] = colmat[8] = colmat[13] = 1;
|
colmat[0] = colmat[4] = colmat[8] = colmat[13] = 1;
|
||||||
cbufid = 7;
|
cbufid = 7;
|
||||||
break;
|
break;
|
||||||
case 12: // GB8
|
case 12: // GB8
|
||||||
colmat[1] = colmat[5] = colmat[9] = colmat[14] = 1;
|
colmat[1] = colmat[5] = colmat[9] = colmat[14] = 1;
|
||||||
cbufid = 8;
|
cbufid = 8;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4: // RGB565
|
case 4: // RGB565
|
||||||
colmat[0] = colmat[5] = colmat[10] = 1;
|
colmat[0] = colmat[5] = colmat[10] = 1;
|
||||||
colmat[19] = 1; // set alpha to 1
|
colmat[19] = 1; // set alpha to 1
|
||||||
cbufid = 9;
|
cbufid = 9;
|
||||||
break;
|
break;
|
||||||
case 5: // RGB5A3
|
case 5: // RGB5A3
|
||||||
case 6: // RGBA8
|
case 6: // RGBA8
|
||||||
colmat[0] = colmat[5] = colmat[10] = colmat[15] = 1;
|
colmat[0] = colmat[5] = colmat[10] = colmat[15] = 1;
|
||||||
cbufid = 10;
|
cbufid = 10;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERROR_LOG(VIDEO, "Unknown copy color format: 0x%x", copyfmt);
|
ERROR_LOG(VIDEO, "Unknown copy color format: 0x%x", copyfmt);
|
||||||
colmat[0] = colmat[5] = colmat[10] = colmat[15] = 1;
|
colmat[0] = colmat[5] = colmat[10] = colmat[15] = 1;
|
||||||
cbufid = 11;
|
cbufid = 11;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Renderer::ResetAPIState(); // reset any game specific settings
|
Renderer::ResetAPIState(); // reset any game specific settings
|
||||||
|
|
||||||
// stretch picture with increased internal resolution
|
// stretch picture with increased internal resolution
|
||||||
D3D11_VIEWPORT vp = CD3D11_VIEWPORT(0.f, 0.f, (float)Scaledtex_w, (float)Scaledtex_h);
|
D3D11_VIEWPORT vp = CD3D11_VIEWPORT(0.f, 0.f, (float)Scaledtex_w, (float)Scaledtex_h);
|
||||||
D3D::context->RSSetViewports(1, &vp);
|
D3D::context->RSSetViewports(1, &vp);
|
||||||
|
|
|
@ -354,6 +354,7 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
|
||||||
DEBUGGER_PAUSE_LOG_AT(NEXT_NEW_TEXTURE,true,{printf("A new texture (%d x %d) is loaded", width, height);});
|
DEBUGGER_PAUSE_LOG_AT(NEXT_NEW_TEXTURE,true,{printf("A new texture (%d x %d) is loaded", width, height);});
|
||||||
return &entry;
|
return &entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool bIsIntensityFmt, u32 copyfmt, int bScaleByHalf, const EFBRectangle &source_rect)
|
void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool bIsIntensityFmt, u32 copyfmt, int bScaleByHalf, const EFBRectangle &source_rect)
|
||||||
{
|
{
|
||||||
int efb_w = source_rect.GetWidth();
|
int efb_w = source_rect.GetWidth();
|
||||||
|
@ -417,7 +418,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, boo
|
||||||
{
|
{
|
||||||
case 0: // Z4
|
case 0: // Z4
|
||||||
case 1: // Z8
|
case 1: // Z8
|
||||||
colmat[0] = colmat[4] = colmat[8] = colmat[12] =1.0f;
|
colmat[0] = colmat[4] = colmat[8] = colmat[12] = 1.0f;
|
||||||
break;
|
break;
|
||||||
case 3: // Z16 //?
|
case 3: // Z16 //?
|
||||||
colmat[1] = colmat[5] = colmat[9] = colmat[12] = 1.0f;
|
colmat[1] = colmat[5] = colmat[9] = colmat[12] = 1.0f;
|
||||||
|
|
|
@ -102,7 +102,7 @@ void AddIndices(int _primitive, int _numVertices)
|
||||||
|
|
||||||
int GetRemainingSize()
|
int GetRemainingSize()
|
||||||
{
|
{
|
||||||
return MAXVBUFFERSIZE - (int)(s_pCurBufferPointer - LocalVBuffer);
|
return MAXVBUFFERSIZE - (int)(s_pCurBufferPointer - LocalVBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetRemainingVertices(int primitive)
|
int GetRemainingVertices(int primitive)
|
||||||
|
|
|
@ -36,7 +36,7 @@ BEGIN_EVENT_TABLE(GFXDebuggerOGL,wxDialog)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
GFXDebuggerOGL::GFXDebuggerOGL(wxWindow *parent, wxWindowID id, const wxString &title,
|
GFXDebuggerOGL::GFXDebuggerOGL(wxWindow *parent, wxWindowID id, const wxString &title,
|
||||||
const wxPoint &position, const wxSize& size, long style)
|
const wxPoint &position, const wxSize& size, long style)
|
||||||
: wxDialog(parent, id, title, position, size, style)
|
: wxDialog(parent, id, title, position, size, style)
|
||||||
{
|
{
|
||||||
CreateGUIControls();
|
CreateGUIControls();
|
||||||
|
@ -72,7 +72,7 @@ void GFXDebuggerOGL::SaveSettings() const
|
||||||
// weird values, perhaps because of some conflict with the rendering window
|
// weird values, perhaps because of some conflict with the rendering window
|
||||||
// TODO: get the screen resolution and make limits from that
|
// TODO: get the screen resolution and make limits from that
|
||||||
if (GetPosition().x < 1000 && GetPosition().y < 1000
|
if (GetPosition().x < 1000 && GetPosition().y < 1000
|
||||||
&& GetSize().GetWidth() < 1000
|
&& GetSize().GetWidth() < 1000
|
||||||
&& GetSize().GetHeight() < 1000)
|
&& GetSize().GetHeight() < 1000)
|
||||||
{
|
{
|
||||||
file.Set("VideoWindow", "x", GetPosition().x);
|
file.Set("VideoWindow", "x", GetPosition().x);
|
||||||
|
@ -137,7 +137,7 @@ void GFXDebuggerOGL::CreateGUIControls()
|
||||||
m_Check[4] = new wxCheckBox(m_MainPanel, ID_SAVETARGETS, wxT("Save Targets"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
m_Check[4] = new wxCheckBox(m_MainPanel, ID_SAVETARGETS, wxT("Save Targets"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||||
m_Check[5] = new wxCheckBox(m_MainPanel, ID_SAVESHADERS, wxT("Save Shaders"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
m_Check[5] = new wxCheckBox(m_MainPanel, ID_SAVESHADERS, wxT("Save Shaders"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||||
|
|
||||||
for (int i = 0; i < NUM_OPTIONS-ID_SAVETOFILE; ++i)
|
for (int i = 0; i < NUM_OPTIONS-ID_SAVETOFILE; ++i)
|
||||||
sOptions->Add(m_Check[i], 0, 0, 5);
|
sOptions->Add(m_Check[i], 0, 0, 5);
|
||||||
|
|
||||||
// Layout everything on m_MainPanel
|
// Layout everything on m_MainPanel
|
||||||
|
|
|
@ -147,6 +147,7 @@ HWND GetWnd()
|
||||||
{
|
{
|
||||||
return m_hWnd;
|
return m_hWnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND GetParentWnd()
|
HWND GetParentWnd()
|
||||||
{
|
{
|
||||||
return m_hParent;
|
return m_hParent;
|
||||||
|
@ -305,7 +306,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// This is called from Create()
|
// This is called from Create()
|
||||||
HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const TCHAR *title)
|
HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const TCHAR *title)
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,15 +24,15 @@
|
||||||
|
|
||||||
namespace EmuWindow
|
namespace EmuWindow
|
||||||
{
|
{
|
||||||
extern int g_winstyle;
|
extern int g_winstyle;
|
||||||
|
|
||||||
HWND GetWnd();
|
HWND GetWnd();
|
||||||
HWND GetParentWnd();
|
HWND GetParentWnd();
|
||||||
HWND Create(HWND hParent, HINSTANCE hInstance, const TCHAR *title);
|
HWND Create(HWND hParent, HINSTANCE hInstance, const TCHAR *title);
|
||||||
void Show();
|
void Show();
|
||||||
void Close();
|
void Close();
|
||||||
void SetSize(int displayWidth, int displayHeight);
|
void SetSize(int displayWidth, int displayHeight);
|
||||||
void ToggleDisplayMode (int bFullscreen);
|
void ToggleDisplayMode(int bFullscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _WIN32_H_
|
#endif // _WIN32_H_
|
||||||
|
|
|
@ -49,10 +49,10 @@ namespace VertexManager
|
||||||
|
|
||||||
static int lastPrimitive;
|
static int lastPrimitive;
|
||||||
|
|
||||||
static u8 *LocalVBuffer;
|
static u8 *LocalVBuffer;
|
||||||
static u16 *TIBuffer;
|
static u16 *TIBuffer;
|
||||||
static u16 *LIBuffer;
|
static u16 *LIBuffer;
|
||||||
static u16 *PIBuffer;
|
static u16 *PIBuffer;
|
||||||
static GLint max_Index_size = 0;
|
static GLint max_Index_size = 0;
|
||||||
#define MAXVBUFFERSIZE 0x1FFFF
|
#define MAXVBUFFERSIZE 0x1FFFF
|
||||||
#define MAXIBUFFERSIZE 0xFFFF
|
#define MAXIBUFFERSIZE 0xFFFF
|
||||||
|
@ -65,7 +65,7 @@ static bool Flushed=false;
|
||||||
|
|
||||||
bool Init()
|
bool Init()
|
||||||
{
|
{
|
||||||
lastPrimitive = GX_DRAW_NONE;
|
lastPrimitive = GX_DRAW_NONE;
|
||||||
glGetIntegerv(GL_MAX_ELEMENTS_INDICES, (GLint *)&max_Index_size);
|
glGetIntegerv(GL_MAX_ELEMENTS_INDICES, (GLint *)&max_Index_size);
|
||||||
|
|
||||||
if(max_Index_size>MAXIBUFFERSIZE)
|
if(max_Index_size>MAXIBUFFERSIZE)
|
||||||
|
@ -94,13 +94,13 @@ void Shutdown()
|
||||||
delete [] LIBuffer;
|
delete [] LIBuffer;
|
||||||
delete [] PIBuffer;
|
delete [] PIBuffer;
|
||||||
glDeleteBuffers(ARRAYSIZE(s_vboBuffers), s_vboBuffers);
|
glDeleteBuffers(ARRAYSIZE(s_vboBuffers), s_vboBuffers);
|
||||||
s_nCurVBOIndex = 0;
|
s_nCurVBOIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResetBuffer()
|
void ResetBuffer()
|
||||||
{
|
{
|
||||||
s_nCurVBOIndex = (s_nCurVBOIndex + 1) % ARRAYSIZE(s_vboBuffers);
|
s_nCurVBOIndex = (s_nCurVBOIndex + 1) % ARRAYSIZE(s_vboBuffers);
|
||||||
s_pCurBufferPointer = LocalVBuffer;
|
s_pCurBufferPointer = LocalVBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddIndices(int primitive, int numVertices)
|
void AddIndices(int primitive, int numVertices)
|
||||||
|
@ -112,13 +112,13 @@ void AddIndices(int primitive, int numVertices)
|
||||||
case GX_DRAW_TRIANGLE_STRIP: IndexGenerator::AddStrip(numVertices); break;
|
case GX_DRAW_TRIANGLE_STRIP: IndexGenerator::AddStrip(numVertices); break;
|
||||||
case GX_DRAW_TRIANGLE_FAN: IndexGenerator::AddFan(numVertices); break;
|
case GX_DRAW_TRIANGLE_FAN: IndexGenerator::AddFan(numVertices); break;
|
||||||
case GX_DRAW_LINE_STRIP: IndexGenerator::AddLineStrip(numVertices); break;
|
case GX_DRAW_LINE_STRIP: IndexGenerator::AddLineStrip(numVertices); break;
|
||||||
case GX_DRAW_LINES: IndexGenerator::AddLineList(numVertices);break;
|
case GX_DRAW_LINES: IndexGenerator::AddLineList(numVertices);break;
|
||||||
case GX_DRAW_POINTS: IndexGenerator::AddPoints(numVertices); break;
|
case GX_DRAW_POINTS: IndexGenerator::AddPoints(numVertices); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetRemainingSize()
|
int GetRemainingSize()
|
||||||
{
|
{
|
||||||
return MAXVBUFFERSIZE - (int)(s_pCurBufferPointer - LocalVBuffer);
|
return MAXVBUFFERSIZE - (int)(s_pCurBufferPointer - LocalVBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,10 +126,10 @@ int GetRemainingVertices(int primitive)
|
||||||
{
|
{
|
||||||
switch (primitive)
|
switch (primitive)
|
||||||
{
|
{
|
||||||
case GX_DRAW_QUADS:
|
case GX_DRAW_QUADS:
|
||||||
case GX_DRAW_TRIANGLES:
|
case GX_DRAW_TRIANGLES:
|
||||||
case GX_DRAW_TRIANGLE_STRIP:
|
case GX_DRAW_TRIANGLE_STRIP:
|
||||||
case GX_DRAW_TRIANGLE_FAN:
|
case GX_DRAW_TRIANGLE_FAN:
|
||||||
return (max_Index_size - IndexGenerator::GetTriangleindexLen())/3;
|
return (max_Index_size - IndexGenerator::GetTriangleindexLen())/3;
|
||||||
case GX_DRAW_LINE_STRIP:
|
case GX_DRAW_LINE_STRIP:
|
||||||
case GX_DRAW_LINES:
|
case GX_DRAW_LINES:
|
||||||
|
@ -147,10 +147,10 @@ void AddVertices(int primitive, int numvertices)
|
||||||
GL_REPORT_ERROR();
|
GL_REPORT_ERROR();
|
||||||
switch (primitive)
|
switch (primitive)
|
||||||
{
|
{
|
||||||
case GX_DRAW_QUADS:
|
case GX_DRAW_QUADS:
|
||||||
case GX_DRAW_TRIANGLES:
|
case GX_DRAW_TRIANGLES:
|
||||||
case GX_DRAW_TRIANGLE_STRIP:
|
case GX_DRAW_TRIANGLE_STRIP:
|
||||||
case GX_DRAW_TRIANGLE_FAN:
|
case GX_DRAW_TRIANGLE_FAN:
|
||||||
if(max_Index_size - IndexGenerator::GetTriangleindexLen() < 3 * numvertices)
|
if(max_Index_size - IndexGenerator::GetTriangleindexLen() < 3 * numvertices)
|
||||||
Flush();
|
Flush();
|
||||||
break;
|
break;
|
||||||
|
@ -170,36 +170,36 @@ void AddVertices(int primitive, int numvertices)
|
||||||
IndexGenerator::Start(TIBuffer,LIBuffer,PIBuffer);
|
IndexGenerator::Start(TIBuffer,LIBuffer,PIBuffer);
|
||||||
Flushed=false;
|
Flushed=false;
|
||||||
}
|
}
|
||||||
lastPrimitive = primitive;
|
lastPrimitive = primitive;
|
||||||
ADDSTAT(stats.thisFrame.numPrims, numvertices);
|
ADDSTAT(stats.thisFrame.numPrims, numvertices);
|
||||||
INCSTAT(stats.thisFrame.numPrimitiveJoins);
|
INCSTAT(stats.thisFrame.numPrimitiveJoins);
|
||||||
AddIndices(primitive, numvertices);
|
AddIndices(primitive, numvertices);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Draw()
|
inline void Draw()
|
||||||
{
|
{
|
||||||
if(IndexGenerator::GetNumTriangles() > 0)
|
if(IndexGenerator::GetNumTriangles() > 0)
|
||||||
{
|
{
|
||||||
glDrawElements(GL_TRIANGLES, IndexGenerator::GetTriangleindexLen(), GL_UNSIGNED_SHORT,TIBuffer);
|
glDrawElements(GL_TRIANGLES, IndexGenerator::GetTriangleindexLen(), GL_UNSIGNED_SHORT, TIBuffer);
|
||||||
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
||||||
}
|
}
|
||||||
if(IndexGenerator::GetNumLines() > 0)
|
if(IndexGenerator::GetNumLines() > 0)
|
||||||
{
|
{
|
||||||
glDrawElements(GL_LINES, IndexGenerator::GetLineindexLen(), GL_UNSIGNED_SHORT,LIBuffer);
|
glDrawElements(GL_LINES, IndexGenerator::GetLineindexLen(), GL_UNSIGNED_SHORT, LIBuffer);
|
||||||
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
||||||
}
|
}
|
||||||
if(IndexGenerator::GetNumPoints() > 0)
|
if(IndexGenerator::GetNumPoints() > 0)
|
||||||
{
|
{
|
||||||
glDrawElements(GL_POINTS, IndexGenerator::GetPointindexLen(), GL_UNSIGNED_SHORT,PIBuffer);
|
glDrawElements(GL_POINTS, IndexGenerator::GetPointindexLen(), GL_UNSIGNED_SHORT, PIBuffer);
|
||||||
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Flush()
|
void Flush()
|
||||||
{
|
{
|
||||||
if (LocalVBuffer == s_pCurBufferPointer) return;
|
if (LocalVBuffer == s_pCurBufferPointer) return;
|
||||||
if(Flushed) return;
|
if(Flushed) return;
|
||||||
Flushed=true;
|
Flushed=true;
|
||||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||||
|
@ -232,7 +232,7 @@ void Flush()
|
||||||
|
|
||||||
DVSTARTPROFILE();
|
DVSTARTPROFILE();
|
||||||
|
|
||||||
GL_REPORT_ERROR();
|
GL_REPORT_ERROR();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -259,9 +259,9 @@ void Flush()
|
||||||
usedtextures |= 1 << bpmem.tevindref.getTexMap(bpmem.tevind[i].bt);
|
usedtextures |= 1 << bpmem.tevindref.getTexMap(bpmem.tevind[i].bt);
|
||||||
|
|
||||||
u32 nonpow2tex = 0;
|
u32 nonpow2tex = 0;
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
if (usedtextures & (1 << i))
|
if (usedtextures & (1 << i))
|
||||||
{
|
{
|
||||||
glActiveTexture(GL_TEXTURE0 + i);
|
glActiveTexture(GL_TEXTURE0 + i);
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ void Flush()
|
||||||
VERTEXSHADER* vs = VertexShaderCache::GetShader(g_nativeVertexFmt->m_components);
|
VERTEXSHADER* vs = VertexShaderCache::GetShader(g_nativeVertexFmt->m_components);
|
||||||
|
|
||||||
// set global constants
|
// set global constants
|
||||||
VertexShaderManager::SetConstants();
|
VertexShaderManager::SetConstants();
|
||||||
PixelShaderManager::SetConstants();
|
PixelShaderManager::SetConstants();
|
||||||
|
|
||||||
// finally bind
|
// finally bind
|
||||||
|
@ -319,12 +319,12 @@ void Flush()
|
||||||
|
|
||||||
Draw();
|
Draw();
|
||||||
|
|
||||||
// run through vertex groups again to set alpha
|
// run through vertex groups again to set alpha
|
||||||
if (!g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate)
|
if (!g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate)
|
||||||
{
|
{
|
||||||
ps = PixelShaderCache::GetShader(true);
|
ps = PixelShaderCache::GetShader(true);
|
||||||
|
|
||||||
if (ps)PixelShaderCache::SetCurrentShader(ps->glprogid);
|
if (ps)PixelShaderCache::SetCurrentShader(ps->glprogid);
|
||||||
|
|
||||||
// only update alpha
|
// only update alpha
|
||||||
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
|
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
|
||||||
|
@ -336,13 +336,13 @@ void Flush()
|
||||||
Renderer::SetColorMask();
|
Renderer::SetColorMask();
|
||||||
|
|
||||||
if (bpmem.blendmode.blendenable || bpmem.blendmode.subtract)
|
if (bpmem.blendmode.blendenable || bpmem.blendmode.subtract)
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
}
|
}
|
||||||
s_nCurVBOIndex = (s_nCurVBOIndex + 1) % ARRAYSIZE(s_vboBuffers);
|
s_nCurVBOIndex = (s_nCurVBOIndex + 1) % ARRAYSIZE(s_vboBuffers);
|
||||||
s_pCurBufferPointer = LocalVBuffer;
|
s_pCurBufferPointer = LocalVBuffer;
|
||||||
IndexGenerator::Start(TIBuffer,LIBuffer,PIBuffer);
|
IndexGenerator::Start(TIBuffer,LIBuffer,PIBuffer);
|
||||||
|
|
||||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||||
if (g_ActiveConfig.iLog & CONF_SAVESHADERS)
|
if (g_ActiveConfig.iLog & CONF_SAVESHADERS)
|
||||||
{
|
{
|
||||||
// save the shaders
|
// save the shaders
|
||||||
|
@ -366,7 +366,6 @@ void Flush()
|
||||||
|
|
||||||
GL_REPORT_ERRORD();
|
GL_REPORT_ERRORD();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@ void GetDllInfo (PLUGIN_INFO* _PluginInfo)
|
||||||
void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals)
|
void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals)
|
||||||
{
|
{
|
||||||
globals = _pPluginGlobals;
|
globals = _pPluginGlobals;
|
||||||
LogManager::SetInstance((LogManager *)globals->logManager);
|
LogManager::SetInstance((LogManager*)globals->logManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is used for the functions right below here which use wxwidgets
|
// This is used for the functions right below here which use wxwidgets
|
||||||
|
@ -211,7 +211,7 @@ void Initialize(void *init)
|
||||||
|
|
||||||
g_Config.UpdateProjectionHack();
|
g_Config.UpdateProjectionHack();
|
||||||
#if defined(HAVE_WX) && HAVE_WX
|
#if defined(HAVE_WX) && HAVE_WX
|
||||||
//Enable support for PNG screenshots.
|
// Enable support for PNG screenshots.
|
||||||
wxImage::AddHandler( new wxPNGHandler );
|
wxImage::AddHandler( new wxPNGHandler );
|
||||||
#endif
|
#endif
|
||||||
UpdateActiveConfig();
|
UpdateActiveConfig();
|
||||||
|
@ -231,10 +231,11 @@ void Initialize(void *init)
|
||||||
_pVideoInitialize->pXWindow = g_VideoInitialize.pXWindow;
|
_pVideoInitialize->pXWindow = g_VideoInitialize.pXWindow;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
OSD::AddMessage("Dolphin OpenGL Video Plugin" ,5000);
|
OSD::AddMessage("Dolphin OpenGL Video Plugin", 5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoState(unsigned char **ptr, int mode) {
|
void DoState(unsigned char **ptr, int mode)
|
||||||
|
{
|
||||||
#if defined(HAVE_X11) && HAVE_X11
|
#if defined(HAVE_X11) && HAVE_X11
|
||||||
OpenGL_MakeCurrent();
|
OpenGL_MakeCurrent();
|
||||||
#endif
|
#endif
|
||||||
|
@ -351,7 +352,8 @@ void Video_AddMessage(const char* pstr, u32 milliseconds)
|
||||||
OSD::AddMessage(pstr, milliseconds);
|
OSD::AddMessage(pstr, milliseconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Video_SetRendering(bool bEnabled) {
|
void Video_SetRendering(bool bEnabled)
|
||||||
|
{
|
||||||
Fifo_SetRendering(bEnabled);
|
Fifo_SetRendering(bEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue