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

@ -717,11 +717,11 @@
Name="Decoder"
>
<File
RelativePath=".\Src\NativeVertexFormat.cpp"
RelativePath=".\Src\BPFunctions.cpp"
>
</File>
<File
RelativePath=".\Src\SUFunctions.cpp"
RelativePath=".\Src\NativeVertexFormat.cpp"
>
</File>
<File

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 "Globals.h"
#include "Profiler.h"
#include "Config.h"
@ -27,7 +27,7 @@
#include "XFB.h"
#include "main.h"
namespace SUFunctions
namespace BPFunctions
{
// ----------------------------------------------
// State translation lookup tables
@ -47,40 +47,40 @@ void FlushPipeline()
{
VertexManager::Flush();
}
void SetGenerationMode(const BPCommand &bp)
void SetGenerationMode(const Bypass &bp)
{
// none, ccw, cw, ccw
if (sumem.genMode.cullmode > 0)
if (bpmem.genMode.cullmode > 0)
{
glEnable(GL_CULL_FACE);
glFrontFace(sumem.genMode.cullmode == 2 ? GL_CCW : GL_CW);
glFrontFace(bpmem.genMode.cullmode == 2 ? GL_CCW : GL_CW);
}
else
glDisable(GL_CULL_FACE);
}
void SetScissor(const BPCommand &bp)
void SetScissor(const Bypass &bp)
{
if (!Renderer::SetScissorRect())
if (bp.address == SUMEM_SCISSORBR)
if (bp.address == BPMEM_SCISSORBR)
ERROR_LOG(VIDEO, "bad scissor!");
}
void SetLineWidth(const BPCommand &bp)
void SetLineWidth(const Bypass &bp)
{
float fratio = xfregs.rawViewport[0] != 0 ? ((float)Renderer::GetTargetWidth() / EFB_WIDTH) : 1.0f;
if (sumem.lineptwidth.linesize > 0)
glLineWidth((float)sumem.lineptwidth.linesize * fratio / 6.0f); // scale by ratio of widths
if (sumem.lineptwidth.pointsize > 0)
glPointSize((float)sumem.lineptwidth.pointsize * fratio / 6.0f);
if (bpmem.lineptwidth.linesize > 0)
glLineWidth((float)bpmem.lineptwidth.linesize * fratio / 6.0f); // scale by ratio of widths
if (bpmem.lineptwidth.pointsize > 0)
glPointSize((float)bpmem.lineptwidth.pointsize * fratio / 6.0f);
}
void SetDepthMode(const BPCommand &bp)
void SetDepthMode(const Bypass &bp)
{
if (sumem.zmode.testenable)
if (bpmem.zmode.testenable)
{
glEnable(GL_DEPTH_TEST);
glDepthMask(sumem.zmode.updateenable ? GL_TRUE : GL_FALSE);
glDepthFunc(glCmpFuncs[sumem.zmode.func]);
glDepthMask(bpmem.zmode.updateenable ? GL_TRUE : GL_FALSE);
glDepthFunc(glCmpFuncs[bpmem.zmode.func]);
}
else
{
@ -89,28 +89,28 @@ void SetDepthMode(const BPCommand &bp)
glDepthMask(GL_FALSE);
}
}
void SetBlendMode(const BPCommand &bp)
void SetBlendMode(const Bypass &bp)
{
Renderer::SetBlendMode(false);
}
void SetDitherMode(const BPCommand &bp)
void SetDitherMode(const Bypass &bp)
{
if (sumem.blendmode.dither)
if (bpmem.blendmode.dither)
glEnable(GL_DITHER);
else
glDisable(GL_DITHER);
}
void SetLogicOpMode(const BPCommand &bp)
void SetLogicOpMode(const Bypass &bp)
{
if (sumem.blendmode.logicopenable)
if (bpmem.blendmode.logicopenable)
{
glEnable(GL_COLOR_LOGIC_OP);
glLogicOp(glLogicOpCodes[sumem.blendmode.logicmode]);
glLogicOp(glLogicOpCodes[bpmem.blendmode.logicmode]);
}
else
glDisable(GL_COLOR_LOGIC_OP);
}
void SetColorMask(const BPCommand &bp)
void SetColorMask(const Bypass &bp)
{
Renderer::SetColorMask();
}
@ -122,9 +122,9 @@ float GetRendererTargetScaleY()
{
return Renderer::GetTargetScaleY();
}
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)
{
// sumem.zcontrol.pixel_format to PIXELFMT_Z24 is when the game wants to copy from ZBuffer (Zbuffer uses 24-bit Format)
// bpmem.zcontrol.pixel_format to PIXELFMT_Z24 is when the game wants to copy from ZBuffer (Zbuffer uses 24-bit Format)
if (!g_Config.bEFBCopyDisable)
if (g_Config.bCopyEFBToRAM) // To RAM
TextureConverter::EncodeToRam(address, fromZBuffer, isIntensityFmt, copyfmt, scaleByHalf, rc);
@ -132,7 +132,7 @@ void CopyEFB(const BPCommand &bp, const TRectangle &rc, const u32 &address, cons
TextureMngr::CopyRenderTargetToTexture(address, fromZBuffer, isIntensityFmt, copyfmt, scaleByHalf, rc);
}
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)
{
// EFB to XFB
if (g_Config.bUseXFB)
@ -155,7 +155,7 @@ void RenderToXFB(const BPCommand &bp, const TRectangle &multirc, const float &yS
}
g_VideoInitialize.pCopiedToXFB();
}
void ClearScreen(const BPCommand &bp, const TRectangle &multirc)
void ClearScreen(const Bypass &bp, const TRectangle &multirc)
{
// Update the view port for clearing the picture
glViewport(0, 0, Renderer::GetTargetWidth(), Renderer::GetTargetHeight());
@ -169,21 +169,21 @@ void ClearScreen(const BPCommand &bp, const TRectangle &multirc)
// Since clear operations use the source rectangle, we have to do
// regular renders (glClear clears the entire buffer)
if (sumem.blendmode.colorupdate || sumem.blendmode.alphaupdate || sumem.zmode.updateenable)
if (bpmem.blendmode.colorupdate || bpmem.blendmode.alphaupdate || bpmem.zmode.updateenable)
{
GLbitfield bits = 0;
if (sumem.blendmode.colorupdate || sumem.blendmode.alphaupdate)
if (bpmem.blendmode.colorupdate || bpmem.blendmode.alphaupdate)
{
u32 clearColor = (sumem.clearcolorAR << 16) | sumem.clearcolorGB;
u32 clearColor = (bpmem.clearcolorAR << 16) | bpmem.clearcolorGB;
glClearColor(((clearColor>>16) & 0xff)*(1/255.0f),
((clearColor>>8 ) & 0xff)*(1/255.0f),
((clearColor>>0 ) & 0xff)*(1/255.0f),
((clearColor>>24) & 0xff)*(1/255.0f));
bits |= GL_COLOR_BUFFER_BIT;
}
if (sumem.zmode.updateenable)
if (bpmem.zmode.updateenable)
{
glClearDepth((float)(sumem.clearZValue & 0xFFFFFF) / float(0xFFFFFF));
glClearDepth((float)(bpmem.clearZValue & 0xFFFFFF) / float(0xFFFFFF));
bits |= GL_DEPTH_BUFFER_BIT;
}
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
@ -191,7 +191,7 @@ void ClearScreen(const BPCommand &bp, const TRectangle &multirc)
}
}
void RestoreRenderState(const BPCommand &bp)
void RestoreRenderState(const Bypass &bp)
{
Renderer::RestoreGLState();
}
@ -215,11 +215,11 @@ u8 *GetPointer(const u32 &address)
{
return g_VideoInitialize.pGetMemoryPointer(address);
}
void SetSamplerState(const BPCommand &bp)
void SetSamplerState(const Bypass &bp)
{
// TODO
}
void SetInterlacingMode(const BPCommand &bp)
void SetInterlacingMode(const Bypass &bp)
{
// TODO
}

