Go to the source code of this file.
Functions | |
void | st_init_bitmap_functions (struct dd_function_table *functions) |
Per-context init. | |
void | st_init_bitmap (struct st_context *st) |
Per-context init. | |
void | st_destroy_bitmap (struct st_context *st) |
Per-context tear-down. | |
void | st_flush_bitmap_cache (struct st_context *st) |
If there's anything in the bitmap cache, draw/flush it now. | |
void | st_flush_bitmap (struct st_context *st) |
void st_destroy_bitmap | ( | struct st_context * | st | ) |
Per-context tear-down.
Definition at line 809 of file st_cb_bitmap.c.
References st_context::bitmap, st_context::cache, st_context::cso_context, cso_delete_vertex_shader(), FREE, st_context::pipe, pipe_buffer_destroy(), pipe_texture_release(), pipe_context::screen, bitmap_cache::surf, pipe_screen::surface_unmap, pipe_screen::tex_surface_release, util_free_shader(), st_context::vbuf, st_context::vert_shader, and st_context::vs.
00810 { 00811 struct pipe_context *pipe = st->pipe; 00812 struct pipe_screen *screen = pipe->screen; 00813 struct bitmap_cache *cache = st->bitmap.cache; 00814 00815 screen->surface_unmap(screen, cache->surf); 00816 screen->tex_surface_release(screen, &cache->surf); 00817 00818 if (st->bitmap.vs) { 00819 cso_delete_vertex_shader(st->cso_context, st->bitmap.vs); 00820 st->bitmap.vs = NULL; 00821 } 00822 util_free_shader(&st->bitmap.vert_shader); 00823 00824 if (st->bitmap.vbuf) { 00825 pipe_buffer_destroy(pipe->screen, st->bitmap.vbuf); 00826 st->bitmap.vbuf = NULL; 00827 } 00828 00829 if (st->bitmap.cache) { 00830 pipe_texture_release(&st->bitmap.cache->texture); 00831 FREE(st->bitmap.cache); 00832 st->bitmap.cache = NULL; 00833 } 00834 }
void st_flush_bitmap | ( | struct st_context * | st | ) |
Definition at line 645 of file st_cb_bitmap.c.
References st_context::bitmap, st_context::pipe, pipe_buffer_reference(), pipe_context::screen, st_flush_bitmap_cache(), st_context::vbuf, and st_context::vbuf_slot.
00646 { 00647 st_flush_bitmap_cache(st); 00648 00649 /* Release vertex buffer to avoid synchronous rendering if we were 00650 * to map it in the next frame. 00651 */ 00652 pipe_buffer_reference(st->pipe->screen, &st->bitmap.vbuf, NULL); 00653 st->bitmap.vbuf_slot = 0; 00654 }
void st_flush_bitmap_cache | ( | struct st_context * | st | ) |
If there's anything in the bitmap cache, draw/flush it now.
Definition at line 601 of file st_cb_bitmap.c.
References assert, st_context::bitmap, BITMAP_CACHE_HEIGHT, BITMAP_CACHE_WIDTH, bitmap_cache::buffer, st_context::cache, bitmap_cache::color, st_context::ctx, draw_bitmap_quad(), st_context::pipe, pipe_texture_reference(), reset_cache(), pipe_context::screen, bitmap_cache::surf, pipe_screen::surface_unmap, pipe_screen::tex_surface_release, bitmap_cache::texture, bitmap_cache::xmax, bitmap_cache::xmin, bitmap_cache::xpos, and bitmap_cache::ypos.
00602 { 00603 if (!st->bitmap.cache->empty) { 00604 struct bitmap_cache *cache = st->bitmap.cache; 00605 00606 if (st->ctx->DrawBuffer) { 00607 struct pipe_context *pipe = st->pipe; 00608 struct pipe_screen *screen = pipe->screen; 00609 00610 assert(cache->xmin <= cache->xmax); 00611 00612 /* printf("flush size %d x %d at %d, %d\n", 00613 cache->xmax - cache->xmin, 00614 cache->ymax - cache->ymin, 00615 cache->xpos, cache->ypos); 00616 */ 00617 00618 /* The texture surface has been mapped until now. 00619 * So unmap and release the texture surface before drawing. 00620 */ 00621 screen->surface_unmap(screen, cache->surf); 00622 cache->buffer = NULL; 00623 00624 screen->tex_surface_release(screen, &cache->surf); 00625 00626 draw_bitmap_quad(st->ctx, 00627 cache->xpos, 00628 cache->ypos, 00629 st->ctx->Current.RasterPos[2], 00630 BITMAP_CACHE_WIDTH, BITMAP_CACHE_HEIGHT, 00631 cache->texture, 00632 cache->color); 00633 } 00634 00635 /* release/free the texture */ 00636 pipe_texture_reference(&cache->texture, NULL); 00637 00638 reset_cache(st); 00639 } 00640 }
void st_init_bitmap | ( | struct st_context * | st | ) |
Per-context init.
Definition at line 769 of file st_cb_bitmap.c.
References assert, st_context::bitmap, pipe_rasterizer_state::bypass_vs, st_context::cache, CALLOC_STRUCT, pipe_rasterizer_state::gl_rasterization_rules, pipe_screen::is_format_supported, pipe_sampler_state::mag_img_filter, pipe_sampler_state::min_img_filter, pipe_sampler_state::min_mip_filter, pipe_sampler_state::normalized_coords, st_context::pipe, PIPE_FORMAT_I8_UNORM, PIPE_TEX_FILTER_NEAREST, PIPE_TEX_MIPFILTER_NONE, PIPE_TEX_WRAP_CLAMP, PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_SAMPLER, st_context::rasterizer, reset_cache(), st_context::sampler, pipe_context::screen, st_context::tex_format, pipe_sampler_state::wrap_r, pipe_sampler_state::wrap_s, and pipe_sampler_state::wrap_t.
00770 { 00771 struct pipe_sampler_state *sampler = &st->bitmap.sampler; 00772 struct pipe_context *pipe = st->pipe; 00773 struct pipe_screen *screen = pipe->screen; 00774 00775 /* init sampler state once */ 00776 memset(sampler, 0, sizeof(*sampler)); 00777 sampler->wrap_s = PIPE_TEX_WRAP_CLAMP; 00778 sampler->wrap_t = PIPE_TEX_WRAP_CLAMP; 00779 sampler->wrap_r = PIPE_TEX_WRAP_CLAMP; 00780 sampler->min_img_filter = PIPE_TEX_FILTER_NEAREST; 00781 sampler->min_mip_filter = PIPE_TEX_MIPFILTER_NONE; 00782 sampler->mag_img_filter = PIPE_TEX_FILTER_NEAREST; 00783 sampler->normalized_coords = 1; 00784 00785 /* init baseline rasterizer state once */ 00786 memset(&st->bitmap.rasterizer, 0, sizeof(st->bitmap.rasterizer)); 00787 st->bitmap.rasterizer.gl_rasterization_rules = 1; 00788 st->bitmap.rasterizer.bypass_vs = 1; 00789 00790 /* find a usable texture format */ 00791 if (screen->is_format_supported(screen, PIPE_FORMAT_I8_UNORM, PIPE_TEXTURE_2D, 00792 PIPE_TEXTURE_USAGE_SAMPLER, 0)) { 00793 st->bitmap.tex_format = PIPE_FORMAT_I8_UNORM; 00794 } 00795 else { 00796 /* XXX support more formats */ 00797 assert(0); 00798 } 00799 00800 /* alloc bitmap cache object */ 00801 st->bitmap.cache = CALLOC_STRUCT(bitmap_cache); 00802 00803 reset_cache(st); 00804 }
void st_init_bitmap_functions | ( | struct dd_function_table * | functions | ) |
Per-context init.
Definition at line 761 of file st_cb_bitmap.c.
References st_Bitmap().
00762 { 00763 functions->Bitmap = st_Bitmap; 00764 }