Backed out changeset 1e5750541f2d (bug 1604622) for Mochitest failures in dom/canvas/test/webgl-conf/generated/test_conformance__extensions__oes-texture-float.html

This commit is contained in:
Dorel Luca 2019-12-27 01:19:45 +02:00
Родитель fe7bd3c390
Коммит 04f0022c40
2 изменённых файлов: 48 добавлений и 68 удалений

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

@ -22,9 +22,8 @@ WebGLExtensionTextureFloat::WebGLExtensionTextureFloat(WebGLContext* webgl)
webgl::DriverUnpackInfo dui; webgl::DriverUnpackInfo dui;
const GLint* swizzle = nullptr; const GLint* swizzle = nullptr;
const auto fnAdd = [&](webgl::EffectiveFormat effFormat) { const auto fnAdd = [&fua, &pi, &dui,
MOZ_ASSERT_IF(swizzle, gl->IsSupported(gl::GLFeature::texture_swizzle)); &swizzle](webgl::EffectiveFormat effFormat) {
auto usage = fua->EditUsage(effFormat); auto usage = fua->EditUsage(effFormat);
usage->textureSwizzleRGBA = swizzle; usage->textureSwizzleRGBA = swizzle;
fua->AddTexUnpack(usage, pi, dui); fua->AddTexUnpack(usage, pi, dui);
@ -32,18 +31,19 @@ WebGLExtensionTextureFloat::WebGLExtensionTextureFloat(WebGLContext* webgl)
fua->AllowUnsizedTexFormat(pi, usage); fua->AllowUnsizedTexFormat(pi, usage);
}; };
bool useSizedFormats = true; const bool needsSwizzle = gl->IsCoreProfile();
const bool hasSizedLegacyFormats = gl->IsCompatibilityProfile(); MOZ_ASSERT_IF(needsSwizzle, gl->IsSupported(gl::GLFeature::texture_swizzle));
if (gl->IsGLES() && gl->Version() < 300) {
useSizedFormats = false; const bool needsSizedFormat = !gl->IsGLES();
}
//////////////// ////////////////
pi = {LOCAL_GL_RGBA, LOCAL_GL_FLOAT}; pi = {LOCAL_GL_RGBA, LOCAL_GL_FLOAT};
dui = {pi.format, pi.format, pi.type}; dui = {pi.format, pi.format, pi.type};
swizzle = nullptr; swizzle = nullptr;
if (useSizedFormats) { if (needsSizedFormat ||
gl->IsExtensionSupported(
gl::GLContext::CHROMIUM_color_buffer_float_rgba)) {
dui.internalFormat = LOCAL_GL_RGBA32F; dui.internalFormat = LOCAL_GL_RGBA32F;
} }
fnAdd(webgl::EffectiveFormat::RGBA32F); fnAdd(webgl::EffectiveFormat::RGBA32F);
@ -53,7 +53,7 @@ WebGLExtensionTextureFloat::WebGLExtensionTextureFloat(WebGLContext* webgl)
pi = {LOCAL_GL_RGB, LOCAL_GL_FLOAT}; pi = {LOCAL_GL_RGB, LOCAL_GL_FLOAT};
dui = {pi.format, pi.format, pi.type}; dui = {pi.format, pi.format, pi.type};
swizzle = nullptr; swizzle = nullptr;
if (useSizedFormats) { if (needsSizedFormat) {
dui.internalFormat = LOCAL_GL_RGB32F; dui.internalFormat = LOCAL_GL_RGB32F;
} }
fnAdd(webgl::EffectiveFormat::RGB32F); fnAdd(webgl::EffectiveFormat::RGB32F);
@ -63,14 +63,11 @@ WebGLExtensionTextureFloat::WebGLExtensionTextureFloat(WebGLContext* webgl)
pi = {LOCAL_GL_LUMINANCE, LOCAL_GL_FLOAT}; pi = {LOCAL_GL_LUMINANCE, LOCAL_GL_FLOAT};
dui = {pi.format, pi.format, pi.type}; dui = {pi.format, pi.format, pi.type};
swizzle = nullptr; swizzle = nullptr;
if (useSizedFormats) { if (needsSwizzle) {
if (hasSizedLegacyFormats) { dui = {LOCAL_GL_R32F, LOCAL_GL_RED, LOCAL_GL_FLOAT};
dui.internalFormat = LOCAL_GL_LUMINANCE32F_ARB; swizzle = webgl::FormatUsageInfo::kLuminanceSwizzleRGBA;
} else { } else if (needsSizedFormat) {
dui.internalFormat = LOCAL_GL_R32F; dui.internalFormat = LOCAL_GL_LUMINANCE32F_ARB;
dui.unpackFormat = LOCAL_GL_RED;
swizzle = webgl::FormatUsageInfo::kLuminanceSwizzleRGBA;
}
} }
fnAdd(webgl::EffectiveFormat::Luminance32F); fnAdd(webgl::EffectiveFormat::Luminance32F);
@ -79,14 +76,11 @@ WebGLExtensionTextureFloat::WebGLExtensionTextureFloat(WebGLContext* webgl)
pi = {LOCAL_GL_ALPHA, LOCAL_GL_FLOAT}; pi = {LOCAL_GL_ALPHA, LOCAL_GL_FLOAT};
dui = {pi.format, pi.format, pi.type}; dui = {pi.format, pi.format, pi.type};
swizzle = nullptr; swizzle = nullptr;
if (useSizedFormats) { if (needsSwizzle) {
if (hasSizedLegacyFormats) { dui = {LOCAL_GL_R32F, LOCAL_GL_RED, LOCAL_GL_FLOAT};
dui.internalFormat = LOCAL_GL_ALPHA32F_ARB; swizzle = webgl::FormatUsageInfo::kAlphaSwizzleRGBA;
} else { } else if (needsSizedFormat) {
dui.internalFormat = LOCAL_GL_R32F; dui.internalFormat = LOCAL_GL_ALPHA32F_ARB;
dui.unpackFormat = LOCAL_GL_RED;
swizzle = webgl::FormatUsageInfo::kAlphaSwizzleRGBA;
}
} }
fnAdd(webgl::EffectiveFormat::Alpha32F); fnAdd(webgl::EffectiveFormat::Alpha32F);
@ -95,14 +89,11 @@ WebGLExtensionTextureFloat::WebGLExtensionTextureFloat(WebGLContext* webgl)
pi = {LOCAL_GL_LUMINANCE_ALPHA, LOCAL_GL_FLOAT}; pi = {LOCAL_GL_LUMINANCE_ALPHA, LOCAL_GL_FLOAT};
dui = {pi.format, pi.format, pi.type}; dui = {pi.format, pi.format, pi.type};
swizzle = nullptr; swizzle = nullptr;
if (useSizedFormats) { if (needsSwizzle) {
if (hasSizedLegacyFormats) { dui = {LOCAL_GL_RG32F, LOCAL_GL_RG, LOCAL_GL_FLOAT};
dui.internalFormat = LOCAL_GL_LUMINANCE_ALPHA32F_ARB; swizzle = webgl::FormatUsageInfo::kLumAlphaSwizzleRGBA;
} else { } else if (needsSizedFormat) {
dui.internalFormat = LOCAL_GL_RG32F; dui.internalFormat = LOCAL_GL_LUMINANCE_ALPHA32F_ARB;
dui.unpackFormat = LOCAL_GL_RG;
swizzle = webgl::FormatUsageInfo::kLumAlphaSwizzleRGBA;
}
} }
fnAdd(webgl::EffectiveFormat::Luminance32FAlpha32F); fnAdd(webgl::EffectiveFormat::Luminance32FAlpha32F);
} }

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

