Lines Matching defs:tc

42 sp_alloc_tile(struct softpipe_tile_cache *tc);
86 struct softpipe_tile_cache *tc;
99 tc = CALLOC_STRUCT( softpipe_tile_cache );
100 if (tc) {
101 tc->pipe = pipe;
103 tc->tile_addrs[pos].bits.invalid = 1;
105 tc->last_tile_addr.bits.invalid = 1;
110 tc->tile = MALLOC_STRUCT( softpipe_cached_tile );
111 if (!tc->tile)
113 FREE(tc);
124 memset(tc->clear_flags, 255, sizeof(tc->clear_flags));
127 return tc;
132 sp_destroy_tile_cache(struct softpipe_tile_cache *tc)
134 if (tc) {
138 /*assert(tc->entries[pos].x < 0);*/
139 FREE( tc->entries[pos] );
141 FREE( tc->tile );
143 if (tc->transfer) {
144 tc->pipe->transfer_destroy(tc->pipe, tc->transfer);
147 FREE( tc );
156 sp_tile_cache_set_surface(struct softpipe_tile_cache *tc,
159 struct pipe_context *pipe = tc->pipe;
161 if (tc->transfer) {
162 if (ps == tc->surface)
165 if (tc->transfer_map) {
166 pipe->transfer_unmap(pipe, tc->transfer);
167 tc->transfer_map = NULL;
170 pipe->transfer_destroy(pipe, tc->transfer);
171 tc->transfer = NULL;
174 tc->surface = ps;
177 tc->transfer = pipe_get_transfer(pipe, ps->texture,
183 tc->depth_stencil = util_format_is_depth_or_stencil(ps->format);
192 sp_tile_cache_get_surface(struct softpipe_tile_cache *tc)
194 return tc->surface;
199 sp_tile_cache_map_transfers(struct softpipe_tile_cache *tc)
201 if (tc->transfer && !tc->transfer_map)
202 tc->transfer_map = tc->pipe->transfer_map(tc->pipe, tc->transfer);
207 sp_tile_cache_unmap_transfers(struct softpipe_tile_cache *tc)
209 if (tc->transfer_map) {
210 tc->pipe->transfer_unmap(tc->pipe, tc->transfer);
211 tc->transfer_map = NULL;
325 sp_tile_cache_flush_clear(struct softpipe_tile_cache *tc)
327 struct pipe_transfer *pt = tc->transfer;
328 const uint w = tc->transfer->box.width;
329 const uint h = tc->transfer->box.height;
334 if (!tc->tile)
335 tc->tile = sp_alloc_tile(tc);
338 if (tc->depth_stencil) {
339 clear_tile(tc->tile, pt->resource->format, tc->clear_val);
341 clear_tile_rgba(tc->tile, pt->resource->format, &tc->clear_color);
349 if (is_clear_flag_set(tc->clear_flags, addr)) {
351 if (tc->depth_stencil) {
352 pipe_put_tile_raw(tc->pipe,
355 tc->tile->data.any, 0/*STRIDE*/);
358 if (util_format_is_pure_uint(tc->surface->format)) {
359 pipe_put_tile_ui_format(tc->pipe, pt,
362 (unsigned *) tc->tile->data.colorui128);
363 } else if (util_format_is_pure_sint(tc->surface->format)) {
364 pipe_put_tile_i_format(tc->pipe, pt,
367 (int *) tc->tile->data.colori128);
369 pipe_put_tile_rgba(tc->pipe, pt,
371 (float *) tc->tile->data.color);
380 memset(tc->clear_flags, 0, sizeof(tc->clear_flags));
388 sp_flush_tile(struct softpipe_tile_cache* tc, unsigned pos)
390 if (!tc->tile_addrs[pos].bits.invalid) {
391 if (tc->depth_stencil) {
392 pipe_put_tile_raw(tc->pipe, tc->transfer,
393 tc->tile_addrs[pos].bits.x * TILE_SIZE,
394 tc->tile_addrs[pos].bits.y * TILE_SIZE,
396 tc->entries[pos]->data.depth32, 0/*STRIDE*/);
399 if (util_format_is_pure_uint(tc->surface->format)) {
400 pipe_put_tile_ui_format(tc->pipe, tc->transfer,
401 tc->tile_addrs[pos].bits.x * TILE_SIZE,
402 tc->tile_addrs[pos].bits.y * TILE_SIZE,
404 tc->surface->format,
405 (unsigned *) tc->entries[pos]->data.colorui128);
406 } else if (util_format_is_pure_sint(tc->surface->format)) {
407 pipe_put_tile_i_format(tc->pipe, tc->transfer,
408 tc->tile_addrs[pos].bits.x * TILE_SIZE,
409 tc->tile_addrs[pos].bits.y * TILE_SIZE,
411 tc->surface->format,
412 (int *) tc->entries[pos]->data.colori128);
414 pipe_put_tile_rgba_format(tc->pipe, tc->transfer,
415 tc->tile_addrs[pos].bits.x * TILE_SIZE,
416 tc->tile_addrs[pos].bits.y * TILE_SIZE,
418 tc->surface->format,
419 (float *) tc->entries[pos]->data.color);
422 tc->tile_addrs[pos].bits.invalid = 1; /* mark as empty */
431 sp_flush_tile_cache(struct softpipe_tile_cache *tc)
433 struct pipe_transfer *pt = tc->transfer;
439 struct softpipe_cached_tile *tile = tc->entries[pos];
442 assert(tc->tile_addrs[pos].bits.invalid);
446 sp_flush_tile(tc, pos);
450 sp_tile_cache_flush_clear(tc);
453 tc->last_tile_addr.bits.invalid = 1;
462 sp_alloc_tile(struct softpipe_tile_cache *tc)
468 if (!tc->tile)
472 if (!tc->entries[pos])
475 sp_flush_tile(tc, pos);
476 tc->tile = tc->entries[pos];
477 tc->entries[pos] = NULL;
482 if (!tc->tile)
486 tile = tc->tile;
487 tc->tile = NULL;
489 tc->last_tile_addr.bits.invalid = 1;
499 sp_find_cached_tile(struct softpipe_tile_cache *tc,
502 struct pipe_transfer *pt = tc->transfer;
506 struct softpipe_cached_tile *tile = tc->entries[pos];
509 tile = sp_alloc_tile(tc);
510 tc->entries[pos] = tile;
513 if (addr.value != tc->tile_addrs[pos].value) {
516 if (tc->tile_addrs[pos].bits.invalid == 0) {
518 if (tc->depth_stencil) {
519 pipe_put_tile_raw(tc->pipe, pt,
520 tc->tile_addrs[pos].bits.x * TILE_SIZE,
521 tc->tile_addrs[pos].bits.y * TILE_SIZE,
526 if (util_format_is_pure_uint(tc->surface->format)) {
527 pipe_put_tile_ui_format(tc->pipe, pt,
528 tc->tile_addrs[pos].bits.x * TILE_SIZE,
529 tc->tile_addrs[pos].bits.y * TILE_SIZE,
531 tc->surface->format,
533 } else if (util_format_is_pure_sint(tc->surface->format)) {
534 pipe_put_tile_i_format(tc->pipe, pt,
535 tc->tile_addrs[pos].bits.x * TILE_SIZE,
536 tc->tile_addrs[pos].bits.y * TILE_SIZE,
538 tc->surface->format,
541 pipe_put_tile_rgba_format(tc->pipe, pt,
542 tc->tile_addrs[pos].bits.x * TILE_SIZE,
543 tc->tile_addrs[pos].bits.y * TILE_SIZE,
545 tc->surface->format,
551 tc->tile_addrs[pos] = addr;
553 if (is_clear_flag_set(tc->clear_flags, addr)) {
555 if (tc->depth_stencil) {
556 clear_tile(tile, pt->resource->format, tc->clear_val);
559 clear_tile_rgba(tile, pt->resource->format, &tc->clear_color);
561 clear_clear_flag(tc->clear_flags, addr);
565 if (tc->depth_stencil) {
566 pipe_get_tile_raw(tc->pipe, pt,
567 tc->tile_addrs[pos].bits.x * TILE_SIZE,
568 tc->tile_addrs[pos].bits.y * TILE_SIZE,
573 if (util_format_is_pure_uint(tc->surface->format)) {
574 pipe_get_tile_ui_format(tc->pipe, pt,
575 tc->tile_addrs[pos].bits.x * TILE_SIZE,
576 tc->tile_addrs[pos].bits.y * TILE_SIZE,
578 tc->surface->format,
580 } else if (util_format_is_pure_sint(tc->surface->format)) {
581 pipe_get_tile_i_format(tc->pipe, pt,
582 tc->tile_addrs[pos].bits.x * TILE_SIZE,
583 tc->tile_addrs[pos].bits.y * TILE_SIZE,
585 tc->surface->format,
588 pipe_get_tile_rgba_format(tc->pipe, pt,
589 tc->tile_addrs[pos].bits.x * TILE_SIZE,
590 tc->tile_addrs[pos].bits.y * TILE_SIZE,
592 tc->surface->format,
599 tc->last_tile = tile;
600 tc->last_tile_addr = addr;
614 sp_tile_cache_clear(struct softpipe_tile_cache *tc,
620 tc->clear_color = *color;
622 tc->clear_val = clearValue;
625 memset(tc->clear_flags, 255, sizeof(tc->clear_flags));
628 tc->tile_addrs[pos].bits.invalid = 1;
630 tc->last_tile_addr.bits.invalid = 1;