| OLD | NEW | 
|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "platform/graphics/gpu/Extensions3DUtil.h" | 5 #include "platform/graphics/gpu/Extensions3DUtil.h" | 
| 6 | 6 | 
| 7 #include "gpu/command_buffer/client/gles2_interface.h" | 7 #include "gpu/command_buffer/client/gles2_interface.h" | 
| 8 #include "wtf/PtrUtil.h" | 8 #include "wtf/PtrUtil.h" | 
| 9 #include "wtf/text/CString.h" | 9 #include "wtf/text/CString.h" | 
| 10 #include "wtf/text/StringHash.h" | 10 #include "wtf/text/StringHash.h" | 
| (...skipping 20 matching lines...) Expand all  Loading... | 
| 31 } | 31 } | 
| 32 | 32 | 
| 33 Extensions3DUtil::Extensions3DUtil(gpu::gles2::GLES2Interface* gl) | 33 Extensions3DUtil::Extensions3DUtil(gpu::gles2::GLES2Interface* gl) | 
| 34     : m_gl(gl), m_isValid(true) {} | 34     : m_gl(gl), m_isValid(true) {} | 
| 35 | 35 | 
| 36 Extensions3DUtil::~Extensions3DUtil() {} | 36 Extensions3DUtil::~Extensions3DUtil() {} | 
| 37 | 37 | 
| 38 void Extensions3DUtil::initializeExtensions() { | 38 void Extensions3DUtil::initializeExtensions() { | 
| 39   if (m_gl->GetGraphicsResetStatusKHR() != GL_NO_ERROR) { | 39   if (m_gl->GetGraphicsResetStatusKHR() != GL_NO_ERROR) { | 
| 40     // If the context is lost don't initialize the extension strings. | 40     // If the context is lost don't initialize the extension strings. | 
| 41     // This will cause supportsExtension, ensureExtensionEnabled, and isExtensio
    nEnabled to always return false. | 41     // This will cause supportsExtension, ensureExtensionEnabled, and | 
|  | 42     // isExtensionEnabled to always return false. | 
| 42     m_isValid = false; | 43     m_isValid = false; | 
| 43     return; | 44     return; | 
| 44   } | 45   } | 
| 45 | 46 | 
| 46   String extensionsString(m_gl->GetString(GL_EXTENSIONS)); | 47   String extensionsString(m_gl->GetString(GL_EXTENSIONS)); | 
| 47   splitStringHelper(extensionsString, m_enabledExtensions); | 48   splitStringHelper(extensionsString, m_enabledExtensions); | 
| 48 | 49 | 
| 49   String requestableExtensionsString(m_gl->GetRequestableExtensionsCHROMIUM()); | 50   String requestableExtensionsString(m_gl->GetRequestableExtensionsCHROMIUM()); | 
| 50   splitStringHelper(requestableExtensionsString, m_requestableExtensions); | 51   splitStringHelper(requestableExtensionsString, m_requestableExtensions); | 
| 51 } | 52 } | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
| 69 } | 70 } | 
| 70 | 71 | 
| 71 bool Extensions3DUtil::isExtensionEnabled(const String& name) { | 72 bool Extensions3DUtil::isExtensionEnabled(const String& name) { | 
| 72   return m_enabledExtensions.contains(name); | 73   return m_enabledExtensions.contains(name); | 
| 73 } | 74 } | 
| 74 | 75 | 
| 75 bool Extensions3DUtil::canUseCopyTextureCHROMIUM(GLenum destTarget, | 76 bool Extensions3DUtil::canUseCopyTextureCHROMIUM(GLenum destTarget, | 
| 76                                                  GLenum destFormat, | 77                                                  GLenum destFormat, | 
| 77                                                  GLenum destType, | 78                                                  GLenum destType, | 
| 78                                                  GLint level) { | 79                                                  GLint level) { | 
| 79   // TODO(zmo): restriction of (RGB || RGBA)/UNSIGNED_BYTE/(Level 0) should be l
    ifted when | 80   // TODO(zmo): restriction of (RGB || RGBA)/UNSIGNED_BYTE/(Level 0) should be | 
| 80   // GLES2Interface::CopyTextureCHROMIUM(...) are fully functional. | 81   // lifted when GLES2Interface::CopyTextureCHROMIUM(...) are fully functional. | 
| 81   if (destTarget == GL_TEXTURE_2D && | 82   if (destTarget == GL_TEXTURE_2D && | 
| 82       (destFormat == GL_RGB || destFormat == GL_RGBA) && | 83       (destFormat == GL_RGB || destFormat == GL_RGBA) && | 
| 83       destType == GL_UNSIGNED_BYTE && !level) | 84       destType == GL_UNSIGNED_BYTE && !level) | 
| 84     return true; | 85     return true; | 
| 85   return false; | 86   return false; | 
| 86 } | 87 } | 
| 87 | 88 | 
| 88 }  // namespace blink | 89 }  // namespace blink | 
| OLD | NEW | 
|---|