Changeset 53639 in webkit
- Timestamp:
- Jan 21, 2010 12:56:25 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r53637 r53639 1 2010-01-21 Jakob Petsovits <jpetsovits@rim.com> 2 3 Reviewed by Adam Treat. 4 5 Don't call vgGetError()/eglGetError() repeatedly 6 https://bugs.webkit.org/show_bug.cgi?id=33959 7 8 For vgGetError(), I missed the part of the spec where 9 it says that calling that function clears the error 10 and subsequent calls will return VG_NO_ERROR again. 11 12 For eglGetError(), the specification doesn't mention 13 that kind of behavior, and interpretations seem to 14 differ between EGL implementations (even within 15 Khronos: the OpenVG reference implementation doesn't 16 reset the error code - and even mentions the difference 17 to vgGetError() in a comment - whereas the online 18 OpenGL ES API document explicitly specifies clearing 19 the error code). 20 21 It thus makes sense not to call either of the two 22 error functions more than once for checking a single 23 EGL/OpenVG call. This patch adapts assertions to 24 accommodate for this behavior, and also needs to 25 change surface creation methods as they previously 26 relied on multiple calls of eglGetError(). 27 28 * platform/graphics/openvg/EGLDisplayOpenVG.cpp: 29 (WebCore::EGLDisplayOpenVG::sharedPlatformSurface): 30 (WebCore::EGLDisplayOpenVG::createPbufferSurface): 31 * platform/graphics/openvg/EGLDisplayOpenVG.h: 32 * platform/graphics/openvg/EGLUtils.h: 33 * platform/graphics/openvg/SurfaceOpenVG.cpp: 34 (WebCore::SurfaceOpenVG::SurfaceOpenVG): 35 * platform/graphics/openvg/SurfaceOpenVG.h: 36 * platform/graphics/openvg/VGUtils.h: 37 1 38 2010-01-20 Simon Fraser <simon.fraser@apple.com> 2 39 -
trunk/WebCore/platform/graphics/openvg/EGLDisplayOpenVG.cpp
r53499 r53639 223 223 EGLConfig config = defaultPbufferConfig(); 224 224 EGLSurface surface = createPbufferSurface(IntSize(1, 1), config); 225 ASSERT_EGL_NO_ERROR();226 225 227 226 EGLContext context = eglCreateContext(m_display, config, EGL_NO_CONTEXT, 0); … … 238 237 } 239 238 240 EGLSurface EGLDisplayOpenVG::createPbufferSurface(const IntSize& size, const EGLConfig& config )239 EGLSurface EGLDisplayOpenVG::createPbufferSurface(const IntSize& size, const EGLConfig& config, EGLint* errorCode) 241 240 { 242 241 const EGLint attribList[] = { … … 246 245 }; 247 246 EGLSurface surface = eglCreatePbufferSurface(m_display, config, attribList); 248 if (eglGetError() != EGL_SUCCESS) 247 248 if (errorCode) 249 *errorCode = eglGetError(); 250 else 251 ASSERT_EGL_NO_ERROR(); 252 253 if (surface == EGL_NO_SURFACE) 249 254 return EGL_NO_SURFACE; 250 255 -
trunk/WebCore/platform/graphics/openvg/EGLDisplayOpenVG.h
r53499 r53639 48 48 /** Creates a pbuffer surface using the given config. If no surface 49 49 * could be created, EGL_NO_SURFACE is returned and errors can be 50 * caught with eglGetError() (respectively ASSERT_EGL_NO_ERROR()). */ 51 EGLSurface createPbufferSurface(const IntSize&, const EGLConfig&); 50 * checked with the value that is written to the errorCode parameter 51 * If no surface could be created and errorCode is zero, this method 52 * will trigger an assertion by itself. */ 53 EGLSurface createPbufferSurface(const IntSize&, const EGLConfig&, EGLint* errorCode = 0); 52 54 53 55 EGLSurface surfaceForWindow(EGLNativeWindowType, const EGLConfig&); -
trunk/WebCore/platform/graphics/openvg/EGLUtils.h
r53499 r53639 63 63 #define ASSERT_EGL_NO_ERROR() ((void)0) 64 64 #else 65 #define ASSERT_EGL_NO_ERROR() \ 66 ASSERT_WITH_MESSAGE(eglGetError() == VG_NO_ERROR, "Found %s", toEGLErrorConstant(eglGetError())) 65 #define ASSERT_EGL_NO_ERROR() do { \ 66 EGLint eglErrorCode = eglGetError(); \ 67 ASSERT_WITH_MESSAGE(eglErrorCode == EGL_SUCCESS, "Found %s", toEGLErrorConstant(eglErrorCode)); \ 68 } while (0) 67 69 #endif 68 70 -
trunk/WebCore/platform/graphics/openvg/SurfaceOpenVG.cpp
r53499 r53639 45 45 46 46 #if PLATFORM(EGL) 47 SurfaceOpenVG::SurfaceOpenVG(const IntSize& size, const EGLDisplay& display, EGLConfig* confPtr )47 SurfaceOpenVG::SurfaceOpenVG(const IntSize& size, const EGLDisplay& display, EGLConfig* confPtr, EGLint* errorCode) 48 48 : m_eglDisplay(display) 49 49 , m_eglSurface(EGL_NO_SURFACE) … … 54 54 EGLDisplayOpenVG* displayManager = EGLDisplayOpenVG::forDisplay(m_eglDisplay); 55 55 EGLConfig config = confPtr ? (*confPtr) : displayManager->defaultPbufferConfig(); 56 m_eglSurface = displayManager->createPbufferSurface(size, config );56 m_eglSurface = displayManager->createPbufferSurface(size, config, errorCode); 57 57 58 58 if (m_eglSurface == EGL_NO_SURFACE) … … 73 73 EGLConfig config = confPtr ? (*confPtr) : displayManager->defaultWindowConfig(); 74 74 m_eglSurface = displayManager->surfaceForWindow(window, config); 75 76 if (m_eglSurface == EGL_NO_SURFACE) 77 return; 75 ASSERT(m_eglSurface != EGL_NO_SURFACE); 78 76 79 77 m_eglContext = displayManager->contextForSurface(m_eglSurface); -
trunk/WebCore/platform/graphics/openvg/SurfaceOpenVG.h
r53499 r53639 55 55 * pbuffer config is used. 56 56 * 57 * For reasons of recoverability (e.g. ImageBuffer's "bool success"58 * return value), this constructor won't assert if creation of the surface59 * fails. Make sure to check successful surface creation with either60 * ASSERT_EGL_NO_ERROR() or the surface's isValid() method.57 * This constructor will trigger an assertion if creation of the surface 58 * fails, unless you pledge to manually process the error code by passing 59 * a non-zero pointer as errorCode parameter. The error code returned by 60 * eglGetError() will be written to that variable. 61 61 */ 62 SurfaceOpenVG(const IntSize& size, const EGLDisplay& display, EGLConfig* config = 0 );62 SurfaceOpenVG(const IntSize& size, const EGLDisplay& display, EGLConfig* config = 0, EGLint* errorCode = 0); 63 63 64 64 /** … … 66 66 * and config on the given display. If config is not specified, the 67 67 * display's default window config is used. 68 *69 * For reasons of recoverability, this constructor won't assert if creation70 * of the surface fails. Make sure to check successful surface creation71 * with either ASSERT_EGL_NO_ERROR() or the surface's isValid() method.72 68 */ 73 69 SurfaceOpenVG(EGLNativeWindowType window, const EGLDisplay& display, EGLConfig* config = 0); -
trunk/WebCore/platform/graphics/openvg/VGUtils.h
r53499 r53639 51 51 #define ASSERT_VG_NO_ERROR() ((void)0) 52 52 #else 53 #define ASSERT_VG_NO_ERROR() \ 54 ASSERT_WITH_MESSAGE(vgGetError() == VG_NO_ERROR, "Found %s", toVGErrorConstant(vgGetError())) 53 #define ASSERT_VG_NO_ERROR() do { \ 54 VGErrorCode vgErrorCode = vgGetError(); \ 55 ASSERT_WITH_MESSAGE(vgErrorCode == VG_NO_ERROR, "Found %s", toVGErrorConstant(vgErrorCode)); \ 56 } while (0) 55 57 #endif 56 58
Note: See TracChangeset
for help on using the changeset viewer.