To be a little more understandable.
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
/* conventional vertex arrays */
if (vao->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) {
aa->array = &vao->VertexAttrib[VERT_ATTRIB_COLOR_INDEX];
- aa->binding = &vao->VertexBinding[aa->array->BufferBindingIndex];
+ aa->binding = &vao->BufferBinding[aa->array->BufferBindingIndex];
aa->offset = IndexFuncs[TYPE_IDX(aa->array->Type)];
check_vbo(actx, aa->binding->BufferObj);
aa++;
if (vao->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled) {
aa->array = &vao->VertexAttrib[VERT_ATTRIB_EDGEFLAG];
- aa->binding = &vao->VertexBinding[aa->array->BufferBindingIndex];
+ aa->binding = &vao->BufferBinding[aa->array->BufferBindingIndex];
aa->offset = _gloffset_EdgeFlagv;
check_vbo(actx, aa->binding->BufferObj);
aa++;
if (vao->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) {
aa->array = &vao->VertexAttrib[VERT_ATTRIB_NORMAL];
- aa->binding = &vao->VertexBinding[aa->array->BufferBindingIndex];
+ aa->binding = &vao->BufferBinding[aa->array->BufferBindingIndex];
aa->offset = NormalFuncs[TYPE_IDX(aa->array->Type)];
check_vbo(actx, aa->binding->BufferObj);
aa++;
if (vao->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) {
aa->array = &vao->VertexAttrib[VERT_ATTRIB_COLOR0];
- aa->binding = &vao->VertexBinding[aa->array->BufferBindingIndex];
+ aa->binding = &vao->BufferBinding[aa->array->BufferBindingIndex];
aa->offset = ColorFuncs[aa->array->Size-3][TYPE_IDX(aa->array->Type)];
check_vbo(actx, aa->binding->BufferObj);
aa++;
if (vao->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) {
aa->array = &vao->VertexAttrib[VERT_ATTRIB_COLOR1];
- aa->binding = &vao->VertexBinding[aa->array->BufferBindingIndex];
+ aa->binding = &vao->BufferBinding[aa->array->BufferBindingIndex];
aa->offset = SecondaryColorFuncs[TYPE_IDX(aa->array->Type)];
check_vbo(actx, aa->binding->BufferObj);
aa++;
if (vao->VertexAttrib[VERT_ATTRIB_FOG].Enabled) {
aa->array = &vao->VertexAttrib[VERT_ATTRIB_FOG];
- aa->binding = &vao->VertexBinding[aa->array->BufferBindingIndex];
+ aa->binding = &vao->BufferBinding[aa->array->BufferBindingIndex];
aa->offset = FogCoordFuncs[TYPE_IDX(aa->array->Type)];
check_vbo(actx, aa->binding->BufferObj);
aa++;
* If we ever remove GL_NV_vertex_program this will have to change.
*/
at->array = attribArray;
- at->binding = &vao->VertexBinding[attribArray->BufferBindingIndex];
+ at->binding = &vao->BufferBinding[attribArray->BufferBindingIndex];
assert(!at->array->Normalized);
at->func = AttribFuncsNV[at->array->Normalized]
[at->array->Size-1]
if (attribArray->Enabled) {
GLint intOrNorm;
at->array = attribArray;
- at->binding = &vao->VertexBinding[attribArray->BufferBindingIndex];
+ at->binding = &vao->BufferBinding[attribArray->BufferBindingIndex];
/* Note: we can't grab the _glapi_Dispatch->VertexAttrib1fvNV
* function pointer here (for float arrays) since the pointer may
* change from one execution of _ae_ArrayElement() to
* issued as the last (provoking) attribute).
*/
aa->array = &vao->VertexAttrib[VERT_ATTRIB_GENERIC0];
- aa->binding = &vao->VertexBinding[aa->array->BufferBindingIndex];
+ aa->binding = &vao->BufferBinding[aa->array->BufferBindingIndex];
assert(aa->array->Size >= 2); /* XXX fix someday? */
aa->offset = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)];
check_vbo(actx, aa->binding->BufferObj);
}
else if (vao->VertexAttrib[VERT_ATTRIB_POS].Enabled) {
aa->array = &vao->VertexAttrib[VERT_ATTRIB_POS];
- aa->binding = &vao->VertexBinding[aa->array->BufferBindingIndex];
+ aa->binding = &vao->BufferBinding[aa->array->BufferBindingIndex];
aa->offset = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)];
check_vbo(actx, aa->binding->BufferObj);
aa++;
{
GLuint i;
- for (i = 0; i < ARRAY_SIZE(obj->VertexBinding); i++)
- _mesa_reference_buffer_object(ctx, &obj->VertexBinding[i].BufferObj, NULL);
+ for (i = 0; i < ARRAY_SIZE(obj->BufferBinding); i++)
+ _mesa_reference_buffer_object(ctx, &obj->BufferBinding[i].BufferObj, NULL);
for (i = 0; i < ARRAY_SIZE(obj->_VertexAttrib); i++)
_mesa_reference_buffer_object(ctx, &obj->_VertexAttrib[i].BufferObj, NULL);
GLuint index, GLint size, GLint type)
{
struct gl_array_attributes *array = &vao->VertexAttrib[index];
- struct gl_vertex_buffer_binding *binding = &vao->VertexBinding[index];
+ struct gl_vertex_buffer_binding *binding = &vao->BufferBinding[index];
array->Size = size;
array->Type = type;
struct gl_vertex_buffer_binding *buffer_binding;
attrib_array = &vao->VertexAttrib[attrib];
- buffer_binding = &vao->VertexBinding[attrib_array->BufferBindingIndex];
+ buffer_binding = &vao->BufferBinding[attrib_array->BufferBindingIndex];
client_array = &vao->_VertexAttrib[attrib];
_mesa_update_client_array(ctx, client_array, attrib_array,
const struct gl_array_attributes *attrib_array =
&vao->VertexAttrib[i];
const struct gl_vertex_buffer_binding *buffer_binding =
- &vao->VertexBinding[attrib_array->BufferBindingIndex];
+ &vao->BufferBinding[attrib_array->BufferBindingIndex];
/* Only enabled arrays shall appear in the _Enabled bitmask */
assert(attrib_array->Enabled);
const struct gl_array_attributes *attrib_array =
&vao->VertexAttrib[i];
const struct gl_vertex_buffer_binding *buffer_binding =
- &vao->VertexBinding[attrib_array->BufferBindingIndex];
+ &vao->BufferBinding[attrib_array->BufferBindingIndex];
/* Only enabled arrays shall appear in the _Enabled bitmask */
assert(attrib_array->Enabled);
for (i = 0; i < ARRAY_SIZE(src->VertexAttrib); i++) {
_mesa_copy_client_array(ctx, &dest->_VertexAttrib[i], &src->_VertexAttrib[i]);
_mesa_copy_vertex_attrib_array(ctx, &dest->VertexAttrib[i], &src->VertexAttrib[i]);
- _mesa_copy_vertex_buffer_binding(ctx, &dest->VertexBinding[i], &src->VertexBinding[i]);
+ _mesa_copy_vertex_buffer_binding(ctx, &dest->BufferBinding[i], &src->BufferBinding[i]);
}
/* _Enabled must be the same than on push */
struct gl_vertex_array_object *vao, unsigned index,
struct gl_buffer_object *obj)
{
- if (vao->VertexBinding[index].BufferObj == obj) {
+ if (vao->BufferBinding[index].BufferObj == obj) {
_mesa_bind_vertex_buffer(ctx, vao, index, ctx->Shared->NullBufferObj,
- vao->VertexBinding[index].Offset,
- vao->VertexBinding[index].Stride);
+ vao->BufferBinding[index].Offset,
+ vao->BufferBinding[index].Stride);
}
}
_mesa_buffer_unmap_all_mappings(ctx, bufObj);
/* unbind any vertex pointers bound to this buffer */
- for (j = 0; j < ARRAY_SIZE(vao->VertexBinding); j++) {
+ for (j = 0; j < ARRAY_SIZE(vao->BufferBinding); j++) {
unbind(ctx, vao, j, bufObj);
}
break;
case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:
v->value_int =
- ctx->Array.VAO->VertexBinding[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)].BufferObj->Name;
+ ctx->Array.VAO->BufferBinding[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)].BufferObj->Name;
break;
case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:
v->value_int = ctx->Array.VAO->IndexBufferObj->Name;
ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0;
break;
case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES:
- v->value_int = ctx->Array.VAO->VertexBinding[VERT_ATTRIB_POINT_SIZE].BufferObj->Name;
+ v->value_int = ctx->Array.VAO->BufferBinding[VERT_ATTRIB_POINT_SIZE].BufferObj->Name;
break;
case GL_FOG_COLOR:
goto invalid_enum;
if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs)
goto invalid_value;
- v->value_int = ctx->Array.VAO->VertexBinding[VERT_ATTRIB_GENERIC(index)].InstanceDivisor;
+ v->value_int = ctx->Array.VAO->BufferBinding[VERT_ATTRIB_GENERIC(index)].InstanceDivisor;
return TYPE_INT;
case GL_VERTEX_BINDING_OFFSET:
goto invalid_enum;
if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs)
goto invalid_value;
- v->value_int = ctx->Array.VAO->VertexBinding[VERT_ATTRIB_GENERIC(index)].Offset;
+ v->value_int = ctx->Array.VAO->BufferBinding[VERT_ATTRIB_GENERIC(index)].Offset;
return TYPE_INT;
case GL_VERTEX_BINDING_STRIDE:
goto invalid_enum;
if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs)
goto invalid_value;
- v->value_int = ctx->Array.VAO->VertexBinding[VERT_ATTRIB_GENERIC(index)].Stride;
+ v->value_int = ctx->Array.VAO->BufferBinding[VERT_ATTRIB_GENERIC(index)].Stride;
return TYPE_INT;
case GL_VERTEX_BINDING_BUFFER:
goto invalid_enum;
if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs)
goto invalid_value;
- v->value_int = ctx->Array.VAO->VertexBinding[VERT_ATTRIB_GENERIC(index)].BufferObj->Name;
+ v->value_int = ctx->Array.VAO->BufferBinding[VERT_ATTRIB_GENERIC(index)].BufferObj->Name;
return TYPE_INT;
/* ARB_shader_image_load_store */
[ "SAMPLE_ALPHA_TO_ONE_ARB", "CONTEXT_BOOL(Multisample.SampleAlphaToOne), NO_EXTRA" ],
# GL_ARB_vertex_buffer_object
- [ "VERTEX_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_vertex_array_object, VertexBinding[VERT_ATTRIB_POS].BufferObj), NO_EXTRA" ],
- [ "NORMAL_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_vertex_array_object, VertexBinding[VERT_ATTRIB_NORMAL].BufferObj), NO_EXTRA" ],
- [ "COLOR_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_vertex_array_object, VertexBinding[VERT_ATTRIB_COLOR0].BufferObj), NO_EXTRA" ],
+ [ "VERTEX_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_vertex_array_object, BufferBinding[VERT_ATTRIB_POS].BufferObj), NO_EXTRA" ],
+ [ "NORMAL_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_vertex_array_object, BufferBinding[VERT_ATTRIB_NORMAL].BufferObj), NO_EXTRA" ],
+ [ "COLOR_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_vertex_array_object, BufferBinding[VERT_ATTRIB_COLOR0].BufferObj), NO_EXTRA" ],
[ "TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, NO_OFFSET, NO_EXTRA" ],
# GL_OES_point_sprite
[ "PRIMITIVE_RESTART_INDEX_NV", "CONTEXT_INT(Array.RestartIndex), extra_NV_primitive_restart" ],
# GL_ARB_vertex_buffer_object
- [ "INDEX_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_vertex_array_object, VertexBinding[VERT_ATTRIB_COLOR_INDEX].BufferObj), NO_EXTRA" ],
- [ "EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_vertex_array_object, VertexBinding[VERT_ATTRIB_EDGEFLAG].BufferObj), NO_EXTRA" ],
- [ "SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_vertex_array_object, VertexBinding[VERT_ATTRIB_COLOR1].BufferObj), NO_EXTRA" ],
- [ "FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_vertex_array_object, VertexBinding[VERT_ATTRIB_FOG].BufferObj), NO_EXTRA" ],
+ [ "INDEX_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_vertex_array_object, BufferBinding[VERT_ATTRIB_COLOR_INDEX].BufferObj), NO_EXTRA" ],
+ [ "EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_vertex_array_object, BufferBinding[VERT_ATTRIB_EDGEFLAG].BufferObj), NO_EXTRA" ],
+ [ "SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_vertex_array_object, BufferBinding[VERT_ATTRIB_COLOR1].BufferObj), NO_EXTRA" ],
+ [ "FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_vertex_array_object, BufferBinding[VERT_ATTRIB_FOG].BufferObj), NO_EXTRA" ],
# GL_ARB_vertex_program
# == GL_VERTEX_PROGRAM_NV
struct gl_array_attributes VertexAttrib[VERT_ATTRIB_MAX];
/** Vertex buffer bindings */
- struct gl_vertex_buffer_binding VertexBinding[VERT_ATTRIB_MAX];
+ struct gl_vertex_buffer_binding BufferBinding[VERT_ATTRIB_MAX];
/** Mask indicating which vertex arrays have vertex buffer associated. */
GLbitfield64 VertexAttribBufferMask;
{
struct gl_array_attributes *array = &vao->VertexAttrib[attribIndex];
- if (!_mesa_is_bufferobj(vao->VertexBinding[bindingIndex].BufferObj))
+ if (!_mesa_is_bufferobj(vao->BufferBinding[bindingIndex].BufferObj))
vao->VertexAttribBufferMask &= ~VERT_BIT(attribIndex);
else
vao->VertexAttribBufferMask |= VERT_BIT(attribIndex);
FLUSH_VERTICES(ctx, _NEW_ARRAY);
- vao->VertexBinding[array->BufferBindingIndex]._BoundArrays &= ~array_bit;
- vao->VertexBinding[bindingIndex]._BoundArrays |= array_bit;
+ vao->BufferBinding[array->BufferBindingIndex]._BoundArrays &= ~array_bit;
+ vao->BufferBinding[bindingIndex]._BoundArrays |= array_bit;
array->BufferBindingIndex = bindingIndex;
struct gl_buffer_object *vbo,
GLintptr offset, GLsizei stride)
{
- struct gl_vertex_buffer_binding *binding = &vao->VertexBinding[index];
+ struct gl_vertex_buffer_binding *binding = &vao->BufferBinding[index];
if (binding->BufferObj != vbo ||
binding->Offset != offset ||
GLuint divisor)
{
struct gl_vertex_buffer_binding *binding =
- &vao->VertexBinding[bindingIndex];
+ &vao->BufferBinding[bindingIndex];
if (binding->InstanceDivisor != divisor) {
FLUSH_VERTICES(ctx, _NEW_ARRAY);
case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB:
return array->Normalized;
case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB:
- return vao->VertexBinding[array->BufferBindingIndex].BufferObj->Name;
+ return vao->BufferBinding[array->BufferBindingIndex].BufferObj->Name;
case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
if ((_mesa_is_desktop_gl(ctx)
&& (ctx->Version >= 30 || ctx->Extensions.EXT_gpu_shader4))
case GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB:
if ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_instanced_arrays)
|| _mesa_is_gles3(ctx)) {
- return vao->VertexBinding[array->BufferBindingIndex].InstanceDivisor;
+ return vao->BufferBinding[array->BufferBindingIndex].InstanceDivisor;
}
goto error;
case GL_VERTEX_ATTRIB_BINDING:
*/
switch (pname) {
case GL_VERTEX_BINDING_OFFSET:
- params[0] = vao->VertexBinding[VERT_ATTRIB_GENERIC(index)].Offset;
+ params[0] = vao->BufferBinding[VERT_ATTRIB_GENERIC(index)].Offset;
break;
case GL_VERTEX_BINDING_STRIDE:
- params[0] = vao->VertexBinding[VERT_ATTRIB_GENERIC(index)].Stride;
+ params[0] = vao->BufferBinding[VERT_ATTRIB_GENERIC(index)].Stride;
break;
case GL_VERTEX_BINDING_DIVISOR:
- params[0] = vao->VertexBinding[VERT_ATTRIB_GENERIC(index)].InstanceDivisor;
+ params[0] = vao->BufferBinding[VERT_ATTRIB_GENERIC(index)].InstanceDivisor;
break;
case GL_VERTEX_BINDING_BUFFER:
- params[0] = vao->VertexBinding[VERT_ATTRIB_GENERIC(index)].BufferObj->Name;
+ params[0] = vao->BufferBinding[VERT_ATTRIB_GENERIC(index)].BufferObj->Name;
break;
default:
params[0] = get_vertex_array_attrib(ctx, vao, index, pname,
return;
}
- params[0] = vao->VertexBinding[VERT_ATTRIB_GENERIC(index)].Offset;
+ params[0] = vao->BufferBinding[VERT_ATTRIB_GENERIC(index)].Offset;
}
}
if (buffer ==
- vao->VertexBinding[VERT_ATTRIB_GENERIC(bindingIndex)].BufferObj->Name) {
- vbo = vao->VertexBinding[VERT_ATTRIB_GENERIC(bindingIndex)].BufferObj;
+ vao->BufferBinding[VERT_ATTRIB_GENERIC(bindingIndex)].BufferObj->Name) {
+ vbo = vao->BufferBinding[VERT_ATTRIB_GENERIC(bindingIndex)].BufferObj;
} else if (buffer != 0) {
vbo = _mesa_lookup_bufferobj(ctx, buffer);
if (buffers[i]) {
struct gl_vertex_buffer_binding *binding =
- &vao->VertexBinding[VERT_ATTRIB_GENERIC(first + i)];
+ &vao->BufferBinding[VERT_ATTRIB_GENERIC(first + i)];
if (buffers[i] == binding->BufferObj->Name)
vbo = binding->BufferObj;
continue;
const struct gl_vertex_buffer_binding *binding =
- &vao->VertexBinding[array->BufferBindingIndex];
+ &vao->BufferBinding[array->BufferBindingIndex];
const struct gl_buffer_object *bo = binding->BufferObj;
fprintf(stderr, " %s: Ptr=%p, Type=%s, Size=%d, ElemSize=%u, "
const struct gl_array_attributes *array = &vao->VertexAttrib[attrib];
if (array->Enabled) {
const struct gl_vertex_buffer_binding *binding =
- &vao->VertexBinding[array->BufferBindingIndex];
+ &vao->BufferBinding[array->BufferBindingIndex];
struct gl_buffer_object *bo = binding->BufferObj;
const void *data = array->Ptr;
if (_mesa_is_bufferobj(bo)) {
const struct gl_array_attributes *array = &vao->VertexAttrib[attrib];
if (array->Enabled) {
const struct gl_vertex_buffer_binding *binding =
- &vao->VertexBinding[array->BufferBindingIndex];
+ &vao->BufferBinding[array->BufferBindingIndex];
struct gl_buffer_object *bo = binding->BufferObj;
if (_mesa_is_bufferobj(bo) && _mesa_bufferobj_mapped(bo, MAP_INTERNAL)) {
ctx->Driver.UnmapBuffer(ctx, bo, MAP_INTERNAL);
continue;
const struct gl_vertex_buffer_binding *binding =
- &vao->VertexBinding[array->BufferBindingIndex];
+ &vao->BufferBinding[array->BufferBindingIndex];
struct gl_buffer_object *bufObj = binding->BufferObj;
printf("attr %s: size %d stride %d enabled %d "