Chia-I Wu | 5a32326 | 2014-08-11 10:31:53 +0800 | [diff] [blame] | 1 | /* |
| 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 Wu | 44e4236 | 2014-09-02 08:32:09 +0800 | [diff] [blame^] | 23 | * |
| 24 | * Authors: |
| 25 | * Chia-I Wu <olv@lunarg.com> |
Chia-I Wu | 5a32326 | 2014-08-11 10:31:53 +0800 | [diff] [blame] | 26 | */ |
| 27 | |
| 28 | #ifndef VIEW_H |
| 29 | #define VIEW_H |
| 30 | |
| 31 | #include "obj.h" |
| 32 | #include "intel.h" |
| 33 | |
| 34 | struct intel_img; |
| 35 | struct intel_mem; |
| 36 | |
| 37 | struct intel_null_view { |
Chia-I Wu | aabb360 | 2014-08-19 14:18:23 +0800 | [diff] [blame] | 38 | /* this is not an intel_obj */ |
Chia-I Wu | 5a32326 | 2014-08-11 10:31:53 +0800 | [diff] [blame] | 39 | |
| 40 | /* SURFACE_STATE */ |
| 41 | uint32_t cmd[8]; |
Chia-I Wu | cd83cf1 | 2014-08-23 17:26:08 +0800 | [diff] [blame] | 42 | XGL_UINT cmd_len; |
Chia-I Wu | 5a32326 | 2014-08-11 10:31:53 +0800 | [diff] [blame] | 43 | }; |
| 44 | |
| 45 | struct intel_mem_view { |
Chia-I Wu | aabb360 | 2014-08-19 14:18:23 +0800 | [diff] [blame] | 46 | /* this is not an intel_obj */ |
Chia-I Wu | 5a32326 | 2014-08-11 10:31:53 +0800 | [diff] [blame] | 47 | |
| 48 | struct intel_mem *mem; |
| 49 | |
| 50 | /* SURFACE_STATE */ |
| 51 | uint32_t cmd[8]; |
Chia-I Wu | cd83cf1 | 2014-08-23 17:26:08 +0800 | [diff] [blame] | 52 | XGL_UINT cmd_len; |
Chia-I Wu | 5a32326 | 2014-08-11 10:31:53 +0800 | [diff] [blame] | 53 | }; |
| 54 | |
| 55 | struct intel_img_view { |
| 56 | struct intel_obj obj; |
| 57 | |
| 58 | struct intel_img *img; |
| 59 | |
| 60 | XGL_CHANNEL_MAPPING swizzles; |
| 61 | XGL_FLOAT min_lod; |
| 62 | |
| 63 | /* SURFACE_STATE */ |
| 64 | uint32_t cmd[8]; |
Chia-I Wu | cd83cf1 | 2014-08-23 17:26:08 +0800 | [diff] [blame] | 65 | XGL_UINT cmd_len; |
Chia-I Wu | 5a32326 | 2014-08-11 10:31:53 +0800 | [diff] [blame] | 66 | }; |
| 67 | |
| 68 | struct intel_rt_view { |
| 69 | struct intel_obj obj; |
| 70 | |
| 71 | struct intel_img *img; |
| 72 | |
| 73 | /* SURFACE_STATE */ |
| 74 | uint32_t cmd[8]; |
Chia-I Wu | cd83cf1 | 2014-08-23 17:26:08 +0800 | [diff] [blame] | 75 | XGL_UINT cmd_len; |
Chia-I Wu | 5a32326 | 2014-08-11 10:31:53 +0800 | [diff] [blame] | 76 | }; |
| 77 | |
| 78 | struct intel_ds_view { |
| 79 | struct intel_obj obj; |
| 80 | |
| 81 | struct intel_img *img; |
| 82 | |
| 83 | /* |
| 84 | * 3DSTATE_DEPTH_BUFFER |
| 85 | * 3DSTATE_STENCIL_BUFFER |
| 86 | * 3DSTATE_HIER_DEPTH_BUFFER |
| 87 | */ |
| 88 | uint32_t cmd[10]; |
| 89 | }; |
| 90 | |
| 91 | static inline struct intel_img_view *intel_img_view(XGL_IMAGE_VIEW view) |
| 92 | { |
| 93 | return (struct intel_img_view *) view; |
| 94 | } |
| 95 | |
| 96 | static inline struct intel_img_view *intel_img_view_from_obj(struct intel_obj *obj) |
| 97 | { |
| 98 | return (struct intel_img_view *) obj; |
| 99 | } |
| 100 | |
| 101 | static inline struct intel_rt_view *intel_rt_view(XGL_COLOR_ATTACHMENT_VIEW view) |
| 102 | { |
| 103 | return (struct intel_rt_view *) view; |
| 104 | } |
| 105 | |
| 106 | static inline struct intel_rt_view *intel_rt_view_from_obj(struct intel_obj *obj) |
| 107 | { |
| 108 | return (struct intel_rt_view *) obj; |
| 109 | } |
| 110 | |
| 111 | static inline struct intel_ds_view *intel_ds_view(XGL_DEPTH_STENCIL_VIEW view) |
| 112 | { |
| 113 | return (struct intel_ds_view *) view; |
| 114 | } |
| 115 | |
| 116 | static inline struct intel_ds_view *intel_ds_view_from_obj(struct intel_obj *obj) |
| 117 | { |
| 118 | return (struct intel_ds_view *) obj; |
| 119 | } |
| 120 | |
| 121 | void intel_null_view_init(struct intel_null_view *view, |
| 122 | struct intel_dev *dev); |
| 123 | |
| 124 | void intel_mem_view_init(struct intel_mem_view *view, |
| 125 | struct intel_dev *dev, |
| 126 | const XGL_MEMORY_VIEW_ATTACH_INFO *info); |
| 127 | |
| 128 | XGL_RESULT intel_img_view_create(struct intel_dev *dev, |
| 129 | const XGL_IMAGE_VIEW_CREATE_INFO *info, |
| 130 | struct intel_img_view **view_ret); |
| 131 | void intel_img_view_destroy(struct intel_img_view *view); |
| 132 | |
| 133 | XGL_RESULT intel_rt_view_create(struct intel_dev *dev, |
| 134 | const XGL_COLOR_ATTACHMENT_VIEW_CREATE_INFO *info, |
| 135 | struct intel_rt_view **view_ret); |
| 136 | void intel_rt_view_destroy(struct intel_rt_view *view); |
| 137 | |
| 138 | XGL_RESULT intel_ds_view_create(struct intel_dev *dev, |
| 139 | const XGL_DEPTH_STENCIL_VIEW_CREATE_INFO *info, |
| 140 | struct intel_ds_view **view_ret); |
| 141 | void intel_ds_view_destroy(struct intel_ds_view *view); |
| 142 | |
| 143 | XGL_RESULT XGLAPI intelCreateImageView( |
| 144 | XGL_DEVICE device, |
| 145 | const XGL_IMAGE_VIEW_CREATE_INFO* pCreateInfo, |
| 146 | XGL_IMAGE_VIEW* pView); |
| 147 | |
| 148 | XGL_RESULT XGLAPI intelCreateColorAttachmentView( |
| 149 | XGL_DEVICE device, |
| 150 | const XGL_COLOR_ATTACHMENT_VIEW_CREATE_INFO* pCreateInfo, |
| 151 | XGL_COLOR_ATTACHMENT_VIEW* pView); |
| 152 | |
| 153 | XGL_RESULT XGLAPI intelCreateDepthStencilView( |
| 154 | XGL_DEVICE device, |
| 155 | const XGL_DEPTH_STENCIL_VIEW_CREATE_INFO* pCreateInfo, |
| 156 | XGL_DEPTH_STENCIL_VIEW* pView); |
| 157 | |
| 158 | #endif /* VIEW_H */ |