summaryrefslogtreecommitdiff
path: root/retrace
diff options
context:
space:
mode:
authorJose Fonseca <jfonseca@vmware.com>2015-08-25 22:05:36 +0100
committerJose Fonseca <jfonseca@vmware.com>2015-08-25 22:05:36 +0100
commit6d7ddcc5594d334f926aa2e0546ab5b57b9a1e3c (patch)
tree145d7bfae2c3c8014675964687ca80e44885f377 /retrace
parentbafc84295df205d0db53353734ec6d61e0f180c5 (diff)
glretrace: Use the returned context version when checking for occlusion query.
Instead of using the requested context version. This fixes occlusion query detection with all traces recorded on Windows, as wglCreateContext doesn't provide way to specify context version and can't be avoided. Fixes https://github.com/apitrace/apitrace/issues/358#issuecomment-131519038
Diffstat (limited to 'retrace')
-rw-r--r--retrace/glretrace.hpp7
-rwxr-xr-xretrace/glretrace_main.cpp8
-rw-r--r--retrace/glws.cpp16
-rw-r--r--retrace/glws.hpp11
4 files changed, 26 insertions, 16 deletions
diff --git a/retrace/glretrace.hpp b/retrace/glretrace.hpp
index b172f852..5cb4a889 100644
--- a/retrace/glretrace.hpp
+++ b/retrace/glretrace.hpp
@@ -59,7 +59,12 @@ struct Context {
profile(void) const {
return wsContext->profile;
}
-
+
+ inline glprofile::Profile
+ actualProfile(void) const {
+ return wsContext->actualProfile;
+ }
+
inline bool
hasExtension(const char *extension) const {
return wsContext->hasExtension(extension);
diff --git a/retrace/glretrace_main.cpp b/retrace/glretrace_main.cpp
index 71dde8ef..f68b0791 100755
--- a/retrace/glretrace_main.cpp
+++ b/retrace/glretrace_main.cpp
@@ -342,7 +342,7 @@ initContext() {
assert(currentContext);
/* Ensure we have adequate extension support */
- glprofile::Profile currentProfile = currentContext->profile();
+ glprofile::Profile currentProfile = currentContext->actualProfile();
supportsTimestamp = currentProfile.versionGreaterOrEqual(glprofile::API_GL, 3, 3) ||
currentContext->hasExtension("GL_ARB_timer_query");
supportsElapsed = currentContext->hasExtension("GL_EXT_timer_query") || supportsTimestamp;
@@ -358,7 +358,7 @@ initContext() {
/* Check for timer query support */
if (retrace::profilingGpuTimes) {
if (!supportsTimestamp && !supportsElapsed) {
- std::cout << "Error: Cannot run profile, GL_ARB_timer_query or GL_EXT_timer_query extensions are not supported." << std::endl;
+ std::cout << "error: cannot profile, GL_ARB_timer_query or GL_EXT_timer_query extensions are not supported." << std::endl;
exit(-1);
}
@@ -366,14 +366,14 @@ initContext() {
glGetQueryiv(GL_TIME_ELAPSED, GL_QUERY_COUNTER_BITS, &bits);
if (!bits) {
- std::cout << "Error: Cannot run profile, GL_QUERY_COUNTER_BITS == 0." << std::endl;
+ std::cout << "error: cannot profile, GL_QUERY_COUNTER_BITS == 0." << std::endl;
exit(-1);
}
}
/* Check for occlusion query support */
if (retrace::profilingPixelsDrawn && !supportsOcclusion) {
- std::cout << "Error: Cannot run profile, GL_ARB_occlusion_query extension is not supported." << std::endl;
+ std::cout << "error: cannot profile, GL_ARB_occlusion_query extension is not supported (" << currentProfile << ")" << std::endl;
exit(-1);
}
diff --git a/retrace/glws.cpp b/retrace/glws.cpp
index c883ab6e..4d036ca3 100644
--- a/retrace/glws.cpp
+++ b/retrace/glws.cpp
@@ -79,7 +79,8 @@ Context::initialize(void)
{
assert(!initialized);
- extensions.getCurrentContextExtensions(profile);
+ actualProfile = glprofile::getCurrentContextProfile();
+ actualExtensions.getCurrentContextExtensions(actualProfile);
/* Ensure we got a matching profile.
*
@@ -88,17 +89,16 @@ Context::initialize(void)
* Also, see if OpenGL ES can be handled through ARB_ES*_compatibility.
*/
glprofile::Profile expectedProfile = profile;
- glprofile::Profile currentProfile = glprofile::getCurrentContextProfile();
- if (!currentProfile.matches(expectedProfile)) {
+ if (!actualProfile.matches(expectedProfile)) {
if (expectedProfile.api == glprofile::API_GLES &&
- currentProfile.api == glprofile::API_GL &&
- ((expectedProfile.major == 2 && extensions.has("GL_ARB_ES2_compatibility")) ||
- (expectedProfile.major == 3 && extensions.has("GL_ARB_ES3_compatibility")))) {
+ actualProfile.api == glprofile::API_GL &&
+ ((expectedProfile.major == 2 && actualExtensions.has("GL_ARB_ES2_compatibility")) ||
+ (expectedProfile.major == 3 && actualExtensions.has("GL_ARB_ES3_compatibility")))) {
std::cerr << "warning: context mismatch:"
<< " expected " << expectedProfile << ","
- << " but got " << currentProfile << " with GL_ARB_ES" << expectedProfile.major << "_compatibility\n";
+ << " but got " << actualProfile << " with GL_ARB_ES" << expectedProfile.major << "_compatibility\n";
} else {
- std::cerr << "error: context mismatch: expected " << expectedProfile << ", but got " << currentProfile << "\n";
+ std::cerr << "error: context mismatch: expected " << expectedProfile << ", but got " << actualProfile << "\n";
exit(1);
}
}
diff --git a/retrace/glws.hpp b/retrace/glws.hpp
index 06e20c3d..46a58bf0 100644
--- a/retrace/glws.hpp
+++ b/retrace/glws.hpp
@@ -140,13 +140,18 @@ class Context
{
public:
const Visual *visual;
+
+ // Requested profile
Profile profile;
-
- glprofile::Extensions extensions;
+
+ // Created profile
+ Profile actualProfile;
+ glprofile::Extensions actualExtensions;
Context(const Visual *vis) :
visual(vis),
profile(vis->profile),
+ actualProfile(profile),
initialized(false)
{}
@@ -156,7 +161,7 @@ public:
inline bool
hasExtension(const char *extension) const {
assert(initialized);
- return extensions.has(extension);
+ return actualExtensions.has(extension);
}
private: