util: add a resource wrapper to get resource samples
[mesa.git] / src / gallium / auxiliary / util / u_debug_image.h
1 /*
2 * Copyright (c) 2008-2016 VMware, Inc.
3 * All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sub license, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial portions
15 * of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
20 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
21 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26
27 #ifndef U_DEBUG_IMAGE_H
28 #define U_DEBUG_IMAGE_H
29
30
31 #include "pipe/p_compiler.h"
32 #include "pipe/p_format.h"
33
34
35 #ifdef DEBUG
36 struct pipe_context;
37 struct pipe_surface;
38 struct pipe_transfer;
39 struct pipe_resource;
40
41 void debug_dump_image(const char *prefix,
42 enum pipe_format format, unsigned cpp,
43 unsigned width, unsigned height,
44 unsigned stride,
45 const void *data);
46 void debug_dump_surface(struct pipe_context *pipe,
47 const char *prefix,
48 struct pipe_surface *surface);
49 void debug_dump_texture(struct pipe_context *pipe,
50 const char *prefix,
51 struct pipe_resource *texture);
52 void debug_dump_surface_bmp(struct pipe_context *pipe,
53 const char *filename,
54 struct pipe_surface *surface);
55 void debug_dump_transfer_bmp(struct pipe_context *pipe,
56 const char *filename,
57 struct pipe_transfer *transfer, void *ptr);
58 void debug_dump_float_rgba_bmp(const char *filename,
59 unsigned width, unsigned height,
60 float *rgba, unsigned stride);
61 void debug_dump_ubyte_rgba_bmp(const char *filename,
62 unsigned width, unsigned height,
63 const ubyte *rgba, unsigned stride);
64 #else
65 #define debug_dump_image(prefix, format, cpp, width, height, stride, data) ((void)0)
66 #define debug_dump_surface(pipe, prefix, surface) ((void)0)
67 #define debug_dump_surface_bmp(pipe, filename, surface) ((void)0)
68 #define debug_dump_transfer_bmp(filename, transfer, ptr) ((void)0)
69 #define debug_dump_float_rgba_bmp(filename, width, height, rgba, stride) ((void)0)
70 #define debug_dump_ubyte_rgba_bmp(filename, width, height, rgba, stride) ((void)0)
71 #endif
72
73
74 #endif