View File

@ -21,7 +21,7 @@
#include <map>
#include <string>
#include "SUMemory.h"
#include "BPMemory.h"
#include "PixelShaderGen.h"
struct FRAGMENTSHADER

View File

@ -38,7 +38,7 @@
#include "ImageWrite.h"
#include "Render.h"
#include "OpcodeDecoding.h"
#include "SUStructs.h"
#include "BPStructs.h"
#include "TextureMngr.h"
#include "rasterfont.h"
#include "VertexShaderGen.h"
@ -606,9 +606,9 @@ void Renderer::ResetGLState()
void Renderer::RestoreGLState()
{
// Gets us back into a more game-like state.
if (sumem.genMode.cullmode > 0) glEnable(GL_CULL_FACE);
if (sumem.zmode.testenable) glEnable(GL_DEPTH_TEST);
if (sumem.zmode.updateenable) glDepthMask(GL_TRUE);
if (bpmem.genMode.cullmode > 0) glEnable(GL_CULL_FACE);
if (bpmem.zmode.testenable) glEnable(GL_DEPTH_TEST);
if (bpmem.zmode.updateenable) glDepthMask(GL_TRUE);
glEnable(GL_SCISSOR_TEST);
SetScissorRect();
@ -621,11 +621,11 @@ void Renderer::RestoreGLState()
void Renderer::SetColorMask()
{
if (sumem.blendmode.alphaupdate && sumem.blendmode.colorupdate)
if (bpmem.blendmode.alphaupdate && bpmem.blendmode.colorupdate)
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
else if (sumem.blendmode.alphaupdate)
else if (bpmem.blendmode.alphaupdate)
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
else if (sumem.blendmode.colorupdate)
else if (bpmem.blendmode.colorupdate)
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);
else
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
@ -639,14 +639,14 @@ void Renderer::SetBlendMode(bool forceUpdate)
// 3-5 - srcRGB function
// 6-8 - dstRGB function
u32 newval = sumem.blendmode.subtract << 2;
u32 newval = bpmem.blendmode.subtract << 2;
if (sumem.blendmode.subtract) {
if (bpmem.blendmode.subtract) {
newval |= 0x0049; // enable blending src 1 dst 1
} else if (sumem.blendmode.blendenable) {
} else if (bpmem.blendmode.blendenable) {
newval |= 1; // enable blending
newval |= sumem.blendmode.srcfactor << 3;
newval |= sumem.blendmode.dstfactor << 6;
newval |= bpmem.blendmode.srcfactor << 3;
newval |= bpmem.blendmode.dstfactor << 6;
}
u32 changes = forceUpdate ? 0xFFFFFFFF : newval ^ s_blendMode;
@ -735,30 +735,30 @@ GLuint Renderer::ResolveAndGetDepthTarget(const TRectangle &source_rect)
// Call browser: OpcodeDecoding.cpp ExecuteDisplayList > Decode() > LoadBPReg()
// case 0x52 > SetScissorRect()
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// sumem.scissorTL.x, y = 342x342
// sumem.scissorBR.x, y = 981x821
// bpmem.scissorTL.x, y = 342x342
// bpmem.scissorBR.x, y = 981x821
// Renderer::GetTargetHeight() = the fixed ini file setting
// donkopunchstania - it appears scissorBR is the bottom right pixel inside the scissor box
// therefore the width and height are (scissorBR + 1) - scissorTL
bool 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;
float MValueX = GetTargetScaleX();
float MValueY = GetTargetScaleY();
float rc_left = (float)sumem.scissorTL.x - xoff - 342; // left = 0
float rc_left = (float)bpmem.scissorTL.x - xoff - 342; // left = 0
rc_left *= MValueX;
if (rc_left < 0) rc_left = 0;
float rc_top = (float)sumem.scissorTL.y - yoff - 342; // right = 0
float rc_top = (float)bpmem.scissorTL.y - yoff - 342; // right = 0
rc_top *= MValueY;
if (rc_top < 0) rc_top = 0;
float rc_right = (float)sumem.scissorBR.x - xoff - 341; // right = 640
float rc_right = (float)bpmem.scissorBR.x - xoff - 341; // right = 640
rc_right *= MValueX;
if (rc_right > EFB_WIDTH * MValueX) rc_right = EFB_WIDTH * MValueX;
float rc_bottom = (float)sumem.scissorBR.y - yoff - 341; // bottom = 480
float rc_bottom = (float)bpmem.scissorBR.y - yoff - 341; // bottom = 480
rc_bottom *= MValueY;
if (rc_bottom > EFB_HEIGHT * MValueY) rc_bottom = EFB_HEIGHT * MValueY;
@ -1384,7 +1384,7 @@ void Renderer::SetScreenshot(const char *filename)
bool Renderer::SaveRenderTarget(const char *filename, int W, int H, int YOffset)
{
// The height seemed to often be one less than the setting (but sometimes not),
// perhaps the source is the (sumem.copyTexSrcWH.y + 1) in SUStructs.cpp that I'm guessing
// perhaps the source is the (bpmem.copyTexSrcWH.y + 1) in BPStructs.cpp that I'm guessing
// is there because of how some GL function works. But the buffer we are reading from here
// seems to have the necessary pixels for a complete height so we use the complete height
// from the settings.
@ -1495,8 +1495,8 @@ void UpdateViewport()
(rawViewport[5] - rawViewport[2]) / 16777215.0f, rawViewport[5] / 16777215.0f);*/
// --------
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 MValueX = Renderer::GetTargetScaleX();

View File

@ -10,7 +10,7 @@ import platform
name = "Plugin_VideoOGL"
files = [
'SUFunctions.cpp',
'BPFunctions.cpp',
'Config.cpp',
'rasterfont.cpp',
'Render.cpp',

View File

@ -20,7 +20,7 @@
#include "TextureDecoder.h"
#include "PixelShaderManager.h"
#include "PixelShaderGen.h"
#include "SUMemory.h"
#include "BPMemory.h"
#include <stdio.h>
#include <math.h>

View File

@ -42,7 +42,7 @@
#include "Render.h"
#include "MemoryUtil.h"
#include "SUStructs.h"
#include "BPStructs.h"
#include "TextureDecoder.h"
#include "TextureMngr.h"
#include "PixelShaderCache.h"
@ -256,7 +256,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
if (address == 0)
return NULL;
TexMode0 &tm0 = sumem.tex[texstage > 3].texMode0[texstage & 3];
TexMode0 &tm0 = bpmem.tex[texstage > 3].texMode0[texstage & 3];
u8 *ptr = g_VideoInitialize.pGetMemoryPointer(address);
int bsw = TexDecoder_GetBlockWidthInTexels(tex_format) - 1;
int bsh = TexDecoder_GetBlockHeightInTexels(tex_format) - 1;

View File

@ -22,7 +22,7 @@
#include "VideoCommon.h"
#include "GLUtil.h"
#include "SUStructs.h"
#include "BPStructs.h"
class TextureMngr
{

View File

@ -26,7 +26,7 @@
#include "Profiler.h"
#include "Render.h"
#include "ImageWrite.h"
#include "SUMemory.h"
#include "BPMemory.h"
#include "TextureMngr.h"
#include "PixelShaderCache.h"
#include "PixelShaderManager.h"
@ -155,8 +155,8 @@ void Flush()
#if defined(_DEBUG) || defined(DEBUGFAST)
PRIM_LOG("frame%d:\n texgen=%d, numchan=%d, dualtex=%d, ztex=%d, cole=%d, alpe=%d, ze=%d", g_Config.iSaveTargetId, xfregs.numTexGens,
xfregs.nNumChans, (int)xfregs.bEnableDualTexTransform, sumem.ztex2.op,
sumem.blendmode.colorupdate, sumem.blendmode.alphaupdate, sumem.zmode.updateenable);
xfregs.nNumChans, (int)xfregs.bEnableDualTexTransform, bpmem.ztex2.op,
bpmem.blendmode.colorupdate, bpmem.blendmode.alphaupdate, bpmem.zmode.updateenable);
for (int i = 0; i < xfregs.nNumChans; ++i)
{
@ -177,8 +177,8 @@ void Flush()
xfregs.texcoords[i].postmtxinfo.index, xfregs.texcoords[i].postmtxinfo.normalize);
}
PRIM_LOG("pixel: tev=%d, ind=%d, texgen=%d, dstalpha=%d, alphafunc=0x%x", sumem.genMode.numtevstages+1, sumem.genMode.numindstages,
sumem.genMode.numtexgens, (u32)sumem.dstalpha.enable, (sumem.alphaFunc.hex>>16)&0xff);
PRIM_LOG("pixel: tev=%d, ind=%d, texgen=%d, dstalpha=%d, alphafunc=0x%x", bpmem.genMode.numtevstages+1, bpmem.genMode.numindstages,
bpmem.genMode.numtexgens, (u32)bpmem.dstalpha.enable, (bpmem.alphaFunc.hex>>16)&0xff);
#endif
DVSTARTPROFILE();
@ -198,14 +198,14 @@ void Flush()
DVSTARTSUBPROFILE("VertexManager::Flush:textures");
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);
u32 nonpow2tex = 0;
for (int i = 0; i < 8; i++)
@ -214,7 +214,7 @@ void Flush()
{
glActiveTexture(GL_TEXTURE0 + i);
FourTexUnits &tex = sumem.tex[i >> 2];
FourTexUnits &tex = bpmem.tex[i >> 2];
TextureMngr::TCacheEntry* tentry = TextureMngr::Load(i, (tex.texImage3[i&3].image_base/* & 0x1FFFFF*/) << 5,
tex.texImage0[i&3].width + 1, tex.texImage0[i&3].height + 1,
tex.texImage0[i&3].format, tex.texTlut[i&3].tmem_offset<<9, tex.texTlut[i&3].tlut_format);
@ -284,7 +284,7 @@ void Flush()
}
// run through vertex groups again to set alpha
if (!g_Config.bDstAlphaPass && sumem.dstalpha.enable && sumem.blendmode.alphaupdate)
if (!g_Config.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate)
{
ps = PixelShaderCache::GetShader(true);
@ -309,7 +309,7 @@ void Flush()
// restore color mask
Renderer::SetColorMask();
if (sumem.blendmode.blendenable || sumem.blendmode.subtract)
if (bpmem.blendmode.blendenable || bpmem.blendmode.subtract)
glEnable(GL_BLEND);
}

View File

@ -21,7 +21,7 @@
#include <map>
#include <string>
#include "SUMemory.h"
#include "BPMemory.h"
#include "VertexShaderGen.h"
struct VERTEXSHADER

View File

@ -71,7 +71,7 @@ Make AA apply instantly during gameplay if possible
#include "Fifo.h"
#include "OpcodeDecoding.h"
#include "TextureMngr.h"
#include "SUStructs.h"
#include "BPStructs.h"
#include "VertexLoader.h"
#include "VertexLoaderManager.h"
#include "VertexManager.h"
@ -330,7 +330,7 @@ void DoState(unsigned char **ptr, int mode) {
// Refresh state.
if (mode == PointerWrap::MODE_READ)
{
SUReload();
BPReload();
RecomputeCachedArraybases();
}
}
@ -347,7 +347,7 @@ void Video_Prepare(void)
TextureMngr::Init();
SUInit();
BPInit();
VertexManager::Init();
Fifo_Init(); // must be done before OpcodeDecoder_Init()
OpcodeDecoder_Init();

View File

@ -141,7 +141,7 @@ RasterFont::~RasterFont()
void RasterFont::printString(const char *s, double x, double y, double z)
{
int length = (int)strlen(s);
int length = strlen(s);
if (!length)
return;