mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
Merge branch 'master' into primitive_restart
Conflicts: Source/Core/VideoCommon/Src/VideoConfig.h Source/Plugins/Plugin_VideoDX9/Src/main.cpp Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
This commit is contained in:
@ -185,7 +185,7 @@ void Read16(u16& _rReturnValue, const u32 _Address)
|
||||
_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())
|
||||
@ -195,29 +195,29 @@ void Read16(u16& _rReturnValue, const u32 _Address)
|
||||
_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 +326,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 +417,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:
|
||||
@ -453,7 +453,7 @@ void STACKALIGN GatherPipeBursted()
|
||||
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 +469,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
|
||||
@ -481,7 +481,7 @@ void STACKALIGN GatherPipeBursted()
|
||||
RunGpu();
|
||||
|
||||
_assert_msg_(COMMANDPROCESSOR, fifo.CPReadWriteDistance <= fifo.CPEnd - fifo.CPBase,
|
||||
"FIFO is overflown by GatherPipe !\nCPU thread is too fast!");
|
||||
"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");
|
||||
|
@ -247,7 +247,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;
|
||||
|
@ -148,7 +148,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;
|
||||
|
@ -390,7 +390,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,
|
||||
@ -598,9 +598,9 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType
|
||||
|
||||
if (ApiType == API_OPENGL)
|
||||
{
|
||||
WRITE(p, "out float4 ocol0;\n");
|
||||
WRITE(p, "COLOROUT(ocol0)\n");
|
||||
if (dstAlphaMode == DSTALPHA_DUAL_SOURCE_BLEND)
|
||||
WRITE(p, "out float4 ocol1;\n");
|
||||
WRITE(p, "COLOROUT(ocol1)\n");
|
||||
|
||||
if (per_pixel_depth)
|
||||
WRITE(p, "#define depth gl_FragDepth\n");
|
||||
@ -668,17 +668,20 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType
|
||||
per_pixel_depth ? "\n out float depth : SV_Depth," : "");
|
||||
}
|
||||
|
||||
WRITE(p, " in float4 colors_0 : COLOR0,\n");
|
||||
WRITE(p, " in float4 colors_1 : COLOR1");
|
||||
// "centroid" attribute is only supported by D3D11
|
||||
const char* optCentroid = (ApiType == API_D3D11 ? "centroid" : "");
|
||||
|
||||
WRITE(p, " in %s float4 colors_0 : COLOR0,\n", optCentroid);
|
||||
WRITE(p, " in %s float4 colors_1 : COLOR1", optCentroid);
|
||||
|
||||
// compute window position if needed because binding semantic WPOS is not widely supported
|
||||
if (numTexgen < 7)
|
||||
{
|
||||
for (int i = 0; i < numTexgen; ++i)
|
||||
WRITE(p, ",\n in float3 uv%d : TEXCOORD%d", i, i);
|
||||
WRITE(p, ",\n in float4 clipPos : TEXCOORD%d", numTexgen);
|
||||
WRITE(p, ",\n in %s float3 uv%d : TEXCOORD%d", optCentroid, i, i);
|
||||
WRITE(p, ",\n in %s float4 clipPos : TEXCOORD%d", optCentroid, numTexgen);
|
||||
if(g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
|
||||
WRITE(p, ",\n in float4 Normal : TEXCOORD%d", numTexgen + 1);
|
||||
WRITE(p, ",\n in %s float4 Normal : TEXCOORD%d", optCentroid, numTexgen + 1);
|
||||
WRITE(p, " ) {\n");
|
||||
}
|
||||
else
|
||||
@ -1333,7 +1336,7 @@ static void WriteFog(char *&p)
|
||||
|
||||
// x_adjust = sqrt((x-center)^2 + k^2)/k
|
||||
// ze *= x_adjust
|
||||
//this is complitly teorical as the real hard seems to use a table intead of calculate the values.
|
||||
//this is completely theoretical as the real hardware seems to use a table instead of calculating the values.
|
||||
if (bpmem.fogRange.Base.Enabled)
|
||||
{
|
||||
WRITE (p, "\tfloat x_adjust = (2.0f * (clipPos.x / " I_FOG"[2].y)) - 1.0f - " I_FOG"[2].x;\n");
|
||||
|
@ -245,14 +245,14 @@ void PixelShaderManager::SetConstants()
|
||||
{
|
||||
//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
|
||||
|
@ -144,7 +144,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 +156,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 +166,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 +283,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;
|
||||
}
|
||||
|
@ -105,8 +105,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 +187,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
|
||||
|
@ -227,7 +227,7 @@ void VertexLoader::CompileVertexTranslator()
|
||||
|
||||
#ifdef USE_JIT
|
||||
if (m_compiledCode)
|
||||
PanicAlert("trying to recompile a vtx translator");
|
||||
PanicAlert("Trying to recompile a vtx translator");
|
||||
|
||||
m_compiledCode = GetCodePtr();
|
||||
ABI_EmitPrologue(4);
|
||||
|
@ -16,17 +16,7 @@
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#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 +31,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
|
||||
{
|
||||
|
@ -57,13 +57,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.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -216,7 +216,7 @@ 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");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,30 +133,34 @@ static char text[16384];
|
||||
|
||||
char* GenerateVSOutputStruct(char* p, u32 components, API_TYPE ApiType)
|
||||
{
|
||||
|
||||
// "centroid" attribute is only supported by D3D11
|
||||
const char* optCentroid = (ApiType == API_D3D11 ? "centroid" : "");
|
||||
|
||||
// GLSL makes this ugly
|
||||
// TODO: Make pretty
|
||||
WRITE(p, "struct VS_OUTPUT {\n");
|
||||
WRITE(p, " float4 pos %s POSITION;\n", ApiType == API_OPENGL ? ";//" : ":");
|
||||
WRITE(p, " float4 colors_0 %s COLOR0;\n", ApiType == API_OPENGL ? ";//" : ":");
|
||||
WRITE(p, " float4 colors_1 %s COLOR1;\n", ApiType == API_OPENGL ? ";//" : ":");
|
||||
WRITE(p, " %s float4 pos %s POSITION;\n", optCentroid, ApiType == API_OPENGL ? ";//" : ":");
|
||||
WRITE(p, " %s float4 colors_0 %s COLOR0;\n", optCentroid, ApiType == API_OPENGL ? ";//" : ":");
|
||||
WRITE(p, " %s float4 colors_1 %s COLOR1;\n", optCentroid, ApiType == API_OPENGL ? ";//" : ":");
|
||||
|
||||
if (xfregs.numTexGen.numTexGens < 7) {
|
||||
for (unsigned int i = 0; i < xfregs.numTexGen.numTexGens; ++i)
|
||||
WRITE(p, " float3 tex%d %s TEXCOORD%d;\n", i, ApiType == API_OPENGL ? ";//" : ":", i);
|
||||
WRITE(p, " float4 clipPos %s TEXCOORD%d;\n", ApiType == API_OPENGL ? ";//" : ":", xfregs.numTexGen.numTexGens);
|
||||
WRITE(p, " %s float3 tex%d %s TEXCOORD%d;\n", optCentroid, i, ApiType == API_OPENGL ? ";//" : ":", i);
|
||||
WRITE(p, " %s float4 clipPos %s TEXCOORD%d;\n", optCentroid, ApiType == API_OPENGL ? ";//" : ":", xfregs.numTexGen.numTexGens);
|
||||
if(g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
|
||||
WRITE(p, " float4 Normal %s TEXCOORD%d;\n", ApiType == API_OPENGL ? ";//" : ":", xfregs.numTexGen.numTexGens + 1);
|
||||
WRITE(p, " %s float4 Normal %s TEXCOORD%d;\n", optCentroid, ApiType == API_OPENGL ? ";//" : ":", xfregs.numTexGen.numTexGens + 1);
|
||||
} else {
|
||||
// clip position is in w of first 4 texcoords
|
||||
if(g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
|
||||
{
|
||||
for (int i = 0; i < 8; ++i)
|
||||
WRITE(p, " float4 tex%d %s TEXCOORD%d;\n", i, ApiType == API_OPENGL? ";//" : ":", i);
|
||||
WRITE(p, " %s float4 tex%d %s TEXCOORD%d;\n", optCentroid, i, ApiType == API_OPENGL? ";//" : ":", i);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (unsigned int i = 0; i < xfregs.numTexGen.numTexGens; ++i)
|
||||
WRITE(p, " float%d tex%d %s TEXCOORD%d;\n", i < 4 ? 4 : 3 , i, ApiType == API_OPENGL ? ";//" : ":", i);
|
||||
WRITE(p, " %s float%d tex%d %s TEXCOORD%d;\n", optCentroid, i < 4 ? 4 : 3 , i, ApiType == API_OPENGL ? ";//" : ":", i);
|
||||
}
|
||||
}
|
||||
WRITE(p, "};\n");
|
||||
|
@ -122,7 +122,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,7 +191,7 @@ 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)
|
||||
@ -455,7 +455,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]);
|
||||
|
@ -49,7 +49,6 @@ VideoConfig::VideoConfig()
|
||||
|
||||
void VideoConfig::Load(const char *ini_file)
|
||||
{
|
||||
std::string temp;
|
||||
IniFile iniFile;
|
||||
iniFile.Load(ini_file);
|
||||
|
||||
@ -80,7 +79,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 +137,32 @@ 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;
|
||||
// Round down to multiple of native IR
|
||||
else
|
||||
{
|
||||
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);
|
||||
|
@ -44,6 +44,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.
|
||||
@ -154,7 +166,7 @@ struct VideoConfig
|
||||
bool bSupportsFormatReinterpretation;
|
||||
bool bSupportsPixelLighting;
|
||||
bool bSupportsPrimitiveRestart;
|
||||
|
||||
bool bSupportsSeparateAlphaFunction;
|
||||
bool bSupportsGLSLUBO; // needed by pixelShaderGen, so must stay in videoCommon
|
||||
} backend_info;
|
||||
|
||||
|
@ -212,7 +212,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;
|
||||
|
Reference in New Issue
Block a user