1 #ifndef _VKTPROTECTEDMEMIMAGEVALIDATOR_HPP
2 #define _VKTPROTECTEDMEMIMAGEVALIDATOR_HPP
3 /*------------------------------------------------------------------------
4  * Vulkan Conformance Tests
5  * ------------------------
6  *
7  * Copyright (c) 2017 The Khronos Group Inc.
8  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  *      http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  *//*!
23  * \file
24  * \brief Protected Memory image validator helper
25  *//*--------------------------------------------------------------------*/
26 
27 #include "tcuVector.hpp"
28 #include "vkDefs.hpp"
29 #include "vktTestCase.hpp"
30 
31 namespace vkt
32 {
33 namespace ProtectedMem
34 {
35 
36 class ProtectedContext;
37 
38 struct ValidationData
39 {
40     tcu::Vec4 coords[4];
41     tcu::Vec4 values[4];
42 };
43 
44 class ImageValidator
45 {
46 public:
ImageValidator(vk::VkFormat imageFormat=vk::VK_FORMAT_R8G8B8A8_UNORM)47     ImageValidator(vk::VkFormat imageFormat = vk::VK_FORMAT_R8G8B8A8_UNORM) : m_imageFormat(imageFormat)
48     {
49     }
~ImageValidator()50     ~ImageValidator()
51     {
52     }
53     void initPrograms(vk::SourceCollections &programCollection) const;
54 
55     bool validateImage(ProtectedContext &ctx, const ValidationData &refData, const vk::VkImage image,
56                        const vk::VkFormat imageFormat, const vk::VkImageLayout imageLayout) const;
57 
58 private:
59     const vk::VkFormat m_imageFormat;
60 };
61 
62 } // namespace ProtectedMem
63 } // namespace vkt
64 
65 #endif // _VKTPROTECTEDMEMIMAGEVALIDATOR_HPP
66