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

Side by Side Diff: Source/modules/webgl/WebGLCompressedTextureASTC.cpp

Issue 1265703005: Implement the texture uploading of ASTC compression for WebGL(part II) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove unnecerssary code and cleanup. Created 5 years, 4 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "config.h"
6
7 #include "modules/webgl/WebGLCompressedTextureASTC.h"
8
9 #include "modules/webgl/WebGLRenderingContextBase.h"
10
11 namespace blink {
12
13 const WebGLCompressedTextureASTC::BlockSizeCompressASTC
14 WebGLCompressedTextureASTC::kBlockSizeCompressASTC[] =
15 {
16 GL_COMPRESSED_RGBA_ASTC_4x4_KHR, 4, 4,
17 GL_COMPRESSED_RGBA_ASTC_5x4_KHR, 5, 4,
18 GL_COMPRESSED_RGBA_ASTC_5x5_KHR, 5, 5,
19 GL_COMPRESSED_RGBA_ASTC_6x5_KHR, 6, 5,
20 GL_COMPRESSED_RGBA_ASTC_6x6_KHR, 6, 6,
21 GL_COMPRESSED_RGBA_ASTC_8x5_KHR, 8, 5,
22 GL_COMPRESSED_RGBA_ASTC_8x6_KHR, 8, 6,
23 GL_COMPRESSED_RGBA_ASTC_8x8_KHR, 8, 8,
24 GL_COMPRESSED_RGBA_ASTC_10x5_KHR, 10, 5,
25 GL_COMPRESSED_RGBA_ASTC_10x6_KHR, 10, 6,
26 GL_COMPRESSED_RGBA_ASTC_10x8_KHR, 10, 8,
27 GL_COMPRESSED_RGBA_ASTC_10x10_KHR, 10, 10,
28 GL_COMPRESSED_RGBA_ASTC_12x10_KHR, 12, 10,
29 GL_COMPRESSED_RGBA_ASTC_12x12_KHR, 12, 12,
30 };
31
32 WebGLCompressedTextureASTC::WebGLCompressedTextureASTC(WebGLRenderingContextBase * context)
33 : WebGLExtension(context)
34 {
35 const int kAlphaFormatGap = 0x20;
Ken Russell (switch to Gerrit) 2015/08/27 03:19:02 Please compute this as COMPRESSED_SRGB8_ALPHA8_AST
36
37 for (size_t i = 0; i < arraysize(WebGLCompressedTextureASTC::kBlockSizeCompr essASTC); i++) {
38 /* GL_COMPRESSED_RGBA_ASTC(0x93B0 ~ 0x93BD) */
39 context->addCompressedTextureFormat(
40 WebGLCompressedTextureASTC::kBlockSizeCompressASTC[i].CompressType);
41 /* GL_COMPRESSED_SRGB8_ALPHA8_ASTC(0x93D0 ~ 0x93DD) */
42 context->addCompressedTextureFormat(
43 WebGLCompressedTextureASTC::kBlockSizeCompressASTC[i].CompressType + kAlphaFormatGap);
44 }
45 }
46
47 WebGLCompressedTextureASTC::~WebGLCompressedTextureASTC()
48 {
49 }
50
51 WebGLExtensionName WebGLCompressedTextureASTC::name() const
52 {
53 return WebGLCompressedTextureASTCName;
54 }
55
56 WebGLCompressedTextureASTC* WebGLCompressedTextureASTC::create(WebGLRenderingCon textBase* context)
57 {
58 return new WebGLCompressedTextureASTC(context);
59 }
60
61 bool WebGLCompressedTextureASTC::supported(WebGLRenderingContextBase* context)
62 {
63 Extensions3DUtil* extensionsUtil = context->extensionsUtil();
64 return extensionsUtil->supportsExtension("GL_KHR_texture_compression_astc_ld r");
65 }
66
67 const char* WebGLCompressedTextureASTC::extensionName()
68 {
69 // TODO(cyzero.kim): implement extension for GL_KHR_texture_compression_astc _hdr.
70 return "WEBGL_compressed_texture_astc";
71 }
72
73 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/webgl/WebGLCompressedTextureASTC.h ('k') | Source/modules/webgl/WebGLCompressedTextureASTC.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698