blob: 26bf63bb33861f22639ad8a2874b05d403d2ca7d [file] [log] [blame]
Mark Lobodzinskid42e4d22017-01-17 14:14:22 -07001/* Copyright (c) 2015-2017 The Khronos Group Inc.
2 * Copyright (c) 2015-2017 Valve Corporation
3 * Copyright (c) 2015-2017 LunarG, Inc.
4 * Copyright (C) 2015-2017 Google Inc.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 * Mark Lobodzinski <mark@lunarg.com>
19 */
20#ifndef CORE_VALIDATION_BUFFER_VALIDATION_H_
21#define CORE_VALIDATION_BUFFER_VALIDATION_H_
22
23#include "core_validation_types.h"
Mark Lobodzinski90224de2017-01-26 15:23:11 -070024#include "core_validation_error_enums.h"
Mark Lobodzinskid42e4d22017-01-17 14:14:22 -070025#include "vulkan/vk_layer.h"
26#include <memory>
27#include <unordered_map>
28#include <vector>
Mark Lobodzinski9ef5d562017-01-27 12:28:30 -070029#include <utility>
Mark Lobodzinskid42e4d22017-01-17 14:14:22 -070030
Mark Lobodzinski90224de2017-01-26 15:23:11 -070031
32bool PreCallValidateCreateImage(core_validation::layer_data *device_data, const VkImageCreateInfo *pCreateInfo,
33 const VkAllocationCallbacks *pAllocator, VkImage *pImage);
34
Mark Lobodzinski214144a2017-01-27 14:25:32 -070035void PostCallRecordCreateImage(core_validation::layer_data *device_data, const VkImageCreateInfo *pCreateInfo, VkImage *pImage);
Mark Lobodzinski42fe5f72017-01-11 11:36:16 -070036
Mark Lobodzinski9ef5d562017-01-27 12:28:30 -070037void PostCallRecordDestroyImage(core_validation::layer_data *device_data, VkImage image, IMAGE_STATE *image_state,
38 VK_OBJECT obj_struct);
39
40bool PreCallValidateDestroyImage(core_validation::layer_data *device_data, VkImage image, IMAGE_STATE **image_state,
41 VK_OBJECT *obj_struct);
42
Mark Lobodzinskic409a582017-01-27 15:16:01 -070043bool ValidateImageAttributes(core_validation::layer_data *device_data, IMAGE_STATE *image_state, VkImageSubresourceRange range);
44
Mark Lobodzinski9c93dbd2017-02-02 08:31:18 -070045void ResolveRemainingLevelsLayers(core_validation::layer_data *dev_data, VkImageSubresourceRange *range, IMAGE_STATE *image_state);
Mark Lobodzinskid81d1012017-02-01 09:03:06 -070046
47void ResolveRemainingLevelsLayers(core_validation::layer_data *dev_data, uint32_t *levels, uint32_t *layers,
Mark Lobodzinski9c93dbd2017-02-02 08:31:18 -070048 VkImageSubresourceRange range, IMAGE_STATE *image_state);
Mark Lobodzinskid81d1012017-02-01 09:03:06 -070049
Mark Lobodzinski9c93dbd2017-02-02 08:31:18 -070050bool VerifyClearImageLayout(core_validation::layer_data *device_data, GLOBAL_CB_NODE *cb_node, IMAGE_STATE *image_state,
Mark Lobodzinskid81d1012017-02-01 09:03:06 -070051 VkImageSubresourceRange range, VkImageLayout dest_image_layout, const char *func_name);
52
53void RecordClearImageLayout(core_validation::layer_data *dev_data, GLOBAL_CB_NODE *cb_node, VkImage image,
54 VkImageSubresourceRange range, VkImageLayout dest_image_layout);
55
56bool PreCallValidateCmdClearColorImage(core_validation::layer_data *dev_data, VkCommandBuffer commandBuffer, VkImage image,
57 VkImageLayout imageLayout, uint32_t rangeCount, const VkImageSubresourceRange *pRanges);
58
59void PreCallRecordCmdClearImage(core_validation::layer_data *dev_data, VkCommandBuffer commandBuffer, VkImage image,
60 VkImageLayout imageLayout, uint32_t rangeCount, const VkImageSubresourceRange *pRanges,
61 CMD_TYPE cmd_type);
62
63bool PreCallValidateCmdClearDepthStencilImage(core_validation::layer_data *dev_data, VkCommandBuffer commandBuffer, VkImage image,
64 VkImageLayout imageLayout, uint32_t rangeCount,
65 const VkImageSubresourceRange *pRanges);
66
Mark Lobodzinski64318ba2017-01-26 13:34:13 -070067#endif // CORE_VALIDATION_BUFFER_VALIDATION_H_