Home | History | Annotate | Download | only in layers
      1 /* Copyright (c) 2015-2016 The Khronos Group Inc.
      2  * Copyright (c) 2015-2016 Valve Corporation
      3  * Copyright (c) 2015-2016 LunarG, Inc.
      4  *
      5  * 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:
     11  *
     12  * The above copyright notice(s) and this permission notice shall be included
     13  * in all copies or substantial portions of the Materials.
     14  *
     15  * THE MATERIALS ARE 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.
     18  *
     19  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
     20  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
     21  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
     22  * USE OR OTHER DEALINGS IN THE MATERIALS
     23  *
     24  * Author: Mark Lobodzinski <mark (at) lunarg.com>
     25  * Author: Mike Stroyan <mike (at) LunarG.com>
     26  * Author: Tobin Ehlis <tobin (at) lunarg.com>
     27  */
     28 
     29 #ifndef IMAGE_H
     30 #define IMAGE_H
     31 #include "vulkan/vulkan.h"
     32 #include "vk_layer_config.h"
     33 #include "vk_layer_logging.h"
     34 
     35 // Image ERROR codes
     36 typedef enum _IMAGE_ERROR {
     37     IMAGE_NONE,                             // Used for INFO & other non-error messages
     38     IMAGE_FORMAT_UNSUPPORTED,               // Request to create Image or RenderPass with a format that is not supported
     39     IMAGE_RENDERPASS_INVALID_ATTACHMENT,    // Invalid image layouts and/or load/storeOps for an attachment when creating RenderPass
     40     IMAGE_RENDERPASS_INVALID_DS_ATTACHMENT, // If no depth attachment for a RenderPass, verify that subpass DS attachment is set to
     41                                             // UNUSED
     42     IMAGE_INVALID_IMAGE_ASPECT,             // Image aspect mask bits are invalid for this API call
     43     IMAGE_MISMATCHED_IMAGE_ASPECT,          // Image aspect masks for source and dest images do not match
     44     IMAGE_VIEW_CREATE_ERROR,                // Error occurred trying to create Image View
     45     IMAGE_MISMATCHED_IMAGE_TYPE,            // Image types for source and dest images do not match
     46     IMAGE_MISMATCHED_IMAGE_FORMAT,          // Image formats for source and dest images do not match
     47     IMAGE_INVALID_RESOLVE_SAMPLES,          // Image resolve source samples less than two or dest samples greater than one
     48     IMAGE_INVALID_FORMAT,                   // Operation specifies an invalid format, or there is a format mismatch
     49     IMAGE_INVALID_FILTER,                   // Operation specifies an invalid filter setting
     50     IMAGE_INVALID_IMAGE_RESOURCE,           // Image resource/subresource called with invalid setting
     51     IMAGE_INVALID_FORMAT_LIMITS_VIOLATION,  // Device limits for this format have been exceeded
     52     IMAGE_INVALID_LAYOUT,                   // Operation specifies an invalid layout.
     53 } IMAGE_ERROR;
     54 
     55 typedef struct _IMAGE_STATE {
     56     uint32_t mipLevels;
     57     uint32_t arraySize;
     58     VkFormat format;
     59     VkSampleCountFlagBits samples;
     60     VkImageType imageType;
     61     VkExtent3D extent;
     62     VkImageCreateFlags flags;
     63     _IMAGE_STATE()
     64         : mipLevels(0), arraySize(0), format(VK_FORMAT_UNDEFINED), samples(VK_SAMPLE_COUNT_1_BIT),
     65           imageType(VK_IMAGE_TYPE_RANGE_SIZE), extent{}, flags(0){};
     66     _IMAGE_STATE(const VkImageCreateInfo *pCreateInfo)
     67         : mipLevels(pCreateInfo->mipLevels), arraySize(pCreateInfo->arrayLayers), format(pCreateInfo->format),
     68           samples(pCreateInfo->samples), imageType(pCreateInfo->imageType), extent(pCreateInfo->extent),
     69           flags(pCreateInfo->flags){};
     70 } IMAGE_STATE;
     71 
     72 #endif // IMAGE_H
     73