Add SwiftShader source to repo

Oct 6 code drop from Transgaming
Review URL: https://chromereviews.googleplex.com/3846015
diff --git a/src/OpenGL ES 2.0/common/angleutils.h b/src/OpenGL ES 2.0/common/angleutils.h
new file mode 100644
index 0000000..24c766b
--- /dev/null
+++ b/src/OpenGL ES 2.0/common/angleutils.h
@@ -0,0 +1,18 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// angleutils.h: Common ANGLE utilities.
+
+#ifndef COMMON_ANGLEUTILS_H_
+#define COMMON_ANGLEUTILS_H_
+
+// A macro to disallow the copy constructor and operator= functions
+// This must be used in the private: declarations for a class
+#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
+  TypeName(const TypeName&);               \
+  void operator=(const TypeName&)
+
+#endif // COMMON_ANGLEUTILS_H_
diff --git a/src/OpenGL ES 2.0/common/debug.cpp b/src/OpenGL ES 2.0/common/debug.cpp
new file mode 100644
index 0000000..44f9667
--- /dev/null
+++ b/src/OpenGL ES 2.0/common/debug.cpp
@@ -0,0 +1,36 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// debug.cpp: Debugging utilities.
+
+#include "common/debug.h"
+
+#include <stdio.h>
+#include <stdarg.h>
+
+namespace gl
+{
+	static void output(const char *format, va_list vararg)
+	{
+		#if 0
+			FILE* file = fopen(TRACE_OUTPUT_FILE, "a");
+
+			if(file)
+			{
+				vfprintf(file, format, vararg);
+				fclose(file);
+			}
+		#endif
+	}
+
+	void trace(const char *format, ...)
+	{
+		va_list vararg;
+		va_start(vararg, format);
+		output(format, vararg);
+		va_end(vararg);
+	}
+}
diff --git a/src/OpenGL ES 2.0/common/debug.h b/src/OpenGL ES 2.0/common/debug.h
new file mode 100644
index 0000000..31d8371
--- /dev/null
+++ b/src/OpenGL ES 2.0/common/debug.h
@@ -0,0 +1,82 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// debug.h: Debugging utilities.
+
+#ifndef COMMON_DEBUG_H_
+#define COMMON_DEBUG_H_
+
+#include <stdio.h>
+#include <assert.h>
+
+#include "common/angleutils.h"
+
+#if !defined(TRACE_OUTPUT_FILE)
+#define TRACE_OUTPUT_FILE "debug.txt"
+#endif
+
+namespace gl
+{
+    // Outputs text to the debugging log
+    void trace(const char *format, ...);
+}
+
+// A macro to output a trace of a function call and its arguments to the debugging log
+#if defined(ANGLE_DISABLE_TRACE)
+#define TRACE(message, ...) (void(0))
+#else
+#define TRACE(message, ...) gl::trace("trace: %s(%d): "message"\n", __FUNCTION__, __LINE__, __VA_ARGS__)
+#endif
+
+// A macro to output a function call and its arguments to the debugging log, to denote an item in need of fixing.
+#if defined(ANGLE_DISABLE_TRACE)
+#define FIXME(message, ...) (void(0))
+#else
+#define FIXME(message, ...) do {gl::trace("fixme: %s(%d): "message"\n", __FUNCTION__, __LINE__, __VA_ARGS__); assert(false);} while(false)
+#endif
+
+// A macro to output a function call and its arguments to the debugging log, in case of error.
+#if defined(ANGLE_DISABLE_TRACE)
+#define ERR(message, ...) (void(0))
+#else
+#define ERR(message, ...) do {gl::trace("err: %s(%d): "message"\n", __FUNCTION__, __LINE__, __VA_ARGS__); assert(false);} while(false)
+#endif
+
+// A macro asserting a condition and outputting failures to the debug log
+#if !defined(NDEBUG)
+#define ASSERT(expression) do { \
+    if(!(expression)) \
+        ERR("\t! Assert failed in %s(%d): "#expression"\n", __FUNCTION__, __LINE__); \
+        assert(expression); \
+    } while(0)
+#else
+#define ASSERT(expression) (void(0))
+#endif
+
+// A macro to indicate unimplemented functionality
+#if !defined(NDEBUG)
+#define UNIMPLEMENTED() do { \
+    FIXME("\t! Unimplemented: %s(%d)\n", __FUNCTION__, __LINE__); \
+    assert(false); \
+    } while(0)
+#else
+    #define UNIMPLEMENTED() FIXME("\t! Unimplemented: %s(%d)\n", __FUNCTION__, __LINE__)
+#endif
+
+// A macro for code which is not expected to be reached under valid assumptions
+#if !defined(NDEBUG)
+#define UNREACHABLE() do { \
+    ERR("\t! Unreachable reached: %s(%d)\n", __FUNCTION__, __LINE__); \
+    assert(false); \
+    } while(0)
+#else
+    #define UNREACHABLE() ERR("\t! Unreachable reached: %s(%d)\n", __FUNCTION__, __LINE__)
+#endif
+
+// A macro functioning as a compile-time assert to validate constant conditions
+#define META_ASSERT(condition) typedef int COMPILE_TIME_ASSERT_##__LINE__[static_cast<bool>(condition) ? 1 : -1]
+
+#endif   // COMMON_DEBUG_H_