1//
2// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6
7// validationES.h: Validation functions for generic OpenGL ES entry point parameters
8
9#ifndef LIBGLESV2_VALIDATION_ES_H
10#define LIBGLESV2_VALIDATION_ES_H
11
12#include "common/mathutil.h"
13
14#include <GLES2/gl2.h>
15#include <GLES3/gl3.h>
16
17namespace gl
18{
19
20class Context;
21
22bool ValidCap(const Context *context, GLenum cap);
23bool ValidTextureTarget(const Context *context, GLenum target);
24bool ValidTexture2DDestinationTarget(const Context *context, GLenum target);
25bool ValidFramebufferTarget(GLenum target);
26bool ValidBufferTarget(const Context *context, GLenum target);
27bool ValidBufferParameter(const Context *context, GLenum pname);
28bool ValidMipLevel(const Context *context, GLenum target, GLint level);
29bool ValidImageSize(const Context *context, GLenum target, GLint level, GLsizei width, GLsizei height, GLsizei depth);
30bool ValidCompressedImageSize(const Context *context, GLenum internalFormat, GLsizei width, GLsizei height);
31bool ValidQueryType(const Context *context, GLenum queryType);
32bool ValidProgram(Context *context, GLuint id);
33
34bool ValidateAttachmentTarget(Context *context, GLenum attachment);
35bool ValidateRenderbufferStorageParameters(Context *context, GLenum target, GLsizei samples,
36                                           GLenum internalformat, GLsizei width, GLsizei height,
37                                           bool angleExtension);
38bool ValidateFramebufferRenderbufferParameters(Context *context, GLenum target, GLenum attachment,
39                                               GLenum renderbuffertarget, GLuint renderbuffer);
40
41bool ValidateBlitFramebufferParameters(Context *context, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
42                                       GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask,
43                                       GLenum filter, bool fromAngleExtension);
44
45bool ValidateGetVertexAttribParameters(Context *context, GLenum pname);
46
47bool ValidateTexParamParameters(Context *context, GLenum pname, GLint param);
48
49bool ValidateSamplerObjectParameter(Context *context, GLenum pname);
50
51bool ValidateReadPixelsParameters(Context *context, GLint x, GLint y, GLsizei width, GLsizei height,
52                                  GLenum format, GLenum type, GLsizei *bufSize, GLvoid *pixels);
53
54bool ValidateBeginQuery(Context *context, GLenum target, GLuint id);
55bool ValidateEndQuery(Context *context, GLenum target);
56
57bool ValidateUniform(Context *context, GLenum uniformType, GLint location, GLsizei count);
58bool ValidateUniformMatrix(Context *context, GLenum matrixType, GLint location, GLsizei count,
59                           GLboolean transpose);
60
61bool ValidateStateQuery(Context *context, GLenum pname, GLenum *nativeType, unsigned int *numParams);
62
63bool ValidateCopyTexImageParametersBase(Context* context, GLenum target, GLint level, GLenum internalformat, bool isSubImage,
64                                        GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height,
65                                        GLint border, GLenum *textureInternalFormatOut);
66
67bool ValidateDrawArrays(Context *context, GLenum mode, GLint first, GLsizei count, GLsizei primcount);
68bool ValidateDrawArraysInstanced(Context *context, GLenum mode, GLint first, GLsizei count, GLsizei primcount);
69bool ValidateDrawArraysInstancedANGLE(Context *context, GLenum mode, GLint first, GLsizei count, GLsizei primcount);
70
71bool ValidateDrawElements(Context *context, GLenum mode, GLsizei count, GLenum type,
72                          const GLvoid* indices, GLsizei primcount, rx::RangeUI *indexRangeOut);
73
74bool ValidateDrawElementsInstanced(Context *context, GLenum mode, GLsizei count, GLenum type,
75                                   const GLvoid *indices, GLsizei primcount, rx::RangeUI *indexRangeOut);
76bool ValidateDrawElementsInstancedANGLE(Context *context, GLenum mode, GLsizei count, GLenum type,
77                                        const GLvoid *indices, GLsizei primcount, rx::RangeUI *indexRangeOut);
78
79bool ValidateFramebufferTextureBase(Context *context, GLenum target, GLenum attachment,
80                                    GLuint texture, GLint level);
81bool ValidateFramebufferTexture2D(Context *context, GLenum target, GLenum attachment,
82                                  GLenum textarget, GLuint texture, GLint level);
83
84bool ValidateGetUniformBase(Context *context, GLuint program, GLint location);
85bool ValidateGetUniformfv(Context *context, GLuint program, GLint location, GLfloat* params);
86bool ValidateGetUniformiv(Context *context, GLuint program, GLint location, GLint* params);
87bool ValidateGetnUniformfvEXT(Context *context, GLuint program, GLint location, GLsizei bufSize, GLfloat* params);
88bool ValidateGetnUniformivEXT(Context *context, GLuint program, GLint location, GLsizei bufSize, GLint* params);
89
90}
91
92#endif // LIBGLESV2_VALIDATION_ES_H
93