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 #ifndef GLES_VALIDATION_H 18 #define GLES_VALIDATION_H 19 20 #include <GLES2/gl2.h> 21 #include <GLES2/gl2ext.h> 22 #include <GLES2/gl2platform.h> 23 24 #include <GLES3/gl3.h> 25 #include <GLES3/gl31.h> 26 27 #include "GL2Encoder.h" 28 29 #include <string> 30 31 namespace GLESv2Validation { 32 33 extern GLbitfield allBufferMapAccessFlags; 34 bool bufferTarget(GL2Encoder* ctx, GLenum target); 35 bool bufferParam(GL2Encoder* ctx, GLenum param); 36 bool bufferUsage(GL2Encoder* ctx, GLenum usage); 37 38 bool pixelStoreParam(GL2Encoder* ctx, GLenum param); 39 bool pixelStoreValue(GLenum param, GLint value); 40 41 bool rboFormat(GL2Encoder* ctx, GLenum internalformat); 42 43 bool framebufferTarget(GL2Encoder* ctx, GLenum target); 44 bool framebufferAttachment(GL2Encoder* ctx, GLenum attachment); 45 46 bool readPixelsFormat(GLenum format); 47 bool readPixelsType(GLenum type); 48 bool pixelOp(GLenum format, GLenum type); 49 50 bool vertexAttribType(GL2Encoder* ctx, GLenum type); 51 52 bool readPixelsFboFormatMatch(GLenum format, GLenum type, GLenum fboTexType); 53 bool blitFramebufferFormat(GLenum readFormat, GLenum drawFormat); 54 55 bool textureTarget(GL2Encoder* ctx, GLenum target); 56 bool textureParams(GL2Encoder* ctx, GLenum pname); 57 bool samplerParams(GL2Encoder* ctx, GLenum pname); 58 bool textureParamValue(GL2Encoder* ctx, GLenum pname, GLint intval, GLfloat floatval, GLenum enumval); 59 60 bool isIntegerFormat(GLenum format); 61 bool isCompressedFormat(GLenum internalformat); 62 bool supportedCompressedFormat(GL2Encoder* ctx, GLenum internalformat); 63 64 bool unsizedFormat(GLenum format); 65 66 bool filterableTexFormat(GL2Encoder* ctx, GLenum internalformat); 67 bool colorRenderableFormat(GL2Encoder* ctx, GLenum internalformat); 68 bool depthRenderableFormat(GL2Encoder* ctx, GLenum internalformat); 69 bool stencilRenderableFormat(GL2Encoder* ctx, GLenum internalformat); 70 71 bool isCubeMapTarget(GLenum target); 72 73 bool pixelType(GL2Encoder* ctx, GLenum type); 74 bool pixelFormat(GL2Encoder* ctx, GLenum format); 75 76 bool textureBufferFormat(GL2Encoder* ctx, GLenum internalFormat); 77 78 bool pixelInternalFormat(GLenum internalformat); 79 bool pixelSizedFormat(GL2Encoder* ctx, GLenum internalformat, GLenum format, GLenum type); 80 void getCompatibleFormatTypeForInternalFormat(GLenum internalformat, GLenum* format_out, GLenum* type_out); 81 82 bool shaderType(GL2Encoder* ctx, GLenum type); 83 84 bool internalFormatTarget(GL2Encoder* ctx, GLenum target); 85 86 std::string vertexAttribIndexRangeErrorMsg(GL2Encoder* ctx, GLuint index); 87 88 bool allowedFace(GLenum face); 89 bool allowedFunc(GLenum func); 90 bool allowedStencilOp(GLenum op); 91 bool allowedBlendEquation(GLenum eq); 92 bool allowedBlendFunc(GLenum func); 93 94 bool allowedCullFace(GLenum mode); 95 bool allowedFrontFace(GLenum mode); 96 97 bool allowedEnable(int majorVersion, int minorVersion, GLenum mode); 98 99 bool allowedGetShader(GLenum pname); 100 101 bool allowedShaderType(GLenum shadertype); 102 bool allowedPrecisionType(GLenum precisiontype); 103 104 bool allowedGetProgram(int majorVersion, int minorVersion, GLenum pname); 105 106 bool allowedGetActiveUniforms(GLenum pname) ; 107 bool allowedGetActiveUniformBlock(GLenum pname) ; 108 109 bool allowedGetVertexAttrib(GLenum pname) ; 110 111 bool allowedGetRenderbufferParameter(GLenum pname); 112 113 bool allowedQueryTarget(GLenum target); 114 bool allowedQueryParam(GLenum pname); 115 bool allowedQueryObjectParam(GLenum pname); 116 117 bool allowedGetSyncParam(GLenum pname); 118 119 bool allowedHintTarget(GLenum target); 120 bool allowedHintMode(GLenum pname); 121 122 } // namespace GLESv2Validation 123 124 #endif 125