Texture size fix

I looked into the texture size issue and I removed the " + Int(1)"
used on the LOD and replaced it with "baseLevel", which I think makes
more sense. Without the "+1", some tests using baseLevel==1 fail, but
all tests pass when I use "+baseLevel". I'm not 100% sure why the
"+1" wasn't making tests that were using baseLevel==0 fail.

Note that, for now, the new Sampler::State "baseLevel" member will
always be 0, as the code to set it hasn't landed yet and will be in
another cl.

Change-Id: I8532bb7009abcc15e03416489f1d25027e336457
Reviewed-on: https://swiftshader-review.googlesource.com/5471
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/Shader/SamplerCore.cpp b/src/Shader/SamplerCore.cpp
index 55d6be4..264f35d 100644
--- a/src/Shader/SamplerCore.cpp
+++ b/src/Shader/SamplerCore.cpp
@@ -549,6 +549,17 @@
 		}
 	}
 
+	void SamplerCore::textureSize(Pointer<Byte> &textureMipmap, Vector4f &size, Float4 &lod)
+	{
+		for(int i = 0; i < 4; ++i)
+		{
+			Pointer<Byte> mipmap = textureMipmap + (As<Int>(Extract(lod, i)) + Int(state.baseLevel)) * sizeof(Mipmap);
+			size.x = Insert(size.x, As<Float>(Int(*Pointer<Short>(mipmap + OFFSET(Mipmap, width)))), i);
+			size.y = Insert(size.y, As<Float>(Int(*Pointer<Short>(mipmap + OFFSET(Mipmap, height)))), i);
+			size.z = Insert(size.z, As<Float>(Int(*Pointer<Short>(mipmap + OFFSET(Mipmap, depth)))), i);
+		}
+	}
+
 	void SamplerCore::border(Short4 &mask, Float4 &coordinates)
 	{
 		Int4 border = As<Int4>(CmpLT(Abs(coordinates - Float4(0.5f)), Float4(0.5f)));