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: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/OutputHLSL.cpp b/src/compiler/translator/OutputHLSL.cpp
index 7e8302f..2c4ad33 100644
--- a/src/compiler/translator/OutputHLSL.cpp
+++ b/src/compiler/translator/OutputHLSL.cpp
@@ -904,6 +904,17 @@
out << " t.x = (u * 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) &&
textureFunction->method != TextureFunction::FETCH)