Bug 1616457 - Fix failures in conformance/extensions/webgl-draw-buffers. r=lsalzman

We must not check frag output type agreement if colorMask(0,0,0,0).
We must allow drawing with no frag outputs, leaving color values
unchanged. (evidently this is used enough that we spec'd it this way?)

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jeff Gilbert 2020-02-19 20:47:30 +00:00
Родитель 5ef32871a5
Коммит b3e7d58623
6 изменённых файлов: 27 добавлений и 24 удалений

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

@ -1203,7 +1203,7 @@ class WebGLContext : public VRefCounted, public SupportsWeakPtr<WebGLContext> {
GLuint mStencilValueMaskBack = 0;
GLuint mStencilWriteMaskFront = 0;
GLuint mStencilWriteMaskBack = 0;
uint8_t mColorWriteMask = 0; // bitmask
uint8_t mColorWriteMask = 0xf; // bitmask
realGLboolean mDepthWriteMask = 0;
GLfloat mColorClearValue[4];
GLint mStencilClearValue = 0;

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

@ -443,18 +443,6 @@ const webgl::CachedDrawFetchLimits* ValidateDraw(WebGLContext* const webgl,
if (fb) {
const auto& info = *fb->GetCompletenessInfo();
fbZLayerCount = info.zLayerCount;
for (const auto& attach : fb->ColorDrawBuffers()) {
const auto i =
uint8_t(attach->mAttachmentPoint - LOCAL_GL_COLOR_ATTACHMENT0);
const auto& imageInfo = attach->GetImageInfo();
if (!imageInfo) continue;
const auto& dstBaseType = imageInfo->mFormat->format->baseType;
if (!fnValidateFragOutputType(i, dstBaseType)) return nullptr;
}
} else {
if (!fnValidateFragOutputType(0, webgl::TextureBaseType::Float))
return nullptr;
}
if (fbZLayerCount != linkInfo->zLayerCount) {
@ -463,6 +451,22 @@ const webgl::CachedDrawFetchLimits* ValidateDraw(WebGLContext* const webgl,
uint32_t{linkInfo->zLayerCount}, uint32_t{fbZLayerCount});
return nullptr;
}
if (webgl->mColorWriteMask) {
if (fb) {
for (const auto& attach : fb->ColorDrawBuffers()) {
const auto i =
uint8_t(attach->mAttachmentPoint - LOCAL_GL_COLOR_ATTACHMENT0);
const auto& imageInfo = attach->GetImageInfo();
if (!imageInfo) continue;
const auto& dstBaseType = imageInfo->mFormat->format->baseType;
if (!fnValidateFragOutputType(i, dstBaseType)) return nullptr;
}
} else {
if (!fnValidateFragOutputType(0, webgl::TextureBaseType::Float))
return nullptr;
}
}
}
// -

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

@ -285,7 +285,6 @@ bool WebGLContext::InitAndValidateGL(FailureReason* const out_failReason) {
// These are the default values, see 6.2 State tables in the
// OpenGL ES 2.0.25 spec.
mColorWriteMask = 0x0f;
mDriverColorMask = mColorWriteMask;
mColorClearValue[0] = 0.f;
mColorClearValue[1] = 0.f;

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

@ -386,6 +386,14 @@ RefPtr<const webgl::LinkedProgramInfo> QueryProgramInfo(WebGLProgram* prog,
// shader, FragData[1] will be present. FragData[0] is valid for non-MRT
// shaders.
drawBuffers = webgl->GLMaxDrawBuffers();
} else if (translatedSource.find("(gl_FragColor") == std::string::npos &&
translatedSource.find("(webgl_FragColor") ==
std::string::npos &&
translatedSource.find("(gl_FragData") == std::string::npos &&
translatedSource.find("(webgl_FragData") ==
std::string::npos) {
// We have to support no-color-output shaders?
drawBuffers = 0;
}
for (uint32_t i = 0; i < drawBuffers; ++i) {

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

@ -6921,8 +6921,8 @@ subsuite = webgl2-core
fail-if = 1
[generated/test_2_conformance2__textures__misc__tex-unpack-params.html]
subsuite = webgl2-core
fail-if = (os == 'mac')
skip-if = (os == 'mac' && debug)
fail-if = (os == 'mac')
[generated/test_2_conformance2__textures__misc__texel-fetch-undefined.html]
subsuite = webgl2-core
[generated/test_2_conformance2__textures__misc__texture-npot.html]
@ -9004,8 +9004,8 @@ subsuite = webgl2-core
subsuite = webgl2-core
[generated/test_2_conformance__textures__misc__texture-corner-case-videos.html]
subsuite = webgl2-core
fail-if = (os == 'linux' && os_version == '18.04')
skip-if = (os == 'android')
fail-if = (os == 'linux' && os_version == '18.04')
[generated/test_2_conformance__textures__misc__texture-cube-as-fbo-attachment.html]
subsuite = webgl2-core
[generated/test_2_conformance__textures__misc__texture-draw-with-2d-and-cube.html]
@ -10926,8 +10926,6 @@ subsuite = webgl1-core
subsuite = webgl1-core
[generated/test_conformance__extensions__webgl-draw-buffers.html]
subsuite = webgl1-core
fail-if = (os != 'android')
skip-if = (os == 'linux')
[generated/test_conformance__extensions__webgl-multi-draw.html]
subsuite = webgl1-core
[generated/test_conformance__glsl__bugs__angle-ambiguous-function-call.html]

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

@ -263,12 +263,6 @@ fail-if = 1 # https://github.com/KhronosGroup/WebGL/pull/2908
# Asserts on linux debug. Crashes on Android.
skip-if = (os == 'linux') || (os == 'android')
[generated/test_conformance__extensions__webgl-draw-buffers.html]
# Crashes
skip-if = (os == 'linux')
# New validation that shaders with no outputs cannot have non-null draw buffers attached.
fail-if = (os != 'android')
[generated/test_conformance__glsl__constructors__glsl-construct-bvec3.html]
# Crashes from libglsl.so
# application crashed [@ jemalloc_crash] on Android