summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/VertexShaderGen.cpp
diff options
context:
space:
mode:
authorcomex <comexk@gmail.com>2015-04-29 17:09:56 -0400
committercomex <comexk@gmail.com>2015-04-29 17:09:56 -0400
commitbac4167ff5cbf07a38073d31440773374f800e9a (patch)
treef2f32158d777aa97ab75ec69ffbcdf8f1455af55 /Source/Core/VideoCommon/VertexShaderGen.cpp
parent79dff19aa0c9f649f9d0783025198a88cd2a8ff0 (diff)
parentae83a1b8216bc863c7a40eec1c5a845d7258546b (diff)
Merge pull request #2319 from comex/linted-fix-qualcomm-fail
(lint issues fixed) Fix OpenGLES 3.0 on Qualcomm's crappy driver, it can't bitshift sometimes.
Diffstat (limited to 'Source/Core/VideoCommon/VertexShaderGen.cpp')
-rw-r--r--Source/Core/VideoCommon/VertexShaderGen.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/VertexShaderGen.cpp b/Source/Core/VideoCommon/VertexShaderGen.cpp
index cb5c23826e..fea6ee3916 100644
--- a/Source/Core/VideoCommon/VertexShaderGen.cpp
+++ b/Source/Core/VideoCommon/VertexShaderGen.cpp
@@ -32,6 +32,29 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ
_assert_(bpmem.genMode.numtexgens == xfmem.numTexGen.numTexGens);
_assert_(bpmem.genMode.numcolchans == xfmem.numChan.numColorChans);
+ if (DriverDetails::HasBug(DriverDetails::BUG_BROKENIVECSHIFTS))
+ {
+ // Add functions to do shifts on scalars and ivecs.
+ // This is included in the vertex shader for lighting shader generation.
+ out.Write("int ilshift(int a, int b) { return a << b; }\n"
+ "int irshift(int a, int b) { return a >> b; }\n"
+
+ "int2 ilshift(int2 a, int2 b) { return int2(a.x << b.x, a.y << b.y); }\n"
+ "int2 ilshift(int2 a, int b) { return int2(a.x << b, a.y << b); }\n"
+ "int2 irshift(int2 a, int2 b) { return int2(a.x >> b.x, a.y >> b.y); }\n"
+ "int2 irshift(int2 a, int b) { return int2(a.x >> b, a.y >> b); }\n"
+
+ "int3 ilshift(int3 a, int3 b) { return int3(a.x << b.x, a.y << b.y, a.z << b.z); }\n"
+ "int3 ilshift(int3 a, int b) { return int3(a.x << b, a.y << b, a.z << b); }\n"
+ "int3 irshift(int3 a, int3 b) { return int3(a.x >> b.x, a.y >> b.y, a.z >> b.z); }\n"
+ "int3 irshift(int3 a, int b) { return int3(a.x >> b, a.y >> b, a.z >> b); }\n"
+
+ "int4 ilshift(int4 a, int4 b) { return int4(a.x << b.x, a.y << b.y, a.z << b.z, a.w << b.w); }\n"
+ "int4 ilshift(int4 a, int b) { return int4(a.x << b, a.y << b, a.z << b, a.w << b); }\n"
+ "int4 irshift(int4 a, int4 b) { return int4(a.x >> b.x, a.y >> b.y, a.z >> b.z, a.w >> b.w); }\n"
+ "int4 irshift(int4 a, int b) { return int4(a.x >> b, a.y >> b, a.z >> b, a.w >> b); }\n\n");
+ }
+
out.Write("%s", s_lighting_struct);
// uniforms