1 #ifndef _VKTSHADEROBJECTCREATEUTIL_HPP
2 #define _VKTSHADEROBJECTCREATEUTIL_HPP
3 /*------------------------------------------------------------------------
4  * Vulkan Conformance Tests
5  * ------------------------
6  *
7  * Copyright (c) 2023 LunarG, Inc.
8  * Copyright (c) 2023 Nintendo
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 Utilities for vertex buffers.
25  *//*--------------------------------------------------------------------*/
26 
27 #include "vkRef.hpp"
28 #include "vkResourceInterface.hpp"
29 
30 namespace vk
31 {
32 
33 #ifndef CTS_USES_VULKANSC
34 std::string getShaderName(vk::VkShaderStageFlagBits stage);
35 vk::VkShaderStageFlags getShaderObjectNextStages(vk::VkShaderStageFlagBits shaderStage, bool tessellationShaderFeature,
36                                                  bool geometryShaderFeature);
37 
38 Move<vk::VkShaderEXT> createShaderFromBinary(const DeviceInterface &vk, VkDevice device,
39                                              vk::VkShaderStageFlagBits shaderStage, size_t codeSize, const void *pCode,
40                                              bool tessellationShaderFeature, bool geometryShaderFeature,
41                                              vk::VkDescriptorSetLayout descriptorSetLayout);
42 Move<vk::VkShaderEXT> createShader(const DeviceInterface &vk, VkDevice device,
43                                    const vk::VkShaderCreateInfoEXT &shaderCreateInfo);
44 
45 void addBasicShaderObjectShaders(vk::SourceCollections &programCollection);
46 
47 vk::VkShaderCreateInfoEXT makeShaderCreateInfo(vk::VkShaderStageFlagBits stage, const vk::ProgramBinary &programBinary,
48                                                bool tessellationShaderFeature, bool geometryShaderFeature,
49                                                const vk::VkDescriptorSetLayout *descriptorSetLayout = DE_NULL);
50 void setDefaultShaderObjectDynamicStates(const vk::DeviceInterface &vk, vk::VkCommandBuffer cmdBuffer,
51                                          const std::vector<std::string> &deviceExtensions,
52                                          vk::VkPrimitiveTopology topology = vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP,
53                                          bool meshShader = false, bool setViewport = false);
54 void bindGraphicsShaders(const vk::DeviceInterface &vk, vk::VkCommandBuffer cmdBuffer, vk::VkShaderEXT vertShader,
55                          vk::VkShaderEXT tescShader, vk::VkShaderEXT teseShader, vk::VkShaderEXT geomShader,
56                          vk::VkShaderEXT fragShader, bool taskShaderSupported, bool meshShaderSupported);
57 void bindComputeShader(const vk::DeviceInterface &vk, vk::VkCommandBuffer cmdBuffer, vk::VkShaderEXT compShader);
58 void bindNullTaskMeshShaders(const vk::DeviceInterface &vk, vk::VkCommandBuffer cmdBuffer,
59                              vk::VkPhysicalDeviceMeshShaderFeaturesEXT meshShaderFeatures);
60 void bindNullRasterizationShaders(const vk::DeviceInterface &vk, vk::VkCommandBuffer cmdBuffer,
61                                   vk::VkPhysicalDeviceFeatures features);
62 #endif
63 
64 } // namespace vk
65 
66 #endif // _VKTSHADEROBJECTCREATEUTIL_HPP
67