Bug 1545890 - Depth textures are filterable like RED textures. r=lsalzman

Differential Revision: https://phabricator.services.mozilla.com/D28267

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jeff Gilbert 2019-04-22 20:57:57 +00:00
Родитель a938a1ad71
Коммит bfe578d84d
2 изменённых файлов: 16 добавлений и 14 удалений

Просмотреть файл

@ -11,35 +11,33 @@
namespace mozilla {
WebGLExtensionDepthTexture::WebGLExtensionDepthTexture(WebGLContext* webgl)
WebGLExtensionDepthTexture::WebGLExtensionDepthTexture(
WebGLContext* const webgl)
: WebGLExtensionBase(webgl) {
auto& fua = webgl->mFormatUsage;
const auto fnAdd = [&fua](webgl::EffectiveFormat effFormat,
GLenum unpackFormat, GLenum unpackType) {
auto usage = fua->EditUsage(effFormat);
usage->isFilterable = true;
usage->SetRenderable();
MOZ_ASSERT(usage->isFilterable);
MOZ_ASSERT(usage->IsRenderable());
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);
}
WebGLExtensionDepthTexture::~WebGLExtensionDepthTexture() {}
WebGLExtensionDepthTexture::~WebGLExtensionDepthTexture() = default;
bool WebGLExtensionDepthTexture::IsSupported(const WebGLContext* const webgl) {
if (webgl->IsWebGL2()) return false;

Просмотреть файл

@ -818,11 +818,12 @@ UniquePtr<FormatUsageAuthority> FormatUsageAuthority::CreateForWebGL1(
fnSet(EffectiveFormat::Luminance8, false, true);
fnSet(EffectiveFormat::Alpha8, false, true);
fnSet(EffectiveFormat::DEPTH_COMPONENT16, true, false);
fnSet(EffectiveFormat::DEPTH_COMPONENT16, true, true);
fnSet(EffectiveFormat::DEPTH_COMPONENT24, true, true); // Requires WEBGL_depth_texture.
fnSet(EffectiveFormat::STENCIL_INDEX8, true, false);
// Added in WebGL 1.0 spec:
fnSet(EffectiveFormat::DEPTH24_STENCIL8, true, false);
fnSet(EffectiveFormat::DEPTH24_STENCIL8, true, true);
////////////////////////////////////
// RB formats
@ -1048,11 +1049,14 @@ UniquePtr<FormatUsageAuthority> FormatUsageAuthority::CreateForWebGL2(
fnAllowES3TexFormat(FOO(RGBA32UI), true, false);
// GLES 3.0.4, p133, table 3.14
fnAllowES3TexFormat(FOO(DEPTH_COMPONENT16), true, false);
fnAllowES3TexFormat(FOO(DEPTH_COMPONENT24), true, false);
fnAllowES3TexFormat(FOO(DEPTH_COMPONENT32F), true, false);
fnAllowES3TexFormat(FOO(DEPTH24_STENCIL8), true, false);
fnAllowES3TexFormat(FOO(DEPTH32F_STENCIL8), true, false);
// p151:
// Depth textures and the depth components of depth/stencil textures can be
// treated as `RED` textures during texture filtering and application.
fnAllowES3TexFormat(FOO(DEPTH_COMPONENT16), true, true);
fnAllowES3TexFormat(FOO(DEPTH_COMPONENT24), true, true);
fnAllowES3TexFormat(FOO(DEPTH_COMPONENT32F), true, true);
fnAllowES3TexFormat(FOO(DEPTH24_STENCIL8), true, true);
fnAllowES3TexFormat(FOO(DEPTH32F_STENCIL8), true, true);
#undef FOO