• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _VKSCOMMON_HPP
2 #define _VKSCOMMON_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 <deDefs.h>
25 #include <string>
26 #include <vector>
27 #include <functional>
28 #include <cassert>
29 #include <stdexcept>
30 #include <future>
31 #include <algorithm>
32 
33 namespace vksc_server
34 {
35 
36 using msize = std::size_t;
37 
38 using s32 = deInt32;
39 
40 using u8  = deUint8;
41 using u16 = deUint16;
42 using u32 = deUint32;
43 using u64 = deUint64;
44 
45 using std::string;
46 using std::vector;
47 
48 template <typename R>
is_ready(const std::future<R> & f)49 bool is_ready (const std::future<R>& f)
50 {
51 	return f.wait_for(std::chrono::seconds(1)) == std::future_status::ready;
52 }
53 
54 template <typename T, typename PRED>
remove_erase_if(vector<T> & on,PRED pred)55 vector<T>& remove_erase_if (vector<T>& on, PRED pred)
56 {
57 	on.erase( std::remove_if(on.begin(), on.end(), pred),  on.end() );
58 	return on;
59 }
60 
61 }; // vksc_server
62 
63 #endif // _VKSCOMMON_HPP
64