Refactor IsMipmapFiltered to take the min filter directly.

This function is more useful if it takes just the min filter mode
instead of the entire sampler struct to read a single member.

Bug: b/167404532
Change-Id: Ie8c01c4095a615f06fe046fb175cdfb92fa54cbf
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2419111
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
This commit is contained in:
Geoff Lang 2020-09-18 11:36:50 -04:00 коммит произвёл Commit Bot
Родитель bda2205da1
Коммит f17cd288c1
5 изменённых файлов: 8 добавлений и 8 удалений

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

@ -276,8 +276,8 @@ bool AttachmentOverlapsWithTexture(const FramebufferAttachment &attachment,
GLuint attachmentLevel = static_cast<GLuint>(index.getLevelIndex());
GLuint textureBaseLevel = texture->getBaseLevel();
GLuint textureMaxLevel = textureBaseLevel;
if ((sampler && IsMipmapFiltered(sampler->getSamplerState())) ||
IsMipmapFiltered(texture->getSamplerState()))
if ((sampler && IsMipmapFiltered(sampler->getSamplerState().getMinFilter())) ||
IsMipmapFiltered(texture->getSamplerState().getMinFilter()))
{
textureMaxLevel = texture->getMipmapMaxLevel();
}

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

@ -49,9 +49,9 @@ InitState DetermineInitState(const Context *context, Buffer *unpackBuffer, const
}
} // namespace
bool IsMipmapFiltered(const SamplerState &samplerState)
bool IsMipmapFiltered(GLenum minFilterMode)
{
switch (samplerState.getMinFilter())
switch (minFilterMode)
{
case GL_NEAREST:
case GL_LINEAR:
@ -315,7 +315,7 @@ bool TextureState::computeSamplerCompleteness(const SamplerState &samplerState,
}
}
if (mType != TextureType::_2DMultisample && IsMipmapFiltered(samplerState))
if (mType != TextureType::_2DMultisample && IsMipmapFiltered(samplerState.getMinFilter()))
{
if (!npotSupport)
{

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

@ -50,7 +50,7 @@ class Texture;
constexpr GLuint kInitialMaxLevel = 1000;
bool IsMipmapFiltered(const SamplerState &samplerState);
bool IsMipmapFiltered(GLenum minFilterMode);
struct ImageDesc final
{

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

@ -223,7 +223,7 @@ angle::Result TextureStorage11::getSRVForSampler(const gl::Context *context,
// Make sure to add the level offset for our tiny compressed texture workaround
const GLuint effectiveBaseLevel = textureState.getEffectiveBaseLevel();
const bool swizzleRequired = textureState.swizzleRequired();
const bool mipmapping = gl::IsMipmapFiltered(sampler);
const bool mipmapping = gl::IsMipmapFiltered(sampler.getMinFilter());
unsigned int mipLevels =
mipmapping ? (textureState.getEffectiveMaxLevel() - effectiveBaseLevel + 1) : 1;

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

@ -2019,7 +2019,7 @@ void SamplerDesc::update(const gl::SamplerState &samplerState,
SetBitField(mCompareEnabled, compareEnable);
SetBitField(mCompareOp, compareOp);
if (!gl::IsMipmapFiltered(samplerState))
if (!gl::IsMipmapFiltered(samplerState.getMinFilter()))
{
// Per the Vulkan spec, GL_NEAREST and GL_LINEAR do not map directly to Vulkan, so
// they must be emulated (See "Mapping of OpenGL to Vulkan filter modes")