Commit 8d9f35f1 by Jamie Madill

Re-land "D3D11: Fix Integer Texture Cube mip mapping."

We were missing both the correct SRV parameter, as well as the full computation of the mip level in the HLSL. Re-land makes the mip computation only happen with implicit sampling. Before it would confuse the LOD0 computation. BUG=angleproject:1208 TEST=dEQP-GLES3.functional.texture.* Change-Id: I4b579033afe5cd1aca1f2d017e48a74c7fc324cc Reviewed-on: https://chromium-review.googlesource.com/314330 Tryjob-Request: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 4029ad42
...@@ -904,6 +904,17 @@ void OutputHLSL::header(const BuiltInFunctionEmulator *builtInFunctionEmulator) ...@@ -904,6 +904,17 @@ void OutputHLSL::header(const BuiltInFunctionEmulator *builtInFunctionEmulator)
out << " t.x = (u * 0.5f / m) + 0.5f;\n"; out << " t.x = (u * 0.5f / m) + 0.5f;\n";
out << " t.y = (v * 0.5f / m) + 0.5f;\n"; out << " t.y = (v * 0.5f / m) + 0.5f;\n";
// Mip level computation.
if (textureFunction->method == TextureFunction::IMPLICIT)
{
out << " float2 tSized = float2(t.x * width, t.y * height);\n"
" float2 dx = ddx(tSized);\n"
" float2 dy = ddy(tSized);\n"
" float lod = 0.5f * log2(max(dot(dx, dx), dot(dy, dy)));\n"
" mip = uint(min(max(round(lod), 0), levels - 1));\n"
" x.GetDimensions(mip, width, height, layers, levels);\n";
}
} }
else if (IsIntegerSampler(textureFunction->sampler) && else if (IsIntegerSampler(textureFunction->sampler) &&
textureFunction->method != TextureFunction::FETCH) textureFunction->method != TextureFunction::FETCH)
......
...@@ -2225,7 +2225,7 @@ gl::Error TextureStorage11_Cube::createSRV(int baseLevel, int mipLevels, DXGI_FO ...@@ -2225,7 +2225,7 @@ gl::Error TextureStorage11_Cube::createSRV(int baseLevel, int mipLevels, DXGI_FO
{ {
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY; srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY;
srvDesc.Texture2DArray.MostDetailedMip = mTopLevel + baseLevel; srvDesc.Texture2DArray.MostDetailedMip = mTopLevel + baseLevel;
srvDesc.Texture2DArray.MipLevels = 1; srvDesc.Texture2DArray.MipLevels = mipLevels;
srvDesc.Texture2DArray.FirstArraySlice = 0; srvDesc.Texture2DArray.FirstArraySlice = 0;
srvDesc.Texture2DArray.ArraySize = CUBE_FACE_COUNT; srvDesc.Texture2DArray.ArraySize = CUBE_FACE_COUNT;
} }
......
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