OSDN Git Service

Clean up minor opengl errors/warnings.
authorLingfeng Yang <lfy@google.com>
Sat, 30 Jan 2016 00:02:25 +0000 (16:02 -0800)
committerLingfeng Yang <lfy@google.com>
Mon, 1 Feb 2016 19:39:20 +0000 (19:39 +0000)
There are always disconcerting messages printed to logcat
whenever developing apps on the emulator.

glUtilsParamSize and other functions
often fail with "unknow param 0x00..."

These are missing GLenums and types that for
some reason are not in glUtils.cpp
in OpenglCodecCommon.

There also has been a long-standing warning
that eglSurfaceAttrib is not implemented.

It seems we don't need to implement that to get things done,
so we will give a no-op implementation that suppresses
the warning.

Change-Id: I1b672cedf1672fc09cfe6a832f908e1496cc7a46

shared/OpenglCodecCommon/GLClientState.cpp
shared/OpenglCodecCommon/glUtils.cpp
system/egl/egl.cpp

index 0826a14..a0c4fc1 100644 (file)
@@ -92,7 +92,7 @@ void GLClientState::setState(int location, int size, GLenum type, GLboolean norm
     m_states[location].stride = stride;
     m_states[location].data = (void*)data;
     m_states[location].bufferObject = m_currentArrayVbo;
-    m_states[location].elementSize = glSizeof(type) * size;
+    m_states[location].elementSize = size ? (glSizeof(type) * size) : 0;
     m_states[location].normalized = normalized;
 }
 
index 4b7fc89..eb4ba94 100644 (file)
@@ -109,6 +109,7 @@ size_t glUtilsParamSize(GLenum param)
     case GL_POINT_SIZE_MIN:
     case GL_POINT_SIZE_MAX:
     case GL_POINT_FADE_THRESHOLD_SIZE:
+    case GL_CULL_FACE:
     case GL_CULL_FACE_MODE:
     case GL_FRONT_FACE:
     case GL_SHADE_MODEL:
@@ -126,6 +127,7 @@ size_t glUtilsParamSize(GLenum param)
     case GL_ALPHA_TEST_FUNC:
     case GL_ALPHA_TEST_REF:
     case GL_ALPHA_TEST:
+    case GL_DITHER:
     case GL_BLEND_DST:
     case GL_BLEND_SRC:
     case GL_BLEND:
@@ -187,6 +189,7 @@ size_t glUtilsParamSize(GLenum param)
     case GL_SAMPLE_COVERAGE_INVERT:
     case GL_SAMPLE_COVERAGE_VALUE:
     case GL_SAMPLES:
+    case GL_MAX_SAMPLES_EXT:
     case GL_STENCIL_BITS:
     case GL_STENCIL_CLEAR_VALUE:
     case GL_STENCIL_FUNC:
index 4ce0888..e7653c9 100644 (file)
@@ -817,13 +817,29 @@ EGLSurface eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGL
 
 EGLBoolean eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
 {
-    //TODO
-    (void)dpy;
-    (void)surface;
-    (void)attribute;
+    // Right now we don't do anything when using host GPU.
+    // This is purely just to pass the data through
+    // without issuing a warning. We may benefit from validating the
+    // display and surface for debug purposes.
+    // TODO: Find cases where we actually need to do something.
+    VALIDATE_DISPLAY_INIT(dpy, EGL_FALSE);
+    VALIDATE_SURFACE_RETURN(surface, EGL_FALSE);
+    if (surface == EGL_NO_SURFACE) {
+        setErrorReturn(EGL_BAD_SURFACE, EGL_FALSE);
+    }
+
     (void)value;
-    ALOGW("%s not implemented", __FUNCTION__);
-    return 0;
+
+    switch (attribute) {
+    case EGL_MIPMAP_LEVEL:
+    case EGL_MULTISAMPLE_RESOLVE:
+    case EGL_SWAP_BEHAVIOR:
+        return true;
+        break;
+    default:
+        ALOGW("%s: attr=0x%x not implemented", __FUNCTION__, attribute);
+    }
+    return false;
 }
 
 EGLBoolean eglBindTexImage(EGLDisplay dpy, EGLSurface eglSurface, EGLint buffer)