diff mbox

[Branch,~glmark2-dev/glmark2/trunk] Rev 253: Merge of lp:~glmark2-dev/glmark2/config-update.

Message ID 20121206181613.7348.77640.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Jesse Barker Dec. 6, 2012, 6:16 p.m. UTC
Merge authors:
  Alexandros Frantzis (afrantzis)
  Jesse Barker (jesse-barker)
Related merge proposals:
  https://code.launchpad.net/~glmark2-dev/glmark2/config-update/+merge/138342
  proposed by: Jesse Barker (jesse-barker)
  review: Approve - Alexandros Frantzis (afrantzis)
------------------------------------------------------------
revno: 253 [merge]
committer: Jesse Barker <jesse.barker@linaro.org>
branch nick: trunk
timestamp: Thu 2012-12-06 10:13:53 -0800
message:
  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.
modified:
  android/src/org/linaro/glmark2/GLVisualConfig.java
  android/src/org/linaro/glmark2/Glmark2SurfaceView.java
  src/canvas-x11-glx.cpp
  src/egl-state.cpp
  src/egl-state.h
  src/gl-visual-config.cpp
  src/gl-visual-config.h


--
lp:glmark2
https://code.launchpad.net/~glmark2-dev/glmark2/trunk

You are subscribed to branch lp:glmark2.
To unsubscribe from this branch go to https://code.launchpad.net/~glmark2-dev/glmark2/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'android/src/org/linaro/glmark2/GLVisualConfig.java'
--- android/src/org/linaro/glmark2/GLVisualConfig.java	2012-07-04 14:27:42 +0000
+++ android/src/org/linaro/glmark2/GLVisualConfig.java	2012-12-05 23:50:25 +0000
@@ -26,12 +26,13 @@ 
  */
 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 @@ 
     public int blue;
     public int alpha;
     public int depth;
+    public int stencil;
     public int buffer;
 }

=== modified file 'android/src/org/linaro/glmark2/Glmark2SurfaceView.java'
--- android/src/org/linaro/glmark2/Glmark2SurfaceView.java	2012-07-30 12:28:16 +0000
+++ android/src/org/linaro/glmark2/Glmark2SurfaceView.java	2012-12-05 23:50:25 +0000
@@ -50,7 +50,7 @@ 
 
         /* 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 @@ 
                 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 @@ 
                     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 @@ 
                                             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);
 

=== modified file 'src/canvas-x11-glx.cpp'
--- src/canvas-x11-glx.cpp	2012-08-23 22:47:12 +0000
+++ src/canvas-x11-glx.cpp	2012-12-06 17:54:57 +0000
@@ -171,6 +171,7 @@ 
         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 @@ 
     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 @@ 
         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 @@ 
     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

=== modified file 'src/egl-state.cpp'
--- src/egl-state.cpp	2012-11-15 23:06:53 +0000
+++ src/egl-state.cpp	2012-12-05 23:50:25 +0000
@@ -38,10 +38,19 @@ 
     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 @@ 
     {
         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 @@ 
     {
         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 @@ 
     {
         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 @@ 
     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 @@ 
         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

=== modified file 'src/egl-state.h'
--- src/egl-state.h	2012-11-13 16:53:41 +0000
+++ src/egl-state.h	2012-12-05 22:19:12 +0000
@@ -37,12 +37,24 @@ 
     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 @@ 
         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),

=== modified file 'src/gl-visual-config.cpp'
--- src/gl-visual-config.cpp	2012-08-13 10:09:08 +0000
+++ src/gl-visual-config.cpp	2012-12-05 23:50:25 +0000
@@ -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 @@ 
                 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 @@ 
     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;

=== modified file 'src/gl-visual-config.h'
--- src/gl-visual-config.h	2012-05-11 13:49:53 +0000
+++ src/gl-visual-config.h	2012-12-05 23:50:25 +0000
@@ -31,9 +31,9 @@ 
 {
 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 @@ 
     int blue;
     int alpha;
     int depth;
+    int stencil;
     int buffer;
 
 private: