| 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 "modules/webgl/WebGLCompressedTextureETC1.h" | 5 #include "modules/webgl/WebGLCompressedTextureETC1.h" |
| 6 | 6 |
| 7 #include "modules/webgl/WebGLRenderingContextBase.h" | 7 #include "modules/webgl/WebGLRenderingContextBase.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 | 10 |
| 11 WebGLCompressedTextureETC1::WebGLCompressedTextureETC1( | 11 WebGLCompressedTextureETC1::WebGLCompressedTextureETC1( |
| 12 WebGLRenderingContextBase* context) | 12 WebGLRenderingContextBase* context) |
| 13 : WebGLExtension(context) { | 13 : WebGLExtension(context) { |
| 14 context->addCompressedTextureFormat(GL_ETC1_RGB8_OES); | 14 context->addCompressedTextureFormat(GL_ETC1_RGB8_OES); |
| 15 } | 15 } |
| 16 | 16 |
| 17 WebGLExtensionName WebGLCompressedTextureETC1::name() const { | 17 WebGLExtensionName WebGLCompressedTextureETC1::name() const { |
| 18 return WebGLCompressedTextureETC1Name; | 18 return WebGLCompressedTextureETC1Name; |
| 19 } | 19 } |
| 20 | 20 |
| 21 WebGLCompressedTextureETC1* WebGLCompressedTextureETC1::create( | 21 WebGLCompressedTextureETC1* WebGLCompressedTextureETC1::create( |
| 22 WebGLRenderingContextBase* context) { | 22 WebGLRenderingContextBase* context) { |
| 23 return new WebGLCompressedTextureETC1(context); | 23 return new WebGLCompressedTextureETC1(context); |
| 24 } | 24 } |
| 25 | 25 |
| 26 bool WebGLCompressedTextureETC1::supported(WebGLRenderingContextBase* context) { | 26 bool WebGLCompressedTextureETC1::supported(WebGLRenderingContextBase* context) { |
| 27 Extensions3DUtil* extensionsUtil = context->extensionsUtil(); | 27 Extensions3DUtil* extensionsUtil = context->extensionsUtil(); |
| 28 bool webgl1 = !context->isWebGL2OrHigher(); | 28 return extensionsUtil->supportsExtension( |
| 29 bool etc1 = | 29 "GL_OES_compressed_ETC1_RGB8_texture"); |
| 30 extensionsUtil->supportsExtension("GL_OES_compressed_ETC1_RGB8_texture"); | |
| 31 bool etc = | |
| 32 extensionsUtil->supportsExtension("GL_CHROMIUM_compressed_texture_etc"); | |
| 33 return (webgl1 || etc) && etc1; | |
| 34 } | 30 } |
| 35 | 31 |
| 36 const char* WebGLCompressedTextureETC1::extensionName() { | 32 const char* WebGLCompressedTextureETC1::extensionName() { |
| 37 return "WEBGL_compressed_texture_etc1"; | 33 return "WEBGL_compressed_texture_etc1"; |
| 38 } | 34 } |
| 39 | 35 |
| 40 } // namespace blink | 36 } // namespace blink |
| OLD | NEW |