Commit e3352f94 by Yuly Novikov Committed by Commit Bot

Change angle_util to be a shared library

So that there will be one instance of static thread synchronization variables in AndroidWindow. Previously there was one instance in lib_angle_deqp_gles2_tests__library and one in libangle_deqp_libgles2, resulting in AndroidWindow::initialize waiting forever. Also make the change in GYP build to fix standalone build, and fix rpath issues on Mac. BUG=angleproject:1471 TEST=end2end and deqp tests on standalone Win10 and end2end on GN Mac 10.11 Change-Id: I731578459400bb47d269df129aabed9b67b555e6 Reviewed-on: https://chromium-review.googlesource.com/376202Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
parent d5da505d
......@@ -497,7 +497,7 @@ config("angle_util_config") {
}
}
static_library("angle_util") {
shared_library("angle_util") {
sources = rebase_path(util_gypi.util_sources, ".", "util")
if (is_win) {
......@@ -514,6 +514,10 @@ static_library("angle_util") {
if (is_mac) {
sources += rebase_path(util_gypi.util_osx_sources, ".", "util")
libs = [
"AppKit.framework",
"QuartzCore.framework",
]
}
if (use_x11) {
......@@ -538,6 +542,7 @@ static_library("angle_util") {
defines = [
"GL_GLEXT_PROTOTYPES",
"EGL_EGLEXT_PROTOTYPES",
"LIBANGLE_UTIL_IMPLEMENTATION",
]
configs += [
......@@ -549,6 +554,13 @@ static_library("angle_util") {
":angle_util_config",
":internal_config",
]
if (is_mac && !is_component_build) {
ldflags = [
"-install_name",
"@rpath/lib${target_name}.dylib",
]
public_configs += [ ":shared_library_public_config" ]
}
deps = [
":angle_common",
......
......@@ -40,6 +40,7 @@
4100, # Unreferenced formal parameter. Not interesting.
4127, # conditional expression is constant. Too noisy to be useful.
4718, # Recursive call has no side effects. Fires on xtree system header.
4251, # STL objects do not have DLL interface, needed by ShaderVars.h and angle_util
],
'conditions':
[
......@@ -50,10 +51,6 @@
['component=="shared_library"',
{
'defines': [ 'COMPONENT_BUILD' ],
'msvs_disabled_warnings':
[
4251, # STL objects do not have DLL interface, needed by ShaderVars.h
],
}],
],
'msvs_settings':
......
......@@ -10,13 +10,15 @@
#define LIBGLESV2_EXPORT_H_
#if defined(_WIN32)
# if defined(LIBGLESV2_IMPLEMENTATION) || defined(LIBANGLE_IMPLEMENTATION)
#if defined(LIBGLESV2_IMPLEMENTATION) || defined(LIBANGLE_IMPLEMENTATION) || \
defined(LIBANGLE_UTIL_IMPLEMENTATION)
# define ANGLE_EXPORT __declspec(dllexport)
# else
# define ANGLE_EXPORT __declspec(dllimport)
# endif
#elif defined(__GNUC__)
# if defined(LIBGLESV2_IMPLEMENTATION) || defined(LIBANGLE_IMPLEMENTATION)
#if defined(LIBGLESV2_IMPLEMENTATION) || defined(LIBANGLE_IMPLEMENTATION) || \
defined(LIBANGLE_UTIL_IMPLEMENTATION)
# define ANGLE_EXPORT __attribute__((visibility ("default")))
# else
# define ANGLE_EXPORT
......
......@@ -303,6 +303,7 @@ if (build_angle_deqp_tests) {
shared_library(shared_library_name) {
deps = [
":angle_deqp_libtester",
"//third_party/angle:angle_util",
]
configs -= deqp_undefine_configs
......
......@@ -1547,6 +1547,7 @@
'AdditionalOptions':
[
'/bigobj', # needed for glsBuiltinPrecisionTests.cpp
'/wd4251', # needed for angle_util STL objects not having DLL interface
],
},
},
......@@ -1762,6 +1763,7 @@
[
'angle_test_support',
'<(angle_path)/util/util.gyp:angle_util',
'<(angle_path)/src/angle.gyp:angle_common',
],
'export_dependent_settings':
[
......
......@@ -12,6 +12,7 @@
#include <stdint.h>
#include <string>
#include <export.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <GLES3/gl3.h>
......@@ -28,7 +29,7 @@ class OSWindow;
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE 0x6AC0
#endif
struct EGLPlatformParameters
struct ANGLE_EXPORT EGLPlatformParameters
{
EGLint renderer;
EGLint majorVersion;
......@@ -46,10 +47,10 @@ struct EGLPlatformParameters
EGLint presentPath);
};
bool operator<(const EGLPlatformParameters &a, const EGLPlatformParameters &b);
bool operator==(const EGLPlatformParameters &a, const EGLPlatformParameters &b);
ANGLE_EXPORT bool operator<(const EGLPlatformParameters &a, const EGLPlatformParameters &b);
ANGLE_EXPORT bool operator==(const EGLPlatformParameters &a, const EGLPlatformParameters &b);
class EGLWindow : angle::NonCopyable
class ANGLE_EXPORT EGLWindow : angle::NonCopyable
{
public:
EGLWindow(EGLint glesMajorVersion,
......
......@@ -10,9 +10,11 @@
#ifndef UTIL_MATRIX_H
#define UTIL_MATRIX_H
#include <export.h>
#include "Vector.h"
struct Matrix4
struct ANGLE_EXPORT Matrix4
{
float data[16];
......@@ -49,13 +51,13 @@ struct Matrix4
static Vector3 transform(const Matrix4 &mat, const Vector4 &pt);
};
Matrix4 operator*(const Matrix4 &a, const Matrix4 &b);
Matrix4 &operator*=(Matrix4 &a, const Matrix4 &b);
Matrix4 operator*(const Matrix4 &a, float b);
Matrix4 &operator*=(Matrix4 &a, float b);
Vector4 operator*(const Matrix4 &a, const Vector4 &b);
ANGLE_EXPORT Matrix4 operator*(const Matrix4 &a, const Matrix4 &b);
ANGLE_EXPORT Matrix4 &operator*=(Matrix4 &a, const Matrix4 &b);
ANGLE_EXPORT Matrix4 operator*(const Matrix4 &a, float b);
ANGLE_EXPORT Matrix4 &operator*=(Matrix4 &a, float b);
ANGLE_EXPORT Vector4 operator*(const Matrix4 &a, const Vector4 &b);
bool operator==(const Matrix4 &a, const Matrix4 &b);
bool operator!=(const Matrix4 &a, const Matrix4 &b);
ANGLE_EXPORT bool operator==(const Matrix4 &a, const Matrix4 &b);
ANGLE_EXPORT bool operator!=(const Matrix4 &a, const Matrix4 &b);
#endif // UTIL_MATRIX_H
......@@ -11,12 +11,13 @@
#include <stdlib.h>
#include <export.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include "Event.h"
class OSPixmap
class ANGLE_EXPORT OSPixmap
{
public:
OSPixmap() {}
......@@ -27,6 +28,6 @@ class OSPixmap
virtual EGLNativePixmapType getNativePixmap() const = 0;
};
OSPixmap *CreateOSPixmap();
ANGLE_EXPORT OSPixmap *CreateOSPixmap();
#endif // SAMPLE_UTIL_PIXMAP_H_
......@@ -11,12 +11,13 @@
#include <stdint.h>
#include <string>
#include <export.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include "Event.h"
class OSWindow
class ANGLE_EXPORT OSWindow
{
public:
OSWindow();
......@@ -63,6 +64,6 @@ class OSWindow
std::list<Event> mEvents;
};
OSWindow *CreateOSWindow();
ANGLE_EXPORT OSWindow *CreateOSWindow();
#endif // SAMPLE_UTIL_WINDOW_H
......@@ -7,7 +7,9 @@
#ifndef SAMPLE_UTIL_TIMER_H
#define SAMPLE_UTIL_TIMER_H
class Timer
#include <export.h>
class ANGLE_EXPORT Timer
{
public:
virtual ~Timer() {}
......@@ -16,6 +18,6 @@ class Timer
virtual double getElapsedTime() const = 0;
};
Timer *CreateTimer();
ANGLE_EXPORT Timer *CreateTimer();
#endif // SAMPLE_UTIL_TIMER_H
......@@ -12,7 +12,9 @@
#include <ostream>
struct Vector2
#include <export.h>
struct ANGLE_EXPORT Vector2
{
Vector2();
Vector2(float x, float y);
......@@ -31,9 +33,9 @@ struct Vector2
float x, y;
};
std::ostream &operator<<(std::ostream &stream, const Vector2 &vec);
ANGLE_EXPORT std::ostream &operator<<(std::ostream &stream, const Vector2 &vec);
struct Vector3
struct ANGLE_EXPORT Vector3
{
Vector3();
Vector3(float x, float y, float z);
......@@ -52,14 +54,14 @@ struct Vector3
float x, y, z;
};
Vector3 operator*(const Vector3 &a, const Vector3 &b);
Vector3 operator*(const Vector3 &a, const float &b);
Vector3 operator/(const Vector3 &a, const Vector3 &b);
Vector3 operator/(const Vector3 &a, const float &b);
Vector3 operator+(const Vector3 &a, const Vector3 &b);
Vector3 operator-(const Vector3 &a, const Vector3 &b);
ANGLE_EXPORT Vector3 operator*(const Vector3 &a, const Vector3 &b);
ANGLE_EXPORT Vector3 operator*(const Vector3 &a, const float &b);
ANGLE_EXPORT Vector3 operator/(const Vector3 &a, const Vector3 &b);
ANGLE_EXPORT Vector3 operator/(const Vector3 &a, const float &b);
ANGLE_EXPORT Vector3 operator+(const Vector3 &a, const Vector3 &b);
ANGLE_EXPORT Vector3 operator-(const Vector3 &a, const Vector3 &b);
struct Vector4
struct ANGLE_EXPORT Vector4
{
Vector4();
Vector4(float x, float y, float z, float w);
......
......@@ -12,20 +12,22 @@
#include <cstddef>
#include <vector>
#include <export.h>
#include <GLES2/gl2.h>
#include "Vector.h"
struct SphereGeometry
struct ANGLE_EXPORT SphereGeometry
{
std::vector<Vector3> positions;
std::vector<Vector3> normals;
std::vector<GLushort> indices;
};
void CreateSphereGeometry(size_t sliceCount, float radius, SphereGeometry *result);
ANGLE_EXPORT void CreateSphereGeometry(size_t sliceCount, float radius, SphereGeometry *result);
struct CubeGeometry
struct ANGLE_EXPORT CubeGeometry
{
std::vector<Vector3> positions;
std::vector<Vector3> normals;
......@@ -33,6 +35,6 @@ struct CubeGeometry
std::vector<GLushort> indices;
};
void GenerateCubeGeometry(float radius, CubeGeometry *result);
ANGLE_EXPORT void GenerateCubeGeometry(float radius, CubeGeometry *result);
#endif // UTIL_GEOMETRY_UTILS_H
......@@ -13,10 +13,12 @@
// TODO(jmadill): Rework this if Chromium decides to ban <random>
#include <random>
#include <export.h>
namespace angle
{
class RNG
class ANGLE_EXPORT RNG
{
public:
// Seed from clock
......
......@@ -7,6 +7,7 @@
#ifndef SAMPLE_UTIL_SHADER_UTILS_H
#define SAMPLE_UTIL_SHADER_UTILS_H
#include <export.h>
#include <GLES3/gl31.h>
#include <GLES3/gl3.h>
#include <GLES2/gl2.h>
......@@ -19,15 +20,17 @@
#define SHADER_SOURCE(...) #__VA_ARGS__
GLuint CompileShader(GLenum type, const std::string &source);
GLuint CompileShaderFromFile(GLenum type, const std::string &sourcePath);
ANGLE_EXPORT GLuint CompileShader(GLenum type, const std::string &source);
ANGLE_EXPORT GLuint CompileShaderFromFile(GLenum type, const std::string &sourcePath);
ANGLE_EXPORT GLuint
CompileProgramWithTransformFeedback(const std::string &vsSource,
const std::string &fsSource,
const std::vector<std::string> &transformFeedbackVaryings,
GLenum bufferMode);
ANGLE_EXPORT GLuint CompileProgram(const std::string &vsSource, const std::string &fsSource);
ANGLE_EXPORT GLuint CompileProgramFromFiles(const std::string &vsPath, const std::string &fsPath);
ANGLE_EXPORT GLuint CompileComputeProgram(const std::string &csSource,
bool outputErrorMessages = true);
GLuint CompileProgramWithTransformFeedback(
const std::string &vsSource,
const std::string &fsSource,
const std::vector<std::string> &transformFeedbackVaryings,
GLenum bufferMode);
GLuint CompileProgram(const std::string &vsSource, const std::string &fsSource);
GLuint CompileProgramFromFiles(const std::string &vsPath, const std::string &fsPath);
GLuint CompileComputeProgram(const std::string &csSource, bool outputErrorMessages = true);
#endif // SAMPLE_UTIL_SHADER_UTILS_H
......@@ -11,31 +11,33 @@
#include <string>
#include <export.h>
#include "common/angleutils.h"
namespace angle
{
std::string GetExecutablePath();
std::string GetExecutableDirectory();
std::string GetSharedLibraryExtension();
ANGLE_EXPORT std::string GetExecutablePath();
ANGLE_EXPORT std::string GetExecutableDirectory();
ANGLE_EXPORT std::string GetSharedLibraryExtension();
// Cross platform equivalent of the Windows Sleep function
void Sleep(unsigned int milliseconds);
ANGLE_EXPORT void Sleep(unsigned int milliseconds);
void SetLowPriorityProcess();
ANGLE_EXPORT void SetLowPriorityProcess();
// Write a debug message, either to a standard output or Debug window.
void WriteDebugMessage(const char *format, ...);
ANGLE_EXPORT void WriteDebugMessage(const char *format, ...);
class Library : angle::NonCopyable
class ANGLE_EXPORT Library : angle::NonCopyable
{
public:
virtual ~Library() {}
virtual void *getSymbol(const std::string &symbolName) = 0;
};
Library *loadLibrary(const std::string &libraryName);
ANGLE_EXPORT Library *loadLibrary(const std::string &libraryName);
} // namespace angle
......
......@@ -96,7 +96,7 @@
[
{
'target_name': 'angle_util',
'type': 'static_library',
'type': 'shared_library',
'includes': [ '../build/common_defines.gypi', ],
'dependencies':
[
......@@ -121,6 +121,7 @@
[
'GL_GLEXT_PROTOTYPES',
'EGL_EGLEXT_PROTOTYPES',
'LIBANGLE_UTIL_IMPLEMENTATION',
],
'direct_dependent_settings':
{
......
......@@ -14,9 +14,11 @@
#include <X11/Xutil.h>
#include <X11/Xresource.h>
#include <export.h>
#include "OSWindow.h"
class X11Window : public OSWindow
class ANGLE_EXPORT X11Window : public OSWindow
{
public:
X11Window();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment