Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Prefer modes with 24-bit or 20-bit depth to 16-bit.
  • Loading branch information
hrydgard committed Oct 31, 2013
1 parent 6c11355 commit c374c6a
Showing 1 changed file with 26 additions and 4 deletions.
Expand Up @@ -102,20 +102,31 @@ public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
// We now ignore destination alpha as a workaround for the Mali issue
// where we get badly composited if we use it.

// First, find our ideal configuration
// First, find our ideal configuration. Prefer depth.
for (int i = 0; i < configs.length; i++) {
ConfigAttribs c = configs[i];
if (c.red == 8 && c.green == 8 && c.blue == 8 && c.alpha == 0 && c.stencil >= 8 && c.depth == 16) {
if (c.red == 8 && c.green == 8 && c.blue == 8 && c.alpha == 0 && c.stencil >= 8 && c.depth >= 24) {
chosen = c;
break;
}
}

if (chosen == null) {
// Second, accept one with bigger depth.
// Then, prefer one with 20-bit depth (Tegra 3)
for (int i = 0; i < configs.length; i++) {
ConfigAttribs c = configs[i];
if (c.red == 8 && c.green == 8 && c.blue == 8 && c.alpha == 0 && c.stencil >= 8 && c.depth > 16) {
if (c.red == 8 && c.green == 8 && c.blue == 8 && c.alpha == 0 && c.stencil >= 8 && c.depth >= 20) {
chosen = c;
break;
}
}
}

if (chosen == null) {
// Second, accept one with 16-bit depth.
for (int i = 0; i < configs.length; i++) {
ConfigAttribs c = configs[i];
if (c.red == 8 && c.green == 8 && c.blue == 8 && c.alpha == 0 && c.stencil >= 8 && c.depth >= 16) {
chosen = c;
break;
}
Expand All @@ -133,6 +144,17 @@ public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
}
}

if (chosen == null) {
// Third, accept one with alpha but with stencil.
for (int i = 0; i < configs.length; i++) {
ConfigAttribs c = configs[i];
if (c.red == 8 && c.green == 8 && c.blue == 8 && c.alpha == 8 && c.stencil >= 8 && c.depth >= 24) {
chosen = c;
break;
}
}
}

if (chosen == null) {
// Third, accept one with alpha but with stencil.
for (int i = 0; i < configs.length; i++) {
Expand Down

0 comments on commit c374c6a

Please sign in to comment.