blob: 729f90d63545366663496719697e3fdfd544d7e4 [file] [log] [blame]
Chia-I Wu5a323262014-08-11 10:31:53 +08001/*
2 * XGL
3 *
4 * Copyright (C) 2014 LunarG, Inc.
5 *
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:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
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.
23 */
24
25#ifndef VIEW_H
26#define VIEW_H
27
28#include "obj.h"
29#include "intel.h"
30
31struct intel_img;
32struct intel_mem;
33
34struct intel_null_view {
Chia-I Wuaabb3602014-08-19 14:18:23 +080035 /* this is not an intel_obj */
Chia-I Wu5a323262014-08-11 10:31:53 +080036
37 /* SURFACE_STATE */
38 uint32_t cmd[8];
39};
40
41struct intel_mem_view {
Chia-I Wuaabb3602014-08-19 14:18:23 +080042 /* this is not an intel_obj */
Chia-I Wu5a323262014-08-11 10:31:53 +080043
44 struct intel_mem *mem;
45
46 /* SURFACE_STATE */
47 uint32_t cmd[8];
48};
49
50struct intel_img_view {
51 struct intel_obj obj;
52
53 struct intel_img *img;
54
55 XGL_CHANNEL_MAPPING swizzles;
56 XGL_FLOAT min_lod;
57
58 /* SURFACE_STATE */
59 uint32_t cmd[8];
60};
61
62struct intel_rt_view {
63 struct intel_obj obj;
64
65 struct intel_img *img;
66
67 /* SURFACE_STATE */
68 uint32_t cmd[8];
69};
70
71struct intel_ds_view {
72 struct intel_obj obj;
73
74 struct intel_img *img;
75
76 /*
77 * 3DSTATE_DEPTH_BUFFER
78 * 3DSTATE_STENCIL_BUFFER
79 * 3DSTATE_HIER_DEPTH_BUFFER
80 */
81 uint32_t cmd[10];
82};
83
84static inline struct intel_img_view *intel_img_view(XGL_IMAGE_VIEW view)
85{
86 return (struct intel_img_view *) view;
87}
88
89static inline struct intel_img_view *intel_img_view_from_obj(struct intel_obj *obj)
90{
91 return (struct intel_img_view *) obj;
92}
93
94static inline struct intel_rt_view *intel_rt_view(XGL_COLOR_ATTACHMENT_VIEW view)
95{
96 return (struct intel_rt_view *) view;
97}
98
99static inline struct intel_rt_view *intel_rt_view_from_obj(struct intel_obj *obj)
100{
101 return (struct intel_rt_view *) obj;
102}
103
104static inline struct intel_ds_view *intel_ds_view(XGL_DEPTH_STENCIL_VIEW view)
105{
106 return (struct intel_ds_view *) view;
107}
108
109static inline struct intel_ds_view *intel_ds_view_from_obj(struct intel_obj *obj)
110{
111 return (struct intel_ds_view *) obj;
112}
113
114void intel_null_view_init(struct intel_null_view *view,
115 struct intel_dev *dev);
116
117void intel_mem_view_init(struct intel_mem_view *view,
118 struct intel_dev *dev,
119 const XGL_MEMORY_VIEW_ATTACH_INFO *info);
120
121XGL_RESULT intel_img_view_create(struct intel_dev *dev,
122 const XGL_IMAGE_VIEW_CREATE_INFO *info,
123 struct intel_img_view **view_ret);
124void intel_img_view_destroy(struct intel_img_view *view);
125
126XGL_RESULT intel_rt_view_create(struct intel_dev *dev,
127 const XGL_COLOR_ATTACHMENT_VIEW_CREATE_INFO *info,
128 struct intel_rt_view **view_ret);
129void intel_rt_view_destroy(struct intel_rt_view *view);
130
131XGL_RESULT intel_ds_view_create(struct intel_dev *dev,
132 const XGL_DEPTH_STENCIL_VIEW_CREATE_INFO *info,
133 struct intel_ds_view **view_ret);
134void intel_ds_view_destroy(struct intel_ds_view *view);
135
136XGL_RESULT XGLAPI intelCreateImageView(
137 XGL_DEVICE device,
138 const XGL_IMAGE_VIEW_CREATE_INFO* pCreateInfo,
139 XGL_IMAGE_VIEW* pView);
140
141XGL_RESULT XGLAPI intelCreateColorAttachmentView(
142 XGL_DEVICE device,
143 const XGL_COLOR_ATTACHMENT_VIEW_CREATE_INFO* pCreateInfo,
144 XGL_COLOR_ATTACHMENT_VIEW* pView);
145
146XGL_RESULT XGLAPI intelCreateDepthStencilView(
147 XGL_DEVICE device,
148 const XGL_DEPTH_STENCIL_VIEW_CREATE_INFO* pCreateInfo,
149 XGL_DEPTH_STENCIL_VIEW* pView);
150
151#endif /* VIEW_H */