Add basic initialization code for ContextNULL so it can run some tests.

BUG=angleproject:1468

Change-Id: I8dfc9a3c71e5638de22bc9d9a5dadfb495ef23a7
Reviewed-on: https://chromium-review.googlesource.com/388846
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/libANGLE/renderer/null/ContextNULL.cpp b/src/libANGLE/renderer/null/ContextNULL.cpp
index 95d4c04..77fa0ab 100644
--- a/src/libANGLE/renderer/null/ContextNULL.cpp
+++ b/src/libANGLE/renderer/null/ContextNULL.cpp
@@ -11,11 +11,32 @@
 
 #include "common/debug.h"
 
+#include "libANGLE/renderer/null/BufferNULL.h"
+#include "libANGLE/renderer/null/CompilerNULL.h"
+#include "libANGLE/renderer/null/DisplayNULL.h"
+#include "libANGLE/renderer/null/FenceNVNULL.h"
+#include "libANGLE/renderer/null/FenceSyncNULL.h"
+#include "libANGLE/renderer/null/FramebufferNULL.h"
+#include "libANGLE/renderer/null/ImageNULL.h"
+#include "libANGLE/renderer/null/PathNULL.h"
+#include "libANGLE/renderer/null/ProgramNULL.h"
+#include "libANGLE/renderer/null/QueryNULL.h"
+#include "libANGLE/renderer/null/RenderbufferNULL.h"
+#include "libANGLE/renderer/null/SamplerNULL.h"
+#include "libANGLE/renderer/null/ShaderNULL.h"
+#include "libANGLE/renderer/null/TextureNULL.h"
+#include "libANGLE/renderer/null/TransformFeedbackNULL.h"
+#include "libANGLE/renderer/null/VertexArrayNULL.h"
+
 namespace rx
 {
 
 ContextNULL::ContextNULL(const gl::ContextState &state) : ContextImpl(state)
 {
+    const gl::Version maxClientVersion(3, 1);
+    mCaps        = GenerateMinimumCaps(maxClientVersion);
+    mExtensions  = gl::Extensions();
+    mTextureCaps = GenerateMinimumTextureCapsMap(maxClientVersion, mExtensions);
 }
 
 ContextNULL::~ContextNULL()
@@ -24,26 +45,22 @@
 
 gl::Error ContextNULL::initialize()
 {
-    UNIMPLEMENTED();
-    return gl::Error(GL_INVALID_OPERATION);
+    return gl::NoError();
 }
 
 gl::Error ContextNULL::flush()
 {
-    UNIMPLEMENTED();
-    return gl::Error(GL_INVALID_OPERATION);
+    return gl::NoError();
 }
 
 gl::Error ContextNULL::finish()
 {
-    UNIMPLEMENTED();
-    return gl::Error(GL_INVALID_OPERATION);
+    return gl::NoError();
 }
 
 gl::Error ContextNULL::drawArrays(GLenum mode, GLint first, GLsizei count)
 {
-    UNIMPLEMENTED();
-    return gl::Error(GL_INVALID_OPERATION);
+    return gl::NoError();
 }
 
 gl::Error ContextNULL::drawArraysInstanced(GLenum mode,
@@ -51,8 +68,7 @@
                                            GLsizei count,
                                            GLsizei instanceCount)
 {
-    UNIMPLEMENTED();
-    return gl::Error(GL_INVALID_OPERATION);
+    return gl::NoError();
 }
 
 gl::Error ContextNULL::drawElements(GLenum mode,
@@ -61,8 +77,7 @@
                                     const GLvoid *indices,
                                     const gl::IndexRange &indexRange)
 {
-    UNIMPLEMENTED();
-    return gl::Error(GL_INVALID_OPERATION);
+    return gl::NoError();
 }
 
 gl::Error ContextNULL::drawElementsInstanced(GLenum mode,
@@ -72,8 +87,7 @@
                                              GLsizei instances,
                                              const gl::IndexRange &indexRange)
 {
-    UNIMPLEMENTED();
-    return gl::Error(GL_INVALID_OPERATION);
+    return gl::NoError();
 }
 
 gl::Error ContextNULL::drawRangeElements(GLenum mode,
@@ -84,92 +98,225 @@
                                          const GLvoid *indices,
                                          const gl::IndexRange &indexRange)
 {
-    UNIMPLEMENTED();
-    return gl::Error(GL_INVALID_OPERATION);
+    return gl::NoError();
+}
+
+void ContextNULL::stencilFillPath(const gl::Path *path, GLenum fillMode, GLuint mask)
+{
+}
+
+void ContextNULL::stencilStrokePath(const gl::Path *path, GLint reference, GLuint mask)
+{
+}
+
+void ContextNULL::coverFillPath(const gl::Path *path, GLenum coverMode)
+{
+}
+
+void ContextNULL::coverStrokePath(const gl::Path *path, GLenum coverMode)
+{
+}
+
+void ContextNULL::stencilThenCoverFillPath(const gl::Path *path,
+                                           GLenum fillMode,
+                                           GLuint mask,
+                                           GLenum coverMode)
+{
+}
+
+void ContextNULL::stencilThenCoverStrokePath(const gl::Path *path,
+                                             GLint reference,
+                                             GLuint mask,
+                                             GLenum coverMode)
+{
+}
+
+void ContextNULL::coverFillPathInstanced(const std::vector<gl::Path *> &paths,
+                                         GLenum coverMode,
+                                         GLenum transformType,
+                                         const GLfloat *transformValues)
+{
+}
+
+void ContextNULL::coverStrokePathInstanced(const std::vector<gl::Path *> &paths,
+                                           GLenum coverMode,
+                                           GLenum transformType,
+                                           const GLfloat *transformValues)
+{
+}
+
+void ContextNULL::stencilFillPathInstanced(const std::vector<gl::Path *> &paths,
+                                           GLenum fillMode,
+                                           GLuint mask,
+                                           GLenum transformType,
+                                           const GLfloat *transformValues)
+{
+}
+
+void ContextNULL::stencilStrokePathInstanced(const std::vector<gl::Path *> &paths,
+                                             GLint reference,
+                                             GLuint mask,
+                                             GLenum transformType,
+                                             const GLfloat *transformValues)
+{
+}
+
+void ContextNULL::stencilThenCoverFillPathInstanced(const std::vector<gl::Path *> &paths,
+                                                    GLenum coverMode,
+                                                    GLenum fillMode,
+                                                    GLuint mask,
+                                                    GLenum transformType,
+                                                    const GLfloat *transformValues)
+{
+}
+
+void ContextNULL::stencilThenCoverStrokePathInstanced(const std::vector<gl::Path *> &paths,
+                                                      GLenum coverMode,
+                                                      GLint reference,
+                                                      GLuint mask,
+                                                      GLenum transformType,
+                                                      const GLfloat *transformValues)
+{
+}
+
+GLenum ContextNULL::getResetStatus()
+{
+    return GL_NO_ERROR;
+}
+
+std::string ContextNULL::getVendorString() const
+{
+    return "NULL";
+}
+
+std::string ContextNULL::getRendererDescription() const
+{
+    return "NULL";
+}
+
+void ContextNULL::insertEventMarker(GLsizei length, const char *marker)
+{
+}
+
+void ContextNULL::pushGroupMarker(GLsizei length, const char *marker)
+{
+}
+
+void ContextNULL::popGroupMarker()
+{
+}
+
+void ContextNULL::syncState(const gl::State &state, const gl::State::DirtyBits &dirtyBits)
+{
+}
+
+GLint ContextNULL::getGPUDisjoint()
+{
+    return 0;
+}
+
+GLint64 ContextNULL::getTimestamp()
+{
+    return 0;
+}
+
+void ContextNULL::onMakeCurrent(const gl::ContextState &data)
+{
+}
+
+const gl::Caps &ContextNULL::getNativeCaps() const
+{
+    return mCaps;
+}
+
+const gl::TextureCapsMap &ContextNULL::getNativeTextureCaps() const
+{
+    return mTextureCaps;
+}
+
+const gl::Extensions &ContextNULL::getNativeExtensions() const
+{
+    return mExtensions;
+}
+
+const gl::Limitations &ContextNULL::getNativeLimitations() const
+{
+    return mLimitations;
 }
 
 CompilerImpl *ContextNULL::createCompiler()
 {
-    UNIMPLEMENTED();
-    return static_cast<CompilerImpl *>(0);
+    return new CompilerNULL();
 }
 
 ShaderImpl *ContextNULL::createShader(const gl::ShaderState &data)
 {
-    UNIMPLEMENTED();
-    return static_cast<ShaderImpl *>(0);
+    return new ShaderNULL(data);
 }
 
 ProgramImpl *ContextNULL::createProgram(const gl::ProgramState &data)
 {
-    UNIMPLEMENTED();
-    return static_cast<ProgramImpl *>(0);
+    return new ProgramNULL(data);
 }
 
 FramebufferImpl *ContextNULL::createFramebuffer(const gl::FramebufferState &data)
 {
-    UNIMPLEMENTED();
-    return static_cast<FramebufferImpl *>(0);
+    return new FramebufferNULL(data);
 }
 
 TextureImpl *ContextNULL::createTexture(const gl::TextureState &state)
 {
-    UNIMPLEMENTED();
-    return static_cast<TextureImpl *>(0);
+    return new TextureNULL(state);
 }
 
 RenderbufferImpl *ContextNULL::createRenderbuffer()
 {
-    UNIMPLEMENTED();
-    return static_cast<RenderbufferImpl *>(0);
+    return new RenderbufferNULL();
 }
 
 BufferImpl *ContextNULL::createBuffer(const gl::BufferState &state)
 {
-    UNIMPLEMENTED();
-    return static_cast<BufferImpl *>(0);
+    return new BufferNULL(state);
 }
 
 VertexArrayImpl *ContextNULL::createVertexArray(const gl::VertexArrayState &data)
 {
-    UNIMPLEMENTED();
-    return static_cast<VertexArrayImpl *>(0);
+    return new VertexArrayNULL(data);
 }
 
 QueryImpl *ContextNULL::createQuery(GLenum type)
 {
-    UNIMPLEMENTED();
-    return static_cast<QueryImpl *>(0);
+    return new QueryNULL(type);
 }
 
 FenceNVImpl *ContextNULL::createFenceNV()
 {
-    UNIMPLEMENTED();
-    return static_cast<FenceNVImpl *>(0);
+    return new FenceNVNULL();
 }
 
 FenceSyncImpl *ContextNULL::createFenceSync()
 {
-    UNIMPLEMENTED();
-    return static_cast<FenceSyncImpl *>(0);
+    return new FenceSyncNULL();
 }
 
 TransformFeedbackImpl *ContextNULL::createTransformFeedback(const gl::TransformFeedbackState &state)
 {
-    UNIMPLEMENTED();
-    return static_cast<TransformFeedbackImpl *>(0);
+    return new TransformFeedbackNULL(state);
 }
 
 SamplerImpl *ContextNULL::createSampler()
 {
-    UNIMPLEMENTED();
-    return static_cast<SamplerImpl *>(0);
+    return new SamplerNULL();
 }
 
 std::vector<PathImpl *> ContextNULL::createPaths(GLsizei range)
 {
-    UNIMPLEMENTED();
-    return std::vector<PathImpl *>();
+    std::vector<PathImpl *> result(range);
+    for (GLsizei idx = 0; idx < range; idx++)
+    {
+        result[idx] = new PathNULL();
+    }
+    return result;
 }
 
 }  // namespace rx