blob: dbc2d30198730dbd47493b0b23154c6b8932ae5d [file] [log] [blame]
Mark Lobodzinski6eda00a2016-02-02 15:55:36 -07001/* Copyright (c) 2015-2016 The Khronos Group Inc.
2 * Copyright (c) 2015-2016 Valve Corporation
3 * Copyright (c) 2015-2016 LunarG, Inc.
Tobin Ehlisad8c4462015-09-21 15:20:28 -06004 *
Mark Lobodzinski6eda00a2016-02-02 15:55:36 -07005 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and/or associated documentation files (the "Materials"), to
7 * deal in the Materials without restriction, including without limitation the
8 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 * sell copies of the Materials, and to permit persons to whom the Materials
10 * are furnished to do so, subject to the following conditions:
Tobin Ehlisad8c4462015-09-21 15:20:28 -060011 *
Mark Lobodzinski6eda00a2016-02-02 15:55:36 -070012 * The above copyright notice(s) and this permission notice shall be included
13 * in all copies or substantial portions of the Materials.
Tobin Ehlisad8c4462015-09-21 15:20:28 -060014 *
Mark Lobodzinski6eda00a2016-02-02 15:55:36 -070015 * The Materials are Confidential Information as defined by the Khronos
16 * Membership Agreement until designated non-confidential by Khronos, at which
17 * point this condition clause shall be removed.
Tobin Ehlisad8c4462015-09-21 15:20:28 -060018 *
Mark Lobodzinski6eda00a2016-02-02 15:55:36 -070019 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Tobin Ehlisad8c4462015-09-21 15:20:28 -060020 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Mark Lobodzinski6eda00a2016-02-02 15:55:36 -070021 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 *
23 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
24 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
25 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
26 * USE OR OTHER DEALINGS IN THE MATERIALS
Courtney Goeltzenleuchter05559522015-10-30 11:14:30 -060027 *
28 * Author: Mark Lobodzinski <mark@lunarg.com>
29 * Author: Mike Stroyan <mike@LunarG.com>
30 * Author: Tobin Ehlis <tobin@lunarg.com>
Tobin Ehlisad8c4462015-09-21 15:20:28 -060031 */
Mark Lobodzinski6eda00a2016-02-02 15:55:36 -070032
Tobin Ehlisad8c4462015-09-21 15:20:28 -060033#ifndef IMAGE_H
34#define IMAGE_H
David Pinedo9316d3b2015-11-06 12:54:48 -070035#include "vulkan/vulkan.h"
Tobin Ehlisad8c4462015-09-21 15:20:28 -060036#include "vk_layer_config.h"
37#include "vk_layer_logging.h"
38
Mike Stroyana3082432015-09-25 13:39:21 -060039// Image ERROR codes
Mark Lobodzinski1ed594e2016-02-03 09:57:14 -070040typedef enum _IMAGE_ERROR
41{
42 IMAGE_NONE, // Used for INFO & other non-error messages
43 IMAGE_FORMAT_UNSUPPORTED, // Request to create Image or RenderPass with a format that is not supported
44 IMAGE_RENDERPASS_INVALID_ATTACHMENT, // Invalid image layouts and/or load/storeOps for an attachment when creating RenderPass
45 IMAGE_RENDERPASS_INVALID_DS_ATTACHMENT, // If no depth attachment for a RenderPass, verify that subpass DS attachment is set to UNUSED
46 IMAGE_INVALID_IMAGE_ASPECT, // Image aspect mask bits are invalid for this API call
47 IMAGE_MISMATCHED_IMAGE_ASPECT, // Image aspect masks for source and dest images do not match
48 IMAGE_VIEW_CREATE_ERROR, // Error occurred trying to create Image View
49 IMAGE_MISMATCHED_IMAGE_TYPE, // Image types for source and dest images do not match
50 IMAGE_MISMATCHED_IMAGE_FORMAT, // Image formats for source and dest images do not match
51 IMAGE_INVALID_RESOLVE_SAMPLES, // Image resolve source samples less than two or dest samples greater than one
52 IMAGE_INVALID_FORMAT, // Operation specifies an invalid format, or there is a format mismatch
53 IMAGE_INVALID_FILTER, // Operation specifies an invalid filter setting
54 IMAGE_INVALID_IMAGE_RESOURCE, // Image resource/subresource called with invalid setting
55 IMAGE_INVALID_FORMAT_LIMITS_VIOLATION, // Device limits for this format have been exceeded
Tobin Ehlisad8c4462015-09-21 15:20:28 -060056} IMAGE_ERROR;
57
Mark Lobodzinski1ed594e2016-02-03 09:57:14 -070058typedef struct _IMAGE_STATE
59{
60 uint32_t mipLevels;
61 uint32_t arraySize;
62 VkFormat format;
Chia-I Wu5c17c962015-10-31 00:31:16 +080063 VkSampleCountFlagBits samples;
Mark Lobodzinski1ed594e2016-02-03 09:57:14 -070064 VkImageType imageType;
65 VkExtent3D extent;
66 VkImageCreateFlags flags;
67 _IMAGE_STATE():mipLevels(0), arraySize(0), format(VK_FORMAT_UNDEFINED), samples(VK_SAMPLE_COUNT_1_BIT), imageType(VK_IMAGE_TYPE_RANGE_SIZE), extent{}, flags(0) {};
68 _IMAGE_STATE(const VkImageCreateInfo* pCreateInfo):
69 mipLevels(pCreateInfo->mipLevels),
70 arraySize(pCreateInfo->arrayLayers),
71 format(pCreateInfo->format),
72 samples(pCreateInfo->samples),
73 imageType(pCreateInfo->imageType),
74 extent(pCreateInfo->extent),
75 flags(pCreateInfo->flags)
76 {};
Tobin Ehliscde08892015-09-22 10:11:37 -060077} IMAGE_STATE;
78
Tobin Ehlisad8c4462015-09-21 15:20:28 -060079#endif // IMAGE_H