• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_google_filtering_precision.h>
20 #define VULKAN_HPP_NO_EXCEPTIONS
21 #define VULKAN_HPP_NAMESPACE vkhpp
22 #include <vulkan/vulkan.hpp>
23 
24 namespace vk {
25 
Stringify(VkStructureType value)26 std::string Stringify(VkStructureType value)
27 {
28 #ifndef NDEBUG
29 	std::string ret = "";
30 	switch(static_cast<int>(value))
31 	{
32 	case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT:
33 		ret = "PhysicalDeviceProvokingVertexFeaturesEXT";
34 		break;
35 	case VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_PROVOKING_VERTEX_STATE_CREATE_INFO_EXT:
36 		ret = "PipelineRasterizationProvokingVertexStateCreateInfoEXT";
37 		break;
38 	case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_PROPERTIES_EXT:
39 		ret = "PhysicalDeviceProvokingVertexPropertiesEXT";
40 		break;
41 	case VK_STRUCTURE_TYPE_SAMPLER_FILTERING_PRECISION_GOOGLE:
42 		ret = "SamplerFilteringPrecisionGOOGLE";
43 		break;
44 	default:
45 		ret = vkhpp::to_string(static_cast<vkhpp::StructureType>(value));
46 		break;
47 	}
48 
49 	return ret;
50 #else
51 	return std::to_string(static_cast<int>(value));
52 #endif
53 }
54 
Stringify(VkFormat value)55 std::string Stringify(VkFormat value)
56 {
57 #ifndef NDEBUG
58 	return vkhpp::to_string(static_cast<vkhpp::Format>(value));
59 #else
60 	return std::to_string(static_cast<int>(value));
61 #endif
62 }
63 
64 }  // namespace vk
65