blob: eca65d2455369945523166e34ab48096d230efbc [file] [log] [blame]
Jon Ashburnc6f4a412014-12-24 12:38:36 -07001/*
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002 * Vulkan
Jon Ashburnc6f4a412014-12-24 12:38:36 -07003 *
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 */
Chia-I Wu4f7730d2015-02-18 15:21:38 -070025
26#ifndef FB_H
27#define FB_H
28
29#include "intel.h"
30#include "obj.h"
Jon Ashburnc6f4a412014-12-24 12:38:36 -070031
Chia-I Wu9d748fd2015-02-18 14:46:55 -070032struct intel_fb {
Jon Ashburnc04b4dc2015-01-08 18:48:10 -070033 struct intel_obj obj;
Jon Ashburnc6f4a412014-12-24 12:38:36 -070034
Chia-I Wu3d4d4a62015-07-09 10:34:10 +080035 const struct intel_att_view **views;
36 uint32_t view_count;
Jon Ashburnc04b4dc2015-01-08 18:48:10 -070037
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -060038 uint32_t width;
39 uint32_t height;
Chia-I Wu4f7730d2015-02-18 15:21:38 -070040 uint32_t array_size;
Jon Ashburnc6f4a412014-12-24 12:38:36 -070041};
42
Chia-I Wubdeed152015-07-09 12:16:29 +080043struct intel_render_pass_attachment {
44 VkFormat format;
45 uint32_t sample_count;
46
47 VkImageLayout initial_layout;
48 VkImageLayout final_layout;
49
50 bool clear_on_load;
51 bool disable_store;
52
53 bool stencil_clear_on_load;
54 bool stencil_disable_store;
Chia-I Wubdeed152015-07-09 12:16:29 +080055};
56
57struct intel_render_pass_subpass {
58 uint32_t color_indices[INTEL_MAX_RENDER_TARGETS];
59 uint32_t resolve_indices[INTEL_MAX_RENDER_TARGETS];
60 VkImageLayout color_layouts[INTEL_MAX_RENDER_TARGETS];
61 uint32_t color_count;
62
63 uint32_t ds_index;
64 VkImageLayout ds_layout;
65 bool ds_optimal;
66};
67
Jon Ashburnc6f4a412014-12-24 12:38:36 -070068struct intel_render_pass {
Jon Ashburnc04b4dc2015-01-08 18:48:10 -070069 struct intel_obj obj;
Chris Forbesfff9bf42015-06-15 15:26:19 +120070
Chia-I Wubdeed152015-07-09 12:16:29 +080071 struct intel_render_pass_attachment *attachments;
72 uint32_t attachment_count;
Chris Forbes4cf9d102015-06-22 18:46:05 +120073
Chia-I Wubdeed152015-07-09 12:16:29 +080074 struct intel_render_pass_subpass *subpasses;
75 uint32_t subpass_count;
Jon Ashburnc6f4a412014-12-24 12:38:36 -070076};
77
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060078static inline struct intel_fb *intel_fb(VkFramebuffer fb)
Jon Ashburnc04b4dc2015-01-08 18:48:10 -070079{
Tony Barbourde4124d2015-07-03 10:33:54 -060080 return *(struct intel_fb **) &fb;
Jon Ashburnc04b4dc2015-01-08 18:48:10 -070081}
82
Chia-I Wu9d748fd2015-02-18 14:46:55 -070083static inline struct intel_fb *intel_fb_from_obj(struct intel_obj *obj)
Jon Ashburnc04b4dc2015-01-08 18:48:10 -070084{
Chia-I Wu9d748fd2015-02-18 14:46:55 -070085 return (struct intel_fb *) obj;
Jon Ashburnc04b4dc2015-01-08 18:48:10 -070086}
87
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060088static inline struct intel_render_pass *intel_render_pass(VkRenderPass rp)
Jon Ashburnc04b4dc2015-01-08 18:48:10 -070089{
Tony Barbourde4124d2015-07-03 10:33:54 -060090 return *(struct intel_render_pass **) &rp;
Jon Ashburnc04b4dc2015-01-08 18:48:10 -070091}
92
Chia-I Wu768a14b2015-02-18 14:48:21 -070093static inline struct intel_render_pass *intel_render_pass_from_obj(struct intel_obj *obj)
Jon Ashburnc04b4dc2015-01-08 18:48:10 -070094{
95 return (struct intel_render_pass *) obj;
96}
97
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060098VkResult intel_fb_create(struct intel_dev *dev,
99 const VkFramebufferCreateInfo *pInfo,
Chia-I Wu4f7730d2015-02-18 15:21:38 -0700100 struct intel_fb **fb_ret);
Chia-I Wu9d748fd2015-02-18 14:46:55 -0700101void intel_fb_destroy(struct intel_fb *fb);
Jon Ashburnc04b4dc2015-01-08 18:48:10 -0700102
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600103VkResult intel_render_pass_create(struct intel_dev *dev,
104 const VkRenderPassCreateInfo *pInfo,
Chia-I Wu4f7730d2015-02-18 15:21:38 -0700105 struct intel_render_pass **rp_ret);
Courtney Goeltzenleuchter5f5a6182015-01-23 14:27:58 -0700106void intel_render_pass_destroy(struct intel_render_pass *rp);
Chia-I Wu4f7730d2015-02-18 15:21:38 -0700107
108#endif /* FB_H */