tnl: Code formatting in t_rebase.c
Many little changes. Almost everything is indentation or removal of trailing whitespace. Some places move a loop variable declaration to the loop. Some comments either re-wrapped or converted to single line. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4512>
This commit is contained in:
@@ -59,10 +59,9 @@
|
||||
|
||||
#define REBASE(TYPE) \
|
||||
static void *rebase_##TYPE(const void *ptr, \
|
||||
GLuint count, \
|
||||
unsigned count, \
|
||||
TYPE min_index) \
|
||||
{ \
|
||||
GLuint i; \
|
||||
const TYPE *in = (TYPE *)ptr; \
|
||||
TYPE *tmp_indices = malloc(count * sizeof(TYPE)); \
|
||||
\
|
||||
@@ -71,19 +70,17 @@ static void *rebase_##TYPE( const void *ptr, \
|
||||
return NULL; \
|
||||
} \
|
||||
\
|
||||
for (i = 0; i < count; i++) \
|
||||
for (unsigned i = 0; i < count; i++) \
|
||||
tmp_indices[i] = in[i] - min_index; \
|
||||
\
|
||||
return (void *)tmp_indices; \
|
||||
}
|
||||
|
||||
|
||||
REBASE(GLuint)
|
||||
REBASE(GLushort)
|
||||
REBASE(GLubyte)
|
||||
|
||||
|
||||
|
||||
/* Adjust primitives, indices and vertex definitions so that min_index
|
||||
* becomes zero. There are lots of reasons for wanting to do this, eg:
|
||||
*
|
||||
@@ -127,13 +124,12 @@ void t_rebase_prims( struct gl_context *ctx,
|
||||
if (0)
|
||||
printf("%s %d..%d\n", __func__, min_index, max_index);
|
||||
|
||||
|
||||
/* XXX this path is disabled for now.
|
||||
* There's rendering corruption in some apps when it's enabled.
|
||||
*/
|
||||
if (0 && ib && ctx->Extensions.ARB_draw_elements_base_vertex) {
|
||||
/* If we can just tell the hardware or the TNL to interpret our
|
||||
* indices with a different base, do so.
|
||||
/* If we can just tell the hardware or the TNL to interpret our indices
|
||||
* with a different base, do so.
|
||||
*/
|
||||
tmp_prims = malloc(sizeof(*prim) * nr_prims);
|
||||
|
||||
@@ -165,8 +161,8 @@ void t_rebase_prims( struct gl_context *ctx,
|
||||
} else
|
||||
ptr = ib->ptr;
|
||||
|
||||
/* Some users might prefer it if we translated elements to
|
||||
* GLuints here. Others wouldn't...
|
||||
/* Some users might prefer it if we translated elements to GLuints here.
|
||||
* Others wouldn't...
|
||||
*/
|
||||
switch (ib->index_size_shift) {
|
||||
case 2:
|
||||
@@ -183,9 +179,8 @@ void t_rebase_prims( struct gl_context *ctx,
|
||||
if (map_ib)
|
||||
ctx->Driver.UnmapBuffer(ctx, ib->obj, MAP_INTERNAL);
|
||||
|
||||
if (tmp_indices == NULL) {
|
||||
if (tmp_indices == NULL)
|
||||
return;
|
||||
}
|
||||
|
||||
tmp_ib.obj = NULL;
|
||||
tmp_ib.ptr = tmp_indices;
|
||||
@@ -195,8 +190,7 @@ void t_rebase_prims( struct gl_context *ctx,
|
||||
ib = &tmp_ib;
|
||||
}
|
||||
else {
|
||||
/* Otherwise the primitives need adjustment.
|
||||
*/
|
||||
/* Otherwise the primitives need adjustment. */
|
||||
tmp_prims = malloc(sizeof(*prim) * nr_prims);
|
||||
|
||||
if (tmp_prims == NULL) {
|
||||
@@ -205,8 +199,7 @@ void t_rebase_prims( struct gl_context *ctx,
|
||||
}
|
||||
|
||||
for (i = 0; i < nr_prims; i++) {
|
||||
/* If this fails, it could indicate an application error:
|
||||
*/
|
||||
/* If this fails, it could indicate an application error: */
|
||||
assert(prim[i].start >= min_index);
|
||||
|
||||
tmp_prims[i] = prim[i];
|
||||
@@ -237,8 +230,7 @@ void t_rebase_prims( struct gl_context *ctx,
|
||||
tmp_attribs[i].Ptr += min_index * arrays[i].BufferBinding->Stride;
|
||||
}
|
||||
|
||||
/* Re-issue the draw call.
|
||||
*/
|
||||
/* Re-issue the draw call. */
|
||||
draw(ctx,
|
||||
tmp_arrays,
|
||||
prim,
|
||||
@@ -250,7 +242,6 @@ void t_rebase_prims( struct gl_context *ctx,
|
||||
num_instances, base_instance);
|
||||
|
||||
free(tmp_indices);
|
||||
|
||||
free(tmp_prims);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user