Merge 'master' into shader-uids-awesome.

Conflicts:
	Source/Core/VideoCommon/Src/BPMemory.h
	Source/Core/VideoCommon/Src/LightingShaderGen.cpp
	Source/Core/VideoCommon/Src/PixelShaderGen.cpp
	Source/Core/VideoCommon/Src/PixelShaderGen.h
	Source/Core/VideoCommon/Src/PixelShaderManager.cpp
	Source/Core/VideoCommon/Src/VertexShaderGen.cpp
	Source/Core/VideoCommon/Src/VertexShaderGen.h
This commit is contained in:
NeoBrainX
2013-04-25 14:01:07 +02:00
1227 changed files with 102349 additions and 86133 deletions

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#if defined(__FreeBSD__)
#define __STDC_CONSTANT_MACROS 1
@@ -102,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;

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _AVIDUMP_H
#define _AVIDUMP_H

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "BPFunctions.h"
#include "Common.h"

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
// ------------------------------------------

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "Common.h"
#include "BPMemory.h"

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _BPMEMORY_H
#define _BPMEMORY_H
@@ -100,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
@@ -149,27 +136,27 @@
#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 GX_TEVPREV 0
#define GX_TEVREG0 1
#define GX_TEVREG1 2
#define GX_TEVREG2 3
#define GX_TEVPREV 0
#define GX_TEVREG0 1
#define GX_TEVREG1 2
#define GX_TEVREG2 3
#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
{
@@ -331,26 +318,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)
@@ -384,7 +371,7 @@ struct TevStageCombiner
u32 unused : 11;
};
bool IsActive() { return (hex&0x17fe00)!=0; }
bool IsActive() { return (hex & 0x17fe00) != 0; }
};
union TwoTevStageOrders
@@ -482,7 +469,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;
};
@@ -560,14 +547,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];
};
@@ -626,6 +613,17 @@ union X10Y10
// Framebuffer/pixel stuff (incl fog)
#define GX_BL_ZERO 0
#define GX_BL_ONE 1
#define GX_BL_SRCCLR 2 // for dst factor
#define GX_BL_INVSRCCLR 3 // for dst factor
#define GX_BL_SRCALPHA 4
#define GX_BL_INVSRCALPHA 5
#define GX_BL_DSTALPHA 6
#define GX_BL_INVDSTALPHA 7
#define GX_BL_DSTCLR GX_BL_SRCCLR // for src factor
#define GX_BL_INVDSTCLR GX_BL_INVSRCCLR // for src factor
union BlendMode
{
struct
@@ -653,7 +651,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;
@@ -674,7 +673,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;
@@ -913,7 +913,8 @@ union UPE_Copy
union BPU_PreloadTileInfo
{
u32 hex;
struct {
struct
{
u32 count : 15;
u32 type : 2;
};

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <cmath>
@@ -115,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;
@@ -206,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();
@@ -426,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.
@@ -459,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
}

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _BPSTRUCTS_H_
#define _BPSTRUCTS_H_

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "Common.h"
#include "CPMemory.h"

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _CPMEMORY_H
#define _CPMEMORY_H
@@ -101,7 +88,9 @@ union TVtxDesc
u32 Tex7Coord : 2;
u32 :31;
};
struct {
struct
{
u32 Hex0, Hex1;
};
};

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "Common.h"
#include "VideoCommon.h"
@@ -80,9 +67,9 @@ void UpdateInterrupts_Wrapper(u64 userdata, int cyclesLate)
void DoState(PointerWrap &p)
{
p.Do(m_CPStatusReg);
p.Do(m_CPCtrlReg);
p.Do(m_CPClearReg);
p.DoPOD(m_CPStatusReg);
p.DoPOD(m_CPCtrlReg);
p.DoPOD(m_CPClearReg);
p.Do(m_bboxleft);
p.Do(m_bboxtop);
p.Do(m_bboxright);
@@ -128,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;
@@ -144,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)
@@ -152,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;
@@ -179,45 +166,53 @@ 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);
}
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);
}
DEBUG_LOG(COMMANDPROCESSOR, "Read FIFO_RW_DISTANCE_HI : %04x", _rReturnValue);
return;
case FIFO_WRITE_POINTER_LO:
_rReturnValue = ReadLow (fifo.CPWritePointer);
DEBUG_LOG(COMMANDPROCESSOR, "read FIFO_WRITE_POINTER_LO : %04x", _rReturnValue);
DEBUG_LOG(COMMANDPROCESSOR, "Read FIFO_WRITE_POINTER_LO : %04x", _rReturnValue);
return;
case FIFO_WRITE_POINTER_HI:
_rReturnValue = ReadHigh(fifo.CPWritePointer);
DEBUG_LOG(COMMANDPROCESSOR, "read FIFO_WRITE_POINTER_HI : %04x", _rReturnValue);
DEBUG_LOG(COMMANDPROCESSOR, "Read FIFO_WRITE_POINTER_HI : %04x", _rReturnValue);
return;
case FIFO_READ_POINTER_LO:
if (IsOnThread())
_rReturnValue = ReadLow (fifo.SafeCPReadPointer);
else
_rReturnValue = ReadLow (fifo.CPReadPointer);
DEBUG_LOG(COMMANDPROCESSOR, "read FIFO_READ_POINTER_LO : %04x", _rReturnValue);
DEBUG_LOG(COMMANDPROCESSOR, "Read FIFO_READ_POINTER_LO : %04x", _rReturnValue);
return;
case FIFO_READ_POINTER_HI:
if (IsOnThread())
_rReturnValue = ReadHigh (fifo.SafeCPReadPointer);
else
_rReturnValue = ReadHigh (fifo.CPReadPointer);
DEBUG_LOG(COMMANDPROCESSOR, "read FIFO_READ_POINTER_HI : %04x", _rReturnValue);
DEBUG_LOG(COMMANDPROCESSOR, "Read FIFO_READ_POINTER_HI : %04x", _rReturnValue);
return;
case FIFO_BP_LO: _rReturnValue = ReadLow (fifo.CPBreakpoint); return;
@@ -326,83 +321,83 @@ void Write16(const u16 _Value, const u32 _Address)
{
UCPClearReg tmpCtrl(_Value);
m_CPClearReg.Hex = tmpCtrl.Hex;
DEBUG_LOG(COMMANDPROCESSOR,"\t write to CLEAR_REGISTER : %04x", _Value);
DEBUG_LOG(COMMANDPROCESSOR,"\t Write to CLEAR_REGISTER : %04x", _Value);
SetCpClearRegister();
}
break;
case PERF_SELECT:
// Seems to select which set of perf registers should be exposed.
DEBUG_LOG(COMMANDPROCESSOR, "write to PERF_SELECT: %04x", _Value);
DEBUG_LOG(COMMANDPROCESSOR, "Write to PERF_SELECT: %04x", _Value);
break;
// Fifo Registers
case FIFO_TOKEN_REGISTER:
m_tokenReg = _Value;
DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_TOKEN_REGISTER : %04x", _Value);
DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_TOKEN_REGISTER : %04x", _Value);
break;
case FIFO_BASE_LO:
WriteLow ((u32 &)fifo.CPBase, _Value & 0xFFE0);
DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_BASE_LO : %04x", _Value);
DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_BASE_LO : %04x", _Value);
break;
case FIFO_BASE_HI:
WriteHigh((u32 &)fifo.CPBase, _Value);
DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_BASE_HI : %04x", _Value);
DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_BASE_HI : %04x", _Value);
break;
case FIFO_END_LO:
WriteLow ((u32 &)fifo.CPEnd, _Value & 0xFFE0);
DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_END_LO : %04x", _Value);
DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_END_LO : %04x", _Value);
break;
case FIFO_END_HI:
WriteHigh((u32 &)fifo.CPEnd, _Value);
DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_END_HI : %04x", _Value);
DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_END_HI : %04x", _Value);
break;
case FIFO_WRITE_POINTER_LO:
WriteLow ((u32 &)fifo.CPWritePointer, _Value & 0xFFE0);
DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_WRITE_POINTER_LO : %04x", _Value);
DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_WRITE_POINTER_LO : %04x", _Value);
break;
case FIFO_WRITE_POINTER_HI:
WriteHigh((u32 &)fifo.CPWritePointer, _Value);
DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_WRITE_POINTER_HI : %04x", _Value);
DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_WRITE_POINTER_HI : %04x", _Value);
break;
case FIFO_READ_POINTER_LO:
WriteLow ((u32 &)fifo.CPReadPointer, _Value & 0xFFE0);
DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_READ_POINTER_LO : %04x", _Value);
DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_READ_POINTER_LO : %04x", _Value);
break;
case FIFO_READ_POINTER_HI:
WriteHigh((u32 &)fifo.CPReadPointer, _Value);
fifo.SafeCPReadPointer = fifo.CPReadPointer;
DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_READ_POINTER_HI : %04x", _Value);
DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_READ_POINTER_HI : %04x", _Value);
break;
case FIFO_HI_WATERMARK_LO:
WriteLow ((u32 &)fifo.CPHiWatermark, _Value);
DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_HI_WATERMARK_LO : %04x", _Value);
DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_HI_WATERMARK_LO : %04x", _Value);
break;
case FIFO_HI_WATERMARK_HI:
WriteHigh((u32 &)fifo.CPHiWatermark, _Value);
DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_HI_WATERMARK_HI : %04x", _Value);
DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_HI_WATERMARK_HI : %04x", _Value);
break;
case FIFO_LO_WATERMARK_LO:
WriteLow ((u32 &)fifo.CPLoWatermark, _Value);
DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_LO_WATERMARK_LO : %04x", _Value);
DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_LO_WATERMARK_LO : %04x", _Value);
break;
case FIFO_LO_WATERMARK_HI:
WriteHigh((u32 &)fifo.CPLoWatermark, _Value);
DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_LO_WATERMARK_HI : %04x", _Value);
DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_LO_WATERMARK_HI : %04x", _Value);
break;
case FIFO_BP_LO:
WriteLow ((u32 &)fifo.CPBreakpoint, _Value & 0xFFE0);
DEBUG_LOG(COMMANDPROCESSOR,"write to FIFO_BP_LO : %04x", _Value);
DEBUG_LOG(COMMANDPROCESSOR,"Write to FIFO_BP_LO : %04x", _Value);
break;
case FIFO_BP_HI:
WriteHigh((u32 &)fifo.CPBreakpoint, _Value);
DEBUG_LOG(COMMANDPROCESSOR,"write to FIFO_BP_HI : %04x", _Value);
DEBUG_LOG(COMMANDPROCESSOR,"Write to FIFO_BP_HI : %04x", _Value);
break;
case FIFO_RW_DISTANCE_HI:
@@ -417,11 +412,11 @@ void Write16(const u16 _Value, const u32 _Address)
ResetVideoBuffer();
}
IncrementCheckContextId();
DEBUG_LOG(COMMANDPROCESSOR,"try to write to FIFO_RW_DISTANCE_HI : %04x", _Value);
DEBUG_LOG(COMMANDPROCESSOR,"Try to write to FIFO_RW_DISTANCE_HI : %04x", _Value);
break;
case FIFO_RW_DISTANCE_LO:
WriteLow((u32 &)fifo.CPReadWriteDistance, _Value & 0xFFE0);
DEBUG_LOG(COMMANDPROCESSOR,"try to write to FIFO_RW_DISTANCE_LO : %04x", _Value);
DEBUG_LOG(COMMANDPROCESSOR,"Try to write to FIFO_RW_DISTANCE_LO : %04x", _Value);
break;
default:
@@ -450,10 +445,12 @@ 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.
// In multibuffer mode is not allowed write in the same FIFO attached to the GPU.
// Fix Pokemon XD in DC mode.
if((ProcessorInterface::Fifo_CPUEnd == fifo.CPEnd) && (ProcessorInterface::Fifo_CPUBase == fifo.CPBase)
&& fifo.CPReadWriteDistance > 0)
@@ -469,7 +466,7 @@ void STACKALIGN GatherPipeBursted()
if (IsOnThread())
SetCpStatus(true);
// update the fifo-pointer
// update the fifo pointer
if (fifo.CPWritePointer >= fifo.CPEnd)
fifo.CPWritePointer = fifo.CPBase;
else
@@ -480,8 +477,8 @@ void STACKALIGN GatherPipeBursted()
if (!IsOnThread())
RunGpu();
_assert_msg_(COMMANDPROCESSOR, fifo.CPReadWriteDistance <= fifo.CPEnd - fifo.CPBase,
"FIFO is overflown by GatherPipe !\nCPU thread is too fast!");
_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
_assert_msg_(COMMANDPROCESSOR, fifo.CPWritePointer == ProcessorInterface::Fifo_CPUWritePointer, "FIFOs linked but out of sync");
@@ -495,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;
}
@@ -523,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)
@@ -584,7 +581,9 @@ void SetCpStatus(bool isCPUThread)
}
}
else
{
CommandProcessor::UpdateInterrupts(userdata);
}
}
}

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _COMMANDPROCESSOR_H
#define _COMMANDPROCESSOR_H
@@ -88,7 +75,7 @@ enum
enum
{
GATHER_PIPE_SIZE = 32,
INT_CAUSE_CP = 0x800
INT_CAUSE_CP = 0x800
};
// Fifo Status Register

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _DLCACHE_H
#define _DLCACHE_H

