• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _VKDEBUGREPORTUTIL_HPP
2 #define _VKDEBUGREPORTUTIL_HPP
3 /*-------------------------------------------------------------------------
4  * Vulkan CTS Framework
5  * --------------------
6  *
7  * Copyright (c) 2016 Google Inc.
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  *//*!
22  * \file
23  * \brief VK_EXT_debug_report utilities
24  *//*--------------------------------------------------------------------*/
25 
26 #include "vkDefs.hpp"
27 #include "vkRef.hpp"
28 #include "deAppendList.hpp"
29 
30 #include <ostream>
31 
32 namespace vk
33 {
34 
35 struct DebugReportMessage
36 {
37 	VkDebugReportFlagsEXT		flags;
38 	VkDebugReportObjectTypeEXT	objectType;
39 	deUint64					object;
40 	size_t						location;
41 	deInt32						messageCode;
42 	std::string					layerPrefix;
43 	std::string					message;
44 
DebugReportMessagevk::DebugReportMessage45 	DebugReportMessage (void)
46 		: flags			(0)
47 		, objectType	((VkDebugReportObjectTypeEXT)0)
48 		, object		(0)
49 		, location		(0)
50 		, messageCode	(0)
51 	{}
52 
DebugReportMessagevk::DebugReportMessage53 	DebugReportMessage (VkDebugReportFlagsEXT		flags_,
54 						VkDebugReportObjectTypeEXT	objectType_,
55 						deUint64					object_,
56 						size_t						location_,
57 						deInt32						messageCode_,
58 						const std::string&			layerPrefix_,
59 						const std::string&			message_)
60 		: flags			(flags_)
61 		, objectType	(objectType_)
62 		, object		(object_)
63 		, location		(location_)
64 		, messageCode	(messageCode_)
65 		, layerPrefix	(layerPrefix_)
66 		, message		(message_)
67 	{}
68 };
69 
70 std::ostream&	operator<<	(std::ostream& str, const DebugReportMessage& message);
71 
72 class DebugReportRecorder
73 {
74 public:
75 	typedef de::AppendList<DebugReportMessage>	MessageList;
76 
77 											DebugReportRecorder		(const InstanceInterface& vki, VkInstance instance);
78 											~DebugReportRecorder	(void);
79 
getMessages(void) const80 	const MessageList&						getMessages				(void) const { return m_messages; }
clearMessages(void)81 	void									clearMessages			(void) { m_messages.clear(); }
82 
83 private:
84 	MessageList								m_messages;
85 	const Unique<VkDebugReportCallbackEXT>	m_callback;
86 };
87 
88 bool	isDebugReportSupported		(const PlatformInterface& vkp);
89 
90 } // vk
91 
92 #endif // _VKDEBUGREPORTUTIL_HPP
93