1 /**************************************************************************
3 * Copyright 2009 VMware, Inc.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
29 #include "util/u_memory.h"
30 #include "util/u_math.h"
31 #include "util/u_rect.h"
32 #include "util/u_surface.h"
34 #include "lp_scene_queue.h"
40 #include "lp_rast_priv.h"
41 #include "lp_tile_soa.h"
42 #include "gallivm/lp_bld_debug.h"
48 const struct lp_rast_state
*jit_state
= NULL
;
53 * Begin rasterizing a scene.
54 * Called once per scene by one thread.
57 lp_rast_begin( struct lp_rasterizer
*rast
,
58 struct lp_scene
*scene
)
60 const struct pipe_framebuffer_state
*fb
= &scene
->fb
;
63 rast
->curr_scene
= scene
;
65 LP_DBG(DEBUG_RAST
, "%s\n", __FUNCTION__
);
67 rast
->state
.nr_cbufs
= scene
->fb
.nr_cbufs
;
69 for (i
= 0; i
< rast
->state
.nr_cbufs
; i
++) {
70 struct pipe_surface
*cbuf
= scene
->fb
.cbufs
[i
];
71 llvmpipe_resource_map(cbuf
->texture
,
75 LP_TEX_USAGE_READ_WRITE
,
76 LP_TEX_LAYOUT_LINEAR
);
80 struct pipe_surface
*zsbuf
= scene
->fb
.zsbuf
;
81 rast
->zsbuf
.stride
= llvmpipe_resource_stride(zsbuf
->texture
, zsbuf
->level
);
82 rast
->zsbuf
.blocksize
=
83 util_format_get_blocksize(zsbuf
->texture
->format
);
85 rast
->zsbuf
.map
= llvmpipe_resource_map(zsbuf
->texture
,
89 LP_TEX_USAGE_READ_WRITE
,
93 lp_scene_bin_iter_begin( scene
);
98 lp_rast_end( struct lp_rasterizer
*rast
)
100 struct lp_scene
*scene
= rast
->curr_scene
;
103 /* Unmap color buffers */
104 for (i
= 0; i
< rast
->state
.nr_cbufs
; i
++) {
105 struct pipe_surface
*cbuf
= scene
->fb
.cbufs
[i
];
106 llvmpipe_resource_unmap(cbuf
->texture
,
112 /* Unmap z/stencil buffer */
113 if (rast
->zsbuf
.map
) {
114 struct pipe_surface
*zsbuf
= scene
->fb
.zsbuf
;
115 llvmpipe_resource_unmap(zsbuf
->texture
,
119 rast
->zsbuf
.map
= NULL
;
122 lp_scene_reset( rast
->curr_scene
);
124 rast
->curr_scene
= NULL
;
128 debug_printf("Post render scene: tile unswizzle: %u tile swizzle: %u\n",
129 lp_tile_unswizzle_count
, lp_tile_swizzle_count
);
135 * Begining rasterization of a tile.
136 * \param x window X position of the tile, in pixels
137 * \param y window Y position of the tile, in pixels
140 lp_rast_tile_begin(struct lp_rasterizer_task
*task
,
141 unsigned x
, unsigned y
)
143 struct lp_rasterizer
*rast
= task
->rast
;
144 struct lp_scene
*scene
= rast
->curr_scene
;
145 enum lp_texture_usage usage
;
147 LP_DBG(DEBUG_RAST
, "%s %d,%d\n", __FUNCTION__
, x
, y
);
149 assert(x
% TILE_SIZE
== 0);
150 assert(y
% TILE_SIZE
== 0);
155 /* reset pointers to color tile(s) */
156 memset(task
->color_tiles
, 0, sizeof(task
->color_tiles
));
158 /* get pointer to depth/stencil tile */
160 struct pipe_surface
*zsbuf
= rast
->curr_scene
->fb
.zsbuf
;
162 struct llvmpipe_resource
*lpt
= llvmpipe_resource(zsbuf
->texture
);
164 if (scene
->has_depthstencil_clear
)
165 usage
= LP_TEX_USAGE_WRITE_ALL
;
167 usage
= LP_TEX_USAGE_READ_WRITE
;
169 /* "prime" the tile: convert data from linear to tiled if necessary
170 * and update the tile's layout info.
172 (void) llvmpipe_get_texture_tile(lpt
,
173 zsbuf
->face
+ zsbuf
->zslice
,
177 /* Get actual pointer to the tile data. Note that depth/stencil
178 * data is tiled differently than color data.
180 task
->depth_tile
= lp_rast_get_depth_block_pointer(task
, x
, y
);
182 assert(task
->depth_tile
);
185 task
->depth_tile
= NULL
;
192 * Clear the rasterizer's current color tile.
193 * This is a bin command called during bin processing.
196 lp_rast_clear_color(struct lp_rasterizer_task
*task
,
197 const union lp_rast_cmd_arg arg
)
199 struct lp_rasterizer
*rast
= task
->rast
;
200 const uint8_t *clear_color
= arg
.clear_color
;
204 LP_DBG(DEBUG_RAST
, "%s 0x%x,0x%x,0x%x,0x%x\n", __FUNCTION__
,
210 if (clear_color
[0] == clear_color
[1] &&
211 clear_color
[1] == clear_color
[2] &&
212 clear_color
[2] == clear_color
[3]) {
213 /* clear to grayscale value {x, x, x, x} */
214 for (i
= 0; i
< rast
->state
.nr_cbufs
; i
++) {
216 lp_rast_get_color_tile_pointer(task
, i
, LP_TEX_USAGE_WRITE_ALL
);
217 memset(ptr
, clear_color
[0], TILE_SIZE
* TILE_SIZE
* 4);
222 * Note: if the swizzled tile layout changes (see TILE_PIXEL) this code
223 * will need to change. It'll be pretty obvious when clearing no longer
226 const unsigned chunk
= TILE_SIZE
/ 4;
227 for (i
= 0; i
< rast
->state
.nr_cbufs
; i
++) {
229 lp_rast_get_color_tile_pointer(task
, i
, LP_TEX_USAGE_WRITE_ALL
);
232 for (j
= 0; j
< 4 * TILE_SIZE
; j
++) {
233 memset(c
, clear_color
[0], chunk
);
235 memset(c
, clear_color
[1], chunk
);
237 memset(c
, clear_color
[2], chunk
);
239 memset(c
, clear_color
[3], chunk
);
245 LP_COUNT(nr_color_tile_clear
);
250 * Clear the rasterizer's current z/stencil tile.
251 * This is a bin command called during bin processing.
254 lp_rast_clear_zstencil(struct lp_rasterizer_task
*task
,
255 const union lp_rast_cmd_arg arg
)
257 struct lp_rasterizer
*rast
= task
->rast
;
258 unsigned clear_value
= arg
.clear_zstencil
.value
;
259 unsigned clear_mask
= arg
.clear_zstencil
.mask
;
260 const unsigned height
= TILE_SIZE
/ TILE_VECTOR_HEIGHT
;
261 const unsigned width
= TILE_SIZE
* TILE_VECTOR_HEIGHT
;
262 const unsigned block_size
= rast
->zsbuf
.blocksize
;
263 const unsigned dst_stride
= rast
->zsbuf
.stride
* TILE_VECTOR_HEIGHT
;
267 LP_DBG(DEBUG_RAST
, "%s 0x%x%x\n", __FUNCTION__
, clear_value
, clear_mask
);
270 * Clear the aera of the swizzled depth/depth buffer matching this tile, in
271 * stripes of TILE_VECTOR_HEIGHT x TILE_SIZE at a time.
273 * The swizzled depth format is such that the depths for
274 * TILE_VECTOR_HEIGHT x TILE_VECTOR_WIDTH pixels have consecutive offsets.
277 dst
= task
->depth_tile
;
279 switch (block_size
) {
281 memset(dst
, (uint8_t) clear_value
, height
* width
);
284 for (i
= 0; i
< height
; i
++) {
285 uint16_t *row
= (uint16_t *)dst
;
286 for (j
= 0; j
< width
; j
++)
287 *row
++ = (uint16_t) clear_value
;
292 if (clear_mask
== 0xffffffff) {
293 for (i
= 0; i
< height
; i
++) {
294 uint32_t *row
= (uint32_t *)dst
;
295 for (j
= 0; j
< width
; j
++)
296 *row
++ = clear_value
;
301 for (i
= 0; i
< height
; i
++) {
302 uint32_t *row
= (uint32_t *)dst
;
303 for (j
= 0; j
< width
; j
++) {
304 uint32_t tmp
= ~clear_mask
& *row
;
305 *row
++ = (clear_value
& clear_mask
) | tmp
;
321 * Convert the color tile from tiled to linear layout.
322 * This is generally only done when we're flushing the scene just prior to
323 * SwapBuffers. If we didn't do this here, we'd have to convert the entire
324 * tiled color buffer to linear layout in the llvmpipe_texture_unmap()
325 * function. It's better to do it here to take advantage of
326 * threading/parallelism.
327 * This is a bin command which is stored in all bins.
330 lp_rast_store_linear_color( struct lp_rasterizer_task
*task
)
332 struct lp_rasterizer
*rast
= task
->rast
;
333 struct lp_scene
*scene
= rast
->curr_scene
;
336 for (buf
= 0; buf
< rast
->state
.nr_cbufs
; buf
++) {
337 struct pipe_surface
*cbuf
= scene
->fb
.cbufs
[buf
];
338 const unsigned face_slice
= cbuf
->face
+ cbuf
->zslice
;
339 const unsigned level
= cbuf
->level
;
340 struct llvmpipe_resource
*lpt
= llvmpipe_resource(cbuf
->texture
);
342 if (!task
->color_tiles
[buf
])
345 llvmpipe_unswizzle_cbuf_tile(lpt
,
349 task
->color_tiles
[buf
]);
356 * Run the shader on all blocks in a tile. This is used when a tile is
357 * completely contained inside a triangle.
358 * This is a bin command called during bin processing.
361 lp_rast_shade_tile(struct lp_rasterizer_task
*task
,
362 const union lp_rast_cmd_arg arg
)
364 struct lp_rasterizer
*rast
= task
->rast
;
365 const struct lp_rast_shader_inputs
*inputs
= arg
.shade_tile
;
366 const struct lp_rast_state
*state
= inputs
->state
;
367 struct lp_fragment_shader_variant
*variant
= state
->variant
;
368 const unsigned tile_x
= task
->x
, tile_y
= task
->y
;
371 if (inputs
->disable
) {
372 /* This command was partially binned and has been disabled */
376 LP_DBG(DEBUG_RAST
, "%s\n", __FUNCTION__
);
378 /* render the whole 64x64 tile in 4x4 chunks */
379 for (y
= 0; y
< TILE_SIZE
; y
+= 4){
380 for (x
= 0; x
< TILE_SIZE
; x
+= 4) {
381 uint8_t *color
[PIPE_MAX_COLOR_BUFS
];
386 for (i
= 0; i
< rast
->state
.nr_cbufs
; i
++)
387 color
[i
] = lp_rast_get_color_block_pointer(task
, i
,
388 tile_x
+ x
, tile_y
+ y
);
391 depth
= lp_rast_get_depth_block_pointer(task
, tile_x
+ x
, tile_y
+ y
);
393 /* run shader on 4x4 block */
394 BEGIN_JIT_CALL(state
);
395 variant
->jit_function
[RAST_WHOLE
]( &state
->jit_context
,
396 tile_x
+ x
, tile_y
+ y
,
412 * Run the shader on all blocks in a tile. This is used when a tile is
413 * completely contained inside a triangle, and the shader is opaque.
414 * This is a bin command called during bin processing.
417 lp_rast_shade_tile_opaque(struct lp_rasterizer_task
*task
,
418 const union lp_rast_cmd_arg arg
)
420 struct lp_rasterizer
*rast
= task
->rast
;
423 LP_DBG(DEBUG_RAST
, "%s\n", __FUNCTION__
);
425 /* this will prevent converting the layout from tiled to linear */
426 for (i
= 0; i
< rast
->state
.nr_cbufs
; i
++) {
427 (void)lp_rast_get_color_tile_pointer(task
, i
, LP_TEX_USAGE_WRITE_ALL
);
430 lp_rast_shade_tile(task
, arg
);
435 * Compute shading for a 4x4 block of pixels inside a triangle.
436 * This is a bin command called during bin processing.
437 * \param x X position of quad in window coords
438 * \param y Y position of quad in window coords
441 lp_rast_shade_quads_mask(struct lp_rasterizer_task
*task
,
442 const struct lp_rast_shader_inputs
*inputs
,
443 unsigned x
, unsigned y
,
446 const struct lp_rast_state
*state
= inputs
->state
;
447 struct lp_fragment_shader_variant
*variant
= state
->variant
;
448 struct lp_rasterizer
*rast
= task
->rast
;
449 uint8_t *color
[PIPE_MAX_COLOR_BUFS
];
456 assert(x
% TILE_VECTOR_WIDTH
== 0);
457 assert(y
% TILE_VECTOR_HEIGHT
== 0);
459 assert((x
% 4) == 0);
460 assert((y
% 4) == 0);
463 for (i
= 0; i
< rast
->state
.nr_cbufs
; i
++) {
464 color
[i
] = lp_rast_get_color_block_pointer(task
, i
, x
, y
);
465 assert(lp_check_alignment(color
[i
], 16));
469 depth
= lp_rast_get_depth_block_pointer(task
, x
, y
);
472 assert(lp_check_alignment(state
->jit_context
.blend_color
, 16));
474 /* run shader on 4x4 block */
475 BEGIN_JIT_CALL(state
);
476 variant
->jit_function
[RAST_EDGE_TEST
](&state
->jit_context
,
492 * Begin a new occlusion query.
493 * This is a bin command put in all bins.
497 lp_rast_begin_query(struct lp_rasterizer_task
*task
,
498 const union lp_rast_cmd_arg arg
)
500 struct llvmpipe_query
*pq
= arg
.query_obj
;
502 assert(task
->query
== NULL
);
503 task
->vis_counter
= 0;
509 * End the current occlusion query.
510 * This is a bin command put in all bins.
514 lp_rast_end_query(struct lp_rasterizer_task
*task
,
515 const union lp_rast_cmd_arg arg
)
517 task
->query
->count
[task
->thread_index
] += task
->vis_counter
;
524 * Set top row and left column of the tile's pixels to white. For debugging.
527 outline_tile(uint8_t *tile
)
529 const uint8_t val
= 0xff;
532 for (i
= 0; i
< TILE_SIZE
; i
++) {
533 TILE_PIXEL(tile
, i
, 0, 0) = val
;
534 TILE_PIXEL(tile
, i
, 0, 1) = val
;
535 TILE_PIXEL(tile
, i
, 0, 2) = val
;
536 TILE_PIXEL(tile
, i
, 0, 3) = val
;
538 TILE_PIXEL(tile
, 0, i
, 0) = val
;
539 TILE_PIXEL(tile
, 0, i
, 1) = val
;
540 TILE_PIXEL(tile
, 0, i
, 2) = val
;
541 TILE_PIXEL(tile
, 0, i
, 3) = val
;
547 * Draw grid of gray lines at 16-pixel intervals across the tile to
548 * show the sub-tile boundaries. For debugging.
551 outline_subtiles(uint8_t *tile
)
553 const uint8_t val
= 0x80;
554 const unsigned step
= 16;
557 for (i
= 0; i
< TILE_SIZE
; i
+= step
) {
558 for (j
= 0; j
< TILE_SIZE
; j
++) {
559 TILE_PIXEL(tile
, i
, j
, 0) = val
;
560 TILE_PIXEL(tile
, i
, j
, 1) = val
;
561 TILE_PIXEL(tile
, i
, j
, 2) = val
;
562 TILE_PIXEL(tile
, i
, j
, 3) = val
;
564 TILE_PIXEL(tile
, j
, i
, 0) = val
;
565 TILE_PIXEL(tile
, j
, i
, 1) = val
;
566 TILE_PIXEL(tile
, j
, i
, 2) = val
;
567 TILE_PIXEL(tile
, j
, i
, 3) = val
;
577 * Called when we're done writing to a color tile.
580 lp_rast_tile_end(struct lp_rasterizer_task
*task
)
583 if (LP_DEBUG
& (DEBUG_SHOW_SUBTILES
| DEBUG_SHOW_TILES
)) {
584 struct lp_rasterizer
*rast
= task
->rast
;
587 for (buf
= 0; buf
< rast
->state
.nr_cbufs
; buf
++) {
588 uint8_t *color
= lp_rast_get_color_block_pointer(task
, buf
,
591 if (LP_DEBUG
& DEBUG_SHOW_SUBTILES
)
592 outline_subtiles(color
);
593 else if (LP_DEBUG
& DEBUG_SHOW_TILES
)
598 (void) outline_subtiles
;
601 lp_rast_store_linear_color(task
);
604 union lp_rast_cmd_arg dummy
= {0};
605 lp_rast_end_query(task
, dummy
);
609 memset(task
->color_tiles
, 0, sizeof(task
->color_tiles
));
610 task
->depth_tile
= NULL
;
618 * Rasterize commands for a single bin.
619 * \param x, y position of the bin's tile in the framebuffer
620 * Must be called between lp_rast_begin() and lp_rast_end().
624 rasterize_bin(struct lp_rasterizer_task
*task
,
625 const struct cmd_bin
*bin
,
628 const struct cmd_block_list
*commands
= &bin
->commands
;
629 struct cmd_block
*block
;
632 lp_rast_tile_begin( task
, x
* TILE_SIZE
, y
* TILE_SIZE
);
634 /* simply execute each of the commands in the block list */
635 for (block
= commands
->head
; block
; block
= block
->next
) {
636 for (k
= 0; k
< block
->count
; k
++) {
637 block
->cmd
[k
]( task
, block
->arg
[k
] );
641 lp_rast_tile_end(task
);
646 /* An empty bin is one that just loads the contents of the tile and
647 * stores them again unchanged. This typically happens when bins have
648 * been flushed for some reason in the middle of a frame, or when
649 * incremental updates are being made to a render target.
651 * Try to avoid doing pointless work in this case.
654 is_empty_bin( const struct cmd_bin
*bin
)
656 return bin
->commands
.head
== NULL
;
662 * Rasterize/execute all bins within a scene.
666 rasterize_scene(struct lp_rasterizer_task
*task
,
667 struct lp_scene
*scene
)
669 /* loop over scene bins, rasterize each */
673 for (i
= 0; i
< scene
->tiles_x
; i
++) {
674 for (j
= 0; j
< scene
->tiles_y
; j
++) {
675 struct cmd_bin
*bin
= lp_scene_get_bin(scene
, i
, j
);
676 rasterize_bin(task
, bin
, i
, j
);
686 while ((bin
= lp_scene_bin_iter_next(scene
, &x
, &y
))) {
687 if (!is_empty_bin( bin
))
688 rasterize_bin(task
, bin
, x
, y
);
694 lp_fence_signal(scene
->fence
);
700 * Called by setup module when it has something for us to render.
703 lp_rast_queue_scene( struct lp_rasterizer
*rast
,
704 struct lp_scene
*scene
)
706 LP_DBG(DEBUG_SETUP
, "%s\n", __FUNCTION__
);
708 if (rast
->num_threads
== 0) {
711 lp_rast_begin( rast
, scene
);
713 rasterize_scene( &rast
->tasks
[0], scene
);
715 lp_scene_reset( scene
);
719 rast
->curr_scene
= NULL
;
722 /* threaded rendering! */
725 lp_scene_enqueue( rast
->full_scenes
, scene
);
727 /* signal the threads that there's work to do */
728 for (i
= 0; i
< rast
->num_threads
; i
++) {
729 pipe_semaphore_signal(&rast
->tasks
[i
].work_ready
);
733 LP_DBG(DEBUG_SETUP
, "%s done \n", __FUNCTION__
);
738 lp_rast_finish( struct lp_rasterizer
*rast
)
740 if (rast
->num_threads
== 0) {
746 /* wait for work to complete */
747 for (i
= 0; i
< rast
->num_threads
; i
++) {
748 pipe_semaphore_wait(&rast
->tasks
[i
].work_done
);
755 * This is the thread's main entrypoint.
756 * It's a simple loop:
759 * 3. signal that we're done
761 static PIPE_THREAD_ROUTINE( thread_func
, init_data
)
763 struct lp_rasterizer_task
*task
= (struct lp_rasterizer_task
*) init_data
;
764 struct lp_rasterizer
*rast
= task
->rast
;
765 boolean debug
= false;
770 debug_printf("thread %d waiting for work\n", task
->thread_index
);
771 pipe_semaphore_wait(&task
->work_ready
);
776 if (task
->thread_index
== 0) {
778 * - get next scene to rasterize
779 * - map the framebuffer surfaces
782 lp_scene_dequeue( rast
->full_scenes
, TRUE
) );
785 /* Wait for all threads to get here so that threads[1+] don't
786 * get a null rast->curr_scene pointer.
788 pipe_barrier_wait( &rast
->barrier
);
792 debug_printf("thread %d doing work\n", task
->thread_index
);
794 rasterize_scene(task
,
797 /* wait for all threads to finish with this scene */
798 pipe_barrier_wait( &rast
->barrier
);
800 /* XXX: shouldn't be necessary:
802 if (task
->thread_index
== 0) {
806 /* signal done with work */
808 debug_printf("thread %d done working\n", task
->thread_index
);
810 pipe_semaphore_signal(&task
->work_done
);
818 * Initialize semaphores and spawn the threads.
821 create_rast_threads(struct lp_rasterizer
*rast
)
825 /* NOTE: if num_threads is zero, we won't use any threads */
826 for (i
= 0; i
< rast
->num_threads
; i
++) {
827 pipe_semaphore_init(&rast
->tasks
[i
].work_ready
, 0);
828 pipe_semaphore_init(&rast
->tasks
[i
].work_done
, 0);
829 rast
->threads
[i
] = pipe_thread_create(thread_func
,
830 (void *) &rast
->tasks
[i
]);
837 * Create new lp_rasterizer. If num_threads is zero, don't create any
838 * new threads, do rendering synchronously.
839 * \param num_threads number of rasterizer threads to create
841 struct lp_rasterizer
*
842 lp_rast_create( unsigned num_threads
)
844 struct lp_rasterizer
*rast
;
847 rast
= CALLOC_STRUCT(lp_rasterizer
);
851 rast
->full_scenes
= lp_scene_queue_create();
853 for (i
= 0; i
< Elements(rast
->tasks
); i
++) {
854 struct lp_rasterizer_task
*task
= &rast
->tasks
[i
];
856 task
->thread_index
= i
;
859 rast
->num_threads
= num_threads
;
861 create_rast_threads(rast
);
863 /* for synchronizing rasterization threads */
864 pipe_barrier_init( &rast
->barrier
, rast
->num_threads
);
866 memset(lp_swizzled_cbuf
, 0, sizeof lp_swizzled_cbuf
);
868 memset(lp_dummy_tile
, 0, sizeof lp_dummy_tile
);
876 void lp_rast_destroy( struct lp_rasterizer
*rast
)
880 /* Set exit_flag and signal each thread's work_ready semaphore.
881 * Each thread will be woken up, notice that the exit_flag is set and
882 * break out of its main loop. The thread will then exit.
884 rast
->exit_flag
= TRUE
;
885 for (i
= 0; i
< rast
->num_threads
; i
++) {
886 pipe_semaphore_signal(&rast
->tasks
[i
].work_ready
);
889 /* Wait for threads to terminate before cleaning up per-thread data */
890 for (i
= 0; i
< rast
->num_threads
; i
++) {
891 pipe_thread_wait(rast
->threads
[i
]);
894 /* Clean up per-thread data */
895 for (i
= 0; i
< rast
->num_threads
; i
++) {
896 pipe_semaphore_destroy(&rast
->tasks
[i
].work_ready
);
897 pipe_semaphore_destroy(&rast
->tasks
[i
].work_done
);
900 /* for synchronizing rasterization threads */
901 pipe_barrier_destroy( &rast
->barrier
);
903 lp_scene_queue_destroy(rast
->full_scenes
);
909 /** Return number of rasterization threads */
911 lp_rast_get_num_threads( struct lp_rasterizer
*rast
)
913 return rast
->num_threads
;