Fix framebuffer completeness tests with sRGB targets.

- Don't expect SRGB to become renderable in GL_EXT_sRGB extension
- Support GL_EXT_sRGB_write_control extension
- Support GL_NV_sRGB_formats extension
- Add missing GLES3 texture formats
- Remove modified cases from must-pass list

Bug: 18094134
Change-Id: I7587ff4a0e6106b74780dae193fa16970145a02e
diff --git a/android/cts/com.drawelements.deqp.gles3.xml b/android/cts/com.drawelements.deqp.gles3.xml
index 6af073a..43db172 100644
--- a/android/cts/com.drawelements.deqp.gles3.xml
+++ b/android/cts/com.drawelements.deqp.gles3.xml
@@ -27838,7 +27838,6 @@
 <Test name="rgba16f" />
 <Test name="depth24_stencil8" />
 <Test name="r11f_g11f_b10f" />
-<Test name="srgb_unsigned_byte" />
 <Test name="srgb_alpha_unsigned_byte" />
 <Test name="srgb8_alpha8" />
 <Test name="depth_component32f" />
diff --git a/android/cts/es30-mustpass-2014.2.9-2014-10-22.txt b/android/cts/es30-mustpass-2014.2.9-2014-10-24.txt
similarity index 99%
rename from android/cts/es30-mustpass-2014.2.9-2014-10-22.txt
rename to android/cts/es30-mustpass-2014.2.9-2014-10-24.txt
index 5ff1012..74173f3 100644
--- a/android/cts/es30-mustpass-2014.2.9-2014-10-22.txt
+++ b/android/cts/es30-mustpass-2014.2.9-2014-10-24.txt
@@ -25928,7 +25928,6 @@
 dEQP-GLES3.functional.fbo.completeness.renderable.renderbuffer.color0.rgba16f
 dEQP-GLES3.functional.fbo.completeness.renderable.renderbuffer.color0.depth24_stencil8
 dEQP-GLES3.functional.fbo.completeness.renderable.renderbuffer.color0.r11f_g11f_b10f
-dEQP-GLES3.functional.fbo.completeness.renderable.renderbuffer.color0.srgb_unsigned_byte
 dEQP-GLES3.functional.fbo.completeness.renderable.renderbuffer.color0.srgb_alpha_unsigned_byte
 dEQP-GLES3.functional.fbo.completeness.renderable.renderbuffer.color0.srgb8_alpha8
 dEQP-GLES3.functional.fbo.completeness.renderable.renderbuffer.color0.depth_component32f
diff --git a/android/cts/es31-mustpass-2014.2.9-2014-10-22.txt b/android/cts/es31-mustpass-2014.2.9-2014-10-24.txt
similarity index 100%
rename from android/cts/es31-mustpass-2014.2.9-2014-10-22.txt
rename to android/cts/es31-mustpass-2014.2.9-2014-10-24.txt
diff --git a/modules/gles2/functional/es2fFboCompletenessTests.cpp b/modules/gles2/functional/es2fFboCompletenessTests.cpp
index 24882aa..5a67f8d 100644
--- a/modules/gles2/functional/es2fFboCompletenessTests.cpp
+++ b/modules/gles2/functional/es2fFboCompletenessTests.cpp
@@ -96,6 +96,12 @@
 	GLS_UNSIZED_FORMATKEY(GL_RGB,	GL_HALF_FLOAT_OES),
 };
 
+// GL_EXT_sRGB_write_control
+static const FormatKey s_extSrgbWriteControlFormats[] =
+{
+	GL_SRGB8_ALPHA8
+};
+
 static const FormatExtEntry s_es2ExtFormats[] =
 {
 	// The extension does not specify these to be color-renderable.
@@ -109,6 +115,13 @@
 		TEXTURE_VALID,
 		GLS_ARRAY_RANGE(s_oesTextureHalfFloatFormats)
 	},
+
+	// GL_EXT_sRGB_write_control makes SRGB8_ALPHA8 color-renderable
+	{
+		"GL_EXT_sRGB_write_control",
+		REQUIRED_RENDERABLE | TEXTURE_VALID | COLOR_RENDERABLE | RENDERBUFFER_VALID,
+		GLS_ARRAY_RANGE(s_extSrgbWriteControlFormats)
+	},
 };
 
 class ES2Checker : public Checker
