Chia-I Wu | e46da3e | 2014-08-08 21:52:48 +0800 | [diff] [blame] | 1 | /* |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame^] | 2 | * Vulkan |
Chia-I Wu | e46da3e | 2014-08-08 21:52:48 +0800 | [diff] [blame] | 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 Wu | 44e4236 | 2014-09-02 08:32:09 +0800 | [diff] [blame] | 23 | * |
| 24 | * Authors: |
| 25 | * Chia-I Wu <olv@lunarg.com> |
Chia-I Wu | e46da3e | 2014-08-08 21:52:48 +0800 | [diff] [blame] | 26 | */ |
| 27 | |
| 28 | #ifndef IMG_H |
| 29 | #define IMG_H |
| 30 | |
Chia-I Wu | feb441f | 2014-08-08 21:27:38 +0800 | [diff] [blame] | 31 | #include "kmd/winsys.h" |
Chia-I Wu | e46da3e | 2014-08-08 21:52:48 +0800 | [diff] [blame] | 32 | #include "intel.h" |
Chia-I Wu | 2b685d7 | 2014-08-14 13:45:37 +0800 | [diff] [blame] | 33 | #include "layout.h" |
Chia-I Wu | e46da3e | 2014-08-08 21:52:48 +0800 | [diff] [blame] | 34 | #include "obj.h" |
| 35 | |
Chia-I Wu | e46da3e | 2014-08-08 21:52:48 +0800 | [diff] [blame] | 36 | struct intel_img { |
| 37 | struct intel_obj obj; |
Chia-I Wu | feb441f | 2014-08-08 21:27:38 +0800 | [diff] [blame] | 38 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame^] | 39 | VK_IMAGE_TYPE type; |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 40 | int32_t depth; |
| 41 | uint32_t mip_levels; |
| 42 | uint32_t array_size; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame^] | 43 | VK_FLAGS usage; |
| 44 | VK_IMAGE_FORMAT_CLASS format_class; // should this be integrated into intel_layout? |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 45 | uint32_t samples; |
Chia-I Wu | 2b685d7 | 2014-08-14 13:45:37 +0800 | [diff] [blame] | 46 | struct intel_layout layout; |
Chia-I Wu | 9b752e1 | 2014-08-15 16:21:44 +0800 | [diff] [blame] | 47 | |
| 48 | /* layout of separate stencil */ |
| 49 | struct intel_layout *s8_layout; |
| 50 | |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 51 | size_t total_size; |
| 52 | size_t aux_offset; |
| 53 | size_t s8_offset; |
Chia-I Wu | 1db76e0 | 2014-09-15 14:21:14 +0800 | [diff] [blame] | 54 | |
Chia-I Wu | 41858c8 | 2015-04-04 16:39:25 +0800 | [diff] [blame] | 55 | void *wsi_data; |
Chia-I Wu | e46da3e | 2014-08-08 21:52:48 +0800 | [diff] [blame] | 56 | }; |
| 57 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame^] | 58 | static inline struct intel_img *intel_img(VK_IMAGE image) |
Chia-I Wu | feb441f | 2014-08-08 21:27:38 +0800 | [diff] [blame] | 59 | { |
| 60 | return (struct intel_img *) image; |
| 61 | } |
| 62 | |
| 63 | static inline struct intel_img *intel_img_from_base(struct intel_base *base) |
| 64 | { |
| 65 | return (struct intel_img *) base; |
| 66 | } |
| 67 | |
| 68 | static inline struct intel_img *intel_img_from_obj(struct intel_obj *obj) |
| 69 | { |
| 70 | return intel_img_from_base(&obj->base); |
| 71 | } |
| 72 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame^] | 73 | VK_RESULT intel_img_create(struct intel_dev *dev, |
| 74 | const VK_IMAGE_CREATE_INFO *info, |
Chia-I Wu | 794d12a | 2014-09-15 14:55:25 +0800 | [diff] [blame] | 75 | bool scanout, |
Chia-I Wu | feb441f | 2014-08-08 21:27:38 +0800 | [diff] [blame] | 76 | struct intel_img **img_ret); |
| 77 | |
| 78 | void intel_img_destroy(struct intel_img *img); |
| 79 | |
Chia-I Wu | 3defd1f | 2015-02-18 12:21:22 -0700 | [diff] [blame] | 80 | static inline bool intel_img_can_enable_hiz(const struct intel_img *img, |
| 81 | uint32_t level) |
| 82 | { |
| 83 | return (img->layout.aux == INTEL_LAYOUT_AUX_HIZ && |
| 84 | img->layout.aux_enables & (1 << level)); |
| 85 | } |
| 86 | |
Chia-I Wu | e46da3e | 2014-08-08 21:52:48 +0800 | [diff] [blame] | 87 | #endif /* IMG_H */ |