From 33efa6416f6ec58a5ec535c4c11501850514d5e7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Thu, 17 Aug 2017 15:36:20 +0200 Subject: [PATCH] gallium/u_blitter: don't use boolean, TRUE, FALSE MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit v2: cherry-picked from the bigger patch series Reviewed-by: Nicolai Hähnle (v1) Tested-by: Brian Paul --- src/gallium/auxiliary/util/u_blitter.c | 122 ++++++++++++------------- src/gallium/auxiliary/util/u_blitter.h | 24 ++--- 2 files changed, 73 insertions(+), 73 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 3ee1ba3ddd2..29b4c5b7d88 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -130,16 +130,16 @@ struct blitter_context_priv unsigned dst_width; unsigned dst_height; - boolean has_geometry_shader; - boolean has_tessellation; - boolean has_layered; - boolean has_stream_out; - boolean has_stencil_export; - boolean has_texture_multisample; - boolean has_tex_lz; - boolean has_txf; - boolean cube_as_2darray; - boolean cached_all_shaders; + bool has_geometry_shader; + bool has_tessellation; + bool has_layered; + bool has_stream_out; + bool has_stencil_export; + bool has_texture_multisample; + bool has_tex_lz; + bool has_txf; + bool cube_as_2darray; + bool cached_all_shaders; /* The Draw module overrides these functions. * Always create the blitter before Draw. */ @@ -344,7 +344,7 @@ static void bind_vs_pos_only(struct blitter_context_priv *ctx, ctx->vs_pos_only[index] = util_make_vertex_passthrough_shader_with_so(pipe, 1, semantic_names, - semantic_indices, FALSE, + semantic_indices, false, false, &so); } @@ -361,7 +361,7 @@ static void bind_vs_passthrough(struct blitter_context_priv *ctx) const uint semantic_indices[] = { 0, 0 }; ctx->vs = util_make_vertex_passthrough_shader(pipe, 2, semantic_names, - semantic_indices, FALSE); + semantic_indices, false); } pipe->bind_vs_state(pipe, ctx->vs); @@ -398,7 +398,7 @@ static void bind_fs_write_one_cbuf(struct blitter_context_priv *ctx) assert(!ctx->cached_all_shaders); ctx->fs_write_one_cbuf = util_make_fragment_passthrough_shader(pipe, TGSI_SEMANTIC_GENERIC, - TGSI_INTERPOLATE_CONSTANT, FALSE); + TGSI_INTERPOLATE_CONSTANT, false); } ctx->bind_fs_state(pipe, ctx->fs_write_one_cbuf); @@ -412,7 +412,7 @@ static void bind_fs_write_all_cbufs(struct blitter_context_priv *ctx) assert(!ctx->cached_all_shaders); ctx->fs_write_all_cbufs = util_make_fragment_passthrough_shader(pipe, TGSI_SEMANTIC_GENERIC, - TGSI_INTERPOLATE_CONSTANT, TRUE); + TGSI_INTERPOLATE_CONSTANT, true); } ctx->bind_fs_state(pipe, ctx->fs_write_all_cbufs); @@ -503,7 +503,7 @@ void util_blitter_destroy(struct blitter_context *blitter) } void util_blitter_set_texture_multisample(struct blitter_context *blitter, - boolean supported) + bool supported) { struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter; @@ -516,7 +516,7 @@ void util_blitter_set_running_flag(struct blitter_context *blitter) _debug_printf("u_blitter:%i: Caught recursion. This is a driver bug.\n", __LINE__); } - blitter->running = TRUE; + blitter->running = true; blitter->pipe->set_active_query_state(blitter->pipe, false); } @@ -527,7 +527,7 @@ void util_blitter_unset_running_flag(struct blitter_context *blitter) _debug_printf("u_blitter:%i: Caught recursion. This is a driver bug.\n", __LINE__); } - blitter->running = FALSE; + blitter->running = false; blitter->pipe->set_active_query_state(blitter->pipe, true); } @@ -622,7 +622,7 @@ void util_blitter_restore_fragment_states(struct blitter_context *blitter) /* Sample mask. */ if (ctx->base.is_sample_mask_saved) { pipe->set_sample_mask(pipe, ctx->base.saved_sample_mask); - ctx->base.is_sample_mask_saved = FALSE; + ctx->base.is_sample_mask_saved = false; } /* Miscellaneous states. */ @@ -642,7 +642,7 @@ static void blitter_disable_render_cond(struct blitter_context_priv *ctx) struct pipe_context *pipe = ctx->base.pipe; if (ctx->base.saved_render_cond_query) { - pipe->render_condition(pipe, NULL, FALSE, 0); + pipe->render_condition(pipe, NULL, false, 0); } } @@ -768,7 +768,7 @@ static void get_texcoords(struct pipe_sampler_view *src, float out[4]) { unsigned level = src->u.tex.first_level; - boolean normalized = !uses_txf && + bool normalized = !uses_txf && src->target != PIPE_TEXTURE_RECT && src->texture->nr_samples <= 1; @@ -822,7 +822,7 @@ static void blitter_set_texcoords(struct blitter_context_priv *ctx, /* pointer, stride in floats */ &face_coord[0][0], 2, &ctx->vertices[0][1][0], 8, - FALSE); + false); } else { set_texcoords_in_vertices(coord, &ctx->vertices[0][1][0], 8); } @@ -1134,7 +1134,7 @@ void util_blitter_cache_all_shaders(struct blitter_context *blitter) struct pipe_context *pipe = blitter->pipe; struct pipe_screen *screen = pipe->screen; unsigned samples, j, f, target, max_samples, use_txf; - boolean has_arraytex, has_cubearraytex; + bool has_arraytex, has_cubearraytex; max_samples = ctx->has_texture_multisample ? 2 : 1; has_arraytex = screen->get_param(screen, @@ -1221,18 +1221,18 @@ void util_blitter_cache_all_shaders(struct blitter_context *blitter) ctx->fs_write_one_cbuf = util_make_fragment_passthrough_shader(pipe, TGSI_SEMANTIC_GENERIC, - TGSI_INTERPOLATE_CONSTANT, FALSE); + TGSI_INTERPOLATE_CONSTANT, false); ctx->fs_write_all_cbufs = util_make_fragment_passthrough_shader(pipe, TGSI_SEMANTIC_GENERIC, - TGSI_INTERPOLATE_CONSTANT, TRUE); + TGSI_INTERPOLATE_CONSTANT, true); - ctx->cached_all_shaders = TRUE; + ctx->cached_all_shaders = true; } static void blitter_set_common_draw_rect_state(struct blitter_context_priv *ctx, - boolean scissor, - boolean vs_layered) + bool scissor, + bool vs_layered) { struct pipe_context *pipe = ctx->base.pipe; @@ -1393,12 +1393,12 @@ static void util_blitter_clear_custom(struct blitter_context *blitter, bind_fs_write_all_cbufs(ctx); if (num_layers > 1 && ctx->has_layered) { - blitter_set_common_draw_rect_state(ctx, FALSE, TRUE); + blitter_set_common_draw_rect_state(ctx, false, true); blitter_set_clear_color(ctx, color); blitter_draw(ctx, 0, 0, width, height, depth, num_layers); } else { - blitter_set_common_draw_rect_state(ctx, FALSE, FALSE); + blitter_set_common_draw_rect_state(ctx, false, false); blitter->draw_rectangle(blitter, 0, 0, width, height, (float) depth, UTIL_BLITTER_ATTRIB_COLOR, color); } @@ -1485,12 +1485,12 @@ void util_blitter_default_src_texture(struct blitter_context *blitter, src_templ->swizzle_a = PIPE_SWIZZLE_W; } -static boolean is_blit_generic_supported(struct blitter_context *blitter, - const struct pipe_resource *dst, - enum pipe_format dst_format, - const struct pipe_resource *src, - enum pipe_format src_format, - unsigned mask) +static bool is_blit_generic_supported(struct blitter_context *blitter, + const struct pipe_resource *dst, + enum pipe_format dst_format, + const struct pipe_resource *src, + enum pipe_format src_format, + unsigned mask) { struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter; struct pipe_screen *screen = ctx->base.pipe->screen; @@ -1499,12 +1499,12 @@ static boolean is_blit_generic_supported(struct blitter_context *blitter, unsigned bind; const struct util_format_description *desc = util_format_description(dst_format); - boolean dst_has_stencil = util_format_has_stencil(desc); + bool dst_has_stencil = util_format_has_stencil(desc); /* Stencil export must be supported for stencil copy. */ if ((mask & PIPE_MASK_S) && dst_has_stencil && !ctx->has_stencil_export) { - return FALSE; + return false; } if (dst_has_stencil || util_format_has_depth(desc)) @@ -1514,18 +1514,18 @@ static boolean is_blit_generic_supported(struct blitter_context *blitter, if (!screen->is_format_supported(screen, dst_format, dst->target, dst->nr_samples, bind)) { - return FALSE; + return false; } } if (src) { if (src->nr_samples > 1 && !ctx->has_texture_multisample) { - return FALSE; + return false; } if (!screen->is_format_supported(screen, src_format, src->target, src->nr_samples, PIPE_BIND_SAMPLER_VIEW)) { - return FALSE; + return false; } /* Check stencil sampler support for stencil copy. */ @@ -1539,25 +1539,25 @@ static boolean is_blit_generic_supported(struct blitter_context *blitter, !screen->is_format_supported(screen, stencil_format, src->target, src->nr_samples, PIPE_BIND_SAMPLER_VIEW)) { - return FALSE; + return false; } } } } - return TRUE; + return true; } -boolean util_blitter_is_copy_supported(struct blitter_context *blitter, - const struct pipe_resource *dst, - const struct pipe_resource *src) +bool util_blitter_is_copy_supported(struct blitter_context *blitter, + const struct pipe_resource *dst, + const struct pipe_resource *src) { return is_blit_generic_supported(blitter, dst, dst->format, src, src->format, PIPE_MASK_RGBAZS); } -boolean util_blitter_is_blit_supported(struct blitter_context *blitter, - const struct pipe_blit_info *info) +bool util_blitter_is_blit_supported(struct blitter_context *blitter, + const struct pipe_blit_info *info) { return is_blit_generic_supported(blitter, info->dst.resource, info->dst.format, @@ -1597,7 +1597,7 @@ void util_blitter_copy_texture(struct blitter_context *blitter, util_blitter_blit_generic(blitter, dst_view, &dstbox, src_view, srcbox, src->width0, src->height0, PIPE_MASK_RGBAZS, PIPE_TEX_FILTER_NEAREST, NULL, - FALSE); + false); pipe_surface_reference(&dst_view, NULL); pipe_sampler_view_reference(&src_view, NULL); @@ -1742,15 +1742,15 @@ void util_blitter_blit_generic(struct blitter_context *blitter, unsigned src_width0, unsigned src_height0, unsigned mask, unsigned filter, const struct pipe_scissor_state *scissor, - boolean alpha_blend) + bool alpha_blend) { struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter; struct pipe_context *pipe = ctx->base.pipe; enum pipe_texture_target src_target = src->target; unsigned src_samples = src->texture->nr_samples; unsigned dst_samples = dst->texture->nr_samples; - boolean has_depth, has_stencil, has_color; - boolean blit_stencil, blit_depth, blit_color; + bool has_depth, has_stencil, has_color; + bool blit_stencil, blit_depth, blit_color; void *sampler_state; const struct util_format_description *src_desc = util_format_description(src->format); @@ -1918,7 +1918,7 @@ void util_blitter_blit_generic(struct blitter_context *blitter, pipe->set_scissor_states(pipe, 0, 1, scissor); } - blitter_set_common_draw_rect_state(ctx, scissor != NULL, FALSE); + blitter_set_common_draw_rect_state(ctx, scissor != NULL, false); do_blits(ctx, dst, dstbox, src, src_width0, src_height0, srcbox, blit_depth || blit_stencil, use_txf); @@ -1977,7 +1977,7 @@ void util_blitter_generate_mipmap(struct blitter_context *blitter, struct pipe_context *pipe = ctx->base.pipe; struct pipe_surface dst_templ, *dst_view; struct pipe_sampler_view src_templ, *src_view; - boolean is_depth; + bool is_depth; void *sampler_state; const struct util_format_description *desc = util_format_description(format); @@ -2025,7 +2025,7 @@ void util_blitter_generate_mipmap(struct blitter_context *blitter, 0, 1, &sampler_state); pipe->bind_vertex_elements_state(pipe, ctx->velem_state); - blitter_set_common_draw_rect_state(ctx, FALSE, FALSE); + blitter_set_common_draw_rect_state(ctx, false, false); for (src_level = base_level; src_level < last_level; src_level++) { struct pipe_box dstbox = {0}, srcbox = {0}; @@ -2115,12 +2115,12 @@ void util_blitter_clear_render_target(struct blitter_context *blitter, num_layers = dstsurf->u.tex.last_layer - dstsurf->u.tex.first_layer + 1; if (num_layers > 1 && ctx->has_layered) { - blitter_set_common_draw_rect_state(ctx, FALSE, TRUE); + blitter_set_common_draw_rect_state(ctx, false, true); blitter_set_clear_color(ctx, color); blitter_draw(ctx, dstx, dsty, dstx+width, dsty+height, 0, num_layers); } else { - blitter_set_common_draw_rect_state(ctx, FALSE, FALSE); + blitter_set_common_draw_rect_state(ctx, false, false); blitter->draw_rectangle(blitter, dstx, dsty, dstx+width, dsty+height, 0, UTIL_BLITTER_ATTRIB_COLOR, color); } @@ -2193,11 +2193,11 @@ void util_blitter_clear_depth_stencil(struct blitter_context *blitter, num_layers = dstsurf->u.tex.last_layer - dstsurf->u.tex.first_layer + 1; if (num_layers > 1 && ctx->has_layered) { - blitter_set_common_draw_rect_state(ctx, FALSE, TRUE); + blitter_set_common_draw_rect_state(ctx, false, true); blitter_draw(ctx, dstx, dsty, dstx+width, dsty+height, (float) depth, num_layers); } else { - blitter_set_common_draw_rect_state(ctx, FALSE, FALSE); + blitter_set_common_draw_rect_state(ctx, false, false); blitter->draw_rectangle(blitter, dstx, dsty, dstx+width, dsty+height, (float) depth, UTIL_BLITTER_ATTRIB_NONE, NULL); @@ -2257,7 +2257,7 @@ void util_blitter_custom_depth_stencil(struct blitter_context *blitter, pipe->set_framebuffer_state(pipe, &fb_state); pipe->set_sample_mask(pipe, sample_mask); - blitter_set_common_draw_rect_state(ctx, FALSE, FALSE); + blitter_set_common_draw_rect_state(ctx, false, false); blitter_set_dst_dimensions(ctx, zsurf->width, zsurf->height); blitter->draw_rectangle(blitter, 0, 0, zsurf->width, zsurf->height, depth, UTIL_BLITTER_ATTRIB_NONE, NULL); @@ -2457,7 +2457,7 @@ void util_blitter_custom_resolve_color(struct blitter_context *blitter, fb_state.zsbuf = NULL; pipe->set_framebuffer_state(pipe, &fb_state); - blitter_set_common_draw_rect_state(ctx, FALSE, FALSE); + blitter_set_common_draw_rect_state(ctx, false, false); blitter_set_dst_dimensions(ctx, src->width0, src->height0); blitter->draw_rectangle(blitter, 0, 0, src->width0, src->height0, 0, 0, NULL); @@ -2507,7 +2507,7 @@ void util_blitter_custom_color(struct blitter_context *blitter, pipe->set_framebuffer_state(pipe, &fb_state); pipe->set_sample_mask(pipe, ~0); - blitter_set_common_draw_rect_state(ctx, FALSE, FALSE); + blitter_set_common_draw_rect_state(ctx, false, false); blitter_set_dst_dimensions(ctx, dstsurf->width, dstsurf->height); blitter->draw_rectangle(blitter, 0, 0, dstsurf->width, dstsurf->height, 0, 0, NULL); diff --git a/src/gallium/auxiliary/util/u_blitter.h b/src/gallium/auxiliary/util/u_blitter.h index 2174f9d9910..f38908700e2 100644 --- a/src/gallium/auxiliary/util/u_blitter.h +++ b/src/gallium/auxiliary/util/u_blitter.h @@ -78,7 +78,7 @@ struct blitter_context const union pipe_color_union *color); /* Whether the blitter is running. */ - boolean running; + bool running; /* Private members, really. */ struct pipe_context *pipe; /**< pipe context */ @@ -93,7 +93,7 @@ struct blitter_context struct pipe_stencil_ref saved_stencil_ref; /**< stencil ref */ struct pipe_viewport_state saved_viewport; struct pipe_scissor_state saved_scissor; - boolean is_sample_mask_saved; + bool is_sample_mask_saved; unsigned saved_sample_mask; unsigned saved_num_sampler_states; @@ -113,7 +113,7 @@ struct blitter_context struct pipe_query *saved_render_cond_query; uint saved_render_cond_mode; - boolean saved_render_cond_cond; + bool saved_render_cond_cond; }; /** @@ -141,7 +141,7 @@ struct pipe_context *util_blitter_get_pipe(struct blitter_context *blitter) * Override PIPE_CAP_TEXTURE_MULTISAMPLE as reported by the driver. */ void util_blitter_set_texture_multisample(struct blitter_context *blitter, - boolean supported); + bool supported); /* The default function to draw a rectangle. This can only be used * inside of the draw_rectangle callback if the driver overrides it. */ @@ -180,12 +180,12 @@ void util_blitter_clear(struct blitter_context *blitter, * Check if the blitter (with the help of the driver) can blit between * the two resources. */ -boolean util_blitter_is_copy_supported(struct blitter_context *blitter, - const struct pipe_resource *dst, - const struct pipe_resource *src); +bool util_blitter_is_copy_supported(struct blitter_context *blitter, + const struct pipe_resource *dst, + const struct pipe_resource *src); -boolean util_blitter_is_blit_supported(struct blitter_context *blitter, - const struct pipe_blit_info *info); +bool util_blitter_is_blit_supported(struct blitter_context *blitter, + const struct pipe_blit_info *info); /** * Copy a block of pixels from one surface to another. @@ -235,7 +235,7 @@ void util_blitter_blit_generic(struct blitter_context *blitter, unsigned src_width0, unsigned src_height0, unsigned mask, unsigned filter, const struct pipe_scissor_state *scissor, - boolean alpha_blend); + bool alpha_blend); void util_blitter_blit(struct blitter_context *blitter, const struct pipe_blit_info *info); @@ -517,14 +517,14 @@ static inline void util_blitter_save_sample_mask(struct blitter_context *blitter, unsigned sample_mask) { - blitter->is_sample_mask_saved = TRUE; + blitter->is_sample_mask_saved = true; blitter->saved_sample_mask = sample_mask; } static inline void util_blitter_save_render_condition(struct blitter_context *blitter, struct pipe_query *query, - boolean condition, + bool condition, enum pipe_render_cond_flag mode) { blitter->saved_render_cond_query = query; -- 2.30.2