summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon
diff options
context:
space:
mode:
authorNeoBrainX <NeoBrainX@googlemail.com>2011-09-08 02:14:18 +0200
committerNeoBrainX <NeoBrainX@googlemail.com>2011-09-08 02:14:18 +0200
commit349a3ae91df42d02f2e07485c1a55805535fef03 (patch)
tree36570325f882c2dadb29d6cec5860188575e0505 /Source/Core/VideoCommon
parent6c7bda6851b39d358f9b951739156e07345ccfa4 (diff)
parent8b8e60c2767d2d21b3aeea7e938bdd64e3a2a61b (diff)
Merge remote-tracking branch 'remotes/origin/master' into new-shadercache-uids
Diffstat (limited to 'Source/Core/VideoCommon')
-rw-r--r--Source/Core/VideoCommon/Src/BPFunctions.cpp19
-rw-r--r--Source/Core/VideoCommon/Src/BPFunctions.h2
-rw-r--r--Source/Core/VideoCommon/Src/BPStructs.cpp2
-rw-r--r--Source/Core/VideoCommon/Src/PixelShaderGen.cpp10
-rw-r--r--Source/Core/VideoCommon/Src/RenderBase.h14
-rw-r--r--Source/Core/VideoCommon/Src/VideoCommon.h3
-rw-r--r--Source/Core/VideoCommon/VideoCommon.vcxproj3
7 files changed, 28 insertions, 25 deletions
diff --git a/Source/Core/VideoCommon/Src/BPFunctions.cpp b/Source/Core/VideoCommon/Src/BPFunctions.cpp
index f323f03142..4f7315e832 100644
--- a/Source/Core/VideoCommon/Src/BPFunctions.cpp
+++ b/Source/Core/VideoCommon/Src/BPFunctions.cpp
@@ -44,9 +44,24 @@ void SetGenerationMode(const BPCmd &bp)
g_renderer->SetGenerationMode();
}
-void SetScissor(const BPCmd &bp)
+void SetScissor()
{
- g_renderer->SetScissorRect();
+ const int xoff = bpmem.scissorOffset.x * 2 - 342;
+ const int yoff = bpmem.scissorOffset.y * 2 - 342;
+
+ EFBRectangle rc (bpmem.scissorTL.x - xoff - 342, bpmem.scissorTL.y - yoff - 342,
+ bpmem.scissorBR.x - xoff - 341, bpmem.scissorBR.y - yoff - 341);
+
+ if (rc.left < 0) rc.left = 0;
+ if (rc.top < 0) rc.top = 0;
+ if (rc.right > EFB_WIDTH) rc.right = EFB_WIDTH;
+ if (rc.bottom > EFB_HEIGHT) rc.bottom = EFB_HEIGHT;
+
+ if (rc.left > rc.right) rc.right = rc.left;
+ if (rc.top > rc.bottom) rc.bottom = rc.top;
+
+ TargetRectangle trc = g_renderer->ConvertEFBRectangle(rc);
+ g_renderer->SetScissorRect(trc);
}
void SetLineWidth(const BPCmd &bp)
diff --git a/Source/Core/VideoCommon/Src/BPFunctions.h b/Source/Core/VideoCommon/Src/BPFunctions.h
index d104b12751..2b86523687 100644
--- a/Source/Core/VideoCommon/Src/BPFunctions.h
+++ b/Source/Core/VideoCommon/Src/BPFunctions.h
@@ -38,7 +38,7 @@ enum
void FlushPipeline();
void SetGenerationMode(const BPCmd &bp);
-void SetScissor(const BPCmd &bp);
+void SetScissor();
void SetLineWidth(const BPCmd &bp);
void SetDepthMode(const BPCmd &bp);
void SetBlendMode(const BPCmd &bp);
diff --git a/Source/Core/VideoCommon/Src/BPStructs.cpp b/Source/Core/VideoCommon/Src/BPStructs.cpp
index 42b5b2212a..cee68327f5 100644
--- a/Source/Core/VideoCommon/Src/BPStructs.cpp
+++ b/Source/Core/VideoCommon/Src/BPStructs.cpp
@@ -162,7 +162,7 @@ void BPWritten(const BPCmd& bp)
case BPMEM_SCISSORTL: // Scissor Rectable Top, Left
case BPMEM_SCISSORBR: // Scissor Rectable Bottom, Right
case BPMEM_SCISSOROFFSET: // Scissor Offset
- SetScissor(bp);
+ SetScissor();
break;
case BPMEM_LINEPTWIDTH: // Line Width
SetLineWidth(bp);
diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
index 464c16fa58..8aa3a0a56e 100644
--- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
@@ -594,10 +594,12 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType
WRITE(p, " float4 c0 = "I_COLORS"[1], c1 = "I_COLORS"[2], c2 = "I_COLORS"[3], prev = float4(0.0f, 0.0f, 0.0f, 0.0f), textemp = float4(0.0f, 0.0f, 0.0f, 0.0f), rastemp = float4(0.0f, 0.0f, 0.0f, 0.0f), konsttemp = float4(0.0f, 0.0f, 0.0f, 0.0f);\n"
" float3 comp16 = float3(1.0f, 255.0f, 0.0f), comp24 = float3(1.0f, 255.0f, 255.0f*255.0f);\n"
- " float4 alphabump=0;\n"
- " float3 tevcoord;\n"
- " float2 wrappedcoord, tempcoord;\n"
- " float4 cc0, cc1, cc2, cprev,crastemp,ckonsttemp;\n\n");
+ " float4 alphabump=float4(0.0f,0.0f,0.0f,0.0f);\n"
+ " float3 tevcoord=float3(0.0f, 0.0f, 0.0f);\n"
+ " float2 wrappedcoord=float2(0.0f,0.0f), tempcoord=float2(0.0f,0.0f);\n"
+ " float4 cc0=float4(0.0f,0.0f,0.0f,0.0f), cc1=float4(0.0f,0.0f,0.0f,0.0f);\n"
+ " float4 cc2=float4(0.0f,0.0f,0.0f,0.0f), cprev=float4(0.0f,0.0f,0.0f,0.0f);\n"
+ " float4 crastemp=float4(0.0f,0.0f,0.0f,0.0f),ckonsttemp=float4(0.0f,0.0f,0.0f,0.0f);\n\n");
if(g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
{
diff --git a/Source/Core/VideoCommon/Src/RenderBase.h b/Source/Core/VideoCommon/Src/RenderBase.h
index 17132ebb8c..b2c2c7ecfb 100644
--- a/Source/Core/VideoCommon/Src/RenderBase.h
+++ b/Source/Core/VideoCommon/Src/RenderBase.h
@@ -54,7 +54,7 @@ public:
virtual void SetColorMask() = 0;
virtual void SetBlendMode(bool forceUpdate) = 0;
- virtual bool SetScissorRect() = 0;
+ virtual void SetScissorRect(const TargetRectangle& rc) = 0;
virtual void SetGenerationMode() = 0;
virtual void SetDepthMode() = 0;
virtual void SetLogicOpMode() = 0;
@@ -175,16 +175,4 @@ extern Renderer *g_renderer;
void UpdateViewport(Matrix44& vpCorrection);
-template <typename R>
-void GetScissorRect(MathUtil::Rectangle<R> &rect)
-{
- const int xoff = bpmem.scissorOffset.x * 2 - 342;
- const int yoff = bpmem.scissorOffset.y * 2 - 342;
-
- rect.left = (R)(bpmem.scissorTL.x - xoff - 342);
- rect.top = (R)(bpmem.scissorTL.y - yoff - 342);
- rect.right = (R)(bpmem.scissorBR.x - xoff - 341);
- rect.bottom = (R)(bpmem.scissorBR.y - yoff - 341);
-}
-
#endif // _COMMON_RENDERBASE_H_
diff --git a/Source/Core/VideoCommon/Src/VideoCommon.h b/Source/Core/VideoCommon/Src/VideoCommon.h
index 030c1f0b32..80c0937884 100644
--- a/Source/Core/VideoCommon/Src/VideoCommon.h
+++ b/Source/Core/VideoCommon/Src/VideoCommon.h
@@ -70,8 +70,7 @@ void HandleGLError();
// This structure should only be used to represent a rectangle in EFB
// coordinates, where the origin is at the upper left and the frame dimensions
// are 640 x 528.
-struct EFBRectangle : public MathUtil::Rectangle<int>
-{};
+typedef MathUtil::Rectangle<int> EFBRectangle;
// This structure should only be used to represent a rectangle in standard target
// coordinates, where the origin is at the lower left and the frame dimensions
diff --git a/Source/Core/VideoCommon/VideoCommon.vcxproj b/Source/Core/VideoCommon/VideoCommon.vcxproj
index cf6d8c28a6..dd29d29ccb 100644
--- a/Source/Core/VideoCommon/VideoCommon.vcxproj
+++ b/Source/Core/VideoCommon/VideoCommon.vcxproj
@@ -45,7 +45,7 @@
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugFast|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
@@ -56,7 +56,6 @@
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugFast|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>