Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLCompressedTextureS3TCsRGB.cpp

Issue 2337833002: Implement WEBGL_compressed_texture_s3tc_srgb (Closed)
Patch Set: Implement WEBGL_compressed_texture_s3tc_srgb Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2016 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the 11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution. 12 * documentation and/or other materials provided with the distribution.
13 * 13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "modules/webgl/WebGLDepthTexture.h" 26 #include "modules/webgl/WebGLCompressedTextureS3TCsRGB.h"
27
28 #include "modules/webgl/WebGLRenderingContextBase.h"
27 29
28 namespace blink { 30 namespace blink {
29 31
30 WebGLDepthTexture::WebGLDepthTexture(WebGLRenderingContextBase* context) 32 WebGLCompressedTextureS3TCsRGB::WebGLCompressedTextureS3TCsRGB(WebGLRenderingCon textBase* context)
31 : WebGLExtension(context) 33 : WebGLExtension(context)
32 { 34 {
33 context->extensionsUtil()->ensureExtensionEnabled("GL_CHROMIUM_depth_texture "); 35 context->addCompressedTextureFormat(GL_COMPRESSED_SRGB_S3TC_DXT1_NV);
36 context->addCompressedTextureFormat(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV);
37 context->addCompressedTextureFormat(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV);
38 context->addCompressedTextureFormat(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV);
34 } 39 }
35 40
36 WebGLDepthTexture::~WebGLDepthTexture() 41 WebGLCompressedTextureS3TCsRGB::~WebGLCompressedTextureS3TCsRGB()
37 { 42 {
38 } 43 }
39 44
40 WebGLExtensionName WebGLDepthTexture::name() const 45 WebGLExtensionName WebGLCompressedTextureS3TCsRGB::name() const
41 { 46 {
42 return WebGLDepthTextureName; 47 return WebGLCompressedTextureS3TCsRGBName;
43 } 48 }
44 49
45 WebGLDepthTexture* WebGLDepthTexture::create(WebGLRenderingContextBase* context) 50 WebGLCompressedTextureS3TCsRGB* WebGLCompressedTextureS3TCsRGB::create(WebGLRend eringContextBase* context)
46 { 51 {
47 return new WebGLDepthTexture(context); 52 return new WebGLCompressedTextureS3TCsRGB(context);
48 } 53 }
49 54
50 bool WebGLDepthTexture::supported(WebGLRenderingContextBase* context) 55 bool WebGLCompressedTextureS3TCsRGB::supported(WebGLRenderingContextBase* contex t)
51 { 56 {
52 Extensions3DUtil* extensionsUtil = context->extensionsUtil(); 57 Extensions3DUtil* extensionsUtil = context->extensionsUtil();
53 // Emulating the UNSIGNED_INT_24_8_WEBGL texture internal format in terms 58 return extensionsUtil->supportsExtension("GL_NV_sRGB_formats");
Ken Russell (switch to Gerrit) 2016/09/15 00:50:35 Let's add a TODO here, at least, about changing th
Kai Ninomiya 2016/09/15 20:45:35 Done.
54 // of two separate texture objects is too difficult, so disable depth
55 // textures unless a packed depth/stencil format is available.
56 if (!extensionsUtil->supportsExtension("GL_OES_packed_depth_stencil"))
57 return false;
58 return extensionsUtil->supportsExtension("GL_CHROMIUM_depth_texture")
59 || extensionsUtil->supportsExtension("GL_OES_depth_texture")
60 || extensionsUtil->supportsExtension("GL_ARB_depth_texture");
61 } 59 }
62 60
63 const char* WebGLDepthTexture::extensionName() 61 const char* WebGLCompressedTextureS3TCsRGB::extensionName()
64 { 62 {
65 return "WEBGL_depth_texture"; 63 return "WEBGL_compressed_texture_s3tc_srgb";
66 } 64 }
67 65
68 } // namespace blink 66 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698