Tobin Ehlis | ad8c446 | 2015-09-21 15:20:28 -0600 | [diff] [blame] | 1 | /* |
Tobin Ehlis | ad8c446 | 2015-09-21 15:20:28 -0600 | [diff] [blame] | 2 | * |
Courtney Goeltzenleuchter | fcbe16f | 2015-10-29 13:50:34 -0600 | [diff] [blame] | 3 | * Copyright (C) 2015 Valve Corporation |
Tobin Ehlis | ad8c446 | 2015-09-21 15:20:28 -0600 | [diff] [blame] | 4 | * |
| 5 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 6 | * copy of this software and associated documentation files (the "Software"), |
| 7 | * to deal in the Software without restriction, including without limitation |
| 8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 9 | * and/or sell copies of the Software, and to permit persons to whom the |
| 10 | * Software is furnished to do so, subject to the following conditions: |
| 11 | * |
| 12 | * The above copyright notice and this permission notice shall be included |
| 13 | * in all copies or substantial portions of the Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 21 | * DEALINGS IN THE SOFTWARE. |
Courtney Goeltzenleuchter | 0555952 | 2015-10-30 11:14:30 -0600 | [diff] [blame] | 22 | * |
| 23 | * Author: Mark Lobodzinski <mark@lunarg.com> |
| 24 | * Author: Mike Stroyan <mike@LunarG.com> |
| 25 | * Author: Tobin Ehlis <tobin@lunarg.com> |
Tobin Ehlis | ad8c446 | 2015-09-21 15:20:28 -0600 | [diff] [blame] | 26 | */ |
| 27 | #ifndef IMAGE_H |
| 28 | #define IMAGE_H |
David Pinedo | 9316d3b | 2015-11-06 12:54:48 -0700 | [diff] [blame] | 29 | #include "vulkan/vulkan.h" |
Tobin Ehlis | ad8c446 | 2015-09-21 15:20:28 -0600 | [diff] [blame] | 30 | #include "vk_layer_config.h" |
| 31 | #include "vk_layer_logging.h" |
| 32 | |
Mike Stroyan | a308243 | 2015-09-25 13:39:21 -0600 | [diff] [blame] | 33 | // Image ERROR codes |
Tobin Ehlis | ad8c446 | 2015-09-21 15:20:28 -0600 | [diff] [blame] | 34 | typedef enum _IMAGE_ERROR |
| 35 | { |
| 36 | IMAGE_NONE, // Used for INFO & other non-error messages |
| 37 | IMAGE_FORMAT_UNSUPPORTED, // Request to create Image or RenderPass with a format that is not supported |
| 38 | IMAGE_RENDERPASS_INVALID_ATTACHMENT, // Invalid image layouts and/or load/storeOps for an attachment when creating RenderPass |
| 39 | IMAGE_RENDERPASS_INVALID_DS_ATTACHMENT, // If no depth attachment for a RenderPass, verify that subpass DS attachment is set to UNUSED |
Mark Lobodzinski | a5eabe7 | 2015-10-05 17:16:05 -0600 | [diff] [blame] | 40 | IMAGE_INVALID_IMAGE_ASPECT, // Image aspect mask bits are invalid for this API call |
| 41 | IMAGE_MISMATCHED_IMAGE_ASPECT, // Image aspect masks for source and dest images do not match |
Tobin Ehlis | ad8c446 | 2015-09-21 15:20:28 -0600 | [diff] [blame] | 42 | IMAGE_VIEW_CREATE_ERROR, // Error occurred trying to create Image View |
Mike Stroyan | a308243 | 2015-09-25 13:39:21 -0600 | [diff] [blame] | 43 | IMAGE_MISMATCHED_IMAGE_TYPE, // Image types for source and dest images do not match |
| 44 | IMAGE_MISMATCHED_IMAGE_FORMAT, // Image formats for source and dest images do not match |
| 45 | IMAGE_INVALID_RESOLVE_SAMPLES, // Image resolve source samples less than two or dest samples greater than one |
Mark Lobodzinski | dc86b85 | 2015-10-23 14:20:31 -0600 | [diff] [blame] | 46 | IMAGE_INVALID_FORMAT, // Operation specifies an invalid format, or there is a format mismatch |
| 47 | IMAGE_INVALID_FILTER, // Operation specifies an invalid filter setting |
Mark Lobodzinski | 37a38b1 | 2016-01-04 13:32:45 -0700 | [diff] [blame] | 48 | IMAGE_INVALID_IMAGE_RESOURCE, // Image resource/subresource called with invalid setting |
Mark Lobodzinski | d5a2382 | 2015-11-12 15:14:35 -0700 | [diff] [blame] | 49 | IMAGE_INVALID_FORMAT_LIMITS_VIOLATION, // Device limits for this format have been exceeded |
Tobin Ehlis | ad8c446 | 2015-09-21 15:20:28 -0600 | [diff] [blame] | 50 | } IMAGE_ERROR; |
| 51 | |
Tobin Ehlis | cde0889 | 2015-09-22 10:11:37 -0600 | [diff] [blame] | 52 | typedef struct _IMAGE_STATE |
| 53 | { |
Mark Lobodzinski | dc86b85 | 2015-10-23 14:20:31 -0600 | [diff] [blame] | 54 | uint32_t mipLevels; |
| 55 | uint32_t arraySize; |
| 56 | VkFormat format; |
Chia-I Wu | 5c17c96 | 2015-10-31 00:31:16 +0800 | [diff] [blame] | 57 | VkSampleCountFlagBits samples; |
Mike Stroyan | a308243 | 2015-09-25 13:39:21 -0600 | [diff] [blame] | 58 | VkImageType imageType; |
Mark Lobodzinski | dc86b85 | 2015-10-23 14:20:31 -0600 | [diff] [blame] | 59 | VkExtent3D extent; |
Chia-I Wu | 5c17c96 | 2015-10-31 00:31:16 +0800 | [diff] [blame] | 60 | _IMAGE_STATE():mipLevels(0), arraySize(0), format(VK_FORMAT_UNDEFINED), samples(VK_SAMPLE_COUNT_1_BIT), imageType(VK_IMAGE_TYPE_RANGE_SIZE), extent{} {}; |
Mike Stroyan | a308243 | 2015-09-25 13:39:21 -0600 | [diff] [blame] | 61 | _IMAGE_STATE(const VkImageCreateInfo* pCreateInfo): |
| 62 | mipLevels(pCreateInfo->mipLevels), |
Courtney Goeltzenleuchter | 5d2aed4 | 2015-10-21 17:57:31 -0600 | [diff] [blame] | 63 | arraySize(pCreateInfo->arrayLayers), |
Mike Stroyan | a308243 | 2015-09-25 13:39:21 -0600 | [diff] [blame] | 64 | format(pCreateInfo->format), |
| 65 | samples(pCreateInfo->samples), |
Mark Lobodzinski | dc86b85 | 2015-10-23 14:20:31 -0600 | [diff] [blame] | 66 | imageType(pCreateInfo->imageType), |
| 67 | extent(pCreateInfo->extent) |
Mike Stroyan | a308243 | 2015-09-25 13:39:21 -0600 | [diff] [blame] | 68 | {}; |
Tobin Ehlis | cde0889 | 2015-09-22 10:11:37 -0600 | [diff] [blame] | 69 | } IMAGE_STATE; |
| 70 | |
Tobin Ehlis | ad8c446 | 2015-09-21 15:20:28 -0600 | [diff] [blame] | 71 | #endif // IMAGE_H |