1 #ifndef _VKTPIPELINEIMAGESAMPLINGINSTANCE_HPP
2 #define _VKTPIPELINEIMAGESAMPLINGINSTANCE_HPP
3 /*------------------------------------------------------------------------
4 * Vulkan Conformance Tests
5 * ------------------------
7 * Copyright (c) 2015 The Khronos Group Inc.
8 * Copyright (c) 2015 Imagination Technologies Ltd.
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
14 * http://www.apache.org/licenses/LICENSE-2.0
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.
24 * \brief Image sampling case
25 *//*--------------------------------------------------------------------*/
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 #include "deSharedPtr.hpp"
44 ALLOCATION_KIND_SUBALLOCATED,
45 ALLOCATION_KIND_DEDICATED,
48 class ImageSamplingInstance : public vkt::TestInstance
51 ImageSamplingInstance (Context& context,
52 const tcu::UVec2& renderSize,
53 vk::VkImageViewType imageViewType,
54 vk::VkFormat imageFormat,
55 const tcu::IVec3& imageSize,
57 const vk::VkComponentMapping& componentMapping,
58 const vk::VkImageSubresourceRange& subresourceRange,
59 const vk::VkSamplerCreateInfo& samplerParams,
61 const std::vector<Vertex4Tex4>& vertices,
62 vk::VkDescriptorType samplingType = vk::VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
64 AllocationKind allocationKind = ALLOCATION_KIND_SUBALLOCATED);
66 virtual ~ImageSamplingInstance (void);
68 virtual tcu::TestStatus iterate (void);
71 tcu::TestStatus verifyImage (void);
74 typedef vk::Unique<vk::VkImage> UniqueImage;
75 typedef vk::Unique<vk::VkImageView> UniqueImageView;
76 typedef de::UniquePtr<vk::Allocation> UniqueAlloc;
77 typedef de::SharedPtr<UniqueImage> SharedImagePtr;
78 typedef de::SharedPtr<UniqueImageView> SharedImageViewPtr;
79 typedef de::SharedPtr<UniqueAlloc> SharedAllocPtr;
81 const AllocationKind m_allocationKind;
82 const vk::VkDescriptorType m_samplingType;
83 const vk::VkImageViewType m_imageViewType;
84 const vk::VkFormat m_imageFormat;
85 const tcu::IVec3 m_imageSize;
86 const int m_layerCount;
87 const int m_imageCount;
89 const vk::VkComponentMapping m_componentMapping;
90 const vk::VkImageSubresourceRange m_subresourceRange;
91 const vk::VkSamplerCreateInfo m_samplerParams;
92 const float m_samplerLod;
94 std::vector<SharedImagePtr> m_images;
95 std::vector<SharedAllocPtr> m_imageAllocs;
96 std::vector<SharedImageViewPtr> m_imageViews;
97 vk::Move<vk::VkSampler> m_sampler;
98 de::MovePtr<TestTexture> m_texture;
100 const tcu::UVec2 m_renderSize;
101 const vk::VkFormat m_colorFormat;
103 vk::Move<vk::VkDescriptorPool> m_descriptorPool;
104 vk::Move<vk::VkDescriptorSetLayout> m_descriptorSetLayout;
105 vk::Move<vk::VkDescriptorSet> m_descriptorSet;
107 std::vector<SharedImagePtr> m_colorImages;
108 std::vector<SharedAllocPtr> m_colorImageAllocs;
109 std::vector<SharedImageViewPtr> m_colorAttachmentViews;
110 vk::Move<vk::VkRenderPass> m_renderPass;
111 vk::Move<vk::VkFramebuffer> m_framebuffer;
113 vk::Move<vk::VkShaderModule> m_vertexShaderModule;
114 vk::Move<vk::VkShaderModule> m_fragmentShaderModule;
116 vk::Move<vk::VkBuffer> m_vertexBuffer;
117 std::vector<Vertex4Tex4> m_vertices;
118 de::MovePtr<vk::Allocation> m_vertexBufferAlloc;
120 vk::Move<vk::VkPipelineLayout> m_pipelineLayout;
121 vk::Move<vk::VkPipeline> m_graphicsPipeline;
123 vk::Move<vk::VkCommandPool> m_cmdPool;
124 vk::Move<vk::VkCommandBuffer> m_cmdBuffer;
126 vk::Move<vk::VkFence> m_fence;
132 #endif // _VKTPIPELINEIMAGESAMPLINGINSTANCE_HPP