summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--helpers/CMakeLists.txt11
-rw-r--r--helpers/glprofile.cpp48
-rw-r--r--helpers/glprofile.hpp86
-rw-r--r--retrace/CMakeLists.txt3
-rw-r--r--retrace/glws.hpp56
-rw-r--r--wrappers/CMakeLists.txt2
6 files changed, 155 insertions, 51 deletions
diff --git a/helpers/CMakeLists.txt b/helpers/CMakeLists.txt
index 235ef36a..5d02d5b8 100644
--- a/helpers/CMakeLists.txt
+++ b/helpers/CMakeLists.txt
@@ -2,6 +2,17 @@
# API helpers
+include_directories (
+ ${CMAKE_BINARY_DIR}/dispatch
+ ${CMAKE_SOURCE_DIR}/dispatch
+)
+
+add_convenience_library (glhelpers
+ glprofile.cpp
+ eglsize.cpp
+)
+
+
if (WIN32)
add_convenience_library (d3dhelpers
d3dshader.cpp
diff --git a/helpers/glprofile.cpp b/helpers/glprofile.cpp
new file mode 100644
index 00000000..b893adfb
--- /dev/null
+++ b/helpers/glprofile.cpp
@@ -0,0 +1,48 @@
+/**************************************************************************
+ *
+ * Copyright 2014 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#include "glprofile.hpp"
+
+
+namespace glprofile {
+
+
+std::ostream &
+operator << (std::ostream &os, const Profile & profile) {
+ os << "OpenGL";
+ if (profile.api == API_GLES) {
+ os << " ES";
+ }
+ os << " " << profile.major << "." << profile.minor;
+ if (profile.api == API_GL &&
+ profile.versionGreaterOrEqual(3, 2)) {
+ os << " " << (profile.core ? "core" : "compat");
+ }
+ return os;
+}
+
+
+} /* namespace glprofile */
diff --git a/helpers/glprofile.hpp b/helpers/glprofile.hpp
new file mode 100644
index 00000000..e8d9edbd
--- /dev/null
+++ b/helpers/glprofile.hpp
@@ -0,0 +1,86 @@
+/**************************************************************************
+ *
+ * Copyright 2014 VMware, Inc.
+ * Copyright 2011 Jose Fonseca
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/*
+ * Representation and manipulation of OpenGL context profiles.
+ */
+
+
+#include <ostream>
+
+
+#ifndef GLPROFILE_HPP
+#define GLPROFILE_HPP
+
+
+namespace glprofile {
+
+
+enum Api {
+ API_GL = 0,
+ API_GLES
+};
+
+
+struct Profile {
+ unsigned major:8;
+ unsigned minor:8;
+ unsigned api:1;
+ unsigned core:1;
+
+ inline
+ Profile(Api _api = API_GL, unsigned _major = 1, unsigned _minor = 0, bool _core = false) {
+ api = _api;
+ major = _major;
+ minor = _minor;
+ core = _core;
+ }
+
+ inline bool
+ versionGreaterOrEqual(unsigned refMajor, unsigned refMinor) const {
+ return major > refMajor ||
+ (major == refMajor && minor >= refMinor);
+ }
+
+ // Comparison operator, mainly for use in std::map
+ inline bool
+ operator < (const Profile & other) const {
+ return api < other.api ||
+ major < other.major ||
+ minor < other.minor ||
+ core < other.core;
+ }
+};
+
+
+std::ostream &
+operator << (std::ostream &os, const Profile & profile);
+
+
+} /* namespace glprofile */
+
+
+#endif // GLPROFILE_HPP
diff --git a/retrace/CMakeLists.txt b/retrace/CMakeLists.txt
index b3021bc2..843e1ca4 100644
--- a/retrace/CMakeLists.txt
+++ b/retrace/CMakeLists.txt
@@ -96,6 +96,7 @@ if (WIN32 OR APPLE OR X11_FOUND)
target_link_libraries (glretrace
retrace_common
glretrace_common
+ glhelpers
glproc_gl
)
@@ -135,6 +136,7 @@ if (ENABLE_EGL AND X11_FOUND AND NOT WIN32 AND NOT APPLE AND NOT ENABLE_WAFFLE)
target_link_libraries (eglretrace
retrace_common
glretrace_common
+ glhelpers
glproc_egl
${X11_X11_LIB}
${CMAKE_THREAD_LIBS_INIT}
@@ -154,6 +156,7 @@ if (ENABLE_EGL AND (ANDROID OR ENABLE_WAFFLE) AND Waffle_FOUND)
target_link_libraries (eglretrace
retrace_common
glretrace_common
+ glhelpers
glproc_egl
${Waffle_LIBRARY}
${X11_X11_LIB}
diff --git a/retrace/glws.hpp b/retrace/glws.hpp
index 6eb3aa67..d1bf0046 100644
--- a/retrace/glws.hpp
+++ b/retrace/glws.hpp
@@ -36,61 +36,17 @@
#include <vector>
#include <set>
#include <string>
-#include <ostream>
+#include "glprofile.hpp"
-namespace glws {
-
-
-enum Api {
- API_GL = 0,
- API_GLES
-};
-
-
-struct Profile {
- unsigned major:8;
- unsigned minor:8;
- unsigned api:1;
- unsigned core:1;
-
- inline
- Profile(Api _api = API_GL, unsigned _major = 1, unsigned _minor = 0, bool _core = false) {
- api = _api;
- major = _major;
- minor = _minor;
- core = _core;
- }
- inline bool
- versionGreaterOrEqual(unsigned refMajor, unsigned refMinor) const {
- return major > refMajor ||
- (major == refMajor && minor >= refMinor);
- }
+namespace glws {
- // Comparison operator, mainly for use in std::map
- inline bool
- operator < (const Profile & other) const {
- return api < other.api ||
- major < other.major ||
- minor < other.minor ||
- core < other.core;
- }
-};
-inline std::ostream &
-operator << (std::ostream &os, const Profile & profile) {
- os << "OpenGL";
- if (profile.api == API_GLES) {
- os << " ES";
- }
- os << " " << profile.major << "." << profile.minor;
- if (profile.api == API_GL &&
- profile.versionGreaterOrEqual(3, 2)) {
- os << " " << (profile.core ? "core" : "compat");
- }
- return os;
-}
+using glprofile::Api;
+using glprofile::API_GL;
+using glprofile::API_GLES;
+using glprofile::Profile;
bool
diff --git a/wrappers/CMakeLists.txt b/wrappers/CMakeLists.txt
index aa497545..b3586fe5 100644
--- a/wrappers/CMakeLists.txt
+++ b/wrappers/CMakeLists.txt
@@ -364,7 +364,6 @@ if (ENABLE_EGL AND NOT WIN32 AND NOT APPLE)
egltrace.cpp
glcaps.cpp
gltrace_state.cpp
- ${CMAKE_SOURCE_DIR}/helpers/eglsize.cpp
dlsym.cpp
)
@@ -379,6 +378,7 @@ if (ENABLE_EGL AND NOT WIN32 AND NOT APPLE)
)
target_link_libraries (egltrace
+ glhelpers
glproc_egl
common
${ZLIB_LIBRARIES}