1/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19#include "FatalBaseDriver.h"
20
21namespace android {
22namespace uirenderer {
23namespace debug {
24
25class NullGlesDriver : public FatalBaseDriver {
26public:
27    virtual sk_sp<const GrGLInterface> getSkiaInterface() override;
28
29    virtual void glGenBuffers_(GLsizei n, GLuint *buffers) override;
30    virtual void glGenFramebuffers_(GLsizei n, GLuint *framebuffers) override;
31    virtual void glGenRenderbuffers_(GLsizei n, GLuint *renderbuffers) override;
32    virtual void glGenTextures_(GLsizei n, GLuint *textures) override;
33    virtual GLuint glCreateProgram_(void) override;
34    virtual GLuint glCreateShader_(GLenum type) override;
35    virtual void glGetProgramiv_(GLuint program, GLenum pname, GLint *params) override;
36    virtual void glGetProgramInfoLog_(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog) override;
37    virtual void glGetShaderiv_(GLuint shader, GLenum pname, GLint *params) override;
38    virtual void glGetShaderInfoLog_(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog) override;
39    virtual void glEnable_(GLenum cap) override;
40    virtual void glDisable_(GLenum cap) override;
41    virtual GLboolean glIsEnabled_(GLenum cap) override;
42    virtual void glGetIntegerv_(GLenum pname, GLint *data) override;
43    virtual const GLubyte* glGetString_(GLenum name) override;
44    virtual GLenum glCheckFramebufferStatus_(GLenum target) override;
45
46    virtual void glActiveTexture_(GLenum texture) override {}
47    virtual void glAttachShader_(GLuint program, GLuint shader) override {}
48    virtual void glBindAttribLocation_(GLuint program, GLuint index, const GLchar *name) override {}
49    virtual void glBindBuffer_(GLenum target, GLuint buffer) override {}
50    virtual void glBindFramebuffer_(GLenum target, GLuint framebuffer) override {}
51    virtual void glBindRenderbuffer_(GLenum target, GLuint renderbuffer) override {}
52    virtual void glBindTexture_(GLenum target, GLuint texture) override {}
53    virtual void glBlendColor_(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) override {}
54    virtual void glBlendEquation_(GLenum mode) override {}
55    virtual void glBlendEquationSeparate_(GLenum modeRGB, GLenum modeAlpha) override {}
56    virtual void glBlendFunc_(GLenum sfactor, GLenum dfactor) override {}
57    virtual void glBlendFuncSeparate_(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) override {}
58    virtual void glBufferData_(GLenum target, GLsizeiptr size, const void *data, GLenum usage) override {}
59    virtual void glBufferSubData_(GLenum target, GLintptr offset, GLsizeiptr size, const void *data) override {}
60    virtual void glClear_(GLbitfield mask) override {}
61    virtual void glClearColor_(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) override {}
62    virtual void glClearDepthf_(GLfloat d) override {}
63    virtual void glClearStencil_(GLint s) override {}
64    virtual void glColorMask_(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) override {}
65    virtual void glCompileShader_(GLuint shader) override {}
66    virtual void glCompressedTexImage2D_(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data) override {}
67    virtual void glCompressedTexSubImage2D_(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data) override {}
68    virtual void glCopyTexImage2D_(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) override {}
69    virtual void glCopyTexSubImage2D_(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) override {}
70    virtual void glCullFace_(GLenum mode) override {}
71    virtual void glDeleteBuffers_(GLsizei n, const GLuint *buffers) override {}
72    virtual void glDeleteFramebuffers_(GLsizei n, const GLuint *framebuffers) override {}
73    virtual void glDeleteProgram_(GLuint program) override {}
74    virtual void glDeleteRenderbuffers_(GLsizei n, const GLuint *renderbuffers) override {}
75    virtual void glDeleteShader_(GLuint shader) override {}
76    virtual void glDeleteTextures_(GLsizei n, const GLuint *textures) override {}
77    virtual void glDepthFunc_(GLenum func) override {}
78    virtual void glDepthMask_(GLboolean flag) override {}
79    virtual void glDepthRangef_(GLfloat n, GLfloat f) override {}
80    virtual void glDetachShader_(GLuint program, GLuint shader) override {}
81    virtual void glDisableVertexAttribArray_(GLuint index) override {}
82    virtual void glDrawArrays_(GLenum mode, GLint first, GLsizei count) override {}
83    virtual void glDrawElements_(GLenum mode, GLsizei count, GLenum type, const void *indices) override {}
84    virtual void glEnableVertexAttribArray_(GLuint index) override {}
85    virtual void glFinish_(void) override {}
86    virtual void glFlush_(void) override {}
87    virtual void glFramebufferRenderbuffer_(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) override {}
88    virtual void glFramebufferTexture2D_(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) override {}
89    virtual void glFrontFace_(GLenum mode) override {}
90    virtual void glGenerateMipmap_(GLenum target) override {}
91    virtual GLint glGetAttribLocation_(GLuint program, const GLchar *name) override { return 1; }
92    virtual GLenum glGetError_(void) override { return GL_NO_ERROR; }
93    virtual GLint glGetUniformLocation_(GLuint program, const GLchar *name) override { return 2; }
94    virtual void glHint_(GLenum target, GLenum mode) override {}
95    virtual void glLineWidth_(GLfloat width) override {}
96    virtual void glLinkProgram_(GLuint program) override {}
97    virtual void glPixelStorei_(GLenum pname, GLint param) override {}
98    virtual void glPolygonOffset_(GLfloat factor, GLfloat units) override {}
99    virtual void glReadPixels_(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels) override {}
100    virtual void glReleaseShaderCompiler_(void) override {}
101    virtual void glRenderbufferStorage_(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) override {}
102    virtual void glSampleCoverage_(GLfloat value, GLboolean invert) override {}
103    virtual void glScissor_(GLint x, GLint y, GLsizei width, GLsizei height) override {}
104    virtual void glShaderBinary_(GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length) override {}
105    virtual void glShaderSource_(GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length) override {}
106    virtual void glStencilFunc_(GLenum func, GLint ref, GLuint mask) override {}
107    virtual void glStencilFuncSeparate_(GLenum face, GLenum func, GLint ref, GLuint mask) override {}
108    virtual void glStencilMask_(GLuint mask) override {}
109    virtual void glStencilMaskSeparate_(GLenum face, GLuint mask) override {}
110    virtual void glStencilOp_(GLenum fail, GLenum zfail, GLenum zpass) override {}
111    virtual void glStencilOpSeparate_(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass) override {}
112    virtual void glTexImage2D_(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels) override {}
113    virtual void glTexParameterf_(GLenum target, GLenum pname, GLfloat param) override {}
114    virtual void glTexParameterfv_(GLenum target, GLenum pname, const GLfloat *params) override {}
115    virtual void glTexParameteri_(GLenum target, GLenum pname, GLint param) override {}
116    virtual void glTexParameteriv_(GLenum target, GLenum pname, const GLint *params) override {}
117    virtual void glTexSubImage2D_(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels) override {}
118    virtual void glUniform1f_(GLint location, GLfloat v0) override {}
119    virtual void glUniform1fv_(GLint location, GLsizei count, const GLfloat *value) override {}
120    virtual void glUniform1i_(GLint location, GLint v0) override {}
121    virtual void glUniform1iv_(GLint location, GLsizei count, const GLint *value) override {}
122    virtual void glUniform2f_(GLint location, GLfloat v0, GLfloat v1) override {}
123    virtual void glUniform2fv_(GLint location, GLsizei count, const GLfloat *value) override {}
124    virtual void glUniform2i_(GLint location, GLint v0, GLint v1) override {}
125    virtual void glUniform2iv_(GLint location, GLsizei count, const GLint *value) override {}
126    virtual void glUniform3f_(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) override {}
127    virtual void glUniform3fv_(GLint location, GLsizei count, const GLfloat *value) override {}
128    virtual void glUniform3i_(GLint location, GLint v0, GLint v1, GLint v2) override {}
129    virtual void glUniform3iv_(GLint location, GLsizei count, const GLint *value) override {}
130    virtual void glUniform4f_(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) override {}
131    virtual void glUniform4fv_(GLint location, GLsizei count, const GLfloat *value) override {}
132    virtual void glUniform4i_(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) override {}
133    virtual void glUniform4iv_(GLint location, GLsizei count, const GLint *value) override {}
134    virtual void glUniformMatrix2fv_(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) override {}
135    virtual void glUniformMatrix3fv_(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) override {}
136    virtual void glUniformMatrix4fv_(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) override {}
137    virtual void glUseProgram_(GLuint program) override {}
138    virtual void glValidateProgram_(GLuint program) override {}
139    virtual void glVertexAttrib1f_(GLuint index, GLfloat x) override {}
140    virtual void glVertexAttrib1fv_(GLuint index, const GLfloat *v) override {}
141    virtual void glVertexAttrib2f_(GLuint index, GLfloat x, GLfloat y) override {}
142    virtual void glVertexAttrib2fv_(GLuint index, const GLfloat *v) override {}
143    virtual void glVertexAttrib3f_(GLuint index, GLfloat x, GLfloat y, GLfloat z) override {}
144    virtual void glVertexAttrib3fv_(GLuint index, const GLfloat *v) override {}
145    virtual void glVertexAttrib4f_(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) override {}
146    virtual void glVertexAttrib4fv_(GLuint index, const GLfloat *v) override {}
147    virtual void glVertexAttribPointer_(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer) override {}
148    virtual void glViewport_(GLint x, GLint y, GLsizei width, GLsizei height) override {}
149
150    // gles2 ext
151    virtual void glInsertEventMarkerEXT_(GLsizei length, const GLchar *marker) override {}
152    virtual void glPushGroupMarkerEXT_(GLsizei length, const GLchar *marker) override {}
153    virtual void glPopGroupMarkerEXT_(void) override {}
154    virtual void glDiscardFramebufferEXT_(GLenum target, GLsizei numAttachments, const GLenum *attachments) override {}
155    virtual void glEGLImageTargetTexture2DOES_(GLenum target, GLeglImageOES image) override {}
156
157    // GLES3
158    virtual void* glMapBufferRange_(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) override {
159        return 0;
160    }
161
162    virtual GLboolean glUnmapBuffer_(GLenum target) override {
163        return GL_FALSE;
164    }
165};
166
167} // namespace debug
168} // namespace uirenderer
169} // namespace android
170