Alexis Hetu | 911b85f | 2019-04-09 17:43:05 -0400 | [diff] [blame] | 1 | // Copyright 2018 The SwiftShader Authors. All Rights Reserved. |
Alexis Hetu | 9fbaf69 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | #include "VkImageView.hpp" |
| 16 | #include "VkImage.hpp" |
Chris Forbes | 2e5042a | 2019-08-23 09:03:48 -0700 | [diff] [blame] | 17 | #include <System/Math.hpp> |
Alexis Hetu | 9fbaf69 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 18 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 19 | namespace { |
| 20 | |
| 21 | VkComponentMapping ResolveComponentMapping(VkComponentMapping m, vk::Format format) |
Chris Forbes | 2527b4d | 2019-04-24 14:32:07 -0700 | [diff] [blame] | 22 | { |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 23 | m = vk::ResolveIdentityMapping(m); |
Chris Forbes | 10186cb | 2019-05-14 18:44:52 -0700 | [diff] [blame] | 24 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 25 | // Replace non-present components with zero/one swizzles so that the sampler |
| 26 | // will give us correct interactions between channel replacement and texel replacement, |
| 27 | // where we've had to invent new channels behind the app's back (eg transparent decompression |
| 28 | // of ETC2 RGB -> BGRA8) |
| 29 | VkComponentSwizzle table[] = { |
| 30 | VK_COMPONENT_SWIZZLE_IDENTITY, |
| 31 | VK_COMPONENT_SWIZZLE_ZERO, |
| 32 | VK_COMPONENT_SWIZZLE_ONE, |
| 33 | VK_COMPONENT_SWIZZLE_R, |
| 34 | format.componentCount() < 2 ? VK_COMPONENT_SWIZZLE_ZERO : VK_COMPONENT_SWIZZLE_G, |
| 35 | format.componentCount() < 3 ? VK_COMPONENT_SWIZZLE_ZERO : VK_COMPONENT_SWIZZLE_B, |
| 36 | format.componentCount() < 4 ? VK_COMPONENT_SWIZZLE_ONE : VK_COMPONENT_SWIZZLE_A, |
| 37 | }; |
Chris Forbes | 10186cb | 2019-05-14 18:44:52 -0700 | [diff] [blame] | 38 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame^] | 39 | return { table[m.r], table[m.g], table[m.b], table[m.a] }; |
Chris Forbes | 2527b4d | 2019-04-24 14:32:07 -0700 | [diff] [blame] | 40 | } |
| 41 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 42 | VkImageSubresourceRange ResolveRemainingLevelsLayers(VkImageSubresourceRange range, const vk::Image *image) |
Alexis Hetu | 9fbaf69 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 43 | { |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 44 | return { |
| 45 | range.aspectMask, |
| 46 | range.baseMipLevel, |
| 47 | (range.levelCount == VK_REMAINING_MIP_LEVELS) ? (image->getMipLevels() - range.baseMipLevel) : range.levelCount, |
| 48 | range.baseArrayLayer, |
| 49 | (range.layerCount == VK_REMAINING_ARRAY_LAYERS) ? (image->getArrayLayers() - range.baseArrayLayer) : range.layerCount, |
| 50 | }; |
| 51 | } |
| 52 | |
| 53 | } // anonymous namespace |
| 54 | |
| 55 | namespace vk { |
Alexis Hetu | 9fbaf69 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 56 | |
Ben Clayton | eac32c4 | 2019-04-26 11:25:57 +0100 | [diff] [blame] | 57 | std::atomic<uint32_t> ImageView::nextID(1); |
| 58 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame^] | 59 | ImageView::ImageView(const VkImageViewCreateInfo *pCreateInfo, void *mem, const vk::SamplerYcbcrConversion *ycbcrConversion) |
| 60 | : image(vk::Cast(pCreateInfo->image)) |
| 61 | , viewType(pCreateInfo->viewType) |
| 62 | , format(pCreateInfo->format) |
| 63 | , components(ResolveComponentMapping(pCreateInfo->components, format)) |
| 64 | , subresourceRange(ResolveRemainingLevelsLayers(pCreateInfo->subresourceRange, image)) |
| 65 | , ycbcrConversion(ycbcrConversion) |
Alexis Hetu | 9fbaf69 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 66 | { |
| 67 | } |
| 68 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame^] | 69 | size_t ImageView::ComputeRequiredAllocationSize(const VkImageViewCreateInfo *pCreateInfo) |
Alexis Hetu | 9fbaf69 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 70 | { |
| 71 | return 0; |
| 72 | } |
| 73 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame^] | 74 | void ImageView::destroy(const VkAllocationCallbacks *pAllocator) |
Alexis Hetu | 9fbaf69 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 75 | { |
| 76 | } |
| 77 | |
Alexis Hetu | ed30373 | 2019-01-16 15:47:19 -0500 | [diff] [blame] | 78 | bool ImageView::imageTypesMatch(VkImageType imageType) const |
| 79 | { |
Alexis Hetu | 911b85f | 2019-04-09 17:43:05 -0400 | [diff] [blame] | 80 | uint32_t imageArrayLayers = image->getArrayLayers(); |
Alexis Hetu | ed30373 | 2019-01-16 15:47:19 -0500 | [diff] [blame] | 81 | |
Alexis Hetu | 911b85f | 2019-04-09 17:43:05 -0400 | [diff] [blame] | 82 | switch(viewType) |
Alexis Hetu | ed30373 | 2019-01-16 15:47:19 -0500 | [diff] [blame] | 83 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame^] | 84 | case VK_IMAGE_VIEW_TYPE_1D: |
| 85 | return (imageType == VK_IMAGE_TYPE_1D) && |
| 86 | (subresourceRange.layerCount == 1); |
| 87 | case VK_IMAGE_VIEW_TYPE_1D_ARRAY: |
| 88 | return imageType == VK_IMAGE_TYPE_1D; |
| 89 | case VK_IMAGE_VIEW_TYPE_2D: |
| 90 | return ((imageType == VK_IMAGE_TYPE_2D) || |
| 91 | ((imageType == VK_IMAGE_TYPE_3D) && |
| 92 | (imageArrayLayers == 1))) && |
| 93 | (subresourceRange.layerCount == 1); |
| 94 | case VK_IMAGE_VIEW_TYPE_2D_ARRAY: |
| 95 | return (imageType == VK_IMAGE_TYPE_2D) || |
| 96 | ((imageType == VK_IMAGE_TYPE_3D) && |
| 97 | (imageArrayLayers == 1)); |
| 98 | case VK_IMAGE_VIEW_TYPE_CUBE: |
| 99 | return image->isCube() && |
| 100 | (imageArrayLayers >= subresourceRange.layerCount) && |
| 101 | (subresourceRange.layerCount == 6); |
| 102 | case VK_IMAGE_VIEW_TYPE_CUBE_ARRAY: |
| 103 | return image->isCube() && |
| 104 | (imageArrayLayers >= subresourceRange.layerCount) && |
| 105 | (subresourceRange.layerCount >= 6); |
| 106 | case VK_IMAGE_VIEW_TYPE_3D: |
| 107 | return (imageType == VK_IMAGE_TYPE_3D) && |
| 108 | (imageArrayLayers == 1) && |
| 109 | (subresourceRange.layerCount == 1); |
| 110 | default: |
| 111 | UNREACHABLE("Unexpected viewType %d", (int)viewType); |
Alexis Hetu | ed30373 | 2019-01-16 15:47:19 -0500 | [diff] [blame] | 112 | } |
| 113 | |
| 114 | return false; |
| 115 | } |
| 116 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame^] | 117 | void ImageView::clear(const VkClearValue &clearValue, const VkImageAspectFlags aspectMask, const VkRect2D &renderArea) |
Alexis Hetu | 9fbaf69 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 118 | { |
| 119 | // Note: clearing ignores swizzling, so components is ignored. |
| 120 | |
Alexis Hetu | ed30373 | 2019-01-16 15:47:19 -0500 | [diff] [blame] | 121 | if(!imageTypesMatch(image->getImageType())) |
Alexis Hetu | 9fbaf69 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 122 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 123 | UNIMPLEMENTED("imageTypesMatch"); |
Alexis Hetu | 9fbaf69 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 124 | } |
| 125 | |
Alexis Hetu | 04dae5e | 2019-04-08 13:41:50 -0400 | [diff] [blame] | 126 | if(!format.isCompatible(image->getFormat())) |
Alexis Hetu | 9fbaf69 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 127 | { |
Alexis Hetu | 04dae5e | 2019-04-08 13:41:50 -0400 | [diff] [blame] | 128 | UNIMPLEMENTED("incompatible formats"); |
Alexis Hetu | 9fbaf69 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 129 | } |
| 130 | |
Chris Forbes | 64cf139 | 2019-03-15 18:37:58 -0700 | [diff] [blame] | 131 | VkImageSubresourceRange sr = subresourceRange; |
| 132 | sr.aspectMask = aspectMask; |
Alexis Hetu | 04dae5e | 2019-04-08 13:41:50 -0400 | [diff] [blame] | 133 | image->clear(clearValue, format, renderArea, sr); |
Alexis Hetu | 9fbaf69 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 134 | } |
| 135 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame^] | 136 | void ImageView::clear(const VkClearValue &clearValue, const VkImageAspectFlags aspectMask, const VkClearRect &renderArea) |
Alexis Hetu | 1cd31ea | 2019-01-17 17:14:57 -0500 | [diff] [blame] | 137 | { |
| 138 | // Note: clearing ignores swizzling, so components is ignored. |
| 139 | |
| 140 | if(!imageTypesMatch(image->getImageType())) |
| 141 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 142 | UNIMPLEMENTED("imageTypesMatch"); |
Alexis Hetu | 1cd31ea | 2019-01-17 17:14:57 -0500 | [diff] [blame] | 143 | } |
| 144 | |
Alexis Hetu | 04dae5e | 2019-04-08 13:41:50 -0400 | [diff] [blame] | 145 | if(!format.isCompatible(image->getFormat())) |
Alexis Hetu | 1cd31ea | 2019-01-17 17:14:57 -0500 | [diff] [blame] | 146 | { |
Alexis Hetu | 04dae5e | 2019-04-08 13:41:50 -0400 | [diff] [blame] | 147 | UNIMPLEMENTED("incompatible formats"); |
Chris Forbes | 5822882 | 2019-04-17 12:51:29 -0700 | [diff] [blame] | 148 | } |
Alexis Hetu | 1cd31ea | 2019-01-17 17:14:57 -0500 | [diff] [blame] | 149 | |
| 150 | VkImageSubresourceRange sr; |
| 151 | sr.aspectMask = aspectMask; |
| 152 | sr.baseMipLevel = subresourceRange.baseMipLevel; |
| 153 | sr.levelCount = subresourceRange.levelCount; |
| 154 | sr.baseArrayLayer = renderArea.baseArrayLayer + subresourceRange.baseArrayLayer; |
| 155 | sr.layerCount = renderArea.layerCount; |
| 156 | |
Alexis Hetu | 04dae5e | 2019-04-08 13:41:50 -0400 | [diff] [blame] | 157 | image->clear(clearValue, format, renderArea.rect, sr); |
Alexis Hetu | 1cd31ea | 2019-01-17 17:14:57 -0500 | [diff] [blame] | 158 | } |
| 159 | |
Chris Forbes | 2e5042a | 2019-08-23 09:03:48 -0700 | [diff] [blame] | 160 | void ImageView::clearWithLayerMask(const VkClearValue &clearValue, VkImageAspectFlags aspectMask, const VkRect2D &renderArea, uint32_t layerMask) |
| 161 | { |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 162 | while(layerMask) |
Chris Forbes | 2e5042a | 2019-08-23 09:03:48 -0700 | [diff] [blame] | 163 | { |
| 164 | uint32_t layer = sw::log2i(layerMask); |
| 165 | layerMask &= ~(1 << layer); |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame^] | 166 | VkClearRect r = { renderArea, layer, 1 }; |
Chris Forbes | 2e5042a | 2019-08-23 09:03:48 -0700 | [diff] [blame] | 167 | r.baseArrayLayer = layer; |
| 168 | clear(clearValue, aspectMask, r); |
| 169 | } |
| 170 | } |
| 171 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame^] | 172 | void ImageView::resolve(ImageView *resolveAttachment, int layer) |
Chris Forbes | 02d4c0d | 2019-08-21 12:04:34 -0700 | [diff] [blame] | 173 | { |
| 174 | if((subresourceRange.levelCount != 1) || (resolveAttachment->subresourceRange.levelCount != 1)) |
| 175 | { |
| 176 | UNIMPLEMENTED("levelCount"); |
| 177 | } |
| 178 | |
| 179 | VkImageCopy region; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame^] | 180 | region.srcSubresource = { |
Chris Forbes | 02d4c0d | 2019-08-21 12:04:34 -0700 | [diff] [blame] | 181 | subresourceRange.aspectMask, |
| 182 | subresourceRange.baseMipLevel, |
| 183 | subresourceRange.baseArrayLayer + layer, |
| 184 | 1 |
| 185 | }; |
| 186 | region.srcOffset = { 0, 0, 0 }; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame^] | 187 | region.dstSubresource = { |
Chris Forbes | 02d4c0d | 2019-08-21 12:04:34 -0700 | [diff] [blame] | 188 | resolveAttachment->subresourceRange.aspectMask, |
| 189 | resolveAttachment->subresourceRange.baseMipLevel, |
| 190 | resolveAttachment->subresourceRange.baseArrayLayer + layer, |
| 191 | 1 |
| 192 | }; |
| 193 | region.dstOffset = { 0, 0, 0 }; |
| 194 | region.extent = image->getMipLevelExtent(static_cast<VkImageAspectFlagBits>(subresourceRange.aspectMask), |
| 195 | subresourceRange.baseMipLevel); |
| 196 | |
| 197 | image->copyTo(resolveAttachment->image, region); |
| 198 | } |
| 199 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame^] | 200 | void ImageView::resolve(ImageView *resolveAttachment) |
Alexis Hetu | 54ec759 | 2019-03-20 14:37:16 -0400 | [diff] [blame] | 201 | { |
| 202 | if((subresourceRange.levelCount != 1) || (resolveAttachment->subresourceRange.levelCount != 1)) |
| 203 | { |
| 204 | UNIMPLEMENTED("levelCount"); |
| 205 | } |
| 206 | |
| 207 | VkImageCopy region; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame^] | 208 | region.srcSubresource = { |
Alexis Hetu | 54ec759 | 2019-03-20 14:37:16 -0400 | [diff] [blame] | 209 | subresourceRange.aspectMask, |
| 210 | subresourceRange.baseMipLevel, |
| 211 | subresourceRange.baseArrayLayer, |
| 212 | subresourceRange.layerCount |
| 213 | }; |
| 214 | region.srcOffset = { 0, 0, 0 }; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame^] | 215 | region.dstSubresource = { |
Alexis Hetu | 54ec759 | 2019-03-20 14:37:16 -0400 | [diff] [blame] | 216 | resolveAttachment->subresourceRange.aspectMask, |
| 217 | resolveAttachment->subresourceRange.baseMipLevel, |
| 218 | resolveAttachment->subresourceRange.baseArrayLayer, |
| 219 | resolveAttachment->subresourceRange.layerCount |
| 220 | }; |
| 221 | region.dstOffset = { 0, 0, 0 }; |
Nicolas Capens | ba87330 | 2019-05-16 11:25:27 -0400 | [diff] [blame] | 222 | region.extent = image->getMipLevelExtent(static_cast<VkImageAspectFlagBits>(subresourceRange.aspectMask), |
| 223 | subresourceRange.baseMipLevel); |
Alexis Hetu | 54ec759 | 2019-03-20 14:37:16 -0400 | [diff] [blame] | 224 | |
Alexis Hetu | 63ae924 | 2019-06-06 13:52:15 -0400 | [diff] [blame] | 225 | image->copyTo(resolveAttachment->image, region); |
Alexis Hetu | 54ec759 | 2019-03-20 14:37:16 -0400 | [diff] [blame] | 226 | } |
| 227 | |
Chris Forbes | 2e5042a | 2019-08-23 09:03:48 -0700 | [diff] [blame] | 228 | void ImageView::resolveWithLayerMask(ImageView *resolveAttachment, uint32_t layerMask) |
| 229 | { |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 230 | while(layerMask) |
Chris Forbes | 2e5042a | 2019-08-23 09:03:48 -0700 | [diff] [blame] | 231 | { |
| 232 | int layer = sw::log2i(layerMask); |
| 233 | layerMask &= ~(1 << layer); |
| 234 | resolve(resolveAttachment, layer); |
| 235 | } |
| 236 | } |
| 237 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame^] | 238 | const Image *ImageView::getImage(Usage usage) const |
Alexis Hetu | ac87334 | 2019-04-17 15:59:03 -0400 | [diff] [blame] | 239 | { |
| 240 | switch(usage) |
| 241 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame^] | 242 | case RAW: |
| 243 | return image; |
| 244 | case SAMPLING: |
| 245 | return image->getSampledImage(format); |
| 246 | default: |
| 247 | UNIMPLEMENTED("usage %d", int(usage)); |
| 248 | return nullptr; |
Alexis Hetu | ac87334 | 2019-04-17 15:59:03 -0400 | [diff] [blame] | 249 | } |
| 250 | } |
| 251 | |
| 252 | Format ImageView::getFormat(Usage usage) const |
| 253 | { |
Alexis Hetu | 9c18a97 | 2019-09-17 15:41:21 -0400 | [diff] [blame] | 254 | Format imageFormat = ((usage == RAW) || (getImage(usage) == image)) ? format : getImage(usage)->getFormat(); |
| 255 | return imageFormat.getAspectFormat(subresourceRange.aspectMask); |
Alexis Hetu | ac87334 | 2019-04-17 15:59:03 -0400 | [diff] [blame] | 256 | } |
| 257 | |
| 258 | int ImageView::rowPitchBytes(VkImageAspectFlagBits aspect, uint32_t mipLevel, Usage usage) const |
| 259 | { |
| 260 | return getImage(usage)->rowPitchBytes(aspect, subresourceRange.baseMipLevel + mipLevel); |
| 261 | } |
| 262 | |
| 263 | int ImageView::slicePitchBytes(VkImageAspectFlagBits aspect, uint32_t mipLevel, Usage usage) const |
| 264 | { |
| 265 | return getImage(usage)->slicePitchBytes(aspect, subresourceRange.baseMipLevel + mipLevel); |
| 266 | } |
| 267 | |
Alexis Hetu | 8a6dcf7 | 2019-11-26 17:24:42 -0500 | [diff] [blame] | 268 | int ImageView::getMipLevelSize(VkImageAspectFlagBits aspect, uint32_t mipLevel, Usage usage) const |
| 269 | { |
| 270 | return getImage(usage)->getMipLevelSize(aspect, subresourceRange.baseMipLevel + mipLevel); |
| 271 | } |
| 272 | |
Alexis Hetu | ac87334 | 2019-04-17 15:59:03 -0400 | [diff] [blame] | 273 | int ImageView::layerPitchBytes(VkImageAspectFlagBits aspect, Usage usage) const |
| 274 | { |
| 275 | return static_cast<int>(getImage(usage)->getLayerSize(aspect)); |
| 276 | } |
| 277 | |
| 278 | VkExtent3D ImageView::getMipLevelExtent(uint32_t mipLevel) const |
| 279 | { |
Nicolas Capens | ba87330 | 2019-05-16 11:25:27 -0400 | [diff] [blame] | 280 | return image->getMipLevelExtent(static_cast<VkImageAspectFlagBits>(subresourceRange.aspectMask), |
| 281 | subresourceRange.baseMipLevel + mipLevel); |
Alexis Hetu | ac87334 | 2019-04-17 15:59:03 -0400 | [diff] [blame] | 282 | } |
| 283 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame^] | 284 | void *ImageView::getOffsetPointer(const VkOffset3D &offset, VkImageAspectFlagBits aspect, uint32_t mipLevel, uint32_t layer, Usage usage) const |
Alexis Hetu | 6159a85 | 2019-02-26 14:42:36 -0500 | [diff] [blame] | 285 | { |
Nicolas Capens | 9e73510 | 2019-04-18 15:03:06 -0400 | [diff] [blame] | 286 | ASSERT(mipLevel < subresourceRange.levelCount); |
| 287 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame^] | 288 | VkImageSubresourceLayers imageSubresourceLayers = { |
Alexis Hetu | f955e63 | 2019-03-08 15:15:20 -0500 | [diff] [blame] | 289 | static_cast<VkImageAspectFlags>(aspect), |
Nicolas Capens | 9e73510 | 2019-04-18 15:03:06 -0400 | [diff] [blame] | 290 | subresourceRange.baseMipLevel + mipLevel, |
Nicolas Capens | a195abb | 2019-04-25 17:15:56 -0400 | [diff] [blame] | 291 | subresourceRange.baseArrayLayer + layer, |
Alexis Hetu | 6159a85 | 2019-02-26 14:42:36 -0500 | [diff] [blame] | 292 | subresourceRange.layerCount |
| 293 | }; |
Nicolas Capens | ba87330 | 2019-05-16 11:25:27 -0400 | [diff] [blame] | 294 | |
Alexis Hetu | ac87334 | 2019-04-17 15:59:03 -0400 | [diff] [blame] | 295 | return getImage(usage)->getTexelPointer(offset, imageSubresourceLayers); |
Chris Forbes | 7c33e88 | 2019-02-21 14:58:28 -0800 | [diff] [blame] | 296 | } |
| 297 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 298 | } // namespace vk |