Fix GCC build This CL fixes building the 'all' target in a Chromium checkout with the following args.gn: is_debug = false is_clang = false use_sysroot = false proprietary_codecs = true ffmpeg_branding = "Chrome" is_component_build = true enable_nacl = false use_goma = true Bug chromium:697528 Change-Id: Ie725988e8a1cb9ee672eb1e8e20d718ac91004fa Change-Id: Ie725988e8a1cb9ee672eb1e8e20d718ac91004fa Reviewed-on: https://swiftshader-review.googlesource.com/8888 Reviewed-by: Nicolas Capens <capn@google.com> Tested-by: Tom Anderson <thomasanderson@google.com>
diff --git a/src/OpenGL/compiler/preprocessor/MacroExpander.h b/src/OpenGL/compiler/preprocessor/MacroExpander.h index 9d304a9..92d275d 100644 --- a/src/OpenGL/compiler/preprocessor/MacroExpander.h +++ b/src/OpenGL/compiler/preprocessor/MacroExpander.h
@@ -75,7 +75,7 @@ Diagnostics* mDiagnostics; const bool mParseDefined; - std::auto_ptr<Token> mReserveToken; + std::unique_ptr<Token> mReserveToken; std::vector<MacroContext*> mContextStack; };
diff --git a/src/Reactor/LLVMReactor.cpp b/src/Reactor/LLVMReactor.cpp index 0d56858..1e8a75a 100644 --- a/src/Reactor/LLVMReactor.cpp +++ b/src/Reactor/LLVMReactor.cpp
@@ -5218,7 +5218,7 @@ else { RValue<Int4> greater = CmpNLE(x, y); - return x & greater | y & ~greater; + return (x & greater) | (y & ~greater); } } @@ -5231,7 +5231,7 @@ else { RValue<Int4> less = CmpLT(x, y); - return x & less | y & ~less; + return (x & less) | (y & ~less); } } @@ -5558,7 +5558,7 @@ else { RValue<UInt4> greater = CmpNLE(x, y); - return x & greater | y & ~greater; + return (x & greater) | (y & ~greater); } } @@ -5571,7 +5571,7 @@ else { RValue<UInt4> less = CmpLT(x, y); - return x & less | y & ~less; + return (x & less) | (y & ~less); } }
diff --git a/src/Renderer/Context.hpp b/src/Renderer/Context.hpp index 2f363f9..640ec4e 100644 --- a/src/Renderer/Context.hpp +++ b/src/Renderer/Context.hpp
@@ -198,7 +198,7 @@ BLEND_CONSTANTALPHA, BLEND_INVCONSTANTALPHA, - BLEND_LAST = BLEND_INVCONSTANT + BLEND_LAST = BLEND_INVCONSTANTALPHA }; enum BlendOperation ENUM_UNDERLYING_TYPE_UNSIGNED_INT
diff --git a/src/Renderer/Surface.cpp b/src/Renderer/Surface.cpp index 0e626f1..ffc7c17 100644 --- a/src/Renderer/Surface.cpp +++ b/src/Renderer/Surface.cpp
@@ -3289,7 +3289,7 @@ unsigned char maskedS = s & mask; unsigned char invMask = ~mask; unsigned int fill = maskedS; - fill = fill | (fill << 8) | (fill << 16) + (fill << 24); + fill = fill | (fill << 8) | (fill << 16) | (fill << 24); char *buffer = (char*)lockStencil(0, 0, 0, PUBLIC);
diff --git a/src/Shader/SamplerCore.cpp b/src/Shader/SamplerCore.cpp index 2a6766a..6025291 100644 --- a/src/Shader/SamplerCore.cpp +++ b/src/Shader/SamplerCore.cpp
@@ -705,10 +705,10 @@ { Short4 b; - c.x = borderMask & c.x | ~borderMask & (*Pointer<Short4>(texture + OFFSET(Texture,borderColor4[0])) >> (hasUnsignedTextureComponent(0) ? 0 : 1)); - c.y = borderMask & c.y | ~borderMask & (*Pointer<Short4>(texture + OFFSET(Texture,borderColor4[1])) >> (hasUnsignedTextureComponent(1) ? 0 : 1)); - c.z = borderMask & c.z | ~borderMask & (*Pointer<Short4>(texture + OFFSET(Texture,borderColor4[2])) >> (hasUnsignedTextureComponent(2) ? 0 : 1)); - c.w = borderMask & c.w | ~borderMask & (*Pointer<Short4>(texture + OFFSET(Texture,borderColor4[3])) >> (hasUnsignedTextureComponent(3) ? 0 : 1)); + c.x = (borderMask & c.x) | (~borderMask & (*Pointer<Short4>(texture + OFFSET(Texture,borderColor4[0])) >> (hasUnsignedTextureComponent(0) ? 0 : 1))); + c.y = (borderMask & c.y) | (~borderMask & (*Pointer<Short4>(texture + OFFSET(Texture,borderColor4[1])) >> (hasUnsignedTextureComponent(1) ? 0 : 1))); + c.z = (borderMask & c.z) | (~borderMask & (*Pointer<Short4>(texture + OFFSET(Texture,borderColor4[2])) >> (hasUnsignedTextureComponent(2) ? 0 : 1))); + c.w = (borderMask & c.w) | (~borderMask & (*Pointer<Short4>(texture + OFFSET(Texture,borderColor4[3])) >> (hasUnsignedTextureComponent(3) ? 0 : 1))); } } @@ -1170,10 +1170,10 @@ { Int4 b; - c.x = As<Float4>(borderMask & As<Int4>(c.x) | ~borderMask & *Pointer<Int4>(texture + OFFSET(Texture,borderColorF[0]))); - c.y = As<Float4>(borderMask & As<Int4>(c.y) | ~borderMask & *Pointer<Int4>(texture + OFFSET(Texture,borderColorF[1]))); - c.z = As<Float4>(borderMask & As<Int4>(c.z) | ~borderMask & *Pointer<Int4>(texture + OFFSET(Texture,borderColorF[2]))); - c.w = As<Float4>(borderMask & As<Int4>(c.w) | ~borderMask & *Pointer<Int4>(texture + OFFSET(Texture,borderColorF[3]))); + c.x = As<Float4>((borderMask & As<Int4>(c.x)) | (~borderMask & *Pointer<Int4>(texture + OFFSET(Texture,borderColorF[0])))); + c.y = As<Float4>((borderMask & As<Int4>(c.y)) | (~borderMask & *Pointer<Int4>(texture + OFFSET(Texture,borderColorF[1])))); + c.z = As<Float4>((borderMask & As<Int4>(c.z)) | (~borderMask & *Pointer<Int4>(texture + OFFSET(Texture,borderColorF[2])))); + c.w = As<Float4>((borderMask & As<Int4>(c.w)) | (~borderMask & *Pointer<Int4>(texture + OFFSET(Texture,borderColorF[3])))); } } @@ -1439,8 +1439,8 @@ Float4 dvdy = duvdxy.wwww; Int4 mask = As<Int4>(CmpNLT(dUV2.x, dUV2.y)); - uDelta = As<Float4>(As<Int4>(dudx) & mask | As<Int4>(dudy) & ~mask); - vDelta = As<Float4>(As<Int4>(dvdx) & mask | As<Int4>(dvdy) & ~mask); + uDelta = As<Float4>((As<Int4>(dudx) & mask) | ((As<Int4>(dudy) & ~mask))); + vDelta = As<Float4>((As<Int4>(dvdx) & mask) | ((As<Int4>(dvdy) & ~mask))); anisotropy = lod * Rcp_pp(det); anisotropy = Min(anisotropy, *Pointer<Float>(texture + OFFSET(Texture,maxAnisotropy)));
diff --git a/src/Shader/ShaderCore.cpp b/src/Shader/ShaderCore.cpp index 338ea08..424636b 100644 --- a/src/Shader/ShaderCore.cpp +++ b/src/Shader/ShaderCore.cpp
@@ -331,7 +331,7 @@ Float4 arctan(RValue<Float4> x, bool pp) { Int4 O = CmpNLT(Abs(x), Float4(1.0f)); - Float4 y = As<Float4>(O & As<Int4>(Float4(1.0f) / x) | ~O & As<Int4>(x)); // FIXME: Vector select + Float4 y = As<Float4>((O & As<Int4>(Float4(1.0f) / x)) | (~O & As<Int4>(x))); // FIXME: Vector select // Approximation of atan in [-1..1] Float4 theta = y * (Float4(-0.27f) * Abs(y) + Float4(1.05539816f)); @@ -339,7 +339,7 @@ // +/-pi/2 depending on sign of x Float4 sgnPi_2 = As<Float4>(As<Int4>(Float4(1.57079632e+0f)) ^ (As<Int4>(x) & Int4(0x80000000))); - theta = As<Float4>(O & As<Int4>(sgnPi_2 - theta) | ~O & As<Int4>(theta)); // FIXME: Vector select + theta = As<Float4>((O & As<Int4>(sgnPi_2 - theta)) | (~O & As<Int4>(theta))); // FIXME: Vector select return theta; } @@ -355,14 +355,14 @@ // Rotate to right quadrant when in left quadrant Int4 Q = CmpLT(x0, Float4(0.0f)); theta += As<Float4>(Q & As<Int4>(Float4(1.57079632e+0f))); // pi/2 - Float4 x1 = As<Float4>(Q & As<Int4>(y0) | ~Q & As<Int4>(x0)); // FIXME: Vector select - Float4 y1 = As<Float4>(Q & As<Int4>(-x0) | ~Q & As<Int4>(y0)); // FIXME: Vector select + Float4 x1 = As<Float4>((Q & As<Int4>(y0)) | (~Q & As<Int4>(x0))); // FIXME: Vector select + Float4 y1 = As<Float4>((Q & As<Int4>(-x0)) | (~Q & As<Int4>(y0))); // FIXME: Vector select // Rotate to first octant when in second octant Int4 O = CmpNLT(y1, x1); theta += As<Float4>(O & As<Int4>(Float4(7.85398163e-1f))); // pi/4 - Float4 x2 = As<Float4>(O & As<Int4>(Float4(7.07106781e-1f) * x1 + Float4(7.07106781e-1f) * y1) | ~O & As<Int4>(x1)); // sqrt(2)/2 // FIXME: Vector select - Float4 y2 = As<Float4>(O & As<Int4>(Float4(7.07106781e-1f) * y1 - Float4(7.07106781e-1f) * x1) | ~O & As<Int4>(y1)); // FIXME: Vector select + Float4 x2 = As<Float4>((O & As<Int4>(Float4(7.07106781e-1f) * x1 + Float4(7.07106781e-1f) * y1)) | (~O & As<Int4>(x1))); // sqrt(2)/2 // FIXME: Vector select + Float4 y2 = As<Float4>((O & As<Int4>(Float4(7.07106781e-1f) * y1 - Float4(7.07106781e-1f) * x1)) | (~O & As<Int4>(y1))); // FIXME: Vector select // Approximation of atan in [0..1] Float4 y_x = y2 / x2; @@ -1624,7 +1624,7 @@ void ShaderCore::select(Float4 &dst, RValue<Int4> src0, const Float4 &src1, const Float4 &src2) { // FIXME: LLVM vector select - dst = As<Float4>(src0 & As<Int4>(src1) | ~src0 & As<Int4>(src2)); + dst = As<Float4>((src0 & As<Int4>(src1)) | (~src0 & As<Int4>(src2))); } void ShaderCore::cmp(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, Control control)
diff --git a/third_party/LLVM/BUILD.gn b/third_party/LLVM/BUILD.gn index ba33b24..db8d05d 100644 --- a/third_party/LLVM/BUILD.gn +++ b/third_party/LLVM/BUILD.gn
@@ -51,21 +51,26 @@ if (is_clang) { cflags += [ "-msse2", - "-Wno-unused-local-typedef", - "-Wno-unused-private-field", - "-Wno-null-dereference", "-Wno-header-hygiene", - "-Wno-unused-function", - "-Wno-deprecated-declarations", - "-Wno-unused-variable", - "-Wno-unused-result", + "-Wno-null-dereference", + "-Wno-unused-private-field", + "-Wno-unused-local-typedef", ] - - defines = [ - "__STDC_CONSTANT_MACROS", - "__STDC_LIMIT_MACROS", - ] + } else { + cflags += [ "-Wno-unused-but-set-variable" ] } + cflags += [ + "-Wno-attributes", + "-Wno-deprecated-declarations", + "-Wno-enum-compare", + "-Wno-unused-function", + "-Wno-unused-result", + "-Wno-unused-variable", + ] + defines = [ + "__STDC_CONSTANT_MACROS", + "__STDC_LIMIT_MACROS", + ] } source_set("swiftshader_llvm") {