diff options
| author | degasus <wickmarkus@web.de> | 2013-04-08 15:57:51 +0200 |
|---|---|---|
| committer | degasus <wickmarkus@web.de> | 2013-04-08 15:57:51 +0200 |
| commit | 702198f39b4eb71a068c20c9969bd86856fa85ae (patch) | |
| tree | bdee823a26505a752dc9c512cfb9bcfee0cbe90f /Source/Core/VideoCommon | |
| parent | ca8554e7d1d7c77b3c2a9ed8a7fb12de7096c67b (diff) | |
| parent | 4c40e70b8af839f84d7d9b8306116cabf3965cdb (diff) | |
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
Diffstat (limited to 'Source/Core/VideoCommon')
| -rw-r--r-- | Source/Core/VideoCommon/Src/CommandProcessor.cpp | 56 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/EmuWindow.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/HiresTextures.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/PixelShaderGen.cpp | 21 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/PixelShaderManager.cpp | 12 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/RenderBase.cpp | 22 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/TextureConversionShader.cpp | 6 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/VertexLoader.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/VertexLoaderManager.cpp | 43 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/VertexManagerBase.cpp | 8 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/VertexShaderGen.cpp | 20 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/VertexShaderManager.cpp | 6 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/VideoConfig.cpp | 30 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/VideoConfig.h | 14 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/XFStructs.cpp | 2 |
15 files changed, 134 insertions, 112 deletions
diff --git a/Source/Core/VideoCommon/Src/CommandProcessor.cpp b/Source/Core/VideoCommon/Src/CommandProcessor.cpp index dacec67823..1958b1c1d9 100644 --- a/Source/Core/VideoCommon/Src/CommandProcessor.cpp +++ b/Source/Core/VideoCommon/Src/CommandProcessor.cpp @@ -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"); diff --git a/Source/Core/VideoCommon/Src/EmuWindow.cpp b/Source/Core/VideoCommon/Src/EmuWindow.cpp index bf9da4190b..8952432789 100644 --- a/Source/Core/VideoCommon/Src/EmuWindow.cpp +++ b/Source/Core/VideoCommon/Src/EmuWindow.cpp @@ -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; diff --git a/Source/Core/VideoCommon/Src/HiresTextures.cpp b/Source/Core/VideoCommon/Src/HiresTextures.cpp index 5a3fb051c3..0207bc021c 100644 --- a/Source/Core/VideoCommon/Src/HiresTextures.cpp +++ b/Source/Core/VideoCommon/Src/HiresTextures.cpp @@ -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; diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index 26391be4dd..93f328fb61 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -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"); diff --git a/Source/Core/VideoCommon/Src/PixelShaderManager.cpp b/Source/Core/VideoCommon/Src/PixelShaderManager.cpp index ad84f6876e..265bebf991 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderManager.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderManager.cpp @@ -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 diff --git a/Source/Core/VideoCommon/Src/RenderBase.cpp b/Source/Core/VideoCommon/Src/RenderBase.cpp index 90a09aec43..652a613b2a 100644 --- a/Source/Core/VideoCommon/Src/RenderBase.cpp +++ b/Source/Core/VideoCommon/Src/RenderBase.cpp @@ -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; } diff --git a/Source/Core/VideoCommon/Src/TextureConversionShader.cpp b/Source/Core/VideoCommon/Src/TextureConversionShader.cpp index 5a81c9e7d5..314be94355 100644 --- a/Source/Core/VideoCommon/Src/TextureConversionShader.cpp +++ b/Source/Core/VideoCommon/Src/TextureConversionShader.cpp @@ -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 diff --git a/Source/Core/VideoCommon/Src/VertexLoader.cpp b/Source/Core/VideoCommon/Src/VertexLoader.cpp index 74c1bd9705..f27271efe6 100644 --- a/Source/Core/VideoCommon/Src/VertexLoader.cpp +++ b/Source/Core/VideoCommon/Src/VertexLoader.cpp @@ -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); diff --git a/Source/Core/VideoCommon/Src/VertexLoaderManager.cpp b/Source/Core/VideoCommon/Src/VertexLoaderManager.cpp index 153e69a8c3..01db9f647c 100644 --- a/Source/Core/VideoCommon/Src/VertexLoaderManager.cpp +++ b/Source/Core/VideoCommon/Src/VertexLoaderManager.cpp @@ -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) { - 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(); - } - }; + +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 { diff --git a/Source/Core/VideoCommon/Src/VertexManagerBase.cpp b/Source/Core/VideoCommon/Src/VertexManagerBase.cpp index 076c45e4eb..d85548bf1f 100644 --- a/Source/Core/VideoCommon/Src/VertexManagerBase.cpp +++ b/Source/Core/VideoCommon/Src/VertexManagerBase.cpp @@ -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"); } } diff --git a/Source/Core/VideoCommon/Src/VertexShaderGen.cpp b/Source/Core/VideoCommon/Src/VertexShaderGen.cpp index 2c0f5676ed..64f57d4ad0 100644 --- a/Source/Core/VideoCommon/Src/VertexShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/VertexShaderGen.cpp @@ -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"); diff --git a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp index a5e84ee69b..b8c9b7d5a3 100644 --- a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp +++ b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp @@ -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]); diff --git a/Source/Core/VideoCommon/Src/VideoConfig.cpp b/Source/Core/VideoCommon/Src/VideoConfig.cpp index 60677ceeeb..ad040b9e24 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.cpp +++ b/Source/Core/VideoCommon/Src/VideoConfig.cpp @@ -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); diff --git a/Source/Core/VideoCommon/Src/VideoConfig.h b/Source/Core/VideoCommon/Src/VideoConfig.h index 88326346f2..f282a3edeb 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.h +++ b/Source/Core/VideoCommon/Src/VideoConfig.h @@ -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; diff --git a/Source/Core/VideoCommon/Src/XFStructs.cpp b/Source/Core/VideoCommon/Src/XFStructs.cpp index df9624b6f0..efbe09e4b3 100644 --- a/Source/Core/VideoCommon/Src/XFStructs.cpp +++ b/Source/Core/VideoCommon/Src/XFStructs.cpp @@ -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; |
