1 #ifndef _VKTPIPELINESPECCONSTANTUTIL_HPP
2 #define _VKTPIPELINESPECCONSTANTUTIL_HPP
3 /*------------------------------------------------------------------------
4 * Vulkan Conformance Tests
5 * ------------------------
7 * Copyright (c) 2016 The Khronos Group Inc.
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
23 * \brief Pipeline specialization constants test utilities
24 *//*--------------------------------------------------------------------*/
28 #include "vkPrograms.hpp"
29 #include "vkMemUtil.hpp"
30 #include "vkRefUtil.hpp"
31 #include "vkQueryUtil.hpp"
38 class GraphicsPipelineBuilder
41 GraphicsPipelineBuilder (void) : m_renderSize (16, 16)
42 , m_shaderStageFlags (0u) {}
44 GraphicsPipelineBuilder& setRenderSize (const tcu::IVec2& size) { m_renderSize = size; return *this; }
45 GraphicsPipelineBuilder& setShader (const vk::DeviceInterface& vk, const vk::VkDevice device, const vk::VkShaderStageFlagBits stage, const vk::ProgramBinary& binary, const vk::VkSpecializationInfo* specInfo);
46 vk::Move<vk::VkPipeline> build (const vk::DeviceInterface& vk, const vk::VkDevice device, const vk::VkPipelineLayout pipelineLayout, const vk::VkRenderPass renderPass);
49 tcu::IVec2 m_renderSize;
50 vk::Move<vk::VkShaderModule> m_vertexShaderModule;
51 vk::Move<vk::VkShaderModule> m_fragmentShaderModule;
52 vk::Move<vk::VkShaderModule> m_geometryShaderModule;
53 vk::Move<vk::VkShaderModule> m_tessControlShaderModule;
54 vk::Move<vk::VkShaderModule> m_tessEvaluationShaderModule;
55 std::vector<vk::VkPipelineShaderStageCreateInfo> m_shaderStages;
56 vk::VkShaderStageFlags m_shaderStageFlags;
58 GraphicsPipelineBuilder (const GraphicsPipelineBuilder&); // "deleted"
59 GraphicsPipelineBuilder& operator= (const GraphicsPipelineBuilder&);
64 FEATURE_TESSELLATION_SHADER = 1u << 0,
65 FEATURE_GEOMETRY_SHADER = 1u << 1,
66 FEATURE_SHADER_FLOAT_64 = 1u << 2,
67 FEATURE_VERTEX_PIPELINE_STORES_AND_ATOMICS = 1u << 3,
68 FEATURE_FRAGMENT_STORES_AND_ATOMICS = 1u << 4,
70 typedef deUint32 FeatureFlags;
72 vk::VkImageCreateInfo makeImageCreateInfo (const tcu::IVec2& size, const vk::VkFormat format, const vk::VkImageUsageFlags usage);
73 vk::Move<vk::VkRenderPass> makeRenderPass (const vk::DeviceInterface& vk, const vk::VkDevice device, const vk::VkFormat colorFormat);
74 void beginRenderPass (const vk::DeviceInterface& vk, const vk::VkCommandBuffer commandBuffer, const vk::VkRenderPass renderPass, const vk::VkFramebuffer framebuffer, const vk::VkRect2D& renderArea, const tcu::Vec4& clearColor);
75 void requireFeatures (const vk::InstanceInterface& vki, const vk::VkPhysicalDevice physDevice, const FeatureFlags flags);
77 // Ugly, brute-force replacement for the initializer list
80 std::vector<T> makeVector (const T& o1)
89 std::vector<T> makeVector (const T& o1, const T& o2)
99 std::vector<T> makeVector (const T& o1, const T& o2, const T& o3)
110 std::vector<T> makeVector (const T& o1, const T& o2, const T& o3, const T& o4)
124 #endif // _VKTPIPELINESPECCONSTANTUTIL_HPP