Beispiel #1
0
void debug_dump_surface(const char *prefix,
                        struct pipe_surface *surface)     
{
   struct pipe_texture *texture;
   struct pipe_screen *screen;
   struct pipe_transfer *transfer;
   void *data;

   if (!surface)
      return;

   texture = surface->texture;
   screen = texture->screen;

   transfer = screen->get_tex_transfer(screen, texture, surface->face,
                                       surface->level, surface->zslice,
                                       PIPE_TRANSFER_READ, 0, 0, surface->width,
                                       surface->height);
   
   data = screen->transfer_map(screen, transfer);
   if(!data)
      goto error;
   
   debug_dump_image(prefix, 
                    texture->format,
                    util_format_get_blocksize(texture->format), 
                    util_format_get_nblocksx(texture->format, transfer->width),
                    util_format_get_nblocksy(texture->format, transfer->height),
                    transfer->stride,
                    data);
   
   screen->transfer_unmap(screen, transfer);
error:
   screen->tex_transfer_destroy(transfer);
}
Beispiel #2
0
void debug_dump_surface(const char *prefix,
                        struct pipe_surface *surface)     
{
   unsigned surface_usage;
   void *data;

   if (!surface)
      goto error1;

   /* XXX: force mappable surface */
   surface_usage = surface->usage;
   surface->usage |= PIPE_BUFFER_USAGE_CPU_READ;
   
   data = pipe_surface_map(surface, 
                           PIPE_BUFFER_USAGE_CPU_READ);
   if(!data)
      goto error2;
   
   debug_dump_image(prefix, 
                    surface->format,
                    surface->block.size, 
                    surface->nblocksx,
                    surface->nblocksy,
                    surface->stride,
                    data);
   
   pipe_surface_unmap(surface);
error2:
   surface->usage = surface_usage;
error1:
   ;
}
Beispiel #3
0
/* FIXME: dump resources, not surfaces... */
void debug_dump_surface(struct pipe_context *pipe,
                        const char *prefix,
                        struct pipe_surface *surface)
{
   struct pipe_resource *texture;
   struct pipe_transfer *transfer;
   void *data;

   if (!surface)
      return;

   /* XXX: this doesn't necessarily work, as the driver may be using
    * temporary storage for the surface which hasn't been propagated
    * back into the texture.  Need to nail down the semantics of views
    * and transfers a bit better before we can say if extra work needs
    * to be done here:
    */
   texture = surface->texture;

   transfer = pipe_get_transfer(pipe, texture, surface->u.tex.level,
                                surface->u.tex.first_layer,
                                PIPE_TRANSFER_READ,
                                0, 0, surface->width, surface->height);

   data = pipe->transfer_map(pipe, transfer);
   if(!data)
      goto error;

   debug_dump_image(prefix,
                    texture->format,
                    util_format_get_blocksize(texture->format),
                    util_format_get_nblocksx(texture->format, surface->width),
                    util_format_get_nblocksy(texture->format, surface->height),
                    transfer->stride,
                    data);

   pipe->transfer_unmap(pipe, transfer);
error:
   pipe->transfer_destroy(pipe, transfer);
}