View File

@@ -1,21 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _DATAREADER_H
#define _DATAREADER_H

View File

@@ -1,20 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "IniFile.h"
#include "Debugger.h"

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _GFX_DEBUGGER_H_
#define _GFX_DEBUGGER_H_

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <windows.h>
@@ -81,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:
@@ -112,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;
@@ -173,8 +163,8 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
s_sizing = false;
break;
/* Post the mouse events to the main window, it's nessesary because in difference to the
keyboard inputs these events only appear here, not in the parent window or any other WndProc()*/
/* Post the mouse events to the main window, it's necessary, because the difference between the
keyboard inputs is that these events only appear here, not in the parent window or any other WndProc()*/
case WM_LBUTTONDOWN:
if(g_ActiveConfig.backend_info.bSupports3DVision && g_ActiveConfig.b3DVision)
{
@@ -247,7 +237,7 @@ void OSDMenu(WPARAM wParam)
OSDChoice = 1;
// Toggle native resolution
g_Config.iEFBScale = g_Config.iEFBScale + 1;
if (g_Config.iEFBScale > 7) g_Config.iEFBScale = 0;
if (g_Config.iEFBScale > SCALE_4X) g_Config.iEFBScale = SCALE_AUTO;
break;
case '4':
OSDChoice = 2;

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "FPSCounter.h"
#include "FileUtil.h"

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _FPS_COUNTER_H_
#define _FPS_COUNTER_H_

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "VideoConfig.h"
#include "MemoryUtil.h"
@@ -125,7 +112,7 @@ void ReadDataFromFifo(u8* _uData, u32 len)
size -= pos;
if (size + len > FIFO_SIZE)
{
PanicAlert("FIFO out of bounds (sz = %i, len = %i at %08x)", size, len, pos);
PanicAlert("FIFO out of bounds (size = %i, len = %i at %08x)", size, len, pos);
}
memmove(&videoBuffer[0], &videoBuffer[pos], size);
g_pVideoData = videoBuffer;
@@ -164,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;
@@ -174,11 +162,13 @@ 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 instabilty in the game. Please report it.", fifo.CPReadWriteDistance - 32);
"Negative fifo.CPReadWriteDistance = %i in FIFO Loop !\nThat can produce instability in the game. Please report it.", fifo.CPReadWriteDistance - 32);
ReadDataFromFifo(uData, 32);
@@ -249,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;
}

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _FIFO_H
#define _FIFO_H

View File

@@ -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();
}
}

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "HiresTextures.h"
@@ -148,7 +135,7 @@ PC_TexFormat GetHiresTex(const char *fileName, unsigned int *pWidth, unsigned in
break;
}
INFO_LOG(VIDEO, "loading custom texture from %s", textureMap[key].c_str());
INFO_LOG(VIDEO, "Loading custom texture from %s", textureMap[key].c_str());
cleanup:
SOIL_free_image_data(temp);
return returnTex;

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _HIRESTEXTURES_H
#define _HIRESTEXTURES_H

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <list>
#include <vector>

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _IMAGEWRITE_H
#define _IMAGEWRITE_H

View File

