blob: b6705e803d774b195f8c82afae8e74a3ce835426 [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;
Chia-I Wu55dffd32014-11-25 11:18:44 +080047 bool read_only;
Chia-I Wu75577d92014-08-11 10:54:33 +080048
49 union {
50 const void *unused;
51 const struct intel_sampler *sampler;
52 const struct intel_img_view *img_view;
53
54 struct intel_mem_view mem_view;
55
56 struct {
57 const struct intel_dset *dset;
58 XGL_UINT slot_offset;
59 } nested;
60
61 } u;
62};
63
64struct intel_dset {
65 struct intel_obj obj;
66
67 struct intel_dev *dev;
68 struct intel_dset_slot *slots;
69};
70
71static inline struct intel_dset *intel_dset(XGL_DESCRIPTOR_SET dset)
72{
73 return (struct intel_dset *) dset;
74}
75
76static inline struct intel_dset *intel_dset_from_obj(struct intel_obj *obj)
77{
78 return (struct intel_dset *) obj;
79}
80
81XGL_RESULT intel_dset_create(struct intel_dev *dev,
82 const XGL_DESCRIPTOR_SET_CREATE_INFO *info,
83 struct intel_dset **dset_ret);
84void intel_dset_destroy(struct intel_dset *dset);
85
Chia-I Wu75577d92014-08-11 10:54:33 +080086#endif /* DSET_H */