Line data Source code
1 : /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #include "WebGLExtensions.h"
7 :
8 : #include "GLContext.h"
9 : #include "mozilla/dom/WebGLRenderingContextBinding.h"
10 : #include "WebGLContext.h"
11 :
12 : namespace mozilla {
13 :
14 0 : WebGLExtensionDepthTexture::WebGLExtensionDepthTexture(WebGLContext* webgl)
15 0 : : WebGLExtensionBase(webgl)
16 : {
17 0 : auto& fua = webgl->mFormatUsage;
18 :
19 : const auto fnAdd = [&fua](webgl::EffectiveFormat effFormat, GLenum unpackFormat,
20 0 : GLenum unpackType)
21 0 : {
22 0 : auto usage = fua->EditUsage(effFormat);
23 0 : usage->isFilterable = true;
24 0 : usage->SetRenderable();
25 :
26 0 : const webgl::PackingInfo pi = {unpackFormat, unpackType};
27 0 : const webgl::DriverUnpackInfo dui = {unpackFormat, unpackFormat, unpackType};
28 0 : fua->AddTexUnpack(usage, pi, dui);
29 :
30 0 : fua->AllowUnsizedTexFormat(pi, usage);
31 0 : };
32 :
33 : fnAdd(webgl::EffectiveFormat::DEPTH_COMPONENT16, LOCAL_GL_DEPTH_COMPONENT,
34 0 : LOCAL_GL_UNSIGNED_SHORT);
35 :
36 : fnAdd(webgl::EffectiveFormat::DEPTH_COMPONENT24, LOCAL_GL_DEPTH_COMPONENT,
37 0 : LOCAL_GL_UNSIGNED_INT);
38 :
39 : fnAdd(webgl::EffectiveFormat::DEPTH24_STENCIL8, LOCAL_GL_DEPTH_STENCIL,
40 0 : LOCAL_GL_UNSIGNED_INT_24_8);
41 0 : }
42 :
43 0 : WebGLExtensionDepthTexture::~WebGLExtensionDepthTexture()
44 : {
45 0 : }
46 :
47 0 : IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionDepthTexture, WEBGL_depth_texture)
48 :
49 : } // namespace mozilla
|