Hash :
f0e89be6
Author :
Date :
2017-11-08T14:00:32
Use packed enums for the texture types and targets, part 1 In OpenGL there are two enum "sets" used by the API that are very similar: texture types (or bind point) and texture targets. They only differ in that texture types have GL_TEXTURE_CUBEMAP and target have GL_TEXTURE_CUBEMAP_[POSITIVE|NEGATIVE]_[X|Y|Z]. This is a problem because in ANGLE we use GLenum to pass around both types of data, making it difficult to know which of type and target a variable is. In addition these enums are placed somewhat randomly in the space of OpenGL enums, making it slow to have a mapping from texture types to some data. Such a mapping is in hot-code with gl::State::mTextures. This commit stack makes the texture types and target enums be translated to internal packed enums right at the OpenGL entry point and used throughout ANGLE to have type safety and performance gains. This is the first of two commit which does the refactor for all of the validation and stops inside gl::Context. This was the best place to split patches without having many conversions from packed enums to GL enums. BUG=angleproject:2169 Change-Id: Ib43da7e71c253bd9fe210fb0ec0de61bc286e6d3 Reviewed-on: https://chromium-review.googlesource.com/758835 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
//
// Copyright (c) 2018 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// validationES1.h: Validation functions for OpenGL ES 1.0 entry point parameters
#ifndef LIBANGLE_VALIDATION_ES1_H_
#define LIBANGLE_VALIDATION_ES1_H_
#include <GLES/gl.h>
#include <GLES/glext.h>
#include "libANGLE/validationES2.h"
namespace gl
{
class Context;
bool ValidateAlphaFunc(Context *context, GLenum func, GLfloat ref);
bool ValidateAlphaFuncx(Context *context, GLenum func, GLfixed ref);
bool ValidateClearColorx(Context *context, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
bool ValidateClearDepthx(Context *context, GLfixed depth);
bool ValidateClientActiveTexture(Context *context, GLenum texture);
bool ValidateClipPlanef(Context *context, GLenum p, const GLfloat *eqn);
bool ValidateClipPlanex(Context *context, GLenum plane, const GLfixed *equation);
bool ValidateColor4f(Context *context, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
bool ValidateColor4ub(Context *context, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
bool ValidateColor4x(Context *context, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
bool ValidateColorPointer(Context *context,
GLint size,
GLenum type,
GLsizei stride,
const void *pointer);
bool ValidateCullFace(Context *context, GLenum mode);
bool ValidateDepthRangex(Context *context, GLfixed n, GLfixed f);
bool ValidateDisableClientState(Context *context, GLenum array);
bool ValidateEnableClientState(Context *context, GLenum array);
bool ValidateFogf(Context *context, GLenum pname, GLfloat param);
bool ValidateFogfv(Context *context, GLenum pname, const GLfloat *params);
bool ValidateFogx(Context *context, GLenum pname, GLfixed param);
bool ValidateFogxv(Context *context, GLenum pname, const GLfixed *param);
bool ValidateFrustumf(Context *context,
GLfloat l,
GLfloat r,
GLfloat b,
GLfloat t,
GLfloat n,
GLfloat f);
bool ValidateFrustumx(Context *context,
GLfixed l,
GLfixed r,
GLfixed b,
GLfixed t,
GLfixed n,
GLfixed f);
bool ValidateGetBufferParameteriv(Context *context, GLenum target, GLenum pname, GLint *params);
bool ValidateGetClipPlanef(Context *context, GLenum plane, GLfloat *equation);
bool ValidateGetClipPlanex(Context *context, GLenum plane, GLfixed *equation);
bool ValidateGetFixedv(Context *context, GLenum pname, GLfixed *params);
bool ValidateGetLightfv(Context *context, GLenum light, GLenum pname, GLfloat *params);
bool ValidateGetLightxv(Context *context, GLenum light, GLenum pname, GLfixed *params);
bool ValidateGetMaterialfv(Context *context, GLenum face, GLenum pname, GLfloat *params);
bool ValidateGetMaterialxv(Context *context, GLenum face, GLenum pname, GLfixed *params);
bool ValidateGetPointerv(Context *context, GLenum pname, void **params);
bool ValidateGetTexEnvfv(Context *context, GLenum target, GLenum pname, GLfloat *params);
bool ValidateGetTexEnviv(Context *context, GLenum target, GLenum pname, GLint *params);
bool ValidateGetTexEnvxv(Context *context, GLenum target, GLenum pname, GLfixed *params);
bool ValidateGetTexParameterxv(Context *context, TextureType target, GLenum pname, GLfixed *params);
bool ValidateLightModelf(Context *context, GLenum pname, GLfloat param);
bool ValidateLightModelfv(Context *context, GLenum pname, const GLfloat *params);
bool ValidateLightModelx(Context *context, GLenum pname, GLfixed param);
bool ValidateLightModelxv(Context *context, GLenum pname, const GLfixed *param);
bool ValidateLightf(Context *context, GLenum light, GLenum pname, GLfloat param);
bool ValidateLightfv(Context *context, GLenum light, GLenum pname, const GLfloat *params);
bool ValidateLightx(Context *context, GLenum light, GLenum pname, GLfixed param);
bool ValidateLightxv(Context *context, GLenum light, GLenum pname, const GLfixed *params);
bool ValidateLineWidthx(Context *context, GLfixed width);
bool ValidateLoadIdentity(Context *context);
bool ValidateLoadMatrixf(Context *context, const GLfloat *m);
bool ValidateLoadMatrixx(Context *context, const GLfixed *m);
bool ValidateLogicOp(Context *context, GLenum opcode);
bool ValidateMaterialf(Context *context, GLenum face, GLenum pname, GLfloat param);
bool ValidateMaterialfv(Context *context, GLenum face, GLenum pname, const GLfloat *params);
bool ValidateMaterialx(Context *context, GLenum face, GLenum pname, GLfixed param);
bool ValidateMaterialxv(Context *context, GLenum face, GLenum pname, const GLfixed *param);
bool ValidateMatrixMode(Context *context, GLenum mode);
bool ValidateMultMatrixf(Context *context, const GLfloat *m);
bool ValidateMultMatrixx(Context *context, const GLfixed *m);
bool ValidateMultiTexCoord4f(Context *context,
GLenum target,
GLfloat s,
GLfloat t,
GLfloat r,
GLfloat q);
bool ValidateMultiTexCoord4x(Context *context,
GLenum texture,
GLfixed s,
GLfixed t,
GLfixed r,
GLfixed q);
bool ValidateNormal3f(Context *context, GLfloat nx, GLfloat ny, GLfloat nz);
bool ValidateNormal3x(Context *context, GLfixed nx, GLfixed ny, GLfixed nz);
bool ValidateNormalPointer(Context *context, GLenum type, GLsizei stride, const void *pointer);
bool ValidateOrthof(Context *context,
GLfloat l,
GLfloat r,
GLfloat b,
GLfloat t,
GLfloat n,
GLfloat f);
bool ValidateOrthox(Context *context,
GLfixed l,
GLfixed r,
GLfixed b,
GLfixed t,
GLfixed n,
GLfixed f);
bool ValidatePointParameterf(Context *context, GLenum pname, GLfloat param);
bool ValidatePointParameterfv(Context *context, GLenum pname, const GLfloat *params);
bool ValidatePointParameterx(Context *context, GLenum pname, GLfixed param);
bool ValidatePointParameterxv(Context *context, GLenum pname, const GLfixed *params);
bool ValidatePointSize(Context *context, GLfloat size);
bool ValidatePointSizex(Context *context, GLfixed size);
bool ValidatePolygonOffsetx(Context *context, GLfixed factor, GLfixed units);
bool ValidatePopMatrix(Context *context);
bool ValidatePushMatrix(Context *context);
bool ValidateRotatef(Context *context, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
bool ValidateRotatex(Context *context, GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
bool ValidateSampleCoveragex(Context *context, GLclampx value, GLboolean invert);
bool ValidateScalef(Context *context, GLfloat x, GLfloat y, GLfloat z);
bool ValidateScalex(Context *context, GLfixed x, GLfixed y, GLfixed z);
bool ValidateShadeModel(Context *context, GLenum mode);
bool ValidateTexCoordPointer(Context *context,
GLint size,
GLenum type,
GLsizei stride,
const void *pointer);
bool ValidateTexEnvf(Context *context, GLenum target, GLenum pname, GLfloat param);
bool ValidateTexEnvfv(Context *context, GLenum target, GLenum pname, const GLfloat *params);
bool ValidateTexEnvi(Context *context, GLenum target, GLenum pname, GLint param);
bool ValidateTexEnviv(Context *context, GLenum target, GLenum pname, const GLint *params);
bool ValidateTexEnvx(Context *context, GLenum target, GLenum pname, GLfixed param);
bool ValidateTexEnvxv(Context *context, GLenum target, GLenum pname, const GLfixed *params);
bool ValidateTexParameterx(Context *context, TextureType target, GLenum pname, GLfixed param);
bool ValidateTexParameterxv(Context *context,
TextureType target,
GLenum pname,
const GLfixed *params);
bool ValidateTranslatef(Context *context, GLfloat x, GLfloat y, GLfloat z);
bool ValidateTranslatex(Context *context, GLfixed x, GLfixed y, GLfixed z);
bool ValidateVertexPointer(Context *context,
GLint size,
GLenum type,
GLsizei stride,
const void *pointer);
// GL_OES_draw_texture
bool ValidateDrawTexfOES(Context *context,
GLfloat x,
GLfloat y,
GLfloat z,
GLfloat width,
GLfloat height);
bool ValidateDrawTexfvOES(Context *context, const GLfloat *coords);
bool ValidateDrawTexiOES(Context *context, GLint x, GLint y, GLint z, GLint width, GLint height);
bool ValidateDrawTexivOES(Context *context, const GLint *coords);
bool ValidateDrawTexsOES(Context *context,
GLshort x,
GLshort y,
GLshort z,
GLshort width,
GLshort height);
bool ValidateDrawTexsvOES(Context *context, const GLshort *coords);
bool ValidateDrawTexxOES(Context *context,
GLfixed x,
GLfixed y,
GLfixed z,
GLfixed width,
GLfixed height);
bool ValidateDrawTexxvOES(Context *context, const GLfixed *coords);
// GL_OES_matrix_palette
bool ValidateCurrentPaletteMatrixOES(Context *context, GLuint matrixpaletteindex);
bool ValidateLoadPaletteFromModelViewMatrixOES(Context *context);
bool ValidateMatrixIndexPointerOES(Context *context,
GLint size,
GLenum type,
GLsizei stride,
const void *pointer);
bool ValidateWeightPointerOES(Context *context,
GLint size,
GLenum type,
GLsizei stride,
const void *pointer);
// GL_OES_point_size_array
bool ValidatePointSizePointerOES(Context *context,
GLenum type,
GLsizei stride,
const void *pointer);
// GL_OES_query_matrix
bool ValidateQueryMatrixxOES(Context *context, GLfixed *mantissa, GLint *exponent);
}
#endif // LIBANGLE_VALIDATION_ES1_H_