blob: 21e06ff33434ac9df33562f87272f272278498d0 [file] [log] [blame]
Tobin Ehlisad8c4462015-09-21 15:20:28 -06001/*
Tobin Ehlisad8c4462015-09-21 15:20:28 -06002 *
Courtney Goeltzenleuchterfcbe16f2015-10-29 13:50:34 -06003 * Copyright (C) 2015 Valve Corporation
Tobin Ehlisad8c4462015-09-21 15:20:28 -06004 *
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 Goeltzenleuchter05559522015-10-30 11:14:30 -060022 *
23 * Author: Mark Lobodzinski <mark@lunarg.com>
24 * Author: Mike Stroyan <mike@LunarG.com>
25 * Author: Tobin Ehlis <tobin@lunarg.com>
Tobin Ehlisad8c4462015-09-21 15:20:28 -060026 */
27#ifndef IMAGE_H
28#define IMAGE_H
David Pinedo9316d3b2015-11-06 12:54:48 -070029#include "vulkan/vulkan.h"
Tobin Ehlisad8c4462015-09-21 15:20:28 -060030#include "vk_layer_config.h"
31#include "vk_layer_logging.h"
32
Mike Stroyana3082432015-09-25 13:39:21 -060033// Image ERROR codes
Tobin Ehlisad8c4462015-09-21 15:20:28 -060034typedef 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 Lobodzinskia5eabe72015-10-05 17:16:05 -060040 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 Ehlisad8c4462015-09-21 15:20:28 -060042 IMAGE_VIEW_CREATE_ERROR, // Error occurred trying to create Image View
Mike Stroyana3082432015-09-25 13:39:21 -060043 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 Lobodzinskidc86b852015-10-23 14:20:31 -060046 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 Lobodzinski37a38b12016-01-04 13:32:45 -070048 IMAGE_INVALID_IMAGE_RESOURCE, // Image resource/subresource called with invalid setting
Mark Lobodzinskid5a23822015-11-12 15:14:35 -070049 IMAGE_INVALID_FORMAT_LIMITS_VIOLATION, // Device limits for this format have been exceeded
Tobin Ehlisad8c4462015-09-21 15:20:28 -060050} IMAGE_ERROR;
51
Tobin Ehliscde08892015-09-22 10:11:37 -060052typedef struct _IMAGE_STATE
53{
Mark Lobodzinskidc86b852015-10-23 14:20:31 -060054 uint32_t mipLevels;
55 uint32_t arraySize;
56 VkFormat format;
Chia-I Wu5c17c962015-10-31 00:31:16 +080057 VkSampleCountFlagBits samples;
Mike Stroyana3082432015-09-25 13:39:21 -060058 VkImageType imageType;
Mark Lobodzinskidc86b852015-10-23 14:20:31 -060059 VkExtent3D extent;
Chia-I Wu5c17c962015-10-31 00:31:16 +080060 _IMAGE_STATE():mipLevels(0), arraySize(0), format(VK_FORMAT_UNDEFINED), samples(VK_SAMPLE_COUNT_1_BIT), imageType(VK_IMAGE_TYPE_RANGE_SIZE), extent{} {};
Mike Stroyana3082432015-09-25 13:39:21 -060061 _IMAGE_STATE(const VkImageCreateInfo* pCreateInfo):
62 mipLevels(pCreateInfo->mipLevels),
Courtney Goeltzenleuchter5d2aed42015-10-21 17:57:31 -060063 arraySize(pCreateInfo->arrayLayers),
Mike Stroyana3082432015-09-25 13:39:21 -060064 format(pCreateInfo->format),
65 samples(pCreateInfo->samples),
Mark Lobodzinskidc86b852015-10-23 14:20:31 -060066 imageType(pCreateInfo->imageType),
67 extent(pCreateInfo->extent)
Mike Stroyana3082432015-09-25 13:39:21 -060068 {};
Tobin Ehliscde08892015-09-22 10:11:37 -060069} IMAGE_STATE;
70
Tobin Ehlisad8c4462015-09-21 15:20:28 -060071#endif // IMAGE_H