mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 06:39:46 -06:00
space changes, merge #defines, language fix, and code reorder/cleanup :P
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5614 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -17,6 +17,7 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "VideoConfig.h"
|
||||
#include "Profiler.h"
|
||||
#include "Statistics.h"
|
||||
#include "Render.h"
|
||||
@ -35,8 +36,8 @@ using namespace BPFunctions;
|
||||
|
||||
void BPInit()
|
||||
{
|
||||
memset(&bpmem, 0, sizeof(bpmem));
|
||||
bpmem.bpMask = 0xFFFFFF;
|
||||
memset(&bpmem, 0, sizeof(bpmem));
|
||||
bpmem.bpMask = 0xFFFFFF;
|
||||
}
|
||||
|
||||
void RenderToXFB(const BPCmd &bp, const EFBRectangle &rc, float yScale, float xfbLines, u32 xfbAddr, const u32 dstWidth, const u32 dstHeight)
|
||||
@ -46,22 +47,22 @@ void RenderToXFB(const BPCmd &bp, const EFBRectangle &rc, float yScale, float xf
|
||||
|
||||
void BPWritten(const BPCmd& bp)
|
||||
{
|
||||
/*
|
||||
----------------------------------------------------------------------------------------------------------------
|
||||
Purpose: Writes to the BP registers
|
||||
Called: At the end of every: OpcodeDecoding.cpp ExecuteDisplayList > Decode() > LoadBPReg
|
||||
How It Works: First the pipeline is flushed then update the bpmem with the new value.
|
||||
Some of the BP cases have to call certain functions while others just update the bpmem.
|
||||
some bp cases check the changes variable, because they might not have to be updated all the time
|
||||
NOTE: it seems not all bp cases like checking changes, so calling if (bp.changes == 0 ? false : true)
|
||||
had to be ditched and the games seem to work fine with out it.
|
||||
NOTE2: Yet Another Gamecube Documentation calls them Bypass Raster State Registers but possibly completely wrong
|
||||
NOTE3: This controls the register groups: RAS1/2, SU, TF, TEV, C/Z, PEC
|
||||
TODO: Turn into function table. The (future) DisplayList (DL) jit can then call the functions directly,
|
||||
getting rid of dynamic dispatch. Unfortunately, few games use DLs properly - most\
|
||||
just stuff geometry in them and don't put state changes there.
|
||||
----------------------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
----------------------------------------------------------------------------------------------------------------
|
||||
Purpose: Writes to the BP registers
|
||||
Called: At the end of every: OpcodeDecoding.cpp ExecuteDisplayList > Decode() > LoadBPReg
|
||||
How It Works: First the pipeline is flushed then update the bpmem with the new value.
|
||||
Some of the BP cases have to call certain functions while others just update the bpmem.
|
||||
some bp cases check the changes variable, because they might not have to be updated all the time
|
||||
NOTE: it seems not all bp cases like checking changes, so calling if (bp.changes == 0 ? false : true)
|
||||
had to be ditched and the games seem to work fine with out it.
|
||||
NOTE2: Yet Another Gamecube Documentation calls them Bypass Raster State Registers but possibly completely wrong
|
||||
NOTE3: This controls the register groups: RAS1/2, SU, TF, TEV, C/Z, PEC
|
||||
TODO: Turn into function table. The (future) DisplayList (DL) jit can then call the functions directly,
|
||||
getting rid of dynamic dispatch. Unfortunately, few games use DLs properly - most\
|
||||
just stuff geometry in them and don't put state changes there
|
||||
----------------------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
// Debugging only, this lets you skip a bp update
|
||||
//static int times = 0;
|
||||
@ -83,13 +84,13 @@ void BPWritten(const BPCmd& bp)
|
||||
//s_bpCritical.Enter();
|
||||
|
||||
FlushPipeline();
|
||||
((u32*)&bpmem)[bp.address] = bp.newvalue;
|
||||
((u32*)&bpmem)[bp.address] = bp.newvalue;
|
||||
|
||||
switch (bp.address)
|
||||
{
|
||||
case BPMEM_GENMODE: // Set the Generation Mode
|
||||
{
|
||||
PRIM_LOG("genmode: texgen=%d, col=%d, ms_en=%d, tev=%d, culmode=%d, ind=%d, zfeeze=%d",
|
||||
PRIM_LOG("genmode: texgen=%d, col=%d, ms_en=%d, tev=%d, cullmode=%d, ind=%d, zfeeze=%d",
|
||||
bpmem.genMode.numtexgens, bpmem.genMode.numcolchans,
|
||||
bpmem.genMode.ms_en, bpmem.genMode.numtevstages+1, bpmem.genMode.cullmode,
|
||||
bpmem.genMode.numindstages, bpmem.genMode.zfreeze);
|
||||
@ -108,9 +109,9 @@ void BPWritten(const BPCmd& bp)
|
||||
PixelShaderManager::SetIndMatrixChanged((bp.address - BPMEM_IND_MTXA) / 3);
|
||||
break;
|
||||
case BPMEM_RAS1_SS0: // Index Texture Coordinate Scale 0
|
||||
PixelShaderManager::SetIndTexScaleChanged(0x03);
|
||||
PixelShaderManager::SetIndTexScaleChanged(0x03);
|
||||
case BPMEM_RAS1_SS1: // Index Texture Coordinate Scale 1
|
||||
PixelShaderManager::SetIndTexScaleChanged(0x0c);
|
||||
PixelShaderManager::SetIndTexScaleChanged(0x0c);
|
||||
break;
|
||||
// ----------------
|
||||
// Scissor Control
|
||||
@ -159,31 +160,31 @@ void BPWritten(const BPCmd& bp)
|
||||
// This is called when the game is done drawing the new frame (eg: like in DX: Begin(); Draw(); End();)
|
||||
// Triggers an interrupt on the PPC side so that the game knows when the GPU has finished drawing.
|
||||
// Tokens are similar.
|
||||
case BPMEM_SETDRAWDONE:
|
||||
case BPMEM_SETDRAWDONE:
|
||||
switch (bp.newvalue & 0xFF)
|
||||
{
|
||||
case 0x02:
|
||||
PixelEngine::SetFinish(); // may generate interrupt
|
||||
DEBUG_LOG(VIDEO, "GXSetDrawDone SetPEFinish (value: 0x%02X)", (bp.newvalue & 0xFFFF));
|
||||
break;
|
||||
{
|
||||
case 0x02:
|
||||
PixelEngine::SetFinish(); // may generate interrupt
|
||||
DEBUG_LOG(VIDEO, "GXSetDrawDone SetPEFinish (value: 0x%02X)", (bp.newvalue & 0xFFFF));
|
||||
break;
|
||||
|
||||
default:
|
||||
WARN_LOG(VIDEO, "GXSetDrawDone ??? (value 0x%02X)", (bp.newvalue & 0xFFFF));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
WARN_LOG(VIDEO, "GXSetDrawDone ??? (value 0x%02X)", (bp.newvalue & 0xFFFF));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case BPMEM_PE_TOKEN_ID: // Pixel Engine Token ID
|
||||
PixelEngine::SetToken(static_cast<u16>(bp.newvalue & 0xFFFF), FALSE);
|
||||
DEBUG_LOG(VIDEO, "SetPEToken 0x%04x", (bp.newvalue & 0xFFFF));
|
||||
break;
|
||||
case BPMEM_PE_TOKEN_INT_ID: // Pixel Engine Interrupt Token ID
|
||||
PixelEngine::SetToken(static_cast<u16>(bp.newvalue & 0xFFFF), TRUE);
|
||||
DEBUG_LOG(VIDEO, "SetPEToken + INT 0x%04x", (bp.newvalue & 0xFFFF));
|
||||
break;
|
||||
PixelEngine::SetToken(static_cast<u16>(bp.newvalue & 0xFFFF), FALSE);
|
||||
DEBUG_LOG(VIDEO, "SetPEToken 0x%04x", (bp.newvalue & 0xFFFF));
|
||||
break;
|
||||
case BPMEM_PE_TOKEN_INT_ID: // Pixel Engine Interrupt Token ID
|
||||
PixelEngine::SetToken(static_cast<u16>(bp.newvalue & 0xFFFF), TRUE);
|
||||
DEBUG_LOG(VIDEO, "SetPEToken + INT 0x%04x", (bp.newvalue & 0xFFFF));
|
||||
break;
|
||||
// ------------------------
|
||||
// EFB copy command. This copies a rectangle from the EFB to either RAM in a texture format or to XFB as YUYV.
|
||||
// It can also optionally clear the EFB while copying from it. To emulate this, we of course copy first and clear afterwards.
|
||||
case BPMEM_TRIGGER_EFB_COPY: // Copy EFB Region or Render to the XFB or Clear the screen.
|
||||
case BPMEM_TRIGGER_EFB_COPY: // Copy EFB Region or Render to the XFB or Clear the screen.
|
||||
{
|
||||
DVSTARTSUBPROFILE("LoadBPReg:swap");
|
||||
// The bottom right is within the rectangle
|
||||
@ -200,7 +201,7 @@ void BPWritten(const BPCmd& bp)
|
||||
// Check if we are to copy from the EFB or draw to the XFB
|
||||
if (PE_copy.copy_to_xfb == 0)
|
||||
{
|
||||
if (GetConfig(CONFIG_SHOWEFBREGIONS))
|
||||
if (GetConfig(CONFIG_SHOWEFBREGIONS))
|
||||
stats.efb_regions.push_back(rc);
|
||||
|
||||
CopyEFB(bp, rc, bpmem.copyTexDest << 5,
|
||||
@ -244,21 +245,21 @@ void BPWritten(const BPCmd& bp)
|
||||
}
|
||||
|
||||
RestoreRenderState(bp);
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
case BPMEM_LOADTLUT0: // This one updates bpmem.tlutXferSrc, no need to do anything here.
|
||||
break;
|
||||
case BPMEM_LOADTLUT1: // Load a Texture Look Up Table
|
||||
{
|
||||
DVSTARTSUBPROFILE("LoadBPReg:GXLoadTlut");
|
||||
{
|
||||
DVSTARTSUBPROFILE("LoadBPReg:GXLoadTlut");
|
||||
|
||||
u32 tlutTMemAddr = (bp.newvalue & 0x3FF) << 9;
|
||||
u32 tlutXferCount = (bp.newvalue & 0x1FFC00) >> 5;
|
||||
u32 tlutTMemAddr = (bp.newvalue & 0x3FF) << 9;
|
||||
u32 tlutXferCount = (bp.newvalue & 0x1FFC00) >> 5;
|
||||
|
||||
u8 *ptr = 0;
|
||||
|
||||
// TODO - figure out a cleaner way.
|
||||
// TODO - figure out a cleaner way.
|
||||
if (GetConfig(CONFIG_ISWII))
|
||||
ptr = GetPointer(bpmem.tlutXferSrc << 5);
|
||||
else
|
||||
@ -269,10 +270,10 @@ void BPWritten(const BPCmd& bp)
|
||||
else
|
||||
PanicAlert("Invalid palette pointer %08x %08x %08x", bpmem.tlutXferSrc, bpmem.tlutXferSrc << 5, (bpmem.tlutXferSrc & 0xFFFFF)<< 5);
|
||||
|
||||
// TODO(ector) : kill all textures that use this palette
|
||||
// Not sure if it's a good idea, though. For now, we hash texture palettes
|
||||
// TODO(ector) : kill all textures that use this palette
|
||||
// Not sure if it's a good idea, though. For now, we hash texture palettes
|
||||
break;
|
||||
}
|
||||
}
|
||||
case BPMEM_FOGRANGE: // Fog Settings Control
|
||||
case BPMEM_FOGRANGE+1:
|
||||
case BPMEM_FOGRANGE+2:
|
||||
@ -293,15 +294,15 @@ void BPWritten(const BPCmd& bp)
|
||||
case BPMEM_ALPHACOMPARE: // Compare Alpha Values
|
||||
PRIM_LOG("alphacmp: ref0=%d, ref1=%d, comp0=%d, comp1=%d, logic=%d", bpmem.alphaFunc.ref0,
|
||||
bpmem.alphaFunc.ref1, bpmem.alphaFunc.comp0, bpmem.alphaFunc.comp1, bpmem.alphaFunc.logic);
|
||||
PixelShaderManager::SetAlpha(bpmem.alphaFunc);
|
||||
PixelShaderManager::SetAlpha(bpmem.alphaFunc);
|
||||
break;
|
||||
case BPMEM_BIAS: // BIAS
|
||||
PRIM_LOG("ztex bias=0x%x", bpmem.ztex1.bias);
|
||||
PixelShaderManager::SetZTextureBias(bpmem.ztex1.bias);
|
||||
PixelShaderManager::SetZTextureBias(bpmem.ztex1.bias);
|
||||
break;
|
||||
case BPMEM_ZTEX2: // Z Texture type
|
||||
{
|
||||
if (bp.changes & 3)
|
||||
if (bp.changes & 3)
|
||||
PixelShaderManager::SetZTextureTypeChanged();
|
||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||
const char* pzop[] = {"DISABLE", "ADD", "REPLACE", "?"};
|
||||
@ -381,8 +382,8 @@ void BPWritten(const BPCmd& bp)
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case BPMEM_TEXINVALIDATE: // Used, if game has manual control the Texture Cache, which we don't allow
|
||||
}
|
||||
case BPMEM_TEXINVALIDATE: // Used, if game has manual control the Texture Cache, which we don't allow
|
||||
DEBUG_LOG(VIDEO, "BP Texture Invalid: %08x", bp.newvalue);
|
||||
case BPMEM_ZCOMPARE: // Set the Z-Compare and EFB pixel format
|
||||
case BPMEM_MIPMAP_STRIDE: // MipMap Stride Channel
|
||||
@ -395,7 +396,7 @@ void BPWritten(const BPCmd& bp)
|
||||
9 BC1 - Ind. Tex Stage 1 NTexCoord
|
||||
6 BI1 - Ind. Tex Stage 1 NTexMap
|
||||
3 BC0 - Ind. Tex Stage 0 NTexCoord
|
||||
0 BI0 - Ind. Tex Stage 0 NTexMap */
|
||||
0 BI0 - Ind. Tex Stage 0 NTexMap*/
|
||||
case BPMEM_TEV_KSEL: // Texture Environment Swap Mode Table 0
|
||||
case BPMEM_TEV_KSEL+1:// Texture Environment Swap Mode Table 1
|
||||
case BPMEM_TEV_KSEL+2:// Texture Environment Swap Mode Table 2
|
||||
@ -405,7 +406,7 @@ void BPWritten(const BPCmd& bp)
|
||||
case BPMEM_TEV_KSEL+6:// Texture Environment Swap Mode Table 6
|
||||
case BPMEM_TEV_KSEL+7:// Texture Environment Swap Mode Table 7
|
||||
case BPMEM_BP_MASK: // This Register can be used to limit to which bits of BP registers is actually written to. the mask is
|
||||
// only valid for the next BP command, and will reset itself.
|
||||
// only valid for the next BP command, and will reset itself.
|
||||
case BPMEM_IND_IMASK: // Index Mask ?
|
||||
case BPMEM_REVBITS: // Always set to 0x0F when GX_InitRevBits() is called.
|
||||
break;
|
||||
@ -439,7 +440,7 @@ void BPWritten(const BPCmd& bp)
|
||||
break;
|
||||
// ----------------------
|
||||
// Set wrap size
|
||||
// ----------------------
|
||||
// ----------------------
|
||||
case BPMEM_SU_SSIZE:
|
||||
case BPMEM_SU_TSIZE:
|
||||
case BPMEM_SU_SSIZE+2:
|
||||
@ -456,12 +457,12 @@ void BPWritten(const BPCmd& bp)
|
||||
case BPMEM_SU_TSIZE+12:
|
||||
case BPMEM_SU_SSIZE+14:
|
||||
case BPMEM_SU_TSIZE+14:
|
||||
PixelShaderManager::SetTexCoordChanged((bp.address - BPMEM_SU_SSIZE) >> 1);
|
||||
PixelShaderManager::SetTexCoordChanged((bp.address - BPMEM_SU_SSIZE) >> 1);
|
||||
break;
|
||||
// ------------------------
|
||||
// BPMEM_TX_SETMODE0 - (Texture lookup and filtering mode) LOD/BIAS Clamp, MaxAnsio, LODBIAS, DiagLoad, Min Filter, Mag Filter, Wrap T, S
|
||||
// BPMEM_TX_SETMODE1 - (LOD Stuff) - Max LOD, Min LOD
|
||||
// ------------------------
|
||||
// ------------------------
|
||||
case BPMEM_TX_SETMODE0: // (0x90 for linear)
|
||||
case BPMEM_TX_SETMODE0_4:
|
||||
// Shouldn't need to call this here, we call it for each active texture right before rendering
|
||||
@ -476,7 +477,7 @@ void BPWritten(const BPCmd& bp)
|
||||
// BPMEM_TX_SETIMAGE1 - even LOD address in TMEM - Image Type, Cache Height, Cache Width, TMEM Offset
|
||||
// BPMEM_TX_SETIMAGE2 - odd LOD address in TMEM - Cache Height, Cache Width, TMEM Offset
|
||||
// BPMEM_TX_SETIMAGE3 - Address of Texture in main memory
|
||||
// --------------------------------------------
|
||||
// --------------------------------------------
|
||||
case BPMEM_TX_SETIMAGE0:
|
||||
case BPMEM_TX_SETIMAGE0_4:
|
||||
case BPMEM_TX_SETIMAGE1:
|
||||
@ -489,14 +490,14 @@ void BPWritten(const BPCmd& bp)
|
||||
// -------------------------------
|
||||
// Set a TLUT
|
||||
// BPMEM_TX_SETTLUT - Format, TMEM Offset (offset of TLUT from start of TMEM high bank > > 5)
|
||||
// -------------------------------
|
||||
// -------------------------------
|
||||
case BPMEM_TX_SETTLUT:
|
||||
case BPMEM_TX_SETLUT_4:
|
||||
break;
|
||||
|
||||
// ---------------------------------------------------
|
||||
// Set the TEV Color
|
||||
// ---------------------------------------------------
|
||||
// ---------------------------------------------------
|
||||
case BPMEM_TEV_REGISTER_L: // Reg 1
|
||||
case BPMEM_TEV_REGISTER_H:
|
||||
case BPMEM_TEV_REGISTER_L+2: // Reg 2
|
||||
|
@ -138,8 +138,8 @@ void VertexShaderManager::Init()
|
||||
Dirty();
|
||||
|
||||
memset(&xfregs, 0, sizeof(xfregs));
|
||||
memset(xfmem, 0, sizeof(xfmem));
|
||||
ResetView();
|
||||
memset(xfmem, 0, sizeof(xfmem));
|
||||
ResetView();
|
||||
}
|
||||
|
||||
void VertexShaderManager::Shutdown()
|
||||
@ -163,154 +163,154 @@ void VertexShaderManager::Dirty()
|
||||
// TODO: A cleaner way to control the matricies without making a mess in the parameters field
|
||||
void VertexShaderManager::SetConstants()
|
||||
{
|
||||
if (nTransformMatricesChanged[0] >= 0)
|
||||
if (nTransformMatricesChanged[0] >= 0)
|
||||
{
|
||||
int startn = nTransformMatricesChanged[0] / 4;
|
||||
int endn = (nTransformMatricesChanged[1] + 3) / 4;
|
||||
const float* pstart = (const float*)&xfmem[startn * 4];
|
||||
int startn = nTransformMatricesChanged[0] / 4;
|
||||
int endn = (nTransformMatricesChanged[1] + 3) / 4;
|
||||
const float* pstart = (const float*)&xfmem[startn * 4];
|
||||
SetMultiVSConstant4fv(C_TRANSFORMMATRICES + startn, endn - startn, pstart);
|
||||
nTransformMatricesChanged[0] = nTransformMatricesChanged[1] = -1;
|
||||
}
|
||||
if (nNormalMatricesChanged[0] >= 0)
|
||||
nTransformMatricesChanged[0] = nTransformMatricesChanged[1] = -1;
|
||||
}
|
||||
if (nNormalMatricesChanged[0] >= 0)
|
||||
{
|
||||
int startn = nNormalMatricesChanged[0] / 3;
|
||||
int endn = (nNormalMatricesChanged[1] + 2) / 3;
|
||||
const float *pnstart = (const float*)&xfmem[XFMEM_NORMALMATRICES+3*startn];
|
||||
SetMultiVSConstant3fv(C_NORMALMATRICES + startn, endn - startn, pnstart);
|
||||
int startn = nNormalMatricesChanged[0] / 3;
|
||||
int endn = (nNormalMatricesChanged[1] + 2) / 3;
|
||||
const float *pnstart = (const float*)&xfmem[XFMEM_NORMALMATRICES+3*startn];
|
||||
SetMultiVSConstant3fv(C_NORMALMATRICES + startn, endn - startn, pnstart);
|
||||
nNormalMatricesChanged[0] = nNormalMatricesChanged[1] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (nPostTransformMatricesChanged[0] >= 0)
|
||||
if (nPostTransformMatricesChanged[0] >= 0)
|
||||
{
|
||||
int startn = nPostTransformMatricesChanged[0] / 4;
|
||||
int endn = (nPostTransformMatricesChanged[1] + 3 ) / 4;
|
||||
const float* pstart = (const float*)&xfmem[XFMEM_POSTMATRICES + startn * 4];
|
||||
SetMultiVSConstant4fv(C_POSTTRANSFORMMATRICES + startn, endn - startn, pstart);
|
||||
}
|
||||
int startn = nPostTransformMatricesChanged[0] / 4;
|
||||
int endn = (nPostTransformMatricesChanged[1] + 3 ) / 4;
|
||||
const float* pstart = (const float*)&xfmem[XFMEM_POSTMATRICES + startn * 4];
|
||||
SetMultiVSConstant4fv(C_POSTTRANSFORMMATRICES + startn, endn - startn, pstart);
|
||||
}
|
||||
|
||||
if (nLightsChanged[0] >= 0)
|
||||
if (nLightsChanged[0] >= 0)
|
||||
{
|
||||
// lights don't have a 1 to 1 mapping, the color component needs to be converted to 4 floats
|
||||
int istart = nLightsChanged[0] / 0x10;
|
||||
int iend = (nLightsChanged[1] + 15) / 0x10;
|
||||
const float* xfmemptr = (const float*)&xfmem[0x10 * istart + XFMEM_LIGHTS];
|
||||
// lights don't have a 1 to 1 mapping, the color component needs to be converted to 4 floats
|
||||
int istart = nLightsChanged[0] / 0x10;
|
||||
int iend = (nLightsChanged[1] + 15) / 0x10;
|
||||
const float* xfmemptr = (const float*)&xfmem[0x10 * istart + XFMEM_LIGHTS];
|
||||
|
||||
for (int i = istart; i < iend; ++i)
|
||||
for (int i = istart; i < iend; ++i)
|
||||
{
|
||||
u32 color = *(const u32*)(xfmemptr + 3);
|
||||
u32 color = *(const u32*)(xfmemptr + 3);
|
||||
float NormalizationCoef = 1 / 255.0f;
|
||||
SetVSConstant4f(C_LIGHTS + 5 * i,
|
||||
((color >> 24) & 0xFF) * NormalizationCoef,
|
||||
SetVSConstant4f(C_LIGHTS + 5 * i,
|
||||
((color >> 24) & 0xFF) * NormalizationCoef,
|
||||
((color >> 16) & 0xFF) * NormalizationCoef,
|
||||
((color >> 8) & 0xFF) * NormalizationCoef,
|
||||
((color) & 0xFF) * NormalizationCoef);
|
||||
xfmemptr += 4;
|
||||
xfmemptr += 4;
|
||||
|
||||
for (int j = 0; j < 4; ++j, xfmemptr += 3)
|
||||
for (int j = 0; j < 4; ++j, xfmemptr += 3)
|
||||
{
|
||||
if (j == 1 &&
|
||||
fabs(xfmemptr[0]) < 0.00001f &&
|
||||
fabs(xfmemptr[1]) < 0.00001f &&
|
||||
fabs(xfmemptr[2]) < 0.00001f)
|
||||
fabs(xfmemptr[2]) < 0.00001f)
|
||||
{
|
||||
// dist attenuation, make sure not equal to 0!!!
|
||||
SetVSConstant4f(C_LIGHTS+5*i+j+1, 0.00001f, xfmemptr[1], xfmemptr[2], 0);
|
||||
}
|
||||
else
|
||||
SetVSConstant4fv(C_LIGHTS+5*i+j+1, xfmemptr);
|
||||
}
|
||||
}
|
||||
// dist attenuation, make sure not equal to 0!!!
|
||||
SetVSConstant4f(C_LIGHTS+5*i+j+1, 0.00001f, xfmemptr[1], xfmemptr[2], 0);
|
||||
}
|
||||
else
|
||||
SetVSConstant4fv(C_LIGHTS+5*i+j+1, xfmemptr);
|
||||
}
|
||||
}
|
||||
|
||||
nLightsChanged[0] = nLightsChanged[1] = -1;
|
||||
}
|
||||
nLightsChanged[0] = nLightsChanged[1] = -1;
|
||||
}
|
||||
|
||||
if (nMaterialsChanged)
|
||||
if (nMaterialsChanged)
|
||||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
if (nMaterialsChanged & (1 << i))
|
||||
SetVSConstant4fv(C_MATERIALS + i, &s_fMaterials[4 * i]);
|
||||
for (int i = 0; i < 4; ++i)
|
||||
if (nMaterialsChanged & (1 << i))
|
||||
SetVSConstant4fv(C_MATERIALS + i, &s_fMaterials[4 * i]);
|
||||
|
||||
nMaterialsChanged = 0;
|
||||
}
|
||||
nMaterialsChanged = 0;
|
||||
}
|
||||
|
||||
if (bPosNormalMatrixChanged)
|
||||
if (bPosNormalMatrixChanged)
|
||||
{
|
||||
bPosNormalMatrixChanged = false;
|
||||
bPosNormalMatrixChanged = false;
|
||||
|
||||
const float *pos = (const float *)xfmem + MatrixIndexA.PosNormalMtxIdx * 4;
|
||||
const float *norm = (const float *)xfmem + XFMEM_NORMALMATRICES + 3 * (MatrixIndexA.PosNormalMtxIdx & 31);
|
||||
const float *pos = (const float *)xfmem + MatrixIndexA.PosNormalMtxIdx * 4;
|
||||
const float *norm = (const float *)xfmem + XFMEM_NORMALMATRICES + 3 * (MatrixIndexA.PosNormalMtxIdx & 31);
|
||||
|
||||
SetMultiVSConstant4fv(C_POSNORMALMATRIX, 3, pos);
|
||||
SetMultiVSConstant4fv(C_POSNORMALMATRIX, 3, pos);
|
||||
SetMultiVSConstant3fv(C_POSNORMALMATRIX + 3, 3, norm);
|
||||
}
|
||||
|
||||
if (bTexMatricesChanged[0])
|
||||
if (bTexMatricesChanged[0])
|
||||
{
|
||||
bTexMatricesChanged[0] = false;
|
||||
const float *fptrs[] =
|
||||
bTexMatricesChanged[0] = false;
|
||||
const float *fptrs[] =
|
||||
{
|
||||
(const float *)xfmem + MatrixIndexA.Tex0MtxIdx * 4, (const float *)xfmem + MatrixIndexA.Tex1MtxIdx * 4,
|
||||
(const float *)xfmem + MatrixIndexA.Tex2MtxIdx * 4, (const float *)xfmem + MatrixIndexA.Tex3MtxIdx * 4
|
||||
(const float *)xfmem + MatrixIndexA.Tex2MtxIdx * 4, (const float *)xfmem + MatrixIndexA.Tex3MtxIdx * 4
|
||||
};
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
SetMultiVSConstant4fv(C_TEXMATRICES + 3 * i, 3, fptrs[i]);
|
||||
}
|
||||
}
|
||||
SetMultiVSConstant4fv(C_TEXMATRICES + 3 * i, 3, fptrs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (bTexMatricesChanged[1])
|
||||
if (bTexMatricesChanged[1])
|
||||
{
|
||||
bTexMatricesChanged[1] = false;
|
||||
const float *fptrs[] = {
|
||||
bTexMatricesChanged[1] = false;
|
||||
const float *fptrs[] = {
|
||||
(const float *)xfmem + MatrixIndexB.Tex4MtxIdx * 4, (const float *)xfmem + MatrixIndexB.Tex5MtxIdx * 4,
|
||||
(const float *)xfmem + MatrixIndexB.Tex6MtxIdx * 4, (const float *)xfmem + MatrixIndexB.Tex7MtxIdx * 4
|
||||
(const float *)xfmem + MatrixIndexB.Tex6MtxIdx * 4, (const float *)xfmem + MatrixIndexB.Tex7MtxIdx * 4
|
||||
};
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
SetMultiVSConstant4fv(C_TEXMATRICES+3 * i + 12, 3, fptrs[i]);
|
||||
}
|
||||
}
|
||||
SetMultiVSConstant4fv(C_TEXMATRICES+3 * i + 12, 3, fptrs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (bViewportChanged)
|
||||
if (bViewportChanged)
|
||||
{
|
||||
bViewportChanged = false;
|
||||
bViewportChanged = false;
|
||||
|
||||
// This is so implementation-dependent that we can't have it here.
|
||||
UpdateViewport();
|
||||
}
|
||||
}
|
||||
|
||||
if (bProjectionChanged)
|
||||
if (bProjectionChanged)
|
||||
{
|
||||
bProjectionChanged = false;
|
||||
bProjectionChanged = false;
|
||||
|
||||
if (xfregs.rawProjection[6] == 0)
|
||||
{
|
||||
if (xfregs.rawProjection[6] == 0)
|
||||
{
|
||||
// Perspective
|
||||
|
||||
g_fProjectionMatrix[0] = xfregs.rawProjection[0] * g_ActiveConfig.fAspectRatioHackW;
|
||||
g_fProjectionMatrix[1] = 0.0f;
|
||||
g_fProjectionMatrix[2] = xfregs.rawProjection[1];
|
||||
g_fProjectionMatrix[3] = 0.0f;
|
||||
g_fProjectionMatrix[2] = xfregs.rawProjection[1];
|
||||
g_fProjectionMatrix[3] = 0.0f;
|
||||
|
||||
g_fProjectionMatrix[4] = 0.0f;
|
||||
g_fProjectionMatrix[5] = xfregs.rawProjection[2] * g_ActiveConfig.fAspectRatioHackH;
|
||||
g_fProjectionMatrix[6] = xfregs.rawProjection[3];
|
||||
g_fProjectionMatrix[7] = 0.0f;
|
||||
g_fProjectionMatrix[4] = 0.0f;
|
||||
g_fProjectionMatrix[5] = xfregs.rawProjection[2] * g_ActiveConfig.fAspectRatioHackH;
|
||||
g_fProjectionMatrix[6] = xfregs.rawProjection[3];
|
||||
g_fProjectionMatrix[7] = 0.0f;
|
||||
|
||||
g_fProjectionMatrix[8] = 0.0f;
|
||||
g_fProjectionMatrix[9] = 0.0f;
|
||||
g_fProjectionMatrix[10] = xfregs.rawProjection[4];
|
||||
g_fProjectionMatrix[8] = 0.0f;
|
||||
g_fProjectionMatrix[9] = 0.0f;
|
||||
g_fProjectionMatrix[10] = xfregs.rawProjection[4];
|
||||
|
||||
g_fProjectionMatrix[11] = xfregs.rawProjection[5];
|
||||
|
||||
g_fProjectionMatrix[12] = 0.0f;
|
||||
g_fProjectionMatrix[13] = 0.0f;
|
||||
g_fProjectionMatrix[12] = 0.0f;
|
||||
g_fProjectionMatrix[13] = 0.0f;
|
||||
// donkopunchstania: GC GPU rounds differently?
|
||||
// -(1 + epsilon) so objects are clipped as they are on the real HW
|
||||
g_fProjectionMatrix[14] = -1.00000011921f;
|
||||
g_fProjectionMatrix[15] = 0.0f;
|
||||
g_fProjectionMatrix[14] = -1.00000011921f;
|
||||
g_fProjectionMatrix[15] = 0.0f;
|
||||
|
||||
SETSTAT_FT(stats.gproj_0, g_fProjectionMatrix[0]);
|
||||
SETSTAT_FT(stats.gproj_1, g_fProjectionMatrix[1]);
|
||||
@ -328,29 +328,29 @@ void VertexShaderManager::SetConstants()
|
||||
SETSTAT_FT(stats.gproj_13, g_fProjectionMatrix[13]);
|
||||
SETSTAT_FT(stats.gproj_14, g_fProjectionMatrix[14]);
|
||||
SETSTAT_FT(stats.gproj_15, g_fProjectionMatrix[15]);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
// Orthographic Projection
|
||||
g_fProjectionMatrix[0] = xfregs.rawProjection[0];
|
||||
g_fProjectionMatrix[1] = 0.0f;
|
||||
g_fProjectionMatrix[2] = 0.0f;
|
||||
g_fProjectionMatrix[3] = xfregs.rawProjection[1];
|
||||
g_fProjectionMatrix[0] = xfregs.rawProjection[0];
|
||||
g_fProjectionMatrix[1] = 0.0f;
|
||||
g_fProjectionMatrix[2] = 0.0f;
|
||||
g_fProjectionMatrix[3] = xfregs.rawProjection[1];
|
||||
|
||||
g_fProjectionMatrix[4] = 0.0f;
|
||||
g_fProjectionMatrix[5] = xfregs.rawProjection[2];
|
||||
g_fProjectionMatrix[6] = 0.0f;
|
||||
g_fProjectionMatrix[7] = xfregs.rawProjection[3];
|
||||
g_fProjectionMatrix[4] = 0.0f;
|
||||
g_fProjectionMatrix[5] = xfregs.rawProjection[2];
|
||||
g_fProjectionMatrix[6] = 0.0f;
|
||||
g_fProjectionMatrix[7] = xfregs.rawProjection[3];
|
||||
|
||||
g_fProjectionMatrix[8] = 0.0f;
|
||||
g_fProjectionMatrix[9] = 0.0f;
|
||||
g_fProjectionMatrix[10] = (g_ProjHack1.enabled ? -(g_ProjHack1.value + xfregs.rawProjection[4]) : xfregs.rawProjection[4]);
|
||||
g_fProjectionMatrix[11] = (g_ProjHack2.enabled ? -(g_ProjHack2.value + xfregs.rawProjection[5]) : xfregs.rawProjection[5]) + (g_ProjHack0 ? 0.1f : 0.0f);
|
||||
|
||||
g_fProjectionMatrix[12] = 0.0f;
|
||||
g_fProjectionMatrix[13] = 0.0f;
|
||||
g_fProjectionMatrix[14] = 0.0f;
|
||||
g_fProjectionMatrix[15] = 1.0f;
|
||||
g_fProjectionMatrix[8] = 0.0f;
|
||||
g_fProjectionMatrix[9] = 0.0f;
|
||||
g_fProjectionMatrix[10] = (g_ProjHack1.enabled ? -(g_ProjHack1.value + xfregs.rawProjection[4]) : xfregs.rawProjection[4]);
|
||||
g_fProjectionMatrix[11] = (g_ProjHack2.enabled ? -(g_ProjHack2.value + xfregs.rawProjection[5]) : xfregs.rawProjection[5]) + (g_ProjHack0 ? 0.1f : 0.0f);
|
||||
|
||||
g_fProjectionMatrix[12] = 0.0f;
|
||||
g_fProjectionMatrix[13] = 0.0f;
|
||||
g_fProjectionMatrix[14] = 0.0f;
|
||||
g_fProjectionMatrix[15] = 1.0f;
|
||||
|
||||
SETSTAT_FT(stats.g2proj_0, g_fProjectionMatrix[0]);
|
||||
SETSTAT_FT(stats.g2proj_1, g_fProjectionMatrix[1]);
|
||||
@ -375,140 +375,140 @@ void VertexShaderManager::SetConstants()
|
||||
SETSTAT_FT(stats.proj_4, xfregs.rawProjection[4]);
|
||||
SETSTAT_FT(stats.proj_5, xfregs.rawProjection[5]);
|
||||
SETSTAT_FT(stats.proj_6, xfregs.rawProjection[6]);
|
||||
}
|
||||
}
|
||||
|
||||
PRIM_LOG("Projection: %f %f %f %f %f %f\n", xfregs.rawProjection[0], xfregs.rawProjection[1], xfregs.rawProjection[2], xfregs.rawProjection[3], xfregs.rawProjection[4], xfregs.rawProjection[5]);
|
||||
PRIM_LOG("Projection: %f %f %f %f %f %f\n", xfregs.rawProjection[0], xfregs.rawProjection[1], xfregs.rawProjection[2], xfregs.rawProjection[3], xfregs.rawProjection[4], xfregs.rawProjection[5]);
|
||||
|
||||
if (g_ActiveConfig.bFreeLook)
|
||||
if (g_ActiveConfig.bFreeLook)
|
||||
{
|
||||
Matrix44 mtxA;
|
||||
Matrix44 mtxB;
|
||||
Matrix44 viewMtx;
|
||||
Matrix44 mtxA;
|
||||
Matrix44 mtxB;
|
||||
Matrix44 viewMtx;
|
||||
|
||||
Matrix44::Translate(mtxA, s_fViewTranslationVector);
|
||||
Matrix44::LoadMatrix33(mtxB, s_viewRotationMatrix);
|
||||
Matrix44::Multiply(mtxB, mtxA, viewMtx); // view = rotation x translation
|
||||
Matrix44::Set(mtxB, g_fProjectionMatrix);
|
||||
Matrix44::Multiply(mtxB, viewMtx, mtxA); // mtxA = projection x view
|
||||
Matrix44::Translate(mtxA, s_fViewTranslationVector);
|
||||
Matrix44::LoadMatrix33(mtxB, s_viewRotationMatrix);
|
||||
Matrix44::Multiply(mtxB, mtxA, viewMtx); // view = rotation x translation
|
||||
Matrix44::Set(mtxB, g_fProjectionMatrix);
|
||||
Matrix44::Multiply(mtxB, viewMtx, mtxA); // mtxA = projection x view
|
||||
|
||||
SetMultiVSConstant4fv(C_PROJECTION, 4, &mtxA.data[0]);
|
||||
}
|
||||
else
|
||||
SetMultiVSConstant4fv(C_PROJECTION, 4, &mtxA.data[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetMultiVSConstant4fv(C_PROJECTION, 4, &g_fProjectionMatrix[0]);
|
||||
}
|
||||
}
|
||||
SetMultiVSConstant4fv(C_PROJECTION, 4, &g_fProjectionMatrix[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VertexShaderManager::InvalidateXFRange(int start, int end)
|
||||
{
|
||||
if (((u32)start >= (u32)MatrixIndexA.PosNormalMtxIdx * 4 &&
|
||||
if (((u32)start >= (u32)MatrixIndexA.PosNormalMtxIdx * 4 &&
|
||||
(u32)start < (u32)MatrixIndexA.PosNormalMtxIdx * 4 + 12) ||
|
||||
((u32)start >= XFMEM_NORMALMATRICES + ((u32)MatrixIndexA.PosNormalMtxIdx & 31) * 3 &&
|
||||
((u32)start >= XFMEM_NORMALMATRICES + ((u32)MatrixIndexA.PosNormalMtxIdx & 31) * 3 &&
|
||||
(u32)start < XFMEM_NORMALMATRICES + ((u32)MatrixIndexA.PosNormalMtxIdx & 31) * 3 + 9)) {
|
||||
bPosNormalMatrixChanged = true;
|
||||
}
|
||||
bPosNormalMatrixChanged = true;
|
||||
}
|
||||
|
||||
if (((u32)start >= (u32)MatrixIndexA.Tex0MtxIdx*4 && (u32)start < (u32)MatrixIndexA.Tex0MtxIdx*4+12) ||
|
||||
((u32)start >= (u32)MatrixIndexA.Tex1MtxIdx*4 && (u32)start < (u32)MatrixIndexA.Tex1MtxIdx*4+12) ||
|
||||
((u32)start >= (u32)MatrixIndexA.Tex2MtxIdx*4 && (u32)start < (u32)MatrixIndexA.Tex2MtxIdx*4+12) ||
|
||||
((u32)start >= (u32)MatrixIndexA.Tex3MtxIdx*4 && (u32)start < (u32)MatrixIndexA.Tex3MtxIdx*4+12)) {
|
||||
bTexMatricesChanged[0] = true;
|
||||
}
|
||||
if (((u32)start >= (u32)MatrixIndexA.Tex0MtxIdx*4 && (u32)start < (u32)MatrixIndexA.Tex0MtxIdx*4+12) ||
|
||||
((u32)start >= (u32)MatrixIndexA.Tex1MtxIdx*4 && (u32)start < (u32)MatrixIndexA.Tex1MtxIdx*4+12) ||
|
||||
((u32)start >= (u32)MatrixIndexA.Tex2MtxIdx*4 && (u32)start < (u32)MatrixIndexA.Tex2MtxIdx*4+12) ||
|
||||
((u32)start >= (u32)MatrixIndexA.Tex3MtxIdx*4 && (u32)start < (u32)MatrixIndexA.Tex3MtxIdx*4+12)) {
|
||||
bTexMatricesChanged[0] = true;
|
||||
}
|
||||
|
||||
if (((u32)start >= (u32)MatrixIndexB.Tex4MtxIdx*4 && (u32)start < (u32)MatrixIndexB.Tex4MtxIdx*4+12) ||
|
||||
((u32)start >= (u32)MatrixIndexB.Tex5MtxIdx*4 && (u32)start < (u32)MatrixIndexB.Tex5MtxIdx*4+12) ||
|
||||
((u32)start >= (u32)MatrixIndexB.Tex6MtxIdx*4 && (u32)start < (u32)MatrixIndexB.Tex6MtxIdx*4+12) ||
|
||||
((u32)start >= (u32)MatrixIndexB.Tex7MtxIdx*4 && (u32)start < (u32)MatrixIndexB.Tex7MtxIdx*4+12)) {
|
||||
bTexMatricesChanged[1] = true;
|
||||
}
|
||||
if (((u32)start >= (u32)MatrixIndexB.Tex4MtxIdx*4 && (u32)start < (u32)MatrixIndexB.Tex4MtxIdx*4+12) ||
|
||||
((u32)start >= (u32)MatrixIndexB.Tex5MtxIdx*4 && (u32)start < (u32)MatrixIndexB.Tex5MtxIdx*4+12) ||
|
||||
((u32)start >= (u32)MatrixIndexB.Tex6MtxIdx*4 && (u32)start < (u32)MatrixIndexB.Tex6MtxIdx*4+12) ||
|
||||
((u32)start >= (u32)MatrixIndexB.Tex7MtxIdx*4 && (u32)start < (u32)MatrixIndexB.Tex7MtxIdx*4+12)) {
|
||||
bTexMatricesChanged[1] = true;
|
||||
}
|
||||
|
||||
if (start < XFMEM_POSMATRICES_END)
|
||||
if (start < XFMEM_POSMATRICES_END)
|
||||
{
|
||||
if (nTransformMatricesChanged[0] == -1)
|
||||
if (nTransformMatricesChanged[0] == -1)
|
||||
{
|
||||
nTransformMatricesChanged[0] = start;
|
||||
nTransformMatricesChanged[1] = end>XFMEM_POSMATRICES_END?XFMEM_POSMATRICES_END:end;
|
||||
}
|
||||
else
|
||||
nTransformMatricesChanged[0] = start;
|
||||
nTransformMatricesChanged[1] = end>XFMEM_POSMATRICES_END?XFMEM_POSMATRICES_END:end;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nTransformMatricesChanged[0] > start) nTransformMatricesChanged[0] = start;
|
||||
if (nTransformMatricesChanged[1] < end) nTransformMatricesChanged[1] = end>XFMEM_POSMATRICES_END?XFMEM_POSMATRICES_END:end;
|
||||
}
|
||||
}
|
||||
if (nTransformMatricesChanged[0] > start) nTransformMatricesChanged[0] = start;
|
||||
if (nTransformMatricesChanged[1] < end) nTransformMatricesChanged[1] = end>XFMEM_POSMATRICES_END?XFMEM_POSMATRICES_END:end;
|
||||
}
|
||||
}
|
||||
|
||||
if (start < XFMEM_NORMALMATRICES_END && end > XFMEM_NORMALMATRICES)
|
||||
if (start < XFMEM_NORMALMATRICES_END && end > XFMEM_NORMALMATRICES)
|
||||
{
|
||||
int _start = start < XFMEM_NORMALMATRICES ? 0 : start-XFMEM_NORMALMATRICES;
|
||||
int _end = end < XFMEM_NORMALMATRICES_END ? end-XFMEM_NORMALMATRICES : XFMEM_NORMALMATRICES_END-XFMEM_NORMALMATRICES;
|
||||
int _start = start < XFMEM_NORMALMATRICES ? 0 : start-XFMEM_NORMALMATRICES;
|
||||
int _end = end < XFMEM_NORMALMATRICES_END ? end-XFMEM_NORMALMATRICES : XFMEM_NORMALMATRICES_END-XFMEM_NORMALMATRICES;
|
||||
|
||||
if (nNormalMatricesChanged[0] == -1)
|
||||
if (nNormalMatricesChanged[0] == -1)
|
||||
{
|
||||
nNormalMatricesChanged[0] = _start;
|
||||
nNormalMatricesChanged[1] = _end;
|
||||
}
|
||||
else
|
||||
nNormalMatricesChanged[0] = _start;
|
||||
nNormalMatricesChanged[1] = _end;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nNormalMatricesChanged[0] > _start) nNormalMatricesChanged[0] = _start;
|
||||
if (nNormalMatricesChanged[1] < _end) nNormalMatricesChanged[1] = _end;
|
||||
}
|
||||
}
|
||||
if (nNormalMatricesChanged[0] > _start) nNormalMatricesChanged[0] = _start;
|
||||
if (nNormalMatricesChanged[1] < _end) nNormalMatricesChanged[1] = _end;
|
||||
}
|
||||
}
|
||||
|
||||
if (start < XFMEM_POSTMATRICES_END && end > XFMEM_POSTMATRICES)
|
||||
if (start < XFMEM_POSTMATRICES_END && end > XFMEM_POSTMATRICES)
|
||||
{
|
||||
int _start = start < XFMEM_POSTMATRICES ? XFMEM_POSTMATRICES : start-XFMEM_POSTMATRICES;
|
||||
int _end = end < XFMEM_POSTMATRICES_END ? end-XFMEM_POSTMATRICES : XFMEM_POSTMATRICES_END-XFMEM_POSTMATRICES;
|
||||
int _start = start < XFMEM_POSTMATRICES ? XFMEM_POSTMATRICES : start-XFMEM_POSTMATRICES;
|
||||
int _end = end < XFMEM_POSTMATRICES_END ? end-XFMEM_POSTMATRICES : XFMEM_POSTMATRICES_END-XFMEM_POSTMATRICES;
|
||||
|
||||
if (nPostTransformMatricesChanged[0] == -1)
|
||||
if (nPostTransformMatricesChanged[0] == -1)
|
||||
{
|
||||
nPostTransformMatricesChanged[0] = _start;
|
||||
nPostTransformMatricesChanged[1] = _end;
|
||||
}
|
||||
else
|
||||
nPostTransformMatricesChanged[0] = _start;
|
||||
nPostTransformMatricesChanged[1] = _end;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nPostTransformMatricesChanged[0] > _start) nPostTransformMatricesChanged[0] = _start;
|
||||
if (nPostTransformMatricesChanged[1] < _end) nPostTransformMatricesChanged[1] = _end;
|
||||
}
|
||||
}
|
||||
if (nPostTransformMatricesChanged[0] > _start) nPostTransformMatricesChanged[0] = _start;
|
||||
if (nPostTransformMatricesChanged[1] < _end) nPostTransformMatricesChanged[1] = _end;
|
||||
}
|
||||
}
|
||||
|
||||
if (start < XFMEM_LIGHTS_END && end > XFMEM_LIGHTS)
|
||||
if (start < XFMEM_LIGHTS_END && end > XFMEM_LIGHTS)
|
||||
{
|
||||
int _start = start < XFMEM_LIGHTS ? XFMEM_LIGHTS : start-XFMEM_LIGHTS;
|
||||
int _end = end < XFMEM_LIGHTS_END ? end-XFMEM_LIGHTS : XFMEM_LIGHTS_END-XFMEM_LIGHTS;
|
||||
int _start = start < XFMEM_LIGHTS ? XFMEM_LIGHTS : start-XFMEM_LIGHTS;
|
||||
int _end = end < XFMEM_LIGHTS_END ? end-XFMEM_LIGHTS : XFMEM_LIGHTS_END-XFMEM_LIGHTS;
|
||||
|
||||
if (nLightsChanged[0] == -1 )
|
||||
if (nLightsChanged[0] == -1 )
|
||||
{
|
||||
nLightsChanged[0] = _start;
|
||||
nLightsChanged[1] = _end;
|
||||
}
|
||||
else
|
||||
nLightsChanged[0] = _start;
|
||||
nLightsChanged[1] = _end;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nLightsChanged[0] > _start) nLightsChanged[0] = _start;
|
||||
if (nLightsChanged[1] < _end) nLightsChanged[1] = _end;
|
||||
}
|
||||
}
|
||||
if (nLightsChanged[0] > _start) nLightsChanged[0] = _start;
|
||||
if (nLightsChanged[1] < _end) nLightsChanged[1] = _end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VertexShaderManager::SetTexMatrixChangedA(u32 Value)
|
||||
{
|
||||
if (MatrixIndexA.Hex != Value)
|
||||
if (MatrixIndexA.Hex != Value)
|
||||
{
|
||||
VertexManager::Flush();
|
||||
if (MatrixIndexA.PosNormalMtxIdx != (Value&0x3f))
|
||||
bPosNormalMatrixChanged = true;
|
||||
bTexMatricesChanged[0] = true;
|
||||
MatrixIndexA.Hex = Value;
|
||||
}
|
||||
VertexManager::Flush();
|
||||
if (MatrixIndexA.PosNormalMtxIdx != (Value&0x3f))
|
||||
bPosNormalMatrixChanged = true;
|
||||
bTexMatricesChanged[0] = true;
|
||||
MatrixIndexA.Hex = Value;
|
||||
}
|
||||
}
|
||||
|
||||
void VertexShaderManager::SetTexMatrixChangedB(u32 Value)
|
||||
{
|
||||
if (MatrixIndexB.Hex != Value)
|
||||
if (MatrixIndexB.Hex != Value)
|
||||
{
|
||||
VertexManager::Flush();
|
||||
bTexMatricesChanged[1] = true;
|
||||
MatrixIndexB.Hex = Value;
|
||||
}
|
||||
VertexManager::Flush();
|
||||
bTexMatricesChanged[1] = true;
|
||||
MatrixIndexB.Hex = Value;
|
||||
}
|
||||
}
|
||||
|
||||
void VertexShaderManager::SetViewport(float* _Viewport, int constantIndex)
|
||||
@ -521,20 +521,20 @@ void VertexShaderManager::SetViewport(float* _Viewport, int constantIndex)
|
||||
{
|
||||
xfregs.rawViewport[constantIndex] = _Viewport[0];
|
||||
}
|
||||
/*//Tino: i think this is nod needed so let this commented til confirmed
|
||||
/*//Tino: i think this is not needed so leave this commented till confirmed
|
||||
// Workaround for paper mario, yep this is bizarre.
|
||||
for (size_t i = 0; i < ARRAYSIZE(xfregs.rawViewport); ++i)
|
||||
for (size_t i = 0; i < ARRAYSIZE(xfregs.rawViewport); ++i)
|
||||
{
|
||||
if (*(u32*)(_Viewport + i) == 0x7f800000) // invalid fp number
|
||||
return;
|
||||
}
|
||||
memcpy(xfregs.rawViewport, _Viewport, sizeof(xfregs.rawViewport));*/
|
||||
bViewportChanged = true;
|
||||
if (*(u32*)(_Viewport + i) == 0x7f800000) // invalid fp number
|
||||
return;
|
||||
}
|
||||
memcpy(xfregs.rawViewport, _Viewport, sizeof(xfregs.rawViewport));*/
|
||||
bViewportChanged = true;
|
||||
}
|
||||
|
||||
void VertexShaderManager::SetViewportChanged()
|
||||
{
|
||||
bViewportChanged = true;
|
||||
bViewportChanged = true;
|
||||
}
|
||||
|
||||
void VertexShaderManager::SetProjection(float* _pProjection, int constantIndex)
|
||||
@ -547,7 +547,7 @@ void VertexShaderManager::SetProjection(float* _pProjection, int constantIndex)
|
||||
{
|
||||
xfregs.rawProjection[constantIndex] = _pProjection[0];
|
||||
}
|
||||
bProjectionChanged = true;
|
||||
bProjectionChanged = true;
|
||||
}
|
||||
|
||||
void VertexShaderManager::SetMaterialColor(int index, u32 data)
|
||||
@ -564,42 +564,42 @@ void VertexShaderManager::SetMaterialColor(int index, u32 data)
|
||||
|
||||
void VertexShaderManager::TranslateView(float x, float y)
|
||||
{
|
||||
float result[3];
|
||||
float vector[3] = { x,0,y };
|
||||
float result[3];
|
||||
float vector[3] = { x,0,y };
|
||||
|
||||
Matrix33::Multiply(s_viewInvRotationMatrix, vector, result);
|
||||
Matrix33::Multiply(s_viewInvRotationMatrix, vector, result);
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
s_fViewTranslationVector[i] += result[i];
|
||||
for (int i = 0; i < 3; i++)
|
||||
s_fViewTranslationVector[i] += result[i];
|
||||
|
||||
bProjectionChanged = true;
|
||||
bProjectionChanged = true;
|
||||
}
|
||||
|
||||
void VertexShaderManager::RotateView(float x, float y)
|
||||
{
|
||||
s_fViewRotation[0] += x;
|
||||
s_fViewRotation[1] += y;
|
||||
s_fViewRotation[0] += x;
|
||||
s_fViewRotation[1] += y;
|
||||
|
||||
Matrix33 mx;
|
||||
Matrix33 my;
|
||||
Matrix33::RotateX(mx, s_fViewRotation[1]);
|
||||
Matrix33::RotateY(my, s_fViewRotation[0]);
|
||||
Matrix33::Multiply(mx, my, s_viewRotationMatrix);
|
||||
Matrix33 mx;
|
||||
Matrix33 my;
|
||||
Matrix33::RotateX(mx, s_fViewRotation[1]);
|
||||
Matrix33::RotateY(my, s_fViewRotation[0]);
|
||||
Matrix33::Multiply(mx, my, s_viewRotationMatrix);
|
||||
|
||||
// reverse rotation
|
||||
Matrix33::RotateX(mx, -s_fViewRotation[1]);
|
||||
Matrix33::RotateY(my, -s_fViewRotation[0]);
|
||||
Matrix33::Multiply(my, mx, s_viewInvRotationMatrix);
|
||||
// reverse rotation
|
||||
Matrix33::RotateX(mx, -s_fViewRotation[1]);
|
||||
Matrix33::RotateY(my, -s_fViewRotation[0]);
|
||||
Matrix33::Multiply(my, mx, s_viewInvRotationMatrix);
|
||||
|
||||
bProjectionChanged = true;
|
||||
bProjectionChanged = true;
|
||||
}
|
||||
|
||||
void VertexShaderManager::ResetView()
|
||||
{
|
||||
memset(s_fViewTranslationVector, 0, sizeof(s_fViewTranslationVector));
|
||||
Matrix33::LoadIdentity(s_viewRotationMatrix);
|
||||
Matrix33::LoadIdentity(s_viewInvRotationMatrix);
|
||||
s_fViewRotation[0] = s_fViewRotation[1] = 0.0f;
|
||||
memset(s_fViewTranslationVector, 0, sizeof(s_fViewTranslationVector));
|
||||
Matrix33::LoadIdentity(s_viewRotationMatrix);
|
||||
Matrix33::LoadIdentity(s_viewInvRotationMatrix);
|
||||
s_fViewRotation[0] = s_fViewRotation[1] = 0.0f;
|
||||
|
||||
bProjectionChanged = true;
|
||||
bProjectionChanged = true;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
VideoConfig g_Config;
|
||||
VideoConfig g_ActiveConfig;
|
||||
|
||||
void UpdateActiveConfig()
|
||||
void UpdateActiveConfig()
|
||||
{
|
||||
g_ActiveConfig = g_Config;
|
||||
}
|
||||
@ -35,7 +35,7 @@ VideoConfig::VideoConfig()
|
||||
{
|
||||
bRunning = false;
|
||||
bAllowSignedBytes = !IsD3D();
|
||||
|
||||
|
||||
// Needed for the first frame, I think
|
||||
fAspectRatioHackW = 1;
|
||||
fAspectRatioHackH = 1;
|
||||
@ -43,63 +43,63 @@ VideoConfig::VideoConfig()
|
||||
|
||||
void VideoConfig::Load(const char *ini_file)
|
||||
{
|
||||
std::string temp;
|
||||
IniFile iniFile;
|
||||
iniFile.Load(ini_file);
|
||||
|
||||
iniFile.Get("Hardware", "VSync", &bVSync, 0); // Hardware
|
||||
iniFile.Get("Settings", "StretchToFit", &bNativeResolution, true);
|
||||
std::string temp;
|
||||
IniFile iniFile;
|
||||
iniFile.Load(ini_file);
|
||||
|
||||
iniFile.Get("Hardware", "VSync", &bVSync, 0); // Hardware
|
||||
iniFile.Get("Settings", "StretchToFit", &bNativeResolution, true);
|
||||
iniFile.Get("Settings", "2xResolution", &b2xResolution, false);
|
||||
iniFile.Get("Settings", "wideScreenHack", &bWidescreenHack, false);
|
||||
iniFile.Get("Settings", "AspectRatio", &iAspectRatio, (int)ASPECT_AUTO);
|
||||
iniFile.Get("Settings", "Crop", &bCrop, false);
|
||||
iniFile.Get("Settings", "UseXFB", &bUseXFB, 0);
|
||||
iniFile.Get("Settings", "UseXFB", &bUseXFB, 0);
|
||||
iniFile.Get("Settings", "UseRealXFB", &bUseRealXFB, 0);
|
||||
iniFile.Get("Settings", "AutoScale", &bAutoScale, true);
|
||||
iniFile.Get("Settings", "AutoScale", &bAutoScale, true);
|
||||
iniFile.Get("Settings", "UseNativeMips", &bUseNativeMips, true);
|
||||
|
||||
iniFile.Get("Settings", "SafeTextureCache", &bSafeTextureCache, false); // Settings
|
||||
|
||||
iniFile.Get("Settings", "SafeTextureCache", &bSafeTextureCache, false); // Settings
|
||||
//Safe texture cache params
|
||||
iniFile.Get("Settings", "SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples,512);
|
||||
|
||||
iniFile.Get("Settings", "ShowFPS", &bShowFPS, false); // Settings
|
||||
iniFile.Get("Settings", "OverlayStats", &bOverlayStats, false);
|
||||
|
||||
iniFile.Get("Settings", "ShowFPS", &bShowFPS, false); // Settings
|
||||
iniFile.Get("Settings", "OverlayStats", &bOverlayStats, false);
|
||||
iniFile.Get("Settings", "OverlayProjStats", &bOverlayProjStats, false);
|
||||
iniFile.Get("Settings", "ShowEFBCopyRegions", &bShowEFBCopyRegions, false);
|
||||
iniFile.Get("Settings", "DLOptimize", &iCompileDLsLevel, 0);
|
||||
iniFile.Get("Settings", "DumpTextures", &bDumpTextures, 0);
|
||||
iniFile.Get("Settings", "HiresTextures", &bHiresTextures, 0);
|
||||
iniFile.Get("Settings", "DLOptimize", &iCompileDLsLevel, 0);
|
||||
iniFile.Get("Settings", "DumpTextures", &bDumpTextures, 0);
|
||||
iniFile.Get("Settings", "HiresTextures", &bHiresTextures, 0);
|
||||
iniFile.Get("Settings", "DumpEFBTarget", &bDumpEFBTarget, 0);
|
||||
iniFile.Get("Settings", "DumpFrames", &bDumpFrames, 0);
|
||||
iniFile.Get("Settings", "FreeLook", &bFreeLook, 0);
|
||||
iniFile.Get("Settings", "ShowShaderErrors", &bShowShaderErrors, 0);
|
||||
iniFile.Get("Settings", "MSAA", &iMultisampleMode, 0);
|
||||
iniFile.Get("Settings", "DstAlphaPass", &bDstAlphaPass, false);
|
||||
|
||||
iniFile.Get("Settings", "TexFmtOverlayEnable", &bTexFmtOverlayEnable, 0);
|
||||
iniFile.Get("Settings", "TexFmtOverlayCenter", &bTexFmtOverlayCenter, 0);
|
||||
iniFile.Get("Settings", "WireFrame", &bWireFrame, 0);
|
||||
iniFile.Get("Settings", "DisableLighting", &bDisableLighting, 0);
|
||||
iniFile.Get("Settings", "DisableTexturing", &bDisableTexturing, 0);
|
||||
iniFile.Get("Settings", "FreeLook", &bFreeLook, 0);
|
||||
iniFile.Get("Settings", "ShowShaderErrors", &bShowShaderErrors, 0);
|
||||
iniFile.Get("Settings", "MSAA", &iMultisampleMode, 0);
|
||||
iniFile.Get("Settings", "DstAlphaPass", &bDstAlphaPass, false);
|
||||
|
||||
iniFile.Get("Settings", "TexFmtOverlayEnable", &bTexFmtOverlayEnable, 0);
|
||||
iniFile.Get("Settings", "TexFmtOverlayCenter", &bTexFmtOverlayCenter, 0);
|
||||
iniFile.Get("Settings", "WireFrame", &bWireFrame, 0);
|
||||
iniFile.Get("Settings", "DisableLighting", &bDisableLighting, 0);
|
||||
iniFile.Get("Settings", "DisableTexturing", &bDisableTexturing, 0);
|
||||
iniFile.Get("Settings", "DisableFog", &bDisableFog, 0);
|
||||
|
||||
iniFile.Get("Enhancements", "ForceFiltering", &bForceFiltering, 0);
|
||||
iniFile.Get("Enhancements", "MaxAnisotropy", &iMaxAnisotropy, 1); // NOTE - this is x in (1 << x)
|
||||
|
||||
iniFile.Get("Enhancements", "ForceFiltering", &bForceFiltering, 0);
|
||||
iniFile.Get("Enhancements", "MaxAnisotropy", &iMaxAnisotropy, 1); // NOTE - this is x in (1 << x)
|
||||
iniFile.Get("Enhancements", "PostProcessingShader", &sPostProcessingShader, "");
|
||||
|
||||
iniFile.Get("Hacks", "EFBAccessEnable", &bEFBAccessEnable, true);
|
||||
iniFile.Get("Hacks", "EFBCopyDisable", &bEFBCopyDisable, false);
|
||||
iniFile.Get("Hacks", "EFBCopyDisableHotKey", &bOSDHotKey, 0);
|
||||
|
||||
iniFile.Get("Hacks", "EFBAccessEnable", &bEFBAccessEnable, true);
|
||||
iniFile.Get("Hacks", "EFBCopyDisable", &bEFBCopyDisable, false);
|
||||
iniFile.Get("Hacks", "EFBCopyDisableHotKey", &bOSDHotKey, 0);
|
||||
iniFile.Get("Hacks", "EFBToTextureEnable", &bCopyEFBToTexture, false);
|
||||
iniFile.Get("Hacks", "EFBScaledCopy", &bCopyEFBScaled, true);
|
||||
iniFile.Get("Hacks", "FIFOBPHack", &bFIFOBPhack, false);
|
||||
iniFile.Get("Hacks", "ProjectionHack", &iPhackvalue, 0);
|
||||
|
||||
iniFile.Get("Hardware", "Adapter", &iAdapter, 0);
|
||||
if (iAdapter == -1)
|
||||
if (iAdapter == -1)
|
||||
iAdapter = 0;
|
||||
iniFile.Get("Hardware", "SimpleFB", &bSimpleFB, false);
|
||||
|
||||
|
||||
// Load common settings
|
||||
iniFile.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
|
||||
bool bTmp;
|
||||
@ -109,9 +109,9 @@ void VideoConfig::Load(const char *ini_file)
|
||||
|
||||
void VideoConfig::GameIniLoad(const char *ini_file)
|
||||
{
|
||||
IniFile iniFile;
|
||||
iniFile.Load(ini_file);
|
||||
|
||||
IniFile iniFile;
|
||||
iniFile.Load(ini_file);
|
||||
|
||||
if (iniFile.Exists("Video", "ForceFiltering"))
|
||||
iniFile.Get("Video", "ForceFiltering", &bForceFiltering);
|
||||
if (iniFile.Exists("Video", "MaxAnisotropy"))
|
||||
@ -148,60 +148,60 @@ void VideoConfig::GameIniLoad(const char *ini_file)
|
||||
|
||||
void VideoConfig::Save(const char *ini_file)
|
||||
{
|
||||
IniFile iniFile;
|
||||
iniFile.Load(ini_file);
|
||||
iniFile.Set("Hardware", "VSync", bVSync);
|
||||
iniFile.Set("Settings", "StretchToFit", bNativeResolution);
|
||||
IniFile iniFile;
|
||||
iniFile.Load(ini_file);
|
||||
iniFile.Set("Hardware", "VSync", bVSync);
|
||||
iniFile.Set("Settings", "StretchToFit", bNativeResolution);
|
||||
iniFile.Set("Settings", "2xResolution", b2xResolution);
|
||||
iniFile.Set("Settings", "AspectRatio", iAspectRatio);
|
||||
iniFile.Set("Settings", "Crop", bCrop);
|
||||
iniFile.Set("Settings", "wideScreenHack", bWidescreenHack);
|
||||
iniFile.Set("Settings", "UseXFB", bUseXFB);
|
||||
iniFile.Set("Settings", "UseXFB", bUseXFB);
|
||||
iniFile.Set("Settings", "UseRealXFB", bUseRealXFB);
|
||||
iniFile.Set("Settings", "AutoScale", bAutoScale);
|
||||
iniFile.Set("Settings", "AutoScale", bAutoScale);
|
||||
iniFile.Set("Settings", "UseNativeMips", bUseNativeMips);
|
||||
|
||||
iniFile.Set("Settings", "SafeTextureCache", bSafeTextureCache);
|
||||
iniFile.Set("Settings", "SafeTextureCache", bSafeTextureCache);
|
||||
//safe texture cache params
|
||||
iniFile.Set("Settings", "SafeTextureCacheColorSamples", iSafeTextureCache_ColorSamples);
|
||||
|
||||
iniFile.Set("Settings", "ShowFPS", bShowFPS);
|
||||
iniFile.Set("Settings", "OverlayStats", bOverlayStats);
|
||||
iniFile.Set("Settings", "ShowFPS", bShowFPS);
|
||||
iniFile.Set("Settings", "OverlayStats", bOverlayStats);
|
||||
iniFile.Set("Settings", "OverlayProjStats", bOverlayProjStats);
|
||||
iniFile.Set("Settings", "DLOptimize", iCompileDLsLevel);
|
||||
iniFile.Set("Settings", "DLOptimize", iCompileDLsLevel);
|
||||
iniFile.Set("Settings", "Show", iCompileDLsLevel);
|
||||
iniFile.Set("Settings", "DumpTextures", bDumpTextures);
|
||||
iniFile.Set("Settings", "HiresTextures", bHiresTextures);
|
||||
iniFile.Set("Settings", "DumpTextures", bDumpTextures);
|
||||
iniFile.Set("Settings", "HiresTextures", bHiresTextures);
|
||||
iniFile.Set("Settings", "DumpEFBTarget", bDumpEFBTarget);
|
||||
iniFile.Set("Settings", "DumpFrames", bDumpFrames);
|
||||
iniFile.Set("Settings", "FreeLook", bFreeLook);
|
||||
iniFile.Set("Settings", "ShowEFBCopyRegions", bShowEFBCopyRegions);
|
||||
iniFile.Set("Settings", "FreeLook", bFreeLook);
|
||||
iniFile.Set("Settings", "ShowEFBCopyRegions", bShowEFBCopyRegions);
|
||||
iniFile.Set("Settings", "ShowShaderErrors", bShowShaderErrors);
|
||||
iniFile.Set("Settings", "MSAA", iMultisampleMode);
|
||||
iniFile.Set("Settings", "TexFmtOverlayEnable", bTexFmtOverlayEnable);
|
||||
iniFile.Set("Settings", "TexFmtOverlayCenter", bTexFmtOverlayCenter);
|
||||
iniFile.Set("Settings", "Wireframe", bWireFrame);
|
||||
iniFile.Set("Settings", "DisableLighting", bDisableLighting);
|
||||
iniFile.Set("Settings", "DisableTexturing", bDisableTexturing);
|
||||
iniFile.Set("Settings", "DstAlphaPass", bDstAlphaPass);
|
||||
iniFile.Set("Settings", "MSAA", iMultisampleMode);
|
||||
iniFile.Set("Settings", "TexFmtOverlayEnable", bTexFmtOverlayEnable);
|
||||
iniFile.Set("Settings", "TexFmtOverlayCenter", bTexFmtOverlayCenter);
|
||||
iniFile.Set("Settings", "Wireframe", bWireFrame);
|
||||
iniFile.Set("Settings", "DisableLighting", bDisableLighting);
|
||||
iniFile.Set("Settings", "DisableTexturing", bDisableTexturing);
|
||||
iniFile.Set("Settings", "DstAlphaPass", bDstAlphaPass);
|
||||
iniFile.Set("Settings", "DisableFog", bDisableFog);
|
||||
|
||||
iniFile.Set("Enhancements", "ForceFiltering", bForceFiltering);
|
||||
iniFile.Set("Enhancements", "MaxAnisotropy", iMaxAnisotropy);
|
||||
|
||||
iniFile.Set("Enhancements", "ForceFiltering", bForceFiltering);
|
||||
iniFile.Set("Enhancements", "MaxAnisotropy", iMaxAnisotropy);
|
||||
iniFile.Set("Enhancements", "PostProcessingShader", sPostProcessingShader);
|
||||
|
||||
iniFile.Set("Hacks", "EFBAccessEnable", bEFBAccessEnable);
|
||||
iniFile.Set("Hacks", "EFBCopyDisable", bEFBCopyDisable);
|
||||
iniFile.Set("Hacks", "EFBCopyDisableHotKey", bOSDHotKey);
|
||||
|
||||
iniFile.Set("Hacks", "EFBAccessEnable", bEFBAccessEnable);
|
||||
iniFile.Set("Hacks", "EFBCopyDisable", bEFBCopyDisable);
|
||||
iniFile.Set("Hacks", "EFBCopyDisableHotKey", bOSDHotKey);
|
||||
iniFile.Set("Hacks", "EFBToTextureEnable", bCopyEFBToTexture);
|
||||
iniFile.Set("Hacks", "EFBScaledCopy", bCopyEFBScaled);
|
||||
iniFile.Set("Hacks", "FIFOBPHack", bFIFOBPhack);
|
||||
iniFile.Set("Hacks", "ProjectionHack", iPhackvalue);
|
||||
|
||||
|
||||
iniFile.Set("Hardware", "Adapter", iAdapter);
|
||||
iniFile.Set("Hardware", "SimpleFB", bSimpleFB);
|
||||
|
||||
iniFile.Save(ini_file);
|
||||
|
||||
iniFile.Save(ini_file);
|
||||
}
|
||||
|
||||
// TODO: Figure out a better place for this function.
|
||||
@ -211,15 +211,15 @@ void ComputeDrawRectangle(int backbuffer_width, int backbuffer_height, bool flip
|
||||
float FloatGLHeight = (float)backbuffer_height;
|
||||
float FloatXOffset = 0;
|
||||
float FloatYOffset = 0;
|
||||
|
||||
|
||||
// The rendering window size
|
||||
const float WinWidth = FloatGLWidth;
|
||||
const float WinHeight = FloatGLHeight;
|
||||
|
||||
|
||||
// Handle aspect ratio.
|
||||
// Default to auto.
|
||||
bool use16_9 = g_VideoInitialize.bAutoAspectIs16_9;
|
||||
|
||||
|
||||
// Update aspect ratio hack values
|
||||
// Won't take effect until next frame
|
||||
// Don't know if there is a better place for this code so there isn't a 1 frame delay
|
||||
@ -227,7 +227,7 @@ void ComputeDrawRectangle(int backbuffer_width, int backbuffer_height, bool flip
|
||||
{
|
||||
float source_aspect = use16_9 ? (16.0f / 9.0f) : (4.0f / 3.0f);
|
||||
float target_aspect;
|
||||
|
||||
|
||||
switch ( g_ActiveConfig.iAspectRatio )
|
||||
{
|
||||
case ASPECT_FORCE_16_9 :
|
||||
@ -244,7 +244,7 @@ void ComputeDrawRectangle(int backbuffer_width, int backbuffer_height, bool flip
|
||||
target_aspect = source_aspect;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
float adjust = source_aspect / target_aspect;
|
||||
if ( adjust > 1 )
|
||||
{
|
||||
@ -271,7 +271,7 @@ void ComputeDrawRectangle(int backbuffer_width, int backbuffer_height, bool flip
|
||||
use16_9 = true;
|
||||
else if (g_ActiveConfig.iAspectRatio == ASPECT_FORCE_4_3)
|
||||
use16_9 = false;
|
||||
|
||||
|
||||
if (g_ActiveConfig.iAspectRatio != ASPECT_STRETCH)
|
||||
{
|
||||
// The rendering window aspect ratio as a proportion of the 4:3 or 16:9 ratio
|
||||
@ -291,7 +291,7 @@ void ComputeDrawRectangle(int backbuffer_width, int backbuffer_height, bool flip
|
||||
FloatYOffset = FloatYOffset + (WinHeight - FloatGLHeight) / 2.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Crop the picture from 4:3 to 5:4 or from 16:9 to 16:10.
|
||||
// Output: FloatGLWidth, FloatGLHeight, FloatXOffset, FloatYOffset
|
||||
@ -309,7 +309,7 @@ void ComputeDrawRectangle(int backbuffer_width, int backbuffer_height, bool flip
|
||||
FloatXOffset = FloatXOffset - (IncreasedWidth * 0.5f);
|
||||
FloatYOffset = FloatYOffset - (IncreasedHeight * 0.5f);
|
||||
}
|
||||
|
||||
|
||||
int XOffset = (int)(FloatXOffset + 0.5f);
|
||||
int YOffset = (int)(FloatYOffset + 0.5f);
|
||||
int iWhidth = (int)ceil(FloatGLWidth);
|
||||
|
@ -60,60 +60,60 @@ class IniFile;
|
||||
// NEVER inherit from this class.
|
||||
struct VideoConfig
|
||||
{
|
||||
VideoConfig();
|
||||
void Load(const char *ini_file);
|
||||
VideoConfig();
|
||||
void Load(const char *ini_file);
|
||||
void GameIniLoad(const char *ini_file);
|
||||
void Save(const char *ini_file);
|
||||
void Save(const char *ini_file);
|
||||
void UpdateProjectionHack();
|
||||
|
||||
// General
|
||||
// General
|
||||
bool bVSync;
|
||||
|
||||
bool bNativeResolution, b2xResolution, bRunning; // Should possibly be augmented with 2x, 4x native.
|
||||
bool bNativeResolution, b2xResolution, bRunning; // Should possibly be augmented with 2x, 4x native.
|
||||
bool bWidescreenHack;
|
||||
int iAspectRatio;
|
||||
bool bCrop; // Aspect ratio controls.
|
||||
bool bUseXFB;
|
||||
bool bCrop; // Aspect ratio controls.
|
||||
bool bUseXFB;
|
||||
bool bUseRealXFB;
|
||||
bool bAutoScale; // Removes annoying borders without using XFB. Doesn't always work perfectly.
|
||||
bool bAutoScale; // Removes annoying borders without using XFB. Doesn't always work perfectly.
|
||||
bool bUseNativeMips;
|
||||
|
||||
|
||||
// Enhancements
|
||||
int iMultisampleMode;
|
||||
bool bForceFiltering;
|
||||
int iMaxAnisotropy;
|
||||
int iMultisampleMode;
|
||||
bool bForceFiltering;
|
||||
int iMaxAnisotropy;
|
||||
std::string sPostProcessingShader;
|
||||
|
||||
// Information
|
||||
bool bShowFPS;
|
||||
bool bOverlayStats;
|
||||
bool bShowFPS;
|
||||
bool bOverlayStats;
|
||||
bool bOverlayProjStats;
|
||||
bool bTexFmtOverlayEnable;
|
||||
bool bTexFmtOverlayCenter;
|
||||
bool bTexFmtOverlayEnable;
|
||||
bool bTexFmtOverlayCenter;
|
||||
bool bShowEFBCopyRegions;
|
||||
|
||||
// Render
|
||||
bool bWireFrame;
|
||||
bool bDisableLighting;
|
||||
bool bDisableTexturing;
|
||||
bool bDstAlphaPass;
|
||||
|
||||
// Render
|
||||
bool bWireFrame;
|
||||
bool bDisableLighting;
|
||||
bool bDisableTexturing;
|
||||
bool bDstAlphaPass;
|
||||
bool bDisableFog;
|
||||
|
||||
// Utility
|
||||
bool bDumpTextures;
|
||||
|
||||
// Utility
|
||||
bool bDumpTextures;
|
||||
bool bHiresTextures;
|
||||
bool bDumpEFBTarget;
|
||||
bool bDumpFrames;
|
||||
bool bFreeLook;
|
||||
|
||||
// Hacks
|
||||
bool bEFBAccessEnable;
|
||||
bool bFreeLook;
|
||||
|
||||
// Hacks
|
||||
bool bEFBAccessEnable;
|
||||
bool bEFBCopyDisable; // should reverse polarity of this one :) true=disabled can be confusing
|
||||
bool bOSDHotKey;
|
||||
bool bOSDHotKey;
|
||||
bool bHack;
|
||||
bool bCopyEFBToTexture;
|
||||
bool bCopyEFBScaled;
|
||||
bool bSafeTextureCache;
|
||||
bool bSafeTextureCache;
|
||||
int iSafeTextureCache_ColorSamples;
|
||||
bool bFIFOBPhack;
|
||||
int iPhackvalue;
|
||||
@ -122,12 +122,12 @@ struct VideoConfig
|
||||
bool bProjHack1;
|
||||
float fAspectRatioHackW, fAspectRatioHackH;
|
||||
|
||||
int iLog; // CONF_ bits
|
||||
int iSaveTargetId;
|
||||
|
||||
//currently unused:
|
||||
int iCompileDLsLevel;
|
||||
bool bShowShaderErrors;
|
||||
int iLog; // CONF_ bits
|
||||
int iSaveTargetId;
|
||||
|
||||
//currently unused:
|
||||
int iCompileDLsLevel;
|
||||
bool bShowShaderErrors;
|
||||
|
||||
// D3D only config, mostly to be merged into the above
|
||||
int iAdapter;
|
||||
|
Reference in New Issue
Block a user