draw: Replace usage of boolean/TRUE/FALSE with bool/true/false in draw_pt_vsplit*

These change can not be done with tools, so do it manually

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23845>
This commit is contained in:
Yonggang Luo 2023-06-22 18:38:10 +08:00
parent fbe9a7ca3e
commit f35ebd221f
2 changed files with 25 additions and 23 deletions

View file

@ -23,6 +23,8 @@
* DEALINGS IN THE SOFTWARE.
*/
#include <stdbool.h>
#include "util/macros.h"
#include "util/u_math.h"
#include "util/u_memory.h"
@ -54,7 +56,7 @@ struct vsplit_frontend {
/* map a fetch element to a draw element */
unsigned fetches[MAP_SIZE];
ushort draws[MAP_SIZE];
boolean has_max_fetch;
bool has_max_fetch;
ushort num_fetch_elts;
ushort num_draw_elts;
@ -66,7 +68,7 @@ static void
vsplit_clear_cache(struct vsplit_frontend *vsplit)
{
memset(vsplit->cache.fetches, 0xff, sizeof(vsplit->cache.fetches));
vsplit->cache.has_max_fetch = FALSE;
vsplit->cache.has_max_fetch = false;
vsplit->cache.num_fetch_elts = 0;
vsplit->cache.num_draw_elts = 0;
}
@ -130,7 +132,7 @@ vsplit_add_cache_ubyte(struct vsplit_frontend *vsplit, const ubyte *elts,
if (elt_bias && elt_idx == DRAW_MAX_FETCH_IDX && !vsplit->cache.has_max_fetch) {
unsigned hash = elt_idx % MAP_SIZE;
vsplit->cache.fetches[hash] = 0;
vsplit->cache.has_max_fetch = TRUE;
vsplit->cache.has_max_fetch = true;
}
vsplit_add_cache(vsplit, elt_idx);
}
@ -148,7 +150,7 @@ vsplit_add_cache_ushort(struct vsplit_frontend *vsplit, const ushort *elts,
if (elt_bias && elt_idx == DRAW_MAX_FETCH_IDX && !vsplit->cache.has_max_fetch) {
unsigned hash = elt_idx % MAP_SIZE;
vsplit->cache.fetches[hash] = 0;
vsplit->cache.has_max_fetch = TRUE;
vsplit->cache.has_max_fetch = true;
}
vsplit_add_cache(vsplit, elt_idx);
}
@ -174,7 +176,7 @@ vsplit_add_cache_uint(struct vsplit_frontend *vsplit, const uint *elts,
unsigned hash = elt_idx % MAP_SIZE;
/* force update - any value will do except DRAW_MAX_FETCH_IDX */
vsplit->cache.fetches[hash] = 0;
vsplit->cache.has_max_fetch = TRUE;
vsplit->cache.has_max_fetch = true;
}
vsplit_add_cache(vsplit, elt_idx);
}

View file

