Changeset 122189 in webkit


Ignore:
Timestamp:
Jul 9, 2012 8:27:37 PM (12 years ago)
Author:
Alexandru Chiculita
Message:

[CSS Shaders] The FECustomFilter is not making the GL context active
https://bugs.webkit.org/show_bug.cgi?id=90840

Reviewed by Dean Jackson.

I've added a couple of makeContextCurrent() in the FECustomFilter related classes.
Also, removed the assumption that GraphicsContext3D::create() never returns 0.

No new tests, this was crashing on existing tests.

  • platform/graphics/filters/CustomFilterCompiledProgram.cpp:

(WebCore::CustomFilterCompiledProgram::CustomFilterCompiledProgram):
(WebCore::CustomFilterCompiledProgram::~CustomFilterCompiledProgram):

  • platform/graphics/filters/CustomFilterGlobalContext.cpp:

(WebCore::CustomFilterGlobalContext::prepareContextIfNeeded):

  • platform/graphics/filters/CustomFilterMesh.cpp:

(WebCore::CustomFilterMesh::CustomFilterMesh):
(WebCore::CustomFilterMesh::~CustomFilterMesh):

  • platform/graphics/filters/FECustomFilter.cpp:

(WebCore::FECustomFilter::deleteRenderBuffers):
(WebCore::FECustomFilter::platformApplySoftware):
(WebCore::FECustomFilter::initializeContext):

  • platform/graphics/filters/FECustomFilter.h:

(FECustomFilter):

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r122188 r122189  
     12012-07-09  Alexandru Chiculita  <achicu@adobe.com>
     2
     3        [CSS Shaders] The FECustomFilter is not making the GL context active
     4        https://bugs.webkit.org/show_bug.cgi?id=90840
     5
     6        Reviewed by Dean Jackson.
     7
     8        I've added a couple of makeContextCurrent() in the FECustomFilter related classes.
     9        Also, removed the assumption that GraphicsContext3D::create() never returns 0.
     10
     11        No new tests, this was crashing on existing tests.
     12
     13        * platform/graphics/filters/CustomFilterCompiledProgram.cpp:
     14        (WebCore::CustomFilterCompiledProgram::CustomFilterCompiledProgram):
     15        (WebCore::CustomFilterCompiledProgram::~CustomFilterCompiledProgram):
     16        * platform/graphics/filters/CustomFilterGlobalContext.cpp:
     17        (WebCore::CustomFilterGlobalContext::prepareContextIfNeeded):
     18        * platform/graphics/filters/CustomFilterMesh.cpp:
     19        (WebCore::CustomFilterMesh::CustomFilterMesh):
     20        (WebCore::CustomFilterMesh::~CustomFilterMesh):
     21        * platform/graphics/filters/FECustomFilter.cpp:
     22        (WebCore::FECustomFilter::deleteRenderBuffers):
     23        (WebCore::FECustomFilter::platformApplySoftware):
     24        (WebCore::FECustomFilter::initializeContext):
     25        * platform/graphics/filters/FECustomFilter.h:
     26        (FECustomFilter):
     27
    1282012-07-09  Kent Tamura  <tkent@chromium.org>
    229
  • trunk/Source/WebCore/platform/graphics/filters/CustomFilterCompiledProgram.cpp

    r122175 r122189  
    8888    , m_isInitialized(false)
    8989{
     90    m_context->makeContextCurrent();
     91   
    9092    Platform3DObject vertexShader = compileShader(GraphicsContext3D::VERTEX_SHADER, m_vertexShaderString);
    9193    if (!vertexShader)
     
    172174CustomFilterCompiledProgram::~CustomFilterCompiledProgram()
    173175{
    174     if (m_program)
     176    if (m_program) {
     177        m_context->makeContextCurrent();
    175178        m_context->deleteProgram(m_program);
     179    }
    176180}
    177181
  • trunk/Source/WebCore/platform/graphics/filters/CustomFilterGlobalContext.cpp

    r122175 r122189  
    5454    attributes.premultipliedAlpha = false;
    5555    m_context = GraphicsContext3D::create(attributes, hostWindow, GraphicsContext3D::RenderOffscreen);
    56 
     56    if (!m_context)
     57        return;
     58    m_context->makeContextCurrent();
    5759    m_context->enable(GraphicsContext3D::DEPTH_TEST);
    5860}
  • trunk/Source/WebCore/platform/graphics/filters/CustomFilterMesh.cpp

    r122175 r122189  
    246246    m_bytesPerVertex = generator.floatsPerVertex() * sizeof(float);   
    247247
     248    m_context->makeContextCurrent();
     249
    248250    m_verticesBufferObject = m_context->createBuffer();
    249251    m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, m_verticesBufferObject);
     
    257259CustomFilterMesh::~CustomFilterMesh()
    258260{
     261    m_context->makeContextCurrent();
    259262    m_context->deleteBuffer(m_verticesBufferObject);
    260263    m_context->deleteBuffer(m_elementsBufferObject);
  • trunk/Source/WebCore/platform/graphics/filters/FECustomFilter.cpp

    r122175 r122189  
    104104void FECustomFilter::deleteRenderBuffers()
    105105{
     106    if (!m_context)
     107        return;
     108    m_context->makeContextCurrent();
    106109    if (m_frameBuffer) {
    107110        m_context->deleteFramebuffer(m_frameBuffer);
     
    130133    IntSize newContextSize(effectDrawingRect.size());
    131134    bool hadContext = m_context;
    132     if (!m_context)
    133         initializeContext();
     135    if (!m_context && !initializeContext())
     136        return;
     137    m_context->makeContextCurrent();
    134138   
    135139    if (!hadContext || m_contextSize != newContextSize)
     
    158162}
    159163
    160 void FECustomFilter::initializeContext()
     164bool FECustomFilter::initializeContext()
    161165{
    162166    ASSERT(!m_context.get());
    163     ASSERT(m_globalContext->context());
    164167    m_context = m_globalContext->context();
     168    if (!m_context)
     169        return false;
     170    m_context->makeContextCurrent();
    165171   
    166172    // FIXME: The shader and the mesh can be shared across multiple elements when possible.
     
    175181                                      FloatRect(0, 0, 1, 1),
    176182                                      m_meshType);
     183    return true;
    177184}
    178185
  • trunk/Source/WebCore/platform/graphics/filters/FECustomFilter.h

    r122175 r122189  
    7373    ~FECustomFilter();
    7474   
    75     void initializeContext();
     75    bool initializeContext();
    7676    void deleteRenderBuffers();
    7777    void resizeContext(const IntSize& newContextSize);
Note: See TracChangeset for help on using the changeset viewer.