diff options
author | Jesse Barker <jesse.barker@linaro.org> | 2012-12-06 10:13:53 -0800 |
---|---|---|
committer | Jesse Barker <jesse.barker@linaro.org> | 2012-12-06 10:13:53 -0800 |
commit | 8eef3806a2aa39f2018d0bfbc6f34a1f8a5cda7e (patch) | |
tree | 659a276faaf7309d322f51aa6ce7eef1bb15f102 | |
parent | a9041c49c67f0abb48abd54bde24dbe4bd48fa29 (diff) | |
parent | d2dc1a8492bb6ca099cba3b5d891177facb278d8 (diff) | |
download | glmark2-8eef3806a2aa39f2018d0bfbc6f34a1f8a5cda7e.tar.gz |
Merge of lp:~glmark2-dev/glmark2/config-update.
Enhances GLVisualConfig to support the stencil attribute (defaults to prefer
no stencil buffer configs).
Updates EglConfig to query for all of table 3.1 in the EGL 1.4 spec.
-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 | 10 | ||||
-rw-r--r-- | src/egl-state.cpp | 59 | ||||
-rw-r--r-- | src/egl-state.h | 21 | ||||
-rw-r--r-- | src/gl-visual-config.cpp | 5 | ||||
-rw-r--r-- | src/gl-visual-config.h | 7 |
7 files changed, 100 insertions, 13 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..db016b8 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 @@ -200,7 +201,7 @@ CanvasX11GLX::ensure_glx_fbconfig() XFree(fbc); if (Options::show_debug) { - int buf, red, green, blue, alpha, depth, id, native_id; + int buf, red, green, blue, alpha, depth, stencil, id, native_id; glXGetFBConfigAttrib(xdpy_, glx_fbconfig_, GLX_FBCONFIG_ID, &id); glXGetFBConfigAttrib(xdpy_, glx_fbconfig_, GLX_VISUAL_ID, &native_id); glXGetFBConfigAttrib(xdpy_, glx_fbconfig_, GLX_BUFFER_SIZE, &buf); @@ -209,15 +210,17 @@ CanvasX11GLX::ensure_glx_fbconfig() glXGetFBConfigAttrib(xdpy_, glx_fbconfig_, GLX_BLUE_SIZE, &blue); glXGetFBConfigAttrib(xdpy_, glx_fbconfig_, GLX_ALPHA_SIZE, &alpha); glXGetFBConfigAttrib(xdpy_, glx_fbconfig_, GLX_DEPTH_SIZE, &depth); + glXGetFBConfigAttrib(xdpy_, glx_fbconfig_, GLX_STENCIL_SIZE, &stencil); Log::debug("GLX chosen config ID: 0x%x Native Visual ID: 0x%x\n" " Buffer: %d bits\n" " Red: %d bits\n" " Green: %d bits\n" " Blue: %d bits\n" " Alpha: %d bits\n" - " Depth: %d bits\n", + " Depth: %d bits\n" + " Stencil: %d bits\n", id, native_id, - buf, red, green, blue, alpha, depth); + buf, red, green, blue, alpha, depth, stencil); } @@ -270,6 +273,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 40cb837..639421a 100644 --- a/src/egl-state.cpp +++ b/src/egl-state.cpp @@ -38,10 +38,19 @@ EglConfig::EglConfig(EGLDisplay dpy, EGLConfig config) : luminanceSize_(0), alphaSize_(0), alphaMaskSize_(0), + bindTexRGB_(false), + bindTexRGBA_(false), bufferType_(EGL_RGB_BUFFER), caveat_(0), configID_(0), + conformant_(0), depthSize_(0), + level_(0), + pbufferWidth_(0), + pbufferHeight_(0), + pbufferPixels_(0), + minSwapInterval_(0), + maxSwapInterval_(0), nativeID_(0), nativeType_(0), nativeRenderable_(false), @@ -63,6 +72,10 @@ EglConfig::EglConfig(EGLDisplay dpy, EGLConfig config) : { badAttribVec.push_back("EGL_CONFIG_CAVEAT"); } + if (!eglGetConfigAttrib(dpy, handle_, EGL_CONFORMANT, &conformant_)) + { + badAttribVec.push_back("EGL_CONFORMANT"); + } if (!eglGetConfigAttrib(dpy, handle_, EGL_COLOR_BUFFER_TYPE, &bufferType_)) { badAttribVec.push_back("EGL_COLOR_BUFFER_TYPE"); @@ -98,6 +111,10 @@ EglConfig::EglConfig(EGLDisplay dpy, EGLConfig config) : { badAttribVec.push_back("EGL_ALPHA_SIZE"); } + if (!eglGetConfigAttrib(dpy, handle_, EGL_ALPHA_MASK_SIZE, &alphaMaskSize_)) + { + badAttribVec.push_back("EGL_ALPHA_MASK_SIZE"); + } if (!eglGetConfigAttrib(dpy, handle_, EGL_DEPTH_SIZE, &depthSize_)) { badAttribVec.push_back("EGL_DEPTH_SIZE"); @@ -106,15 +123,47 @@ EglConfig::EglConfig(EGLDisplay dpy, EGLConfig config) : { badAttribVec.push_back("EGL_STENCIL_SIZE"); } + EGLint doBind(EGL_FALSE); + if (!eglGetConfigAttrib(dpy, handle_, EGL_BIND_TO_TEXTURE_RGB, &doBind)) + { + badAttribVec.push_back("EGL_BIND_TO_TEXTURE_RGB"); + } + bindTexRGB_ = (doBind == EGL_TRUE); + if (!eglGetConfigAttrib(dpy, handle_, EGL_BIND_TO_TEXTURE_RGBA, &doBind)) + { + badAttribVec.push_back("EGL_BIND_TO_TEXTURE_RGBA"); + } + bindTexRGBA_ = (doBind == EGL_TRUE); + if (!eglGetConfigAttrib(dpy, handle_, EGL_LEVEL, &level_)) + { + badAttribVec.push_back("EGL_LEVEL"); + } + if (!eglGetConfigAttrib(dpy, handle_, EGL_MAX_PBUFFER_WIDTH, &pbufferWidth_)) + { + badAttribVec.push_back("EGL_MAX_PBUFFER_WIDTH"); + } + if (!eglGetConfigAttrib(dpy, handle_, EGL_MAX_PBUFFER_HEIGHT, &pbufferHeight_)) + { + badAttribVec.push_back("EGL_MAX_PBUFFER_HEIGHT"); + } + if (!eglGetConfigAttrib(dpy, handle_, EGL_MAX_PBUFFER_PIXELS, &pbufferPixels_)) + { + badAttribVec.push_back("EGL_MAX_PBUFFER_PIXELS"); + } + if (!eglGetConfigAttrib(dpy, handle_, EGL_MIN_SWAP_INTERVAL, &minSwapInterval_)) + { + badAttribVec.push_back("EGL_MIN_SWAP_INTERVAL"); + } + if (!eglGetConfigAttrib(dpy, handle_, EGL_MAX_SWAP_INTERVAL, &maxSwapInterval_)) + { + badAttribVec.push_back("EGL_MAX_SWAP_INTERVAL"); + } EGLint doNative(EGL_FALSE); if (!eglGetConfigAttrib(dpy, handle_, EGL_NATIVE_RENDERABLE, &doNative)) { badAttribVec.push_back("EGL_NATIVE_RENDERABLE"); } - if (doNative == EGL_TRUE) - { - nativeRenderable_ = true; - } + nativeRenderable_ = (doNative == EGL_TRUE); if (!eglGetConfigAttrib(dpy, handle_, EGL_NATIVE_VISUAL_TYPE, &nativeType_)) { badAttribVec.push_back("EGL_NATIVE_VISUAL_TYPE"); @@ -293,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 @@ -341,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/egl-state.h b/src/egl-state.h index bd21e8d..2eaeba3 100644 --- a/src/egl-state.h +++ b/src/egl-state.h @@ -37,12 +37,24 @@ class EglConfig EGLint luminanceSize_; EGLint alphaSize_; EGLint alphaMaskSize_; + bool bindTexRGB_; + bool bindTexRGBA_; EGLint bufferType_; // Base config attributes EGLint caveat_; EGLint configID_; + EGLint conformant_; // Depth buffer EGLint depthSize_; + // Framebuffer level + EGLint level_; + // Pbuffers + EGLint pbufferWidth_; + EGLint pbufferHeight_; + EGLint pbufferPixels_; + // Swap interval + EGLint minSwapInterval_; + EGLint maxSwapInterval_; // Native window system attributes. EGLint nativeID_; EGLint nativeType_; @@ -69,10 +81,19 @@ public: luminanceSize_(0), alphaSize_(0), alphaMaskSize_(0), + bindTexRGB_(false), + bindTexRGBA_(false), bufferType_(EGL_RGB_BUFFER), caveat_(0), configID_(0), + conformant_(0), depthSize_(0), + level_(0), + pbufferWidth_(0), + pbufferHeight_(0), + pbufferPixels_(0), + minSwapInterval_(0), + maxSwapInterval_(0), nativeID_(0), nativeType_(0), nativeRenderable_(false), 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: |