Changeset 125349 in webkit


Ignore:
Timestamp:
Aug 10, 2012 7:45:06 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[WebGL] Add support for EXT_robustness
https://bugs.webkit.org/show_bug.cgi?id=93379

Patch by Joshua Netterfield <jnetterfield@rim.com> on 2012-08-10
Reviewed by George Staikos.

Source/WebCore:

Take advantage of EXT robustness in WebKit.

This commit makes WebKit use readnPixelsEXT, getnUniformfvEXT and
getnUniformivEXT instead of readPixels, getUniformfv and getUniformiv
when possible, and sets up the reset notification behaviour for
GLES platforms.

The reset behaviour has not yet been implemented in the BlackBerry
compositing thread, so for now on BlackBerry we just abort when
the context has been reset. This prevents undefined behaviour, but
can be improved in the future.

No new tests are needed because no new functionality is introduced.
Support for ARB robustness reset notification behaviour is already
in WebKit, and EXT robustness' reset notifcation behaviour is the
same. readnPixelsEXT replaces WebKit's existing mechanisms of
preventing buffer overflows.

RIM PR# 147510
Internally reviewed by Arvid Nilsson.

  • html/canvas/WebGLRenderingContext.cpp:

(WebCore):
(WebCore::WebGLRenderingContext::setupFlags):
(WebCore::WebGLRenderingContext::getUniform):
(WebCore::WebGLRenderingContext::readPixels):

  • html/canvas/WebGLRenderingContext.h:

(WebGLRenderingContext):

  • platform/chromium/support/Extensions3DChromium.cpp:

(WebCore::Extensions3DChromium::readnPixelsEXT):
(WebCore):
(WebCore::Extensions3DChromium::getnUniformfvEXT):
(WebCore::Extensions3DChromium::getnUniformivEXT):

  • platform/graphics/Extensions3D.h:
  • platform/graphics/blackberry/GraphicsContext3DBlackBerry.cpp:

(WebCore::GraphicsContext3D::setContextLostCallback):

  • platform/graphics/blackberry/LayerRenderer.cpp:

(WebCore::LayerRenderer::LayerRenderer):
(WebCore::LayerRenderer::makeContextCurrent):

  • platform/graphics/blackberry/LayerRenderer.h:

(LayerRenderer):

  • platform/graphics/chromium/Extensions3DChromium.h:
  • platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:

(WebCore::Extensions3DOpenGLCommon::readnPixelsEXT):
(WebCore):
(WebCore::Extensions3DOpenGLCommon::getnUniformfvEXT):
(WebCore::Extensions3DOpenGLCommon::getnUniformivEXT):

  • platform/graphics/opengl/Extensions3DOpenGLCommon.h:

(Extensions3DOpenGLCommon):

  • platform/graphics/opengl/Extensions3DOpenGLES.cpp:

(WebCore::Extensions3DOpenGLES::Extensions3DOpenGLES):
(WebCore::Extensions3DOpenGLES::getGraphicsResetStatusARB):
(WebCore):
(WebCore::Extensions3DOpenGLES::setEXTContextLostCallback):
(WebCore::Extensions3DOpenGLES::readnPixelsEXT):
(WebCore::Extensions3DOpenGLES::getnUniformfvEXT):
(WebCore::Extensions3DOpenGLES::getnUniformivEXT):
(WebCore::Extensions3DOpenGLES::supportsExtension):

  • platform/graphics/opengl/Extensions3DOpenGLES.h:

(Extensions3DOpenGLES):

Source/WebKit:

RIM PR# 147510
Internally reviewed by Arvid Nilsson.

  • CMakeLists.txt: Build system adaptation.
