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,
37                                      GLchar* infoLog) override;
38    virtual void glGetShaderiv_(GLuint shader, GLenum pname, GLint* params) override;
39    virtual void glGetShaderInfoLog_(GLuint shader, GLsizei bufSize, GLsizei* length,
40                                     GLchar* infoLog) override;
41    virtual void glEnable_(GLenum cap) override;
42    virtual void glDisable_(GLenum cap) override;
43    virtual GLboolean glIsEnabled_(GLenum cap) override;
44    virtual void glGetIntegerv_(GLenum pname, GLint* data) override;
45    virtual const GLubyte* glGetString_(GLenum name) override;
46    virtual GLenum glCheckFramebufferStatus_(GLenum target) override;
47
48    virtual void glActiveTexture_(GLenum texture) override {}
49    virtual void glAttachShader_(GLuint program, GLuint shader) override {}
50    virtual void glBindAttribLocation_(GLuint program, GLuint index, const GLchar* name) override {}
51    virtual void glBindBuffer_(GLenum target, GLuint buffer) override {}
52    virtual void glBindFramebuffer_(GLenum target, GLuint framebuffer) override {}
53    virtual void glBindRenderbuffer_(GLenum target, GLuint renderbuffer) override {}
54    virtual void glBindTexture_(GLenum target, GLuint texture) override {}
55    virtual void glBlendColor_(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) override {}
56    virtual void glBlendEquation_(GLenum mode) override {}
57    virtual void glBlendEquationSeparate_(GLenum modeRGB, GLenum modeAlpha) override {}
58    virtual void glBlendFunc_(GLenum sfactor, GLenum dfactor) override {}
59    virtual void glBlendFuncSeparate_(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha,
60                                      GLenum dfactorAlpha) override {}
61    virtual void glBufferData_(GLenum target, GLsizeiptr size, const void* data,
62                               GLenum usage) override {}
63    virtual void glBufferSubData_(GLenum target, GLintptr offset, GLsizeiptr size,
64                                  const void* data) override {}
65    virtual void glClear_(GLbitfield mask) override {}
66    virtual void glClearColor_(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) override {}
67    virtual void glClearDepthf_(GLfloat d) override {}
68    virtual void glClearStencil_(GLint s) override {}
69    virtual void glColorMask_(GLboolean red, GLboolean green, GLboolean blue,
70                              GLboolean alpha) override {}
71    virtual void glCompileShader_(GLuint shader) override {}
72    virtual void glCompressedTexImage2D_(GLenum target, GLint level, GLenum internalformat,
73                                         GLsizei width, GLsizei height, GLint border,
74                                         GLsizei imageSize, const void* data) override {}
75    virtual void glCompressedTexSubImage2D_(GLenum target, GLint level, GLint xoffset,
76                                            GLint yoffset, GLsizei width, GLsizei height,
77                                            GLenum format, GLsizei imageSize,
78                                            const void* data) override {}
79    virtual void glCopyTexImage2D_(GLenum target, GLint level, GLenum internalformat, GLint x,
80                                   GLint y, GLsizei width, GLsizei height, GLint border) override {}
81    virtual void glCopyTexSubImage2D_(GLenum target, GLint level, GLint xoffset, GLint yoffset,
82                                      GLint x, GLint y, GLsizei width, GLsizei height) override {}
83    virtual void glCullFace_(GLenum mode) override {}
84    virtual void glDeleteBuffers_(GLsizei n, const GLuint* buffers) override {}
85    virtual void glDeleteFramebuffers_(GLsizei n, const GLuint* framebuffers) override {}
86    virtual void glDeleteProgram_(GLuint program) override {}
87    virtual void glDeleteRenderbuffers_(GLsizei n, const GLuint* renderbuffers) override {}
88    virtual void glDeleteShader_(GLuint shader) override {}
89    virtual void glDeleteTextures_(GLsizei n, const GLuint* textures) override {}
90    virtual void glDepthFunc_(GLenum func) override {}
91    virtual void glDepthMask_(GLboolean flag) override {}
92    virtual void glDepthRangef_(GLfloat n, GLfloat f) override {}
93    virtual void glDetachShader_(GLuint program, GLuint shader) override {}
94    virtual void glDisableVertexAttribArray_(GLuint index) override {}
95    virtual void glDrawArrays_(GLenum mode, GLint first, GLsizei count) override {}
96    virtual void glDrawElements_(GLenum mode, GLsizei count, GLenum type,
97                                 const void* indices) override {}
98    virtual void glEnableVertexAttribArray_(GLuint index) override {}
99    virtual void glFinish_(void) override {}
100    virtual void glFlush_(void) override {}
101    virtual void glFramebufferRenderbuffer_(GLenum target, GLenum attachment,
102                                            GLenum renderbuffertarget,
103                                            GLuint renderbuffer) override {}
104    virtual void glFramebufferTexture2D_(GLenum target, GLenum attachment, GLenum textarget,
105                                         GLuint texture, GLint level) override {}
106    virtual void glFrontFace_(GLenum mode) override {}
107    virtual void glGenerateMipmap_(GLenum target) override {}
108    virtual GLint glGetAttribLocation_(GLuint program, const GLchar* name) override { return 1; }
109    virtual GLenum glGetError_(void) override { return GL_NO_ERROR; }
110    virtual GLint glGetUniformLocation_(GLuint program, const GLchar* name) override { return 2; }
111    virtual void glHint_(GLenum target, GLenum mode) override {}
112    virtual void glLineWidth_(GLfloat width) override {}
113    virtual void glLinkProgram_(GLuint program) override {}
114    virtual void glPixelStorei_(GLenum pname, GLint param) override {}
115    virtual void glPolygonOffset_(GLfloat factor, GLfloat units) override {}
116    virtual void glReadPixels_(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format,
117                               GLenum type, void* pixels) override {}
118    virtual void glReleaseShaderCompiler_(void) override {}
119    virtual void glRenderbufferStorage_(GLenum target, GLenum internalformat, GLsizei width,
120                                        GLsizei height) override {}
121    virtual void glSampleCoverage_(GLfloat value, GLboolean invert) override {}
122    virtual void glScissor_(GLint x, GLint y, GLsizei width, GLsizei height) override {}
123    virtual void glShaderBinary_(GLsizei count, const GLuint* shaders, GLenum binaryformat,
124                                 const void* binary, GLsizei length) override {}
125    virtual void glShaderSource_(GLuint shader, GLsizei count, const GLchar* const* string,
126                                 const GLint* length) override {}
127    virtual void glStencilFunc_(GLenum func, GLint ref, GLuint mask) override {}
128    virtual void glStencilFuncSeparate_(GLenum face, GLenum func, GLint ref, GLuint mask) override {
129    }
130    virtual void glStencilMask_(GLuint mask) override {}
131    virtual void glStencilMaskSeparate_(GLenum face, GLuint mask) override {}
132    virtual void glStencilOp_(GLenum fail, GLenum zfail, GLenum zpass) override {}
133    virtual void glStencilOpSeparate_(GLenum face, GLenum sfail, GLenum dpfail,
134                                      GLenum dppass) override {}
135    virtual void glTexImage2D_(GLenum target, GLint level, GLint internalformat, GLsizei width,
136                               GLsizei height, GLint border, GLenum format, GLenum type,
137                               const void* pixels) override {}
138    virtual void glTexParameterf_(GLenum target, GLenum pname, GLfloat param) override {}
139    virtual void glTexParameterfv_(GLenum target, GLenum pname, const GLfloat* params) override {}
140    virtual void glTexParameteri_(GLenum target, GLenum pname, GLint param) override {}
141    virtual void glTexParameteriv_(GLenum target, GLenum pname, const GLint* params) override {}
142    virtual void glTexSubImage2D_(GLenum target, GLint level, GLint xoffset, GLint yoffset,
143                                  GLsizei width, GLsizei height, GLenum format, GLenum type,
144                                  const void* pixels) override {}
145    virtual void glUniform1f_(GLint location, GLfloat v0) override {}
146    virtual void glUniform1fv_(GLint location, GLsizei count, const GLfloat* value) override {}
147    virtual void glUniform1i_(GLint location, GLint v0) override {}
148    virtual void glUniform1iv_(GLint location, GLsizei count, const GLint* value) override {}
149    virtual void glUniform2f_(GLint location, GLfloat v0, GLfloat v1) override {}
150    virtual void glUniform2fv_(GLint location, GLsizei count, const GLfloat* value) override {}
151    virtual void glUniform2i_(GLint location, GLint v0, GLint v1) override {}
152    virtual void glUniform2iv_(GLint location, GLsizei count, const GLint* value) override {}
153    virtual void glUniform3f_(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) override {}
154    virtual void glUniform3fv_(GLint location, GLsizei count, const GLfloat* value) override {}
155    virtual void glUniform3i_(GLint location, GLint v0, GLint v1, GLint v2) override {}
156    virtual void glUniform3iv_(GLint location, GLsizei count, const GLint* value) override {}
157    virtual void glUniform4f_(GLint location, GLfloat v0, GLfloat v1, GLfloat v2,
158                              GLfloat v3) override {}
159    virtual void glUniform4fv_(GLint location, GLsizei count, const GLfloat* value) override {}
160    virtual void glUniform4i_(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) override {}
161    virtual void glUniform4iv_(GLint location, GLsizei count, const GLint* value) override {}
162    virtual void glUniformMatrix2fv_(GLint location, GLsizei count, GLboolean transpose,
163                                     const GLfloat* value) override {}
164    virtual void glUniformMatrix3fv_(GLint location, GLsizei count, GLboolean transpose,
165                                     const GLfloat* value) override {}
166    virtual void glUniformMatrix4fv_(GLint location, GLsizei count, GLboolean transpose,
167                                     const GLfloat* value) override {}
168    virtual void glUseProgram_(GLuint program) override {}
169    virtual void glValidateProgram_(GLuint program) override {}
170    virtual void glVertexAttrib1f_(GLuint index, GLfloat x) override {}
171    virtual void glVertexAttrib1fv_(GLuint index, const GLfloat* v) override {}
172    virtual void glVertexAttrib2f_(GLuint index, GLfloat x, GLfloat y) override {}
173    virtual void glVertexAttrib2fv_(GLuint index, const GLfloat* v) override {}
174    virtual void glVertexAttrib3f_(GLuint index, GLfloat x, GLfloat y, GLfloat z) override {}
175    virtual void glVertexAttrib3fv_(GLuint index, const GLfloat* v) override {}
176    virtual void glVertexAttrib4f_(GLuint index, GLfloat x, GLfloat y, GLfloat z,
177                                   GLfloat w) override {}
178    virtual void glVertexAttrib4fv_(GLuint index, const GLfloat* v) override {}
179    virtual void glVertexAttribPointer_(GLuint index, GLint size, GLenum type, GLboolean normalized,
180                                        GLsizei stride, const void* pointer) override {}
181    virtual void glViewport_(GLint x, GLint y, GLsizei width, GLsizei height) override {}
182
183    // gles2 ext
184    virtual void glInsertEventMarkerEXT_(GLsizei length, const GLchar* marker) override {}
185    virtual void glPushGroupMarkerEXT_(GLsizei length, const GLchar* marker) override {}
186    virtual void glPopGroupMarkerEXT_(void) override {}
187    virtual void glDiscardFramebufferEXT_(GLenum target, GLsizei numAttachments,
188                                          const GLenum* attachments) override {}
189    virtual void glEGLImageTargetTexture2DOES_(GLenum target, GLeglImageOES image) override {}
190
191    // GLES3
192    virtual void* glMapBufferRange_(GLenum target, GLintptr offset, GLsizeiptr length,
193                                    GLbitfield access) override {
194        return 0;
195    }
196
197    virtual GLboolean glUnmapBuffer_(GLenum target) override { return GL_FALSE; }
198};
199
200}  // namespace debug
201}  // namespace uirenderer
202}  // namespace android
203