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 #include "deSharedPtr.hpp" 36 37 namespace vkt 38 { 39 namespace pipeline 40 { 41 42 class ImageSamplingInstance : public vkt::TestInstance 43 { 44 public: 45 ImageSamplingInstance (Context& context, 46 const tcu::UVec2& renderSize, 47 vk::VkImageViewType imageViewType, 48 vk::VkFormat imageFormat, 49 const tcu::IVec3& imageSize, 50 int layerCount, 51 const vk::VkComponentMapping& componentMapping, 52 const vk::VkImageSubresourceRange& subresourceRange, 53 const vk::VkSamplerCreateInfo& samplerParams, 54 float samplerLod, 55 const std::vector<Vertex4Tex4>& vertices, 56 vk::VkDescriptorType samplingType = vk::VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 57 int imageCount = 1); 58 59 virtual ~ImageSamplingInstance (void); 60 61 virtual tcu::TestStatus iterate (void); 62 63 protected: 64 tcu::TestStatus verifyImage (void); 65 66 private: 67 typedef vk::Unique<vk::VkImage> UniqueImage; 68 typedef vk::Unique<vk::VkImageView> UniqueImageView; 69 typedef de::UniquePtr<vk::Allocation> UniqueAlloc; 70 typedef de::SharedPtr<UniqueImage> SharedImagePtr; 71 typedef de::SharedPtr<UniqueImageView> SharedImageViewPtr; 72 typedef de::SharedPtr<UniqueAlloc> SharedAllocPtr; 73 74 const vk::VkDescriptorType m_samplingType; 75 const vk::VkImageViewType m_imageViewType; 76 const vk::VkFormat m_imageFormat; 77 const tcu::IVec3 m_imageSize; 78 const int m_layerCount; 79 const int m_imageCount; 80 81 const vk::VkComponentMapping m_componentMapping; 82 const vk::VkImageSubresourceRange m_subresourceRange; 83 const vk::VkSamplerCreateInfo m_samplerParams; 84 const float m_samplerLod; 85 86 std::vector<SharedImagePtr> m_images; 87 std::vector<SharedAllocPtr> m_imageAllocs; 88 std::vector<SharedImageViewPtr> m_imageViews; 89 vk::Move<vk::VkSampler> m_sampler; 90 de::MovePtr<TestTexture> m_texture; 91 92 const tcu::UVec2 m_renderSize; 93 const vk::VkFormat m_colorFormat; 94 95 vk::Move<vk::VkDescriptorPool> m_descriptorPool; 96 vk::Move<vk::VkDescriptorSetLayout> m_descriptorSetLayout; 97 vk::Move<vk::VkDescriptorSet> m_descriptorSet; 98 99 std::vector<SharedImagePtr> m_colorImages; 100 std::vector<SharedAllocPtr> m_colorImageAllocs; 101 std::vector<SharedImageViewPtr> m_colorAttachmentViews; 102 vk::Move<vk::VkRenderPass> m_renderPass; 103 vk::Move<vk::VkFramebuffer> m_framebuffer; 104 105 vk::Move<vk::VkShaderModule> m_vertexShaderModule; 106 vk::Move<vk::VkShaderModule> m_fragmentShaderModule; 107 108 vk::Move<vk::VkBuffer> m_vertexBuffer; 109 std::vector<Vertex4Tex4> m_vertices; 110 de::MovePtr<vk::Allocation> m_vertexBufferAlloc; 111 112 vk::Move<vk::VkPipelineLayout> m_pipelineLayout; 113 vk::Move<vk::VkPipeline> m_graphicsPipeline; 114 115 vk::Move<vk::VkCommandPool> m_cmdPool; 116 vk::Move<vk::VkCommandBuffer> m_cmdBuffer; 117 118 vk::Move<vk::VkFence> m_fence; 119 }; 120 121 } // pipeline 122 } // vkt 123 124 #endif // _VKTPIPELINEIMAGESAMPLINGINSTANCE_HPP 125