mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 14:18:31 +09:00
The binding-point half of ARB_vertex_attrib_binding was implemented, but nothing
outside it could see the result. glGetIntegerv answered GL_MAX_VERTEX_ATTRIB_BINDINGS,
GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET and GL_MAX_VERTEX_ATTRIB_STRIDE with a hardcoded
0 and a comment saying the entry points were stubs, which they no longer are. An
application that sizes its loops off those limits therefore saw none, and every
"bindingindex must be less than MAX_VERTEX_ATTRIB_BINDINGS" check silently accepted
everything because the limit it validated against was not the one it reported.
The indexed getters answer GL_VERTEX_BINDING_{BUFFER,DIVISOR,OFFSET,STRIDE} from the
bound vertex array now, and the non-indexed getter reports them as indexed-only rather
than returning a fabricated 0.
glVertexAttribPointer is defined in terms of the binding model: it also points the
attribute at its own binding point and gives that point the buffer, the pointer as the
offset and the effective (never zero) stride. MobileGL resolved the pointer form
straight into the flat attribute view and left the binding point untouched, so
GL_VERTEX_BINDING_OFFSET read back 0 for every attribute set up the classic way. The
flat view keeps the raw stride, because GL_VERTEX_ATTRIB_ARRAY_STRIDE reports that
argument verbatim, so the binding point is recorded alongside it rather than resolved
from it. glVertexAttribDivisor likewise now moves the binding point's divisor.
The by-name entry points reject vertex array 0. MobileGL keeps a real object at index 0
for the compatibility paths, so the name validation used to let the default vertex array
through a direct-state-access call that has no such thing.
glVertexAttribFormat and friends validated with the pointer-only subset, which reports
GL_BGRA as an out-of-range size instead of applying the BGRA rules, and never saw
relativeoffset at all. They share the full format validation now, which also grew the
GL_UNSIGNED_INT_10F_11F_11F_REV rules - that type has no DataType of its own, so it has
to be recognised before the conversion turns it into Unknown and reports the wrong error.
glVertexAttribLFormat and glVertexArrayAttribLFormat were stubs. They validate their
arguments now and then report that 64-bit vertex attributes are unsupported, which is
honest; silently accepting a format that can never be used is not.
Takes direct_state_access.vertex_arrays_* from 12 to 17 of 19 on both backends.
125 lines
8.2 KiB
C++
125 lines
8.2 KiB
C++
// MobileGL - MobileGL/MG_Impl/GLImpl/VertexArray/GL_VertexArray.h
|
|
// Copyright (c) 2025-2026 MobileGL-Dev
|
|
// Licensed under the GNU Lesser General Public License v3.0:
|
|
// https://www.gnu.org/licenses/gpl-3.0.txt
|
|
// https://www.gnu.org/licenses/lgpl-3.0.txt
|
|
// SPDX-License-Identifier: LGPL-3.0-only
|
|
// End of Source File Header
|
|
|
|
#pragma once
|
|
#include <Includes.h>
|
|
|
|
namespace MobileGL::MG_Impl::GLImpl {
|
|
/* @INSERTION_POINT:FUNCTION_DECLARATION@ */
|
|
void VertexAttrib1f(GLuint index, GLfloat x);
|
|
void VertexAttrib1fv(GLuint index, const GLfloat* v);
|
|
void VertexAttrib2f(GLuint index, GLfloat x, GLfloat y);
|
|
void VertexAttrib2fv(GLuint index, const GLfloat* v);
|
|
void VertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z);
|
|
void VertexAttrib3fv(GLuint index, const GLfloat* v);
|
|
void VertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
|
void VertexAttrib4fv(GLuint index, const GLfloat* v);
|
|
void VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);
|
|
void VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
|
|
void VertexAttribI4iv(GLuint index, const GLint* v);
|
|
void VertexAttribI4uiv(GLuint index, const GLuint* v);
|
|
// Packed current-value setters (GL_INT_/GL_UNSIGNED_INT_2_10_10_10_REV). Decode one packed word
|
|
// into the first 1/2/3/4 components of the generic attribute's float current value.
|
|
void VertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
|
|
void VertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
|
|
void VertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
|
|
void VertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
|
|
void VertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint* value);
|
|
void VertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint* value);
|
|
void VertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint* value);
|
|
void VertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint* value);
|
|
void VertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
|
|
void VertexAttrib4Nubv(GLuint index, const GLubyte* v);
|
|
void VertexAttrib4ubv(GLuint index, const GLubyte* v);
|
|
// Float-domain current-value setters that funnel into VertexAttrib4f. The d/s/bv/iv/uiv/usv
|
|
// forms are value-preserving (only the 4N* forms normalize per GL 3.3 Core Eq 2.1/2.2).
|
|
void VertexAttrib1d(GLuint index, GLdouble x);
|
|
void VertexAttrib2d(GLuint index, GLdouble x, GLdouble y);
|
|
void VertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);
|
|
void VertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
|
|
void VertexAttrib1dv(GLuint index, const GLdouble* v);
|
|
void VertexAttrib2dv(GLuint index, const GLdouble* v);
|
|
void VertexAttrib3dv(GLuint index, const GLdouble* v);
|
|
void VertexAttrib4dv(GLuint index, const GLdouble* v);
|
|
void VertexAttrib1s(GLuint index, GLshort x);
|
|
void VertexAttrib2s(GLuint index, GLshort x, GLshort y);
|
|
void VertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z);
|
|
void VertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
|
|
void VertexAttrib1sv(GLuint index, const GLshort* v);
|
|
void VertexAttrib2sv(GLuint index, const GLshort* v);
|
|
void VertexAttrib3sv(GLuint index, const GLshort* v);
|
|
void VertexAttrib4sv(GLuint index, const GLshort* v);
|
|
void VertexAttrib4bv(GLuint index, const GLbyte* v);
|
|
void VertexAttrib4iv(GLuint index, const GLint* v);
|
|
void VertexAttrib4uiv(GLuint index, const GLuint* v);
|
|
void VertexAttrib4usv(GLuint index, const GLushort* v);
|
|
void VertexAttrib4Nbv(GLuint index, const GLbyte* v);
|
|
void VertexAttrib4Nsv(GLuint index, const GLshort* v);
|
|
void VertexAttrib4Niv(GLuint index, const GLint* v);
|
|
void VertexAttrib4Nusv(GLuint index, const GLushort* v);
|
|
void VertexAttrib4Nuiv(GLuint index, const GLuint* v);
|
|
// Pure-integer current-value setters that funnel into VertexAttribI4i / VertexAttribI4ui and
|
|
// write the integer view, never the float one.
|
|
void VertexAttribI1i(GLuint index, GLint x);
|
|
void VertexAttribI2i(GLuint index, GLint x, GLint y);
|
|
void VertexAttribI3i(GLuint index, GLint x, GLint y, GLint z);
|
|
void VertexAttribI1ui(GLuint index, GLuint x);
|
|
void VertexAttribI2ui(GLuint index, GLuint x, GLuint y);
|
|
void VertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z);
|
|
void VertexAttribI1iv(GLuint index, const GLint* v);
|
|
void VertexAttribI2iv(GLuint index, const GLint* v);
|
|
void VertexAttribI3iv(GLuint index, const GLint* v);
|
|
void VertexAttribI1uiv(GLuint index, const GLuint* v);
|
|
void VertexAttribI2uiv(GLuint index, const GLuint* v);
|
|
void VertexAttribI3uiv(GLuint index, const GLuint* v);
|
|
void VertexAttribI4bv(GLuint index, const GLbyte* v);
|
|
void VertexAttribI4sv(GLuint index, const GLshort* v);
|
|
void VertexAttribI4ubv(GLuint index, const GLubyte* v);
|
|
void VertexAttribI4usv(GLuint index, const GLushort* v);
|
|
void GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params);
|
|
void GetVertexAttribdv(GLuint index, GLenum pname, GLdouble* params);
|
|
void GetVertexAttribiv(GLuint index, GLenum pname, GLint* params);
|
|
void GetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer);
|
|
void GetVertexAttribIiv(GLuint index, GLenum pname, GLint* params);
|
|
void GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params);
|
|
void CreateVertexArrays(GLsizei n, GLuint* arrays);
|
|
void DisableVertexArrayAttrib(GLuint vaobj, GLuint index);
|
|
void EnableVertexArrayAttrib(GLuint vaobj, GLuint index);
|
|
void VertexArrayElementBuffer(GLuint vaobj, GLuint buffer);
|
|
void VertexArrayVertexBuffer(GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
|
|
void GetVertexArrayiv(GLuint vaobj, GLenum pname, GLint* param);
|
|
void GetVertexArrayIndexediv(GLuint vaobj, GLuint index, GLenum pname, GLint* param);
|
|
void GetVertexArrayIndexed64iv(GLuint vaobj, GLuint index, GLenum pname, GLint64* param);
|
|
void VertexArrayAttribFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized,
|
|
GLuint relativeoffset);
|
|
void VertexArrayAttribIFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
|
|
void VertexArrayAttribLFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
|
|
void VertexArrayAttribBinding(GLuint vaobj, GLuint attribindex, GLuint bindingindex);
|
|
void VertexArrayBindingDivisor(GLuint vaobj, GLuint bindingindex, GLuint divisor);
|
|
void VertexArrayVertexBuffers(GLuint vaobj, GLuint first, GLsizei count, const GLuint* buffers,
|
|
const GLintptr* offsets, const GLsizei* strides);
|
|
void BindVertexBuffer(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
|
|
void BindVertexBuffers(GLuint first, GLsizei count, const GLuint* buffers, const GLintptr* offsets,
|
|
const GLsizei* strides);
|
|
void VertexAttribFormat(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
|
|
void VertexAttribIFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
|
|
void VertexAttribLFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
|
|
void VertexAttribBinding(GLuint attribindex, GLuint bindingindex);
|
|
void VertexBindingDivisor(GLuint bindingindex, GLuint divisor);
|
|
void VertexAttribDivisor(GLuint index, GLuint divisor);
|
|
GLboolean IsVertexArray(GLuint array);
|
|
void DisableVertexAttribArray(GLuint index);
|
|
void EnableVertexAttribArray(GLuint index);
|
|
void VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void* pointer);
|
|
void VertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride,
|
|
const void* pointer);
|
|
void BindVertexArray(GLuint array);
|
|
void DeleteVertexArrays(GLsizei n, const GLuint* arrays);
|
|
void GenVertexArrays(GLsizei n, GLuint* arrays);
|
|
} // namespace MobileGL::MG_Impl::GLImpl
|