diff --git a/modules/gles3/functional/es3fFboCompletenessTests.cpp b/modules/gles3/functional/es3fFboCompletenessTests.cpp
index c594e4c..b392f51 100644
--- a/modules/gles3/functional/es3fFboCompletenessTests.cpp
+++ b/modules/gles3/functional/es3fFboCompletenessTests.cpp
@@ -93,6 +93,14 @@
 	GL_RGBA16F, GL_RGB16F, GL_RG16F, GL_R16F,
 };
 
+static const FormatKey s_es3NotRenderableTextureFormats[] =
+{
+	GL_R8_SNORM, GL_RG8_SNORM, GL_RGB8_SNORM, GL_RGBA8_SNORM,
+	GL_RGB9_E5, GL_SRGB8,
+	GL_RGB8I, GL_RGB16I, GL_RGB32I,
+	GL_RGB8UI, GL_RGB16UI,GL_RGB32UI,
+};
+
 static const FormatEntry s_es3Formats[] =
 {
 	// Renderbuffers don't support unsized formats
@@ -106,6 +114,8 @@
 	  GLS_ARRAY_RANGE(s_es3StencilRboRenderables) },
 	{ REQUIRED_RENDERABLE | STENCIL_RENDERABLE | RENDERBUFFER_VALID | TEXTURE_VALID,
 	  GLS_ARRAY_RANGE(s_es3StencilRenderables) },
+	{ TEXTURE_VALID,
+	  GLS_ARRAY_RANGE(s_es3NotRenderableTextureFormats) },
 
 	// These are not color-renderable in vanilla ES3, but we need to mark them
 	// as valid for textures, since EXT_color_buffer_(half_)float brings in
diff --git a/modules/glshared/glsFboCompletenessTests.cpp b/modules/glshared/glsFboCompletenessTests.cpp
index 498f1fd..80d5e6c 100644
--- a/modules/glshared/glsFboCompletenessTests.cpp
+++ b/modules/glshared/glsFboCompletenessTests.cpp
@@ -175,10 +175,20 @@
 	GL_SRGB8_ALPHA8,
 };
 
-static const FormatKey s_extSrgbTexFormats[] =
+static const FormatKey s_extSrgbRenderableTexFormats[] =
+{
+	GLS_UNSIZED_FORMATKEY(GL_SRGB_ALPHA,	GL_UNSIGNED_BYTE),
+};
+
+static const FormatKey s_extSrgbNonRenderableTexFormats[] =
 {
 	GLS_UNSIZED_FORMATKEY(GL_SRGB,			GL_UNSIGNED_BYTE),
-	GLS_UNSIZED_FORMATKEY(GL_SRGB_ALPHA,	GL_UNSIGNED_BYTE),
+	GL_SRGB8,
+};
+
+static const FormatKey s_nvSrgbFormatsFormats[] =
+{
+	GL_SRGB8,
 };
 
 static const FormatKey s_oesRgb8Rgba8TexFormats[] =
@@ -282,13 +292,23 @@
 	{
 		"GL_EXT_sRGB",
 		COLOR_RENDERABLE | TEXTURE_VALID,
-		GLS_ARRAY_RANGE(s_extSrgbTexFormats)
+		GLS_ARRAY_RANGE(s_extSrgbRenderableTexFormats)
+	},
+	{
+		"GL_EXT_sRGB",
+		TEXTURE_VALID,
+		GLS_ARRAY_RANGE(s_extSrgbNonRenderableTexFormats)
 	},
 	{
 		"GL_EXT_sRGB",
 		REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID,
 		GLS_ARRAY_RANGE(s_extSrgbRboFormats)
 	},
+	{
+		"GL_NV_sRGB_formats",
+		REQUIRED_RENDERABLE | COLOR_RENDERABLE | TEXTURE_VALID | RENDERBUFFER_VALID,
+		GLS_ARRAY_RANGE(s_nvSrgbFormatsFormats)
+	},
 
 	 // In Khronos bug 7333 discussion, the consensus is that these texture
 	 // formats, at least, should be color-renderable. Still, that cannot be