| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 | 998 |
| 999 // Get the max texture size supported by the system. | 999 // Get the max texture size supported by the system. |
| 1000 m_maxTextureSize = 0; | 1000 m_maxTextureSize = 0; |
| 1001 GLC(m_context.get(), m_context->getIntegerv(GraphicsContext3D::MAX_TEXTURE_S
IZE, &m_maxTextureSize)); | 1001 GLC(m_context.get(), m_context->getIntegerv(GraphicsContext3D::MAX_TEXTURE_S
IZE, &m_maxTextureSize)); |
| 1002 | 1002 |
| 1003 // Create an FBO for doing offscreen rendering. | 1003 // Create an FBO for doing offscreen rendering. |
| 1004 GLC(m_context.get(), m_offscreenFramebufferId = m_context->createFramebuffer
()); | 1004 GLC(m_context.get(), m_offscreenFramebufferId = m_context->createFramebuffer
()); |
| 1005 | 1005 |
| 1006 m_sharedGeometry = adoptPtr(new GeometryBinding(m_context.get())); | 1006 m_sharedGeometry = adoptPtr(new GeometryBinding(m_context.get())); |
| 1007 m_borderProgram = adoptPtr(new LayerChromium::BorderProgram(m_context.get())
); | 1007 m_borderProgram = adoptPtr(new LayerChromium::BorderProgram(m_context.get())
); |
| 1008 m_headsUpDisplayProgram = adoptPtr(new CCHeadsUpDisplay::Program(m_context.g
et())); |
| 1008 m_canvasLayerProgram = adoptPtr(new CCCanvasLayerImpl::Program(m_context.get
())); | 1009 m_canvasLayerProgram = adoptPtr(new CCCanvasLayerImpl::Program(m_context.get
())); |
| 1009 m_videoLayerRGBAProgram = adoptPtr(new CCVideoLayerImpl::RGBAProgram(m_conte
xt.get())); | 1010 m_videoLayerRGBAProgram = adoptPtr(new CCVideoLayerImpl::RGBAProgram(m_conte
xt.get())); |
| 1010 m_videoLayerYUVProgram = adoptPtr(new CCVideoLayerImpl::YUVProgram(m_context
.get())); | 1011 m_videoLayerYUVProgram = adoptPtr(new CCVideoLayerImpl::YUVProgram(m_context
.get())); |
| 1011 m_pluginLayerProgram = adoptPtr(new CCPluginLayerImpl::Program(m_context.get
())); | 1012 m_pluginLayerProgram = adoptPtr(new CCPluginLayerImpl::Program(m_context.get
())); |
| 1012 m_renderSurfaceProgram = adoptPtr(new RenderSurfaceChromium::Program(m_conte
xt.get())); | 1013 m_renderSurfaceProgram = adoptPtr(new RenderSurfaceChromium::Program(m_conte
xt.get())); |
| 1013 m_renderSurfaceMaskProgram = adoptPtr(new RenderSurfaceChromium::MaskProgram
(m_context.get())); | 1014 m_renderSurfaceMaskProgram = adoptPtr(new RenderSurfaceChromium::MaskProgram
(m_context.get())); |
| 1014 m_tilerProgram = adoptPtr(new LayerTilerChromium::Program(m_context.get())); | 1015 m_tilerProgram = adoptPtr(new LayerTilerChromium::Program(m_context.get())); |
| 1015 | 1016 |
| 1016 if (!m_sharedGeometry->initialized() || !m_borderProgram->initialized() | 1017 if (!m_sharedGeometry->initialized() || !m_borderProgram->initialized() |
| 1017 || !m_canvasLayerProgram->initialized() | 1018 || !m_canvasLayerProgram->initialized() |
| 1019 || !m_headsUpDisplayProgram->initialized() |
| 1018 || !m_videoLayerRGBAProgram->initialized() || !m_videoLayerYUVProgram->i
nitialized() | 1020 || !m_videoLayerRGBAProgram->initialized() || !m_videoLayerYUVProgram->i
nitialized() |
| 1019 || !m_pluginLayerProgram->initialized() || !m_renderSurfaceProgram->init
ialized() | 1021 || !m_pluginLayerProgram->initialized() || !m_renderSurfaceProgram->init
ialized() |
| 1020 || !m_renderSurfaceMaskProgram->initialized() || !m_tilerProgram->initia
lized()) { | 1022 || !m_renderSurfaceMaskProgram->initialized() || !m_tilerProgram->initia
lized()) { |
| 1021 LOG_ERROR("Compositor failed to initialize shaders. Falling back to soft
ware."); | 1023 LOG_ERROR("Compositor failed to initialize shaders. Falling back to soft
ware."); |
| 1022 cleanupSharedObjects(); | 1024 cleanupSharedObjects(); |
| 1023 return false; | 1025 return false; |
| 1024 } | 1026 } |
| 1025 | 1027 |
| 1026 m_textureManager = TextureManager::create(m_context.get(), textureMemoryLimi
tBytes, m_maxTextureSize); | 1028 m_textureManager = TextureManager::create(m_context.get(), textureMemoryLimi
tBytes, m_maxTextureSize); |
| 1027 return true; | 1029 return true; |
| 1028 } | 1030 } |
| 1029 | 1031 |
| 1030 void LayerRendererChromium::cleanupSharedObjects() | 1032 void LayerRendererChromium::cleanupSharedObjects() |
| 1031 { | 1033 { |
| 1032 makeContextCurrent(); | 1034 makeContextCurrent(); |
| 1033 | 1035 |
| 1034 m_sharedGeometry.clear(); | 1036 m_sharedGeometry.clear(); |
| 1035 m_borderProgram.clear(); | 1037 m_borderProgram.clear(); |
| 1036 m_canvasLayerProgram.clear(); | 1038 m_canvasLayerProgram.clear(); |
| 1039 m_headsUpDisplayProgram.clear(); |
| 1037 m_videoLayerRGBAProgram.clear(); | 1040 m_videoLayerRGBAProgram.clear(); |
| 1038 m_videoLayerYUVProgram.clear(); | 1041 m_videoLayerYUVProgram.clear(); |
| 1039 m_pluginLayerProgram.clear(); | 1042 m_pluginLayerProgram.clear(); |
| 1040 m_renderSurfaceProgram.clear(); | 1043 m_renderSurfaceProgram.clear(); |
| 1041 m_renderSurfaceMaskProgram.clear(); | 1044 m_renderSurfaceMaskProgram.clear(); |
| 1042 m_tilerProgram.clear(); | 1045 m_tilerProgram.clear(); |
| 1043 if (m_offscreenFramebufferId) | 1046 if (m_offscreenFramebufferId) |
| 1044 GLC(m_context.get(), m_context->deleteFramebuffer(m_offscreenFramebuffer
Id)); | 1047 GLC(m_context.get(), m_context->deleteFramebuffer(m_offscreenFramebuffer
Id)); |
| 1045 | 1048 |
| 1046 // Clear tilers before the texture manager, as they have references to textu
res. | 1049 // Clear tilers before the texture manager, as they have references to textu
res. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 if (layer->ccLayerImpl()->renderSurface()) | 1110 if (layer->ccLayerImpl()->renderSurface()) |
| 1108 layer->ccLayerImpl()->renderSurface()->dumpSurface(ts, indent); | 1111 layer->ccLayerImpl()->renderSurface()->dumpSurface(ts, indent); |
| 1109 | 1112 |
| 1110 for (size_t i = 0; i < layer->getSublayers().size(); ++i) | 1113 for (size_t i = 0; i < layer->getSublayers().size(); ++i) |
| 1111 dumpRenderSurfaces(ts, indent, layer->getSublayers()[i].get()); | 1114 dumpRenderSurfaces(ts, indent, layer->getSublayers()[i].get()); |
| 1112 } | 1115 } |
| 1113 | 1116 |
| 1114 } // namespace WebCore | 1117 } // namespace WebCore |
| 1115 | 1118 |
| 1116 #endif // USE(ACCELERATED_COMPOSITING) | 1119 #endif // USE(ACCELERATED_COMPOSITING) |
| OLD | NEW |