2018-11-30 22:52:05 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-08-14 05:17:55 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "WebGLExtensions.h"
|
2014-11-14 07:03:50 +03:00
|
|
|
|
2016-07-22 09:25:41 +03:00
|
|
|
#include "GLContext.h"
|
2012-10-04 01:13:05 +04:00
|
|
|
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
2014-11-14 07:03:50 +03:00
|
|
|
#include "WebGLContext.h"
|
2012-08-14 05:17:55 +04:00
|
|
|
|
2014-11-14 07:03:50 +03:00
|
|
|
namespace mozilla {
|
2012-08-14 05:17:55 +04:00
|
|
|
|
2014-11-14 07:03:50 +03:00
|
|
|
WebGLExtensionDepthTexture::WebGLExtensionDepthTexture(WebGLContext* webgl)
|
|
|
|
: WebGLExtensionBase(webgl) {
|
2015-11-25 07:15:29 +03:00
|
|
|
auto& fua = webgl->mFormatUsage;
|
|
|
|
|
|
|
|
const auto fnAdd = [&fua](webgl::EffectiveFormat effFormat,
|
|
|
|
GLenum unpackFormat, GLenum unpackType) {
|
|
|
|
auto usage = fua->EditUsage(effFormat);
|
2016-08-02 08:59:25 +03:00
|
|
|
usage->isFilterable = true;
|
2016-06-06 23:43:18 +03:00
|
|
|
usage->SetRenderable();
|
2015-11-25 07:15:29 +03:00
|
|
|
|
|
|
|
const webgl::PackingInfo pi = {unpackFormat, unpackType};
|
|
|
|
const webgl::DriverUnpackInfo dui = {unpackFormat, unpackFormat,
|
|
|
|
unpackType};
|
|
|
|
fua->AddTexUnpack(usage, pi, dui);
|
|
|
|
|
|
|
|
fua->AllowUnsizedTexFormat(pi, usage);
|
|
|
|
};
|
|
|
|
|
|
|
|
fnAdd(webgl::EffectiveFormat::DEPTH_COMPONENT16, LOCAL_GL_DEPTH_COMPONENT,
|
|
|
|
LOCAL_GL_UNSIGNED_SHORT);
|
|
|
|
|
|
|
|
fnAdd(webgl::EffectiveFormat::DEPTH_COMPONENT24, LOCAL_GL_DEPTH_COMPONENT,
|
|
|
|
LOCAL_GL_UNSIGNED_INT);
|
|
|
|
|
|
|
|
fnAdd(webgl::EffectiveFormat::DEPTH24_STENCIL8, LOCAL_GL_DEPTH_STENCIL,
|
|
|
|
LOCAL_GL_UNSIGNED_INT_24_8);
|
2012-08-14 05:17:55 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
WebGLExtensionDepthTexture::~WebGLExtensionDepthTexture() {}
|
|
|
|
|
2015-06-01 17:17:00 +03:00
|
|
|
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionDepthTexture, WEBGL_depth_texture)
|
2014-11-14 07:03:50 +03:00
|
|
|
|
|
|
|
} // namespace mozilla
|