Chia-I Wu | e46da3e | 2014-08-08 21:52:48 +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. |
| 23 | */ |
| 24 | |
| 25 | #ifndef IMG_H |
| 26 | #define IMG_H |
| 27 | |
Chia-I Wu | feb441f | 2014-08-08 21:27:38 +0800 | [diff] [blame] | 28 | #include "kmd/winsys.h" |
Chia-I Wu | e46da3e | 2014-08-08 21:52:48 +0800 | [diff] [blame] | 29 | #include "intel.h" |
| 30 | #include "obj.h" |
| 31 | |
| 32 | #define INTEL_IMG_MAX_LEVELS 16 |
| 33 | |
| 34 | /** |
| 35 | * A 3D image slice, cube face, or array layer. |
| 36 | */ |
| 37 | struct intel_img_slice { |
| 38 | /* 2D offset to the slice */ |
| 39 | unsigned x, y; |
| 40 | unsigned flags; |
| 41 | }; |
| 42 | |
| 43 | struct intel_img { |
| 44 | struct intel_obj obj; |
Chia-I Wu | feb441f | 2014-08-08 21:27:38 +0800 | [diff] [blame] | 45 | |
| 46 | XGL_FORMAT bo_format; |
| 47 | |
| 48 | enum intel_tiling_mode tiling; |
| 49 | unsigned long bo_stride; /* distance between two block rows in bytes */ |
| 50 | unsigned long bo_height; |
| 51 | |
| 52 | unsigned block_width; |
| 53 | unsigned block_height; |
| 54 | unsigned block_size; |
| 55 | |
| 56 | /* true if the mip level alignments are stricter */ |
| 57 | bool halign_8, valign_4; |
| 58 | /* true if space is reserved between layers */ |
| 59 | bool array_spacing_full; |
| 60 | /* true if samples are interleaved */ |
| 61 | bool interleaved; |
| 62 | |
| 63 | struct intel_img_slice *slices[INTEL_IMG_MAX_LEVELS]; |
Chia-I Wu | e46da3e | 2014-08-08 21:52:48 +0800 | [diff] [blame] | 64 | }; |
| 65 | |
Chia-I Wu | feb441f | 2014-08-08 21:27:38 +0800 | [diff] [blame] | 66 | static inline struct intel_img *intel_img(XGL_IMAGE image) |
| 67 | { |
| 68 | return (struct intel_img *) image; |
| 69 | } |
| 70 | |
| 71 | static inline struct intel_img *intel_img_from_base(struct intel_base *base) |
| 72 | { |
| 73 | return (struct intel_img *) base; |
| 74 | } |
| 75 | |
| 76 | static inline struct intel_img *intel_img_from_obj(struct intel_obj *obj) |
| 77 | { |
| 78 | return intel_img_from_base(&obj->base); |
| 79 | } |
| 80 | |
| 81 | XGL_RESULT intel_img_create(struct intel_dev *dev, |
| 82 | const XGL_IMAGE_CREATE_INFO *info, |
| 83 | struct intel_img **img_ret); |
| 84 | |
| 85 | void intel_img_destroy(struct intel_img *img); |
| 86 | |
| 87 | XGL_RESULT XGLAPI intelCreateImage( |
| 88 | XGL_DEVICE device, |
| 89 | const XGL_IMAGE_CREATE_INFO* pCreateInfo, |
| 90 | XGL_IMAGE* pImage); |
| 91 | |
| 92 | XGL_RESULT XGLAPI intelGetImageSubresourceInfo( |
| 93 | XGL_IMAGE image, |
| 94 | const XGL_IMAGE_SUBRESOURCE* pSubresource, |
| 95 | XGL_SUBRESOURCE_INFO_TYPE infoType, |
| 96 | XGL_SIZE* pDataSize, |
| 97 | XGL_VOID* pData); |
| 98 | |
Chia-I Wu | e46da3e | 2014-08-08 21:52:48 +0800 | [diff] [blame] | 99 | #endif /* IMG_H */ |