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

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: Clean and Remove unnecessary enum. 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 const int WebGLCompressedTextureASTC::kSizeOfBlockSizeCompressASTC =
Ken Russell (switch to Gerrit) 2015/08/18 00:05:02 Please use arraysize(WebGLCompressedTextureASTC::B
33 sizeof(WebGLCompressedTextureASTC::kBlockSizeCompressASTC) /
34 sizeof(WebGLCompressedTextureASTC::kBlockSizeCompressASTC[0]);
35
36 WebGLCompressedTextureASTC::WebGLCompressedTextureASTC(WebGLRenderingContextBase * context)
37 : WebGLExtension(context)
38 {
39 for (int i = 0; i < WebGLCompressedTextureASTC::kSizeOfBlockSizeCompressASTC ; i++) {
40 /* GL_COMPRESSED_RGBA_ASTC(0x93B0 ~ 0x93BD) */
41 context->addCompressedTextureFormat(
42 WebGLCompressedTextureASTC::kBlockSizeCompressASTC[i].CompressType);
43 /* GL_COMPRESSED_SRGB8_ALPHA8_ASTC(0x93D0 ~ 0x93DD) */
44 context->addCompressedTextureFormat(
45 WebGLCompressedTextureASTC::kBlockSizeCompressASTC[i].CompressType + 20);
Ken Russell (switch to Gerrit) 2015/08/18 00:05:02 This addition looks wrong -- I think it should be
46 }
47 }
48
49 WebGLCompressedTextureASTC::~WebGLCompressedTextureASTC()
50 {
51 }
52
53 WebGLExtensionName WebGLCompressedTextureASTC::name() const
54 {
55 return WebGLCompressedTextureASTCName;
56 }
57
58 PassRefPtrWillBeRawPtr<WebGLCompressedTextureASTC> WebGLCompressedTextureASTC::c reate(WebGLRenderingContextBase* context)
59 {
60 return adoptRefWillBeNoop(new WebGLCompressedTextureASTC(context));
61 }
62
63 bool WebGLCompressedTextureASTC::supported(WebGLRenderingContextBase* context)
64 {
65 Extensions3DUtil* extensionsUtil = context->extensionsUtil();
66 return extensionsUtil->supportsExtension("GL_KHR_texture_compression_astc_ld r");
67 }
68
69 const char* WebGLCompressedTextureASTC::extensionName()
70 {
71 return "WEBGL_compressed_texture_astc_ldr";
Ken Russell (switch to Gerrit) 2015/08/18 00:05:02 At this point this should be "WEBGL_compressed_tex
72 }
73
74 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698