diff options
author | Jesse Barker <jesse.barker@linaro.org> | 2012-12-05 15:50:25 -0800 |
---|---|---|
committer | Jesse Barker <jesse.barker@linaro.org> | 2012-12-05 15:50:25 -0800 |
commit | 008f1384ba0eccdaff3ed8088d87f4999b7c01e6 (patch) | |
tree | 04826e367d7218761eb8d3906fea14a64e5206d9 | |
parent | 413f587b3c01afd3e1dbe636ecc4bc4910d563b1 (diff) | |
download | glmark2-008f1384ba0eccdaff3ed8088d87f4999b7c01e6.tar.gz |
GLVisualConfig: Update the visual config object to understand stencil, and,
importantly, to explicitly favor no stencil unless asked via command line option.
-rw-r--r-- | android/src/org/linaro/glmark2/GLVisualConfig.java | 4 | ||||
-rw-r--r-- | android/src/org/linaro/glmark2/Glmark2SurfaceView.java | 7 | ||||
-rw-r--r-- | src/canvas-x11-glx.cpp | 2 | ||||
-rw-r--r-- | src/egl-state.cpp | 2 | ||||
-rw-r--r-- | src/gl-visual-config.cpp | 5 | ||||
-rw-r--r-- | src/gl-visual-config.h | 7 |
6 files changed, 21 insertions, 6 deletions
diff --git a/android/src/org/linaro/glmark2/GLVisualConfig.java b/android/src/org/linaro/glmark2/GLVisualConfig.java index 9aeb5ca..ca4d218 100644 --- a/android/src/org/linaro/glmark2/GLVisualConfig.java +++ b/android/src/org/linaro/glmark2/GLVisualConfig.java @@ -26,12 +26,13 @@ package org.linaro.glmark2; */ class GLVisualConfig { public GLVisualConfig() {} - public GLVisualConfig(int r, int g, int b, int a, int d, int buf) { + public GLVisualConfig(int r, int g, int b, int a, int d, int s, int buf) { red = r; green = g; blue = b; alpha = a; depth = d; + stencil = s; buffer = buf; } @@ -40,5 +41,6 @@ class GLVisualConfig { public int blue; public int alpha; public int depth; + public int stencil; public int buffer; } diff --git a/android/src/org/linaro/glmark2/Glmark2SurfaceView.java b/android/src/org/linaro/glmark2/Glmark2SurfaceView.java index 6cf65aa..35c6c26 100644 --- a/android/src/org/linaro/glmark2/Glmark2SurfaceView.java +++ b/android/src/org/linaro/glmark2/Glmark2SurfaceView.java @@ -50,7 +50,7 @@ class Glmark2SurfaceView extends GLSurfaceView { /* Parse the config string parameters */ String[] configParams = configString.split(":"); - GLVisualConfig targetConfig = new GLVisualConfig(5, 6, 5, 0, 16, 1); + GLVisualConfig targetConfig = new GLVisualConfig(5, 6, 5, 0, 16, 0, 1); for (String param : configParams) { String[] paramKeyValue = param.split("="); @@ -67,6 +67,8 @@ class Glmark2SurfaceView extends GLSurfaceView { targetConfig.alpha = Integer.parseInt(paramKeyValue[1]); else if (paramKeyValue[0].equals("depth") || paramKeyValue[0].equals("d")) targetConfig.depth = Integer.parseInt(paramKeyValue[1]); + else if (paramKeyValue[0].equals("stencil") || paramKeyValue[0].equals("s")) + targetConfig.stencil = Integer.parseInt(paramKeyValue[1]); else if (paramKeyValue[0].equals("buffer") || paramKeyValue[0].equals("buf")) targetConfig.buffer = Integer.parseInt(paramKeyValue[1]); } @@ -89,6 +91,7 @@ class Glmark2SurfaceView extends GLSurfaceView { EGL10.EGL_BLUE_SIZE, targetConfig.blue, EGL10.EGL_ALPHA_SIZE, targetConfig.alpha, EGL10.EGL_DEPTH_SIZE, targetConfig.depth, + EGL10.EGL_STENCIL_SIZE, targetConfig.stencil, EGL10.EGL_BUFFER_SIZE, targetConfig.buffer, EGL10.EGL_RENDERABLE_TYPE, 4, /* 4 = EGL_OPENGL_ES2_BIT */ EGL10.EGL_NONE }; @@ -156,6 +159,8 @@ class Glmark2SurfaceView extends GLSurfaceView { EGL10.EGL_ALPHA_SIZE, 0); vc.depth = findConfigAttrib(egl, display, config, EGL10.EGL_DEPTH_SIZE, 0); + vc.stencil = findConfigAttrib(egl, display, config, + EGL10.EGL_STENCIL_SIZE, 0); vc.buffer = findConfigAttrib(egl, display, config, EGL10.EGL_BUFFER_SIZE, 0); diff --git a/src/canvas-x11-glx.cpp b/src/canvas-x11-glx.cpp index db3ac70..3162337 100644 --- a/src/canvas-x11-glx.cpp +++ b/src/canvas-x11-glx.cpp @@ -171,6 +171,7 @@ CanvasX11GLX::ensure_glx_fbconfig() GLX_BLUE_SIZE, visual_config_.blue, GLX_ALPHA_SIZE, visual_config_.alpha, GLX_DEPTH_SIZE, visual_config_.depth, + GLX_STENCIL_SIZE, visual_config_.stencil, GLX_BUFFER_SIZE, visual_config_.buffer, GLX_DOUBLEBUFFER, True, None @@ -270,6 +271,7 @@ CanvasX11GLX::get_glvisualconfig_glx(const GLXFBConfig config, GLVisualConfig &v glXGetFBConfigAttrib(xdpy_, config, GLX_BLUE_SIZE, &visual_config.blue); glXGetFBConfigAttrib(xdpy_, config, GLX_ALPHA_SIZE, &visual_config.alpha); glXGetFBConfigAttrib(xdpy_, config, GLX_DEPTH_SIZE, &visual_config.depth); + glXGetFBConfigAttrib(xdpy_, config, GLX_STENCIL_SIZE, &visual_config.stencil); } GLXFBConfig diff --git a/src/egl-state.cpp b/src/egl-state.cpp index e0f7ca5..639421a 100644 --- a/src/egl-state.cpp +++ b/src/egl-state.cpp @@ -342,6 +342,7 @@ EGLState::get_glvisualconfig(EGLConfig config, GLVisualConfig& visual_config) eglGetConfigAttrib(egl_display_, config, EGL_BLUE_SIZE, &visual_config.blue); eglGetConfigAttrib(egl_display_, config, EGL_ALPHA_SIZE, &visual_config.alpha); eglGetConfigAttrib(egl_display_, config, EGL_DEPTH_SIZE, &visual_config.depth); + eglGetConfigAttrib(egl_display_, config, EGL_STENCIL_SIZE, &visual_config.stencil); } EGLConfig @@ -390,6 +391,7 @@ EGLState::gotValidConfig() EGL_BLUE_SIZE, visual_config_.blue, EGL_ALPHA_SIZE, visual_config_.alpha, EGL_DEPTH_SIZE, visual_config_.depth, + EGL_STENCIL_SIZE, visual_config_.stencil, #if USE_GLESv2 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, #elif USE_GL diff --git a/src/gl-visual-config.cpp b/src/gl-visual-config.cpp index 4e9ab93..dbd87d2 100644 --- a/src/gl-visual-config.cpp +++ b/src/gl-visual-config.cpp @@ -26,7 +26,7 @@ #include <vector> GLVisualConfig::GLVisualConfig(const std::string &s) : - red(1), green(1), blue(1), alpha(1), depth(1), buffer(1) + red(1), green(1), blue(1), alpha(1), depth(1), stencil(0), buffer(1) { std::vector<std::string> elems; @@ -50,6 +50,8 @@ GLVisualConfig::GLVisualConfig(const std::string &s) : alpha = Util::fromString<int>(opt[1]); else if (opt[0] == "d" || opt[0] == "depth") depth = Util::fromString<int>(opt[1]); + else if (opt[0] == "s" || opt[0] == "stencil") + stencil = Util::fromString<int>(opt[1]); else if (opt[0] == "buf" || opt[0] == "buffer") buffer = Util::fromString<int>(opt[1]); } @@ -74,6 +76,7 @@ GLVisualConfig::match_score(const GLVisualConfig &target) const score += score_component(blue, target.blue, 4); score += score_component(alpha, target.alpha, 4); score += score_component(depth, target.depth, 1); + score += score_component(stencil, target.stencil, 0); score += score_component(buffer, target.buffer, 1); return score; diff --git a/src/gl-visual-config.h b/src/gl-visual-config.h index 7eec2df..dc035cd 100644 --- a/src/gl-visual-config.h +++ b/src/gl-visual-config.h @@ -31,9 +31,9 @@ class GLVisualConfig { public: GLVisualConfig(): - red(1), green(1), blue(1), alpha(1), depth(1), buffer(1) {} - GLVisualConfig(int r, int g, int b, int a, int d, int buf): - red(r), green(g), blue(b), alpha(a), depth(d), buffer(buf) {} + red(1), green(1), blue(1), alpha(1), depth(1), stencil(0), buffer(1) {} + GLVisualConfig(int r, int g, int b, int a, int d, int s, int buf): + red(r), green(g), blue(b), alpha(a), depth(d), stencil(s), buffer(buf) {} GLVisualConfig(const std::string &s); /** @@ -55,6 +55,7 @@ public: int blue; int alpha; int depth; + int stencil; int buffer; private: |