Location:
trunk/Source
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r125348 r125349  
     12012-08-10  Joshua Netterfield  <jnetterfield@rim.com>
     2
     3        [WebGL] Add support for EXT_robustness
     4        https://bugs.webkit.org/show_bug.cgi?id=93379
     5
     6        Reviewed by George Staikos.
     7
     8        Take advantage of EXT robustness in WebKit.
     9
     10        This commit makes WebKit use readnPixelsEXT, getnUniformfvEXT and
     11        getnUniformivEXT instead of readPixels, getUniformfv and getUniformiv
     12        when possible, and sets up the reset notification behaviour for
     13        GLES platforms.
     14
     15        The reset behaviour has not yet been implemented in the BlackBerry
     16        compositing thread, so for now on BlackBerry we just abort when
     17        the context has been reset. This prevents undefined behaviour, but
     18        can be improved in the future.
     19
     20        No new tests are needed because no new functionality is introduced.
     21        Support for ARB robustness reset notification behaviour is already
     22        in WebKit, and EXT robustness' reset notifcation behaviour is the
     23        same. readnPixelsEXT replaces WebKit's existing mechanisms of
     24        preventing buffer overflows.
     25
     26        RIM PR# 147510
     27        Internally reviewed by Arvid Nilsson.
     28
     29        * html/canvas/WebGLRenderingContext.cpp:
     30        (WebCore):
     31        (WebCore::WebGLRenderingContext::setupFlags):
     32        (WebCore::WebGLRenderingContext::getUniform):
     33        (WebCore::WebGLRenderingContext::readPixels):
     34        * html/canvas/WebGLRenderingContext.h:
     35        (WebGLRenderingContext):
     36        * platform/chromium/support/Extensions3DChromium.cpp:
     37        (WebCore::Extensions3DChromium::readnPixelsEXT):
     38        (WebCore):
     39        (WebCore::Extensions3DChromium::getnUniformfvEXT):
     40        (WebCore::Extensions3DChromium::getnUniformivEXT):
     41        * platform/graphics/Extensions3D.h:
     42        * platform/graphics/blackberry/GraphicsContext3DBlackBerry.cpp:
     43        (WebCore::GraphicsContext3D::setContextLostCallback):
     44        * platform/graphics/blackberry/LayerRenderer.cpp:
     45        (WebCore::LayerRenderer::LayerRenderer):
     46        (WebCore::LayerRenderer::makeContextCurrent):
     47        * platform/graphics/blackberry/LayerRenderer.h:
     48        (LayerRenderer):
     49        * platform/graphics/chromium/Extensions3DChromium.h:
     50        * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
     51        (WebCore::Extensions3DOpenGLCommon::readnPixelsEXT):
     52        (WebCore):
     53        (WebCore::Extensions3DOpenGLCommon::getnUniformfvEXT):
     54        (WebCore::Extensions3DOpenGLCommon::getnUniformivEXT):
     55        * platform/graphics/opengl/Extensions3DOpenGLCommon.h:
     56        (Extensions3DOpenGLCommon):
     57        * platform/graphics/opengl/Extensions3DOpenGLES.cpp:
     58        (WebCore::Extensions3DOpenGLES::Extensions3DOpenGLES):
     59        (WebCore::Extensions3DOpenGLES::getGraphicsResetStatusARB):
     60        (WebCore):
     61        (WebCore::Extensions3DOpenGLES::setEXTContextLostCallback):
     62        (WebCore::Extensions3DOpenGLES::readnPixelsEXT):
     63        (WebCore::Extensions3DOpenGLES::getnUniformfvEXT):
     64        (WebCore::Extensions3DOpenGLES::getnUniformivEXT):
     65        (WebCore::Extensions3DOpenGLES::supportsExtension):
     66        * platform/graphics/opengl/Extensions3DOpenGLES.h:
     67        (Extensions3DOpenGLES):
     68
    1692012-08-10  Arko Saha  <arko@motorola.com>
    270
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp

    r123819 r125349  
    549549        m_isDepthStencilSupported = m_context->getExtensions()->isEnabled("GL_EXT_packed_depth_stencil");
    550550    }
     551    m_isRobustnessEXTSupported = m_context->getExtensions()->isEnabled("GL_EXT_robustness");
    551552}
    552553
     
    29762977                case GraphicsContext3D::FLOAT: {
    29772978                    GC3Dfloat value[16] = {0};
    2978                     m_context->getUniformfv(objectOrZero(program), location, value);
     2979                    if (m_isRobustnessEXTSupported)
     2980                        m_context->getExtensions()->getnUniformfvEXT(objectOrZero(program), location, 16, value);
     2981                    else
     2982                        m_context->getUniformfv(objectOrZero(program), location, value);
    29792983                    if (length == 1)
    29802984                        return WebGLGetInfo(value[0]);
     
    29832987                case GraphicsContext3D::INT: {
    29842988                    GC3Dint value[4] = {0};
    2985                     m_context->getUniformiv(objectOrZero(program), location, value);
     2989                    if (m_isRobustnessEXTSupported)
     2990                        m_context->getExtensions()->getnUniformivEXT(objectOrZero(program), location, 4, value);
     2991                    else
     2992                        m_context->getUniformiv(objectOrZero(program), location, value);
    29862993                    if (length == 1)
    29872994                        return WebGLGetInfo(value[0]);
     
    29902997                case GraphicsContext3D::BOOL: {
    29912998                    GC3Dint value[4] = {0};
    2992                     m_context->getUniformiv(objectOrZero(program), location, value);
     2999                    if (m_isRobustnessEXTSupported)
     3000                        m_context->getExtensions()->getnUniformivEXT(objectOrZero(program), location, 4, value);
     3001                    else
     3002                        m_context->getUniformiv(objectOrZero(program), location, value);
    29933003                    if (length > 1) {
    29943004                        bool boolValue[16] = {0};
     
    32913301    }
    32923302    // Calculate array size, taking into consideration of PACK_ALIGNMENT.
    3293     unsigned int totalBytesRequired;
    3294     unsigned int padding;
    3295     GC3Denum error = m_context->computeImageSizeInBytes(format, type, width, height, m_packAlignment, &totalBytesRequired, &padding);
    3296     if (error != GraphicsContext3D::NO_ERROR) {
    3297         synthesizeGLError(error, "readPixels", "invalid dimensions");
    3298         return;
    3299     }
    3300     if (pixels->byteLength() < totalBytesRequired) {
    3301         synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "readPixels", "ArrayBufferView not large enough for dimensions");
    3302         return;
    3303     }
     3303    unsigned int totalBytesRequired = 0;
     3304    unsigned int padding = 0;
     3305    if (!m_isRobustnessEXTSupported) {
     3306        GC3Denum error = m_context->computeImageSizeInBytes(format, type, width, height, m_packAlignment, &totalBytesRequired, &padding);
     3307        if (error != GraphicsContext3D::NO_ERROR) {
     3308            synthesizeGLError(error, "readPixels", "invalid dimensions");
     3309            return;
     3310        }
     3311        if (pixels->byteLength() < totalBytesRequired) {
     3312            synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "readPixels", "ArrayBufferView not large enough for dimensions");
     3313            return;
     3314        }
     3315    }
     3316
    33043317    clearIfComposited();
    33053318    void* data = pixels->baseAddress();
     
    33073320    {
    33083321        ScopedDrawingBufferBinder binder(m_drawingBuffer.get(), m_framebufferBinding.get());
    3309         m_context->readPixels(x, y, width, height, format, type, data);
     3322        if (m_isRobustnessEXTSupported)
     3323            m_context->getExtensions()->readnPixelsEXT(x, y, width, height, format, type, pixels->byteLength(), data);
     3324        else
     3325            m_context->readPixels(x, y, width, height, format, type, data);
    33103326    }
    33113327
    33123328#if OS(DARWIN) || OS(QNX)
     3329    if (m_isRobustnessEXTSupported) // we haven't computed padding
     3330        m_context->computeImageSizeInBytes(format, type, width, height, m_packAlignment, &totalBytesRequired, &padding);
    33133331    // FIXME: remove this section when GL driver bug on Mac AND the GLES driver bug
    33143332    // on QC & Imagination QNX is fixed, i.e., when alpha is off, readPixels should
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h

    r123816 r125349  
    495495    bool m_isResourceSafe;
    496496    bool m_isDepthStencilSupported;
     497    bool m_isRobustnessEXTSupported;
    497498
    498499    bool m_synthesizedErrorsToConsole;
  • trunk/Source/WebCore/platform/chromium/support/Extensions3DChromium.cpp

    r123416 r125349  
    3030#include "GraphicsContext3D.h"
    3131#include "GraphicsContext3DPrivate.h"
     32#include "NotImplemented.h"
    3233#include <public/WebGraphicsContext3D.h>
    3334
     
    182183}
    183184
     185void Extensions3DChromium::readnPixelsEXT(int x, int y, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, GC3Dsizei bufSize, void *data)
     186{
     187    notImplemented();
     188}
     189
     190void Extensions3DChromium::getnUniformfvEXT(GC3Duint program, int location, GC3Dsizei bufSize, float *params)
     191{
     192    notImplemented();
     193}
     194
     195void Extensions3DChromium::getnUniformivEXT(GC3Duint program, int location, GC3Dsizei bufSize, int *params)
     196{
     197    notImplemented();
     198}
     199
     200
    184201} // namespace WebCore
  • trunk/Source/WebCore/platform/graphics/Extensions3D.h

    r121055 r125349  
    178178    // GL_CHROMIUM_copy_texture
    179179    virtual void copyTextureCHROMIUM(GC3Denum, Platform3DObject, Platform3DObject, GC3Dint, GC3Denum) = 0;
     180
     181    // EXT Robustness - uses getGraphicsResetStatusARB
     182    virtual void readnPixelsEXT(int x, int y, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, GC3Dsizei bufSize, void *data) = 0;
     183    virtual void getnUniformfvEXT(GC3Duint program, int location, GC3Dsizei bufSize, float *params) = 0;
     184    virtual void getnUniformivEXT(GC3Duint program, int location, GC3Dsizei bufSize, int *params) = 0;
    180185};
    181186
  • trunk/Source/WebCore/platform/graphics/blackberry/GraphicsContext3DBlackBerry.cpp

    r123749 r125349  
    389389}
    390390
    391 void GraphicsContext3D::setContextLostCallback(PassOwnPtr<ContextLostCallback>)
    392 {
     391void GraphicsContext3D::setContextLostCallback(PassOwnPtr<ContextLostCallback> callback)
     392{
     393    static_cast<Extensions3DOpenGLES*>(getExtensions())->setEXTContextLostCallback(callback);
    393394}
    394395
  • trunk/Source/WebCore/platform/graphics/blackberry/LayerRenderer.cpp

    r125068 r125349  
    4444#include <BlackBerryPlatformGraphics.h>
    4545#include <BlackBerryPlatformLog.h>
     46#include <EGL/egl.h>
    4647#include <limits>
    4748#include <wtf/text/CString.h>
     
    160161    , m_clearSurfaceOnDrawLayers(true)
    161162    , m_context(context)
     163    , m_isRobustnessSupported(false)
    162164    , m_needsCommit(false)
    163165{
     166    if (makeContextCurrent()) {
     167        m_isRobustnessSupported = String(reinterpret_cast<const char*>(::glGetString(GL_EXTENSIONS))).contains("GL_EXT_robustness");
     168        if (m_isRobustnessSupported)
     169            m_glGetGraphicsResetStatusEXT = reinterpret_cast<PFNGLGETGRAPHICSRESETSTATUSEXTPROC>(eglGetProcAddress("glGetGraphicsResetStatusEXT"));
     170    }
     171
    164172    for (int i = 0; i < LayerData::NumberOfLayerProgramShaders; ++i)
    165173        m_layerProgramObject[i] = 0;
     
    9991007bool LayerRenderer::makeContextCurrent()
    10001008{
    1001     return m_context->makeCurrent();
     1009    bool ret = m_context->makeCurrent();
     1010    if (ret && m_isRobustnessSupported) {
     1011        if (m_glGetGraphicsResetStatusEXT() != GL_NO_ERROR) {
     1012            BlackBerry::Platform::logAlways(BlackBerry::Platform::LogLevelCritical, "Robust OpenGL context has been reset. Aborting.");
     1013            CRASH();
     1014        }
     1015    }
     1016    return ret;
    10021017}
    10031018
  • trunk/Source/WebCore/platform/graphics/blackberry/LayerRenderer.h

    r124242 r125349  
    3030 */
    3131
    32 
    3332#ifndef LayerRenderer_h
    3433#define LayerRenderer_h
     
    3635#if USE(ACCELERATED_COMPOSITING)
    3736
     37#include "Extensions3DOpenGLES.h"
    3838#include "IntRect.h"
    3939#include "LayerData.h"
     
    208208    BlackBerry::Platform::Graphics::GLES2Context* m_context;
    209209
     210    bool m_isRobustnessSupported;
     211    PFNGLGETGRAPHICSRESETSTATUSEXTPROC m_glGetGraphicsResetStatusEXT;
     212
    210213    LayerRenderingResults m_lastRenderingResults;
    211214    bool m_needsCommit;
  • trunk/Source/WebCore/platform/graphics/chromium/Extensions3DChromium.h

    r123416 r125349  
    127127    virtual void shallowFlushCHROMIUM();
    128128
     129    // GL_EXT_robustness
     130    virtual void readnPixelsEXT(int x, int y, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, GC3Dsizei bufSize, void *data);
     131    virtual void getnUniformfvEXT(GC3Duint program, int location, GC3Dsizei bufSize, float *params);
     132    virtual void getnUniformivEXT(GC3Duint program, int location, GC3Dsizei bufSize, int *params);
     133
    129134private:
    130135    // Instances of this class are strictly owned by the GraphicsContext3D implementation and do not
  • trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp

    r123749 r125349  
    144144}
    145145
     146void Extensions3DOpenGLCommon::readnPixelsEXT(int, int, GC3Dsizei, GC3Dsizei, GC3Denum, GC3Denum, GC3Dsizei, void *)
     147{
     148    m_context->synthesizeGLError(GL_INVALID_OPERATION);
     149}
     150
     151void Extensions3DOpenGLCommon::getnUniformfvEXT(GC3Duint, int, GC3Dsizei, float *)
     152{
     153    m_context->synthesizeGLError(GL_INVALID_OPERATION);
     154}
     155
     156void Extensions3DOpenGLCommon::getnUniformivEXT(GC3Duint, int, GC3Dsizei, int *)
     157{
     158    m_context->synthesizeGLError(GL_INVALID_OPERATION);
     159}
     160
    146161} // namespace WebCore
    147162
  • trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.h

    r122754 r125349  
    5353    virtual String getTranslatedShaderSourceANGLE(Platform3DObject);
    5454
     55    // EXT Robustness - uses getGraphicsResetStatusARB()
     56    virtual void readnPixelsEXT(int x, int y, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, GC3Dsizei bufSize, void *data);
     57    virtual void getnUniformfvEXT(GC3Duint program, int location, GC3Dsizei bufSize, float *params);
     58    virtual void getnUniformivEXT(GC3Duint program, int location, GC3Dsizei bufSize, int *params);
     59
    5560protected:
    5661    friend class Extensions3DOpenGLES;
  • trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp

    r122754 r125349  
    3434#include <wtf/Vector.h>
    3535
     36#if PLATFORM(BLACKBERRY)
     37#include <BlackBerryPlatformLog.h>
     38#endif
    3639
    3740namespace WebCore {
     
    3942Extensions3DOpenGLES::Extensions3DOpenGLES(GraphicsContext3D* context)
    4043    : Extensions3DOpenGLCommon(context)
     44    , m_contextResetStatus(GL_NO_ERROR)
    4145    , m_supportsOESvertexArrayObject(false)
    4246    , m_supportsIMGMultisampledRenderToTexture(false)
     
    4751    , m_glGenVertexArraysOES(0)
    4852    , m_glIsVertexArrayOES(0)
     53    , m_glGetGraphicsResetStatusEXT(0)
     54    , m_glReadnPixelsEXT(0)
     55    , m_glGetnUniformfvEXT(0)
     56    , m_glGetnUniformivEXT(0)
    4957{
    5058}
     
    138146}
    139147
     148int Extensions3DOpenGLES::getGraphicsResetStatusARB()
     149{
     150    // FIXME: This does not call getGraphicsResetStatusARB, but instead getGraphicsResetStatusEXT.
     151    // The return codes from the two extensions are identical and their purpose is the same, so it
     152    // may be best to rename getGraphicsResetStatusARB() to getGraphicsResetStatus().
     153    if (m_contextResetStatus != GL_NO_ERROR)
     154        return m_contextResetStatus;
     155    if (m_glGetGraphicsResetStatusEXT) {
     156        m_context->makeContextCurrent();
     157        int reasonForReset = m_glGetGraphicsResetStatusEXT();
     158        if (reasonForReset != GL_NO_ERROR) {
     159#if PLATFORM(BLACKBERRY)
     160            // We cannot yet recreate our compositing thread, so just quit.
     161            BlackBerry::Platform::logAlways(BlackBerry::Platform::LogLevelCritical, "Robust OpenGL context has been reset. Aborting.");
     162            CRASH();
     163#endif
     164            ASSERT(m_contextLostCallback);
     165            if (m_contextLostCallback)
     166                m_contextLostCallback->onContextLost();
     167            m_contextResetStatus = reasonForReset;
     168        }
     169        return reasonForReset;
     170    }
     171
     172    m_context->synthesizeGLError(GL_INVALID_OPERATION);
     173    return false;
     174}
     175
     176void Extensions3DOpenGLES::setEXTContextLostCallback(PassOwnPtr<GraphicsContext3D::ContextLostCallback> callback)
     177{
     178    m_contextLostCallback = callback;
     179}
     180
     181void Extensions3DOpenGLES::readnPixelsEXT(int x, int y, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, GC3Dsizei bufSize, void *data)
     182{
     183    if (m_glReadnPixelsEXT) {
     184        m_context->makeContextCurrent();
     185        // FIXME: remove the two glFlush calls when the driver bug is fixed, i.e.,
     186        // all previous rendering calls should be done before reading pixels.
     187        ::glFlush();
     188
     189        // FIXME: If non-BlackBerry platforms use this, they will need to implement
     190        // their anti-aliasing code here.
     191        m_glReadnPixelsEXT(x, y, width, height, format, type, bufSize, data);
     192        return;
     193    }
     194
     195    m_context->synthesizeGLError(GL_INVALID_OPERATION);
     196}
     197
     198void Extensions3DOpenGLES::getnUniformfvEXT(GC3Duint program, int location, GC3Dsizei bufSize, float *params)
     199{
     200    if (m_glGetnUniformfvEXT) {
     201        m_context->makeContextCurrent();
     202        m_glGetnUniformfvEXT(program, location, bufSize, params);
     203        return;
     204    }
     205
     206    m_context->synthesizeGLError(GL_INVALID_OPERATION);
     207}
     208
     209void Extensions3DOpenGLES::getnUniformivEXT(GC3Duint program, int location, GC3Dsizei bufSize, int *params)
     210{
     211    if (m_glGetnUniformivEXT) {
     212        m_context->makeContextCurrent();
     213        m_glGetnUniformivEXT(program, location, bufSize, params);
     214        return;
     215    }
     216
     217    m_context->synthesizeGLError(GL_INVALID_OPERATION);
     218}
    140219
    141220bool Extensions3DOpenGLES::supportsExtension(const String& name)
     
    152231            m_glRenderbufferStorageMultisampleIMG = reinterpret_cast<PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG>(eglGetProcAddress("glRenderbufferStorageMultisampleIMG"));
    153232            m_supportsIMGMultisampledRenderToTexture = true;
     233        } else if (name == "GL_EXT_robustness" && !m_glGetGraphicsResetStatusEXT) {
     234            m_glGetGraphicsResetStatusEXT = reinterpret_cast<PFNGLGETGRAPHICSRESETSTATUSEXTPROC>(eglGetProcAddress("glGetGraphicsResetStatusEXT"));
     235            m_glReadnPixelsEXT = reinterpret_cast<PFNGLREADNPIXELSEXTPROC>(eglGetProcAddress("glReadnPixelsEXT"));
     236            m_glGetnUniformfvEXT = reinterpret_cast<PFNGLGETNUNIFORMFVEXTPROC>(eglGetProcAddress("glGetnUniformfvEXT"));
     237            m_glGetnUniformivEXT = reinterpret_cast<PFNGLGETNUNIFORMIVEXTPROC>(eglGetProcAddress("glGetnUniformivEXT"));
    154238        }
    155239        return true;
  • trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.h

    r122754 r125349  
    3939#endif
    4040
     41#ifndef GL_EXT_robustness
     42/* reuse GL_NO_ERROR */
     43#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253
     44#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254
     45#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255
     46#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3
     47#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256
     48#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252
     49#define GL_NO_RESET_NOTIFICATION_EXT 0x8261
     50#endif
     51
     52#ifndef GL_EXT_robustness
     53#define GL_EXT_robustness 1
     54#ifdef GL_GLEXT_PROTOTYPES
     55GL_APICALL GC3Denum GL_APIENTRY glGetGraphicsResetStatusEXT(void);
     56GL_APICALL void GL_APIENTRY glReadnPixelsEXT(GLint x, GLint y, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, GC3Dsizei bufSize, void *data);
     57GL_APICALL void GL_APIENTRY glGetnUniformfvEXT(GLuint program, GLint location, GC3Dsizei bufSize, float *params);
     58GL_APICALL void GL_APIENTRY glGetnUniformivEXT(GLuint program, GLint location, GC3Dsizei bufSize, GLint *params);
     59#endif
     60typedef GC3Denum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void);
     61typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, GC3Dsizei bufSize, void *data);
     62typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GC3Dsizei bufSize, float *params);
     63typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GC3Dsizei bufSize, GLint *params);
     64#endif
     65
    4166namespace WebCore {
    4267
     
    5883    virtual void bindVertexArrayOES(Platform3DObject);
    5984
     85    // EXT Robustness - reset
     86    virtual int getGraphicsResetStatusARB();
     87    void setEXTContextLostCallback(PassOwnPtr<GraphicsContext3D::ContextLostCallback>);
     88
     89    // EXT Robustness - etc
     90    virtual void readnPixelsEXT(int x, int y, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, GC3Dsizei bufSize, void *data);
     91    virtual void getnUniformfvEXT(GC3Duint program, int location, GC3Dsizei bufSize, float *params);
     92    virtual void getnUniformivEXT(GC3Duint program, int location, GC3Dsizei bufSize, int *params);
     93
    6094protected:
    6195    // This class only needs to be instantiated by GraphicsContext3D implementations.
     
    6599    virtual bool supportsExtension(const String&);
    66100    virtual String getExtensions();
     101
     102    GC3Denum m_contextResetStatus;
    67103
    68104    bool m_supportsOESvertexArrayObject;
     
    75111    PFNGLGENVERTEXARRAYSOESPROC m_glGenVertexArraysOES;
    76112    PFNGLISVERTEXARRAYOESPROC m_glIsVertexArrayOES;
     113    PFNGLGETGRAPHICSRESETSTATUSEXTPROC m_glGetGraphicsResetStatusEXT;
     114    PFNGLREADNPIXELSEXTPROC m_glReadnPixelsEXT;
     115    PFNGLGETNUNIFORMFVEXTPROC m_glGetnUniformfvEXT;
     116    PFNGLGETNUNIFORMIVEXTPROC m_glGetnUniformivEXT;
     117
     118    OwnPtr<GraphicsContext3D::ContextLostCallback> m_contextLostCallback;
    77119};
    78120
  • trunk/Source/WebKit/CMakeLists.txt

    r123864 r125349  
    3232    "${WEBCORE_DIR}/platform/graphics/harfbuzz"
    3333    "${WEBCORE_DIR}/platform/graphics/harfbuzz/ng"
     34    "${WEBCORE_DIR}/platform/graphics/opengl"
    3435    "${WEBCORE_DIR}/platform/graphics/transforms"
    3536    "${WEBCORE_DIR}/platform/network"
  • trunk/Source/WebKit/ChangeLog

    r125324 r125349  
     12012-08-10  Joshua Netterfield  <jnetterfield@rim.com>
     2
     3        [WebGL] Add support for EXT_robustness
     4        https://bugs.webkit.org/show_bug.cgi?id=93379
     5
     6        Reviewed by George Staikos.
     7
     8        RIM PR# 147510
     9        Internally reviewed by Arvid Nilsson.
     10
     11        * CMakeLists.txt: Build system adaptation.
     12
    1132012-08-10  Benjamin C Meyer  <bmeyer@rim.com>
    214
Note: See TracChangeset for help on using the changeset viewer.