1 /* -*- mode: C; c-file-style: "k&r"; tab-width 4; indent-tabs-mode: t; -*- */
4 * Copyright (C) 2012 Rob Clark <robclark@freedesktop.org>
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26 * Rob Clark <robclark@freedesktop.org>
29 #ifndef FREEDRENO_RESOURCE_H_
30 #define FREEDRENO_RESOURCE_H_
32 #include "util/u_transfer.h"
34 #include "freedreno_util.h"
36 /* for mipmap, cubemap, etc, each level is represented by a slice.
37 * Currently all slices are part of same bo (just different offsets),
38 * this is at least how it needs to be for cubemaps, although mipmap
39 * can be different bo's (although, not sure if there is a strong
40 * advantage to doing that)
42 struct fd_resource_slice
{
43 uint32_t offset
; /* offset of first layer in slice */
45 uint32_t size0
; /* size of first layer in slice */
49 struct u_resource base
;
52 struct fd_resource_slice slices
[MAX_MIP_LEVELS
];
57 static INLINE
struct fd_resource
*
58 fd_resource(struct pipe_resource
*ptex
)
60 return (struct fd_resource
*)ptex
;
63 static INLINE
struct fd_resource_slice
*
64 fd_resource_slice(struct fd_resource
*rsc
, unsigned level
)
66 assert(level
<= rsc
->base
.b
.last_level
);
67 return &rsc
->slices
[level
];
70 void fd_resource_screen_init(struct pipe_screen
*pscreen
);
71 void fd_resource_context_init(struct pipe_context
*pctx
);
73 #endif /* FREEDRENO_RESOURCE_H_ */