summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/api_arrayelt.c
diff options
context:
space:
mode:
authorMathias Fröhlich <[email protected]>2018-11-17 07:13:11 +0100
committerMathias Fröhlich <[email protected]>2018-11-21 06:27:19 +0100
commit0a7020b4e60ef69e0e4b38aee31bfce385e594d8 (patch)
tree64e68add5e2e22579c6ef715707c1dd99c1ecde1 /src/mesa/main/api_arrayelt.c
parent2da7b0a2fbf0dbc5e89f19622cf3bbfa346ed0f1 (diff)
mesa: Factor out struct gl_vertex_format.
Factor out struct gl_vertex_format from array attributes. The data type is supposed to describe the type of a vertex element. At this current stage the data type is only used with the VAO, but actually is useful in various other places. Due to the bitfields being used, special care needs to be taken for the glGet code paths. v2: Change unsigned char -> GLubyte. Use struct assignment for struct gl_vertex_format. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Signed-off-by: Mathias Fröhlich <[email protected]>
Diffstat (limited to 'src/mesa/main/api_arrayelt.c')
-rw-r--r--src/mesa/main/api_arrayelt.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c
index 25cbc5326f8..2b59c478d9e 100644
--- a/src/mesa/main/api_arrayelt.c
+++ b/src/mesa/main/api_arrayelt.c
@@ -1575,7 +1575,7 @@ _ae_update_state(struct gl_context *ctx)
if (vao->Enabled & VERT_BIT_COLOR_INDEX) {
aa->array = &vao->VertexAttrib[VERT_ATTRIB_COLOR_INDEX];
aa->binding = &vao->BufferBinding[aa->array->BufferBindingIndex];
- aa->offset = IndexFuncs[TYPE_IDX(aa->array->Type)];
+ aa->offset = IndexFuncs[TYPE_IDX(aa->array->Format.Type)];
check_vbo(actx, aa->binding->BufferObj);
aa++;
}
@@ -1591,7 +1591,7 @@ _ae_update_state(struct gl_context *ctx)
if (vao->Enabled & VERT_BIT_NORMAL) {
aa->array = &vao->VertexAttrib[VERT_ATTRIB_NORMAL];
aa->binding = &vao->BufferBinding[aa->array->BufferBindingIndex];
- aa->offset = NormalFuncs[TYPE_IDX(aa->array->Type)];
+ aa->offset = NormalFuncs[TYPE_IDX(aa->array->Format.Type)];
check_vbo(actx, aa->binding->BufferObj);
aa++;
}
@@ -1599,7 +1599,7 @@ _ae_update_state(struct gl_context *ctx)
if (vao->Enabled & VERT_BIT_COLOR0) {
aa->array = &vao->VertexAttrib[VERT_ATTRIB_COLOR0];
aa->binding = &vao->BufferBinding[aa->array->BufferBindingIndex];
- aa->offset = ColorFuncs[aa->array->Size-3][TYPE_IDX(aa->array->Type)];
+ aa->offset = ColorFuncs[aa->array->Format.Size-3][TYPE_IDX(aa->array->Format.Type)];
check_vbo(actx, aa->binding->BufferObj);
aa++;
}
@@ -1607,7 +1607,7 @@ _ae_update_state(struct gl_context *ctx)
if (vao->Enabled & VERT_BIT_COLOR1) {
aa->array = &vao->VertexAttrib[VERT_ATTRIB_COLOR1];
aa->binding = &vao->BufferBinding[aa->array->BufferBindingIndex];
- aa->offset = SecondaryColorFuncs[TYPE_IDX(aa->array->Type)];
+ aa->offset = SecondaryColorFuncs[TYPE_IDX(aa->array->Format.Type)];
check_vbo(actx, aa->binding->BufferObj);
aa++;
}
@@ -1615,7 +1615,7 @@ _ae_update_state(struct gl_context *ctx)
if (vao->Enabled & VERT_BIT_FOG) {
aa->array = &vao->VertexAttrib[VERT_ATTRIB_FOG];
aa->binding = &vao->BufferBinding[aa->array->BufferBindingIndex];
- aa->offset = FogCoordFuncs[TYPE_IDX(aa->array->Type)];
+ aa->offset = FogCoordFuncs[TYPE_IDX(aa->array->Format.Type)];
check_vbo(actx, aa->binding->BufferObj);
aa++;
}
@@ -1629,10 +1629,10 @@ _ae_update_state(struct gl_context *ctx)
*/
at->array = attribArray;
at->binding = &vao->BufferBinding[attribArray->BufferBindingIndex];
- assert(!at->array->Normalized);
- at->func = AttribFuncsNV[at->array->Normalized]
- [at->array->Size-1]
- [TYPE_IDX(at->array->Type)];
+ assert(!at->array->Format.Normalized);
+ at->func = AttribFuncsNV[at->array->Format.Normalized]
+ [at->array->Format.Size-1]
+ [TYPE_IDX(at->array->Format.Type)];
at->index = VERT_ATTRIB_TEX0 + i;
check_vbo(actx, at->binding->BufferObj);
at++;
@@ -1652,18 +1652,18 @@ _ae_update_state(struct gl_context *ctx)
* change from one execution of _ae_ArrayElement() to
* the next. Doing so caused UT to break.
*/
- if (at->array->Doubles)
+ if (at->array->Format.Doubles)
intOrNorm = 3;
- else if (at->array->Integer)
+ else if (at->array->Format.Integer)
intOrNorm = 2;
- else if (at->array->Normalized)
+ else if (at->array->Format.Normalized)
intOrNorm = 1;
else
intOrNorm = 0;
at->func = AttribFuncsARB[intOrNorm]
- [at->array->Size-1]
- [TYPE_IDX(at->array->Type)];
+ [at->array->Format.Size-1]
+ [TYPE_IDX(at->array->Format.Type)];
at->index = i;
check_vbo(actx, at->binding->BufferObj);
@@ -1678,15 +1678,15 @@ _ae_update_state(struct gl_context *ctx)
*/
aa->array = &vao->VertexAttrib[VERT_ATTRIB_GENERIC0];
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)];
+ assert(aa->array->Format.Size >= 2); /* XXX fix someday? */
+ aa->offset = VertexFuncs[aa->array->Format.Size-2][TYPE_IDX(aa->array->Format.Type)];
check_vbo(actx, aa->binding->BufferObj);
aa++;
}
else if (vao->Enabled & VERT_BIT_POS) {
aa->array = &vao->VertexAttrib[VERT_ATTRIB_POS];
aa->binding = &vao->BufferBinding[aa->array->BufferBindingIndex];
- aa->offset = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)];
+ aa->offset = VertexFuncs[aa->array->Format.Size-2][TYPE_IDX(aa->array->Format.Type)];
check_vbo(actx, aa->binding->BufferObj);
aa++;
}