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  * 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 Image sampling case
25  *//*--------------------------------------------------------------------*/
26 
27 #include "vkDefs.hpp"
28 
29 #include "vktTestCase.hpp"
30 #include "vktTestCaseUtil.hpp"
31 #include "vktPipelineImageUtil.hpp"
32 #include "vktPipelineReferenceRenderer.hpp"
33 #include "vktPipelineVertexUtil.hpp"
34 #include "tcuVectorUtil.hpp"
35 
36 namespace vkt
37 {
38 namespace pipeline
39 {
40 
41 class ImageSamplingInstance : public vkt::TestInstance
42 {
43 public:
44 												ImageSamplingInstance	(Context&							context,
45 																		 const tcu::UVec2&					renderSize,
46 																		 vk::VkImageViewType				imageViewType,
47 																		 vk::VkFormat						imageFormat,
48 																		 const tcu::IVec3&					imageSize,
49 																		 int								layerCount,
50 																		 const vk::VkComponentMapping&		componentMapping,
51 																		 const vk::VkImageSubresourceRange&	subresourceRange,
52 																		 const vk::VkSamplerCreateInfo&		samplerParams,
53 																		 float								samplerLod,
54 																		 const std::vector<Vertex4Tex4>&	vertices);
55 
56 	virtual										~ImageSamplingInstance	(void);
57 
58 	virtual tcu::TestStatus						iterate					(void);
59 
60 protected:
61 	tcu::TestStatus								verifyImage				(void);
62 
63 private:
64 	const vk::VkImageViewType					m_imageViewType;
65 	const vk::VkFormat							m_imageFormat;
66 	const tcu::IVec3							m_imageSize;
67 	const int									m_layerCount;
68 
69 	const vk::VkComponentMapping				m_componentMapping;
70 	const vk::VkImageSubresourceRange			m_subresourceRange;
71 	const vk::VkSamplerCreateInfo				m_samplerParams;
72 	const float									m_samplerLod;
73 
74 	vk::Move<vk::VkImage>						m_image;
75 	de::MovePtr<vk::Allocation>					m_imageAlloc;
76 	vk::Move<vk::VkImageView>					m_imageView;
77 	vk::Move<vk::VkSampler>						m_sampler;
78 	de::MovePtr<TestTexture>					m_texture;
79 
80 	const tcu::UVec2							m_renderSize;
81 	const vk::VkFormat							m_colorFormat;
82 
83 	vk::Move<vk::VkDescriptorPool>				m_descriptorPool;
84 	vk::Move<vk::VkDescriptorSetLayout>			m_descriptorSetLayout;
85 	vk::Move<vk::VkDescriptorSet>				m_descriptorSet;
86 
87 	vk::Move<vk::VkImage>						m_colorImage;
88 	de::MovePtr<vk::Allocation>					m_colorImageAlloc;
89 	vk::Move<vk::VkImageView>					m_colorAttachmentView;
90 	vk::Move<vk::VkRenderPass>					m_renderPass;
91 	vk::Move<vk::VkFramebuffer>					m_framebuffer;
92 
93 	vk::Move<vk::VkShaderModule>				m_vertexShaderModule;
94 	vk::Move<vk::VkShaderModule>				m_fragmentShaderModule;
95 
96 	vk::Move<vk::VkBuffer>						m_vertexBuffer;
97 	std::vector<Vertex4Tex4>					m_vertices;
98 	de::MovePtr<vk::Allocation>					m_vertexBufferAlloc;
99 
100 	vk::Move<vk::VkPipelineLayout>				m_pipelineLayout;
101 	vk::Move<vk::VkPipeline>					m_graphicsPipeline;
102 
103 	vk::Move<vk::VkCommandPool>					m_cmdPool;
104 	vk::Move<vk::VkCommandBuffer>				m_cmdBuffer;
105 
106 	vk::Move<vk::VkFence>						m_fence;
107 };
108 
109 } // pipeline
110 } // vkt
111 
112 #endif // _VKTPIPELINEIMAGESAMPLINGINSTANCE_HPP
113