summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_cb_bitmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/state_tracker/st_cb_bitmap.c')
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index e95ff5e2e0..3a102df67f 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -325,16 +325,18 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
* Create texture to hold bitmap pattern.
*/
pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, ctx->st->bitmap.tex_format,
- 0, width, height, 1, 0);
+ 0, width, height, 1, 0,
+ PIPE_TEXTURE_USAGE_SAMPLER);
if (!pt) {
_mesa_unmap_bitmap_pbo(ctx, unpack);
return NULL;
}
- surface = screen->get_tex_surface(screen, pt, 0, 0, 0);
+ surface = screen->get_tex_surface(screen, pt, 0, 0, 0,
+ PIPE_BUFFER_USAGE_CPU_WRITE);
/* map texture surface */
- dest = pipe_surface_map(surface);
+ dest = screen->surface_map(screen, surface, PIPE_BUFFER_USAGE_CPU_WRITE);
/* Put image into texture surface */
memset(dest, 0xff, height * surface->pitch);
@@ -344,9 +346,8 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
_mesa_unmap_bitmap_pbo(ctx, unpack);
/* Release surface */
- pipe_surface_unmap(surface);
+ screen->surface_unmap(screen, surface);
pipe_surface_reference(&surface, NULL);
- pipe->texture_update(pipe, pt, 0, 0x1);
return pt;
}
@@ -543,13 +544,16 @@ reset_cache(struct st_context *st)
cache->texture = st_texture_create(st, PIPE_TEXTURE_2D,
st->bitmap.tex_format, 0,
BITMAP_CACHE_WIDTH, BITMAP_CACHE_HEIGHT,
- 1, 0);
+ 1, 0,
+ PIPE_TEXTURE_USAGE_SAMPLER);
/* Map the texture surface.
* Subsequent glBitmap calls will write into the texture image.
*/
- cache->surf = screen->get_tex_surface(screen, cache->texture, 0, 0, 0);
- cache->buffer = pipe_surface_map(cache->surf);
+ cache->surf = screen->get_tex_surface(screen, cache->texture, 0, 0, 0,
+ PIPE_BUFFER_USAGE_CPU_WRITE);
+ cache->buffer = screen->surface_map(screen, cache->surf,
+ PIPE_BUFFER_USAGE_CPU_WRITE);
/* init image to all 0xff */
memset(cache->buffer, 0xff, BITMAP_CACHE_WIDTH * BITMAP_CACHE_HEIGHT);
@@ -566,6 +570,7 @@ st_flush_bitmap_cache(struct st_context *st)
if (st->ctx->DrawBuffer) {
struct bitmap_cache *cache = st->bitmap.cache;
struct pipe_context *pipe = st->pipe;
+ struct pipe_screen *screen = pipe->screen;
assert(cache->xmin <= cache->xmax);
/*
@@ -578,11 +583,8 @@ st_flush_bitmap_cache(struct st_context *st)
/* The texture surface has been mapped until now.
* So unmap and release the texture surface before drawing.
*/
- pipe_surface_unmap(cache->surf);
- pipe_surface_reference(&cache->surf, NULL);
-
- /* XXX is this needed? */
- pipe->texture_update(pipe, cache->texture, 0, 0x1);
+ screen->surface_unmap(screen, cache->surf);
+ screen->tex_surface_release(screen, &cache->surf);
draw_bitmap_quad(st->ctx,
cache->xpos,
@@ -666,6 +668,9 @@ st_Bitmap(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
struct st_context *st = ctx->st;
struct pipe_texture *pt;
+ if (width == 0 || height == 0)
+ return;
+
st_validate_state(st);
if (!st->bitmap.vs) {
@@ -746,6 +751,11 @@ void
st_destroy_bitmap(struct st_context *st)
{
struct pipe_context *pipe = st->pipe;
+ struct pipe_screen *screen = pipe->screen;
+ struct bitmap_cache *cache = st->bitmap.cache;
+
+ screen->surface_unmap(screen, cache->surf);
+ screen->tex_surface_release(screen, &cache->surf);
if (st->bitmap.vs) {
cso_delete_vertex_shader(st->cso_context, st->bitmap.vs);