summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/draw.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/draw.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/draw.c')
-rw-r--r--src/mesa/main/draw.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/mesa/main/draw.c b/src/mesa/main/draw.c
index 313df6aa8bc..bfc4b9c9373 100644
--- a/src/mesa/main/draw.c
+++ b/src/mesa/main/draw.c
@@ -82,18 +82,19 @@ check_array_data(struct gl_context *ctx, struct gl_vertex_array_object *vao,
data = ADD_POINTERS(_mesa_vertex_attrib_address(array, binding),
bo->Mappings[MAP_INTERNAL].Pointer);
}
- switch (array->Type) {
+ switch (array->Format.Type) {
case GL_FLOAT:
{
GLfloat *f = (GLfloat *) ((GLubyte *) data + binding->Stride * j);
GLint k;
- for (k = 0; k < array->Size; k++) {
+ for (k = 0; k < array->Format.Size; k++) {
if (IS_INF_OR_NAN(f[k]) || f[k] >= 1.0e20F || f[k] <= -1.0e10F) {
printf("Bad array data:\n");
printf(" Element[%u].%u = %f\n", j, k, f[k]);
printf(" Array %u at %p\n", attrib, (void *) array);
printf(" Type 0x%x, Size %d, Stride %d\n",
- array->Type, array->Size, binding->Stride);
+ array->Format.Type, array->Format.Size,
+ binding->Stride);
printf(" Address/offset %p in Buffer Object %u\n",
array->Ptr, bo->Name);
f[k] = 1.0F; /* XXX replace the bad value! */
@@ -288,7 +289,7 @@ print_draw_arrays(struct gl_context *ctx,
printf("attr %s: size %d stride %d "
"ptr %p Bufobj %u\n",
gl_vert_attrib_name((gl_vert_attrib) i),
- array->Size, binding->Stride,
+ array->Format.Size, binding->Stride,
array->Ptr, bufObj->Name);
if (_mesa_is_bufferobj(bufObj)) {
@@ -299,7 +300,7 @@ print_draw_arrays(struct gl_context *ctx,
_mesa_vertex_attrib_address(array, binding);
unsigned multiplier;
- switch (array->Type) {
+ switch (array->Format.Type) {
case GL_DOUBLE:
case GL_INT64_ARB:
case GL_UNSIGNED_INT64_ARB:
@@ -313,7 +314,7 @@ print_draw_arrays(struct gl_context *ctx,
int *k = (int *) f;
int i = 0;
int n = (count - 1) * (binding->Stride / (4 * multiplier))
- + array->Size;
+ + array->Format.Size;
if (n > 32)
n = 32;
printf(" Data at offset %d:\n", offset);