Merge branch 'jekstrand_renderpass_transfer_bit_fix' into 'master'
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / modules / vulkan / pipeline / vktPipelineImageSamplingInstance.hpp
1 #ifndef _VKTPIPELINEIMAGESAMPLINGINSTANCE_HPP
2 #define _VKTPIPELINEIMAGESAMPLINGINSTANCE_HPP
3 /*------------------------------------------------------------------------
4  * Vulkan Conformance Tests
5  * ------------------------
6  *
7  * Copyright (c) 2015 The Khronos Group Inc.
8  * Copyright (c) 2015 Imagination Technologies Ltd.
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining a
11  * copy of this software and/or associated documentation files (the
12  * "Materials"), to deal in the Materials without restriction, including
13  * without limitation the rights to use, copy, modify, merge, publish,
14  * distribute, sublicense, and/or sell copies of the Materials, and to
15  * permit persons to whom the Materials are furnished to do so, subject to
16  * the following conditions:
17  *
18  * The above copyright notice(s) and this permission notice shall be included
19  * in all copies or substantial portions of the Materials.
20  *
21  * The Materials are Confidential Information as defined by the
22  * Khronos Membership Agreement until designated non-confidential by Khronos,
23  * at which point this condition clause shall be removed.
24  *
25  * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
28  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
29  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
30  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
31  * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
32  *
33  *//*!
34  * \file
35  * \brief Image sampling case
36  *//*--------------------------------------------------------------------*/
37
38 #include "vkDefs.hpp"
39
40 #include "vktTestCase.hpp"
41 #include "vktTestCaseUtil.hpp"
42 #include "vktPipelineImageUtil.hpp"
43 #include "vktPipelineReferenceRenderer.hpp"
44 #include "vktPipelineVertexUtil.hpp"
45 #include "tcuVectorUtil.hpp"
46
47 namespace vkt
48 {
49 namespace pipeline
50 {
51
52 class ImageSamplingInstance : public vkt::TestInstance
53 {
54 public:
55                                                                                                 ImageSamplingInstance   (Context&                                                       context,
56                                                                                                                                                  const tcu::UVec2&                                      renderSize,
57                                                                                                                                                  vk::VkImageViewType                            imageViewType,
58                                                                                                                                                  vk::VkFormat                                           imageFormat,
59                                                                                                                                                  const tcu::IVec3&                                      imageSize,
60                                                                                                                                                  int                                                            layerCount,
61                                                                                                                                                  const vk::VkComponentMapping&          componentMapping,
62                                                                                                                                                  const vk::VkImageSubresourceRange&     subresourceRange,
63                                                                                                                                                  const vk::VkSamplerCreateInfo&         samplerParams,
64                                                                                                                                                  float                                                          samplerLod,
65                                                                                                                                                  const std::vector<Vertex4Tex4>&        vertices);
66
67         virtual                                                                         ~ImageSamplingInstance  (void);
68
69         virtual tcu::TestStatus                                         iterate                                 (void);
70
71 protected:
72         tcu::TestStatus                                                         verifyImage                             (void);
73
74 private:
75         const vk::VkImageViewType                                       m_imageViewType;
76         const tcu::IVec3                                                        m_imageSize;
77         const int                                                                       m_layerCount;
78
79         const vk::VkComponentMapping                            m_componentMapping;
80         const vk::VkImageSubresourceRange                       m_subresourceRange;
81         const vk::VkSamplerCreateInfo                           m_samplerParams;
82         const float                                                                     m_samplerLod;
83
84         vk::Move<vk::VkImage>                                           m_image;
85         de::MovePtr<vk::Allocation>                                     m_imageAlloc;
86         vk::Move<vk::VkImageView>                                       m_imageView;
87         vk::Move<vk::VkSampler>                                         m_sampler;
88         de::MovePtr<TestTexture>                                        m_texture;
89
90         const tcu::UVec2                                                        m_renderSize;
91         const vk::VkFormat                                                      m_colorFormat;
92
93         vk::Move<vk::VkDescriptorPool>                          m_descriptorPool;
94         vk::Move<vk::VkDescriptorSetLayout>                     m_descriptorSetLayout;
95         vk::Move<vk::VkDescriptorSet>                           m_descriptorSet;
96
97         vk::Move<vk::VkImage>                                           m_colorImage;
98         de::MovePtr<vk::Allocation>                                     m_colorImageAlloc;
99         vk::Move<vk::VkImageView>                                       m_colorAttachmentView;
100         vk::Move<vk::VkRenderPass>                                      m_renderPass;
101         vk::Move<vk::VkFramebuffer>                                     m_framebuffer;
102
103         vk::Move<vk::VkShaderModule>                            m_vertexShaderModule;
104         vk::Move<vk::VkShaderModule>                            m_fragmentShaderModule;
105
106         vk::Move<vk::VkBuffer>                                          m_vertexBuffer;
107         std::vector<Vertex4Tex4>                                        m_vertices;
108         de::MovePtr<vk::Allocation>                                     m_vertexBufferAlloc;
109
110         vk::Move<vk::VkPipelineLayout>                          m_pipelineLayout;
111         vk::Move<vk::VkPipeline>                                        m_graphicsPipeline;
112
113         vk::Move<vk::VkCommandPool>                                     m_cmdPool;
114         vk::Move<vk::VkCommandBuffer>                           m_cmdBuffer;
115
116         vk::Move<vk::VkFence>                                           m_fence;
117 };
118
119 } // pipeline
120 } // vkt
121
122 #endif // _VKTPIPELINEIMAGESAMPLINGINSTANCE_HPP