mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Merge branch 'master' into wii-network
This commit is contained in:
@@ -213,7 +213,7 @@ void Write32(const u32 _Value, const u32 _Address)
|
||||
break;
|
||||
}
|
||||
|
||||
WII_IPC_HLE_Interface::Update();
|
||||
//WII_IPC_HLE_Interface::Update();
|
||||
CoreTiming::ScheduleEvent_Threadsafe(0, updateInterrupts, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,6 @@ void EnqueReplyCallback(u64 userdata, int)
|
||||
|
||||
void Init()
|
||||
{
|
||||
enque_reply = CoreTiming::RegisterEvent("IPCReply", EnqueReplyCallback);
|
||||
|
||||
_dbg_assert_msg_(WII_IPC_HLE, g_DeviceMap.empty(), "DeviceMap isn't empty on init");
|
||||
CWII_IPC_HLE_Device_es::m_ContentFile = "";
|
||||
@@ -130,11 +129,15 @@ void Init()
|
||||
#endif
|
||||
g_DeviceMap[i] = new CWII_IPC_HLE_Device_stub(i, std::string("/dev/usb/oh1")); i++;
|
||||
g_DeviceMap[i] = new IWII_IPC_HLE_Device(i, std::string("_Unimplemented_Device_")); i++;
|
||||
|
||||
enque_reply = CoreTiming::RegisterEvent("IPCReply", EnqueReplyCallback);
|
||||
}
|
||||
|
||||
void Reset(bool _bHard)
|
||||
{
|
||||
|
||||
|
||||
CoreTiming::RemoveAllEvents(enque_reply);
|
||||
|
||||
u32 i;
|
||||
for (i=0; i<IPC_MAX_FDS; i++)
|
||||
{
|
||||
|
||||
@@ -89,8 +89,10 @@ bool AVIDump::CreateFile()
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_fileCount) {
|
||||
if (!SetCompressionOptions()) {
|
||||
if (!m_fileCount)
|
||||
{
|
||||
if (!SetCompressionOptions())
|
||||
{
|
||||
NOTICE_LOG(VIDEO, "SetCompressionOptions failed");
|
||||
Stop();
|
||||
return false;
|
||||
|
||||
@@ -87,17 +87,17 @@
|
||||
#define BPMEM_FOGPARAM3 0xF1
|
||||
#define BPMEM_FOGCOLOR 0xF2
|
||||
#define BPMEM_ALPHACOMPARE 0xF3
|
||||
#define BPMEM_BIAS 0xF4
|
||||
#define BPMEM_ZTEX2 0xF5
|
||||
#define BPMEM_BIAS 0xF4
|
||||
#define BPMEM_ZTEX2 0xF5
|
||||
#define BPMEM_TEV_KSEL 0xF6 // 0xF6 + 8
|
||||
#define BPMEM_BP_MASK 0xFE
|
||||
|
||||
|
||||
// Tev/combiner things
|
||||
|
||||
#define TEVSCALE_1 0
|
||||
#define TEVSCALE_2 1
|
||||
#define TEVSCALE_4 2
|
||||
#define TEVSCALE_1 0
|
||||
#define TEVSCALE_2 1
|
||||
#define TEVSCALE_4 2
|
||||
#define TEVDIVIDE_2 3
|
||||
|
||||
#define TEVCMP_R8 0
|
||||
@@ -136,22 +136,22 @@
|
||||
#define TEVCOLORARG_ZERO 15
|
||||
|
||||
#define TEVALPHAARG_APREV 0
|
||||
#define TEVALPHAARG_A0 1
|
||||
#define TEVALPHAARG_A1 2
|
||||
#define TEVALPHAARG_A2 3
|
||||
#define TEVALPHAARG_TEXA 4
|
||||
#define TEVALPHAARG_RASA 5
|
||||
#define TEVALPHAARG_A0 1
|
||||
#define TEVALPHAARG_A1 2
|
||||
#define TEVALPHAARG_A2 3
|
||||
#define TEVALPHAARG_TEXA 4
|
||||
#define TEVALPHAARG_RASA 5
|
||||
#define TEVALPHAARG_KONST 6
|
||||
#define TEVALPHAARG_ZERO 7
|
||||
#define TEVALPHAARG_ZERO 7
|
||||
|
||||
#define ALPHACMP_NEVER 0
|
||||
#define ALPHACMP_LESS 1
|
||||
#define ALPHACMP_EQUAL 2
|
||||
#define ALPHACMP_LEQUAL 3
|
||||
#define ALPHACMP_NEVER 0
|
||||
#define ALPHACMP_LESS 1
|
||||
#define ALPHACMP_EQUAL 2
|
||||
#define ALPHACMP_LEQUAL 3
|
||||
#define ALPHACMP_GREATER 4
|
||||
#define ALPHACMP_NEQUAL 5
|
||||
#define ALPHACMP_GEQUAL 6
|
||||
#define ALPHACMP_ALWAYS 7
|
||||
#define ALPHACMP_NEQUAL 5
|
||||
#define ALPHACMP_GEQUAL 6
|
||||
#define ALPHACMP_ALWAYS 7
|
||||
|
||||
enum Compare
|
||||
{
|
||||
@@ -313,26 +313,26 @@ struct TevStageCombiner
|
||||
#define ITF_3 3
|
||||
|
||||
#define ITB_NONE 0
|
||||
#define ITB_S 1
|
||||
#define ITB_T 2
|
||||
#define ITB_ST 3
|
||||
#define ITB_U 4
|
||||
#define ITB_SU 5
|
||||
#define ITB_TU 6
|
||||
#define ITB_STU 7
|
||||
#define ITB_S 1
|
||||
#define ITB_T 2
|
||||
#define ITB_ST 3
|
||||
#define ITB_U 4
|
||||
#define ITB_SU 5
|
||||
#define ITB_TU 6
|
||||
#define ITB_STU 7
|
||||
|
||||
#define ITBA_OFF 0
|
||||
#define ITBA_S 1
|
||||
#define ITBA_T 2
|
||||
#define ITBA_U 3
|
||||
#define ITBA_S 1
|
||||
#define ITBA_T 2
|
||||
#define ITBA_U 3
|
||||
|
||||
#define ITW_OFF 0
|
||||
#define ITW_256 1
|
||||
#define ITW_128 2
|
||||
#define ITW_64 3
|
||||
#define ITW_32 4
|
||||
#define ITW_16 5
|
||||
#define ITW_0 6
|
||||
#define ITW_64 3
|
||||
#define ITW_32 4
|
||||
#define ITW_16 5
|
||||
#define ITW_0 6
|
||||
|
||||
// several discoveries:
|
||||
// GXSetTevIndBumpST(tevstage, indstage, matrixind)
|
||||
@@ -366,7 +366,7 @@ struct TevStageCombiner
|
||||
u32 unused : 11;
|
||||
};
|
||||
|
||||
bool IsActive() { return (hex&0x17fe00)!=0; }
|
||||
bool IsActive() { return (hex & 0x17fe00) != 0; }
|
||||
};
|
||||
|
||||
union TwoTevStageOrders
|
||||
@@ -464,7 +464,7 @@ union TexImage0
|
||||
{
|
||||
struct
|
||||
{
|
||||
u32 width : 10; //actually w-1
|
||||
u32 width : 10; //actually w-1
|
||||
u32 height : 10; //actually h-1
|
||||
u32 format : 4;
|
||||
};
|
||||
@@ -542,14 +542,14 @@ union ZTex2
|
||||
|
||||
struct FourTexUnits
|
||||
{
|
||||
TexMode0 texMode0[4];
|
||||
TexMode1 texMode1[4];
|
||||
TexImage0 texImage0[4];
|
||||
TexImage1 texImage1[4];
|
||||
TexImage2 texImage2[4];
|
||||
TexImage3 texImage3[4];
|
||||
TexTLUT texTlut[4];
|
||||
u32 unknown[4];
|
||||
TexMode0 texMode0[4];
|
||||
TexMode1 texMode1[4];
|
||||
TexImage0 texImage0[4];
|
||||
TexImage1 texImage1[4];
|
||||
TexImage2 texImage2[4];
|
||||
TexImage3 texImage3[4];
|
||||
TexTLUT texTlut[4];
|
||||
u32 unknown[4];
|
||||
};
|
||||
|
||||
|
||||
@@ -646,7 +646,8 @@ union FogParam0
|
||||
u32 sign : 1;
|
||||
};
|
||||
|
||||
float GetA() {
|
||||
float GetA()
|
||||
{
|
||||
union { u32 i; float f; } dummy;
|
||||
dummy.i = ((u32)sign << 31) | ((u32)exponent << 23) | ((u32)mantissa << 12); // scale mantissa from 11 to 23 bits
|
||||
return dummy.f;
|
||||
@@ -667,7 +668,8 @@ union FogParam3
|
||||
};
|
||||
|
||||
// amount to subtract from eyespacez after range adjustment
|
||||
float GetC() {
|
||||
float GetC()
|
||||
{
|
||||
union { u32 i; float f; } dummy;
|
||||
dummy.i = ((u32)c_sign << 31) | ((u32)c_exp << 23) | ((u32)c_mant << 12); // scale mantissa from 11 to 23 bits
|
||||
return dummy.f;
|
||||
@@ -906,7 +908,8 @@ union UPE_Copy
|
||||
union BPU_PreloadTileInfo
|
||||
{
|
||||
u32 hex;
|
||||
struct {
|
||||
struct
|
||||
{
|
||||
u32 count : 15;
|
||||
u32 type : 2;
|
||||
};
|
||||
|
||||
@@ -102,7 +102,9 @@ void BPWritten(const BPCmd& bp)
|
||||
if (!mapTexFound)
|
||||
{
|
||||
if (bp.address != BPMEM_TEV_COLOR_ENV && bp.address != BPMEM_TEV_ALPHA_ENV)
|
||||
{
|
||||
numWrites = 0;
|
||||
}
|
||||
else if (++numWrites >= 100) // seem that if 100 consecutive BP writes are called to either of these addresses in ZTP,
|
||||
{ // then it is safe to assume the map texture address is currently loaded into the BP memory
|
||||
mapTexAddress = bpmem.tex[0].texImage3[0].hex << 5;
|
||||
@@ -193,15 +195,19 @@ void BPWritten(const BPCmd& bp)
|
||||
PRIM_LOG("blendmode: en=%d, open=%d, colupd=%d, alphaupd=%d, dst=%d, src=%d, sub=%d, mode=%d",
|
||||
bpmem.blendmode.blendenable, bpmem.blendmode.logicopenable, bpmem.blendmode.colorupdate, bpmem.blendmode.alphaupdate,
|
||||
bpmem.blendmode.dstfactor, bpmem.blendmode.srcfactor, bpmem.blendmode.subtract, bpmem.blendmode.logicmode);
|
||||
|
||||
// Set LogicOp Blending Mode
|
||||
if (bp.changes & 2)
|
||||
SetLogicOpMode();
|
||||
|
||||
// Set Dithering Mode
|
||||
if (bp.changes & 4)
|
||||
SetDitherMode();
|
||||
|
||||
// Set Blending Mode
|
||||
if (bp.changes & 0xFF1)
|
||||
SetBlendMode();
|
||||
|
||||
// Set Color Mask
|
||||
if (bp.changes & 0x18)
|
||||
SetColorMask();
|
||||
@@ -413,32 +419,35 @@ void BPWritten(const BPCmd& bp)
|
||||
case BPMEM_CLEARBBOX1:
|
||||
case BPMEM_CLEARBBOX2:
|
||||
{
|
||||
if(g_ActiveConfig.bUseBBox)
|
||||
{
|
||||
// Don't compute bounding box if this frame is being skipped!
|
||||
// Wrong but valid values are better than bogus values...
|
||||
if(g_bSkipCurrentFrame)
|
||||
break;
|
||||
if(g_ActiveConfig.bUseBBox)
|
||||
{
|
||||
// Don't compute bounding box if this frame is being skipped!
|
||||
// Wrong but valid values are better than bogus values...
|
||||
if(g_bSkipCurrentFrame)
|
||||
break;
|
||||
|
||||
if (bp.address == BPMEM_CLEARBBOX1) {
|
||||
int right = bp.newvalue >> 10;
|
||||
int left = bp.newvalue & 0x3ff;
|
||||
if (bp.address == BPMEM_CLEARBBOX1)
|
||||
{
|
||||
int right = bp.newvalue >> 10;
|
||||
int left = bp.newvalue & 0x3ff;
|
||||
|
||||
// We should only set these if bbox is calculated properly.
|
||||
PixelEngine::bbox[0] = left;
|
||||
PixelEngine::bbox[1] = right;
|
||||
PixelEngine::bbox_active = true;
|
||||
} else {
|
||||
int bottom = bp.newvalue >> 10;
|
||||
int top = bp.newvalue & 0x3ff;
|
||||
// We should only set these if bbox is calculated properly.
|
||||
PixelEngine::bbox[0] = left;
|
||||
PixelEngine::bbox[1] = right;
|
||||
PixelEngine::bbox_active = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
int bottom = bp.newvalue >> 10;
|
||||
int top = bp.newvalue & 0x3ff;
|
||||
|
||||
// We should only set these if bbox is calculated properly.
|
||||
PixelEngine::bbox[2] = top;
|
||||
PixelEngine::bbox[3] = bottom;
|
||||
PixelEngine::bbox_active = true;
|
||||
// We should only set these if bbox is calculated properly.
|
||||
PixelEngine::bbox[2] = top;
|
||||
PixelEngine::bbox[3] = bottom;
|
||||
PixelEngine::bbox_active = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BPMEM_TEXINVALIDATE:
|
||||
// TODO: Needs some restructuring in TextureCacheBase.
|
||||
@@ -446,7 +455,8 @@ void BPWritten(const BPCmd& bp)
|
||||
|
||||
case BPMEM_ZCOMPARE: // Set the Z-Compare and EFB pixel format
|
||||
OnPixelFormatChange();
|
||||
if(bp.changes & 7) {
|
||||
if(bp.changes & 7)
|
||||
{
|
||||
SetBlendMode(); // dual source could be activated by changing to PIXELFMT_RGBA6_Z24
|
||||
g_renderer->SetColorMask(); // alpha writing needs to be disabled if the new pixel format doesn't have an alpha channel
|
||||
}
|
||||
|
||||
@@ -88,7 +88,9 @@ union TVtxDesc
|
||||
u32 Tex7Coord : 2;
|
||||
u32 :31;
|
||||
};
|
||||
struct {
|
||||
|
||||
struct
|
||||
{
|
||||
u32 Hex0, Hex1;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -115,13 +115,13 @@ void Init()
|
||||
fifo.CPCmdIdle = 1;
|
||||
fifo.CPReadIdle = 1;
|
||||
fifo.bFF_Breakpoint = 0;
|
||||
fifo.bFF_HiWatermark = 0;
|
||||
fifo.bFF_HiWatermark = 0;
|
||||
fifo.bFF_HiWatermarkInt = 0;
|
||||
fifo.bFF_LoWatermark = 0;
|
||||
fifo.bFF_LoWatermark = 0;
|
||||
fifo.bFF_LoWatermarkInt = 0;
|
||||
|
||||
interruptSet = false;
|
||||
interruptWaiting = false;
|
||||
interruptWaiting = false;
|
||||
interruptFinishWaiting = false;
|
||||
interruptTokenWaiting = false;
|
||||
|
||||
@@ -131,7 +131,7 @@ void Init()
|
||||
isHiWatermarkActive = false;
|
||||
isLoWatermarkActive = false;
|
||||
|
||||
et_UpdateInterrupts = CoreTiming::RegisterEvent("CPInterrupt", UpdateInterrupts_Wrapper);
|
||||
et_UpdateInterrupts = CoreTiming::RegisterEvent("CPInterrupt", UpdateInterrupts_Wrapper);
|
||||
}
|
||||
|
||||
void Read16(u16& _rReturnValue, const u32 _Address)
|
||||
@@ -139,7 +139,7 @@ void Read16(u16& _rReturnValue, const u32 _Address)
|
||||
INFO_LOG(COMMANDPROCESSOR, "(r): 0x%08x", _Address);
|
||||
switch (_Address & 0xFFF)
|
||||
{
|
||||
case STATUS_REGISTER:
|
||||
case STATUS_REGISTER:
|
||||
SetCpStatusRegister();
|
||||
_rReturnValue = m_CPStatusReg.Hex;
|
||||
return;
|
||||
@@ -166,22 +166,30 @@ void Read16(u16& _rReturnValue, const u32 _Address)
|
||||
|
||||
case FIFO_RW_DISTANCE_LO:
|
||||
if (IsOnThread())
|
||||
{
|
||||
if(fifo.CPWritePointer >= fifo.SafeCPReadPointer)
|
||||
_rReturnValue = ReadLow (fifo.CPWritePointer - fifo.SafeCPReadPointer);
|
||||
else
|
||||
_rReturnValue = ReadLow (fifo.CPEnd - fifo.SafeCPReadPointer + fifo.CPWritePointer - fifo.CPBase + 32);
|
||||
}
|
||||
else
|
||||
{
|
||||
_rReturnValue = ReadLow (fifo.CPReadWriteDistance);
|
||||
}
|
||||
DEBUG_LOG(COMMANDPROCESSOR, "Read FIFO_RW_DISTANCE_LO : %04x", _rReturnValue);
|
||||
return;
|
||||
case FIFO_RW_DISTANCE_HI:
|
||||
if (IsOnThread())
|
||||
{
|
||||
if(fifo.CPWritePointer >= fifo.SafeCPReadPointer)
|
||||
_rReturnValue = ReadHigh (fifo.CPWritePointer - fifo.SafeCPReadPointer);
|
||||
else
|
||||
_rReturnValue = ReadHigh (fifo.CPEnd - fifo.SafeCPReadPointer + fifo.CPWritePointer - fifo.CPBase + 32);
|
||||
}
|
||||
else
|
||||
{
|
||||
_rReturnValue = ReadHigh(fifo.CPReadWriteDistance);
|
||||
}
|
||||
DEBUG_LOG(COMMANDPROCESSOR, "Read FIFO_RW_DISTANCE_HI : %04x", _rReturnValue);
|
||||
return;
|
||||
case FIFO_WRITE_POINTER_LO:
|
||||
@@ -437,7 +445,9 @@ void STACKALIGN GatherPipeBursted()
|
||||
if (!m_CPCtrlReg.GPLinkEnable)
|
||||
{
|
||||
if (!IsOnThread())
|
||||
{
|
||||
RunGpu();
|
||||
}
|
||||
else
|
||||
{
|
||||
// In multibuffer mode is not allowed write in the same FIFO attached to the GPU.
|
||||
@@ -467,7 +477,7 @@ void STACKALIGN GatherPipeBursted()
|
||||
if (!IsOnThread())
|
||||
RunGpu();
|
||||
|
||||
_assert_msg_(COMMANDPROCESSOR, fifo.CPReadWriteDistance <= fifo.CPEnd - fifo.CPBase,
|
||||
_assert_msg_(COMMANDPROCESSOR, fifo.CPReadWriteDistance <= fifo.CPEnd - fifo.CPBase,
|
||||
"FIFO is overflowed by GatherPipe !\nCPU thread is too fast!");
|
||||
|
||||
// check if we are in sync
|
||||
@@ -482,13 +492,13 @@ void UpdateInterrupts(u64 userdata)
|
||||
{
|
||||
interruptSet = true;
|
||||
INFO_LOG(COMMANDPROCESSOR,"Interrupt set");
|
||||
ProcessorInterface::SetInterrupt(INT_CAUSE_CP, true);
|
||||
ProcessorInterface::SetInterrupt(INT_CAUSE_CP, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
interruptSet = false;
|
||||
INFO_LOG(COMMANDPROCESSOR,"Interrupt cleared");
|
||||
ProcessorInterface::SetInterrupt(INT_CAUSE_CP, false);
|
||||
ProcessorInterface::SetInterrupt(INT_CAUSE_CP, false);
|
||||
}
|
||||
interruptWaiting = false;
|
||||
}
|
||||
@@ -510,7 +520,7 @@ void SetCpStatus(bool isCPUThread)
|
||||
fifo.bFF_HiWatermark = (fifo.CPReadWriteDistance > fifo.CPHiWatermark);
|
||||
fifo.bFF_LoWatermark = (fifo.CPReadWriteDistance < fifo.CPLoWatermark);
|
||||
|
||||
// breakpoint
|
||||
// breakpoint
|
||||
if (!isCPUThread)
|
||||
{
|
||||
if (fifo.bFF_BPEnable)
|
||||
@@ -571,7 +581,9 @@ void SetCpStatus(bool isCPUThread)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CommandProcessor::UpdateInterrupts(userdata);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ enum
|
||||
enum
|
||||
{
|
||||
GATHER_PIPE_SIZE = 32,
|
||||
INT_CAUSE_CP = 0x800
|
||||
INT_CAUSE_CP = 0x800
|
||||
};
|
||||
|
||||
// Fifo Status Register
|
||||
|
||||
@@ -68,6 +68,7 @@ void FreeLookInput( UINT iMsg, WPARAM wParam )
|
||||
static bool mouseMoveEnabled = false;
|
||||
static float lastMouse[2];
|
||||
POINT point;
|
||||
|
||||
switch(iMsg)
|
||||
{
|
||||
case WM_USER_KEYDOWN:
|
||||
@@ -99,14 +100,16 @@ void FreeLookInput( UINT iMsg, WPARAM wParam )
|
||||
break;
|
||||
|
||||
case WM_MOUSEMOVE:
|
||||
if (mouseLookEnabled) {
|
||||
if (mouseLookEnabled)
|
||||
{
|
||||
GetCursorPos(&point);
|
||||
VertexShaderManager::RotateView((point.x - lastMouse[0]) / 200.0f, (point.y - lastMouse[1]) / 200.0f);
|
||||
lastMouse[0] = (float)point.x;
|
||||
lastMouse[1] = (float)point.y;
|
||||
}
|
||||
|
||||
if (mouseMoveEnabled) {
|
||||
if (mouseMoveEnabled)
|
||||
{
|
||||
GetCursorPos(&point);
|
||||
VertexShaderManager::TranslateView((point.x - lastMouse[0]) / 50.0f, (point.y - lastMouse[1]) / 50.0f);
|
||||
lastMouse[0] = (float)point.x;
|
||||
|
||||
@@ -151,7 +151,8 @@ void RunGpuLoop()
|
||||
// check if we are able to run this buffer
|
||||
while (GpuRunningState && !CommandProcessor::interruptWaiting && fifo.bFF_GPReadEnable && fifo.CPReadWriteDistance && !AtBreakpoint())
|
||||
{
|
||||
if (!GpuRunningState) break;
|
||||
if (!GpuRunningState)
|
||||
break;
|
||||
|
||||
fifo.isGpuReadingData = true;
|
||||
CommandProcessor::isPossibleWaitingSetDrawDone = fifo.bFF_GPLinkEnable ? true : false;
|
||||
@@ -161,8 +162,10 @@ void RunGpuLoop()
|
||||
u32 readPtr = fifo.CPReadPointer;
|
||||
u8 *uData = Memory::GetPointer(readPtr);
|
||||
|
||||
if (readPtr == fifo.CPEnd) readPtr = fifo.CPBase;
|
||||
else readPtr += 32;
|
||||
if (readPtr == fifo.CPEnd)
|
||||
readPtr = fifo.CPBase;
|
||||
else
|
||||
readPtr += 32;
|
||||
|
||||
_assert_msg_(COMMANDPROCESSOR, (s32)fifo.CPReadWriteDistance - 32 >= 0 ,
|
||||
"Negative fifo.CPReadWriteDistance = %i in FIFO Loop !\nThat can produce instability in the game. Please report it.", fifo.CPReadWriteDistance - 32);
|
||||
@@ -236,8 +239,10 @@ void RunGpu()
|
||||
|
||||
//DEBUG_LOG(COMMANDPROCESSOR, "Fifo wraps to base");
|
||||
|
||||
if (fifo.CPReadPointer == fifo.CPEnd) fifo.CPReadPointer = fifo.CPBase;
|
||||
else fifo.CPReadPointer += 32;
|
||||
if (fifo.CPReadPointer == fifo.CPEnd)
|
||||
fifo.CPReadPointer = fifo.CPBase;
|
||||
else
|
||||
fifo.CPReadPointer += 32;
|
||||
|
||||
fifo.CPReadWriteDistance -= 32;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,8 @@ FramebufferManagerBase::~FramebufferManagerBase()
|
||||
|
||||
const XFBSourceBase* const* FramebufferManagerBase::GetXFBSource(u32 xfbAddr, u32 fbWidth, u32 fbHeight, u32 &xfbCount)
|
||||
{
|
||||
if (!g_ActiveConfig.bUseXFB) return NULL;
|
||||
if (!g_ActiveConfig.bUseXFB)
|
||||
return NULL;
|
||||
|
||||
if (g_ActiveConfig.bUseRealXFB)
|
||||
return GetRealXFBSource(xfbAddr, fbWidth, fbHeight, xfbCount);
|
||||
@@ -237,7 +238,9 @@ int FramebufferManagerBase::ScaleToVirtualXfbWidth(int x, unsigned int backbuffe
|
||||
return x * (int)backbuffer_width / (int)FramebufferManagerBase::LastXfbWidth();
|
||||
}
|
||||
else
|
||||
{
|
||||
return x * (int)Renderer::GetTargetRectangle().GetWidth() / (int)FramebufferManagerBase::LastXfbWidth();
|
||||
}
|
||||
}
|
||||
|
||||
int FramebufferManagerBase::ScaleToVirtualXfbHeight(int y, unsigned int backbuffer_height)
|
||||
@@ -251,5 +254,7 @@ int FramebufferManagerBase::ScaleToVirtualXfbHeight(int y, unsigned int backbuff
|
||||
return y * (int)backbuffer_height / (int)FramebufferManagerBase::LastXfbHeight();
|
||||
}
|
||||
else
|
||||
{
|
||||
return y * (int)Renderer::GetTargetRectangle().GetHeight() / (int)FramebufferManagerBase::LastXfbHeight();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,8 @@ template <bool pr> void IndexGenerator::AddList(u32 const numVerts)
|
||||
|
||||
template <bool pr> void IndexGenerator::AddStrip(u32 const numVerts)
|
||||
{
|
||||
if(pr) {
|
||||
if(pr)
|
||||
{
|
||||
for (u32 i = 0; i < numVerts; ++i)
|
||||
{
|
||||
*Tptr++ = index + i;
|
||||
@@ -100,7 +101,9 @@ template <bool pr> void IndexGenerator::AddStrip(u32 const numVerts)
|
||||
*Tptr++ = s_primitive_restart;
|
||||
numT += numVerts - 2;
|
||||
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
bool wind = false;
|
||||
for (u32 i = 2; i < numVerts; ++i)
|
||||
{
|
||||
@@ -137,8 +140,10 @@ template <bool pr> void IndexGenerator::AddFan(u32 numVerts)
|
||||
{
|
||||
u32 i = 2;
|
||||
|
||||
if(pr) {
|
||||
for(; i<=numVerts-3; i+=3) {
|
||||
if(pr)
|
||||
{
|
||||
for(; i<=numVerts-3; i+=3)
|
||||
{
|
||||
*Tptr++ = index + i - 1;
|
||||
*Tptr++ = index + i + 0;
|
||||
*Tptr++ = index;
|
||||
@@ -148,7 +153,8 @@ template <bool pr> void IndexGenerator::AddFan(u32 numVerts)
|
||||
numT += 3;
|
||||
}
|
||||
|
||||
for(; i<=numVerts-2; i+=2) {
|
||||
for(; i<=numVerts-2; i+=2)
|
||||
{
|
||||
*Tptr++ = index + i - 1;
|
||||
*Tptr++ = index + i + 0;
|
||||
*Tptr++ = index;
|
||||
@@ -186,18 +192,22 @@ template <bool pr> void IndexGenerator::AddQuads(u32 numVerts)
|
||||
auto const numQuads = numVerts / 4;
|
||||
for (u32 i = 0; i != numQuads; ++i)
|
||||
{
|
||||
if(pr) {
|
||||
if(pr)
|
||||
{
|
||||
*Tptr++ = index + i * 4 + 1;
|
||||
*Tptr++ = index + i * 4 + 2;
|
||||
*Tptr++ = index + i * 4 + 0;
|
||||
*Tptr++ = index + i * 4 + 3;
|
||||
*Tptr++ = s_primitive_restart;
|
||||
numT += 2;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTriangle<pr>(index + i * 4, index + i * 4 + 1, index + i * 4 + 2);
|
||||
WriteTriangle<pr>(index + i * 4, index + i * 4 + 2, index + i * 4 + 3);
|
||||
}
|
||||
}
|
||||
|
||||
// three vertices remaining, so render a triangle
|
||||
u32 remainingVerts = numVerts - numQuads*4;
|
||||
if(remainingVerts == 3)
|
||||
@@ -205,7 +215,9 @@ template <bool pr> void IndexGenerator::AddQuads(u32 numVerts)
|
||||
WriteTriangle<pr>(index+numVerts-3, index+numVerts-2, index+numVerts-1);
|
||||
}
|
||||
else if(remainingVerts)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "AddQuads: unknown count of vertices found");
|
||||
}
|
||||
}
|
||||
|
||||
// Lines
|
||||
|
||||
@@ -27,12 +27,17 @@ int GetLightingShaderId(u32* out)
|
||||
char *GenerateLightShader(char *p, int index, const LitChannel& chan, const char* lightsName, int coloralpha)
|
||||
{
|
||||
const char* swizzle = "xyzw";
|
||||
if (coloralpha == 1 ) swizzle = "xyz";
|
||||
else if (coloralpha == 2 ) swizzle = "w";
|
||||
|
||||
if (!(chan.attnfunc & 1)) {
|
||||
// atten disabled
|
||||
switch (chan.diffusefunc) {
|
||||
if (coloralpha == 1 )
|
||||
swizzle = "xyz";
|
||||
else if (coloralpha == 2 )
|
||||
swizzle = "w";
|
||||
|
||||
if (!(chan.attnfunc & 1))
|
||||
{
|
||||
// attenuation disabled
|
||||
switch (chan.diffusefunc)
|
||||
{
|
||||
case LIGHTDIF_NONE:
|
||||
WRITE(p, "lacc.%s += %s[%d].%s;\n", swizzle, lightsName, index * 5, swizzle);
|
||||
break;
|
||||
@@ -45,8 +50,8 @@ char *GenerateLightShader(char *p, int index, const LitChannel& chan, const char
|
||||
default: _assert_(0);
|
||||
}
|
||||
}
|
||||
else { // spec and spot
|
||||
|
||||
else // spec and spot
|
||||
{
|
||||
if (chan.attnfunc == 3)
|
||||
{ // spot
|
||||
WRITE(p, "ldir = %s[%d + 3].xyz - pos.xyz;\n", lightsName, index * 5);
|
||||
@@ -74,13 +79,13 @@ char *GenerateLightShader(char *p, int index, const LitChannel& chan, const char
|
||||
swizzle,
|
||||
chan.diffusefunc != LIGHTDIF_SIGN ? "max(0.0f," :"(",
|
||||
lightsName,
|
||||
index * 5,
|
||||
index * 5,
|
||||
swizzle);
|
||||
break;
|
||||
default: _assert_(0);
|
||||
}
|
||||
}
|
||||
WRITE(p, "\n");
|
||||
WRITE(p, "\n");
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -98,7 +103,8 @@ char *GenerateLightingShader(char *p, int components, const char* materialsName,
|
||||
|
||||
WRITE(p, "{\n");
|
||||
|
||||
if (color.matsource) {// from vertex
|
||||
if (color.matsource) // from vertex
|
||||
{
|
||||
if (components & (VB_HAS_COL0 << j))
|
||||
WRITE(p, "mat = %s%d;\n", inColorName, j);
|
||||
else if (components & VB_HAS_COL0)
|
||||
@@ -107,10 +113,14 @@ char *GenerateLightingShader(char *p, int components, const char* materialsName,
|
||||
WRITE(p, "mat = float4(1.0f, 1.0f, 1.0f, 1.0f);\n");
|
||||
}
|
||||
else // from color
|
||||
{
|
||||
WRITE(p, "mat = %s[%d];\n", materialsName, j+2);
|
||||
}
|
||||
|
||||
if (color.enablelighting) {
|
||||
if (color.ambsource) { // from vertex
|
||||
if (color.enablelighting)
|
||||
{
|
||||
if (color.ambsource) // from vertex
|
||||
{
|
||||
if (components & (VB_HAS_COL0<<j) )
|
||||
WRITE(p, "lacc = %s%d;\n", inColorName, j);
|
||||
else if (components & VB_HAS_COL0 )
|
||||
@@ -119,7 +129,9 @@ char *GenerateLightingShader(char *p, int components, const char* materialsName,
|
||||
WRITE(p, "lacc = float4(0.0f, 0.0f, 0.0f, 0.0f);\n");
|
||||
}
|
||||
else // from color
|
||||
{
|
||||
WRITE(p, "lacc = %s[%d];\n", materialsName, j);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -127,8 +139,10 @@ char *GenerateLightingShader(char *p, int components, const char* materialsName,
|
||||
}
|
||||
|
||||
// check if alpha is different
|
||||
if (alpha.matsource != color.matsource) {
|
||||
if (alpha.matsource) {// from vertex
|
||||
if (alpha.matsource != color.matsource)
|
||||
{
|
||||
if (alpha.matsource) // from vertex
|
||||
{
|
||||
if (components & (VB_HAS_COL0<<j))
|
||||
WRITE(p, "mat.w = %s%d.w;\n", inColorName, j);
|
||||
else if (components & VB_HAS_COL0)
|
||||
@@ -136,12 +150,15 @@ char *GenerateLightingShader(char *p, int components, const char* materialsName,
|
||||
else WRITE(p, "mat.w = 1.0f;\n");
|
||||
}
|
||||
else // from color
|
||||
{
|
||||
WRITE(p, "mat.w = %s[%d].w;\n", materialsName, j+2);
|
||||
}
|
||||
}
|
||||
|
||||
if (alpha.enablelighting)
|
||||
{
|
||||
if (alpha.ambsource) {// from vertex
|
||||
if (alpha.ambsource) // from vertex
|
||||
{
|
||||
if (components & (VB_HAS_COL0<<j) )
|
||||
WRITE(p, "lacc.w = %s%d.w;\n", inColorName, j);
|
||||
else if (components & VB_HAS_COL0 )
|
||||
@@ -150,12 +167,14 @@ char *GenerateLightingShader(char *p, int components, const char* materialsName,
|
||||
WRITE(p, "lacc.w = 0.0f;\n");
|
||||
}
|
||||
else // from color
|
||||
{
|
||||
WRITE(p, "lacc.w = %s[%d].w;\n", materialsName, j);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WRITE(p, "lacc.w = 1.0f;\n");
|
||||
}
|
||||
}
|
||||
|
||||
if(color.enablelighting && alpha.enablelighting)
|
||||
{
|
||||
|
||||
@@ -230,9 +230,13 @@ void VideoBackendHardware::DoState(PointerWrap& p)
|
||||
{
|
||||
bool software = false;
|
||||
p.Do(software);
|
||||
|
||||
if (p.GetMode() == PointerWrap::MODE_READ && software == true)
|
||||
{
|
||||
// change mode to abort load of incompatible save state.
|
||||
p.SetMode(PointerWrap::MODE_VERIFY);
|
||||
}
|
||||
|
||||
VideoCommon_DoState(p);
|
||||
p.DoMarker("VideoCommon");
|
||||
|
||||
@@ -255,7 +259,8 @@ void VideoBackendHardware::DoState(PointerWrap& p)
|
||||
}
|
||||
}
|
||||
|
||||
void VideoBackendHardware::CheckInvalidState() {
|
||||
void VideoBackendHardware::CheckInvalidState()
|
||||
{
|
||||
if (m_invalid)
|
||||
{
|
||||
m_invalid = false;
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
#include "Common.h"
|
||||
|
||||
// m_components
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
VB_HAS_POSMTXIDX =(1<<1),
|
||||
VB_HAS_TEXMTXIDX0=(1<<2),
|
||||
VB_HAS_TEXMTXIDX1=(1<<3),
|
||||
|
||||
@@ -19,7 +19,8 @@ namespace OSD
|
||||
struct MESSAGE
|
||||
{
|
||||
MESSAGE() {}
|
||||
MESSAGE(const char* p, u32 dw) {
|
||||
MESSAGE(const char* p, u32 dw)
|
||||
{
|
||||
strncpy(str, p, 255);
|
||||
str[255] = '\0';
|
||||
dwTimeStamp = dw;
|
||||
@@ -45,8 +46,10 @@ public:
|
||||
{
|
||||
m_functionptr(m_data);
|
||||
}
|
||||
|
||||
CallbackType Type() { return m_type; }
|
||||
};
|
||||
|
||||
std::vector<OSDCALLBACK> m_callbacks;
|
||||
static std::list<MESSAGE> s_listMsgs;
|
||||
|
||||
@@ -57,7 +60,8 @@ void AddMessage(const char* pstr, u32 ms)
|
||||
|
||||
void DrawMessages()
|
||||
{
|
||||
if(!SConfig::GetInstance().m_LocalCoreStartupParameter.bOnScreenDisplayMessages) return;
|
||||
if(!SConfig::GetInstance().m_LocalCoreStartupParameter.bOnScreenDisplayMessages)
|
||||
return;
|
||||
|
||||
if (s_listMsgs.size() > 0)
|
||||
{
|
||||
@@ -71,7 +75,8 @@ void DrawMessages()
|
||||
if (time_left < 1024)
|
||||
{
|
||||
alpha = time_left >> 2;
|
||||
if (time_left < 0) alpha = 0;
|
||||
if (time_left < 0)
|
||||
alpha = 0;
|
||||
}
|
||||
|
||||
alpha <<= 24;
|
||||
@@ -91,8 +96,11 @@ void DrawMessages()
|
||||
void ClearMessages()
|
||||
{
|
||||
std::list<MESSAGE>::iterator it = s_listMsgs.begin();
|
||||
while (it != s_listMsgs.end())
|
||||
|
||||
while (it != s_listMsgs.end())
|
||||
{
|
||||
it = s_listMsgs.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
// On-Screen Display Callbacks
|
||||
@@ -104,8 +112,10 @@ void AddCallback(CallbackType OnType, CallbackPtr FuncPtr, u32 UserData)
|
||||
void DoCallbacks(CallbackType OnType)
|
||||
{
|
||||
for (auto it = m_callbacks.begin(); it != m_callbacks.end(); ++it)
|
||||
{
|
||||
if (it->Type() == OnType)
|
||||
it->Call();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -61,7 +61,8 @@ static void StageHash(u32 stage, u32* out)
|
||||
out[3] |= bpmem.tevorders[stage/2].getEnable(stage&1);
|
||||
if (bpmem.tevorders[stage/2].getEnable(stage&1))
|
||||
{
|
||||
if (bHasIndStage) needstexcoord = true;
|
||||
if (bHasIndStage)
|
||||
needstexcoord = true;
|
||||
|
||||
out[0] |= bpmem.combiners[stage].alphaC.tswap;
|
||||
out[3] |= bpmem.tevksel[bpmem.combiners[stage].alphaC.tswap*2].swap1 << 1; // 2
|
||||
@@ -98,20 +99,27 @@ void GetPixelShaderId(PIXELSHADERUID *uid, DSTALPHA_MODE dstAlphaMode, u32 compo
|
||||
bool enablePL = g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting;
|
||||
uid->values[0] |= enablePL << 10; // 1
|
||||
|
||||
if (!enablePL) uid->values[0] |= xfregs.numTexGen.numTexGens << 11; // 4
|
||||
if (!enablePL)
|
||||
{
|
||||
uid->values[0] |= xfregs.numTexGen.numTexGens << 11; // 4
|
||||
}
|
||||
|
||||
AlphaTest::TEST_RESULT alphaPreTest = bpmem.alpha_test.TestResult();
|
||||
uid->values[0] |= alphaPreTest << 15; // 2
|
||||
|
||||
// numtexgens should be <= 8
|
||||
for (unsigned int i = 0; i < bpmem.genMode.numtexgens; ++i)
|
||||
{
|
||||
uid->values[0] |= xfregs.texMtxInfo[i].projection << (17+i); // 1
|
||||
}
|
||||
|
||||
uid->values[1] = bpmem.genMode.numindstages; // 3
|
||||
u32 indirectStagesUsed = 0;
|
||||
for (unsigned int i = 0; i < bpmem.genMode.numindstages; ++i)
|
||||
{
|
||||
if (bpmem.tevind[i].IsActive() && bpmem.tevind[i].bt < bpmem.genMode.numindstages)
|
||||
indirectStagesUsed |= (1 << bpmem.tevind[i].bt);
|
||||
}
|
||||
|
||||
assert(indirectStagesUsed == (indirectStagesUsed & 0xF));
|
||||
|
||||
@@ -255,7 +263,7 @@ void ValidatePixelShaderIDs(API_TYPE api, PIXELSHADERUIDSAFE old_id, const std::
|
||||
//
|
||||
// color for this stage (alpha, color) is given by bpmem.tevorders[0].colorchan0
|
||||
// konstant for this stage (alpha, color) is given by bpmem.tevksel
|
||||
// inputs are given by bpmem.combiners[0].colorC.a/b/c/d << could be current chan color
|
||||
// inputs are given by bpmem.combiners[0].colorC.a/b/c/d << could be current channel color
|
||||
// according to GXTevColorArg table above
|
||||
// output is given by .outreg
|
||||
// tevtemp is set according to swapmodetables and
|
||||
@@ -268,7 +276,7 @@ static void WriteFog(char *&p);
|
||||
|
||||
static const char *tevKSelTableC[] = // KCSEL
|
||||
{
|
||||
"1.0f,1.0f,1.0f", // 1 = 0x00
|
||||
"1.0f,1.0f,1.0f", // 1 = 0x00
|
||||
"0.875f,0.875f,0.875f", // 7_8 = 0x01
|
||||
"0.75f,0.75f,0.75f", // 3_4 = 0x02
|
||||
"0.625f,0.625f,0.625f", // 5_8 = 0x03
|
||||
@@ -407,7 +415,7 @@ static const char *tevAInputTable[] = // CA
|
||||
"rastemp", // RASA,
|
||||
"konsttemp", // KONST, (hw1 had quarter)
|
||||
"float4(0.0f, 0.0f, 0.0f, 0.0f)", // ZERO
|
||||
///aded extra values to map clamped values
|
||||
///added extra values to map clamped values
|
||||
"cprev", // APREV,
|
||||
"cc0", // A0,
|
||||
"cc1", // A1,
|
||||
@@ -827,7 +835,9 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType
|
||||
}
|
||||
|
||||
if (dstAlphaMode == DSTALPHA_ALPHA_PASS)
|
||||
{
|
||||
WRITE(p, "\tocol0 = float4(prev.rgb, " I_ALPHA"[0].a);\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteFog(p);
|
||||
@@ -959,10 +969,14 @@ static void WriteStage(char *&p, int n, API_TYPE ApiType)
|
||||
WRITE(p, "float2 indtevtrans%d = " I_INDTEXMTX"[%d].ww * uv%d.xy * indtevcrd%d.yy;\n", n, mtxidx, texcoord, n);
|
||||
}
|
||||
else
|
||||
{
|
||||
WRITE(p, "float2 indtevtrans%d = float2(0.0f, 0.0f);\n", n);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WRITE(p, "float2 indtevtrans%d = float2(0.0f, 0.0f);\n", n);
|
||||
}
|
||||
|
||||
// ---------
|
||||
// Wrapping
|
||||
@@ -1022,7 +1036,9 @@ static void WriteStage(char *&p, int n, API_TYPE ApiType)
|
||||
SampleTexture(p, "textemp", "tevcoord", texswap, texmap, ApiType);
|
||||
}
|
||||
else
|
||||
{
|
||||
WRITE(p, "textemp = float4(1.0f, 1.0f, 1.0f, 1.0f);\n");
|
||||
}
|
||||
|
||||
|
||||
if (cc.a == TEVCOLORARG_KONST || cc.b == TEVCOLORARG_KONST || cc.c == TEVCOLORARG_KONST || cc.d == TEVCOLORARG_KONST
|
||||
@@ -1226,14 +1242,14 @@ void SampleTexture(char *&p, const char *destination, const char *texcoords, con
|
||||
|
||||
static const char *tevAlphaFuncsTable[] =
|
||||
{
|
||||
"(false)", //ALPHACMP_NEVER 0
|
||||
"(prev.a <= %s - (0.25f/255.0f))", //ALPHACMP_LESS 1
|
||||
"(abs( prev.a - %s ) < (0.5f/255.0f))", //ALPHACMP_EQUAL 2
|
||||
"(prev.a < %s + (0.25f/255.0f))", //ALPHACMP_LEQUAL 3
|
||||
"(false)", //ALPHACMP_NEVER 0
|
||||
"(prev.a <= %s - (0.25f/255.0f))", //ALPHACMP_LESS 1
|
||||
"(abs( prev.a - %s ) < (0.5f/255.0f))", //ALPHACMP_EQUAL 2
|
||||
"(prev.a < %s + (0.25f/255.0f))", //ALPHACMP_LEQUAL 3
|
||||
"(prev.a >= %s + (0.25f/255.0f))", //ALPHACMP_GREATER 4
|
||||
"(abs( prev.a - %s ) >= (0.5f/255.0f))", //ALPHACMP_NEQUAL 5
|
||||
"(prev.a > %s - (0.25f/255.0f))", //ALPHACMP_GEQUAL 6
|
||||
"(true)" //ALPHACMP_ALWAYS 7
|
||||
"(abs( prev.a - %s ) >= (0.5f/255.0f))", //ALPHACMP_NEQUAL 5
|
||||
"(prev.a > %s - (0.25f/255.0f))", //ALPHACMP_GEQUAL 6
|
||||
"(true)" //ALPHACMP_ALWAYS 7
|
||||
};
|
||||
|
||||
static const char *tevAlphaFunclogicTable[] =
|
||||
@@ -1250,7 +1266,7 @@ static void WriteAlphaTest(char *&p, API_TYPE ApiType,DSTALPHA_MODE dstAlphaMode
|
||||
{
|
||||
I_ALPHA"[0].r",
|
||||
I_ALPHA"[0].g"
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// using discard then return works the same in cg and dx9 but not in dx11
|
||||
@@ -1275,7 +1291,7 @@ static void WriteAlphaTest(char *&p, API_TYPE ApiType,DSTALPHA_MODE dstAlphaMode
|
||||
// or after texturing and alpha test. PC GPUs have no way to support this
|
||||
// feature properly as of 2012: depth buffer and depth test are not
|
||||
// programmable and the depth test is always done after texturing.
|
||||
// Most importantly, PC GPUs do not allow writing to the z buffer without
|
||||
// Most importantly, PC GPUs do not allow writing to the z-buffer without
|
||||
// writing a color value (unless color writing is disabled altogether).
|
||||
// We implement "depth test before texturing" by discarding the fragment
|
||||
// when the alpha test fail. This is not a correct implementation because
|
||||
@@ -1293,14 +1309,14 @@ static void WriteAlphaTest(char *&p, API_TYPE ApiType,DSTALPHA_MODE dstAlphaMode
|
||||
|
||||
static const char *tevFogFuncsTable[] =
|
||||
{
|
||||
"", //No Fog
|
||||
"", //?
|
||||
"", //Linear
|
||||
"", //?
|
||||
"\tfog = 1.0f - pow(2.0f, -8.0f * fog);\n", //exp
|
||||
"\tfog = 1.0f - pow(2.0f, -8.0f * fog * fog);\n", //exp2
|
||||
"\tfog = pow(2.0f, -8.0f * (1.0f - fog));\n", //backward exp
|
||||
"\tfog = 1.0f - fog;\n fog = pow(2.0f, -8.0f * fog * fog);\n" //backward exp2
|
||||
"", // No Fog
|
||||
"", // ?
|
||||
"", // Linear
|
||||
"", // ?
|
||||
"\tfog = 1.0f - pow(2.0f, -8.0f * fog);\n", // exp
|
||||
"\tfog = 1.0f - pow(2.0f, -8.0f * fog * fog);\n", // exp2
|
||||
"\tfog = pow(2.0f, -8.0f * (1.0f - fog));\n", // backward exp
|
||||
"\tfog = 1.0f - fog;\n fog = pow(2.0f, -8.0f * fog * fog);\n" // backward exp2
|
||||
};
|
||||
|
||||
static void WriteFog(char *&p)
|
||||
|
||||
@@ -62,23 +62,30 @@ public:
|
||||
_PIXELSHADERUID(const _PIXELSHADERUID& r)
|
||||
{
|
||||
num_values = r.num_values;
|
||||
if (safe) memcpy(values, r.values, PIXELSHADERUID_MAX_VALUES_SAFE);
|
||||
else memcpy(values, r.values, r.GetNumValues() * sizeof(values[0]));
|
||||
|
||||
if (safe)
|
||||
memcpy(values, r.values, PIXELSHADERUID_MAX_VALUES_SAFE);
|
||||
else
|
||||
memcpy(values, r.values, r.GetNumValues() * sizeof(values[0]));
|
||||
}
|
||||
|
||||
int GetNumValues() const
|
||||
{
|
||||
if (safe) return (sizeof(values) / sizeof(u32));
|
||||
else return num_values;
|
||||
if (safe)
|
||||
return (sizeof(values) / sizeof(u32));
|
||||
else
|
||||
return num_values;
|
||||
}
|
||||
|
||||
bool operator <(const _PIXELSHADERUID& _Right) const
|
||||
{
|
||||
int N = GetNumValues();
|
||||
|
||||
if (N < _Right.GetNumValues())
|
||||
return true;
|
||||
else if (N > _Right.GetNumValues())
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < N; ++i)
|
||||
{
|
||||
if (values[i] < _Right.values[i])
|
||||
@@ -86,22 +93,27 @@ public:
|
||||
else if (values[i] > _Right.values[i])
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool operator ==(const _PIXELSHADERUID& _Right) const
|
||||
{
|
||||
int N = GetNumValues();
|
||||
|
||||
if (N != _Right.GetNumValues())
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < N; ++i)
|
||||
{
|
||||
if (values[i] != _Right.values[i])
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
typedef _PIXELSHADERUID<false> PIXELSHADERUID;
|
||||
typedef _PIXELSHADERUID<true> PIXELSHADERUIDSAFE;
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ void PixelShaderManager::SetConstants()
|
||||
{
|
||||
if (g_ActiveConfig.backend_info.APIType == API_OPENGL && !g_ActiveConfig.backend_info.bSupportsGLSLUBO)
|
||||
Dirty();
|
||||
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
if (s_nColorsChanged[i])
|
||||
@@ -158,8 +159,10 @@ void PixelShaderManager::SetConstants()
|
||||
SetPSConstant4fv(C_INDTEXSCALE, f);
|
||||
}
|
||||
|
||||
if (s_nIndTexScaleChanged & 0x0c) {
|
||||
for (u32 i = 2; i < 4; ++i) {
|
||||
if (s_nIndTexScaleChanged & 0x0c)
|
||||
{
|
||||
for (u32 i = 2; i < 4; ++i)
|
||||
{
|
||||
f[2 * i] = bpmem.texscale[1].getScaleS(i & 1);
|
||||
f[2 * i + 1] = bpmem.texscale[1].getScaleT(i & 1);
|
||||
PRIM_LOG("tex indscale%d: %f %f\n", i, f[2 * i], f[2 * i + 1]);
|
||||
@@ -243,7 +246,9 @@ void PixelShaderManager::SetConstants()
|
||||
SetPSConstant4f(C_FOG + 2, ScreenSpaceCenter, (float)Renderer::EFBToScaledX((int)(2.0f * xfregs.viewport.wd)), bpmem.fogRange.K[4].HI / 256.0f,0.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetPSConstant4f(C_FOG + 2, 0.0f, 1.0f, 1.0f, 0.0f); // Need to update these values for older hardware that fails to divide by zero in shaders.
|
||||
}
|
||||
|
||||
s_bFogRangeAdjustChanged = false;
|
||||
}
|
||||
@@ -279,7 +284,9 @@ void PixelShaderManager::SetConstants()
|
||||
SetPSConstant4f(C_PLIGHTS+5*i+j+1, 0.00001f, xfmemptr[1], xfmemptr[2], 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetPSConstant4fv(C_PLIGHTS+5*i+j+1, xfmemptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,17 +354,22 @@ void PixelShaderManager::SetPSTextureDims(int texid)
|
||||
void PixelShaderManager::SetColorChanged(int type, int num, bool high)
|
||||
{
|
||||
float *pf = &lastRGBAfull[type][num][0];
|
||||
if (!high) {
|
||||
|
||||
if (!high)
|
||||
{
|
||||
int r = bpmem.tevregs[num].low.a;
|
||||
int a = bpmem.tevregs[num].low.b;
|
||||
pf[0] = (float)r * (1.0f / 255.0f);
|
||||
pf[3] = (float)a * (1.0f / 255.0f);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
int b = bpmem.tevregs[num].high.a;
|
||||
int g = bpmem.tevregs[num].high.b;
|
||||
pf[1] = (float)g * (1.0f / 255.0f);
|
||||
pf[2] = (float)b * (1.0f / 255.0f);
|
||||
}
|
||||
|
||||
s_nColorsChanged[type] |= 1 << num;
|
||||
PRIM_LOG("pixel %scolor%d: %f %f %f %f\n", type?"k":"", num, pf[0], pf[1], pf[2], pf[3]);
|
||||
}
|
||||
|
||||
@@ -72,7 +72,8 @@ char *Statistics::ToString(char *ptr)
|
||||
}
|
||||
|
||||
// Is this really needed?
|
||||
char *Statistics::ToStringProj(char *ptr) {
|
||||
char *Statistics::ToStringProj(char *ptr)
|
||||
{
|
||||
char *p = ptr;
|
||||
p+=sprintf(p,"Projection #: X for Raw 6=0 (X for Raw 6!=0)\n\n");
|
||||
p+=sprintf(p,"Projection 0: %f (%f) Raw 0: %f\n", stats.gproj_0, stats.g2proj_0, stats.proj_0);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user