Determine D3D texture storage size with correct base level

The size of the texture storage is now determined by extrapolating
the level zero texture dimensions from the base level dimensions.
This fixes crashing when images for levels below the base level are
not defined, and also fixes texture storage dimensions being
calculated wrong in case the levels outside the used level range have
dimensions that are inconsistent with the dimensions inside the used
level range.

Checking texture level completeness in TextureD3D is now done based on
the dimensions of the base level, and levels that are outside the base
level to max level range are not taken into account. Textures are
marked incomplete in case their base level is greater than their max
level.

Changing the base level can also affect the size of the storage
required for the texture. Old storage is now discarded when the base
level is changed and the new base level calls for different storage
dimensions.

Code in TextureD3D is refactored so that "base level" actually means
the base level of the texture specified through the GLES API, and
"level zero" is used where TextureD3D would sometimes previously use
"base level".

Changing either the base level or max level can also affect texture
completeness, so invalidate the cached completeness in Texture if
they are changed.

Some of the added tests are still failing on Intel and NVIDIA OpenGL
drivers because of driver bugs. Tests also fail on OSX.

BUG=angleproject:596
TEST=angle_end2end_tests,
     dEQP-GLES3.functional.texture.* (no regressions),
     dEQP-GLES3.functional.shaders.texture_functions.* (no regressions),
     dEQP-GLES3.functional.state_query.texture.* (no regressions)

Change-Id: Icd73d6e29f84a341ed5ff36d5ec5cb2f469cb4e8
Reviewed-on: https://chromium-review.googlesource.com/333352
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/tests/test_utils/ANGLETest.cpp b/src/tests/test_utils/ANGLETest.cpp
index 15135a5..4115b4d 100644
--- a/src/tests/test_utils/ANGLETest.cpp
+++ b/src/tests/test_utils/ANGLETest.cpp
@@ -15,6 +15,12 @@
 namespace angle
 {
 
+const GLColor GLColor::red   = GLColor(255u, 0u, 0u, 255u);
+const GLColor GLColor::green = GLColor(0u, 255u, 0u, 255u);
+const GLColor GLColor::blue  = GLColor(0u, 0u, 255u, 255u);
+const GLColor GLColor::cyan  = GLColor(0u, 255u, 255u, 255u);
+const GLColor GLColor::black = GLColor(0u, 0u, 0u, 255u);
+
 namespace
 {
 float ColorNorm(GLubyte channelValue)