• Home
  • Raw
  • Download

Lines Matching refs:setup

62 static boolean try_update_scene_state( struct lp_setup_context *setup );
66 lp_setup_get_empty_scene(struct lp_setup_context *setup) in lp_setup_get_empty_scene() argument
68 assert(setup->scene == NULL); in lp_setup_get_empty_scene()
70 setup->scene_idx++; in lp_setup_get_empty_scene()
71 setup->scene_idx %= Elements(setup->scenes); in lp_setup_get_empty_scene()
73 setup->scene = setup->scenes[setup->scene_idx]; in lp_setup_get_empty_scene()
75 if (setup->scene->fence) { in lp_setup_get_empty_scene()
78 __FUNCTION__, setup->scene->fence->id); in lp_setup_get_empty_scene()
80 lp_fence_wait(setup->scene->fence); in lp_setup_get_empty_scene()
83 lp_scene_begin_binning(setup->scene, &setup->fb); in lp_setup_get_empty_scene()
89 first_triangle( struct lp_setup_context *setup, in first_triangle() argument
94 assert(setup->state == SETUP_ACTIVE); in first_triangle()
95 lp_setup_choose_triangle( setup ); in first_triangle()
96 setup->triangle( setup, v0, v1, v2 ); in first_triangle()
100 first_line( struct lp_setup_context *setup, in first_line() argument
104 assert(setup->state == SETUP_ACTIVE); in first_line()
105 lp_setup_choose_line( setup ); in first_line()
106 setup->line( setup, v0, v1 ); in first_line()
110 first_point( struct lp_setup_context *setup, in first_point() argument
113 assert(setup->state == SETUP_ACTIVE); in first_point()
114 lp_setup_choose_point( setup ); in first_point()
115 setup->point( setup, v0 ); in first_point()
118 void lp_setup_reset( struct lp_setup_context *setup ) in lp_setup_reset() argument
123 setup->constants.stored_size = 0; in lp_setup_reset()
124 setup->constants.stored_data = NULL; in lp_setup_reset()
125 setup->fs.stored = NULL; in lp_setup_reset()
126 setup->dirty = ~0; in lp_setup_reset()
129 setup->scene = NULL; in lp_setup_reset()
133 memset(&setup->clear, 0, sizeof setup->clear); in lp_setup_reset()
138 setup->line = first_line; in lp_setup_reset()
139 setup->point = first_point; in lp_setup_reset()
140 setup->triangle = first_triangle; in lp_setup_reset()
146 lp_setup_rasterize_scene( struct lp_setup_context *setup ) in lp_setup_rasterize_scene() argument
148 struct lp_scene *scene = setup->scene; in lp_setup_rasterize_scene()
153 lp_fence_reference(&setup->last_fence, scene->fence); in lp_setup_rasterize_scene()
155 if (setup->last_fence) in lp_setup_rasterize_scene()
156 setup->last_fence->issued = TRUE; in lp_setup_rasterize_scene()
163 lp_scene_end_rasterization(setup->scene); in lp_setup_rasterize_scene()
164 lp_setup_reset( setup ); in lp_setup_rasterize_scene()
172 begin_binning( struct lp_setup_context *setup ) in begin_binning() argument
174 struct lp_scene *scene = setup->scene; in begin_binning()
184 scene->fence = lp_fence_create(MAX2(1, setup->num_threads)); in begin_binning()
197 ok = try_update_scene_state(setup); in begin_binning()
201 if (setup->fb.zsbuf && in begin_binning()
202 ((setup->clear.flags & PIPE_CLEAR_DEPTHSTENCIL) != PIPE_CLEAR_DEPTHSTENCIL) && in begin_binning()
203 util_format_is_depth_and_stencil(setup->fb.zsbuf->format)) in begin_binning()
207 (setup->clear.flags & PIPE_CLEAR_COLOR) ? "clear": "load", in begin_binning()
210 if (setup->fb.nr_cbufs) { in begin_binning()
211 if (setup->clear.flags & PIPE_CLEAR_COLOR) { in begin_binning()
214 setup->clear.color ); in begin_binning()
220 if (setup->fb.zsbuf) { in begin_binning()
221 if (setup->clear.flags & PIPE_CLEAR_DEPTHSTENCIL) { in begin_binning()
228 setup->clear.zsvalue, in begin_binning()
229 setup->clear.zsmask)); in begin_binning()
235 if (setup->active_query) { in begin_binning()
238 lp_rast_arg_query(setup->active_query) ); in begin_binning()
243 setup->clear.flags = 0; in begin_binning()
244 setup->clear.zsmask = 0; in begin_binning()
245 setup->clear.zsvalue = 0; in begin_binning()
258 execute_clears( struct lp_setup_context *setup ) in execute_clears() argument
262 return begin_binning( setup ); in execute_clears()
273 set_scene_state( struct lp_setup_context *setup, in set_scene_state() argument
277 unsigned old_state = setup->state; in set_scene_state()
290 if (new_state == SETUP_FLUSHED && setup->scene) in set_scene_state()
291 lp_debug_draw_bins_by_cmd_length(setup->scene); in set_scene_state()
297 lp_setup_get_empty_scene(setup); in set_scene_state()
304 if (!begin_binning( setup )) in set_scene_state()
310 if (!execute_clears( setup )) in set_scene_state()
313 lp_setup_rasterize_scene( setup ); in set_scene_state()
314 assert(setup->scene == NULL); in set_scene_state()
322 setup->state = new_state; in set_scene_state()
326 if (setup->scene) { in set_scene_state()
327 lp_scene_end_rasterization(setup->scene); in set_scene_state()
328 setup->scene = NULL; in set_scene_state()
331 setup->state = SETUP_FLUSHED; in set_scene_state()
332 lp_setup_reset( setup ); in set_scene_state()
338 lp_setup_flush( struct lp_setup_context *setup, in lp_setup_flush() argument
342 set_scene_state( setup, SETUP_FLUSHED, reason ); in lp_setup_flush()
345 lp_fence_reference((struct lp_fence **)fence, setup->last_fence); in lp_setup_flush()
351 lp_setup_bind_framebuffer( struct lp_setup_context *setup, in lp_setup_bind_framebuffer() argument
358 set_scene_state( setup, SETUP_FLUSHED, __FUNCTION__ ); in lp_setup_bind_framebuffer()
363 assert(!setup->scene); in lp_setup_bind_framebuffer()
368 util_copy_framebuffer_state(&setup->fb, fb); in lp_setup_bind_framebuffer()
369 setup->framebuffer.x0 = 0; in lp_setup_bind_framebuffer()
370 setup->framebuffer.y0 = 0; in lp_setup_bind_framebuffer()
371 setup->framebuffer.x1 = fb->width-1; in lp_setup_bind_framebuffer()
372 setup->framebuffer.y1 = fb->height-1; in lp_setup_bind_framebuffer()
373 setup->dirty |= LP_SETUP_NEW_SCISSOR; in lp_setup_bind_framebuffer()
378 lp_setup_try_clear( struct lp_setup_context *setup, in lp_setup_try_clear() argument
389 LP_DBG(DEBUG_SETUP, "%s state %d\n", __FUNCTION__, setup->state); in lp_setup_try_clear()
400 zsvalue = util_pack_z_stencil(setup->fb.zsbuf->format, in lp_setup_try_clear()
405 zsmask = util_pack_mask_z_stencil(setup->fb.zsbuf->format, in lp_setup_try_clear()
412 if (setup->state == SETUP_ACTIVE) { in lp_setup_try_clear()
413 struct lp_scene *scene = setup->scene; in lp_setup_try_clear()
441 set_scene_state( setup, SETUP_CLEARED, __FUNCTION__ ); in lp_setup_try_clear()
443 setup->clear.flags |= flags; in lp_setup_try_clear()
446 setup->clear.zsmask |= zsmask; in lp_setup_try_clear()
447 setup->clear.zsvalue = in lp_setup_try_clear()
448 (setup->clear.zsvalue & ~zsmask) | (zsvalue & zsmask); in lp_setup_try_clear()
452 memcpy(setup->clear.color.clear_color, in lp_setup_try_clear()
454 sizeof setup->clear.color.clear_color); in lp_setup_try_clear()
462 lp_setup_clear( struct lp_setup_context *setup, in lp_setup_clear() argument
468 if (!lp_setup_try_clear( setup, color, depth, stencil, flags )) { in lp_setup_clear()
469 lp_setup_flush(setup, NULL, __FUNCTION__); in lp_setup_clear()
471 if (!lp_setup_try_clear( setup, color, depth, stencil, flags )) in lp_setup_clear()
481 lp_setup_set_triangle_state( struct lp_setup_context *setup, in lp_setup_set_triangle_state() argument
489 setup->ccw_is_frontface = ccw_is_frontface; in lp_setup_set_triangle_state()
490 setup->cullmode = cull_mode; in lp_setup_set_triangle_state()
491 setup->triangle = first_triangle; in lp_setup_set_triangle_state()
492 setup->pixel_offset = gl_rasterization_rules ? 0.5f : 0.0f; in lp_setup_set_triangle_state()
494 if (setup->scissor_test != scissor) { in lp_setup_set_triangle_state()
495 setup->dirty |= LP_SETUP_NEW_SCISSOR; in lp_setup_set_triangle_state()
496 setup->scissor_test = scissor; in lp_setup_set_triangle_state()
501 lp_setup_set_line_state( struct lp_setup_context *setup, in lp_setup_set_line_state() argument
506 setup->line_width = line_width; in lp_setup_set_line_state()
510 lp_setup_set_point_state( struct lp_setup_context *setup, in lp_setup_set_point_state() argument
518 setup->point_size = point_size; in lp_setup_set_point_state()
519 setup->sprite_coord_enable = sprite_coord_enable; in lp_setup_set_point_state()
520 setup->sprite_coord_origin = sprite_coord_origin; in lp_setup_set_point_state()
521 setup->point_size_per_vertex = point_size_per_vertex; in lp_setup_set_point_state()
525 lp_setup_set_setup_variant( struct lp_setup_context *setup, in lp_setup_set_setup_variant() argument
530 setup->setup.variant = variant; in lp_setup_set_setup_variant()
534 lp_setup_set_fs_variant( struct lp_setup_context *setup, in lp_setup_set_fs_variant() argument
541 setup->fs.current.variant = variant; in lp_setup_set_fs_variant()
542 setup->dirty |= LP_SETUP_NEW_FS; in lp_setup_set_fs_variant()
546 lp_setup_set_fs_constants(struct lp_setup_context *setup, in lp_setup_set_fs_constants() argument
551 pipe_resource_reference(&setup->constants.current, buffer); in lp_setup_set_fs_constants()
553 setup->dirty |= LP_SETUP_NEW_CONSTANTS; in lp_setup_set_fs_constants()
558 lp_setup_set_alpha_ref_value( struct lp_setup_context *setup, in lp_setup_set_alpha_ref_value() argument
563 if(setup->fs.current.jit_context.alpha_ref_value != alpha_ref_value) { in lp_setup_set_alpha_ref_value()
564 setup->fs.current.jit_context.alpha_ref_value = alpha_ref_value; in lp_setup_set_alpha_ref_value()
565 setup->dirty |= LP_SETUP_NEW_FS; in lp_setup_set_alpha_ref_value()
570 lp_setup_set_stencil_ref_values( struct lp_setup_context *setup, in lp_setup_set_stencil_ref_values() argument
575 if (setup->fs.current.jit_context.stencil_ref_front != refs[0] || in lp_setup_set_stencil_ref_values()
576 setup->fs.current.jit_context.stencil_ref_back != refs[1]) { in lp_setup_set_stencil_ref_values()
577 setup->fs.current.jit_context.stencil_ref_front = refs[0]; in lp_setup_set_stencil_ref_values()
578 setup->fs.current.jit_context.stencil_ref_back = refs[1]; in lp_setup_set_stencil_ref_values()
579 setup->dirty |= LP_SETUP_NEW_FS; in lp_setup_set_stencil_ref_values()
584 lp_setup_set_blend_color( struct lp_setup_context *setup, in lp_setup_set_blend_color() argument
591 if(memcmp(&setup->blend_color.current, blend_color, sizeof *blend_color) != 0) { in lp_setup_set_blend_color()
592 memcpy(&setup->blend_color.current, blend_color, sizeof *blend_color); in lp_setup_set_blend_color()
593 setup->dirty |= LP_SETUP_NEW_BLEND_COLOR; in lp_setup_set_blend_color()
599 lp_setup_set_scissor( struct lp_setup_context *setup, in lp_setup_set_scissor() argument
606 setup->scissor.x0 = scissor->minx; in lp_setup_set_scissor()
607 setup->scissor.x1 = scissor->maxx-1; in lp_setup_set_scissor()
608 setup->scissor.y0 = scissor->miny; in lp_setup_set_scissor()
609 setup->scissor.y1 = scissor->maxy-1; in lp_setup_set_scissor()
610 setup->dirty |= LP_SETUP_NEW_SCISSOR; in lp_setup_set_scissor()
615 lp_setup_set_flatshade_first( struct lp_setup_context *setup, in lp_setup_set_flatshade_first() argument
618 setup->flatshade_first = flatshade_first; in lp_setup_set_flatshade_first()
623 lp_setup_set_vertex_info( struct lp_setup_context *setup, in lp_setup_set_vertex_info() argument
628 setup->vertex_info = vertex_info; in lp_setup_set_vertex_info()
636 lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup, in lp_setup_set_fragment_sampler_views() argument
653 jit_tex = &setup->fs.current.jit_context.textures[i]; in lp_setup_set_fragment_sampler_views()
663 pipe_resource_reference(&setup->fs.current_tex[i], tex); in lp_setup_set_fragment_sampler_views()
705 setup->dirty |= LP_SETUP_NEW_FS; in lp_setup_set_fragment_sampler_views()
713 lp_setup_set_fragment_sampler_state(struct lp_setup_context *setup, in lp_setup_set_fragment_sampler_state() argument
728 jit_tex = &setup->fs.current.jit_context.textures[i]; in lp_setup_set_fragment_sampler_state()
737 setup->dirty |= LP_SETUP_NEW_FS; in lp_setup_set_fragment_sampler_state()
747 lp_setup_is_resource_referenced( const struct lp_setup_context *setup, in lp_setup_is_resource_referenced() argument
753 for (i = 0; i < setup->fb.nr_cbufs; i++) { in lp_setup_is_resource_referenced()
754 if (setup->fb.cbufs[i]->texture == texture) in lp_setup_is_resource_referenced()
757 if (setup->fb.zsbuf && setup->fb.zsbuf->texture == texture) { in lp_setup_is_resource_referenced()
762 for (i = 0; i < Elements(setup->scenes); i++) { in lp_setup_is_resource_referenced()
763 if (lp_scene_is_resource_referenced(setup->scenes[i], texture)) { in lp_setup_is_resource_referenced()
776 try_update_scene_state( struct lp_setup_context *setup ) in try_update_scene_state() argument
778 boolean new_scene = (setup->fs.stored == NULL); in try_update_scene_state()
779 struct lp_scene *scene = setup->scene; in try_update_scene_state()
783 if(setup->dirty & LP_SETUP_NEW_BLEND_COLOR) { in try_update_scene_state()
795 uint8_t c = float_to_ubyte(setup->blend_color.current.color[i]); in try_update_scene_state()
800 setup->blend_color.stored = stored; in try_update_scene_state()
801 setup->fs.current.jit_context.blend_color = setup->blend_color.stored; in try_update_scene_state()
802 setup->dirty |= LP_SETUP_NEW_FS; in try_update_scene_state()
805 if(setup->dirty & LP_SETUP_NEW_CONSTANTS) { in try_update_scene_state()
806 struct pipe_resource *buffer = setup->constants.current; in try_update_scene_state()
814 if(setup->constants.stored_size != current_size || in try_update_scene_state()
815 !setup->constants.stored_data || in try_update_scene_state()
816 memcmp(setup->constants.stored_data, in try_update_scene_state()
830 setup->constants.stored_size = current_size; in try_update_scene_state()
831 setup->constants.stored_data = stored; in try_update_scene_state()
835 setup->constants.stored_size = 0; in try_update_scene_state()
836 setup->constants.stored_data = NULL; in try_update_scene_state()
839 setup->fs.current.jit_context.constants = setup->constants.stored_data; in try_update_scene_state()
840 setup->dirty |= LP_SETUP_NEW_FS; in try_update_scene_state()
844 if (setup->dirty & LP_SETUP_NEW_FS) { in try_update_scene_state()
845 if (!setup->fs.stored || in try_update_scene_state()
846 memcmp(setup->fs.stored, in try_update_scene_state()
847 &setup->fs.current, in try_update_scene_state()
848 sizeof setup->fs.current) != 0) in try_update_scene_state()
864 &setup->fs.current, in try_update_scene_state()
865 sizeof setup->fs.current); in try_update_scene_state()
866 setup->fs.stored = stored; in try_update_scene_state()
871 for (i = 0; i < Elements(setup->fs.current_tex); i++) { in try_update_scene_state()
872 if (setup->fs.current_tex[i]) { in try_update_scene_state()
874 setup->fs.current_tex[i], in try_update_scene_state()
884 if (setup->dirty & LP_SETUP_NEW_SCISSOR) { in try_update_scene_state()
885 setup->draw_region = setup->framebuffer; in try_update_scene_state()
886 if (setup->scissor_test) { in try_update_scene_state()
887 u_rect_possible_intersection(&setup->scissor, in try_update_scene_state()
888 &setup->draw_region); in try_update_scene_state()
892 setup->dirty = 0; in try_update_scene_state()
894 assert(setup->fs.stored); in try_update_scene_state()
899 lp_setup_update_state( struct lp_setup_context *setup, in lp_setup_update_state() argument
909 struct llvmpipe_context *lp = llvmpipe_context(setup->pipe); in lp_setup_update_state()
914 if (lp->setup->dirty) { in lp_setup_update_state()
918 assert(setup->setup.variant); in lp_setup_update_state()
923 setup->psize = lp->psize_slot; in lp_setup_update_state()
928 setup->setup.variant->key.size); in lp_setup_update_state()
931 &setup->setup.variant->key, in lp_setup_update_state()
932 setup->setup.variant->key.size) == 0); in lp_setup_update_state()
935 if (update_scene && setup->state != SETUP_ACTIVE) { in lp_setup_update_state()
936 if (!set_scene_state( setup, SETUP_ACTIVE, __FUNCTION__ )) in lp_setup_update_state()
943 if (update_scene && setup->scene) { in lp_setup_update_state()
944 assert(setup->state == SETUP_ACTIVE); in lp_setup_update_state()
946 if (try_update_scene_state(setup)) in lp_setup_update_state()
954 if (!set_scene_state(setup, SETUP_FLUSHED, __FUNCTION__)) in lp_setup_update_state()
957 if (!set_scene_state(setup, SETUP_ACTIVE, __FUNCTION__)) in lp_setup_update_state()
960 if (!setup->scene) in lp_setup_update_state()
963 return try_update_scene_state(setup); in lp_setup_update_state()
974 lp_setup_destroy( struct lp_setup_context *setup ) in lp_setup_destroy() argument
978 lp_setup_reset( setup ); in lp_setup_destroy()
980 util_unreference_framebuffer_state(&setup->fb); in lp_setup_destroy()
982 for (i = 0; i < Elements(setup->fs.current_tex); i++) { in lp_setup_destroy()
983 pipe_resource_reference(&setup->fs.current_tex[i], NULL); in lp_setup_destroy()
986 pipe_resource_reference(&setup->constants.current, NULL); in lp_setup_destroy()
989 for (i = 0; i < Elements(setup->scenes); i++) { in lp_setup_destroy()
990 struct lp_scene *scene = setup->scenes[i]; in lp_setup_destroy()
998 lp_fence_reference(&setup->last_fence, NULL); in lp_setup_destroy()
1000 FREE( setup ); in lp_setup_destroy()
1014 struct lp_setup_context *setup; in lp_setup_create() local
1017 setup = CALLOC_STRUCT(lp_setup_context); in lp_setup_create()
1018 if (!setup) { in lp_setup_create()
1022 lp_setup_init_vbuf(setup); in lp_setup_create()
1026 setup->pipe = pipe; in lp_setup_create()
1029 setup->num_threads = screen->num_threads; in lp_setup_create()
1030 setup->vbuf = draw_vbuf_stage(draw, &setup->base); in lp_setup_create()
1031 if (!setup->vbuf) { in lp_setup_create()
1035 draw_set_rasterize_stage(draw, setup->vbuf); in lp_setup_create()
1036 draw_set_render(draw, &setup->base); in lp_setup_create()
1040 setup->scenes[i] = lp_scene_create( pipe ); in lp_setup_create()
1041 if (!setup->scenes[i]) { in lp_setup_create()
1046 setup->triangle = first_triangle; in lp_setup_create()
1047 setup->line = first_line; in lp_setup_create()
1048 setup->point = first_point; in lp_setup_create()
1050 setup->dirty = ~0; in lp_setup_create()
1052 return setup; in lp_setup_create()
1056 if (setup->scenes[i]) { in lp_setup_create()
1057 lp_scene_destroy(setup->scenes[i]); in lp_setup_create()
1061 setup->vbuf->destroy(setup->vbuf); in lp_setup_create()
1063 FREE(setup); in lp_setup_create()
1073 lp_setup_begin_query(struct lp_setup_context *setup, in lp_setup_begin_query() argument
1077 assert(setup->active_query == NULL); in lp_setup_begin_query()
1079 set_scene_state(setup, SETUP_ACTIVE, "begin_query"); in lp_setup_begin_query()
1081 setup->active_query = pq; in lp_setup_begin_query()
1083 if (setup->scene) { in lp_setup_begin_query()
1084 if (!lp_scene_bin_everywhere(setup->scene, in lp_setup_begin_query()
1088 if (!lp_setup_flush_and_restart(setup)) in lp_setup_begin_query()
1091 if (!lp_scene_bin_everywhere(setup->scene, in lp_setup_begin_query()
1105 lp_setup_end_query(struct lp_setup_context *setup, struct llvmpipe_query *pq) in lp_setup_end_query() argument
1109 set_scene_state(setup, SETUP_ACTIVE, "end_query"); in lp_setup_end_query()
1111 assert(setup->active_query == pq); in lp_setup_end_query()
1112 setup->active_query = NULL; in lp_setup_end_query()
1119 if (setup->scene) { in lp_setup_end_query()
1123 lp_fence_reference(&pq->fence, setup->scene->fence); in lp_setup_end_query()
1125 if (!lp_scene_bin_everywhere(setup->scene, in lp_setup_end_query()
1128 lp_setup_flush(setup, NULL, __FUNCTION__); in lp_setup_end_query()
1132 lp_fence_reference(&pq->fence, setup->last_fence); in lp_setup_end_query()
1138 lp_setup_flush_and_restart(struct lp_setup_context *setup) in lp_setup_flush_and_restart() argument
1142 assert(setup->state == SETUP_ACTIVE); in lp_setup_flush_and_restart()
1144 if (!set_scene_state(setup, SETUP_FLUSHED, __FUNCTION__)) in lp_setup_flush_and_restart()
1147 if (!lp_setup_update_state(setup, TRUE)) in lp_setup_flush_and_restart()