Changeset 111986 in webkit
- Timestamp:
- Mar 24, 2012 1:37:51 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r111982 r111986 1 2012-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 1 20 2012-03-23 Shawn Singh <shawnsingh@chromium.org> 2 21 -
trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp
r111687 r111986 320 320 RefPtr<TextureMapperShaderProgram> shaderInfo; 321 321 if (maskTexture) 322 shaderInfo = data().sharedGLData().textureMapperShaderManager.getShaderProgram <TextureMapperShaderProgramOpacityAndMask>();322 shaderInfo = data().sharedGLData().textureMapperShaderManager.getShaderProgram(TextureMapperShaderManager::OpacityAndMask); 323 323 else 324 shaderInfo = data().sharedGLData().textureMapperShaderManager.getShaderProgram <TextureMapperShaderProgramSimple>();324 shaderInfo = data().sharedGLData().textureMapperShaderManager.getShaderProgram(TextureMapperShaderManager::Simple); 325 325 326 326 GL_CMD(glUseProgram(shaderInfo->id())) … … 625 625 data().initializeStencil(); 626 626 627 RefPtr<TextureMapperShaderProgram Simple> shaderInfo = data().sharedGLData().textureMapperShaderManager.getShaderProgram<TextureMapperShaderProgramSimple>();627 RefPtr<TextureMapperShaderProgram> shaderInfo = data().sharedGLData().textureMapperShaderManager.getShaderProgram(TextureMapperShaderManager::Simple); 628 628 629 629 GL_CMD(glUseProgram(shaderInfo->id())) -
trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.h
r110438 r111986 34 34 namespace WebCore { 35 35 36 typedef void* ShaderType;37 38 36 class BitmapTexture; 39 37 class TextureMapperShaderManager; … … 45 43 46 44 virtual ~TextureMapperShaderProgram(); 47 48 template<class T>49 static ShaderType shaderType()50 {51 static int type = 0;52 return &type;53 }54 45 55 46 virtual void prepare(float opacity, const BitmapTexture*) { } … … 102 93 class TextureMapperShaderManager { 103 94 public: 95 enum ShaderType { 96 Invalid = 0, // HashMaps do not like 0 as a key. 97 Simple, 98 OpacityAndMask 99 }; 100 104 101 TextureMapperShaderManager(); 105 102 virtual ~TextureMapperShaderManager(); 106 103 107 template<class T> 108 PassRefPtr<T> getShaderProgram() 104 PassRefPtr<TextureMapperShaderProgram> getShaderProgram(ShaderType shaderType) 109 105 { 110 ShaderType shaderType = TextureMapperShaderProgram::shaderType<T>(); 106 RefPtr<TextureMapperShaderProgram> program; 107 if (shaderType == Invalid) 108 return program; 109 111 110 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; 118 121 } 119 122 120 123 private: 121 typedef HashMap<ShaderType, RefPtr<TextureMapperShaderProgram> > TextureMapperShaderProgramMap;124 typedef HashMap<ShaderType, RefPtr<TextureMapperShaderProgram>, DefaultHash<int>::Hash, HashTraits<int> > TextureMapperShaderProgramMap; 122 125 TextureMapperShaderProgramMap m_textureMapperShaderProgramMap; 123 126 };
Note: See TracChangeset
for help on using the changeset viewer.