Commit 155610b9 by Jamie Madill

Fix off-by-one max mip levels in getSRV.

We would try to create SRVs with zero mip levels, when we should be asking for a single mip level. This would happen when the base level is equal to the max level. See the dEQP test: texture.mipmap.2d.max_level.linear_nearest Change-Id: I3f231f159dbdecbf7c2e61b373bfc3545875f36e Reviewed-on: https://chromium-review.googlesource.com/240762Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarBrandon Jones <bajones@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 3c9db122
...@@ -175,7 +175,7 @@ gl::Error TextureStorage11::getSRV(const gl::SamplerState &samplerState, ID3D11S ...@@ -175,7 +175,7 @@ gl::Error TextureStorage11::getSRV(const gl::SamplerState &samplerState, ID3D11S
{ {
bool swizzleRequired = samplerState.swizzleRequired(); bool swizzleRequired = samplerState.swizzleRequired();
bool mipmapping = gl::IsMipmapFiltered(samplerState); bool mipmapping = gl::IsMipmapFiltered(samplerState);
unsigned int mipLevels = mipmapping ? (samplerState.maxLevel - samplerState.baseLevel) : 1; unsigned int mipLevels = mipmapping ? (samplerState.maxLevel - samplerState.baseLevel + 1) : 1;
// Make sure there's 'mipLevels' mipmap levels below the base level (offset by the top level, which corresponds to GL level 0) // Make sure there's 'mipLevels' mipmap levels below the base level (offset by the top level, which corresponds to GL level 0)
mipLevels = std::min(mipLevels, mMipLevels - mTopLevel - samplerState.baseLevel); mipLevels = std::min(mipLevels, mMipLevels - mTopLevel - samplerState.baseLevel);
......
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