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