1 // Copyright 2019 The SwiftShader Authors. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //    http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include "VkStringify.hpp"
16 
17 #include "System/Debug.hpp"
18 
19 #include <vulkan/vk_ext_provoking_vertex.h>
20 #include <vulkan/vk_google_filtering_precision.h>
21 #define VULKAN_HPP_NO_EXCEPTIONS
22 #define VULKAN_HPP_NAMESPACE vkhpp
23 #include <vulkan/vulkan.hpp>
24 
25 namespace vk {
26 
Stringify(VkStructureType value)27 std::string Stringify(VkStructureType value)
28 {
29 #ifndef NDEBUG
30 	std::string ret = "";
31 	switch(static_cast<int>(value))
32 	{
33 		case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT:
34 			ret = "PhysicalDeviceProvokingVertexFeaturesEXT";
35 			break;
36 		case VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_PROVOKING_VERTEX_STATE_CREATE_INFO_EXT:
37 			ret = "PipelineRasterizationProvokingVertexStateCreateInfoEXT";
38 			break;
39 		case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_PROPERTIES_EXT:
40 			ret = "PhysicalDeviceProvokingVertexPropertiesEXT";
41 			break;
42 		case VK_STRUCTURE_TYPE_SAMPLER_FILTERING_PRECISION_GOOGLE:
43 			ret = "SamplerFilteringPrecisionGOOGLE";
44 			break;
45 		default:
46 			ret = vkhpp::to_string(static_cast<vkhpp::StructureType>(value));
47 			break;
48 	}
49 
50 	return ret;
51 #else
52 	return std::to_string(static_cast<int>(value));
53 #endif
54 }
55 
56 }  // namespace vk
57