@@ -1,34 +1,13 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <cstddef>
#include "Common.h"
#include "VideoConfig.h"
#include "IndexGenerator.h"
/*
*
QUAD simulator
0 1 4 5
3 2 7 6
012023 147172 ...
*/
//Init
u16 *IndexGenerator::Tptr;
u16 *IndexGenerator::BASETptr;
@@ -41,6 +20,32 @@ u32 IndexGenerator::numL;
u32 IndexGenerator::numP;
u32 IndexGenerator::index;
static const u16 s_primitive_restart = -1;
static void (*primitive_table[8])(u32);
void IndexGenerator::Init()
{
if(g_Config.backend_info.bSupportsPrimitiveRestart)
{
primitive_table[0] = IndexGenerator::AddQuads<true>;
primitive_table[2] = IndexGenerator::AddList<true>;
primitive_table[3] = IndexGenerator::AddStrip<true>;
primitive_table[4] = IndexGenerator::AddFan<true>;
}
else
{
primitive_table[0] = IndexGenerator::AddQuads<false>;
primitive_table[2] = IndexGenerator::AddList<false>;
primitive_table[3] = IndexGenerator::AddStrip<false>;
primitive_table[4] = IndexGenerator::AddFan<false>;
}
primitive_table[1] = NULL;
primitive_table[5] = &IndexGenerator::AddLineList;
primitive_table[6] = &IndexGenerator::AddLineStrip;
primitive_table[7] = &IndexGenerator::AddPoints;
}
void IndexGenerator::Start(u16* Triangleptr, u16* Lineptr, u16* Pointptr)
{
Tptr = Triangleptr;
@@ -57,81 +62,161 @@ void IndexGenerator::Start(u16* Triangleptr, u16* Lineptr, u16* Pointptr)
void IndexGenerator::AddIndices(int primitive, u32 numVerts)
{
//switch (primitive)
//{
//case GX_DRAW_QUADS: IndexGenerator::AddQuads(numVerts); break;
//case GX_DRAW_TRIANGLES: IndexGenerator::AddList(numVerts); break;
//case GX_DRAW_TRIANGLE_STRIP: IndexGenerator::AddStrip(numVerts); break;
//case GX_DRAW_TRIANGLE_FAN: IndexGenerator::AddFan(numVerts); break;
//case GX_DRAW_LINES: IndexGenerator::AddLineList(numVerts); break;
//case GX_DRAW_LINE_STRIP: IndexGenerator::AddLineStrip(numVerts); break;
//case GX_DRAW_POINTS: IndexGenerator::AddPoints(numVerts); break;
//}
static void (*const primitive_table[])(u32) =
{
IndexGenerator::AddQuads,
NULL,
IndexGenerator::AddList,
IndexGenerator::AddStrip,
IndexGenerator::AddFan,
IndexGenerator::AddLineList,
IndexGenerator::AddLineStrip,
IndexGenerator::AddPoints,
};
primitive_table[primitive](numVerts);
index += numVerts;
}
// Triangles
__forceinline void IndexGenerator::WriteTriangle(u32 index1, u32 index2, u32 index3)
template <bool pr> __forceinline void IndexGenerator::WriteTriangle(u32 index1, u32 index2, u32 index3)
{
*Tptr++ = index1;
*Tptr++ = index2;
*Tptr++ = index3;
if(pr)
*Tptr++ = s_primitive_restart;
++numT;
}
void IndexGenerator::AddList(u32 const numVerts)
template <bool pr> void IndexGenerator::AddList(u32 const numVerts)
{
auto const numTris = numVerts / 3;
for (u32 i = 0; i != numTris; ++i)
{
WriteTriangle(index + i * 3, index + i * 3 + 1, index + i * 3 + 2);
WriteTriangle<pr>(index + i * 3, index + i * 3 + 1, index + i * 3 + 2);
}
u32 remainingVerts = numVerts - numTris*3;
if(remainingVerts)
ERROR_LOG(VIDEO, "AddList: unknown count of vertices found");
}
void IndexGenerator::AddStrip(u32 const numVerts)
template <bool pr> void IndexGenerator::AddStrip(u32 const numVerts)
{
bool wind = false;
for (u32 i = 2; i < numVerts; ++i)
if(pr)
{
WriteTriangle(
index + i - 2,
index + i - !wind,
index + i - wind);
for (u32 i = 0; i < numVerts; ++i)
{
*Tptr++ = index + i;
}
*Tptr++ = s_primitive_restart;
numT += numVerts - 2;
}
else
{
bool wind = false;
for (u32 i = 2; i < numVerts; ++i)
{
WriteTriangle<pr>(
index + i - 2,
index + i - !wind,
index + i - wind);
wind ^= true;
wind ^= true;
}
}
}
void IndexGenerator::AddFan(u32 numVerts)
/**
* FAN simulator:
*
* 2---3
* / \ / \
* 1---0---4
*
* would generate this triangles:
* 012, 023, 034
*
* rotated (for better striping):
* 120, 302, 034
*
* as odd ones have to winded, following strip is fine:
* 12034
*
* so we use 6 indices for 3 triangles
*/
template <bool pr> void IndexGenerator::AddFan(u32 numVerts)
{
for (u32 i = 2; i < numVerts; ++i)
u32 i = 2;
if(pr)
{
WriteTriangle(index, index + i - 1, index + i);
for(; i<=numVerts-3; i+=3)
{
*Tptr++ = index + i - 1;
*Tptr++ = index + i + 0;
*Tptr++ = index;
*Tptr++ = index + i + 1;
*Tptr++ = index + i + 2;
*Tptr++ = s_primitive_restart;
numT += 3;
}
for(; i<=numVerts-2; i+=2)
{
*Tptr++ = index + i - 1;
*Tptr++ = index + i + 0;
*Tptr++ = index;
*Tptr++ = index + i + 1;
*Tptr++ = s_primitive_restart;
numT += 2;
}
}
for (; i < numVerts; ++i)
{
WriteTriangle<pr>(index, index + i - 1, index + i);
}
}
void IndexGenerator::AddQuads(u32 numVerts)
/*
* QUAD simulator
*
* 0---1 4---5
* |\ | |\ |
* | \ | | \ |
* | \| | \|
* 3---2 7---6
*
* 012,023, 456,467 ...
* or 120,302, 564,746
* or as strip: 1203, 5647
*
* Warning:
* A simple triangle has to be rendered for three vertices.
* ZWW do this for sun rays
*/
template <bool pr> void IndexGenerator::AddQuads(u32 numVerts)
{
auto const numQuads = numVerts / 4;
for (u32 i = 0; i != numQuads; ++i)
{
WriteTriangle(index + i * 4, index + i * 4 + 1, index + i * 4 + 2);
WriteTriangle(index + i * 4, index + i * 4 + 2, index + i * 4 + 3);
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
{
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)
{
WriteTriangle<pr>(index+numVerts-3, index+numVerts-2, index+numVerts-1);
}
else if(remainingVerts)
{
ERROR_LOG(VIDEO, "AddQuads: unknown count of vertices found");
}
}
@@ -145,8 +230,14 @@ void IndexGenerator::AddLineList(u32 numVerts)
*Lptr++ = index + i * 2 + 1;
++numL;
}
u32 remainingVerts = numVerts - numLines*2;
if(remainingVerts)
ERROR_LOG(VIDEO, "AddLineList: unknown count of vertices found");
}
// shouldn't be used as strips as LineLists are much more common
// so converting them to lists
void IndexGenerator::AddLineStrip(u32 numVerts)
{
for (u32 i = 1; i < numVerts; ++i)
@@ -170,6 +261,6 @@ void IndexGenerator::AddPoints(u32 numVerts)
u32 IndexGenerator::GetRemainingIndices()
{
u32 max_index = 65535;
u32 max_index = 65534; // -1 is reserved for primitive restart (ogl + dx11)
return max_index - index;
}

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
// This is currently only used by the DX backend, but it may make sense to
// use it in the GL backend or a future DX10 backend too.
@@ -26,6 +13,7 @@ class IndexGenerator
{
public:
// Init
static void Init();
static void Start(u16 *Triangleptr,u16 *Lineptr,u16 *Pointptr);
static void AddIndices(int primitive, u32 numVertices);
@@ -54,10 +42,10 @@ public:
*/
private:
// Triangles
static void AddList(u32 numVerts);
static void AddStrip(u32 numVerts);
static void AddFan(u32 numVerts);
static void AddQuads(u32 numVerts);
template <bool pr> static void AddList(u32 numVerts);
template <bool pr> static void AddStrip(u32 numVerts);
template <bool pr> static void AddFan(u32 numVerts);
template <bool pr> static void AddQuads(u32 numVerts);
// Lines
static void AddLineList(u32 numVerts);
@@ -66,7 +54,7 @@ private:
// Points
static void AddPoints(u32 numVerts);
static void WriteTriangle(u32 index1, u32 index2, u32 index3);
template <bool pr> static void WriteTriangle(u32 index1, u32 index2, u32 index3);
static u16 *Tptr;
static u16 *BASETptr;

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "LightingShaderGen.h"
#include "NativeVertexFormat.h"

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _LIGHTINGSHADERGEN_H_
#define _LIGHTINGSHADERGEN_H_
@@ -62,14 +49,18 @@ static void GenerateLightShader(T& object, LightingUidData& uid_data, int index,
{
const LitChannel& chan = (litchan_index > 1) ? xfregs.alpha[litchan_index-2] : xfregs.color[litchan_index];
const char* swizzle = "xyzw";
if (coloralpha == 1 ) swizzle = "xyz";
else if (coloralpha == 2 ) swizzle = "w";
if (coloralpha == 1)
swizzle = "xyz";
else if (coloralpha == 2)
swizzle = "w";
uid_data.lit_chans[litchan_index].attnfunc = chan.attnfunc;
uid_data.lit_chans[litchan_index].diffusefunc = chan.diffusefunc;
if (!(chan.attnfunc & 1)) {
if (!(chan.attnfunc & 1))
{
// atten disabled
switch (chan.diffusefunc) {
switch (chan.diffusefunc)
{
case LIGHTDIF_NONE:
object.Write("lacc.%s += %s;\n", swizzle, LightCol(lightsName, index, swizzle));
break;
@@ -82,8 +73,8 @@ static void GenerateLightShader(T& object, LightingUidData& uid_data, int index,
default: _assert_(0);
}
}
else { // spec and spot
else // spec and spot
{
if (chan.attnfunc == 3)
{ // spot
object.Write("ldir = %s.xyz - pos.xyz;\n", LightPos(lightsName, index));
@@ -134,7 +125,8 @@ static void GenerateLightingShader(T& object, LightingUidData& uid_data, int com
object.Write("{\n");
uid_data.lit_chans[j].matsource = xfregs.color[j].matsource;
if (color.matsource) {// from vertex
if (color.matsource) // from vertex
{
if (components & (VB_HAS_COL0 << j))
object.Write("mat = %s%d;\n", inColorName, j);
else if (components & VB_HAS_COL0)
@@ -143,12 +135,16 @@ static void GenerateLightingShader(T& object, LightingUidData& uid_data, int com
object.Write("mat = float4(1.0f, 1.0f, 1.0f, 1.0f);\n");
}
else // from color
{
object.Write("mat = %s[%d];\n", materialsName, j+2);
}
uid_data.lit_chans[j].enablelighting = xfregs.color[j].enablelighting;
if (color.enablelighting) {
if (color.enablelighting)
{
uid_data.lit_chans[j].ambsource = xfregs.color[j].ambsource;
if (color.ambsource) { // from vertex
if (color.ambsource) // from vertex
{
if (components & (VB_HAS_COL0<<j) )
object.Write("lacc = %s%d;\n", inColorName, j);
else if (components & VB_HAS_COL0 )
@@ -157,7 +153,9 @@ static void GenerateLightingShader(T& object, LightingUidData& uid_data, int com
object.Write("lacc = float4(0.0f, 0.0f, 0.0f, 0.0f);\n");
}
else // from color
{
object.Write("lacc = %s[%d];\n", materialsName, j);
}
}
else
{
@@ -166,8 +164,10 @@ static void GenerateLightingShader(T& object, LightingUidData& uid_data, int com
// check if alpha is different
uid_data.lit_chans[j+2].matsource = xfregs.alpha[j].matsource;
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))
object.Write("mat.w = %s%d.w;\n", inColorName, j);
else if (components & VB_HAS_COL0)
@@ -175,14 +175,17 @@ static void GenerateLightingShader(T& object, LightingUidData& uid_data, int com
else object.Write("mat.w = 1.0f;\n");
}
else // from color
{
object.Write("mat.w = %s[%d].w;\n", materialsName, j+2);
}
}
uid_data.lit_chans[j+2].enablelighting = xfregs.alpha[j].enablelighting;
if (alpha.enablelighting)
{
uid_data.lit_chans[j+2].ambsource = xfregs.alpha[j].ambsource;
if (alpha.ambsource) {// from vertex
if (alpha.ambsource) // from vertex
{
if (components & (VB_HAS_COL0<<j) )
object.Write("lacc.w = %s%d.w;\n", inColorName, j);
else if (components & VB_HAS_COL0 )
@@ -191,7 +194,9 @@ static void GenerateLightingShader(T& object, LightingUidData& uid_data, int com
object.Write("lacc.w = 0.0f;\n");
}
else // from color
{
object.Write("lacc.w = %s[%d].w;\n", materialsName, j);
}
}
else
{

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _LOOKUPTABLES_H
#define _LOOKUPTABLES_H

View File

@@ -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;

View File

@@ -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),

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <list>
@@ -24,13 +11,16 @@
#include "RenderBase.h"
#include "Timer.h"
#include <vector>
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;
@@ -39,6 +29,28 @@ struct MESSAGE
u32 dwTimeStamp;
};
class OSDCALLBACK
{
private:
CallbackPtr m_functionptr;
CallbackType m_type;
u32 m_data;
public:
OSDCALLBACK(CallbackType OnType, CallbackPtr FuncPtr, u32 UserData)
{
m_type = OnType;
m_functionptr = FuncPtr;
m_data = UserData;
}
void Call()
{
m_functionptr(m_data);
}
CallbackType Type() { return m_type; }
};
std::vector<OSDCALLBACK> m_callbacks;
static std::list<MESSAGE> s_listMsgs;
void AddMessage(const char* pstr, u32 ms)
@@ -48,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)
{
@@ -62,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;
@@ -82,8 +96,26 @@ 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
void AddCallback(CallbackType OnType, CallbackPtr FuncPtr, u32 UserData)
{
m_callbacks.push_back(OSDCALLBACK(OnType, FuncPtr, UserData));
}
void DoCallbacks(CallbackType OnType)
{
for (auto it = m_callbacks.begin(); it != m_callbacks.end(); ++it)
{
if (it->Type() == OnType)
it->Call();
}
}
} // namespace

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _OSD_H_
#define _OSD_H_
@@ -26,6 +13,18 @@ void AddMessage(const char* str, u32 ms = 2000);
void DrawMessages(); // draw the current messages on the screen. Only call once per frame.
void ClearMessages();
// On-screen callbacks
enum CallbackType
{
OSD_INIT = 0,
OSD_ONFRAME,
OSD_SHUTDOWN
};
typedef void(*CallbackPtr)(u32);
void AddCallback(CallbackType OnType, CallbackPtr FuncPtr, u32 UserData);
void DoCallbacks(CallbackType OnType);
} // namespace
#endif // _OSD_H_

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
//DL facts:
// Ikaruga uses (nearly) NO display lists!

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _OPCODE_DECODING_H
#define _OPCODE_DECODING_H
@@ -44,7 +31,7 @@
#define GX_DRAW_LINES 0x5 // 0xA8
#define GX_DRAW_LINE_STRIP 0x6 // 0xB0
#define GX_DRAW_POINTS 0x7 // 0xB8
#define GX_DRAW_NONE 0x1; //Tis is a fake value to used in the backends
#define GX_DRAW_NONE 0x1; // This is a fake value to used in the backends
extern bool g_bRecordFifoData;

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
// TODO: Make a more centralized version of this (for now every backend that will use it will create its own context, which is weird). An object maybe?

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef __OPENCL_H__
#define __OPENCL_H__

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "OCLTextureDecoder.h"

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef OPENCL_TEXTURE_DECODER
#define OPENCL_TEXTURE_DECODER

View File

@@ -1,25 +1,11 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
// http://developer.nvidia.com/object/General_FAQ.html#t6 !!!!!
#include "Common.h"
#include "VideoCommon.h"
#include "ChunkFile.h"
@@ -137,7 +123,7 @@ void DoState(PointerWrap &p)
p.Do(m_DstAlphaConf);
p.Do(m_AlphaModeConf);
p.Do(m_AlphaRead);
p.Do(m_Control);
p.DoPOD(m_Control);
p.Do(g_bSignalTokenInterrupt);
p.Do(g_bSignalFinishInterrupt);
@@ -464,7 +450,7 @@ void SetFinish()
void ResetSetFinish()
{
//if SetFinish happened but PE_CTRL_REGISTER not, I reset the interrupt else
//remove event from the queque
//remove event from the queue
if (g_bSignalFinishInterrupt)
{
UpdateFinishInterrupt(false);

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _PIXELENGINE_H
#define _PIXELENGINE_H

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <stdio.h>
#include <cmath>
@@ -32,7 +19,7 @@
//
// 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
@@ -44,7 +31,7 @@ template<class T> static void WriteFog(T& out, pixel_shader_uid_data& uid_data);
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
@@ -153,7 +140,7 @@ static const char *tevCInputTable[] = // CC
"float3(0.5f, 0.5f, 0.5f)", // HALF
"(konsttemp.rgb)", //"konsttemp.rgb", // KONST
"float3(0.0f, 0.0f, 0.0f)", // ZERO
///aded extra values to map clamped values
///added extra values to map clamped values
"(cprev.rgb)", // CPREV,
"(cprev.aaa)", // APREV,
"(cc0.rgb)", // C0,
@@ -183,7 +170,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,
@@ -346,10 +333,10 @@ void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType, u
if (ApiType == API_OPENGL)
{
out.Write("out float4 ocol0;\n");
out.Write("COLOROUT(ocol0);\n");
if (dstAlphaMode == DSTALPHA_DUAL_SOURCE_BLEND)
out.Write("out float4 ocol1;\n");
out.Write("COLOROUT(ocol1);\n");
if (per_pixel_depth)
out.Write("#define depth gl_FragDepth\n");
out.Write("float4 rawpos = gl_FragCoord;\n");
@@ -416,17 +403,20 @@ void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType, u
per_pixel_depth ? "\n out float depth : SV_Depth," : "");
}
out.Write(" in float4 colors_0 : COLOR0,\n");
out.Write(" in float4 colors_1 : COLOR1");
// "centroid" attribute is only supported by D3D11
const char* optCentroid = (ApiType == API_D3D11 ? "centroid" : "");
out.Write(" in %s float4 colors_0 : COLOR0,\n", optCentroid);
out.Write(" in %s float4 colors_1 : COLOR1", optCentroid);
// compute window position if needed because binding semantic WPOS is not widely supported
if (numTexgen < 7)
{
for (unsigned int i = 0; i < numTexgen; ++i)
out.Write(",\n in float3 uv%d : TEXCOORD%d", i, i);
out.Write(",\n in float4 clipPos : TEXCOORD%d", numTexgen);
for (int i = 0; i < numTexgen; ++i)
out.Write(",\n in %s float3 uv%d : TEXCOORD%d", optCentroid, i, i);
out.Write(",\n in %s float4 clipPos : TEXCOORD%d", optCentroid, numTexgen);
if(g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
out.Write(",\n in float4 Normal : TEXCOORD%d", numTexgen + 1);
out.Write(",\n in %s float4 Normal : TEXCOORD%d", optCentroid, numTexgen + 1);
out.Write(" ) {\n");
}
else
@@ -629,17 +619,25 @@ void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType, u
out.Write("\tocol0 = prev;\n");
}
// On D3D11, use dual-source color blending to perform dst alpha in a
// single pass
// Use dual-source color blending to perform dst alpha in a single pass
if (dstAlphaMode == DSTALPHA_DUAL_SOURCE_BLEND)
{
out.SetConstantsUsed(C_ALPHA, C_ALPHA);
// Colors will be blended against the alpha from ocol1...
out.Write("\tocol1 = prev;\n");
if(ApiType & API_D3D9)
{
// alpha component must be 0 or the shader will not compile (Direct3D 9Ex restriction)
// Colors will be blended against the color from ocol1 in D3D 9...
out.Write("\tocol1 = float4(prev.a, prev.a, prev.a, 0.0f);\n");
}
else
{
// Colors will be blended against the alpha from ocol1...
out.Write("\tocol1 = prev;\n");
}
// ...and the alpha from ocol0 will be written to the framebuffer.
out.Write("\tocol0.a = " I_ALPHA"[0].a;\n");
}
out.Write("}\n");
if (text[sizeof(text) - 1] != 0x7C)
@@ -760,10 +758,14 @@ static void WriteStage(T& out, pixel_shader_uid_data& uid_data, int n, API_TYPE
out.Write("float2 indtevtrans%d = " I_INDTEXMTX"[%d].ww * uv%d.xy * indtevcrd%d.yy;\n", n, mtxidx, texcoord, n);
}
else
{
out.Write("float2 indtevtrans%d = float2(0.0f, 0.0f);\n", n);
}
}
else
{
out.Write("float2 indtevtrans%d = float2(0.0f, 0.0f);\n", n);
}
// ---------
// Wrapping
@@ -841,7 +843,9 @@ static void WriteStage(T& out, pixel_shader_uid_data& uid_data, int n, API_TYPE
SampleTexture<T>(out, "textemp", "tevcoord", texswap, texmap, ApiType);
}
else
{
out.Write("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
@@ -1124,7 +1128,7 @@ static void WriteAlphaTest(T& out, pixel_shader_uid_data& uid_data, API_TYPE Api
// 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
@@ -1143,14 +1147,14 @@ static void WriteAlphaTest(T& out, pixel_shader_uid_data& uid_data, API_TYPE Api
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
};
template<class T>
@@ -1180,7 +1184,7 @@ static void WriteFog(T& out, pixel_shader_uid_data& uid_data)
// ze *= x_adjust
// this is completely theoretical as the real hardware seems to use a table intead of calculating the values.
uid_data.fog.RangeBaseEnabled = bpmem.fogRange.Base.Enabled;
if(bpmem.fogRange.Base.Enabled)
if (bpmem.fogRange.Base.Enabled)
{
out.SetConstantsUsed(C_FOG+2, C_FOG+2);
out.Write("\tfloat x_adjust = (2.0f * (clipPos.x / " I_FOG"[2].y)) - 1.0f - " I_FOG"[2].x;\n");

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef GCOGL_PIXELSHADER_H
#define GCOGL_PIXELSHADER_H

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <cmath>
@@ -123,7 +110,7 @@ void PixelShaderManager::SetConstants(u32 components)
static int saved_updates = 0;
static int necessary_updates = 0;
// TODO: Remove this!
#define IncStuff() { \
saved_updates++; \
/*printf("Saved a constant update at line %d! Saved %d against %d now!\n", __LINE__, saved_updates, necessary_updates);*/ }
@@ -224,8 +211,10 @@ void PixelShaderManager::SetConstants(u32 components)
}
else if ((s_nIndTexScaleChanged & 0x03)) IncStuff();
if ((s_nIndTexScaleChanged & 0x0c) && constant_profile.ConstantIsUsed(C_INDTEXSCALE+1)) {
for (u32 i = 2; i < 4; ++i) {
if ((s_nIndTexScaleChanged & 0x0c) && constant_profile.ConstantIsUsed(C_INDTEXSCALE+1))
{
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]);
@@ -305,18 +294,20 @@ void PixelShaderManager::SetConstants(u32 components)
{
//bpmem.fogRange.Base.Center : center of the viewport in x axis. observation: bpmem.fogRange.Base.Center = realcenter + 342;
int center = ((u32)bpmem.fogRange.Base.Center) - 342;
// normalice center to make calculations easy
// normalize center to make calculations easy
float ScreenSpaceCenter = center / (2.0f * xfregs.viewport.wd);
ScreenSpaceCenter = (ScreenSpaceCenter * 2.0f) - 1.0f;
//bpmem.fogRange.K seems to be a table of precalculated coeficients for the adjust factor
//observations: bpmem.fogRange.K[0].LO apears to be the lowest value and bpmem.fogRange.K[4].HI the largest
// they always seems to be larger than 256 so my teory is :
// they are the coeficients from the center to th e border of the screen
// so to simplify i use the hi coeficient as K in the shader taking 256 as the scale
//bpmem.fogRange.K seems to be a table of precalculated coefficients for the adjust factor
//observations: bpmem.fogRange.K[0].LO appears to be the lowest value and bpmem.fogRange.K[4].HI the largest
// they always seems to be larger than 256 so my theory is :
// they are the coefficients from the center to the border of the screen
// so to simplify I use the hi coefficient as K in the shader taking 256 as the scale
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;
}else if ( s_bFogRangeAdjustChanged) IncStuff();
@@ -353,7 +344,9 @@ void PixelShaderManager::SetConstants(u32 components)
SetPSConstant4f(C_PLIGHTS+5*i+j+1, 0.00001f, xfmemptr[1], xfmemptr[2], 0);
}
else
{
SetPSConstant4fv(C_PLIGHTS+5*i+j+1, xfmemptr);
}
}
}
@@ -423,17 +416,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]);
}

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _PIXELSHADERMANAGER_H
#define _PIXELSHADERMANAGER_H

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
// ---------------------------------------------------------------------------------------------
// GC graphics pipeline
@@ -144,7 +131,7 @@ int Renderer::EFBToScaledX(int x)
{
switch (g_ActiveConfig.iEFBScale)
{
case 0: // fractional
case SCALE_AUTO: // fractional
return (int)ssaa_multiplier * FramebufferManagerBase::ScaleToVirtualXfbWidth(x, s_backbuffer_width);
default:
@@ -156,7 +143,7 @@ int Renderer::EFBToScaledY(int y)
{
switch (g_ActiveConfig.iEFBScale)
{
case 0: // fractional
case SCALE_AUTO: // fractional
return (int)ssaa_multiplier * FramebufferManagerBase::ScaleToVirtualXfbHeight(y, s_backbuffer_height);
default:
@@ -166,7 +153,7 @@ int Renderer::EFBToScaledY(int y)
void Renderer::CalculateTargetScale(int x, int y, int &scaledX, int &scaledY)
{
if (g_ActiveConfig.iEFBScale == 0 || g_ActiveConfig.iEFBScale == 1)
if (g_ActiveConfig.iEFBScale == SCALE_AUTO || g_ActiveConfig.iEFBScale == SCALE_AUTO_INTEGRAL)
{
scaledX = x;
scaledY = y;
@@ -283,28 +270,28 @@ void Renderer::DrawDebugText()
const char* res_text = "";
switch (g_ActiveConfig.iEFBScale)
{
case 0:
case SCALE_AUTO:
res_text = "Auto (fractional)";
break;
case 1:
case SCALE_AUTO_INTEGRAL:
res_text = "Auto (integral)";
break;
case 2:
case SCALE_1X:
res_text = "Native";
break;
case 3:
case SCALE_1_5X:
res_text = "1.5x";
break;
case 4:
case SCALE_2X:
res_text = "2x";
break;
case 5:
case SCALE_2_5X:
res_text = "2.5x";
break;
case 6:
case SCALE_3X:
res_text = "3x";
break;
case 7:
case SCALE_4X:
res_text = "4x";
break;
}

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
// ---------------------------------------------------------------------------------------------
// GC graphics pipeline

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <string.h>
@@ -46,8 +33,8 @@ void Statistics::SwapDL()
char *Statistics::ToString(char *ptr)
{
char *p = ptr;
ptr+=sprintf(ptr,"textures created: %i\n",stats.numTexturesCreated);
ptr+=sprintf(ptr,"textures alive: %i\n",stats.numTexturesAlive);
ptr+=sprintf(ptr,"Textures created: %i\n",stats.numTexturesCreated);
ptr+=sprintf(ptr,"Textures alive: %i\n",stats.numTexturesAlive);
ptr+=sprintf(ptr,"pshaders created: %i\n",stats.numPixelShadersCreated);
ptr+=sprintf(ptr,"pshaders alive: %i\n",stats.numPixelShadersAlive);
ptr+=sprintf(ptr,"pshaders (unique, delete cache first): %i\n",stats.numUniquePixelShaders);
@@ -56,12 +43,12 @@ char *Statistics::ToString(char *ptr)
ptr+=sprintf(ptr,"dlists called: %i\n",stats.numDListsCalled);
ptr+=sprintf(ptr,"dlists called(f): %i\n",stats.thisFrame.numDListsCalled);
ptr+=sprintf(ptr,"dlists alive: %i\n",stats.numDListsAlive);
ptr+=sprintf(ptr,"primitive joins: %i\n",stats.thisFrame.numPrimitiveJoins);
ptr+=sprintf(ptr,"draw calls: %i\n",stats.thisFrame.numDrawCalls);
ptr+=sprintf(ptr,"indexed draw calls: %i\n",stats.thisFrame.numIndexedDrawCalls);
ptr+=sprintf(ptr,"buffer splits: %i\n",stats.thisFrame.numBufferSplits);
ptr+=sprintf(ptr,"primitives: %i\n",stats.thisFrame.numPrims);
ptr+=sprintf(ptr,"primitives (DL): %i\n",stats.thisFrame.numDLPrims);
ptr+=sprintf(ptr,"Primitive joins: %i\n",stats.thisFrame.numPrimitiveJoins);
ptr+=sprintf(ptr,"Draw calls: %i\n",stats.thisFrame.numDrawCalls);
ptr+=sprintf(ptr,"Indexed draw calls: %i\n",stats.thisFrame.numIndexedDrawCalls);
ptr+=sprintf(ptr,"Buffer splits: %i\n",stats.thisFrame.numBufferSplits);
ptr+=sprintf(ptr,"Primitives: %i\n",stats.thisFrame.numPrims);
ptr+=sprintf(ptr,"Primitives (DL): %i\n",stats.thisFrame.numDLPrims);
ptr+=sprintf(ptr,"XF loads: %i\n",stats.thisFrame.numXFLoads);
ptr+=sprintf(ptr,"XF loads (DL): %i\n",stats.thisFrame.numXFLoadsInDL);
ptr+=sprintf(ptr,"CP loads: %i\n",stats.thisFrame.numCPLoads);
@@ -85,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);

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "CommonTypes.h"
#include "VideoCommon.h"

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "MemoryUtil.h"
@@ -55,9 +42,12 @@ TextureCache::TextureCache()
temp_size = 2048 * 2048 * 4;
if (!temp)
temp = (u8*)AllocateAlignedMemory(temp_size, 16);
TexDecoder_SetTexFmtOverlayOptions(g_ActiveConfig.bTexFmtOverlayEnable, g_ActiveConfig.bTexFmtOverlayCenter);
if(g_ActiveConfig.bHiresTextures && !g_ActiveConfig.bDumpTextures)
HiresTextures::Init(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str());
SetHash64Function(g_ActiveConfig.bHiresTextures || g_ActiveConfig.bDumpTextures);
}
@@ -138,7 +128,9 @@ void TextureCache::Cleanup()
textures.erase(iter++);
}
else
{
++iter;
}
}
}
@@ -156,7 +148,9 @@ void TextureCache::InvalidateRange(u32 start_address, u32 size)
textures.erase(iter++);
}
else
{
++iter;
}
}
}
@@ -214,7 +208,9 @@ void TextureCache::ClearRenderTargets()
textures.erase(iter++);
}
else
{
++iter;
}
}
}
@@ -395,7 +391,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage,
// TODO: Print a warning if the format changes! In this case,
// we could reinterpret the internal texture object data to the new pixel format
// (similiar to what is already being done in Renderer::ReinterpretPixelFormat())
// (similar to what is already being done in Renderer::ReinterpretPixelFormat())
return ReturnEntry(stage, entry);
}
@@ -560,17 +556,20 @@ void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat
const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf)
{
// Emulation methods:
//
// - EFB to RAM:
// Encodes the requested EFB data at its native resolution to the emulated RAM using shaders.
// Load() decodes the data from there again (using TextureDecoder) if the EFB copy is being used as a texture again.
// Advantage: CPU can read data from the EFB copy and we don't lose any important updates to the texture
// Disadvantage: Encoding+decoding steps often are redundant because only some games read or modify EFB copies before using them as textures.
//
// - EFB to texture:
// Copies the requested EFB data to a texture object in VRAM, performing any color conversion using shaders.
// Advantage: Works for many games, since in most cases EFB copies aren't read or modified at all before being used as a texture again.
// Since we don't do any further encoding or decoding here, this method is much faster.
// It also allows enhancing the visual quality by doing scaled EFB copies.
// - hybrid EFB copies:
//
// - Hybrid EFB copies:
// 1a) Whenever this function gets called, encode the requested EFB data to RAM (like EFB to RAM)
// 1b) Set type to TCET_EC_DYNAMIC for all texture cache entries in the destination address range.
// If EFB copy caching is enabled, further checks will (try to) prevent redundant EFB copies.
@@ -685,8 +684,8 @@ void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat
}
else
{
cbufid = 9;
}
cbufid = 9;
}
}
else// alpha
{

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _TEXTURECACHEBASE_H
#define _TEXTURECACHEBASE_H
@@ -137,7 +124,8 @@ private:
static TexCache textures;
// Backup configuration values
static struct BackupConfig {
static struct BackupConfig
{
int s_colorsamples;
bool s_copy_efb_to_texture;
bool s_copy_efb_scaled;

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003-2000 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <stdio.h>
@@ -39,7 +26,8 @@ namespace TextureConversionShader
u16 GetEncodedSampleCount(u32 format)
{
switch (format) {
switch (format)
{
case GX_TF_I4: return 8;
case GX_TF_I8: return 4;
case GX_TF_IA4: return 4;
@@ -105,8 +93,8 @@ void WriteSwizzler(char*& p, u32 format, API_TYPE ApiType)
if (ApiType == API_OPENGL)
{
WRITE(p, " out float4 ocol0;\n");
WRITE(p, " in float2 uv0;\n");
WRITE(p, " COLOROUT(ocol0)\n");
WRITE(p, " VARYIN float2 uv0;\n");
WRITE(p, "void main()\n");
}
else
@@ -187,7 +175,7 @@ void Write32BitSwizzler(char*& p, u32 format, API_TYPE ApiType)
if (ApiType == API_OPENGL)
{
WRITE(p, " out float4 ocol0;\n");
WRITE(p, " in float2 uv0;\n");
WRITE(p, " VARYIN float2 uv0;\n");
WRITE(p, "void main()\n");
}
else

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _TEXTURECONVERSIONSHADER_H_
#define _TEXTURECONVERSIONSHADER_H_

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _TEXTUREDECODER_H
#define _TEXTUREDECODER_H

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <assert.h>
@@ -227,7 +214,7 @@ void VertexLoader::CompileVertexTranslator()
#ifdef USE_JIT
if (m_compiledCode)
PanicAlert("trying to recompile a vtx translator");
PanicAlert("Trying to recompile a vertex translator");
m_compiledCode = GetCodePtr();
ABI_EmitPrologue(4);
@@ -237,14 +224,17 @@ void VertexLoader::CompileVertexTranslator()
// Reset component counters if present in vertex format only.
if (m_VtxDesc.Tex0Coord || m_VtxDesc.Tex1Coord || m_VtxDesc.Tex2Coord || m_VtxDesc.Tex3Coord ||
m_VtxDesc.Tex4Coord || m_VtxDesc.Tex5Coord || m_VtxDesc.Tex6Coord || m_VtxDesc.Tex7Coord) {
m_VtxDesc.Tex4Coord || m_VtxDesc.Tex5Coord || m_VtxDesc.Tex6Coord || m_VtxDesc.Tex7Coord)
{
WriteSetVariable(32, &tcIndex, Imm32(0));
}
if (m_VtxDesc.Color0 || m_VtxDesc.Color1) {
if (m_VtxDesc.Color0 || m_VtxDesc.Color1)
{
WriteSetVariable(32, &colIndex, Imm32(0));
}
if (m_VtxDesc.Tex0MatIdx || m_VtxDesc.Tex1MatIdx || m_VtxDesc.Tex2MatIdx || m_VtxDesc.Tex3MatIdx ||
m_VtxDesc.Tex4MatIdx || m_VtxDesc.Tex5MatIdx || m_VtxDesc.Tex6MatIdx || m_VtxDesc.Tex7MatIdx) {
m_VtxDesc.Tex4MatIdx || m_VtxDesc.Tex5MatIdx || m_VtxDesc.Tex6MatIdx || m_VtxDesc.Tex7MatIdx)
{
WriteSetVariable(32, &s_texmtxwrite, Imm32(0));
WriteSetVariable(32, &s_texmtxread, Imm32(0));
}
@@ -271,14 +261,16 @@ void VertexLoader::CompileVertexTranslator()
int nat_offset = 0;
PortableVertexDeclaration vtx_decl;
memset(&vtx_decl, 0, sizeof(vtx_decl));
for (int i = 0; i < 8; i++) {
for (int i = 0; i < 8; i++)
{
vtx_decl.texcoord_offset[i] = -1;
}
// m_VBVertexStride for texmtx and posmtx is computed later when writing.
// Position Matrix Index
if (m_VtxDesc.PosMatIdx) {
if (m_VtxDesc.PosMatIdx)
{
WriteCall(PosMtx_ReadDirect_UByte);
m_NativeFmt->m_components |= VB_HAS_POSMTXIDX;
m_VertexSize += 1;
@@ -294,11 +286,14 @@ void VertexLoader::CompileVertexTranslator()
if (m_VtxDesc.Tex7MatIdx) {m_VertexSize += 1; m_NativeFmt->m_components |= VB_HAS_TEXMTXIDX7; WriteCall(TexMtx_ReadDirect_UByte); }
// Write vertex position loader
if(g_ActiveConfig.bUseBBox) {
if(g_ActiveConfig.bUseBBox)
{
WriteCall(UpdateBoundingBoxPrepare);
WriteCall(VertexLoader_Position::GetFunction(m_VtxDesc.Position, m_VtxAttr.PosFormat, m_VtxAttr.PosElements));
WriteCall(UpdateBoundingBox);
} else {
}
else
{
WriteCall(VertexLoader_Position::GetFunction(m_VtxDesc.Position, m_VtxAttr.PosFormat, m_VtxAttr.PosElements));
}
m_VertexSize += VertexLoader_Position::GetSize(m_VtxDesc.Position, m_VtxAttr.PosFormat, m_VtxAttr.PosElements);
@@ -330,7 +325,9 @@ void VertexLoader::CompileVertexTranslator()
vtx_decl.normal_gl_size = 3;
vtx_decl.normal_offset[0] = nat_offset;
nat_offset += 12;
if (vtx_attr.NormalElements) {
if (vtx_attr.NormalElements)
{
vtx_decl.normal_offset[1] = nat_offset;
nat_offset += 12;
vtx_decl.normal_offset[2] = nat_offset;
@@ -347,7 +344,8 @@ void VertexLoader::CompileVertexTranslator()
vtx_decl.color_gl_type = VAR_UNSIGNED_BYTE;
vtx_decl.color_offset[0] = -1;
vtx_decl.color_offset[1] = -1;
for (int i = 0; i < 2; i++) {
for (int i = 0; i < 2; i++)
{
m_NativeFmt->m_components |= VB_HAS_COL0 << i;
switch (col[i])
{
@@ -395,32 +393,39 @@ void VertexLoader::CompileVertexTranslator()
break;
}
// Common for the three bottom cases
if (col[i] != NOT_PRESENT) {
if (col[i] != NOT_PRESENT)
{
vtx_decl.color_offset[i] = nat_offset;
nat_offset += 4;
}
}
// Texture matrix indices (remove if corresponding texture coordinate isn't enabled)
for (int i = 0; i < 8; i++) {
for (int i = 0; i < 8; i++)
{
vtx_decl.texcoord_offset[i] = -1;
const int format = m_VtxAttr.texCoord[i].Format;
const int elements = m_VtxAttr.texCoord[i].Elements;
if (tc[i] == NOT_PRESENT) {
if (tc[i] == NOT_PRESENT)
{
m_NativeFmt->m_components &= ~(VB_HAS_UV0 << i);
} else {
}
else
{
_assert_msg_(VIDEO, DIRECT <= tc[i] && tc[i] <= INDEX16, "Invalid texture coordinates!\n(tc[i] = %d)", tc[i]);
_assert_msg_(VIDEO, FORMAT_UBYTE <= format && format <= FORMAT_FLOAT, "Invalid texture coordinates format!\n(format = %d)", format);
_assert_msg_(VIDEO, 0 <= elements && elements <= 1, "Invalid number of texture coordinates elemnts!\n(elements = %d)", elements);
_assert_msg_(VIDEO, 0 <= elements && elements <= 1, "Invalid number of texture coordinates elements!\n(elements = %d)", elements);
m_NativeFmt->m_components |= VB_HAS_UV0 << i;
WriteCall(VertexLoader_TextCoord::GetFunction(tc[i], format, elements));
m_VertexSize += VertexLoader_TextCoord::GetSize(tc[i], format, elements);
}
if (m_NativeFmt->m_components & (VB_HAS_TEXMTXIDX0 << i)) {
if (tc[i] != NOT_PRESENT) {
if (m_NativeFmt->m_components & (VB_HAS_TEXMTXIDX0 << i))
{
if (tc[i] != NOT_PRESENT)
{
// if texmtx is included, texcoord will always be 3 floats, z will be the texmtx index
vtx_decl.texcoord_offset[i] = nat_offset;
vtx_decl.texcoord_gl_type[i] = VAR_FLOAT;
@@ -428,7 +433,8 @@ void VertexLoader::CompileVertexTranslator()
nat_offset += 12;
WriteCall(m_VtxAttr.texCoord[i].Elements ? TexMtx_Write_Float : TexMtx_Write_Float2);
}
else {
else
{
m_NativeFmt->m_components |= VB_HAS_UV0 << i; // have to include since using now
vtx_decl.texcoord_offset[i] = nat_offset;
vtx_decl.texcoord_gl_type[i] = VAR_FLOAT;
@@ -437,8 +443,10 @@ void VertexLoader::CompileVertexTranslator()
WriteCall(TexMtx_Write_Float4);
}
}
else {
if (tc[i] != NOT_PRESENT) {
else
{
if (tc[i] != NOT_PRESENT)
{
vtx_decl.texcoord_offset[i] = nat_offset;
vtx_decl.texcoord_gl_type[i] = VAR_FLOAT;
vtx_decl.texcoord_size[i] = vtx_attr.texCoord[i].Elements ? 2 : 1;
@@ -446,28 +454,35 @@ void VertexLoader::CompileVertexTranslator()
}
}
if (tc[i] == NOT_PRESENT) {
if (tc[i] == NOT_PRESENT)
{
// if there's more tex coords later, have to write a dummy call
int j = i + 1;
for (; j < 8; ++j) {
if (tc[j] != NOT_PRESENT) {
for (; j < 8; ++j)
{
if (tc[j] != NOT_PRESENT)
{
WriteCall(VertexLoader_TextCoord::GetDummyFunction()); // important to get indices right!
break;
}
}
// tricky!
if (j == 8 && !((m_NativeFmt->m_components & VB_HAS_TEXMTXIDXALL) & (VB_HAS_TEXMTXIDXALL << (i + 1)))) {
if (j == 8 && !((m_NativeFmt->m_components & VB_HAS_TEXMTXIDXALL) & (VB_HAS_TEXMTXIDXALL << (i + 1))))
{
// no more tex coords and tex matrices, so exit loop
break;
}
}
}
if (m_VtxDesc.PosMatIdx) {
if (m_VtxDesc.PosMatIdx)
{
WriteCall(PosMtx_Write);
vtx_decl.posmtx_offset = nat_offset;
nat_offset += 4;
} else {
}
else
{
vtx_decl.posmtx_offset = -1;
}
@@ -587,7 +602,8 @@ void VertexLoader::RunVertices(int vtx_attr_group, int primitive, int const coun
void VertexLoader::ConvertVertices ( int count )
{
#ifdef USE_JIT
if (count > 0) {
if (count > 0)
{
loop_counter = count;
((void (*)())(void*)m_compiledCode)();
}
@@ -659,6 +675,10 @@ void VertexLoader::SetVAT(u32 _group0, u32 _group1, u32 _group2)
m_VtxAttr.texCoord[7].Elements = vat.g2.Tex7CoordElements;
m_VtxAttr.texCoord[7].Format = vat.g2.Tex7CoordFormat;
m_VtxAttr.texCoord[7].Frac = vat.g2.Tex7Frac;
if(!m_VtxAttr.ByteDequant) {
ERROR_LOG(VIDEO, "ByteDequant is set to zero");
}
};
void VertexLoader::AppendToString(std::string *dest) const
@@ -687,10 +707,13 @@ void VertexLoader::AppendToString(std::string *dest) const
dest->append(StringFromFormat("%ib skin: %i P: %i %s-%s ",
m_VertexSize, m_VtxDesc.PosMatIdx,
m_VtxAttr.PosElements ? 3 : 2, posMode[m_VtxDesc.Position], posFormats[m_VtxAttr.PosFormat]));
if (m_VtxDesc.Normal) {
if (m_VtxDesc.Normal)
{
dest->append(StringFromFormat("Nrm: %i %s-%s ",
m_VtxAttr.NormalElements, posMode[m_VtxDesc.Normal], posFormats[m_VtxAttr.NormalFormat]));
}
u32 color_mode[2] = {m_VtxDesc.Color0, m_VtxDesc.Color1};
for (int i = 0; i < 2; i++)
{

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _VERTEXLOADER_H
#define _VERTEXLOADER_H
@@ -37,8 +24,12 @@ class VertexLoaderUID
u32 vid[5];
size_t hash;
public:
VertexLoaderUID() {}
void InitFromCurrentState(int vtx_attr_group) {
VertexLoaderUID()
{
}
void InitFromCurrentState(int vtx_attr_group)
{
vid[0] = g_VtxDesc.Hex & 0xFFFFFFFF;
vid[1] = g_VtxDesc.Hex >> 32;
vid[2] = g_VtxAttr[vtx_attr_group].g0.Hex & ~VAT_0_FRACBITS;
@@ -46,32 +37,47 @@ public:
vid[4] = g_VtxAttr[vtx_attr_group].g2.Hex & ~VAT_2_FRACBITS;
hash = CalculateHash();
}
bool operator < (const VertexLoaderUID &other) const {
bool operator < (const VertexLoaderUID &other) const
{
// This is complex because of speed.
if (vid[0] < other.vid[0])
return true;
else if (vid[0] > other.vid[0])
return false;
for (int i = 1; i < 5; ++i) {
for (int i = 1; i < 5; ++i)
{
if (vid[i] < other.vid[i])
return true;
else if (vid[i] > other.vid[i])
return false;
}
return false;
}
bool operator == (const VertexLoaderUID& rh) const {
bool operator == (const VertexLoaderUID& rh) const
{
return hash == rh.hash && std::equal(vid, vid + sizeof(vid) / sizeof(vid[0]), rh.vid);
}
size_t GetHash() const {
size_t GetHash() const
{
return hash;
}
private:
size_t CalculateHash() {
size_t CalculateHash()
{
size_t h = -1;
for (unsigned int i = 0; i < sizeof(vid) / sizeof(vid[0]); ++i) {
for (unsigned int i = 0; i < sizeof(vid) / sizeof(vid[0]); ++i)
{
h = h * 137 + vid[i];
}
return h;
}
};

View File

@@ -1,32 +1,9 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <algorithm>
#ifdef _MSC_VER
#include <hash_map>
using stdext::hash_map;
#elif defined __APPLE__
#include <ext/hash_map>
using __gnu_cxx::hash_map;
#else
#include <unordered_map>
using std::unordered_map;
#endif
#include <map>
#include <vector>
#include "VideoCommon.h"
@@ -41,32 +18,21 @@ static int s_attr_dirty; // bitfield
static VertexLoader *g_VertexLoaders[8];
#ifdef _MSC_VER
namespace stdext {
inline size_t hash_value(const VertexLoaderUID& uid) {
namespace std
{
template <>
struct hash<VertexLoaderUID>
{
size_t operator()(const VertexLoaderUID& uid) const
{
return uid.GetHash();
}
}
#else
#ifdef __APPLE__
namespace __gnu_cxx
#else
namespace std
#endif
{
template<> struct hash<VertexLoaderUID> {
size_t operator()(const VertexLoaderUID& uid) const {
return uid.GetHash();
}
};
}
#endif
};
#if defined _MSC_VER || defined __APPLE__
typedef hash_map<VertexLoaderUID, VertexLoader*> VertexLoaderMap;
#else
typedef unordered_map<VertexLoaderUID, VertexLoader*> VertexLoaderMap;
#endif
}
typedef std::unordered_map<VertexLoaderUID, VertexLoader*> VertexLoaderMap;
namespace VertexLoaderManager
{
@@ -91,11 +57,14 @@ void Shutdown()
g_VertexLoaderMap.clear();
}
namespace {
struct entry {
namespace
{
struct entry
{
std::string text;
u64 num_verts;
bool operator < (const entry &other) const {
bool operator < (const entry &other) const
{
return num_verts > other.num_verts;
}
};
@@ -116,7 +85,8 @@ void AppendListToString(std::string *dest)
}
sort(entries.begin(), entries.end());
dest->reserve(dest->size() + total_size);
for (std::vector<entry>::const_iterator iter = entries.begin(); iter != entries.end(); ++iter) {
for (std::vector<entry>::const_iterator iter = entries.begin(); iter != entries.end(); ++iter)
{
dest->append(iter->text);
}
}

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _VERTEXLOADERMANAGER_H
#define _VERTEXLOADERMANAGER_H

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "Common.h"
#include "VideoCommon.h"
@@ -91,7 +78,8 @@ void LOADERDECL Color_ReadDirect_24b_888()
DataSkip(3);
}
void LOADERDECL Color_ReadDirect_32b_888x(){
void LOADERDECL Color_ReadDirect_32b_888x()
{
_SetCol(_Read24(DataGetPosition()));
DataSkip(4);
}

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _VERTEXLOADERCOLOR_H
#define _VERTEXLOADERCOLOR_H

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "Common.h"
#include "VideoCommon.h"
@@ -53,7 +40,9 @@ __forceinline float FracAdjust(T val)
template <>
__forceinline float FracAdjust(float val)
{ return val; }
{
return val;
}
template <typename T, int N>
__forceinline void ReadIndirect(const T* data)
@@ -200,5 +189,5 @@ TPipelineFunction VertexLoader_Normal::GetFunction(unsigned int _type,
unsigned int _format, unsigned int _elements, unsigned int _index3)
{
TPipelineFunction pFunc = m_Table[_type][_index3][_elements][_format].function;
return pFunc;
return pFunc;
}

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _VERTEXLOADER_NORMAL_H
#define _VERTEXLOADER_NORMAL_H

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <limits>
@@ -81,7 +68,9 @@ float PosScale(T val)
template <>
float PosScale(float val)
{ return val; }
{
return val;
}
template <typename T, int N>
void LOADERDECL Pos_ReadDirect()
@@ -179,11 +168,13 @@ static int tableReadPositionVertexSize[4][8][2] = {
};
void VertexLoader_Position::Init(void) {
void VertexLoader_Position::Init(void)
{
#if _M_SSE >= 0x301
if (cpu_info.bSSSE3) {
if (cpu_info.bSSSE3)
{
tableReadPosition[2][4][0] = Pos_ReadIndex_Float_SSSE3<u8, false>;
tableReadPosition[2][4][1] = Pos_ReadIndex_Float_SSSE3<u8, true>;
tableReadPosition[3][4][0] = Pos_ReadIndex_Float_SSSE3<u16, false>;
@@ -194,10 +185,12 @@ void VertexLoader_Position::Init(void) {
}
unsigned int VertexLoader_Position::GetSize(unsigned int _type, unsigned int _format, unsigned int _elements) {
unsigned int VertexLoader_Position::GetSize(unsigned int _type, unsigned int _format, unsigned int _elements)
{
return tableReadPositionVertexSize[_type][_format][_elements];
}
TPipelineFunction VertexLoader_Position::GetFunction(unsigned int _type, unsigned int _format, unsigned int _elements) {
TPipelineFunction VertexLoader_Position::GetFunction(unsigned int _type, unsigned int _format, unsigned int _elements)
{
return tableReadPosition[_type][_format][_elements];
}

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef VERTEXLOADER_POSITION_H
#define VERTEXLOADER_POSITION_H

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "Common.h"
#include "VideoCommon.h"
@@ -61,7 +48,9 @@ float TCScale(T val)
template <>
float TCScale(float val)
{ return val; }
{
return val;
}
template <typename T, int N>
void LOADERDECL TexCoord_ReadDirect()
@@ -179,7 +168,8 @@ static int tableReadTexCoordVertexSize[4][8][2] = {
},
};
void VertexLoader_TextCoord::Init(void) {
void VertexLoader_TextCoord::Init(void)
{
#if _M_SSE >= 0x301
@@ -203,14 +193,17 @@ void VertexLoader_TextCoord::Init(void) {
}
unsigned int VertexLoader_TextCoord::GetSize(unsigned int _type, unsigned int _format, unsigned int _elements) {
unsigned int VertexLoader_TextCoord::GetSize(unsigned int _type, unsigned int _format, unsigned int _elements)
{
return tableReadTexCoordVertexSize[_type][_format][_elements];
}
TPipelineFunction VertexLoader_TextCoord::GetFunction(unsigned int _type, unsigned int _format, unsigned int _elements) {
TPipelineFunction VertexLoader_TextCoord::GetFunction(unsigned int _type, unsigned int _format, unsigned int _elements)
{
return tableReadTexCoord[_type][_format][_elements];
}
TPipelineFunction VertexLoader_TextCoord::GetDummyFunction() {
TPipelineFunction VertexLoader_TextCoord::GetDummyFunction()
{
return TexCoord_Read_Dummy;
}

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef VERTEXLOADER_TEXCOORD_H
#define VERTEXLOADER_TEXCOORD_H

View File

@@ -35,7 +35,8 @@ VertexManager::VertexManager()
}
VertexManager::~VertexManager()
{}
{
}
void VertexManager::ResetBuffer()
{
@@ -57,13 +58,13 @@ void VertexManager::PrepareForAdditionalData(int primitive, u32 count, u32 strid
Flush();
if(count > IndexGenerator::GetRemainingIndices())
ERROR_LOG(VIDEO, "Too less index values. Use 32bit or reset them on flush.");
ERROR_LOG(VIDEO, "Too little remaining index values. Use 32-bit or reset them on flush.");
if (count > GetRemainingIndices(primitive))
ERROR_LOG(VIDEO, "VertexManager: Buffer not large enough for all indices! "
"Increase MAXIBUFFERSIZE or we need primitive breaking afterall.");
"Increase MAXIBUFFERSIZE or we need primitive breaking after all.");
if (needed_vertex_bytes > GetRemainingSize())
ERROR_LOG(VIDEO, "VertexManager: Buffer not large enough for all vertices! "
"Increase MAXVBUFFERSIZE or we need primitive breaking afterall.");
"Increase MAXVBUFFERSIZE or we need primitive breaking after all.");
}
}
@@ -74,28 +75,57 @@ bool VertexManager::IsFlushed() const
u32 VertexManager::GetRemainingIndices(int primitive)
{
switch (primitive)
if(g_Config.backend_info.bSupportsPrimitiveRestart)
{
case GX_DRAW_QUADS:
return (MAXIBUFFERSIZE - IndexGenerator::GetTriangleindexLen()) / 6 * 4;
case GX_DRAW_TRIANGLES:
return (MAXIBUFFERSIZE - IndexGenerator::GetTriangleindexLen());
case GX_DRAW_TRIANGLE_STRIP:
return (MAXIBUFFERSIZE - IndexGenerator::GetTriangleindexLen()) / 3 + 2;
case GX_DRAW_TRIANGLE_FAN:
return (MAXIBUFFERSIZE - IndexGenerator::GetTriangleindexLen()) / 3 + 2;
switch (primitive)
{
case GX_DRAW_QUADS:
return (MAXIBUFFERSIZE - IndexGenerator::GetTriangleindexLen()) / 5 * 4;
case GX_DRAW_TRIANGLES:
return (MAXIBUFFERSIZE - IndexGenerator::GetTriangleindexLen()) / 4 * 3;
case GX_DRAW_TRIANGLE_STRIP:
return (MAXIBUFFERSIZE - IndexGenerator::GetTriangleindexLen()) / 1 - 1;
case GX_DRAW_TRIANGLE_FAN:
return (MAXIBUFFERSIZE - IndexGenerator::GetTriangleindexLen()) / 6 * 4 + 1;
case GX_DRAW_LINES:
return (MAXIBUFFERSIZE - IndexGenerator::GetLineindexLen());
case GX_DRAW_LINE_STRIP:
return (MAXIBUFFERSIZE - IndexGenerator::GetLineindexLen()) / 2 + 1;
case GX_DRAW_LINES:
return (MAXIBUFFERSIZE - IndexGenerator::GetLineindexLen());
case GX_DRAW_LINE_STRIP:
return (MAXIBUFFERSIZE - IndexGenerator::GetLineindexLen()) / 2 + 1;
case GX_DRAW_POINTS:
return (MAXIBUFFERSIZE - IndexGenerator::GetPointindexLen());
case GX_DRAW_POINTS:
return (MAXIBUFFERSIZE - IndexGenerator::GetPointindexLen());
default:
return 0;
default:
return 0;
}
}
else
{
switch (primitive)
{
case GX_DRAW_QUADS:
return (MAXIBUFFERSIZE - IndexGenerator::GetTriangleindexLen()) / 6 * 4;
case GX_DRAW_TRIANGLES:
return (MAXIBUFFERSIZE - IndexGenerator::GetTriangleindexLen());
case GX_DRAW_TRIANGLE_STRIP:
return (MAXIBUFFERSIZE - IndexGenerator::GetTriangleindexLen()) / 3 + 2;
case GX_DRAW_TRIANGLE_FAN:
return (MAXIBUFFERSIZE - IndexGenerator::GetTriangleindexLen()) / 3 + 2;
case GX_DRAW_LINES:
return (MAXIBUFFERSIZE - IndexGenerator::GetLineindexLen());
case GX_DRAW_LINE_STRIP:
return (MAXIBUFFERSIZE - IndexGenerator::GetLineindexLen()) / 2 + 1;
case GX_DRAW_POINTS:
return (MAXIBUFFERSIZE - IndexGenerator::GetPointindexLen());
default:
return 0;
}
}
}
void VertexManager::AddVertices(int primitive, u32 numVertices)
@@ -190,7 +220,9 @@ void VertexManager::Flush()
PixelShaderManager::SetTexDims(i, tentry->nativeW, tentry->nativeH, 0, 0);
}
else
ERROR_LOG(VIDEO, "error loading texture");
{
ERROR_LOG(VIDEO, "Error loading texture");
}
}
}

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <math.h>
#include <locale.h>
@@ -125,7 +112,7 @@ static void GenerateVertexShader(T& out, u32 components, API_TYPE api_type)
{
out.Write("ATTRIN float4 rawpos; // ATTR%d,\n", SHADER_POSITION_ATTRIB);
if (components & VB_HAS_POSMTXIDX)
out.Write("ATTRIN int posmtx; // ATTR%d,\n", SHADER_POSMTX_ATTRIB);
out.Write("ATTRIN float posmtx; // ATTR%d,\n", SHADER_POSMTX_ATTRIB);
if (components & VB_HAS_NRM0)
out.Write("ATTRIN float3 rawnorm0; // ATTR%d,\n", SHADER_NORM0_ATTRIB);
if (components & VB_HAS_NRM1)
@@ -138,7 +125,8 @@ static void GenerateVertexShader(T& out, u32 components, API_TYPE api_type)
if (components & VB_HAS_COL1)
out.Write("ATTRIN float4 color1; // ATTR%d,\n", SHADER_COLOR1_ATTRIB);
for (int i = 0; i < 8; ++i) {
for (int i = 0; i < 8; ++i)
{
u32 hastexmtx = (components & (VB_HAS_TEXMTXIDX0<<i));
if ((components & (VB_HAS_UV0<<i)) || hastexmtx)
out.Write("ATTRIN float%d tex%d; // ATTR%d,\n", hastexmtx ? 3 : 2, i, SHADER_TEXTURE0_ATTRIB + i);
@@ -179,13 +167,15 @@ static void GenerateVertexShader(T& out, u32 components, API_TYPE api_type)
// inputs
if (components & VB_HAS_NRM0)
out.Write(" float3 rawnorm0 : NORMAL0,\n");
if (components & VB_HAS_NRM1) {
if (components & VB_HAS_NRM1)
{
if (is_d3d)
out.Write(" float3 rawnorm1 : NORMAL1,\n");
else
out.Write(" float3 rawnorm1 : ATTR%d,\n", SHADER_NORM1_ATTRIB);
}
if (components & VB_HAS_NRM2) {
if (components & VB_HAS_NRM2)
{
if (is_d3d)
out.Write(" float3 rawnorm2 : NORMAL2,\n");
else
@@ -195,12 +185,14 @@ static void GenerateVertexShader(T& out, u32 components, API_TYPE api_type)
out.Write(" float4 color0 : COLOR0,\n");
if (components & VB_HAS_COL1)
out.Write(" float4 color1 : COLOR1,\n");
for (int i = 0; i < 8; ++i) {
for (int i = 0; i < 8; ++i)
{
u32 hastexmtx = (components & (VB_HAS_TEXMTXIDX0<<i));
if ((components & (VB_HAS_UV0<<i)) || hastexmtx)
out.Write(" float%d tex%d : TEXCOORD%d,\n", hastexmtx ? 3 : 2, i, i);
}
if (components & VB_HAS_POSMTXIDX) {
if (components & VB_HAS_POSMTXIDX)
{
if (is_d3d)
out.Write(" float4 blend_indices : BLENDINDICES,\n");
else
@@ -208,7 +200,7 @@ static void GenerateVertexShader(T& out, u32 components, API_TYPE api_type)
}
out.Write(" float4 rawpos : POSITION) {\n");
}
out.Write("VS_OUTPUT o;\n");
out.Write("VS_OUTPUT o;\n");
// transforms
if (components & VB_HAS_POSMTXIDX)
@@ -222,6 +214,10 @@ static void GenerateVertexShader(T& out, u32 components, API_TYPE api_type)
{
out.Write("int posmtx = blend_indices.x * 255.0f;\n");
}
else
{
out.Write("int posmtx = int(fposmtx);\n");
}
out.Write("float4 pos = float4(dot(" I_TRANSFORMMATRICES"[posmtx], rawpos), dot(" I_TRANSFORMMATRICES"[posmtx+1], rawpos), dot(" I_TRANSFORMMATRICES"[posmtx+2], rawpos), 1);\n");
@@ -288,19 +284,22 @@ static void GenerateVertexShader(T& out, u32 components, API_TYPE api_type)
// transform texcoords
out.Write("float4 coord = float4(0.0f, 0.0f, 1.0f, 1.0f);\n");
for (unsigned int i = 0; i < xfregs.numTexGen.numTexGens; ++i) {
for (unsigned int i = 0; i < xfregs.numTexGen.numTexGens; ++i)
{
TexMtxInfo& texinfo = xfregs.texMtxInfo[i];
out.Write("{\n");
out.Write("coord = float4(0.0f, 0.0f, 1.0f, 1.0f);\n");
uid_data.texMtxInfo[i].sourcerow = xfregs.texMtxInfo[i].sourcerow;
switch (texinfo.sourcerow) {
switch (texinfo.sourcerow)
{
case XF_SRCGEOM_INROW:
_assert_( texinfo.inputform == XF_TEXINPUT_ABC1 );
out.Write("coord = rawpos;\n"); // pos.w is 1
break;
case XF_SRCNORMAL_INROW:
if (components & VB_HAS_NRM0) {
if (components & VB_HAS_NRM0)
{
_assert_( texinfo.inputform == XF_TEXINPUT_ABC1 );
out.Write("coord = float4(rawnorm0.xyz, 1.0f);\n");
}
@@ -309,13 +308,15 @@ static void GenerateVertexShader(T& out, u32 components, API_TYPE api_type)
_assert_( texinfo.texgentype == XF_TEXGEN_COLOR_STRGBC0 || texinfo.texgentype == XF_TEXGEN_COLOR_STRGBC1 );
break;
case XF_SRCBINORMAL_T_INROW:
if (components & VB_HAS_NRM1) {
if (components & VB_HAS_NRM1)
{
_assert_( texinfo.inputform == XF_TEXINPUT_ABC1 );
out.Write("coord = float4(rawnorm1.xyz, 1.0f);\n");
}
break;
case XF_SRCBINORMAL_B_INROW:
if (components & VB_HAS_NRM2) {
if (components & VB_HAS_NRM2)
{
_assert_( texinfo.inputform == XF_TEXINPUT_ABC1 );
out.Write("coord = float4(rawnorm2.xyz, 1.0f);\n");
}
@@ -329,10 +330,12 @@ static void GenerateVertexShader(T& out, u32 components, API_TYPE api_type)
// first transformation
uid_data.texMtxInfo[i].texgentype = xfregs.texMtxInfo[i].texgentype;
switch (texinfo.texgentype) {
switch (texinfo.texgentype)
{
case XF_TEXGEN_EMBOSS_MAP: // calculate tex coords into bump map
if (components & (VB_HAS_NRM1|VB_HAS_NRM2)) {
if (components & (VB_HAS_NRM1|VB_HAS_NRM2))
{
// transform the light dir into tangent space
uid_data.texMtxInfo[i].embosslightshift = xfregs.texMtxInfo[i].embosslightshift;
uid_data.texMtxInfo[i].embosssourceshift = xfregs.texMtxInfo[i].embosssourceshift;
@@ -363,11 +366,11 @@ static void GenerateVertexShader(T& out, u32 components, API_TYPE api_type)
out.Write("int tmp = int(tex%d.z);\n", i);
if (texinfo.projection == XF_TEXPROJ_STQ)
out.Write("o.tex%d.xyz = float3(dot(coord, " I_TRANSFORMMATRICES"[tmp]), dot(coord, " I_TRANSFORMMATRICES"[tmp+1]), dot(coord, " I_TRANSFORMMATRICES"[tmp+2]));\n", i);
else {
else
out.Write("o.tex%d.xyz = float3(dot(coord, " I_TRANSFORMMATRICES"[tmp]), dot(coord, " I_TRANSFORMMATRICES"[tmp+1]), 1);\n", i);
}
}
else {
else
{
if (texinfo.projection == XF_TEXPROJ_STQ)
out.Write("o.tex%d.xyz = float3(dot(coord, " I_TEXMATRICES"[%d]), dot(coord, " I_TEXMATRICES"[%d]), dot(coord, " I_TEXMATRICES"[%d]));\n", i, 3*i, 3*i+1, 3*i+2);
else
@@ -377,7 +380,9 @@ static void GenerateVertexShader(T& out, u32 components, API_TYPE api_type)
}
uid_data.dualTexTrans.enabled = xfregs.dualTexTrans.enabled;
if (xfregs.dualTexTrans.enabled && texinfo.texgentype == XF_TEXGEN_REGULAR) { // only works for regular tex gen types?
// CHECKME: does this only work for regular tex gen types?
if (xfregs.dualTexTrans.enabled && texinfo.texgentype == XF_TEXGEN_REGULAR)
{
const PostMtxInfo& postInfo = xfregs.postMtxInfo[i];
uid_data.postMtxInfo[i].index = xfregs.postMtxInfo[i].index;
@@ -387,7 +392,8 @@ static void GenerateVertexShader(T& out, u32 components, API_TYPE api_type)
"float4 P2 = " I_POSTTRANSFORMMATRICES"[%d];\n",
postidx&0x3f, (postidx+1)&0x3f, (postidx+2)&0x3f);
if (texGenSpecialCase) {
if (texGenSpecialCase)
{
// no normalization
// q of input is 1
// q of output is unknown
@@ -410,9 +416,12 @@ static void GenerateVertexShader(T& out, u32 components, API_TYPE api_type)
}
// clipPos/w needs to be done in pixel shader, not here
if (xfregs.numTexGen.numTexGens < 7) {
if (xfregs.numTexGen.numTexGens < 7)
{
out.Write("o.clipPos = float4(pos.x,pos.y,o.pos.z,o.pos.w);\n");
} else {
}
else
{
out.Write("o.tex0.w = pos.x;\n");
out.Write("o.tex1.w = pos.y;\n");
out.Write("o.tex2.w = o.pos.z;\n");
@@ -421,9 +430,12 @@ static void GenerateVertexShader(T& out, u32 components, API_TYPE api_type)
if(g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
{
if (xfregs.numTexGen.numTexGens < 7) {
if (xfregs.numTexGen.numTexGens < 7)
{
out.Write("o.Normal = float4(_norm0.x,_norm0.y,_norm0.z,pos.z);\n");
} else {
}
else
{
out.Write("o.tex4.w = _norm0.x;\n");
out.Write("o.tex5.w = _norm0.y;\n");
out.Write("o.tex6.w = _norm0.z;\n");
@@ -432,6 +444,7 @@ static void GenerateVertexShader(T& out, u32 components, API_TYPE api_type)
else
out.Write("o.tex7.w = pos.z;\n");
}
if (components & VB_HAS_COL0)
out.Write("o.colors_0 = color0;\n");
@@ -483,16 +496,21 @@ static void GenerateVertexShader(T& out, u32 components, API_TYPE api_type)
// Will look better when we bind uniforms in GLSL 1.3
// clipPos/w needs to be done in pixel shader, not here
if (xfregs.numTexGen.numTexGens < 7) {
if (xfregs.numTexGen.numTexGens < 7)
{
for (unsigned int i = 0; i < 8; ++i)
{
if(i < xfregs.numTexGen.numTexGens)
out.Write(" uv%d_2.xyz = o.tex%d;\n", i, i);
else
out.Write(" uv%d_2.xyz = float3(0.0f, 0.0f, 0.0f);\n", i);
}
out.Write(" clipPos_2 = o.clipPos;\n");
if(g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
out.Write(" Normal_2 = o.Normal;\n");
} else {
}
else
{
// clip position is in w of first 4 texcoords
if (g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
{
@@ -511,7 +529,9 @@ static void GenerateVertexShader(T& out, u32 components, API_TYPE api_type)
out.Write("}\n");
}
else
{
out.Write("return o;\n}\n");
}
if (text[sizeof(text) - 1] != 0x7C)
PanicAlert("VertexShader generator - buffer too small, canary has been eaten!");

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef GCOGL_VERTEXSHADER_H
#define GCOGL_VERTEXSHADER_H
@@ -74,7 +61,7 @@ const s_svar VSVar_Loc[] = { {I_POSNORMALMATRIX, C_POSNORMALMATRIX, 6 },
{I_NORMALMATRICES , C_NORMALMATRICES, 32 },
{I_POSTTRANSFORMMATRICES, C_POSTTRANSFORMMATRICES, 64 },
{I_DEPTHPARAMS, C_DEPTHPARAMS, 1 },
};
};
#pragma pack(4)

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "Common.h"
#include "VideoConfig.h"
@@ -99,15 +86,18 @@ float PHackValue(std::string sValue)
c[i] = '\0';
break;
}
c[i] = (cStr[i] == ',') ? '.' : *(cStr+i);
if (c[i] == '.')
fp = true;
}
cStr = c;
sTof.str(cStr);
sTof >> f;
if (!fp) f /= 0xF4240;
if (!fp)
f /= 0xF4240;
delete [] c;
return f;
@@ -122,7 +112,7 @@ void UpdateProjectionHack(int iPhackvalue[], std::string sPhackvalue[])
if (iPhackvalue[0] == 1)
{
NOTICE_LOG(VIDEO, "\t\t--- Ortographic Projection Hack ON ---");
NOTICE_LOG(VIDEO, "\t\t--- Orthographic Projection Hack ON ---");
fhacksign1 *= (iPhackvalue[1] == 1) ? -1.0f : fhacksign1;
sTemp[0] = (iPhackvalue[1] == 1) ? " * (-1)" : "";
@@ -191,11 +181,12 @@ void VertexShaderManager::Dirty()
}
// Syncs the shader constant buffers with xfmem
// TODO: A cleaner way to control the matricies without making a mess in the parameters field
// TODO: A cleaner way to control the matrices without making a mess in the parameters field
void VertexShaderManager::SetConstants()
{
if (g_ActiveConfig.backend_info.APIType == API_OPENGL && !g_ActiveConfig.backend_info.bSupportsGLSLUBO)
Dirty();
if (nTransformMatricesChanged[0] >= 0)
{
int startn = nTransformMatricesChanged[0] / 4;
@@ -204,6 +195,7 @@ void VertexShaderManager::SetConstants()
SetMultiVSConstant4fv(C_TRANSFORMMATRICES + startn, endn - startn, pstart);
nTransformMatricesChanged[0] = nTransformMatricesChanged[1] = -1;
}
if (nNormalMatricesChanged[0] >= 0)
{
int startn = nNormalMatricesChanged[0] / 3;
@@ -251,7 +243,9 @@ void VertexShaderManager::SetConstants()
SetVSConstant4f(C_LIGHTS+5*i+j+1, 0.00001f, xfmemptr[1], xfmemptr[2], 0);
}
else
{
SetVSConstant4fv(C_LIGHTS+5*i+j+1, xfmemptr);
}
}
}
@@ -455,7 +449,7 @@ void VertexShaderManager::SetConstants()
break;
default:
ERROR_LOG(VIDEO, "unknown projection type: %d", xfregs.projection.type);
ERROR_LOG(VIDEO, "Unknown projection type: %d", xfregs.projection.type);
}
PRIM_LOG("Projection: %f %f %f %f %f %f\n", rawProjection[0], rawProjection[1], rawProjection[2], rawProjection[3], rawProjection[4], rawProjection[5]);
@@ -492,21 +486,24 @@ void VertexShaderManager::InvalidateXFRange(int start, int end)
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 + 9)) {
(u32)start < XFMEM_NORMALMATRICES + ((u32)MatrixIndexA.PosNormalMtxIdx & 31) * 3 + 9))
{
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)) {
((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)) {
((u32)start >= (u32)MatrixIndexB.Tex7MtxIdx*4 && (u32)start < (u32)MatrixIndexB.Tex7MtxIdx*4+12))
{
bTexMatricesChanged[1] = true;
}

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _VERTEXSHADERMANAGER_H
#define _VERTEXSHADERMANAGER_H

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _VIDEOCOMMON_H
#define _VIDEOCOMMON_H

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <cmath>
@@ -49,7 +36,6 @@ VideoConfig::VideoConfig()
void VideoConfig::Load(const char *ini_file)
{
std::string temp;
IniFile iniFile;
iniFile.Load(ini_file);
@@ -80,7 +66,7 @@ void VideoConfig::Load(const char *ini_file)
iniFile.Get("Settings", "HackedBufferUpload", &bHackedBufferUpload, 0);
iniFile.Get("Settings", "MSAA", &iMultisampleMode, 0);
iniFile.Get("Settings", "EFBScale", &iEFBScale, 2); // native
iniFile.Get("Settings", "EFBScale", &iEFBScale, (int) SCALE_1X); // native
iniFile.Get("Settings", "DstAlphaPass", &bDstAlphaPass, false);
@@ -138,7 +124,33 @@ void VideoConfig::GameIniLoad(const char *ini_file)
iniFile.GetIfExists("Video_Settings", "EnablePixelLighting", &bEnablePixelLighting);
iniFile.GetIfExists("Video_Settings", "HackedBufferUpload", &bHackedBufferUpload);
iniFile.GetIfExists("Video_Settings", "MSAA", &iMultisampleMode);
iniFile.GetIfExists("Video_Settings", "EFBScale", &iEFBScale); // integral
int tmp = -9000;
iniFile.GetIfExists("Video_Settings", "EFBScale", &tmp); // integral
if (tmp != -9000)
{
if (tmp != SCALE_FORCE_INTEGRAL)
{
iEFBScale = tmp;
}
else // Round down to multiple of native IR
{
switch (iEFBScale)
{
case SCALE_AUTO:
iEFBScale = SCALE_AUTO_INTEGRAL;
break;
case SCALE_1_5X:
iEFBScale = SCALE_1X;
break;
case SCALE_2_5X:
iEFBScale = SCALE_2X;
break;
default:
break;
}
}
}
iniFile.GetIfExists("Video_Settings", "DstAlphaPass", &bDstAlphaPass);
iniFile.GetIfExists("Video_Settings", "DisableFog", &bDisableFog);
iniFile.GetIfExists("Video_Settings", "EnableOpenCL", &bEnableOpenCL);

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
// IMPORTANT: UI etc should modify g_Config. Graphics code should read g_ActiveConfig.
@@ -44,6 +31,18 @@ enum AspectMode {
ASPECT_STRETCH = 3,
};
enum EFBScale {
SCALE_FORCE_INTEGRAL = -1,
SCALE_AUTO,
SCALE_AUTO_INTEGRAL,
SCALE_1X,
SCALE_1_5X,
SCALE_2X,
SCALE_2_5X,
SCALE_3X,
SCALE_4X,
};
class IniFile;
// NEVER inherit from this class.
@@ -153,7 +152,8 @@ struct VideoConfig
bool bSupportsDualSourceBlend; // only supported by D3D11 and OpenGL
bool bSupportsFormatReinterpretation;
bool bSupportsPixelLighting;
bool bSupportsPrimitiveRestart;
bool bSupportsSeparateAlphaFunction;
bool bSupportsGLSLUBO; // needed by pixelShaderGen, so must stay in videoCommon
} backend_info;

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "VideoState.h"

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _VIDEOSTATE_H
#define _VIDEOSTATE_H

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "XFMemory.h"

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _XFMEMORY_H
#define _XFMEMORY_H
@@ -208,20 +195,24 @@ union DualTexInfo
struct Light
{
u32 useless[3];
u32 color; //rgba
float a0; //attenuation
u32 color; // rgba
float a0; // attenuation
float a1;
float a2;
float k0; //k stuff
float k0; // k stuff
float k1;
float k2;
union
{
struct {
struct
{
float dpos[3];
float ddir[3]; // specular lights only
};
struct {
struct
{
float sdir[3];
float shalfangle[3]; // specular lights only
};

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "Common.h"
#include "VideoCommon.h"
@@ -212,7 +199,7 @@ void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData)
// do not allow writes past registers
if (baseAddress + transferSize > 0x1058)
{
INFO_LOG(VIDEO, "xf load exceeds address space: %x %d bytes\n", baseAddress, transferSize);
INFO_LOG(VIDEO, "XF load exceeds address space: %x %d bytes\n", baseAddress, transferSize);
if (baseAddress >= 0x1058)
transferSize = 0;

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _XFSTRUCTS_H
#define _XFSTRUCTS_H

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
// TODO: Handle cache-is-full condition :p
@@ -106,7 +93,7 @@ struct CachedDisplayList
// Compile the commands themselves down to native code.
const u8* compiled_code;
u32 uncachable; // if set, this DL will always be interpreted. This gets set if hash ever changes.
// Analitic data
// Analytic data
u32 num_xf_reg;
u32 num_cp_reg;
u32 num_bp_reg;
@@ -182,7 +169,7 @@ struct CachedDisplayList
while(Current)
{
if(!Current->IntersectsMemoryRange(RegionStart, Regionsize))
return Current;
return Current;
Current = Current->NextRegion;
}
return Current;
@@ -611,14 +598,17 @@ void Shutdown()
void Clear()
{
VDLMap::iterator iter = dl_map.begin();
while (iter != dl_map.end()) {
while (iter != dl_map.end())
{
VDlist &ParentEntry = iter->second;
DLMap::iterator childiter = ParentEntry.dl_map.begin();
while (childiter != ParentEntry.dl_map.end()) {
while (childiter != ParentEntry.dl_map.end())
{
CachedDisplayList &entry = childiter->second;
entry.ClearRegions();
childiter++;
}
ParentEntry.dl_map.clear();
iter++;
}
@@ -630,26 +620,33 @@ void Clear()
void ProgressiveCleanup()
{
VDLMap::iterator iter = dl_map.begin();
while (iter != dl_map.end()) {
while (iter != dl_map.end())
{
VDlist &ParentEntry = iter->second;
DLMap::iterator childiter = ParentEntry.dl_map.begin();
while (childiter != ParentEntry.dl_map.end())
{
CachedDisplayList &entry = childiter->second;
int limit = 3600;
if (entry.frame_count < frameCount - limit) {
if (entry.frame_count < frameCount - limit)
{
entry.ClearRegions();
ParentEntry.dl_map.erase(childiter++); // (this is gcc standard!)
}
else
{
++childiter;
}
}
if(ParentEntry.dl_map.empty())
{
dl_map.erase(iter++);
}
else
{
iter++;
}
}
}
@@ -666,10 +663,12 @@ bool HandleDisplayList(u32 address, u32 size)
//Fixed DlistCaching now is fully functional still some things to workout
if(!g_ActiveConfig.bDlistCachingEnable)
return false;
if(size == 0) return false;
if(size == 0)
return false;
// Is this thread safe?
if (DLCache::GetSpaceLeft() < DL_CODE_CLEAR_THRESHOLD) {
// TODO: Is this thread safe?
if (DLCache::GetSpaceLeft() < DL_CODE_CLEAR_THRESHOLD)
{
DLCache::Clear();
}
@@ -678,12 +677,14 @@ bool HandleDisplayList(u32 address, u32 size)
DLCache::VDLMap::iterator Parentiter = DLCache::dl_map.find(dl_id);
DLCache::DLMap::iterator iter;
bool childexist = false;
if (Parentiter != DLCache::dl_map.end())
{
vhash = DLCache::CreateVMapId(Parentiter->second.VATUsed);
iter = Parentiter->second.dl_map.find(vhash);
childexist = iter != Parentiter->second.dl_map.end();
}
if (Parentiter != DLCache::dl_map.end() && childexist)
{
DLCache::CachedDisplayList &dl = iter->second;

View File

@@ -1,19 +1,6 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "Common.h"
//#include "VideoCommon.h" // to get debug logs
@@ -688,7 +675,7 @@ PC_TexFormat GetPC_TexFormat(int texformat, int tlutfmt)
inline void SetOpenMPThreadCount(int width, int height)
{
#ifdef _OPENMP
// Dont use multithreading in small Textures
// Don't use multithreading in small Textures
if (g_ActiveConfig.bOMPDecoder && width > 127 && height > 127)
{
// don't span to many threads they will kill the rest of the emu :)