From 32218eabdb5d577ed9e661db6d5ec6a56ace7988 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 5 Oct 2022 12:23:06 -0600 Subject: [PATCH] draw: asst. clean-ups in draw_context.[ch] Fix whitespace/formatting for consistency. Move var decls to where they're first used, etc. Signed-off-by: Brian Paul Acked-by: Dave Airlie Part-of: --- src/gallium/auxiliary/draw/draw_context.c | 279 +++++++++++++++--------------- src/gallium/auxiliary/draw/draw_context.h | 2 +- 2 files changed, 141 insertions(+), 140 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index dde87c4..1f67970 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -1,8 +1,8 @@ /************************************************************************** - * + * * Copyright 2007 VMware, Inc. * All Rights Reserved. - * + * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -10,11 +10,11 @@ * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. @@ -22,7 +22,7 @@ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * **************************************************************************/ /* @@ -80,7 +80,7 @@ static struct draw_context * draw_create_context(struct pipe_context *pipe, void *context, boolean try_llvm) { - struct draw_context *draw = CALLOC_STRUCT( draw_context ); + struct draw_context *draw = CALLOC_STRUCT(draw_context); if (!draw) goto err_out; @@ -103,7 +103,7 @@ draw_create_context(struct pipe_context *pipe, void *context, return draw; err_destroy: - draw_destroy( draw ); + draw_destroy(draw); err_out: return NULL; } @@ -128,6 +128,7 @@ draw_create_with_llvm_context(struct pipe_context *pipe, } #endif + /** * Create a new draw context, without LLVM JIT. */ @@ -138,7 +139,8 @@ draw_create_no_llvm(struct pipe_context *pipe) } -boolean draw_init(struct draw_context *draw) +boolean +draw_init(struct draw_context *draw) { /* * Note that several functions compute the clipmask of the predefined @@ -146,28 +148,28 @@ boolean draw_init(struct draw_context *draw) * here must be reflected there too. */ - ASSIGN_4V( draw->plane[0], -1, 0, 0, 1 ); - ASSIGN_4V( draw->plane[1], 1, 0, 0, 1 ); - ASSIGN_4V( draw->plane[2], 0, -1, 0, 1 ); - ASSIGN_4V( draw->plane[3], 0, 1, 0, 1 ); - ASSIGN_4V( draw->plane[4], 0, 0, 1, 1 ); /* yes these are correct */ - ASSIGN_4V( draw->plane[5], 0, 0, -1, 1 ); /* mesa's a bit wonky */ + ASSIGN_4V(draw->plane[0], -1, 0, 0, 1); + ASSIGN_4V(draw->plane[1], 1, 0, 0, 1); + ASSIGN_4V(draw->plane[2], 0, -1, 0, 1); + ASSIGN_4V(draw->plane[3], 0, 1, 0, 1); + ASSIGN_4V(draw->plane[4], 0, 0, 1, 1); /* yes these are correct */ + ASSIGN_4V(draw->plane[5], 0, 0, -1, 1); /* mesa's a bit wonky */ draw->clip_xy = TRUE; draw->clip_z = TRUE; draw->pt.user.planes = (float (*) [DRAW_TOTAL_CLIP_PLANES][4]) &(draw->plane[0]); draw->pt.user.eltMax = ~0; - if (!draw_pipeline_init( draw )) + if (!draw_pipeline_init(draw)) return FALSE; - if (!draw_pt_init( draw )) + if (!draw_pt_init(draw)) return FALSE; - if (!draw_vs_init( draw )) + if (!draw_vs_init(draw)) return FALSE; - if (!draw_gs_init( draw )) + if (!draw_gs_init(draw)) return FALSE; draw->quads_always_flatshade_last = !draw->pipe->screen->get_param( @@ -178,36 +180,36 @@ boolean draw_init(struct draw_context *draw) return TRUE; } + /* * Called whenever we're starting to draw a new instance. * Some internal structures don't want to have to reset internal * members on each invocation (because their state might have to persist - * between multiple primitive restart rendering call) but might have to - * for each new instance. + * between multiple primitive restart rendering call) but might have to + * for each new instance. * This is particularly the case for primitive id's in geometry shader. */ -void draw_new_instance(struct draw_context *draw) +void +draw_new_instance(struct draw_context *draw) { draw_geometry_shader_new_instance(draw->gs.geometry_shader); draw_prim_assembler_new_instance(draw->ia); } -void draw_destroy( struct draw_context *draw ) +void +draw_destroy(struct draw_context *draw) { - struct pipe_context *pipe; - unsigned i, j, k; - if (!draw) return; - pipe = draw->pipe; + struct pipe_context *pipe = draw->pipe; /* free any rasterizer CSOs that we may have created. */ - for (i = 0; i < 2; i++) { - for (j = 0; j < 2; j++) { - for (k = 0; k < 2; k++) { + for (unsigned i = 0; i < 2; i++) { + for (unsigned j = 0; j < 2; j++) { + for (unsigned k = 0; k < 2; k++) { if (draw->rasterizer_no_cull[i][j][k]) { pipe->delete_rasterizer_state(pipe, draw->rasterizer_no_cull[i][j][k]); } @@ -215,33 +217,33 @@ void draw_destroy( struct draw_context *draw ) } } - for (i = 0; i < draw->pt.nr_vertex_buffers; i++) + for (unsigned i = 0; i < draw->pt.nr_vertex_buffers; i++) pipe_vertex_buffer_unreference(&draw->pt.vertex_buffer[i]); /* Not so fast -- we're just borrowing this at the moment. - * + * if (draw->render) - draw->render->destroy( draw->render ); + draw->render->destroy(draw->render); */ draw_prim_assembler_destroy(draw->ia); - draw_pipeline_destroy( draw ); - draw_pt_destroy( draw ); - draw_vs_destroy( draw ); - draw_gs_destroy( draw ); + draw_pipeline_destroy(draw); + draw_pt_destroy(draw); + draw_vs_destroy(draw); + draw_gs_destroy(draw); #ifdef DRAW_LLVM_AVAILABLE if (draw->llvm) - draw_llvm_destroy( draw->llvm ); + draw_llvm_destroy(draw->llvm); #endif - FREE( draw ); + FREE(draw); } - -void draw_flush( struct draw_context *draw ) +void +draw_flush(struct draw_context *draw) { - draw_do_flush( draw, DRAW_FLUSH_BACKEND ); + draw_do_flush(draw, DRAW_FLUSH_BACKEND); } @@ -252,7 +254,8 @@ void draw_flush( struct draw_context *draw ) * the rasterization algorithm and the arithmetic performed on Z * values between vertex shading and rasterization. */ -void draw_set_zs_format(struct draw_context *draw, enum pipe_format format) +void +draw_set_zs_format(struct draw_context *draw, enum pipe_format format) { const struct util_format_description *desc = util_format_description(format); @@ -309,12 +312,12 @@ draw_update_viewport_flags(struct draw_context *draw) * Register new primitive rasterization/rendering state. * This causes the drawing pipeline to be rebuilt. */ -void draw_set_rasterizer_state( struct draw_context *draw, +void draw_set_rasterizer_state(struct draw_context *draw, const struct pipe_rasterizer_state *raster, - void *rast_handle ) + void *rast_handle) { if (!draw->suspend_flushing) { - draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); + draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE); draw->rasterizer = raster; draw->rast_handle = rast_handle; @@ -322,8 +325,9 @@ void draw_set_rasterizer_state( struct draw_context *draw, } } + /* With a little more work, llvmpipe will be able to turn this off and - * do its own x/y clipping. + * do its own x/y clipping. * * Some hardware can turn off clipping altogether - in particular any * hardware with a TNL unit can do its own clipping, even if it is @@ -333,13 +337,14 @@ void draw_set_rasterizer_state( struct draw_context *draw, * wide points / point sprites itself (points will still be clipped if rasterizer * point_tri_clip isn't set). Only relevant if bypass_clip_xy isn't set. */ -void draw_set_driver_clipping( struct draw_context *draw, - boolean bypass_clip_xy, - boolean bypass_clip_z, - boolean guard_band_xy, - boolean bypass_clip_points) +void +draw_set_driver_clipping(struct draw_context *draw, + boolean bypass_clip_xy, + boolean bypass_clip_z, + boolean guard_band_xy, + boolean bypass_clip_points) { - draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); + draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE); draw->driver.bypass_clip_xy = bypass_clip_xy; draw->driver.bypass_clip_z = bypass_clip_z; @@ -349,15 +354,16 @@ void draw_set_driver_clipping( struct draw_context *draw, } -/** +/** * Plug in the primitive rendering/rasterization stage (which is the last * stage in the drawing pipeline). * This is provided by the device driver. */ -void draw_set_rasterize_stage( struct draw_context *draw, - struct draw_stage *stage ) +void +draw_set_rasterize_stage(struct draw_context *draw, + struct draw_stage *stage) { - draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); + draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE); draw->pipeline.rasterize = stage; } @@ -366,8 +372,9 @@ void draw_set_rasterize_stage( struct draw_context *draw, /** * Set the draw module's clipping state. */ -void draw_set_clip_state( struct draw_context *draw, - const struct pipe_clip_state *clip ) +void +draw_set_clip_state(struct draw_context *draw, + const struct pipe_clip_state *clip) { draw_do_flush(draw, DRAW_FLUSH_PARAMETER_CHANGE); @@ -378,10 +385,11 @@ void draw_set_clip_state( struct draw_context *draw, /** * Set the draw module's viewport state. */ -void draw_set_viewport_states( struct draw_context *draw, - unsigned start_slot, - unsigned num_viewports, - const struct pipe_viewport_state *vps ) +void +draw_set_viewport_states(struct draw_context *draw, + unsigned start_slot, + unsigned num_viewports, + const struct pipe_viewport_state *vps) { const struct pipe_viewport_state *viewport = vps; draw_do_flush(draw, DRAW_FLUSH_PARAMETER_CHANGE); @@ -403,7 +411,6 @@ void draw_set_viewport_states( struct draw_context *draw, } - void draw_set_vertex_buffers(struct draw_context *draw, unsigned start_slot, unsigned count, @@ -428,7 +435,7 @@ draw_set_vertex_elements(struct draw_context *draw, /* We could improve this by only flushing the frontend and the fetch part * of the middle. This would avoid recalculating the emit keys.*/ - draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); + draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE); memcpy(draw->pt.vertex_element, elements, count * sizeof(elements[0])); draw->pt.nr_vertex_elements = count; @@ -453,7 +460,7 @@ draw_set_mapped_constant_buffer(struct draw_context *draw, enum pipe_shader_type shader_type, unsigned slot, const void *buffer, - unsigned size ) + unsigned size) { assert(shader_type == PIPE_SHADER_VERTEX || shader_type == PIPE_SHADER_GEOMETRY || @@ -490,7 +497,7 @@ draw_set_mapped_shader_buffer(struct draw_context *draw, enum pipe_shader_type shader_type, unsigned slot, const void *buffer, - unsigned size ) + unsigned size) { assert(shader_type == PIPE_SHADER_VERTEX || shader_type == PIPE_SHADER_GEOMETRY || @@ -522,6 +529,7 @@ draw_set_mapped_shader_buffer(struct draw_context *draw, } } + /** * Tells the draw module to draw points with triangles if their size * is greater than this threshold. @@ -529,7 +537,7 @@ draw_set_mapped_shader_buffer(struct draw_context *draw, void draw_wide_point_threshold(struct draw_context *draw, float threshold) { - draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); + draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE); draw->pipeline.wide_point_threshold = threshold; } @@ -540,7 +548,7 @@ draw_wide_point_threshold(struct draw_context *draw, float threshold) void draw_wide_point_sprites(struct draw_context *draw, boolean draw_sprite) { - draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); + draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE); draw->pipeline.wide_point_sprites = draw_sprite; } @@ -552,7 +560,7 @@ draw_wide_point_sprites(struct draw_context *draw, boolean draw_sprite) void draw_wide_line_threshold(struct draw_context *draw, float threshold) { - draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); + draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE); draw->pipeline.wide_line_threshold = roundf(threshold); } @@ -563,7 +571,7 @@ draw_wide_line_threshold(struct draw_context *draw, float threshold) void draw_enable_line_stipple(struct draw_context *draw, boolean enable) { - draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); + draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE); draw->pipeline.line_stipple = enable; } @@ -574,12 +582,11 @@ draw_enable_line_stipple(struct draw_context *draw, boolean enable) void draw_enable_point_sprites(struct draw_context *draw, boolean enable) { - draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); + draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE); draw->pipeline.point_sprite = enable; } - /** * Allocate an extra vertex/geometry shader vertex attribute, if it doesn't * exist already. @@ -592,17 +599,13 @@ int draw_alloc_extra_vertex_attrib(struct draw_context *draw, uint semantic_name, uint semantic_index) { - int slot; - uint num_outputs; - uint n; - - slot = draw_find_shader_output(draw, semantic_name, semantic_index); + int slot = draw_find_shader_output(draw, semantic_name, semantic_index); if (slot >= 0) { return slot; } - num_outputs = draw_current_shader_outputs(draw); - n = draw->extra_shader_outputs.num; + uint num_outputs = draw_current_shader_outputs(draw); + uint n = draw->extra_shader_outputs.num; assert(n < ARRAY_SIZE(draw->extra_shader_outputs.semantic_name)); @@ -633,7 +636,6 @@ draw_remove_extra_vertex_attribs(struct draw_context *draw) struct tgsi_shader_info * draw_get_shader_info(const struct draw_context *draw) { - if (draw->gs.geometry_shader) { return &draw->gs.geometry_shader->info; } else if (draw->tes.tess_eval_shader) { @@ -643,6 +645,7 @@ draw_get_shader_info(const struct draw_context *draw) } } + /** * Prepare outputs slots from the draw module * @@ -666,6 +669,7 @@ draw_prepare_shader_outputs(struct draw_context *draw) draw_aaline_prepare_outputs(draw, draw->pipeline.aaline); } + /** * Ask the draw module for the location/slot of the given vertex attribute in * a post-transformed vertex. @@ -687,16 +691,15 @@ draw_find_shader_output(const struct draw_context *draw, uint semantic_name, uint semantic_index) { const struct tgsi_shader_info *info = draw_get_shader_info(draw); - uint i; - for (i = 0; i < info->num_outputs; i++) { + for (unsigned i = 0; i < info->num_outputs; i++) { if (info->output_semantic_name[i] == semantic_name && info->output_semantic_index[i] == semantic_index) return i; } /* Search the extra vertex attributes */ - for (i = 0; i < draw->extra_shader_outputs.num; i++) { + for (unsigned i = 0; i < draw->extra_shader_outputs.num; i++) { if (draw->extra_shader_outputs.semantic_name[i] == semantic_name && draw->extra_shader_outputs.semantic_index[i] == semantic_index) { return draw->extra_shader_outputs.slot[i]; @@ -720,12 +723,7 @@ uint draw_num_shader_outputs(const struct draw_context *draw) { const struct tgsi_shader_info *info = draw_get_shader_info(draw); - uint count; - - count = info->num_outputs; - count += draw->extra_shader_outputs.num; - - return count; + return info->num_outputs + draw->extra_shader_outputs.num; } @@ -743,6 +741,7 @@ draw_total_vs_outputs(const struct draw_context *draw) return info->num_outputs + draw->extra_shader_outputs.num; } + /** * Return total number of the geometry shader outputs. This function * also counts any extra geometry output attributes that may @@ -751,49 +750,40 @@ draw_total_vs_outputs(const struct draw_context *draw) */ uint draw_total_gs_outputs(const struct draw_context *draw) -{ - const struct tgsi_shader_info *info; - +{ if (!draw->gs.geometry_shader) return 0; - - info = &draw->gs.geometry_shader->info; - + const struct tgsi_shader_info *info = &draw->gs.geometry_shader->info; return info->num_outputs + draw->extra_shader_outputs.num; } + /** * Return total number of the tess ctrl shader outputs. */ uint draw_total_tcs_outputs(const struct draw_context *draw) { - const struct tgsi_shader_info *info; - if (!draw->tcs.tess_ctrl_shader) return 0; - - info = &draw->tcs.tess_ctrl_shader->info; - + const struct tgsi_shader_info *info = &draw->tcs.tess_ctrl_shader->info; return info->num_outputs; } + /** * Return total number of the tess eval shader outputs. */ uint draw_total_tes_outputs(const struct draw_context *draw) { - const struct tgsi_shader_info *info; - if (!draw->tes.tess_eval_shader) return 0; - - info = &draw->tes.tess_eval_shader->info; - + const struct tgsi_shader_info *info = &draw->tes.tess_eval_shader->info; return info->num_outputs + draw->extra_shader_outputs.num; } + /** * Provide TGSI sampler objects for vertex/geometry shaders that use * texture fetches. This state only needs to be set once per context. @@ -823,6 +813,7 @@ draw_texture_sampler(struct draw_context *draw, } } + /** * Provide TGSI image objects for vertex/geometry shaders that use * texture fetches. This state only needs to be set once per context. @@ -852,6 +843,7 @@ draw_image(struct draw_context *draw, } } + /** * Provide TGSI buffer objects for vertex/geometry shaders that use * load/store/atomic ops. This state only needs to be set once per context. @@ -882,8 +874,9 @@ draw_buffer(struct draw_context *draw, } -void draw_set_render( struct draw_context *draw, - struct vbuf_render *render ) +void +draw_set_render(struct draw_context *draw, + struct vbuf_render *render) { draw->render = render; } @@ -913,17 +906,16 @@ draw_set_indexes(struct draw_context *draw, /* Revamp me please: */ -void draw_do_flush( struct draw_context *draw, unsigned flags ) +void draw_do_flush(struct draw_context *draw, unsigned flags) { - if (!draw->suspend_flushing) - { + if (!draw->suspend_flushing) { assert(!draw->flushing); /* catch inadvertant recursion */ draw->flushing = TRUE; - draw_pipeline_flush( draw, flags ); + draw_pipeline_flush(draw, flags); - draw_pt_flush( draw, flags ); + draw_pt_flush(draw, flags); draw->flushing = FALSE; } @@ -976,6 +968,7 @@ draw_current_shader_viewport_index_output(const struct draw_context *draw) return draw->vs.vertex_shader->viewport_index_output; } + /** * Returns true if there's a geometry shader bound and the geometry * shader writes out a viewport index. @@ -1007,6 +1000,7 @@ draw_current_shader_clipvertex_output(const struct draw_context *draw) return draw->vs.clipvertex_output; } + uint draw_current_shader_ccdistance_output(const struct draw_context *draw, int index) { @@ -1039,6 +1033,7 @@ draw_current_shader_num_written_culldistances(const struct draw_context *draw) return draw->vs.vertex_shader->info.num_written_culldistance; } + /** * Return a pointer/handle for a driver/CSO rasterizer object which * disabled culling, stippling, unfilled tris, etc. @@ -1051,8 +1046,8 @@ draw_current_shader_num_written_culldistances(const struct draw_context *draw) * \return rasterizer CSO handle */ void * -draw_get_rasterizer_no_cull( struct draw_context *draw, - const struct pipe_rasterizer_state *base_rast ) +draw_get_rasterizer_no_cull(struct draw_context *draw, + const struct pipe_rasterizer_state *base_rast) { if (!draw->rasterizer_no_cull[base_rast->scissor][base_rast->flatshade][base_rast->rasterizer_discard]) { /* create now */ @@ -1074,60 +1069,57 @@ draw_get_rasterizer_no_cull( struct draw_context *draw, return draw->rasterizer_no_cull[base_rast->scissor][base_rast->flatshade][base_rast->rasterizer_discard]; } + void draw_set_mapped_so_targets(struct draw_context *draw, - int num_targets, + unsigned num_targets, struct draw_so_target *targets[PIPE_MAX_SO_BUFFERS]) { - int i; + draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE); - draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); - - for (i = 0; i < num_targets; i++) + for (unsigned i = 0; i < num_targets; i++) draw->so.targets[i] = targets[i]; - for (i = num_targets; i < PIPE_MAX_SO_BUFFERS; i++) + for (unsigned i = num_targets; i < PIPE_MAX_SO_BUFFERS; i++) draw->so.targets[i] = NULL; draw->so.num_targets = num_targets; } + void draw_set_sampler_views(struct draw_context *draw, enum pipe_shader_type shader_stage, struct pipe_sampler_view **views, unsigned num) { - unsigned i; - assert(shader_stage < PIPE_SHADER_TYPES); assert(num <= PIPE_MAX_SHADER_SAMPLER_VIEWS); - draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); + draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE); - for (i = 0; i < num; ++i) + for (unsigned i = 0; i < num; ++i) draw->sampler_views[shader_stage][i] = views[i]; - for (i = num; i < draw->num_sampler_views[shader_stage]; ++i) + for (unsigned i = num; i < draw->num_sampler_views[shader_stage]; ++i) draw->sampler_views[shader_stage][i] = NULL; draw->num_sampler_views[shader_stage] = num; } + void draw_set_samplers(struct draw_context *draw, enum pipe_shader_type shader_stage, struct pipe_sampler_state **samplers, unsigned num) { - unsigned i; - assert(shader_stage < PIPE_SHADER_TYPES); assert(num <= PIPE_MAX_SAMPLERS); - draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); + draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE); - for (i = 0; i < num; ++i) + for (unsigned i = 0; i < num; ++i) draw->samplers[shader_stage][i] = samplers[i]; - for (i = num; i < PIPE_MAX_SAMPLERS; ++i) + for (unsigned i = num; i < PIPE_MAX_SAMPLERS; ++i) draw->samplers[shader_stage][i] = NULL; draw->num_samplers[shader_stage] = num; @@ -1138,27 +1130,27 @@ draw_set_samplers(struct draw_context *draw, #endif } + void draw_set_images(struct draw_context *draw, enum pipe_shader_type shader_stage, struct pipe_image_view *views, unsigned num) { - unsigned i; - assert(shader_stage < PIPE_SHADER_TYPES); assert(num <= PIPE_MAX_SHADER_IMAGES); - draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); + draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE); - for (i = 0; i < num; ++i) + for (unsigned i = 0; i < num; ++i) draw->images[shader_stage][i] = &views[i]; - for (i = num; i < draw->num_sampler_views[shader_stage]; ++i) + for (unsigned i = num; i < draw->num_sampler_views[shader_stage]; ++i) draw->images[shader_stage][i] = NULL; draw->num_images[shader_stage] = num; } + void draw_set_mapped_texture(struct draw_context *draw, enum pipe_shader_type shader_stage, @@ -1183,6 +1175,7 @@ draw_set_mapped_texture(struct draw_context *draw, #endif } + void draw_set_mapped_image(struct draw_context *draw, enum pipe_shader_type shader_stage, @@ -1206,6 +1199,7 @@ draw_set_mapped_image(struct draw_context *draw, #endif } + /** * XXX: Results for PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS because there are two * different ways of setting textures, and drivers typically only support one. @@ -1223,6 +1217,7 @@ draw_get_shader_param_no_llvm(enum pipe_shader_type shader, } } + /** * XXX: Results for PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS because there are two * different ways of setting textures, and drivers typically only support one. @@ -1232,7 +1227,6 @@ draw_get_shader_param_no_llvm(enum pipe_shader_type shader, int draw_get_shader_param(enum pipe_shader_type shader, enum pipe_shader_cap param) { - #ifdef DRAW_LLVM_AVAILABLE if (draw_get_option_use_llvm()) { switch(shader) { @@ -1250,6 +1244,7 @@ draw_get_shader_param(enum pipe_shader_type shader, enum pipe_shader_cap param) return draw_get_shader_param_no_llvm(shader, param); } + /** * Enables or disables collection of statistics. * @@ -1267,6 +1262,7 @@ draw_collect_pipeline_statistics(struct draw_context *draw, draw->collect_statistics = enable; } + /** * Enable/disable primitives generated gathering. */ @@ -1276,6 +1272,7 @@ void draw_collect_primitives_generated(struct draw_context *draw, draw->collect_primgen = enable; } + /** * Computes clipper invocation statistics. * @@ -1323,10 +1320,11 @@ draw_will_inject_frontface(const struct draw_context *draw) rast->fill_back != PIPE_POLYGON_MODE_FILL)); } + void draw_set_tess_state(struct draw_context *draw, - const float default_outer_level[4], - const float default_inner_level[2]) + const float default_outer_level[4], + const float default_inner_level[2]) { for (unsigned i = 0; i < 4; i++) draw->default_outer_tess_level[i] = default_outer_level[i]; @@ -1334,6 +1332,7 @@ draw_set_tess_state(struct draw_context *draw, draw->default_inner_tess_level[i] = default_inner_level[i]; } + void draw_set_disk_cache_callbacks(struct draw_context *draw, void *data_cookie, @@ -1349,7 +1348,9 @@ draw_set_disk_cache_callbacks(struct draw_context *draw, draw->disk_cache_cookie = data_cookie; } -void draw_set_constant_buffer_stride(struct draw_context *draw, unsigned num_bytes) + +void +draw_set_constant_buffer_stride(struct draw_context *draw, unsigned num_bytes) { draw->constant_buffer_stride = num_bytes; } diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h index 1cf548e..d42e985 100644 --- a/src/gallium/auxiliary/draw/draw_context.h +++ b/src/gallium/auxiliary/draw/draw_context.h @@ -317,7 +317,7 @@ draw_set_mapped_shader_buffer(struct draw_context *draw, void draw_set_mapped_so_targets(struct draw_context *draw, - int num_targets, + unsigned num_targets, struct draw_so_target *targets[PIPE_MAX_SO_BUFFERS]); -- 2.7.4