Commit abb09f12 by Lingfeng Yang Committed by Commit Bot

GLES1: Client vertex array pointer API

glVertexPointer glNormalPointer glColorPointer glPointSizePointerOES glTexCoordPointer BUG=angleproject:2306 Change-Id: Id022b467ac998ea116130c5cec0c77afefb0dd4c Reviewed-on: https://chromium-review.googlesource.com/1014381 Commit-Queue: Lingfeng Yang <lfy@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 427064d2
...@@ -1665,6 +1665,38 @@ void Context::getIntegervImpl(GLenum pname, GLint *params) ...@@ -1665,6 +1665,38 @@ void Context::getIntegervImpl(GLenum pname, GLint *params)
case GL_MAX_TEXTURE_STACK_DEPTH: case GL_MAX_TEXTURE_STACK_DEPTH:
*params = mCaps.maxTextureMatrixStackDepth; *params = mCaps.maxTextureMatrixStackDepth;
break; break;
// GLES1 emulation: Vertex attribute queries
case GL_VERTEX_ARRAY_BUFFER_BINDING:
case GL_NORMAL_ARRAY_BUFFER_BINDING:
case GL_COLOR_ARRAY_BUFFER_BINDING:
case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES:
case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING:
getVertexAttribiv(static_cast<GLuint>(vertexArrayIndex(ParamToVertexArrayType(pname))),
GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, params);
break;
case GL_VERTEX_ARRAY_STRIDE:
case GL_NORMAL_ARRAY_STRIDE:
case GL_COLOR_ARRAY_STRIDE:
case GL_POINT_SIZE_ARRAY_STRIDE_OES:
case GL_TEXTURE_COORD_ARRAY_STRIDE:
getVertexAttribiv(static_cast<GLuint>(vertexArrayIndex(ParamToVertexArrayType(pname))),
GL_VERTEX_ATTRIB_ARRAY_STRIDE, params);
break;
case GL_VERTEX_ARRAY_SIZE:
case GL_COLOR_ARRAY_SIZE:
case GL_TEXTURE_COORD_ARRAY_SIZE:
getVertexAttribiv(static_cast<GLuint>(vertexArrayIndex(ParamToVertexArrayType(pname))),
GL_VERTEX_ATTRIB_ARRAY_SIZE, params);
break;
case GL_VERTEX_ARRAY_TYPE:
case GL_COLOR_ARRAY_TYPE:
case GL_NORMAL_ARRAY_TYPE:
case GL_POINT_SIZE_ARRAY_TYPE_OES:
case GL_TEXTURE_COORD_ARRAY_TYPE:
getVertexAttribiv(static_cast<GLuint>(vertexArrayIndex(ParamToVertexArrayType(pname))),
GL_VERTEX_ATTRIB_ARRAY_TYPE, params);
break;
default: default:
handleError(mGLState.getIntegerv(this, pname, params)); handleError(mGLState.getIntegerv(this, pname, params));
break; break;
...@@ -1709,7 +1741,7 @@ void Context::getInteger64vImpl(GLenum pname, GLint64 *params) ...@@ -1709,7 +1741,7 @@ void Context::getInteger64vImpl(GLenum pname, GLint64 *params)
void Context::getPointerv(GLenum pname, void **params) const void Context::getPointerv(GLenum pname, void **params) const
{ {
mGLState.getPointerv(pname, params); mGLState.getPointerv(this, pname, params);
} }
void Context::getPointervRobustANGLERobust(GLenum pname, void Context::getPointervRobustANGLERobust(GLenum pname,
...@@ -6978,6 +7010,24 @@ bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *nu ...@@ -6978,6 +7010,24 @@ bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *nu
case GL_MAX_MODELVIEW_STACK_DEPTH: case GL_MAX_MODELVIEW_STACK_DEPTH:
case GL_MAX_PROJECTION_STACK_DEPTH: case GL_MAX_PROJECTION_STACK_DEPTH:
case GL_MAX_TEXTURE_STACK_DEPTH: case GL_MAX_TEXTURE_STACK_DEPTH:
case GL_VERTEX_ARRAY_STRIDE:
case GL_NORMAL_ARRAY_STRIDE:
case GL_COLOR_ARRAY_STRIDE:
case GL_TEXTURE_COORD_ARRAY_STRIDE:
case GL_VERTEX_ARRAY_SIZE:
case GL_COLOR_ARRAY_SIZE:
case GL_TEXTURE_COORD_ARRAY_SIZE:
case GL_VERTEX_ARRAY_TYPE:
case GL_NORMAL_ARRAY_TYPE:
case GL_COLOR_ARRAY_TYPE:
case GL_TEXTURE_COORD_ARRAY_TYPE:
case GL_VERTEX_ARRAY_BUFFER_BINDING:
case GL_NORMAL_ARRAY_BUFFER_BINDING:
case GL_COLOR_ARRAY_BUFFER_BINDING:
case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING:
case GL_POINT_SIZE_ARRAY_STRIDE_OES:
case GL_POINT_SIZE_ARRAY_TYPE_OES:
case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES:
*type = GL_INT; *type = GL_INT;
*numParams = 1; *numParams = 1;
return true; return true;
......
...@@ -1457,6 +1457,9 @@ class Context final : angle::NonCopyable ...@@ -1457,6 +1457,9 @@ class Context final : angle::NonCopyable
bool isValidBufferBinding(BufferBinding binding) const { return mValidBufferBindings[binding]; } bool isValidBufferBinding(BufferBinding binding) const { return mValidBufferBindings[binding]; }
// GLES1 emulation: Renderer level (for validation)
int vertexArrayIndex(ClientVertexArrayType type) const;
private: private:
Error prepareForDraw(); Error prepareForDraw();
Error prepareForClear(GLbitfield mask); Error prepareForClear(GLbitfield mask);
......
...@@ -87,7 +87,8 @@ void Context::color4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) ...@@ -87,7 +87,8 @@ void Context::color4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
void Context::colorPointer(GLint size, GLenum type, GLsizei stride, const void *ptr) void Context::colorPointer(GLint size, GLenum type, GLsizei stride, const void *ptr)
{ {
UNIMPLEMENTED(); vertexAttribPointer(vertexArrayIndex(ClientVertexArrayType::Color), size, type, GL_FALSE,
stride, ptr);
} }
void Context::depthRangex(GLfixed n, GLfixed f) void Context::depthRangex(GLfixed n, GLfixed f)
...@@ -98,11 +99,13 @@ void Context::depthRangex(GLfixed n, GLfixed f) ...@@ -98,11 +99,13 @@ void Context::depthRangex(GLfixed n, GLfixed f)
void Context::disableClientState(ClientVertexArrayType clientState) void Context::disableClientState(ClientVertexArrayType clientState)
{ {
mGLState.gles1().setClientStateEnabled(clientState, false); mGLState.gles1().setClientStateEnabled(clientState, false);
disableVertexAttribArray(vertexArrayIndex(clientState));
} }
void Context::enableClientState(ClientVertexArrayType clientState) void Context::enableClientState(ClientVertexArrayType clientState)
{ {
mGLState.gles1().setClientStateEnabled(clientState, true); mGLState.gles1().setClientStateEnabled(clientState, true);
enableVertexAttribArray(vertexArrayIndex(clientState));
} }
void Context::fogf(GLenum pname, GLfloat param) void Context::fogf(GLenum pname, GLfloat param)
...@@ -319,7 +322,8 @@ void Context::normal3x(GLfixed nx, GLfixed ny, GLfixed nz) ...@@ -319,7 +322,8 @@ void Context::normal3x(GLfixed nx, GLfixed ny, GLfixed nz)
void Context::normalPointer(GLenum type, GLsizei stride, const void *ptr) void Context::normalPointer(GLenum type, GLsizei stride, const void *ptr)
{ {
UNIMPLEMENTED(); vertexAttribPointer(vertexArrayIndex(ClientVertexArrayType::Normal), 3, type, GL_FALSE, stride,
ptr);
} }
void Context::orthof(GLfloat left, void Context::orthof(GLfloat left,
...@@ -418,7 +422,8 @@ void Context::shadeModel(GLenum mode) ...@@ -418,7 +422,8 @@ void Context::shadeModel(GLenum mode)
void Context::texCoordPointer(GLint size, GLenum type, GLsizei stride, const void *ptr) void Context::texCoordPointer(GLint size, GLenum type, GLsizei stride, const void *ptr)
{ {
UNIMPLEMENTED(); vertexAttribPointer(vertexArrayIndex(ClientVertexArrayType::TextureCoord), size, type, GL_FALSE,
stride, ptr);
} }
void Context::texEnvf(GLenum target, GLenum pname, GLfloat param) void Context::texEnvf(GLenum target, GLenum pname, GLfloat param)
...@@ -474,7 +479,8 @@ void Context::translatex(GLfixed x, GLfixed y, GLfixed z) ...@@ -474,7 +479,8 @@ void Context::translatex(GLfixed x, GLfixed y, GLfixed z)
void Context::vertexPointer(GLint size, GLenum type, GLsizei stride, const void *ptr) void Context::vertexPointer(GLint size, GLenum type, GLsizei stride, const void *ptr)
{ {
UNIMPLEMENTED(); vertexAttribPointer(vertexArrayIndex(ClientVertexArrayType::Vertex), size, type, GL_FALSE,
stride, ptr);
} }
// GL_OES_draw_texture // GL_OES_draw_texture
...@@ -542,7 +548,8 @@ void Context::weightPointer(GLint size, GLenum type, GLsizei stride, const void ...@@ -542,7 +548,8 @@ void Context::weightPointer(GLint size, GLenum type, GLsizei stride, const void
// GL_OES_point_size_array // GL_OES_point_size_array
void Context::pointSizePointer(GLenum type, GLsizei stride, const void *ptr) void Context::pointSizePointer(GLenum type, GLsizei stride, const void *ptr)
{ {
UNIMPLEMENTED(); vertexAttribPointer(vertexArrayIndex(ClientVertexArrayType::PointSize), 1, type, GL_FALSE,
stride, ptr);
} }
// GL_OES_query_matrix // GL_OES_query_matrix
...@@ -598,4 +605,25 @@ void Context::texGenxv(GLenum coord, GLenum pname, const GLint *params) ...@@ -598,4 +605,25 @@ void Context::texGenxv(GLenum coord, GLenum pname, const GLint *params)
UNIMPLEMENTED(); UNIMPLEMENTED();
} }
int Context::vertexArrayIndex(ClientVertexArrayType type) const
{
switch (type)
{
case ClientVertexArrayType::Vertex:
return 0;
case ClientVertexArrayType::Normal:
return 1;
case ClientVertexArrayType::Color:
return 2;
case ClientVertexArrayType::PointSize:
return 3;
case ClientVertexArrayType::TextureCoord:
return 4 + mGLState.gles1().getClientTextureUnit();
default:
UNREACHABLE();
return 0;
}
}
// static
} // namespace gl } // namespace gl
...@@ -99,6 +99,7 @@ ERRMSG(InvalidMultitextureUnit, ...@@ -99,6 +99,7 @@ ERRMSG(InvalidMultitextureUnit,
ERRMSG(InvalidName, "Invalid name."); ERRMSG(InvalidName, "Invalid name.");
ERRMSG(InvalidNameCharacters, "Name contains invalid characters."); ERRMSG(InvalidNameCharacters, "Name contains invalid characters.");
ERRMSG(InvalidPname, "Invalid pname."); ERRMSG(InvalidPname, "Invalid pname.");
ERRMSG(InvalidPointerQuery, "Invalid pointer query.");
ERRMSG(InvalidPrecision, "Invalid or unsupported precision type."); ERRMSG(InvalidPrecision, "Invalid or unsupported precision type.");
ERRMSG(InvalidProgramName, "Program object expected."); ERRMSG(InvalidProgramName, "Program object expected.");
ERRMSG(InvalidProjectionMatrix, ERRMSG(InvalidProjectionMatrix,
...@@ -129,6 +130,9 @@ ERRMSG(InvalidType, "Invalid type."); ...@@ -129,6 +130,9 @@ ERRMSG(InvalidType, "Invalid type.");
ERRMSG(InvalidTypePureInt, "Invalid type, should be integer"); ERRMSG(InvalidTypePureInt, "Invalid type, should be integer");
ERRMSG(InvalidUnpackAlignment, "Unpack alignment must be 1, 2, 4, or 8."); ERRMSG(InvalidUnpackAlignment, "Unpack alignment must be 1, 2, 4, or 8.");
ERRMSG(InvalidVertexAttrSize, "Vertex attribute size must be 1, 2, 3, or 4."); ERRMSG(InvalidVertexAttrSize, "Vertex attribute size must be 1, 2, 3, or 4.");
ERRMSG(InvalidVertexPointerSize, "Size for built-in vertex attribute is outside allowed range.");
ERRMSG(InvalidVertexPointerStride, "Invalid stride for built-in vertex attribute.");
ERRMSG(InvalidVertexPointerType, "Invalid type for built-in vertex attribute.");
ERRMSG(InvalidWidth, "Invalid width."); ERRMSG(InvalidWidth, "Invalid width.");
ERRMSG(InvalidWrapModeTexture, "Invalid wrap mode for texture type."); ERRMSG(InvalidWrapModeTexture, "Invalid wrap mode for texture type.");
ERRMSG(LevelNotZero, "Texture level must be zero."); ERRMSG(LevelNotZero, "Texture level must be zero.");
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "libANGLE/VertexArray.h" #include "libANGLE/VertexArray.h"
#include "libANGLE/formatutils.h" #include "libANGLE/formatutils.h"
#include "libANGLE/queryconversions.h" #include "libANGLE/queryconversions.h"
#include "libANGLE/queryutils.h"
#include "libANGLE/renderer/ContextImpl.h" #include "libANGLE/renderer/ContextImpl.h"
namespace namespace
...@@ -2361,7 +2362,7 @@ Error State::getIntegerv(const Context *context, GLenum pname, GLint *params) ...@@ -2361,7 +2362,7 @@ Error State::getIntegerv(const Context *context, GLenum pname, GLint *params)
return NoError(); return NoError();
} }
void State::getPointerv(GLenum pname, void **params) const void State::getPointerv(const Context *context, GLenum pname, void **params) const
{ {
switch (pname) switch (pname)
{ {
...@@ -2371,6 +2372,15 @@ void State::getPointerv(GLenum pname, void **params) const ...@@ -2371,6 +2372,15 @@ void State::getPointerv(GLenum pname, void **params) const
case GL_DEBUG_CALLBACK_USER_PARAM: case GL_DEBUG_CALLBACK_USER_PARAM:
*params = const_cast<void *>(mDebug.getUserParam()); *params = const_cast<void *>(mDebug.getUserParam());
break; break;
case GL_VERTEX_ARRAY_POINTER:
case GL_NORMAL_ARRAY_POINTER:
case GL_COLOR_ARRAY_POINTER:
case GL_TEXTURE_COORD_ARRAY_POINTER:
case GL_POINT_SIZE_ARRAY_POINTER_OES:
QueryVertexAttribPointerv(getVertexArray()->getVertexAttribute(
context->vertexArrayIndex(ParamToVertexArrayType(pname))),
GL_VERTEX_ATTRIB_ARRAY_POINTER, params);
return;
default: default:
UNREACHABLE(); UNREACHABLE();
break; break;
......
...@@ -335,7 +335,7 @@ class State : public angle::ObserverInterface, angle::NonCopyable ...@@ -335,7 +335,7 @@ class State : public angle::ObserverInterface, angle::NonCopyable
void getBooleanv(GLenum pname, GLboolean *params); void getBooleanv(GLenum pname, GLboolean *params);
void getFloatv(GLenum pname, GLfloat *params); void getFloatv(GLenum pname, GLfloat *params);
Error getIntegerv(const Context *context, GLenum pname, GLint *params); Error getIntegerv(const Context *context, GLenum pname, GLint *params);
void getPointerv(GLenum pname, void **params) const; void getPointerv(const Context *context, GLenum pname, void **params) const;
void getIntegeri_v(GLenum target, GLuint index, GLint *data); void getIntegeri_v(GLenum target, GLuint index, GLint *data);
void getInteger64i_v(GLenum target, GLuint index, GLint64 *data); void getInteger64i_v(GLenum target, GLuint index, GLint64 *data);
void getBooleani_v(GLenum target, GLuint index, GLboolean *data); void getBooleani_v(GLenum target, GLuint index, GLboolean *data);
......
...@@ -1688,6 +1688,49 @@ void QueryProgramInterfaceiv(const Program *program, ...@@ -1688,6 +1688,49 @@ void QueryProgramInterfaceiv(const Program *program,
} }
} }
ClientVertexArrayType ParamToVertexArrayType(GLenum param)
{
switch (param)
{
case GL_VERTEX_ARRAY:
case GL_VERTEX_ARRAY_BUFFER_BINDING:
case GL_VERTEX_ARRAY_STRIDE:
case GL_VERTEX_ARRAY_SIZE:
case GL_VERTEX_ARRAY_TYPE:
case GL_VERTEX_ARRAY_POINTER:
return ClientVertexArrayType::Vertex;
case GL_NORMAL_ARRAY:
case GL_NORMAL_ARRAY_BUFFER_BINDING:
case GL_NORMAL_ARRAY_STRIDE:
case GL_NORMAL_ARRAY_TYPE:
case GL_NORMAL_ARRAY_POINTER:
return ClientVertexArrayType::Normal;
case GL_COLOR_ARRAY:
case GL_COLOR_ARRAY_BUFFER_BINDING:
case GL_COLOR_ARRAY_STRIDE:
case GL_COLOR_ARRAY_SIZE:
case GL_COLOR_ARRAY_TYPE:
case GL_COLOR_ARRAY_POINTER:
return ClientVertexArrayType::Color;
case GL_POINT_SIZE_ARRAY_OES:
case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES:
case GL_POINT_SIZE_ARRAY_STRIDE_OES:
case GL_POINT_SIZE_ARRAY_TYPE_OES:
case GL_POINT_SIZE_ARRAY_POINTER_OES:
return ClientVertexArrayType::PointSize;
case GL_TEXTURE_COORD_ARRAY:
case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING:
case GL_TEXTURE_COORD_ARRAY_STRIDE:
case GL_TEXTURE_COORD_ARRAY_SIZE:
case GL_TEXTURE_COORD_ARRAY_TYPE:
case GL_TEXTURE_COORD_ARRAY_POINTER:
return ClientVertexArrayType::TextureCoord;
default:
UNREACHABLE();
return ClientVertexArrayType::InvalidEnum;
}
}
} // namespace gl } // namespace gl
namespace egl namespace egl
......
...@@ -145,6 +145,8 @@ void QueryProgramInterfaceiv(const Program *program, ...@@ -145,6 +145,8 @@ void QueryProgramInterfaceiv(const Program *program,
GLenum pname, GLenum pname,
GLint *params); GLint *params);
ClientVertexArrayType ParamToVertexArrayType(GLenum param);
} // namespace gl } // namespace gl
namespace egl namespace egl
......
...@@ -23,18 +23,18 @@ ...@@ -23,18 +23,18 @@
namespace gl namespace gl
{ {
bool ValidateAlphaFuncCommon(gl::Context *context, gl::AlphaTestFunc func) bool ValidateAlphaFuncCommon(Context *context, AlphaTestFunc func)
{ {
switch (func) switch (func)
{ {
case gl::AlphaTestFunc::AlwaysPass: case AlphaTestFunc::AlwaysPass:
case gl::AlphaTestFunc::Equal: case AlphaTestFunc::Equal:
case gl::AlphaTestFunc::Gequal: case AlphaTestFunc::Gequal:
case gl::AlphaTestFunc::Greater: case AlphaTestFunc::Greater:
case gl::AlphaTestFunc::Lequal: case AlphaTestFunc::Lequal:
case gl::AlphaTestFunc::Less: case AlphaTestFunc::Less:
case gl::AlphaTestFunc::Never: case AlphaTestFunc::Never:
case gl::AlphaTestFunc::NotEqual: case AlphaTestFunc::NotEqual:
return true; return true;
default: default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported); ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
...@@ -42,17 +42,17 @@ bool ValidateAlphaFuncCommon(gl::Context *context, gl::AlphaTestFunc func) ...@@ -42,17 +42,17 @@ bool ValidateAlphaFuncCommon(gl::Context *context, gl::AlphaTestFunc func)
} }
} }
bool ValidateClientStateCommon(gl::Context *context, gl::ClientVertexArrayType arrayType) bool ValidateClientStateCommon(Context *context, ClientVertexArrayType arrayType)
{ {
ANGLE_VALIDATE_IS_GLES1(context); ANGLE_VALIDATE_IS_GLES1(context);
switch (arrayType) switch (arrayType)
{ {
case gl::ClientVertexArrayType::Vertex: case ClientVertexArrayType::Vertex:
case gl::ClientVertexArrayType::Normal: case ClientVertexArrayType::Normal:
case gl::ClientVertexArrayType::Color: case ClientVertexArrayType::Color:
case gl::ClientVertexArrayType::TextureCoord: case ClientVertexArrayType::TextureCoord:
return true; return true;
case gl::ClientVertexArrayType::PointSize: case ClientVertexArrayType::PointSize:
if (!context->getExtensions().pointSizeArray) if (!context->getExtensions().pointSizeArray)
{ {
ANGLE_VALIDATION_ERR(context, InvalidEnum(), PointSizeArrayExtensionNotEnabled); ANGLE_VALIDATION_ERR(context, InvalidEnum(), PointSizeArrayExtensionNotEnabled);
...@@ -65,6 +65,88 @@ bool ValidateClientStateCommon(gl::Context *context, gl::ClientVertexArrayType a ...@@ -65,6 +65,88 @@ bool ValidateClientStateCommon(gl::Context *context, gl::ClientVertexArrayType a
} }
} }
bool ValidateBuiltinVertexAttributeCommon(Context *context,
ClientVertexArrayType arrayType,
GLint size,
GLenum type,
GLsizei stride,
const void *pointer)
{
ANGLE_VALIDATE_IS_GLES1(context);
if (stride < 0)
{
ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidVertexPointerStride);
return false;
}
int minSize = 1;
int maxSize = 4;
switch (arrayType)
{
case ClientVertexArrayType::Vertex:
case ClientVertexArrayType::TextureCoord:
minSize = 2;
maxSize = 4;
break;
case ClientVertexArrayType::Normal:
minSize = 3;
maxSize = 3;
break;
case ClientVertexArrayType::Color:
minSize = 4;
maxSize = 4;
break;
case ClientVertexArrayType::PointSize:
if (!context->getExtensions().pointSizeArray)
{
ANGLE_VALIDATION_ERR(context, InvalidEnum(), PointSizeArrayExtensionNotEnabled);
return false;
}
minSize = 1;
maxSize = 1;
break;
default:
UNREACHABLE();
return false;
}
if (size < minSize || size > maxSize)
{
ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidVertexPointerSize);
return false;
}
switch (type)
{
case GL_BYTE:
if (arrayType == ClientVertexArrayType::PointSize)
{
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidVertexPointerType);
return false;
}
break;
case GL_SHORT:
if (arrayType == ClientVertexArrayType::PointSize ||
arrayType == ClientVertexArrayType::Color)
{
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidVertexPointerType);
return false;
}
break;
case GL_FIXED:
case GL_FLOAT:
break;
default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidVertexPointerType);
return false;
}
return true;
}
} // namespace gl } // namespace gl
namespace gl namespace gl
...@@ -136,8 +218,8 @@ bool ValidateColorPointer(Context *context, ...@@ -136,8 +218,8 @@ bool ValidateColorPointer(Context *context,
GLsizei stride, GLsizei stride,
const void *pointer) const void *pointer)
{ {
UNIMPLEMENTED(); return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Color, size, type,
return true; stride, pointer);
} }
bool ValidateCullFace(Context *context, GLenum mode) bool ValidateCullFace(Context *context, GLenum mode)
...@@ -268,8 +350,19 @@ bool ValidateGetMaterialxv(Context *context, GLenum face, GLenum pname, GLfixed ...@@ -268,8 +350,19 @@ bool ValidateGetMaterialxv(Context *context, GLenum face, GLenum pname, GLfixed
bool ValidateGetPointerv(Context *context, GLenum pname, void **params) bool ValidateGetPointerv(Context *context, GLenum pname, void **params)
{ {
UNIMPLEMENTED(); ANGLE_VALIDATE_IS_GLES1(context);
return true; switch (pname)
{
case GL_VERTEX_ARRAY_POINTER:
case GL_NORMAL_ARRAY_POINTER:
case GL_COLOR_ARRAY_POINTER:
case GL_TEXTURE_COORD_ARRAY_POINTER:
case GL_POINT_SIZE_ARRAY_POINTER_OES:
return true;
default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPointerQuery);
return false;
}
} }
bool ValidateGetTexEnvfv(Context *context, GLenum target, GLenum pname, GLfloat *params) bool ValidateGetTexEnvfv(Context *context, GLenum target, GLenum pname, GLfloat *params)
...@@ -461,8 +554,8 @@ bool ValidateNormal3x(Context *context, GLfixed nx, GLfixed ny, GLfixed nz) ...@@ -461,8 +554,8 @@ bool ValidateNormal3x(Context *context, GLfixed nx, GLfixed ny, GLfixed nz)
bool ValidateNormalPointer(Context *context, GLenum type, GLsizei stride, const void *pointer) bool ValidateNormalPointer(Context *context, GLenum type, GLsizei stride, const void *pointer)
{ {
UNIMPLEMENTED(); return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Normal, 3, type,
return true; stride, pointer);
} }
bool ValidateOrthof(Context *context, bool ValidateOrthof(Context *context,
...@@ -605,8 +698,8 @@ bool ValidateTexCoordPointer(Context *context, ...@@ -605,8 +698,8 @@ bool ValidateTexCoordPointer(Context *context,
GLsizei stride, GLsizei stride,
const void *pointer) const void *pointer)
{ {
UNIMPLEMENTED(); return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::TextureCoord, size,
return true; type, stride, pointer);
} }
bool ValidateTexEnvf(Context *context, GLenum target, GLenum pname, GLfloat param) bool ValidateTexEnvf(Context *context, GLenum target, GLenum pname, GLfloat param)
...@@ -678,8 +771,8 @@ bool ValidateVertexPointer(Context *context, ...@@ -678,8 +771,8 @@ bool ValidateVertexPointer(Context *context,
GLsizei stride, GLsizei stride,
const void *pointer) const void *pointer)
{ {
UNIMPLEMENTED(); return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Vertex, size, type,
return true; stride, pointer);
} }
bool ValidateDrawTexfOES(Context *context, bool ValidateDrawTexfOES(Context *context,
...@@ -779,8 +872,8 @@ bool ValidateWeightPointerOES(Context *context, ...@@ -779,8 +872,8 @@ bool ValidateWeightPointerOES(Context *context,
bool ValidatePointSizePointerOES(Context *context, GLenum type, GLsizei stride, const void *pointer) bool ValidatePointSizePointerOES(Context *context, GLenum type, GLsizei stride, const void *pointer)
{ {
UNIMPLEMENTED(); return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::PointSize, 1, type,
return true; stride, pointer);
} }
bool ValidateQueryMatrixxOES(Context *context, GLfixed *mantissa, GLint *exponent) bool ValidateQueryMatrixxOES(Context *context, GLfixed *mantissa, GLint *exponent)
......
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
'<(angle_path)/src/tests/gl_tests/gles1/MatrixModeTest.cpp', '<(angle_path)/src/tests/gl_tests/gles1/MatrixModeTest.cpp',
'<(angle_path)/src/tests/gl_tests/gles1/MatrixMultTest.cpp', '<(angle_path)/src/tests/gl_tests/gles1/MatrixMultTest.cpp',
'<(angle_path)/src/tests/gl_tests/gles1/MatrixStackTest.cpp', '<(angle_path)/src/tests/gl_tests/gles1/MatrixStackTest.cpp',
'<(angle_path)/src/tests/gl_tests/gles1/VertexPointerTest.cpp',
'<(angle_path)/src/tests/gl_tests/GLSLTest.cpp', '<(angle_path)/src/tests/gl_tests/GLSLTest.cpp',
'<(angle_path)/src/tests/gl_tests/ImageTest.cpp', '<(angle_path)/src/tests/gl_tests/ImageTest.cpp',
'<(angle_path)/src/tests/gl_tests/IncompleteTextureTest.cpp', '<(angle_path)/src/tests/gl_tests/IncompleteTextureTest.cpp',
......
//
// Copyright 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.
//
// VertexPointerTest.cpp: Tests basic usage of built-in vertex attributes of GLES1.
#include "test_utils/ANGLETest.h"
#include "test_utils/gl_raii.h"
using namespace angle;
class VertexPointerTest : public ANGLETest
{
protected:
VertexPointerTest()
{
setWindowWidth(32);
setWindowHeight(32);
setConfigRedBits(8);
setConfigGreenBits(8);
setConfigBlueBits(8);
setConfigAlphaBits(8);
setConfigDepthBits(24);
}
};
// Checks that we can assign to client side vertex arrays
TEST_P(VertexPointerTest, AssignRetrieve)
{
std::vector<float> testVertexAttribute = {
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
};
glVertexPointer(4, GL_FLOAT, 0, testVertexAttribute.data());
EXPECT_GL_NO_ERROR();
void *ptr = nullptr;
glGetPointerv(GL_VERTEX_ARRAY_POINTER, &ptr);
EXPECT_EQ(testVertexAttribute.data(), ptr);
glColorPointer(4, GL_FLOAT, 0, testVertexAttribute.data() + 4);
glGetPointerv(GL_COLOR_ARRAY_POINTER, &ptr);
EXPECT_EQ(testVertexAttribute.data() + 4, ptr);
glNormalPointer(GL_FLOAT, 0, testVertexAttribute.data() + 8);
glGetPointerv(GL_NORMAL_ARRAY_POINTER, &ptr);
EXPECT_EQ(testVertexAttribute.data() + 8, ptr);
glPointSizePointerOES(GL_FLOAT, 0, testVertexAttribute.data() + 8);
glGetPointerv(GL_POINT_SIZE_ARRAY_POINTER_OES, &ptr);
EXPECT_EQ(testVertexAttribute.data() + 8, ptr);
GLint maxTextureUnits;
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &maxTextureUnits);
for (int i = 0; i < maxTextureUnits; i++)
{
glClientActiveTexture(GL_TEXTURE0 + i);
glTexCoordPointer(4, GL_FLOAT, 0, testVertexAttribute.data() + i * 4);
glGetPointerv(GL_TEXTURE_COORD_ARRAY_POINTER, &ptr);
EXPECT_EQ(testVertexAttribute.data() + i * 4, ptr);
}
}
ANGLE_INSTANTIATE_TEST(VertexPointerTest, ES1_D3D11(), ES1_OPENGL(), ES1_OPENGLES());
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment