Lines Matching full:setup

64 static boolean try_update_scene_state( struct lp_setup_context *setup );
68 lp_setup_get_empty_scene(struct lp_setup_context *setup) in lp_setup_get_empty_scene() argument
70 assert(setup->scene == NULL); in lp_setup_get_empty_scene()
72 setup->scene_idx++; in lp_setup_get_empty_scene()
73 setup->scene_idx %= ARRAY_SIZE(setup->scenes); in lp_setup_get_empty_scene()
75 setup->scene = setup->scenes[setup->scene_idx]; in lp_setup_get_empty_scene()
77 if (setup->scene->fence) { in lp_setup_get_empty_scene()
80 __FUNCTION__, setup->scene->fence->id); in lp_setup_get_empty_scene()
82 lp_fence_wait(setup->scene->fence); in lp_setup_get_empty_scene()
85 lp_scene_begin_binning(setup->scene, &setup->fb, setup->rasterizer_discard); in lp_setup_get_empty_scene()
91 first_triangle( struct lp_setup_context *setup, in first_triangle() argument
96 assert(setup->state == SETUP_ACTIVE); in first_triangle()
97 lp_setup_choose_triangle( setup ); in first_triangle()
98 setup->triangle( setup, v0, v1, v2 ); in first_triangle()
102 first_line( struct lp_setup_context *setup, in first_line() argument
106 assert(setup->state == SETUP_ACTIVE); in first_line()
107 lp_setup_choose_line( setup ); in first_line()
108 setup->line( setup, v0, v1 ); in first_line()
112 first_point( struct lp_setup_context *setup, in first_point() argument
115 assert(setup->state == SETUP_ACTIVE); in first_point()
116 lp_setup_choose_point( setup ); in first_point()
117 setup->point( setup, v0 ); in first_point()
120 void lp_setup_reset( struct lp_setup_context *setup ) in lp_setup_reset() argument
127 for (i = 0; i < ARRAY_SIZE(setup->constants); ++i) { in lp_setup_reset()
128 setup->constants[i].stored_size = 0; in lp_setup_reset()
129 setup->constants[i].stored_data = NULL; in lp_setup_reset()
131 setup->fs.stored = NULL; in lp_setup_reset()
132 setup->dirty = ~0; in lp_setup_reset()
135 setup->scene = NULL; in lp_setup_reset()
139 memset(&setup->clear, 0, sizeof setup->clear); in lp_setup_reset()
144 setup->line = first_line; in lp_setup_reset()
145 setup->point = first_point; in lp_setup_reset()
146 setup->triangle = first_triangle; in lp_setup_reset()
152 lp_setup_rasterize_scene( struct lp_setup_context *setup ) in lp_setup_rasterize_scene() argument
154 struct lp_scene *scene = setup->scene; in lp_setup_rasterize_scene()
157 scene->num_active_queries = setup->active_binned_queries; in lp_setup_rasterize_scene()
158 memcpy(scene->active_queries, setup->active_queries, in lp_setup_rasterize_scene()
163 lp_fence_reference(&setup->last_fence, scene->fence); in lp_setup_rasterize_scene()
165 if (setup->last_fence) in lp_setup_rasterize_scene()
166 setup->last_fence->issued = TRUE; in lp_setup_rasterize_scene()
173 * multiple scenes per setup is about - when we get a new empty scene in lp_setup_rasterize_scene()
184 lp_scene_end_rasterization(setup->scene); in lp_setup_rasterize_scene()
185 lp_setup_reset( setup ); in lp_setup_rasterize_scene()
193 begin_binning( struct lp_setup_context *setup ) in begin_binning() argument
195 struct lp_scene *scene = setup->scene; in begin_binning()
204 scene->fence = lp_fence_create(MAX2(1, setup->num_threads)); in begin_binning()
208 ok = try_update_scene_state(setup); in begin_binning()
212 if (setup->fb.zsbuf && in begin_binning()
213 ((setup->clear.flags & PIPE_CLEAR_DEPTHSTENCIL) != PIPE_CLEAR_DEPTHSTENCIL) && in begin_binning()
214 util_format_is_depth_and_stencil(setup->fb.zsbuf->format)) in begin_binning()
218 setup->clear.flags >> 2, in begin_binning()
221 if (setup->clear.flags & PIPE_CLEAR_COLOR) { in begin_binning()
223 for (cbuf = 0; cbuf < setup->fb.nr_cbufs; cbuf++) { in begin_binning()
225 if (setup->clear.flags & (1 << (2 + cbuf))) { in begin_binning()
236 cc_scene->color_val = setup->clear.color_val[cbuf]; in begin_binning()
247 if (setup->fb.zsbuf) { in begin_binning()
248 if (setup->clear.flags & PIPE_CLEAR_DEPTHSTENCIL) { in begin_binning()
252 setup->clear.zsvalue, in begin_binning()
253 setup->clear.zsmask)); in begin_binning()
259 setup->clear.flags = 0; in begin_binning()
260 setup->clear.zsmask = 0; in begin_binning()
261 setup->clear.zsvalue = 0; in begin_binning()
263 scene->had_queries = !!setup->active_binned_queries; in begin_binning()
276 execute_clears( struct lp_setup_context *setup ) in execute_clears() argument
280 return begin_binning( setup ); in execute_clears()
291 set_scene_state( struct lp_setup_context *setup, in set_scene_state() argument
295 unsigned old_state = setup->state; in set_scene_state()
308 if (new_state == SETUP_FLUSHED && setup->scene) in set_scene_state()
309 lp_debug_draw_bins_by_cmd_length(setup->scene); in set_scene_state()
315 lp_setup_get_empty_scene(setup); in set_scene_state()
322 if (!begin_binning( setup )) in set_scene_state()
328 if (!execute_clears( setup )) in set_scene_state()
331 lp_setup_rasterize_scene( setup ); in set_scene_state()
332 assert(setup->scene == NULL); in set_scene_state()
336 assert(0 && "invalid setup state mode"); in set_scene_state()
340 setup->state = new_state; in set_scene_state()
344 if (setup->scene) { in set_scene_state()
345 lp_scene_end_rasterization(setup->scene); in set_scene_state()
346 setup->scene = NULL; in set_scene_state()
349 setup->state = SETUP_FLUSHED; in set_scene_state()
350 lp_setup_reset( setup ); in set_scene_state()
356 lp_setup_flush( struct lp_setup_context *setup, in lp_setup_flush() argument
360 set_scene_state( setup, SETUP_FLUSHED, reason ); in lp_setup_flush()
363 lp_fence_reference((struct lp_fence **)fence, setup->last_fence); in lp_setup_flush()
369 lp_setup_bind_framebuffer( struct lp_setup_context *setup, in lp_setup_bind_framebuffer() argument
376 set_scene_state( setup, SETUP_FLUSHED, __FUNCTION__ ); in lp_setup_bind_framebuffer()
381 assert(!setup->scene); in lp_setup_bind_framebuffer()
386 util_copy_framebuffer_state(&setup->fb, fb); in lp_setup_bind_framebuffer()
387 setup->framebuffer.x0 = 0; in lp_setup_bind_framebuffer()
388 setup->framebuffer.y0 = 0; in lp_setup_bind_framebuffer()
389 setup->framebuffer.x1 = fb->width-1; in lp_setup_bind_framebuffer()
390 setup->framebuffer.y1 = fb->height-1; in lp_setup_bind_framebuffer()
391 setup->dirty |= LP_SETUP_NEW_SCISSOR; in lp_setup_bind_framebuffer()
400 lp_setup_try_clear_color_buffer(struct lp_setup_context *setup, in lp_setup_try_clear_color_buffer() argument
406 enum pipe_format format = setup->fb.cbufs[cbuf]->format; in lp_setup_try_clear_color_buffer()
408 LP_DBG(DEBUG_SETUP, "%s state %d\n", __FUNCTION__, setup->state); in lp_setup_try_clear_color_buffer()
428 if (setup->state == SETUP_ACTIVE) { in lp_setup_try_clear_color_buffer()
429 struct lp_scene *scene = setup->scene; in lp_setup_try_clear_color_buffer()
460 set_scene_state( setup, SETUP_CLEARED, __FUNCTION__ ); in lp_setup_try_clear_color_buffer()
463 setup->clear.flags |= 1 << (cbuf + 2); in lp_setup_try_clear_color_buffer()
464 setup->clear.color_val[cbuf] = uc; in lp_setup_try_clear_color_buffer()
471 lp_setup_try_clear_zs(struct lp_setup_context *setup, in lp_setup_try_clear_zs() argument
480 enum pipe_format format = setup->fb.zsbuf->format; in lp_setup_try_clear_zs()
482 LP_DBG(DEBUG_SETUP, "%s state %d\n", __FUNCTION__, setup->state); in lp_setup_try_clear_zs()
504 if (setup->state == SETUP_ACTIVE) { in lp_setup_try_clear_zs()
505 struct lp_scene *scene = setup->scene; in lp_setup_try_clear_zs()
524 set_scene_state( setup, SETUP_CLEARED, __FUNCTION__ ); in lp_setup_try_clear_zs()
526 setup->clear.flags |= flags; in lp_setup_try_clear_zs()
528 setup->clear.zsmask |= zsmask; in lp_setup_try_clear_zs()
529 setup->clear.zsvalue = in lp_setup_try_clear_zs()
530 (setup->clear.zsvalue & ~zsmask) | (zsvalue & zsmask); in lp_setup_try_clear_zs()
537 lp_setup_clear( struct lp_setup_context *setup, in lp_setup_clear() argument
553 if (!lp_setup_try_clear_zs(setup, depth, stencil, flagszs)) { in lp_setup_clear()
554 lp_setup_flush(setup, NULL, __FUNCTION__); in lp_setup_clear()
556 if (!lp_setup_try_clear_zs(setup, depth, stencil, flagszs)) in lp_setup_clear()
563 for (i = 0; i < setup->fb.nr_cbufs; i++) { in lp_setup_clear()
564 if ((flags & (1 << (2 + i))) && setup->fb.cbufs[i]) { in lp_setup_clear()
565 if (!lp_setup_try_clear_color_buffer(setup, color, i)) { in lp_setup_clear()
566 lp_setup_flush(setup, NULL, __FUNCTION__); in lp_setup_clear()
568 if (!lp_setup_try_clear_color_buffer(setup, color, i)) in lp_setup_clear()
579 lp_setup_set_triangle_state( struct lp_setup_context *setup, in lp_setup_set_triangle_state() argument
588 setup->ccw_is_frontface = ccw_is_frontface; in lp_setup_set_triangle_state()
589 setup->cullmode = cull_mode; in lp_setup_set_triangle_state()
590 setup->triangle = first_triangle; in lp_setup_set_triangle_state()
591 setup->pixel_offset = half_pixel_center ? 0.5f : 0.0f; in lp_setup_set_triangle_state()
592 setup->bottom_edge_rule = bottom_edge_rule; in lp_setup_set_triangle_state()
594 if (setup->scissor_test != scissor) { in lp_setup_set_triangle_state()
595 setup->dirty |= LP_SETUP_NEW_SCISSOR; in lp_setup_set_triangle_state()
596 setup->scissor_test = scissor; in lp_setup_set_triangle_state()
601 lp_setup_set_line_state( struct lp_setup_context *setup, in lp_setup_set_line_state() argument
606 setup->line_width = line_width; in lp_setup_set_line_state()
610 lp_setup_set_point_state( struct lp_setup_context *setup, in lp_setup_set_point_state() argument
618 setup->point_size = point_size; in lp_setup_set_point_state()
619 setup->sprite_coord_enable = sprite_coord_enable; in lp_setup_set_point_state()
620 setup->sprite_coord_origin = sprite_coord_origin; in lp_setup_set_point_state()
621 setup->point_size_per_vertex = point_size_per_vertex; in lp_setup_set_point_state()
625 lp_setup_set_setup_variant( struct lp_setup_context *setup, in lp_setup_set_setup_variant() argument
630 setup->setup.variant = variant; in lp_setup_set_setup_variant()
634 lp_setup_set_fs_variant( struct lp_setup_context *setup, in lp_setup_set_fs_variant() argument
641 setup->fs.current.variant = variant; in lp_setup_set_fs_variant()
642 setup->dirty |= LP_SETUP_NEW_FS; in lp_setup_set_fs_variant()
646 lp_setup_set_fs_constants(struct lp_setup_context *setup, in lp_setup_set_fs_constants() argument
654 assert(num <= ARRAY_SIZE(setup->constants)); in lp_setup_set_fs_constants()
657 util_copy_constant_buffer(&setup->constants[i].current, &buffers[i]); in lp_setup_set_fs_constants()
659 for (; i < ARRAY_SIZE(setup->constants); i++) { in lp_setup_set_fs_constants()
660 util_copy_constant_buffer(&setup->constants[i].current, NULL); in lp_setup_set_fs_constants()
662 setup->dirty |= LP_SETUP_NEW_CONSTANTS; in lp_setup_set_fs_constants()
667 lp_setup_set_alpha_ref_value( struct lp_setup_context *setup, in lp_setup_set_alpha_ref_value() argument
672 if(setup->fs.current.jit_context.alpha_ref_value != alpha_ref_value) { in lp_setup_set_alpha_ref_value()
673 setup->fs.current.jit_context.alpha_ref_value = alpha_ref_value; in lp_setup_set_alpha_ref_value()
674 setup->dirty |= LP_SETUP_NEW_FS; in lp_setup_set_alpha_ref_value()
679 lp_setup_set_stencil_ref_values( struct lp_setup_context *setup, in lp_setup_set_stencil_ref_values() argument
684 if (setup->fs.current.jit_context.stencil_ref_front != refs[0] || in lp_setup_set_stencil_ref_values()
685 setup->fs.current.jit_context.stencil_ref_back != refs[1]) { in lp_setup_set_stencil_ref_values()
686 setup->fs.current.jit_context.stencil_ref_front = refs[0]; in lp_setup_set_stencil_ref_values()
687 setup->fs.current.jit_context.stencil_ref_back = refs[1]; in lp_setup_set_stencil_ref_values()
688 setup->dirty |= LP_SETUP_NEW_FS; in lp_setup_set_stencil_ref_values()
693 lp_setup_set_blend_color( struct lp_setup_context *setup, in lp_setup_set_blend_color() argument
700 if(memcmp(&setup->blend_color.current, blend_color, sizeof *blend_color) != 0) { in lp_setup_set_blend_color()
701 memcpy(&setup->blend_color.current, blend_color, sizeof *blend_color); in lp_setup_set_blend_color()
702 setup->dirty |= LP_SETUP_NEW_BLEND_COLOR; in lp_setup_set_blend_color()
708 lp_setup_set_scissors( struct lp_setup_context *setup, in lp_setup_set_scissors() argument
717 setup->scissors[i].x0 = scissors[i].minx; in lp_setup_set_scissors()
718 setup->scissors[i].x1 = scissors[i].maxx-1; in lp_setup_set_scissors()
719 setup->scissors[i].y0 = scissors[i].miny; in lp_setup_set_scissors()
720 setup->scissors[i].y1 = scissors[i].maxy-1; in lp_setup_set_scissors()
722 setup->dirty |= LP_SETUP_NEW_SCISSOR; in lp_setup_set_scissors()
727 lp_setup_set_flatshade_first( struct lp_setup_context *setup, in lp_setup_set_flatshade_first() argument
730 setup->flatshade_first = flatshade_first; in lp_setup_set_flatshade_first()
734 lp_setup_set_rasterizer_discard( struct lp_setup_context *setup, in lp_setup_set_rasterizer_discard() argument
737 if (setup->rasterizer_discard != rasterizer_discard) { in lp_setup_set_rasterizer_discard()
738 setup->rasterizer_discard = rasterizer_discard; in lp_setup_set_rasterizer_discard()
739 set_scene_state( setup, SETUP_FLUSHED, __FUNCTION__ ); in lp_setup_set_rasterizer_discard()
744 lp_setup_set_vertex_info( struct lp_setup_context *setup, in lp_setup_set_vertex_info() argument
749 setup->vertex_info = vertex_info; in lp_setup_set_vertex_info()
757 lp_setup_set_viewports(struct lp_setup_context *setup, in lp_setup_set_viewports() argument
761 struct llvmpipe_context *lp = llvmpipe_context(setup->pipe); in lp_setup_set_viewports()
778 if (setup->viewports[i].min_depth != min_depth || in lp_setup_set_viewports()
779 setup->viewports[i].max_depth != max_depth) { in lp_setup_set_viewports()
780 setup->viewports[i].min_depth = min_depth; in lp_setup_set_viewports()
781 setup->viewports[i].max_depth = max_depth; in lp_setup_set_viewports()
782 setup->dirty |= LP_SETUP_NEW_VIEWPORTS; in lp_setup_set_viewports()
792 lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup, in lp_setup_set_fragment_sampler_views() argument
802 max_tex_num = MAX2(num, setup->fs.current_tex_num); in lp_setup_set_fragment_sampler_views()
811 jit_tex = &setup->fs.current.jit_context.textures[i]; in lp_setup_set_fragment_sampler_views()
816 pipe_resource_reference(&setup->fs.current_tex[i], res); in lp_setup_set_fragment_sampler_views()
819 /* regular texture - setup array of mipmap level offsets */ in lp_setup_set_fragment_sampler_views()
923 pipe_resource_reference(&setup->fs.current_tex[i], NULL); in lp_setup_set_fragment_sampler_views()
926 setup->fs.current_tex_num = num; in lp_setup_set_fragment_sampler_views()
928 setup->dirty |= LP_SETUP_NEW_FS; in lp_setup_set_fragment_sampler_views()
936 lp_setup_set_fragment_sampler_state(struct lp_setup_context *setup, in lp_setup_set_fragment_sampler_state() argument
951 jit_sam = &setup->fs.current.jit_context.samplers[i]; in lp_setup_set_fragment_sampler_state()
960 setup->dirty |= LP_SETUP_NEW_FS; in lp_setup_set_fragment_sampler_state()
970 lp_setup_is_resource_referenced( const struct lp_setup_context *setup, in lp_setup_is_resource_referenced() argument
976 for (i = 0; i < setup->fb.nr_cbufs; i++) { in lp_setup_is_resource_referenced()
977 if (setup->fb.cbufs[i] && setup->fb.cbufs[i]->texture == texture) in lp_setup_is_resource_referenced()
980 if (setup->fb.zsbuf && setup->fb.zsbuf->texture == texture) { in lp_setup_is_resource_referenced()
985 for (i = 0; i < ARRAY_SIZE(setup->scenes); i++) { in lp_setup_is_resource_referenced()
986 if (lp_scene_is_resource_referenced(setup->scenes[i], texture)) { in lp_setup_is_resource_referenced()
1008 try_update_scene_state( struct lp_setup_context *setup ) in try_update_scene_state() argument
1011 boolean new_scene = (setup->fs.stored == NULL); in try_update_scene_state()
1012 struct lp_scene *scene = setup->scene; in try_update_scene_state()
1017 if (setup->dirty & LP_SETUP_NEW_VIEWPORTS) { in try_update_scene_state()
1027 lp_scene_alloc(scene, sizeof setup->viewports); in try_update_scene_state()
1034 memcpy(stored, setup->viewports, sizeof setup->viewports); in try_update_scene_state()
1036 setup->fs.current.jit_context.viewports = stored; in try_update_scene_state()
1037 setup->dirty |= LP_SETUP_NEW_FS; in try_update_scene_state()
1040 if(setup->dirty & LP_SETUP_NEW_BLEND_COLOR) { in try_update_scene_state()
1059 fstored[i] = setup->blend_color.current.color[i % 4]; in try_update_scene_state()
1064 uint8_t c = float_to_ubyte(setup->blend_color.current.color[i]); in try_update_scene_state()
1069 setup->blend_color.stored = stored; in try_update_scene_state()
1070 setup->fs.current.jit_context.u8_blend_color = stored; in try_update_scene_state()
1071 setup->fs.current.jit_context.f_blend_color = fstored; in try_update_scene_state()
1072 setup->dirty |= LP_SETUP_NEW_FS; in try_update_scene_state()
1075 if (setup->dirty & LP_SETUP_NEW_CONSTANTS) { in try_update_scene_state()
1076 for (i = 0; i < ARRAY_SIZE(setup->constants); ++i) { in try_update_scene_state()
1077 struct pipe_resource *buffer = setup->constants[i].current.buffer; in try_update_scene_state()
1078 const unsigned current_size = MIN2(setup->constants[i].current.buffer_size, in try_update_scene_state()
1089 else if (setup->constants[i].current.user_buffer) { in try_update_scene_state()
1091 current_data = (ubyte *) setup->constants[i].current.user_buffer; in try_update_scene_state()
1095 current_data += setup->constants[i].current.buffer_offset; in try_update_scene_state()
1099 if (setup->constants[i].stored_size != current_size || in try_update_scene_state()
1100 !setup->constants[i].stored_data || in try_update_scene_state()
1101 memcmp(setup->constants[i].stored_data, in try_update_scene_state()
1115 setup->constants[i].stored_size = current_size; in try_update_scene_state()
1116 setup->constants[i].stored_data = stored; in try_update_scene_state()
1118 setup->fs.current.jit_context.constants[i] = in try_update_scene_state()
1119 setup->constants[i].stored_data; in try_update_scene_state()
1122 setup->constants[i].stored_size = 0; in try_update_scene_state()
1123 setup->constants[i].stored_data = NULL; in try_update_scene_state()
1124 setup->fs.current.jit_context.constants[i] = fake_const_buf; in try_update_scene_state()
1128 setup->constants[i].stored_size / (sizeof(float) * 4); in try_update_scene_state()
1129 setup->fs.current.jit_context.num_constants[i] = num_constants; in try_update_scene_state()
1130 setup->dirty |= LP_SETUP_NEW_FS; in try_update_scene_state()
1135 if (setup->dirty & LP_SETUP_NEW_FS) { in try_update_scene_state()
1136 if (!setup->fs.stored || in try_update_scene_state()
1137 memcmp(setup->fs.stored, in try_update_scene_state()
1138 &setup->fs.current, in try_update_scene_state()
1139 sizeof setup->fs.current) != 0) in try_update_scene_state()
1145 * and append it to the bin's setup data buffer. in try_update_scene_state()
1154 &setup->fs.current, in try_update_scene_state()
1155 sizeof setup->fs.current); in try_update_scene_state()
1156 setup->fs.stored = stored; in try_update_scene_state()
1161 for (i = 0; i < ARRAY_SIZE(setup->fs.current_tex); i++) { in try_update_scene_state()
1162 if (setup->fs.current_tex[i]) { in try_update_scene_state()
1164 setup->fs.current_tex[i], in try_update_scene_state()
1174 if (setup->dirty & LP_SETUP_NEW_SCISSOR) { in try_update_scene_state()
1177 setup->draw_regions[i] = setup->framebuffer; in try_update_scene_state()
1178 if (setup->scissor_test) { in try_update_scene_state()
1179 u_rect_possible_intersection(&setup->scissors[i], in try_update_scene_state()
1180 &setup->draw_regions[i]); in try_update_scene_state()
1185 setup->dirty = 0; in try_update_scene_state()
1187 assert(setup->fs.stored); in try_update_scene_state()
1192 lp_setup_update_state( struct lp_setup_context *setup, in lp_setup_update_state() argument
1199 * setup code. This may get refactored/changed... in lp_setup_update_state()
1202 struct llvmpipe_context *lp = llvmpipe_context(setup->pipe); in lp_setup_update_state()
1207 if (lp->setup->dirty) { in lp_setup_update_state()
1211 assert(setup->setup.variant); in lp_setup_update_state()
1216 setup->psize_slot = lp->psize_slot; in lp_setup_update_state()
1217 setup->viewport_index_slot = lp->viewport_index_slot; in lp_setup_update_state()
1218 setup->layer_slot = lp->layer_slot; in lp_setup_update_state()
1219 setup->face_slot = lp->face_slot; in lp_setup_update_state()
1224 setup->setup.variant->key.size); in lp_setup_update_state()
1227 &setup->setup.variant->key, in lp_setup_update_state()
1228 setup->setup.variant->key.size) == 0); in lp_setup_update_state()
1231 if (update_scene && setup->state != SETUP_ACTIVE) { in lp_setup_update_state()
1232 if (!set_scene_state( setup, SETUP_ACTIVE, __FUNCTION__ )) in lp_setup_update_state()
1239 if (update_scene && setup->scene) { in lp_setup_update_state()
1240 assert(setup->state == SETUP_ACTIVE); in lp_setup_update_state()
1242 if (try_update_scene_state(setup)) in lp_setup_update_state()
1250 if (!set_scene_state(setup, SETUP_FLUSHED, __FUNCTION__)) in lp_setup_update_state()
1253 if (!set_scene_state(setup, SETUP_ACTIVE, __FUNCTION__)) in lp_setup_update_state()
1256 if (!setup->scene) in lp_setup_update_state()
1259 return try_update_scene_state(setup); in lp_setup_update_state()
1270 lp_setup_destroy( struct lp_setup_context *setup ) in lp_setup_destroy() argument
1274 lp_setup_reset( setup ); in lp_setup_destroy()
1276 util_unreference_framebuffer_state(&setup->fb); in lp_setup_destroy()
1278 for (i = 0; i < ARRAY_SIZE(setup->fs.current_tex); i++) { in lp_setup_destroy()
1279 pipe_resource_reference(&setup->fs.current_tex[i], NULL); in lp_setup_destroy()
1282 for (i = 0; i < ARRAY_SIZE(setup->constants); i++) { in lp_setup_destroy()
1283 pipe_resource_reference(&setup->constants[i].current.buffer, NULL); in lp_setup_destroy()
1287 for (i = 0; i < ARRAY_SIZE(setup->scenes); i++) { in lp_setup_destroy()
1288 struct lp_scene *scene = setup->scenes[i]; in lp_setup_destroy()
1296 lp_fence_reference(&setup->last_fence, NULL); in lp_setup_destroy()
1298 FREE( setup ); in lp_setup_destroy()
1312 struct lp_setup_context *setup; in lp_setup_create() local
1315 setup = CALLOC_STRUCT(lp_setup_context); in lp_setup_create()
1316 if (!setup) { in lp_setup_create()
1320 lp_setup_init_vbuf(setup); in lp_setup_create()
1324 setup->pipe = pipe; in lp_setup_create()
1327 setup->num_threads = screen->num_threads; in lp_setup_create()
1328 setup->vbuf = draw_vbuf_stage(draw, &setup->base); in lp_setup_create()
1329 if (!setup->vbuf) { in lp_setup_create()
1333 draw_set_rasterize_stage(draw, setup->vbuf); in lp_setup_create()
1334 draw_set_render(draw, &setup->base); in lp_setup_create()
1338 setup->scenes[i] = lp_scene_create( pipe ); in lp_setup_create()
1339 if (!setup->scenes[i]) { in lp_setup_create()
1344 setup->triangle = first_triangle; in lp_setup_create()
1345 setup->line = first_line; in lp_setup_create()
1346 setup->point = first_point; in lp_setup_create()
1348 setup->dirty = ~0; in lp_setup_create()
1351 setup->framebuffer.x1 = -1; in lp_setup_create()
1352 setup->framebuffer.y1 = -1; in lp_setup_create()
1354 return setup; in lp_setup_create()
1358 if (setup->scenes[i]) { in lp_setup_create()
1359 lp_scene_destroy(setup->scenes[i]); in lp_setup_create()
1363 setup->vbuf->destroy(setup->vbuf); in lp_setup_create()
1365 FREE(setup); in lp_setup_create()
1375 lp_setup_begin_query(struct lp_setup_context *setup, in lp_setup_begin_query() argument
1379 set_scene_state(setup, SETUP_ACTIVE, "begin_query"); in lp_setup_begin_query()
1388 assert(setup->active_binned_queries < LP_MAX_ACTIVE_BINNED_QUERIES); in lp_setup_begin_query()
1390 if (setup->active_binned_queries >= LP_MAX_ACTIVE_BINNED_QUERIES) { in lp_setup_begin_query()
1393 assert(setup->active_queries[setup->active_binned_queries] == NULL); in lp_setup_begin_query()
1394 setup->active_queries[setup->active_binned_queries] = pq; in lp_setup_begin_query()
1395 setup->active_binned_queries++; in lp_setup_begin_query()
1397 assert(setup->scene); in lp_setup_begin_query()
1398 if (setup->scene) { in lp_setup_begin_query()
1399 if (!lp_scene_bin_everywhere(setup->scene, in lp_setup_begin_query()
1403 if (!lp_setup_flush_and_restart(setup)) in lp_setup_begin_query()
1406 if (!lp_scene_bin_everywhere(setup->scene, in lp_setup_begin_query()
1412 setup->scene->had_queries |= TRUE; in lp_setup_begin_query()
1421 lp_setup_end_query(struct lp_setup_context *setup, struct llvmpipe_query *pq) in lp_setup_end_query() argument
1423 set_scene_state(setup, SETUP_ACTIVE, "end_query"); in lp_setup_end_query()
1425 assert(setup->scene); in lp_setup_end_query()
1426 if (setup->scene) { in lp_setup_end_query()
1430 lp_fence_reference(&pq->fence, setup->scene->fence); in lp_setup_end_query()
1438 !(setup->scene->tiles_x | setup->scene->tiles_y)) { in lp_setup_end_query()
1446 if (!lp_scene_bin_everywhere(setup->scene, in lp_setup_end_query()
1449 if (!lp_setup_flush_and_restart(setup)) in lp_setup_end_query()
1452 if (!lp_scene_bin_everywhere(setup->scene, in lp_setup_end_query()
1458 setup->scene->had_queries |= TRUE; in lp_setup_end_query()
1462 lp_fence_reference(&pq->fence, setup->last_fence); in lp_setup_end_query()
1476 for (i = 0; i < setup->active_binned_queries; i++) { in lp_setup_end_query()
1477 if (setup->active_queries[i] == pq) in lp_setup_end_query()
1480 assert(i < setup->active_binned_queries); in lp_setup_end_query()
1481 if (i == setup->active_binned_queries) in lp_setup_end_query()
1483 setup->active_binned_queries--; in lp_setup_end_query()
1484 setup->active_queries[i] = setup->active_queries[setup->active_binned_queries]; in lp_setup_end_query()
1485 setup->active_queries[setup->active_binned_queries] = NULL; in lp_setup_end_query()
1491 lp_setup_flush_and_restart(struct lp_setup_context *setup) in lp_setup_flush_and_restart() argument
1495 assert(setup->state == SETUP_ACTIVE); in lp_setup_flush_and_restart()
1497 if (!set_scene_state(setup, SETUP_FLUSHED, __FUNCTION__)) in lp_setup_flush_and_restart()
1500 if (!lp_setup_update_state(setup, TRUE)) in lp_setup_flush_and_restart()