blob: cd13ffc1367e11602ef934574aad162d1bdb61a8 [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.
22 */
23#ifndef IMAGE_H
24#define IMAGE_H
25#include "vulkan.h"
26#include "vk_layer_config.h"
27#include "vk_layer_logging.h"
28
Mike Stroyana3082432015-09-25 13:39:21 -060029// Image ERROR codes
Tobin Ehlisad8c4462015-09-21 15:20:28 -060030typedef enum _IMAGE_ERROR
31{
32 IMAGE_NONE, // Used for INFO & other non-error messages
33 IMAGE_FORMAT_UNSUPPORTED, // Request to create Image or RenderPass with a format that is not supported
34 IMAGE_RENDERPASS_INVALID_ATTACHMENT, // Invalid image layouts and/or load/storeOps for an attachment when creating RenderPass
35 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 -060036 IMAGE_INVALID_IMAGE_ASPECT, // Image aspect mask bits are invalid for this API call
37 IMAGE_MISMATCHED_IMAGE_ASPECT, // Image aspect masks for source and dest images do not match
Tobin Ehlisad8c4462015-09-21 15:20:28 -060038 IMAGE_VIEW_CREATE_ERROR, // Error occurred trying to create Image View
Mike Stroyana3082432015-09-25 13:39:21 -060039 IMAGE_MISMATCHED_IMAGE_TYPE, // Image types for source and dest images do not match
40 IMAGE_MISMATCHED_IMAGE_FORMAT, // Image formats for source and dest images do not match
41 IMAGE_INVALID_RESOLVE_SAMPLES, // Image resolve source samples less than two or dest samples greater than one
Mark Lobodzinskidc86b852015-10-23 14:20:31 -060042 IMAGE_INVALID_FORMAT, // Operation specifies an invalid format, or there is a format mismatch
43 IMAGE_INVALID_FILTER, // Operation specifies an invalid filter setting
Tobin Ehlisad8c4462015-09-21 15:20:28 -060044} IMAGE_ERROR;
45
Tobin Ehliscde08892015-09-22 10:11:37 -060046typedef struct _IMAGE_STATE
47{
Mark Lobodzinskidc86b852015-10-23 14:20:31 -060048 uint32_t mipLevels;
49 uint32_t arraySize;
50 VkFormat format;
Chia-I Wu5c17c962015-10-31 00:31:16 +080051 VkSampleCountFlagBits samples;
Mike Stroyana3082432015-09-25 13:39:21 -060052 VkImageType imageType;
Mark Lobodzinskidc86b852015-10-23 14:20:31 -060053 VkExtent3D extent;
Chia-I Wu5c17c962015-10-31 00:31:16 +080054 _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 -060055 _IMAGE_STATE(const VkImageCreateInfo* pCreateInfo):
56 mipLevels(pCreateInfo->mipLevels),
Courtney Goeltzenleuchter5d2aed42015-10-21 17:57:31 -060057 arraySize(pCreateInfo->arrayLayers),
Mike Stroyana3082432015-09-25 13:39:21 -060058 format(pCreateInfo->format),
59 samples(pCreateInfo->samples),
Mark Lobodzinskidc86b852015-10-23 14:20:31 -060060 imageType(pCreateInfo->imageType),
61 extent(pCreateInfo->extent)
Mike Stroyana3082432015-09-25 13:39:21 -060062 {};
Tobin Ehliscde08892015-09-22 10:11:37 -060063} IMAGE_STATE;
64
Tobin Ehlisad8c4462015-09-21 15:20:28 -060065#endif // IMAGE_H