2 * Mesa 3-D graphics library
4 * Copyright (C) 2015 LunarG, Inc.
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 shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
25 * Chia-I Wu <olv@lunarg.com>
28 #ifndef ILO_STATE_SURFACE_H
29 #define ILO_STATE_SURFACE_H
31 #include "genhw/genhw.h"
36 enum ilo_state_surface_access
{
37 ILO_STATE_SURFACE_ACCESS_SAMPLER
, /* sampling engine surfaces */
38 ILO_STATE_SURFACE_ACCESS_DP_RENDER
, /* render target surfaces */
39 ILO_STATE_SURFACE_ACCESS_DP_TYPED
, /* typed surfaces */
40 ILO_STATE_SURFACE_ACCESS_DP_UNTYPED
, /* untyped surfaces */
41 ILO_STATE_SURFACE_ACCESS_DP_DATA
,
42 ILO_STATE_SURFACE_ACCESS_DP_SVB
,
48 struct ilo_state_surface_buffer_info
{
49 const struct ilo_vma
*vma
;
53 enum ilo_state_surface_access access
;
55 /* format_size may be less than, equal to, or greater than struct_size */
56 enum gen_surface_format format
;
63 struct ilo_state_surface_image_info
{
64 const struct ilo_image
*img
;
70 const struct ilo_vma
*vma
;
71 const struct ilo_vma
*aux_vma
;
73 enum ilo_state_surface_access access
;
75 enum gen_surface_type type
;
77 enum gen_surface_format format
;
84 struct ilo_state_surface
{
87 const struct ilo_vma
*vma
;
88 const struct ilo_vma
*aux_vma
;
90 enum gen_surface_type type
;
100 ilo_state_surface_valid_format(const struct ilo_dev
*dev
,
101 enum ilo_state_surface_access access
,
102 enum gen_surface_format format
);
105 ilo_state_surface_buffer_size(const struct ilo_dev
*dev
,
106 enum ilo_state_surface_access access
,
107 uint32_t size
, uint32_t *alignment
);
110 ilo_state_surface_init_for_null(struct ilo_state_surface
*surf
,
111 const struct ilo_dev
*dev
);
114 ilo_state_surface_init_for_buffer(struct ilo_state_surface
*surf
,
115 const struct ilo_dev
*dev
,
116 const struct ilo_state_surface_buffer_info
*info
);
119 ilo_state_surface_init_for_image(struct ilo_state_surface
*surf
,
120 const struct ilo_dev
*dev
,
121 const struct ilo_state_surface_image_info
*info
);
124 ilo_state_surface_set_scs(struct ilo_state_surface
*surf
,
125 const struct ilo_dev
*dev
,
126 enum gen_surface_scs rgba
[4]);
128 #endif /* ILO_STATE_SURFACE_H */