revert last 2 commits

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3533 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee
2009-06-22 09:31:30 +00:00
parent 5bcf69cbd6
commit 6b2855de5e
37 changed files with 1935 additions and 1939 deletions

View File

@ -1180,7 +1180,7 @@
Name="Decoder"
>
<File
RelativePath=".\Src\SUFunctions.cpp"
RelativePath=".\Src\BPFunctions.cpp"
>
</File>
</Filter>

View File

@ -15,7 +15,7 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "SUFunctions.h"
#include "BPFunctions.h"
#include "D3DBase.h"
#include "Config.h"
#include "Common.h"
@ -92,7 +92,7 @@ static const D3DTEXTUREADDRESS d3dClamps[4] =
D3DTADDRESS_WRAP //reserved
};
namespace SUFunctions
namespace BPFunctions
{
void FlushPipeline()
@ -100,12 +100,12 @@ void FlushPipeline()
VertexManager::Flush();
}
void SetGenerationMode(const BPCommand &bp)
void SetGenerationMode(const Bypass &bp)
{
// dev->SetRenderState(D3DRS_CULLMODE, d3dCullModes[sumem.genMode.cullmode]);
Renderer::SetRenderState(D3DRS_CULLMODE, d3dCullModes[sumem.genMode.cullmode]);
// dev->SetRenderState(D3DRS_CULLMODE, d3dCullModes[bpmem.genMode.cullmode]);
Renderer::SetRenderState(D3DRS_CULLMODE, d3dCullModes[bpmem.genMode.cullmode]);
if (sumem.genMode.cullmode == 3)
if (bpmem.genMode.cullmode == 3)
{
// dev->SetRenderState(D3DRS_COLORWRITEENABLE, 0);
Renderer::SetRenderState(D3DRS_COLORWRITEENABLE, 0);
@ -113,9 +113,9 @@ void SetGenerationMode(const BPCommand &bp)
else
{
DWORD write = 0;
if (sumem.blendmode.alphaupdate)
if (bpmem.blendmode.alphaupdate)
write = D3DCOLORWRITEENABLE_ALPHA;
if (sumem.blendmode.colorupdate)
if (bpmem.blendmode.colorupdate)
write |= D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE;
// dev->SetRenderState(D3DRS_COLORWRITEENABLE, write);
@ -123,27 +123,27 @@ void SetGenerationMode(const BPCommand &bp)
}
}
void SetScissor(const BPCommand &bp)
void SetScissor(const Bypass &bp)
{
Renderer::SetScissorRect();
}
void SetLineWidth(const BPCommand &bp)
void SetLineWidth(const Bypass &bp)
{
// We can't change line width in D3D unless we use ID3DXLine
float psize = float(sumem.lineptwidth.pointsize) * 6.0f;
float psize = float(bpmem.lineptwidth.pointsize) * 6.0f;
Renderer::SetRenderState(D3DRS_POINTSIZE, *((DWORD*)&psize));
}
void SetDepthMode(const BPCommand &bp)
void SetDepthMode(const Bypass &bp)
{
if (sumem.zmode.testenable)
if (bpmem.zmode.testenable)
{
// dev->SetRenderState(D3DRS_ZENABLE, TRUE);
// dev->SetRenderState(D3DRS_ZWRITEENABLE, sumem.zmode.updateenable);
// dev->SetRenderState(D3DRS_ZFUNC,d3dCmpFuncs[sumem.zmode.func]);
// dev->SetRenderState(D3DRS_ZWRITEENABLE, bpmem.zmode.updateenable);
// dev->SetRenderState(D3DRS_ZFUNC,d3dCmpFuncs[bpmem.zmode.func]);
Renderer::SetRenderState(D3DRS_ZENABLE, TRUE);
Renderer::SetRenderState(D3DRS_ZWRITEENABLE, sumem.zmode.updateenable);
Renderer::SetRenderState(D3DRS_ZFUNC, d3dCmpFuncs[sumem.zmode.func]);
Renderer::SetRenderState(D3DRS_ZWRITEENABLE, bpmem.zmode.updateenable);
Renderer::SetRenderState(D3DRS_ZFUNC, d3dCmpFuncs[bpmem.zmode.func]);
}
else
{
@ -155,23 +155,23 @@ void SetDepthMode(const BPCommand &bp)
Renderer::SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
}
//if (!sumem.zmode.updateenable)
//if (!bpmem.zmode.updateenable)
// Renderer::SetRenderMode(Renderer::RM_Normal);
}
void SetBlendMode(const BPCommand &bp)
void SetBlendMode(const Bypass &bp)
{
if (bp.changes & 1)
Renderer::SetRenderState(D3DRS_ALPHABLENDENABLE, sumem.blendmode.blendenable);
Renderer::SetRenderState(D3DRS_ALPHABLENDENABLE, bpmem.blendmode.blendenable);
D3DBLEND src = d3dSrcFactors[sumem.blendmode.srcfactor];
D3DBLEND dst = d3dDestFactors[sumem.blendmode.dstfactor];
D3DBLEND src = d3dSrcFactors[bpmem.blendmode.srcfactor];
D3DBLEND dst = d3dDestFactors[bpmem.blendmode.dstfactor];
if (bp.changes & 0x700)
Renderer::SetRenderState(D3DRS_SRCBLEND, src);
if (bp.changes & 0xE0) {
if (!sumem.blendmode.subtract)
if (!bpmem.blendmode.subtract)
{
Renderer::SetRenderState(D3DRS_DESTBLEND, dst);
}
@ -182,7 +182,7 @@ void SetBlendMode(const BPCommand &bp)
}
if (bp.changes & 0x800)
{
if (sumem.blendmode.subtract)
if (bpmem.blendmode.subtract)
{
Renderer::SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
Renderer::SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);
@ -193,23 +193,23 @@ void SetBlendMode(const BPCommand &bp)
Renderer::SetRenderState(D3DRS_DESTBLEND, dst);
}
Renderer::SetRenderState(D3DRS_BLENDOP, sumem.blendmode.subtract ? D3DBLENDOP_SUBTRACT : D3DBLENDOP_ADD);
Renderer::SetRenderState(D3DRS_BLENDOP, bpmem.blendmode.subtract ? D3DBLENDOP_SUBTRACT : D3DBLENDOP_ADD);
}
}
void SetDitherMode(const BPCommand &bp)
void SetDitherMode(const Bypass &bp)
{
Renderer::SetRenderState(D3DRS_DITHERENABLE,sumem.blendmode.dither);
Renderer::SetRenderState(D3DRS_DITHERENABLE,bpmem.blendmode.dither);
}
void SetLogicOpMode(const BPCommand &bp)
void SetLogicOpMode(const Bypass &bp)
{
// Logic op blending. D3D can't do this but can fake some modes.
}
void SetColorMask(const BPCommand &bp)
void SetColorMask(const Bypass &bp)
{
DWORD write = 0;
if (sumem.blendmode.alphaupdate)
if (bpmem.blendmode.alphaupdate)
write = D3DCOLORWRITEENABLE_ALPHA;
if (sumem.blendmode.colorupdate)
if (bpmem.blendmode.colorupdate)
write |= D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE;
Renderer::SetRenderState(D3DRS_COLORWRITEENABLE, write);
@ -222,19 +222,19 @@ float GetRendererTargetScaleY()
{
return Renderer::GetYScale();
}
void CopyEFB(const BPCommand &bp, const TRectangle &rc, const u32 &address, const bool &fromZBuffer, const bool &isIntensityFmt, const u32 &copyfmt, const bool &scaleByHalf)
void CopyEFB(const Bypass &bp, const TRectangle &rc, const u32 &address, const bool &fromZBuffer, const bool &isIntensityFmt, const u32 &copyfmt, const bool &scaleByHalf)
{
RECT rec = { rc.left, rc.top, rc.right, rc.bottom };
TextureCache::CopyEFBToRenderTarget(sumem.copyTexDest<<5, &rec);
TextureCache::CopyEFBToRenderTarget(bpmem.copyTexDest<<5, &rec);
}
void RenderToXFB(const BPCommand &bp, const TRectangle &multirc, const float &yScale, const float &xfbLines, u8* pXFB, const u32 &dstWidth, const u32 &dstHeight)
void RenderToXFB(const Bypass &bp, const TRectangle &multirc, const float &yScale, const float &xfbLines, u8* pXFB, const u32 &dstWidth, const u32 &dstHeight)
{
Renderer::SwapBuffers();
PRIM_LOG("Renderer::SwapBuffers()");
g_VideoInitialize.pCopiedToXFB();
}
void ClearScreen(const BPCommand &bp, const TRectangle &multirc)
void ClearScreen(const Bypass &bp, const TRectangle &multirc)
{
// it seems that the GC is able to alpha blend on color-fill
// we cant do that so if alpha is != 255 we skip it
@ -247,17 +247,17 @@ void ClearScreen(const BPCommand &bp, const TRectangle &multirc)
D3DCOLOR col = 0;
float clearZ = 0;
if (sumem.blendmode.colorupdate || sumem.blendmode.alphaupdate)
if (bpmem.blendmode.colorupdate || bpmem.blendmode.alphaupdate)
{
if (sumem.blendmode.colorupdate || sumem.blendmode.alphaupdate)
col = (sumem.clearcolorAR << 16) | sumem.clearcolorGB;
if (bpmem.blendmode.colorupdate || bpmem.blendmode.alphaupdate)
col = (bpmem.clearcolorAR << 16) | bpmem.clearcolorGB;
// clearflags |= D3DCLEAR_TARGET; set to break animal crossing :p
}
// clear z-buffer
if (sumem.zmode.updateenable)
if (bpmem.zmode.updateenable)
{
clearZ = (float)(sumem.clearZValue & 0xFFFFFF) / float(0xFFFFFF);
clearZ = (float)(bpmem.clearZValue & 0xFFFFFF) / float(0xFFFFFF);
if (clearZ > 1.0f) clearZ = 1.0f;
if (clearZ < 0.0f) clearZ = 0.0f;
clearflags |= D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL;
@ -266,7 +266,7 @@ void ClearScreen(const BPCommand &bp, const TRectangle &multirc)
D3D::dev->Clear(0, NULL, clearflags, col, clearZ, 0);
}
void RestoreRenderState(const BPCommand &bp)
void RestoreRenderState(const Bypass &bp)
{
//Renderer::SetRenderMode(Renderer::RM_Normal);
}
@ -290,9 +290,9 @@ u8 *GetPointer(const u32 &address)
{
return g_VideoInitialize.pGetMemoryPointer(address);
}
void SetSamplerState(const BPCommand &bp)
void SetSamplerState(const Bypass &bp)
{
FourTexUnits &tex = sumem.tex[(bp.address & 0xE0) == 0xA0];
FourTexUnits &tex = bpmem.tex[(bp.address & 0xE0) == 0xA0];
int stage = (bp.address & 3);//(addr>>4)&2;
TexMode0 &tm0 = tex.texMode0[stage];
@ -329,7 +329,7 @@ void SetSamplerState(const BPCommand &bp)
//sprintf(temp,"lod %f",tm0.lod_bias/4.0f);
//g_VideoInitialize.pLog(temp);
}
void SetInterlacingMode(const BPCommand &bp)
void SetInterlacingMode(const Bypass &bp)
{
// TODO
}

View File

@ -25,7 +25,7 @@
#include "PixelShaderManager.h"
#include "PixelShaderCache.h"
#include "VertexLoader.h"
#include "SUMemory.h"
#include "BPMemory.h"
#include "XFMemory.h"
#include <Cg/cg.h>

View File

@ -26,7 +26,7 @@
#include "VertexManager.h"
#include "Render.h"
#include "OpcodeDecoding.h"
#include "SUStructs.h"
#include "BPStructs.h"
#include "XFStructs.h"
#include "D3DPostprocess.h"
#include "D3DUtil.h"
@ -386,7 +386,7 @@ void Renderer::SwapBuffers()
D3D::dev->SetRenderState(D3DRS_SCISSORTESTENABLE, false);
D3D::dev->Clear(0, 0, D3DCLEAR_TARGET, 0x101010, 0, 0);
u32 clearColor = (sumem.clearcolorAR << 16) | sumem.clearcolorGB;
u32 clearColor = (bpmem.clearcolorAR << 16) | bpmem.clearcolorGB;
// clearColor |= 0x003F003F;
// D3D::BeginFrame(true,clearColor,1.0f);
D3D::BeginFrame(false, clearColor, 1.0f);
@ -441,13 +441,13 @@ void Renderer::SetViewport(float* _Viewport)
void Renderer::SetScissorRect()
{
int xoff = sumem.scissorOffset.x * 2 - 342;
int yoff = sumem.scissorOffset.y * 2 - 342;
int xoff = bpmem.scissorOffset.x * 2 - 342;
int yoff = bpmem.scissorOffset.y * 2 - 342;
RECT rc;
rc.left = (int)((float)sumem.scissorTL.x - xoff - 342);
rc.top = (int)((float)sumem.scissorTL.y - yoff - 342);
rc.right = (int)((float)sumem.scissorBR.x - xoff - 341);
rc.bottom = (int)((float)sumem.scissorBR.y - yoff - 341);
rc.left = (int)((float)bpmem.scissorTL.x - xoff - 342);
rc.top = (int)((float)bpmem.scissorTL.y - yoff - 342);
rc.right = (int)((float)bpmem.scissorBR.x - xoff - 341);
rc.bottom = (int)((float)bpmem.scissorBR.y - yoff - 341);
rc.left = (int)(rc.left * xScale);
rc.top = (int)(rc.top * yScale);
@ -588,8 +588,8 @@ void UpdateViewport()
// Keep aspect ratio at 4:3
// rawViewport[0] = 320, rawViewport[1] = -240
int scissorXOff = sumem.scissorOffset.x * 2 - 342;
int scissorYOff = sumem.scissorOffset.y * 2 - 342;
int scissorXOff = bpmem.scissorOffset.x * 2 - 342;
int scissorYOff = bpmem.scissorOffset.y * 2 - 342;
float fourThree = 4.0f / 3.0f;
// These were commented out to fix "unreferenced local variable" compiler warnings.
// float wAdj, hAdj;

View File

@ -213,7 +213,7 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
entry.w = width;
entry.h = height;
entry.fmt = format;
entry.mode = sumem.tex[stage > 3].texMode0[stage & 3];
entry.mode = bpmem.tex[stage > 3].texMode0[stage & 3];
if (g_Config.bDumpTextures)
{ // dump texture to file

View File

@ -22,7 +22,7 @@
#include <map>
#include "D3DBase.h"
#include "SUMemory.h"
#include "BPMemory.h"
class TextureCache
{

View File

@ -33,7 +33,7 @@
#include "NativeVertexWriter.h"
#include "TextureCache.h"
#include "SUStructs.h"
#include "BPStructs.h"
#include "XFStructs.h"
using namespace D3D;
@ -185,15 +185,15 @@ void Flush()
g_nativeVertexFmt->SetupVertexPointers();
u32 usedtextures = 0;
for (u32 i = 0; i < (u32)sumem.genMode.numtevstages + 1; ++i) {
if (sumem.tevorders[i/2].getEnable(i & 1))
usedtextures |= 1 << sumem.tevorders[i/2].getTexMap(i & 1);
for (u32 i = 0; i < (u32)bpmem.genMode.numtevstages + 1; ++i) {
if (bpmem.tevorders[i/2].getEnable(i & 1))
usedtextures |= 1 << bpmem.tevorders[i/2].getTexMap(i & 1);
}
if (sumem.genMode.numindstages > 0) {
for (u32 i = 0; i < (u32)sumem.genMode.numtevstages + 1; ++i) {
if (sumem.tevind[i].IsActive() && sumem.tevind[i].bt < sumem.genMode.numindstages) {
usedtextures |= 1 << sumem.tevindref.getTexMap(sumem.tevind[i].bt);
if (bpmem.genMode.numindstages > 0) {
for (u32 i = 0; i < (u32)bpmem.genMode.numtevstages + 1; ++i) {
if (bpmem.tevind[i].IsActive() && bpmem.tevind[i].bt < bpmem.genMode.numindstages) {
usedtextures |= 1 << bpmem.tevindref.getTexMap(bpmem.tevind[i].bt);
}
}
}
@ -202,7 +202,7 @@ void Flush()
for (int i = 0; i < 8; i++)
{
if (usedtextures & (1 << i)) {
FourTexUnits &tex = sumem.tex[i >> 2];
FourTexUnits &tex = bpmem.tex[i >> 2];
TextureCache::TCacheEntry* tentry = TextureCache::Load(i,
(tex.texImage3[i&3].image_base/* & 0x1FFFFF*/) << 5,
tex.texImage0[i&3].width+1, tex.texImage0[i&3].height+1,

View File

@ -25,7 +25,7 @@
#include "Config.h"
#include "VertexShaderCache.h"
#include "VertexLoader.h"
#include "SUMemory.h"
#include "BPMemory.h"
#include "XFMemory.h"
#include <Cg/cg.h>

View File

@ -28,7 +28,7 @@
#include "Fifo.h"
#include "OpcodeDecoding.h"
#include "TextureCache.h"
#include "SUStructs.h"
#include "BPStructs.h"
#include "VertexManager.h"
#include "VertexLoaderManager.h"
#include "VertexShaderManager.h"
@ -223,7 +223,7 @@ void Video_Prepare(void)
TextureCache::Init();
SUInit();
BPInit();
VertexManager::Init();
Fifo_Init();
VertexLoaderManager::Init();