Changeset 111986 in webkit


Ignore:
Timestamp:
Mar 24, 2012 1:37:51 AM (12 years ago)
Author:
zeno.albisser@nokia.com
Message:

[Qt][WK2] Make TextureMapperShaderManager::getShaderProgram() not be a template.
https://bugs.webkit.org/show_bug.cgi?id=82049

Change the getShaderProgram() function to not be a template.
This is a workaround for a compiler bug that leads to an assert
when compiling in debug mode on mac.

Reviewed by Noam Rosenthal.

  • platform/graphics/texmap/TextureMapperGL.cpp:

(WebCore::TextureMapperGL::drawTexture):
(WebCore::TextureMapperGL::beginClip):

  • platform/graphics/texmap/TextureMapperShaderManager.h:

(TextureMapperShaderProgram):
(WebCore::TextureMapperShaderManager::getShaderProgram):
(TextureMapperShaderManager):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r111982 r111986  
     12012-03-24  Zeno Albisser  <zeno@webkit.org>
     2
     3        [Qt][WK2] Make TextureMapperShaderManager::getShaderProgram() not be a template.
     4        https://bugs.webkit.org/show_bug.cgi?id=82049
     5
     6        Change the getShaderProgram() function to not be a template.
     7        This is a workaround for a compiler bug that leads to an assert
     8        when compiling in debug mode on mac.
     9
     10        Reviewed by Noam Rosenthal.
     11
     12        * platform/graphics/texmap/TextureMapperGL.cpp:
     13        (WebCore::TextureMapperGL::drawTexture):
     14        (WebCore::TextureMapperGL::beginClip):
     15        * platform/graphics/texmap/TextureMapperShaderManager.h:
     16        (TextureMapperShaderProgram):
     17        (WebCore::TextureMapperShaderManager::getShaderProgram):
     18        (TextureMapperShaderManager):
     19
    1202012-03-23  Shawn Singh  <shawnsingh@chromium.org>
    221
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp

    r111687 r111986  
    320320    RefPtr<TextureMapperShaderProgram> shaderInfo;
    321321    if (maskTexture)
    322         shaderInfo = data().sharedGLData().textureMapperShaderManager.getShaderProgram<TextureMapperShaderProgramOpacityAndMask>();
     322        shaderInfo = data().sharedGLData().textureMapperShaderManager.getShaderProgram(TextureMapperShaderManager::OpacityAndMask);
    323323    else
    324         shaderInfo = data().sharedGLData().textureMapperShaderManager.getShaderProgram<TextureMapperShaderProgramSimple>();
     324        shaderInfo = data().sharedGLData().textureMapperShaderManager.getShaderProgram(TextureMapperShaderManager::Simple);
    325325
    326326    GL_CMD(glUseProgram(shaderInfo->id()))
     
    625625    data().initializeStencil();
    626626
    627     RefPtr<TextureMapperShaderProgramSimple> shaderInfo = data().sharedGLData().textureMapperShaderManager.getShaderProgram<TextureMapperShaderProgramSimple>();
     627    RefPtr<TextureMapperShaderProgram> shaderInfo = data().sharedGLData().textureMapperShaderManager.getShaderProgram(TextureMapperShaderManager::Simple);
    628628
    629629    GL_CMD(glUseProgram(shaderInfo->id()))
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.h

    r110438 r111986  
    3434namespace WebCore {
    3535
    36 typedef void* ShaderType;
    37 
    3836class BitmapTexture;
    3937class TextureMapperShaderManager;
     
    4543
    4644    virtual ~TextureMapperShaderProgram();
    47 
    48     template<class T>
    49     static ShaderType shaderType()
    50     {
    51         static int type = 0;
    52         return &type;
    53     }
    5445
    5546    virtual void prepare(float opacity, const BitmapTexture*) { }
     
    10293class TextureMapperShaderManager {
    10394public:
     95    enum ShaderType {
     96        Invalid = 0, // HashMaps do not like 0 as a key.
     97        Simple,
     98        OpacityAndMask
     99    };
     100
    104101    TextureMapperShaderManager();
    105102    virtual ~TextureMapperShaderManager();
    106103
    107     template<class T>
    108     PassRefPtr<T> getShaderProgram()
     104    PassRefPtr<TextureMapperShaderProgram> getShaderProgram(ShaderType shaderType)
    109105    {
    110         ShaderType shaderType = TextureMapperShaderProgram::shaderType<T>();
     106        RefPtr<TextureMapperShaderProgram> program;
     107        if (shaderType == Invalid)
     108            return program;
     109
    111110        TextureMapperShaderProgramMap::iterator it = m_textureMapperShaderProgramMap.find(shaderType);
    112         if (it != m_textureMapperShaderProgramMap.end())
    113             return static_cast<T*>(it->second.get());
    114 
    115         RefPtr<T> t = T::create();
    116         m_textureMapperShaderProgramMap.add(shaderType, t);
    117         return t;
     111        switch (shaderType) {
     112        case Simple:
     113            program = TextureMapperShaderProgramSimple::create();
     114            break;
     115        case OpacityAndMask:
     116            program = TextureMapperShaderProgramOpacityAndMask::create();
     117            break;
     118        }
     119        m_textureMapperShaderProgramMap.add(shaderType, program);
     120        return program;
    118121    }
    119122
    120123private:
    121     typedef HashMap<ShaderType, RefPtr<TextureMapperShaderProgram> > TextureMapperShaderProgramMap;
     124    typedef HashMap<ShaderType, RefPtr<TextureMapperShaderProgram>, DefaultHash<int>::Hash, HashTraits<int> > TextureMapperShaderProgramMap;
    122125    TextureMapperShaderProgramMap m_textureMapperShaderProgramMap;
    123126};
Note: See TracChangeset for help on using the changeset viewer.