@ -21,9 +21,8 @@ WebGLExtensionTextureHalfFloat::WebGLExtensionTextureHalfFloat(
webgl::DriverUnpackInfo dui; webgl::DriverUnpackInfo dui;
const GLint* swizzle = nullptr; const GLint* swizzle = nullptr;
const auto fnAdd = [&](webgl::EffectiveFormat effFormat) { const auto fnAdd = [&fua, &pi, &dui,
MOZ_ASSERT_IF(swizzle, gl->IsSupported(gl::GLFeature::texture_swizzle)); &swizzle](webgl::EffectiveFormat effFormat) {
auto usage = fua->EditUsage(effFormat); auto usage = fua->EditUsage(effFormat);
usage->textureSwizzleRGBA = swizzle; usage->textureSwizzleRGBA = swizzle;
fua->AddTexUnpack(usage, pi, dui); fua->AddTexUnpack(usage, pi, dui);
@ -31,11 +30,10 @@ WebGLExtensionTextureHalfFloat::WebGLExtensionTextureHalfFloat(
fua->AllowUnsizedTexFormat(pi, usage); fua->AllowUnsizedTexFormat(pi, usage);
}; };
bool useSizedFormats = true; const bool needsSwizzle = gl->IsCoreProfile();
const bool hasSizedLegacyFormats = gl->IsCompatibilityProfile(); MOZ_ASSERT_IF(needsSwizzle, gl->IsSupported(gl::GLFeature::texture_swizzle));
if (gl->IsGLES() && gl->Version() < 300) {
useSizedFormats = false; const bool needsSizedFormat = !gl->IsGLES();
}
GLenum driverUnpackType = LOCAL_GL_HALF_FLOAT; GLenum driverUnpackType = LOCAL_GL_HALF_FLOAT;
if (!gl->IsSupported(gl::GLFeature::texture_half_float)) { if (!gl->IsSupported(gl::GLFeature::texture_half_float)) {
@ -48,7 +46,7 @@ WebGLExtensionTextureHalfFloat::WebGLExtensionTextureHalfFloat(
pi = {LOCAL_GL_RGBA, LOCAL_GL_HALF_FLOAT_OES}; pi = {LOCAL_GL_RGBA, LOCAL_GL_HALF_FLOAT_OES};
dui = {pi.format, pi.format, driverUnpackType}; dui = {pi.format, pi.format, driverUnpackType};
swizzle = nullptr; swizzle = nullptr;
if (useSizedFormats) { if (needsSizedFormat) {
dui.internalFormat = LOCAL_GL_RGBA16F; dui.internalFormat = LOCAL_GL_RGBA16F;
} }
fnAdd(webgl::EffectiveFormat::RGBA16F); fnAdd(webgl::EffectiveFormat::RGBA16F);
@ -58,7 +56,7 @@ WebGLExtensionTextureHalfFloat::WebGLExtensionTextureHalfFloat(
pi = {LOCAL_GL_RGB, LOCAL_GL_HALF_FLOAT_OES}; pi = {LOCAL_GL_RGB, LOCAL_GL_HALF_FLOAT_OES};
dui = {pi.format, pi.format, driverUnpackType}; dui = {pi.format, pi.format, driverUnpackType};
swizzle = nullptr; swizzle = nullptr;
if (useSizedFormats) { if (needsSizedFormat) {
dui.internalFormat = LOCAL_GL_RGB16F; dui.internalFormat = LOCAL_GL_RGB16F;
} }
fnAdd(webgl::EffectiveFormat::RGB16F); fnAdd(webgl::EffectiveFormat::RGB16F);
@ -68,14 +66,11 @@ WebGLExtensionTextureHalfFloat::WebGLExtensionTextureHalfFloat(
pi = {LOCAL_GL_LUMINANCE, LOCAL_GL_HALF_FLOAT_OES}; pi = {LOCAL_GL_LUMINANCE, LOCAL_GL_HALF_FLOAT_OES};
dui = {pi.format, pi.format, driverUnpackType}; dui = {pi.format, pi.format, driverUnpackType};
swizzle = nullptr; swizzle = nullptr;
if (useSizedFormats) { if (needsSwizzle) {
if (hasSizedLegacyFormats) { dui = {LOCAL_GL_R16F, LOCAL_GL_RED, driverUnpackType};
dui.internalFormat = LOCAL_GL_LUMINANCE16F_ARB; swizzle = webgl::FormatUsageInfo::kLuminanceSwizzleRGBA;
} else { } else if (needsSizedFormat) {
dui.internalFormat = LOCAL_GL_R16F; dui.internalFormat = LOCAL_GL_LUMINANCE16F_ARB;
dui.unpackFormat = LOCAL_GL_RED;
swizzle = webgl::FormatUsageInfo::kLuminanceSwizzleRGBA;
}
} }
fnAdd(webgl::EffectiveFormat::Luminance16F); fnAdd(webgl::EffectiveFormat::Luminance16F);
@ -84,14 +79,11 @@ WebGLExtensionTextureHalfFloat::WebGLExtensionTextureHalfFloat(
pi = {LOCAL_GL_ALPHA, LOCAL_GL_HALF_FLOAT_OES}; pi = {LOCAL_GL_ALPHA, LOCAL_GL_HALF_FLOAT_OES};
dui = {pi.format, pi.format, driverUnpackType}; dui = {pi.format, pi.format, driverUnpackType};
swizzle = nullptr; swizzle = nullptr;
if (useSizedFormats) { if (needsSwizzle) {
if (hasSizedLegacyFormats) { dui = {LOCAL_GL_R16F, LOCAL_GL_RED, driverUnpackType};
dui.internalFormat = LOCAL_GL_ALPHA16F_ARB; swizzle = webgl::FormatUsageInfo::kAlphaSwizzleRGBA;
} else { } else if (needsSizedFormat) {
dui.internalFormat = LOCAL_GL_R16F; dui.internalFormat = LOCAL_GL_ALPHA16F_ARB;
dui.unpackFormat = LOCAL_GL_RED;
swizzle = webgl::FormatUsageInfo::kAlphaSwizzleRGBA;
}
} }
fnAdd(webgl::EffectiveFormat::Alpha16F); fnAdd(webgl::EffectiveFormat::Alpha16F);
@ -100,14 +92,11 @@ WebGLExtensionTextureHalfFloat::WebGLExtensionTextureHalfFloat(
pi = {LOCAL_GL_LUMINANCE_ALPHA, LOCAL_GL_HALF_FLOAT_OES}; pi = {LOCAL_GL_LUMINANCE_ALPHA, LOCAL_GL_HALF_FLOAT_OES};
dui = {pi.format, pi.format, driverUnpackType}; dui = {pi.format, pi.format, driverUnpackType};
swizzle = nullptr; swizzle = nullptr;
if (useSizedFormats) { if (needsSwizzle) {
if (hasSizedLegacyFormats) { dui = {LOCAL_GL_RG16F, LOCAL_GL_RG, driverUnpackType};
dui.internalFormat = LOCAL_GL_LUMINANCE_ALPHA16F_ARB; swizzle = webgl::FormatUsageInfo::kLumAlphaSwizzleRGBA;
} else { } else if (needsSizedFormat) {
dui.internalFormat = LOCAL_GL_RG16F; dui.internalFormat = LOCAL_GL_LUMINANCE_ALPHA16F_ARB;
dui.unpackFormat = LOCAL_GL_RG;
swizzle = webgl::FormatUsageInfo::kLumAlphaSwizzleRGBA;
}
} }
fnAdd(webgl::EffectiveFormat::Luminance16FAlpha16F); fnAdd(webgl::EffectiveFormat::Luminance16FAlpha16F);
} }