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