Accept GL_RGB/GL_RGBA for glGetInternalformativ.

The spec mentions them as color-renderable, but our IsColorRenderable()
function only handles sized internal format, and adding them there
might hide bugs in our renderbuffer implementation since they can only
be constructed using sized internal formats.

dEQP also has a note about this inconsistency, and consequently these
formats are not part of the 'mustpass' set for
dEQP-GLES3.functional.state_query.internal_format.
So it might be a spec oversight.

Change-Id: I08ca3dad4c0b5686536dafd3ade1e855e3968aa0
Reviewed-on: https://swiftshader-review.googlesource.com/16410
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/OpenGL/libGLESv2/libGLESv3.cpp b/src/OpenGL/libGLESv2/libGLESv3.cpp
index a13000e..f5f3264 100644
--- a/src/OpenGL/libGLESv2/libGLESv3.cpp
+++ b/src/OpenGL/libGLESv2/libGLESv3.cpp
@@ -3766,6 +3766,12 @@
 		return;
 	}
 
+	// OpenGL ES 3.0, section 4.4.4: "An internal format is color-renderable if it is one of the formats
+	// from table 3.13 noted as color-renderable or if it is unsized format RGBA or RGB."
+	// Since we only use sized formats internally, replace them here (assuming type = GL_UNSIGNED_BYTE).
+	if(internalformat == GL_RGB)  internalformat = GL_RGB8;
+	if(internalformat == GL_RGBA) internalformat = GL_RGBA8;
+
 	if(!IsColorRenderable(internalformat, egl::getClientVersion()) &&
 	   !IsDepthRenderable(internalformat, egl::getClientVersion()) &&
 	   !IsStencilRenderable(internalformat, egl::getClientVersion()))