Commit f17cd288 by Geoff Lang Committed by Commit Bot

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/+/2419111Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent bda2205d
......@@ -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")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment