blob: 8e2fce88ce8240a1d04d30054af315027b28a043 [file] [log] [blame]
Chia-I Wu75577d92014-08-11 10:54:33 +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 DSET_H
26#define DSET_H
27
28#include "intel.h"
29#include "obj.h"
30#include "view.h"
31
32enum intel_dset_slot_type {
33 INTEL_DSET_SLOT_UNUSED,
34 INTEL_DSET_SLOT_SAMPLER,
35 INTEL_DSET_SLOT_IMG_VIEW,
36 INTEL_DSET_SLOT_MEM_VIEW,
37 INTEL_DSET_SLOT_NESTED,
38};
39
40struct intel_dset;
41
42struct intel_dset_slot {
43 enum intel_dset_slot_type type;
44
45 union {
46 const void *unused;
47 const struct intel_sampler *sampler;
48 const struct intel_img_view *img_view;
49
50 struct intel_mem_view mem_view;
51
52 struct {
53 const struct intel_dset *dset;
54 XGL_UINT slot_offset;
55 } nested;
56
57 } u;
58};
59
60struct intel_dset {
61 struct intel_obj obj;
62
63 struct intel_dev *dev;
64 struct intel_dset_slot *slots;
65};
66
67static inline struct intel_dset *intel_dset(XGL_DESCRIPTOR_SET dset)
68{
69 return (struct intel_dset *) dset;
70}
71
72static inline struct intel_dset *intel_dset_from_obj(struct intel_obj *obj)
73{
74 return (struct intel_dset *) obj;
75}
76
77XGL_RESULT intel_dset_create(struct intel_dev *dev,
78 const XGL_DESCRIPTOR_SET_CREATE_INFO *info,
79 struct intel_dset **dset_ret);
80void intel_dset_destroy(struct intel_dset *dset);
81
82XGL_RESULT XGLAPI intelCreateDescriptorSet(
83 XGL_DEVICE device,
84 const XGL_DESCRIPTOR_SET_CREATE_INFO* pCreateInfo,
85 XGL_DESCRIPTOR_SET* pDescriptorSet);
86
87XGL_VOID XGLAPI intelBeginDescriptorSetUpdate(
88 XGL_DESCRIPTOR_SET descriptorSet);
89
90XGL_VOID XGLAPI intelEndDescriptorSetUpdate(
91 XGL_DESCRIPTOR_SET descriptorSet);
92
93XGL_VOID XGLAPI intelAttachSamplerDescriptors(
94 XGL_DESCRIPTOR_SET descriptorSet,
95 XGL_UINT startSlot,
96 XGL_UINT slotCount,
97 const XGL_SAMPLER* pSamplers);
98
99XGL_VOID XGLAPI intelAttachImageViewDescriptors(
100 XGL_DESCRIPTOR_SET descriptorSet,
101 XGL_UINT startSlot,
102 XGL_UINT slotCount,
103 const XGL_IMAGE_VIEW_ATTACH_INFO* pImageViews);
104
105XGL_VOID XGLAPI intelAttachMemoryViewDescriptors(
106 XGL_DESCRIPTOR_SET descriptorSet,
107 XGL_UINT startSlot,
108 XGL_UINT slotCount,
109 const XGL_MEMORY_VIEW_ATTACH_INFO* pMemViews);
110
111XGL_VOID XGLAPI intelAttachNestedDescriptors(
112 XGL_DESCRIPTOR_SET descriptorSet,
113 XGL_UINT startSlot,
114 XGL_UINT slotCount,
115 const XGL_DESCRIPTOR_SET_ATTACH_INFO* pNestedDescriptorSets);
116
117XGL_VOID XGLAPI intelClearDescriptorSetSlots(
118 XGL_DESCRIPTOR_SET descriptorSet,
119 XGL_UINT startSlot,
120 XGL_UINT slotCount);
121
122#endif /* DSET_H */