• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2021 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 #ifndef BENCHMARKS_WINDOW_HPP_
16 #define BENCHMARKS_WINDOW_HPP_
17 
18 #include "VulkanHeaders.hpp"
19 
20 #if defined(_WIN32)
21 #	define WIN32_LEAN_AND_MEAN
22 #	include <Windows.h>
23 #endif
24 
25 #if USE_HEADLESS_SURFACE
26 class Window
27 {
28 public:
29 	Window(vk::Instance instance, vk::Extent2D windowSize);
30 	~Window();
31 	vk::SurfaceKHR getSurface();
32 	void show();
33 
34 private:
35 	const vk::Instance instance;
36 	vk::SurfaceKHR surface;
37 };
38 
39 #elif defined(_WIN32)
40 
41 class Window
42 {
43 public:
44 	Window(vk::Instance instance, vk::Extent2D windowSize);
45 	~Window();
46 	vk::SurfaceKHR getSurface();
47 	void show();
48 
49 private:
50 	HWND window;
51 	HINSTANCE moduleInstance;
52 	WNDCLASSEX windowClass;
53 	const vk::Instance instance;
54 	vk::SurfaceKHR surface;
55 };
56 
57 #else
58 #	error Window class unimplemented for this platform
59 #endif
60 
61 #endif  // BENCHMARKS_WINDOW_HPP_
62