• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _VKSJSON_HPP
2 #define _VKSJSON_HPP
3 
4 /*-------------------------------------------------------------------------
5  * Vulkan CTS Framework
6  * --------------------
7  *
8  * Copyright (c) 2021 The Khronos Group Inc.
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 
24 #include "vksCommon.hpp"
25 
26 #include "vkPrograms.hpp"
27 
28 #include "vkDefs.hpp"
29 using namespace vk;
30 
31 namespace Json
32 {
33 	class CharReader;
34 }
35 
36 namespace vksc_server
37 {
38 
39 struct VulkanPipelineStatistics;
40 
41 namespace json
42 {
43 
44 struct Context
45 {
46 	Context();
47 	~Context();
48 	std::unique_ptr<Json::CharReader> reader;
49 };
50 
51 void	runGarbageCollection								();
52 
53 string	writeJSON_VkGraphicsPipelineCreateInfo				(const vk::VkGraphicsPipelineCreateInfo&		pCreateInfo);
54 string	writeJSON_VkComputePipelineCreateInfo				(const vk::VkComputePipelineCreateInfo&			pCreateInfo);
55 string	writeJSON_VkRenderPassCreateInfo					(const vk::VkRenderPassCreateInfo&				pCreateInfo);
56 string	writeJSON_VkRenderPassCreateInfo2					(const vk::VkRenderPassCreateInfo2&				pCreateInfo);
57 string	writeJSON_VkPipelineLayoutCreateInfo				(const vk::VkPipelineLayoutCreateInfo&			pCreateInfo);
58 string	writeJSON_VkDescriptorSetLayoutCreateInfo			(const vk::VkDescriptorSetLayoutCreateInfo&		pCreateInfo);
59 string	writeJSON_VkSamplerCreateInfo						(const vk::VkSamplerCreateInfo&					pCreateInfo);
60 string	writeJSON_VkSamplerYcbcrConversionCreateInfo		(const vk::VkSamplerYcbcrConversionCreateInfo&	pCreateInfo);
61 string	writeJSON_VkShaderModuleCreateInfo					(const vk::VkShaderModuleCreateInfo&			smCI);
62 string	writeJSON_VkDeviceObjectReservationCreateInfo		(const vk::VkDeviceObjectReservationCreateInfo&	dmrCI);
63 string	writeJSON_VkPipelineOfflineCreateInfo				(const vk::VkPipelineOfflineCreateInfo&			piInfo);
64 string	writeJSON_GraphicsPipeline_vkpccjson				(const std::string&																		filePrefix,
65 															 deUint32																				pipelineIndex,
66 															 const vk::VkPipelineOfflineCreateInfo													id,
67 															 const vk::VkGraphicsPipelineCreateInfo&												gpCI,
68 															 const vk::VkPhysicalDeviceFeatures2&													deviceFeatures2,
69 															 const std::vector<std::string>&														deviceExtensions,
70 															 const std::map<vk::VkSamplerYcbcrConversion, vk::VkSamplerYcbcrConversionCreateInfo>&	samplerYcbcrConversions,
71 															 const std::map<vk::VkSampler, vk::VkSamplerCreateInfo>&								samplers,
72 															 const std::map<vk::VkDescriptorSetLayout, vk::VkDescriptorSetLayoutCreateInfo>&		descriptorSetLayouts,
73 															 const std::map<vk::VkRenderPass, vk::VkRenderPassCreateInfo>&							renderPasses,
74 															 const std::map<vk::VkRenderPass, vk::VkRenderPassCreateInfo2>&							renderPasses2,
75 															 const std::map<vk::VkPipelineLayout, vk::VkPipelineLayoutCreateInfo>&					pipelineLayouts);
76 string	writeJSON_ComputePipeline_vkpccjson					(const std::string&																		filePrefix,
77 															 deUint32																				pipelineIndex,
78 															 const vk::VkPipelineOfflineCreateInfo													id,
79 															 const vk::VkComputePipelineCreateInfo&													cpCI,
80 															 const vk::VkPhysicalDeviceFeatures2&													deviceFeatures2,
81 															 const std::vector<std::string>&														deviceExtensions,
82 															 const std::map<vk::VkSamplerYcbcrConversion, vk::VkSamplerYcbcrConversionCreateInfo>&	samplerYcbcrConversions,
83 															 const std::map<vk::VkSampler, vk::VkSamplerCreateInfo>&								samplers,
84 															 const std::map<vk::VkDescriptorSetLayout, vk::VkDescriptorSetLayoutCreateInfo>&		descriptorSetLayouts,
85 															 const std::map<vk::VkPipelineLayout, vk::VkPipelineLayoutCreateInfo>&					pipelineLayouts);
86 string	writeJSON_VkPhysicalDeviceFeatures2					(const vk::VkPhysicalDeviceFeatures2&			features);
87 string	writeJSON_pNextChain								(const void*			pNext);
88 
89 void	readJSON_VkGraphicsPipelineCreateInfo				(Context&									context,
90 															 const string&								graphicsPipelineCreateInfo,
91 															 vk::VkGraphicsPipelineCreateInfo&			gpCI);
92 void	readJSON_VkComputePipelineCreateInfo				(Context&									context,
93 															 const string&								computePipelineCreateInfo,
94 															 vk::VkComputePipelineCreateInfo&			cpCI);
95 void	readJSON_VkRenderPassCreateInfo						(Context&									context,
96 															 const string&								renderPassCreateInfo,
97 															 vk::VkRenderPassCreateInfo&				rpCI);
98 void	readJSON_VkRenderPassCreateInfo2					(Context&									context,
99 															 const string&								renderPassCreateInfo,
100 															 vk::VkRenderPassCreateInfo2&				rpCI);
101 void	readJSON_VkDescriptorSetLayoutCreateInfo			(Context&									context,
102 															 const string&								descriptorSetLayoutCreateInfo,
103 															 vk::VkDescriptorSetLayoutCreateInfo&		dsCI);
104 void	readJSON_VkPipelineLayoutCreateInfo					(Context&									context,
105 															 const string&								pipelineLayoutCreateInfo,
106 															 vk::VkPipelineLayoutCreateInfo&			plCI);
107 void	readJSON_VkShaderModuleCreateInfo					(Context&									context,
108 															 const string&								shaderModuleCreate,
109 															 vk::VkShaderModuleCreateInfo&				smCI,
110 															 vector<deUint8>&							spirvShader);
111 void	readJSON_VkDeviceObjectReservationCreateInfo		(Context&									context,
112 															 const string&								deviceMemoryReservation,
113 															 vk::VkDeviceObjectReservationCreateInfo&	dmrCI);
114 void	readJSON_VkPipelineOfflineCreateInfo				(Context&									context,
115 															 const string&								pipelineIdentifierInfo,
116 															 vk::VkPipelineOfflineCreateInfo&			piInfo);
117 void	readJSON_VkSamplerCreateInfo						(Context&									context,
118 															 const string&								samplerCreateInfo,
119 															 vk::VkSamplerCreateInfo&					sCI);
120 void	readJSON_VkSamplerYcbcrConversionCreateInfo			(Context&									context,
121 															 const std::string&							samplerYcbcrConversionCreateInfo,
122 															 vk::VkSamplerYcbcrConversionCreateInfo&	sycCI);
123 void	readJSON_VkPhysicalDeviceFeatures2					(Context&									context,
124 															 const std::string&							featuresJson,
125 															 vk::VkPhysicalDeviceFeatures2&				features);
126 void*	readJSON_pNextChain									(Context&									context,
127 															 const std::string&							chainJson);
128 
129 }
130 
131 }
132 
133 #endif // _VKSJSON_HPP
134