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

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

Issue 2337833002: Implement WEBGL_compressed_texture_s3tc_srgb (Closed)
Patch Set: replace NV_sRGB_formats with (draft) EXT_texture_compression_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) 2011 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/WebGLCompressedTextureS3TC.h" 26 #include "modules/webgl/WebGLCompressedTextureS3TCsRGB.h"
27 27
28 #include "modules/webgl/WebGLRenderingContextBase.h" 28 #include "modules/webgl/WebGLRenderingContextBase.h"
29 29
30 namespace blink { 30 namespace blink {
31 31
32 WebGLCompressedTextureS3TC::WebGLCompressedTextureS3TC(WebGLRenderingContextBase * context) 32 WebGLCompressedTextureS3TCsRGB::WebGLCompressedTextureS3TCsRGB(WebGLRenderingCon textBase* context)
33 : WebGLExtension(context) 33 : WebGLExtension(context)
34 { 34 {
35 context->addCompressedTextureFormat(GL_COMPRESSED_RGB_S3TC_DXT1_EXT); 35 context->addCompressedTextureFormat(GL_COMPRESSED_SRGB_S3TC_DXT1_NV);
36 context->addCompressedTextureFormat(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT); 36 context->addCompressedTextureFormat(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV);
37 context->addCompressedTextureFormat(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT); 37 context->addCompressedTextureFormat(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV);
38 context->addCompressedTextureFormat(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT); 38 context->addCompressedTextureFormat(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV);
Kai Ninomiya 2016/09/15 21:54:08 Should these be left as _NV, or should we define t
Ken Russell (switch to Gerrit) 2016/09/15 23:38:26 We'd need to modify src/third_party/khronos/GLES2/
39 } 39 }
40 40
41 WebGLCompressedTextureS3TC::~WebGLCompressedTextureS3TC() 41 WebGLCompressedTextureS3TCsRGB::~WebGLCompressedTextureS3TCsRGB()
42 { 42 {
43 } 43 }
44 44
45 WebGLExtensionName WebGLCompressedTextureS3TC::name() const 45 WebGLExtensionName WebGLCompressedTextureS3TCsRGB::name() const
46 { 46 {
47 return WebGLCompressedTextureS3TCName; 47 return WebGLCompressedTextureS3TCsRGBName;
48 } 48 }
49 49
50 WebGLCompressedTextureS3TC* WebGLCompressedTextureS3TC::create(WebGLRenderingCon textBase* context) 50 WebGLCompressedTextureS3TCsRGB* WebGLCompressedTextureS3TCsRGB::create(WebGLRend eringContextBase* context)
51 { 51 {
52 return new WebGLCompressedTextureS3TC(context); 52 return new WebGLCompressedTextureS3TCsRGB(context);
53 } 53 }
54 54
55 bool WebGLCompressedTextureS3TC::supported(WebGLRenderingContextBase* context) 55 bool WebGLCompressedTextureS3TCsRGB::supported(WebGLRenderingContextBase* contex t)
56 { 56 {
57 Extensions3DUtil* extensionsUtil = context->extensionsUtil(); 57 Extensions3DUtil* extensionsUtil = context->extensionsUtil();
58 return extensionsUtil->supportsExtension("GL_EXT_texture_compression_s3tc") 58 return extensionsUtil->supportsExtension("GL_EXT_texture_compression_s3tc_sr gb");
59 || (extensionsUtil->supportsExtension("GL_EXT_texture_compression_dxt1")
60 && extensionsUtil->supportsExtension("GL_CHROMIUM_texture_compressio n_dxt3")
61 && extensionsUtil->supportsExtension("GL_CHROMIUM_texture_compressio n_dxt5"));
62 } 59 }
63 60
64 const char* WebGLCompressedTextureS3TC::extensionName() 61 const char* WebGLCompressedTextureS3TCsRGB::extensionName()
65 { 62 {
66 return "WEBGL_compressed_texture_s3tc"; 63 return "WEBGL_compressed_texture_s3tc_srgb";
67 } 64 }
68 65
69 } // namespace blink 66 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698