Lines Matching refs:draw
75 struct draw_context *draw = CALLOC_STRUCT( draw_context ); in draw_create_context() local
76 if (draw == NULL) in draw_create_context()
81 draw->llvm = draw_llvm_create(draw); in draw_create_context()
82 if (!draw->llvm) in draw_create_context()
87 draw->pipe = pipe; in draw_create_context()
89 if (!draw_init(draw)) in draw_create_context()
92 return draw; in draw_create_context()
95 draw_destroy( draw ); in draw_create_context()
121 boolean draw_init(struct draw_context *draw) in draw_init() argument
129 ASSIGN_4V( draw->plane[0], -1, 0, 0, 1 ); in draw_init()
130 ASSIGN_4V( draw->plane[1], 1, 0, 0, 1 ); in draw_init()
131 ASSIGN_4V( draw->plane[2], 0, -1, 0, 1 ); in draw_init()
132 ASSIGN_4V( draw->plane[3], 0, 1, 0, 1 ); in draw_init()
133 ASSIGN_4V( draw->plane[4], 0, 0, 1, 1 ); /* yes these are correct */ in draw_init()
134 ASSIGN_4V( draw->plane[5], 0, 0, -1, 1 ); /* mesa's a bit wonky */ in draw_init()
135 draw->clip_xy = TRUE; in draw_init()
136 draw->clip_z = TRUE; in draw_init()
138 draw->pt.user.planes = (float (*) [DRAW_TOTAL_CLIP_PLANES][4]) &(draw->plane[0]); in draw_init()
140 if (!draw_pipeline_init( draw )) in draw_init()
143 if (!draw_pt_init( draw )) in draw_init()
146 if (!draw_vs_init( draw )) in draw_init()
149 if (!draw_gs_init( draw )) in draw_init()
152 draw->quads_always_flatshade_last = !draw->pipe->screen->get_param( in draw_init()
153 draw->pipe->screen, PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION); in draw_init()
159 void draw_destroy( struct draw_context *draw ) in draw_destroy() argument
164 if (!draw) in draw_destroy()
167 pipe = draw->pipe; in draw_destroy()
173 if (draw->rasterizer_no_cull[i][j]) { in draw_destroy()
174 pipe->delete_rasterizer_state(pipe, draw->rasterizer_no_cull[i][j]); in draw_destroy()
179 for (i = 0; i < draw->pt.nr_vertex_buffers; i++) { in draw_destroy()
180 pipe_resource_reference(&draw->pt.vertex_buffer[i].buffer, NULL); in draw_destroy()
189 draw_pipeline_destroy( draw ); in draw_destroy()
190 draw_pt_destroy( draw ); in draw_destroy()
191 draw_vs_destroy( draw ); in draw_destroy()
192 draw_gs_destroy( draw ); in draw_destroy()
194 if (draw->llvm) in draw_destroy()
195 draw_llvm_destroy( draw->llvm ); in draw_destroy()
198 FREE( draw ); in draw_destroy()
203 void draw_flush( struct draw_context *draw ) in draw_flush() argument
205 draw_do_flush( draw, DRAW_FLUSH_BACKEND ); in draw_flush()
216 void draw_set_mrd(struct draw_context *draw, double mrd) in draw_set_mrd() argument
218 draw->mrd = mrd; in draw_set_mrd()
222 static void update_clip_flags( struct draw_context *draw ) in update_clip_flags() argument
224 draw->clip_xy = !draw->driver.bypass_clip_xy; in update_clip_flags()
225 draw->guard_band_xy = (!draw->driver.bypass_clip_xy && in update_clip_flags()
226 draw->driver.guard_band_xy); in update_clip_flags()
227 draw->clip_z = (!draw->driver.bypass_clip_z && in update_clip_flags()
228 draw->rasterizer && draw->rasterizer->depth_clip); in update_clip_flags()
229 draw->clip_user = draw->rasterizer && in update_clip_flags()
230 draw->rasterizer->clip_plane_enable != 0; in update_clip_flags()
237 void draw_set_rasterizer_state( struct draw_context *draw, in draw_set_rasterizer_state() argument
241 if (!draw->suspend_flushing) { in draw_set_rasterizer_state()
242 draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); in draw_set_rasterizer_state()
244 draw->rasterizer = raster; in draw_set_rasterizer_state()
245 draw->rast_handle = rast_handle; in draw_set_rasterizer_state()
246 update_clip_flags(draw); in draw_set_rasterizer_state()
257 void draw_set_driver_clipping( struct draw_context *draw, in draw_set_driver_clipping() argument
262 draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); in draw_set_driver_clipping()
264 draw->driver.bypass_clip_xy = bypass_clip_xy; in draw_set_driver_clipping()
265 draw->driver.bypass_clip_z = bypass_clip_z; in draw_set_driver_clipping()
266 draw->driver.guard_band_xy = guard_band_xy; in draw_set_driver_clipping()
267 update_clip_flags(draw); in draw_set_driver_clipping()
276 void draw_set_rasterize_stage( struct draw_context *draw, in draw_set_rasterize_stage() argument
279 draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); in draw_set_rasterize_stage()
281 draw->pipeline.rasterize = stage; in draw_set_rasterize_stage()
288 void draw_set_clip_state( struct draw_context *draw, in draw_set_clip_state() argument
291 draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); in draw_set_clip_state()
293 memcpy(&draw->plane[6], clip->ucp, sizeof(clip->ucp)); in draw_set_clip_state()
300 void draw_set_viewport_state( struct draw_context *draw, in draw_set_viewport_state() argument
303 draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); in draw_set_viewport_state()
304 draw->viewport = *viewport; /* struct copy */ in draw_set_viewport_state()
305 draw->identity_viewport = (viewport->scale[0] == 1.0f && in draw_set_viewport_state()
314 draw_vs_set_viewport( draw, viewport ); in draw_set_viewport_state()
320 draw_set_vertex_buffers(struct draw_context *draw, in draw_set_vertex_buffers() argument
326 util_copy_vertex_buffers(draw->pt.vertex_buffer, in draw_set_vertex_buffers()
327 &draw->pt.nr_vertex_buffers, in draw_set_vertex_buffers()
333 draw_set_vertex_elements(struct draw_context *draw, in draw_set_vertex_elements() argument
341 draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); in draw_set_vertex_elements()
343 memcpy(draw->pt.vertex_element, elements, count * sizeof(elements[0])); in draw_set_vertex_elements()
344 draw->pt.nr_vertex_elements = count; in draw_set_vertex_elements()
352 draw_set_mapped_vertex_buffer(struct draw_context *draw, in draw_set_mapped_vertex_buffer() argument
355 draw->pt.user.vbuffer[attr] = buffer; in draw_set_mapped_vertex_buffer()
360 draw_set_mapped_constant_buffer(struct draw_context *draw, in draw_set_mapped_constant_buffer() argument
372 draw->pt.user.vs_constants[slot] = buffer; in draw_set_mapped_constant_buffer()
373 draw->pt.user.vs_constants_size[slot] = size; in draw_set_mapped_constant_buffer()
374 draw_vs_set_constants(draw, slot, buffer, size); in draw_set_mapped_constant_buffer()
377 draw->pt.user.gs_constants[slot] = buffer; in draw_set_mapped_constant_buffer()
378 draw->pt.user.gs_constants_size[slot] = size; in draw_set_mapped_constant_buffer()
379 draw_gs_set_constants(draw, slot, buffer, size); in draw_set_mapped_constant_buffer()
392 draw_wide_point_threshold(struct draw_context *draw, float threshold) in draw_wide_point_threshold() argument
394 draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); in draw_wide_point_threshold()
395 draw->pipeline.wide_point_threshold = threshold; in draw_wide_point_threshold()
403 draw_wide_point_sprites(struct draw_context *draw, boolean draw_sprite) in draw_wide_point_sprites() argument
405 draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); in draw_wide_point_sprites()
406 draw->pipeline.wide_point_sprites = draw_sprite; in draw_wide_point_sprites()
415 draw_wide_line_threshold(struct draw_context *draw, float threshold) in draw_wide_line_threshold() argument
417 draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); in draw_wide_line_threshold()
418 draw->pipeline.wide_line_threshold = roundf(threshold); in draw_wide_line_threshold()
426 draw_enable_line_stipple(struct draw_context *draw, boolean enable) in draw_enable_line_stipple() argument
428 draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); in draw_enable_line_stipple()
429 draw->pipeline.line_stipple = enable; in draw_enable_line_stipple()
437 draw_enable_point_sprites(struct draw_context *draw, boolean enable) in draw_enable_point_sprites() argument
439 draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); in draw_enable_point_sprites()
440 draw->pipeline.point_sprite = enable; in draw_enable_point_sprites()
445 draw_set_force_passthrough( struct draw_context *draw, boolean enable ) in draw_set_force_passthrough() argument
447 draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); in draw_set_force_passthrough()
448 draw->force_passthrough = enable; in draw_set_force_passthrough()
462 draw_alloc_extra_vertex_attrib(struct draw_context *draw, in draw_alloc_extra_vertex_attrib() argument
469 slot = draw_find_shader_output(draw, semantic_name, semantic_index); in draw_alloc_extra_vertex_attrib()
474 num_outputs = draw_current_shader_outputs(draw); in draw_alloc_extra_vertex_attrib()
475 n = draw->extra_shader_outputs.num; in draw_alloc_extra_vertex_attrib()
477 assert(n < Elements(draw->extra_shader_outputs.semantic_name)); in draw_alloc_extra_vertex_attrib()
479 draw->extra_shader_outputs.semantic_name[n] = semantic_name; in draw_alloc_extra_vertex_attrib()
480 draw->extra_shader_outputs.semantic_index[n] = semantic_index; in draw_alloc_extra_vertex_attrib()
481 draw->extra_shader_outputs.slot[n] = num_outputs + n; in draw_alloc_extra_vertex_attrib()
482 draw->extra_shader_outputs.num++; in draw_alloc_extra_vertex_attrib()
484 return draw->extra_shader_outputs.slot[n]; in draw_alloc_extra_vertex_attrib()
493 draw_remove_extra_vertex_attribs(struct draw_context *draw) in draw_remove_extra_vertex_attribs() argument
495 draw->extra_shader_outputs.num = 0; in draw_remove_extra_vertex_attribs()
504 draw_get_shader_info(const struct draw_context *draw) in draw_get_shader_info() argument
507 if (draw->gs.geometry_shader) { in draw_get_shader_info()
508 return &draw->gs.geometry_shader->info; in draw_get_shader_info()
510 return &draw->vs.vertex_shader->info; in draw_get_shader_info()
531 draw_find_shader_output(const struct draw_context *draw, in draw_find_shader_output() argument
534 const struct tgsi_shader_info *info = draw_get_shader_info(draw); in draw_find_shader_output()
544 for (i = 0; i < draw->extra_shader_outputs.num; i++) { in draw_find_shader_output()
545 if (draw->extra_shader_outputs.semantic_name[i] == semantic_name && in draw_find_shader_output()
546 draw->extra_shader_outputs.semantic_index[i] == semantic_index) { in draw_find_shader_output()
547 return draw->extra_shader_outputs.slot[i]; in draw_find_shader_output()
565 draw_num_shader_outputs(const struct draw_context *draw) in draw_num_shader_outputs() argument
567 const struct tgsi_shader_info *info = draw_get_shader_info(draw); in draw_num_shader_outputs()
571 count += draw->extra_shader_outputs.num; in draw_num_shader_outputs()
583 draw_texture_samplers(struct draw_context *draw, in draw_texture_samplers() argument
589 draw->vs.tgsi.num_samplers = num_samplers; in draw_texture_samplers()
590 draw->vs.tgsi.samplers = samplers; in draw_texture_samplers()
593 draw->gs.tgsi.num_samplers = num_samplers; in draw_texture_samplers()
594 draw->gs.tgsi.samplers = samplers; in draw_texture_samplers()
601 void draw_set_render( struct draw_context *draw, in draw_set_render() argument
604 draw->render = render; in draw_set_render()
616 draw_set_indexes(struct draw_context *draw, in draw_set_indexes() argument
623 draw->pt.user.elts = elements; in draw_set_indexes()
624 draw->pt.user.eltSizeIB = elem_size; in draw_set_indexes()
630 void draw_do_flush( struct draw_context *draw, unsigned flags ) in draw_do_flush() argument
632 if (!draw->suspend_flushing) in draw_do_flush()
634 assert(!draw->flushing); /* catch inadvertant recursion */ in draw_do_flush()
636 draw->flushing = TRUE; in draw_do_flush()
638 draw_pipeline_flush( draw, flags ); in draw_do_flush()
640 draw_pt_flush( draw, flags ); in draw_do_flush()
642 draw->flushing = FALSE; in draw_do_flush()
654 draw_current_shader_outputs(const struct draw_context *draw) in draw_current_shader_outputs() argument
656 if (draw->gs.geometry_shader) in draw_current_shader_outputs()
657 return draw->gs.num_gs_outputs; in draw_current_shader_outputs()
658 return draw->vs.num_vs_outputs; in draw_current_shader_outputs()
667 draw_current_shader_position_output(const struct draw_context *draw) in draw_current_shader_position_output() argument
669 if (draw->gs.geometry_shader) in draw_current_shader_position_output()
670 return draw->gs.position_output; in draw_current_shader_position_output()
671 return draw->vs.position_output; in draw_current_shader_position_output()
680 draw_current_shader_clipvertex_output(const struct draw_context *draw) in draw_current_shader_clipvertex_output() argument
682 return draw->vs.clipvertex_output; in draw_current_shader_clipvertex_output()
686 draw_current_shader_clipdistance_output(const struct draw_context *draw, int index) in draw_current_shader_clipdistance_output() argument
688 return draw->vs.clipdistance_output[index]; in draw_current_shader_clipdistance_output()
703 draw_get_rasterizer_no_cull( struct draw_context *draw, in draw_get_rasterizer_no_cull() argument
707 if (!draw->rasterizer_no_cull[scissor][flatshade]) { in draw_get_rasterizer_no_cull()
709 struct pipe_context *pipe = draw->pipe; in draw_get_rasterizer_no_cull()
716 rast.gl_rasterization_rules = draw->rasterizer->gl_rasterization_rules; in draw_get_rasterizer_no_cull()
718 draw->rasterizer_no_cull[scissor][flatshade] = in draw_get_rasterizer_no_cull()
721 return draw->rasterizer_no_cull[scissor][flatshade]; in draw_get_rasterizer_no_cull()
725 draw_set_mapped_so_targets(struct draw_context *draw, in draw_set_mapped_so_targets() argument
732 draw->so.targets[i] = targets[i]; in draw_set_mapped_so_targets()
734 draw->so.targets[i] = NULL; in draw_set_mapped_so_targets()
736 draw->so.num_targets = num_targets; in draw_set_mapped_so_targets()
740 draw_set_mapped_so_buffers(struct draw_context *draw, in draw_set_mapped_so_buffers() argument
747 draw_set_so_state(struct draw_context *draw, in draw_set_so_state() argument
750 memcpy(&draw->so.state, in draw_set_so_state()
756 draw_set_sampler_views(struct draw_context *draw, in draw_set_sampler_views() argument
767 draw->sampler_views[shader_stage][i] = views[i]; in draw_set_sampler_views()
769 draw->sampler_views[shader_stage][i] = NULL; in draw_set_sampler_views()
771 draw->num_sampler_views[shader_stage] = num; in draw_set_sampler_views()
775 draw_set_samplers(struct draw_context *draw, in draw_set_samplers() argument
786 draw->samplers[shader_stage][i] = samplers[i]; in draw_set_samplers()
788 draw->samplers[shader_stage][i] = NULL; in draw_set_samplers()
790 draw->num_samplers[shader_stage] = num; in draw_set_samplers()
793 if (draw->llvm && shader_stage == PIPE_SHADER_VERTEX) in draw_set_samplers()
794 draw_llvm_set_sampler_state(draw); in draw_set_samplers()
799 draw_set_mapped_texture(struct draw_context *draw, in draw_set_mapped_texture() argument
810 if (draw->llvm) in draw_set_mapped_texture()
811 draw_llvm_set_mapped_texture(draw, in draw_set_mapped_texture()