summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon
diff options
context:
space:
mode:
authorRyan Houdek <Sonicadvance1@gmail.com>2014-12-03 01:22:09 -0600
committerRyan Houdek <Sonicadvance1@gmail.com>2014-12-03 01:22:09 -0600
commit303ff79746fe170d8c655a3ef92fc42b96883454 (patch)
tree3471cde08698797f197310e0866d1b12adcd6bf3 /Source/Core/VideoCommon
parent22209bcc62fb30b6c8f047876d82b3ec7e4279ec (diff)
parent5c3bbf74094135b92a3f912eb67cace29676dcc3 (diff)
Merge pull request #1642 from Sonicadvance1/fix_intel_windows_crap
Works around broken Intel Windows video drivers.
Diffstat (limited to 'Source/Core/VideoCommon')
-rw-r--r--Source/Core/VideoCommon/DriverDetails.cpp1
-rw-r--r--Source/Core/VideoCommon/DriverDetails.h25
-rw-r--r--Source/Core/VideoCommon/PixelShaderGen.cpp15
3 files changed, 36 insertions, 5 deletions
diff --git a/Source/Core/VideoCommon/DriverDetails.cpp b/Source/Core/VideoCommon/DriverDetails.cpp
index 4664f17e16..ccde499071 100644
--- a/Source/Core/VideoCommon/DriverDetails.cpp
+++ b/Source/Core/VideoCommon/DriverDetails.cpp
@@ -48,6 +48,7 @@ namespace DriverDetails
{OS_ALL, VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, -1, BUG_BROKENBUFFERSTREAM, -1.0, -1.0, true},
{OS_ALL, VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, -1, BUG_BROKENTEXTURESIZE, -1.0, 65.0, true},
{OS_ALL, VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, -1, BUG_BROKENATTRIBUTELESS, -1.0, 94.0, true},
+ {OS_ALL, VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, -1, BUG_BROKENNEGATEDBOOLEAN,-1.0, -1.0, true},
{OS_ALL, VENDOR_ARM, DRIVER_ARM_MIDGARD, -1, BUG_BROKENBUFFERSTREAM, -1.0, -1.0, true},
{OS_ALL, VENDOR_MESA, DRIVER_NOUVEAU, -1, BUG_BROKENUBO, 900, 916, true},
{OS_ALL, VENDOR_MESA, DRIVER_R600, -1, BUG_BROKENUBO, 900, 913, true},
diff --git a/Source/Core/VideoCommon/DriverDetails.h b/Source/Core/VideoCommon/DriverDetails.h
index 02b56e5d08..49371d3a03 100644
--- a/Source/Core/VideoCommon/DriverDetails.h
+++ b/Source/Core/VideoCommon/DriverDetails.h
@@ -178,6 +178,31 @@ namespace DriverDetails
// This was fixed in a v66 development version, the first shipping driver version with the release was v95.
// To be safe, make v95 the minimum version to work around this issue
BUG_BROKENATTRIBUTELESS,
+ // Bug: Qualcomm has broken boolean negation
+ // Affected devices: Adreno
+ // Started Version: -1
+ // Ended Version: -1
+ // Qualcomm has the boolean negation broken in their shader compiler
+ // Instead of inverting the boolean value it does a binary negation on the full 32bit register
+ // This causes a compare against zero to fail in their shader since it is no longer a 0 or 1 value
+ // but 0xFFFFFFFF or 0xFFFFFFFE depending on what the boolean value was before the negation.
+ //
+ // This bug has a secondary issue tied to it unlike other bugs.
+ // The correction of this bug is to check the boolean value against false which results in us
+ // not doing a negation of the source but instead checking against the boolean value we want.
+ // The issue with this is that Intel's Window driver is broken when checking if a boolean value is
+ // equal to true or false, so one has to do a boolean negation of the source
+ //
+ // eg.
+ // Broken on Qualcomm
+ // Works on Windows Intel
+ // if (!cond)
+ //
+ // Works on Qualcomm
+ // Broken on Windows Intel
+ // if (cond == false)
+ BUG_BROKENNEGATEDBOOLEAN,
+
};
// Initializes our internal vendor, device family, and driver version
diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp
index 71e534df0a..ae27c3f586 100644
--- a/Source/Core/VideoCommon/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/PixelShaderGen.cpp
@@ -13,6 +13,7 @@
#include "VideoCommon/BoundingBox.h"
#include "VideoCommon/BPMemory.h"
#include "VideoCommon/ConstantManager.h"
+#include "VideoCommon/DriverDetails.h"
#include "VideoCommon/LightingShaderGen.h"
#include "VideoCommon/NativeVertexFormat.h"
#include "VideoCommon/PixelShaderGen.h"
@@ -981,10 +982,10 @@ static inline void WriteAlphaTest(T& out, pixel_shader_uid_data* uid_data, API_T
out.SetConstantsUsed(C_ALPHA, C_ALPHA);
- // This outputted if statement is not like 'if(!(cond))' for a reason.
- // Qualcomm's v95 drivers produce incorrect code using logical not
- // Checking against false produces the correct code.
- out.Write("\tif(( ");
+ if (DriverDetails::HasBug(DriverDetails::BUG_BROKENNEGATEDBOOLEAN))
+ out.Write("\tif(( ");
+ else
+ out.Write("\tif(!( ");
uid_data->alpha_test_comp0 = bpmem.alpha_test.comp0;
uid_data->alpha_test_comp1 = bpmem.alpha_test.comp1;
@@ -999,7 +1000,11 @@ static inline void WriteAlphaTest(T& out, pixel_shader_uid_data* uid_data, API_T
// Lookup the second component from the alpha function table
compindex = bpmem.alpha_test.comp1;
out.Write(tevAlphaFuncsTable[compindex], alphaRef[1]);
- out.Write(") == false) {\n");
+
+ if (DriverDetails::HasBug(DriverDetails::BUG_BROKENNEGATEDBOOLEAN))
+ out.Write(") == false) {\n");
+ else
+ out.Write(")) {\n");
out.Write("\t\tocol0 = float4(0.0, 0.0, 0.0, 0.0);\n");
if (dstAlphaMode == DSTALPHA_DUAL_SOURCE_BLEND)