af508511567e02919c94dd4552fb0d37dde0bd43
[mesa.git] / src / gallium / drivers / trace / tr_texture.h
1 /**************************************************************************
2 *
3 * Copyright 2008 VMware, Inc.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28 #ifndef TR_TEXTURE_H_
29 #define TR_TEXTURE_H_
30
31
32 #include "pipe/p_compiler.h"
33 #include "pipe/p_state.h"
34
35 #include "tr_screen.h"
36
37 struct trace_context;
38
39
40 struct tr_list
41 {
42 struct tr_list *next;
43 struct tr_list *prev;
44 };
45
46
47 struct trace_resource
48 {
49 struct pipe_resource base;
50
51 struct pipe_resource *resource;
52
53 struct tr_list list;
54 };
55
56
57 struct trace_surface
58 {
59 struct pipe_surface base;
60
61 struct pipe_surface *surface;
62
63 struct tr_list list;
64 };
65
66
67 struct trace_sampler_view
68 {
69 struct pipe_sampler_view base;
70
71 struct pipe_sampler_view *sampler_view;
72 };
73
74
75 struct trace_transfer
76 {
77 struct pipe_transfer base;
78
79 struct pipe_transfer *transfer;
80 struct pipe_context *pipe;
81
82 struct tr_list list;
83
84 void *map;
85 };
86
87
88 static inline struct trace_resource *
89 trace_resource(struct pipe_resource *texture)
90 {
91 if (!texture)
92 return NULL;
93 (void)trace_screen(texture->screen);
94 return (struct trace_resource *)texture;
95 }
96
97
98 static inline struct trace_surface *
99 trace_surface(struct pipe_surface *surface)
100 {
101 if (!surface)
102 return NULL;
103 (void)trace_resource(surface->texture);
104 return (struct trace_surface *)surface;
105 }
106
107
108 static inline struct trace_sampler_view *
109 trace_sampler_view(struct pipe_sampler_view *sampler_view)
110 {
111 if (!sampler_view)
112 return NULL;
113 return (struct trace_sampler_view *)sampler_view;
114 }
115
116
117 static inline struct trace_transfer *
118 trace_transfer(struct pipe_transfer *transfer)
119 {
120 if (!transfer)
121 return NULL;
122 (void)trace_resource(transfer->resource);
123 return (struct trace_transfer *)transfer;
124 }
125
126
127 struct pipe_resource *
128 trace_resource_create(struct trace_screen *tr_scr,
129 struct pipe_resource *texture);
130
131 void
132 trace_resource_destroy(struct trace_screen *tr_scr,
133 struct trace_resource *tr_res);
134
135 struct pipe_surface *
136 trace_surf_create(struct trace_context *tr_ctx,
137 struct trace_resource *tr_res,
138 struct pipe_surface *surface);
139
140 void
141 trace_surf_destroy(struct trace_surface *tr_surf);
142
143 struct pipe_transfer *
144 trace_transfer_create(struct trace_context *tr_ctx,
145 struct trace_resource *tr_res,
146 struct pipe_transfer *transfer);
147
148 void
149 trace_transfer_destroy(struct trace_context *tr_ctx,
150 struct trace_transfer *tr_trans);
151
152
153 #endif /* TR_TEXTURE_H_ */