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