Bug 1692617 - Rendering into a miplevel while sampling from a disjoint set of miplevels should be allowed for immutable textures. r=lsalzman

For example, when sampling from miplevel N-1 to render into another miplevel
N.

Differential Revision: https://phabricator.services.mozilla.com/D105083
This commit is contained in:
Jeff Gilbert 2021-02-13 09:06:09 +00:00
Родитель c1876ed76f
Коммит bfa84e6b27
2 изменённых файлов: 13 добавлений и 7 удалений

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

@ -101,18 +101,23 @@ bool WebGLFBAttachPoint::IsComplete(WebGLContext* webgl,
const auto& tex = Texture();
if (tex) {
// ES 3.0 spec, pg 213 has giant blocks of text that bake down to requiring
// that attached tex images are within the valid mip-levels of the texture.
// While it draws distinction to only test non-immutable textures, that's
// because immutable textures are *always* texture-complete. We need to
// check immutable textures though, because checking completeness is also
// when we zero invalidated/no-data tex images.
// that attached *non-immutable* tex images are within the valid mip-levels
// of the texture. We still need to check immutable textures though, because
// checking completeness is also when we zero invalidated/no-data tex
// images.
const auto attachedMipLevel = MipLevel();
const bool withinValidMipLevels = [&]() {
const bool ensureInit = false;
const auto texCompleteness = tex->CalcCompletenessInfo(ensureInit);
if (!texCompleteness) // OOM
return false;
if (!texCompleteness) return false; // OOM
if (tex->Immutable()) {
// Immutable textures can attach a level that's not valid for sampling.
// It still has to exist though!
return attachedMipLevel < tex->ImmutableLevelCount();
}
if (!texCompleteness->levels) return false;
const auto baseLevel = tex->BaseMipmapLevel();

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

@ -149,6 +149,7 @@ class WebGLTexture final : public WebGLContextBoundObject,
// -
const auto& Immutable() const { return mImmutable; }
const auto& ImmutableLevelCount() const { return mImmutableLevelCount; }
const auto& BaseMipmapLevel() const { return mBaseMipmapLevel; }
const auto& FaceCount() const { return mFaceCount; }