Commit 35adc099 by Nicolas Capens

Implement BASE/MAX_LEVEL, and MIN/MAX_LOD functionality.

BUG=angle:596 Change-Id: I0c818fdc1575be1ee16966acf7b6daa067a24282 Reviewed-on: https://chromium-review.googlesource.com/193236Tested-by: 's avatarNicolas Capens <nicolascapens@chromium.org> Reviewed-by: 's avatarShannon Woods <shannonwoods@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 8de68287
......@@ -409,8 +409,8 @@ ID3D11SamplerState *RenderStateCache::getSamplerState(const gl::SamplerState &sa
samplerDesc.BorderColor[1] = 0.0f;
samplerDesc.BorderColor[2] = 0.0f;
samplerDesc.BorderColor[3] = 0.0f;
samplerDesc.MinLOD = -FLT_MAX;
samplerDesc.MaxLOD = +FLT_MAX;
samplerDesc.MinLOD = samplerState.minLod;
samplerDesc.MaxLOD = samplerState.maxLod;
ID3D11SamplerState *dx11SamplerState = NULL;
HRESULT result = mDevice->CreateSamplerState(&samplerDesc, &dx11SamplerState);
......
......@@ -195,14 +195,17 @@ ID3D11ShaderResourceView *TextureStorage11::getSRV(const gl::SamplerState &sampl
{
bool swizzleRequired = samplerState.swizzleRequired();
bool mipmapping = gl::IsMipmapFiltered(samplerState);
int mipLevels = mipmapping ? (mMipLevels == 0 ? -1 : mMipLevels) : 1;
unsigned int mipLevels = mipmapping ? (samplerState.maxLevel - samplerState.baseLevel) : 1;
// 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);
if (swizzleRequired)
{
verifySwizzleExists(samplerState.swizzleRed, samplerState.swizzleGreen, samplerState.swizzleBlue, samplerState.swizzleAlpha);
}
SRVKey key(0, mipLevels, swizzleRequired);
SRVKey key(samplerState.baseLevel, mipLevels, swizzleRequired);
ID3D11ShaderResourceView *srv = srvCache.find(key);
if(srv)
......@@ -213,7 +216,7 @@ ID3D11ShaderResourceView *TextureStorage11::getSRV(const gl::SamplerState &sampl
DXGI_FORMAT format = (swizzleRequired ? mSwizzleShaderResourceFormat : mShaderResourceFormat);
ID3D11Resource *texture = swizzleRequired ? getSwizzleTexture() : getResource();
srv = createSRV(0, mipLevels, format, texture);
srv = createSRV(samplerState.baseLevel, mipLevels, format, texture);
return srvCache.add(key, srv);
}
......
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