@ -29,7 +29,7 @@
* Fetch all elements in [min_index, max_index] with bias, and use the
* (rebased) index buffer as the draw elements.
*/
static boolean
static bool
CONCAT2(vsplit_primitive_, ELT_TYPE)(struct vsplit_frontend *vsplit,
unsigned istart, unsigned icount)
{
@ -47,12 +47,12 @@ CONCAT2(vsplit_primitive_, ELT_TYPE)(struct vsplit_frontend *vsplit,
* through the normal paths */
if (end >= draw->pt.user.eltMax ||
end < istart)
return FALSE;
return false;
/* use the ib directly */
if (min_index == 0 && sizeof(ib[0]) == sizeof(draw_elts[0])) {
if (icount > vsplit->max_vertices)
return FALSE;
return false;
for (unsigned i = 0; i < icount; i++) {
ELT_TYPE idx = DRAW_GET_IDX(ib, start + i);
@ -64,20 +64,20 @@ CONCAT2(vsplit_primitive_, ELT_TYPE)(struct vsplit_frontend *vsplit,
} else {
/* have to go through vsplit->draw_elts */
if (icount > vsplit->segment_size)
return FALSE;
return false;
}
/* this is faster only when we fetch less elements than the normal path */
if (max_index - min_index > icount - 1)
return FALSE;
return false;
if (elt_bias < 0 && (int) min_index < -elt_bias)
return FALSE;
return false;
/* why this check? */
for (unsigned i = 0; i < draw->pt.nr_vertex_elements; i++) {
if (draw->pt.vertex_element[i].instance_divisor)
return FALSE;
return false;
}
fetch_start = min_index + elt_bias;
@ -85,7 +85,7 @@ CONCAT2(vsplit_primitive_, ELT_TYPE)(struct vsplit_frontend *vsplit,
/* Check for overflow in the fetch_start */
if (fetch_start < min_index || fetch_start < elt_bias)
return FALSE;
return false;
if (!draw_elts) {
if (min_index == 0) {
@ -127,8 +127,8 @@ static inline void
CONCAT2(vsplit_segment_cache_, ELT_TYPE)(struct vsplit_frontend *vsplit,
unsigned flags,
unsigned istart, unsigned icount,
boolean spoken, unsigned ispoken,
boolean close, unsigned iclose)
bool spoken, unsigned ispoken,
bool close, unsigned iclose)
{
struct draw_context *draw = vsplit->draw;
const ELT_TYPE *ib = (const ELT_TYPE *) draw->pt.user.elts;
@ -171,7 +171,7 @@ CONCAT2(vsplit_segment_simple_, ELT_TYPE)(struct vsplit_frontend *vsplit,
unsigned icount)
{
CONCAT2(vsplit_segment_cache_, ELT_TYPE)(vsplit,
flags, istart, icount, FALSE, 0, FALSE, 0);
flags, istart, icount, false, 0, false, 0);
}
@ -182,10 +182,10 @@ CONCAT2(vsplit_segment_loop_, ELT_TYPE)(struct vsplit_frontend *vsplit,
unsigned icount,
unsigned i0)
{
const boolean close_loop = ((flags) == DRAW_SPLIT_BEFORE);
const bool close_loop = ((flags) == DRAW_SPLIT_BEFORE);
CONCAT2(vsplit_segment_cache_, ELT_TYPE)(vsplit,
flags, istart, icount, FALSE, 0, close_loop, i0);
flags, istart, icount, false, 0, close_loop, i0);
}
@ -196,10 +196,10 @@ CONCAT2(vsplit_segment_fan_, ELT_TYPE)(struct vsplit_frontend *vsplit,
unsigned icount,
unsigned i0)
{
const boolean use_spoken = (((flags) & DRAW_SPLIT_BEFORE) != 0);
const bool use_spoken = (((flags) & DRAW_SPLIT_BEFORE) != 0);
CONCAT2(vsplit_segment_cache_, ELT_TYPE)(vsplit,
flags, istart, icount, use_spoken, i0, FALSE, 0);
flags, istart, icount, use_spoken, i0, false, 0);
}
@ -228,7 +228,7 @@ static void
vsplit_segment_loop_linear(struct vsplit_frontend *vsplit, unsigned flags,
unsigned istart, unsigned icount, unsigned i0)
{
boolean close_loop = (flags == DRAW_SPLIT_BEFORE);
bool close_loop = (flags == DRAW_SPLIT_BEFORE);
unsigned nr;
assert(icount + !!close_loop <= vsplit->segment_size);
@ -253,7 +253,7 @@ static void
vsplit_segment_fan_linear(struct vsplit_frontend *vsplit, unsigned flags,
unsigned istart, unsigned icount, unsigned i0)
{
boolean use_spoken = ((flags & DRAW_SPLIT_BEFORE) != 0);
bool use_spoken = ((flags & DRAW_SPLIT_BEFORE) != 0);
unsigned nr = 0;
assert(icount <= vsplit->segment_size);
@ -279,7 +279,7 @@ vsplit_segment_fan_linear(struct vsplit_frontend *vsplit, unsigned flags,
const unsigned max_count_loop = vsplit->segment_size - 1; \
const unsigned max_count_fan = vsplit->segment_size;
#define PRIMITIVE(istart, icount) FALSE
#define PRIMITIVE(istart, icount) false
#define ELT_TYPE linear