x11: Fix deadlock am: 5e863331b2 am: f49e8bfc0e am: 1eb4f43dc4
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / modules / vulkan / dynamic_state / vktDynamicStateBaseClass.hpp
1 #ifndef _VKTDYNAMICSTATEBASECLASS_HPP
2 #define _VKTDYNAMICSTATEBASECLASS_HPP
3 /*------------------------------------------------------------------------
4  * Vulkan Conformance Tests
5  * ------------------------
6  *
7  * Copyright (c) 2015 The Khronos Group Inc.
8  * Copyright (c) 2015 Intel Corporation
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 Dynamic State Tests - Base Class
25  *//*--------------------------------------------------------------------*/
26
27 #include "tcuDefs.hpp"
28 #include "vktTestCase.hpp"
29
30 #include "vktDynamicStateTestCaseUtil.hpp"
31 #include "vktDrawImageObjectUtil.hpp"
32 #include "vktDrawBufferObjectUtil.hpp"
33 #include "vktDrawCreateInfoUtil.hpp"
34
35 namespace vkt
36 {
37 namespace DynamicState
38 {
39
40 class DynamicStateBaseClass : public TestInstance
41 {
42 public:
43         DynamicStateBaseClass (Context& context, const char* vertexShaderName, const char* fragmentShaderName);
44
45 protected:
46         void                                    initialize                                              (void);
47
48         virtual void                    initPipeline                                    (const vk::VkDevice                             device);
49
50         virtual tcu::TestStatus iterate                                                 (void);
51
52         void                                    beginRenderPass                                 (void);
53
54         void                                    beginRenderPassWithClearColor   (const vk::VkClearColorValue&   clearColor);
55
56         void                                    setDynamicViewportState                 (const deUint32                                 width,
57                                                                                                                         const deUint32                                  height);
58
59         void                                    setDynamicViewportState                 (deUint32                                               viewportCount,
60                                                                                                                          const vk::VkViewport*                  pViewports,
61                                                                                                                          const vk::VkRect2D*                    pScissors);
62
63         void                                    setDynamicRasterizationState    (const float                                    lineWidth = 1.0f,
64                                                                                                                          const float                                    depthBiasConstantFactor = 0.0f,
65                                                                                                                          const float                                    depthBiasClamp = 0.0f,
66                                                                                                                          const float                                    depthBiasSlopeFactor = 0.0f);
67
68         void                                    setDynamicBlendState                    (const float                                    const1 = 0.0f, const float const2 = 0.0f,
69                                                                                                                          const float                                    const3 = 0.0f, const float const4 = 0.0f);
70
71         void                                    setDynamicDepthStencilState             (const float                                    minDepthBounds = -1.0f,
72                                                                                                                          const float                                    maxDepthBounds = 1.0f,
73                                                                                                                          const deUint32                                 stencilFrontCompareMask = 0xffffffffu,
74                                                                                                                          const deUint32                                 stencilFrontWriteMask = 0xffffffffu,
75                                                                                                                          const deUint32                                 stencilFrontReference = 0,
76                                                                                                                          const deUint32                                 stencilBackCompareMask = 0xffffffffu,
77                                                                                                                          const deUint32                                 stencilBackWriteMask = 0xffffffffu,
78                                                                                                                          const deUint32                                 stencilBackReference = 0);
79         enum
80         {
81                 WIDTH       = 128,
82                 HEIGHT      = 128
83         };
84
85         vk::VkFormat                                                                    m_colorAttachmentFormat;
86
87         vk::VkPrimitiveTopology                                                 m_topology;
88
89         const vk::DeviceInterface&                                              m_vk;
90
91         vk::Move<vk::VkPipeline>                                                m_pipeline;
92         vk::Move<vk::VkPipelineLayout>                                  m_pipelineLayout;
93
94         de::SharedPtr<Draw::Image>                                              m_colorTargetImage;
95         vk::Move<vk::VkImageView>                                               m_colorTargetView;
96
97         Draw::PipelineCreateInfo::VertexInputState              m_vertexInputState;
98         de::SharedPtr<Draw::Buffer>                                             m_vertexBuffer;
99
100         vk::Move<vk::VkCommandPool>                                             m_cmdPool;
101         vk::Move<vk::VkCommandBuffer>                                   m_cmdBuffer;
102
103         vk::Move<vk::VkFramebuffer>                                             m_framebuffer;
104         vk::Move<vk::VkRenderPass>                                              m_renderPass;
105
106         const std::string                                                               m_vertexShaderName;
107         const std::string                                                               m_fragmentShaderName;
108         std::vector<PositionColorVertex>                                m_data;
109 };
110
111 } // DynamicState
112 } // vkt
113
114 #endif // _VKTDYNAMICSTATEBASECLASS_HPP