• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*------------------------------------------------------------------------
2  * Vulkan Conformance Tests
3  * ------------------------
4  *
5  * Copyright (c) 2017 The Khronos Group Inc.
6  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  *//*!
21  * \file
22  * \brief Protected Memory
23  *//*--------------------------------------------------------------------*/
24 #include "vktProtectedMemContext.hpp"
25 
26 namespace vkt
27 {
28 namespace ProtectedMem
29 {
30 
ProtectedContext(Context & ctx,const std::vector<std::string> instanceExtensions,const std::vector<std::string> deviceExtensions)31 ProtectedContext::ProtectedContext	(Context&						ctx,
32 									 const std::vector<std::string>	instanceExtensions,
33 									 const std::vector<std::string>	deviceExtensions)
34 	: m_context				(ctx)
35 	, m_interface			(m_context.getPlatformInterface())
36 	, m_instance			(makeProtectedMemInstance(m_context, instanceExtensions))
37 	, m_vki					(m_instance.getDriver())
38 	, m_phyDevice			(vk::chooseDevice(m_vki, m_instance, m_context.getTestContext().getCommandLine()))
39 	, m_queueFamilyIndex	(chooseProtectedMemQueueFamilyIndex(m_vki, m_phyDevice))
40 	, m_device				(makeProtectedMemDevice(m_interface, m_instance, m_vki, m_phyDevice, m_queueFamilyIndex, ctx.getUsedApiVersion(), deviceExtensions, m_context.getTestContext().getCommandLine().isValidationEnabled()))
41 	, m_deviceDriver		(m_context.getPlatformInterface(), m_instance, *m_device)
42 	, m_allocator			(createAllocator())
43 	, m_queue				(getProtectedQueue(m_deviceDriver, *m_device, m_queueFamilyIndex, 0))
44 {
45 }
46 
ProtectedContext(Context & ctx,vk::wsi::Type wsiType,vk::wsi::Display & display,vk::wsi::Window & window,const std::vector<std::string> instanceExtensions,const std::vector<std::string> deviceExtensions)47 ProtectedContext::ProtectedContext	(Context&						ctx,
48 									 vk::wsi::Type					wsiType,
49 									 vk::wsi::Display&				display,
50 									 vk::wsi::Window&				window,
51 									 const std::vector<std::string>	instanceExtensions,
52 									 const std::vector<std::string>	deviceExtensions)
53 	: m_context				(ctx)
54 	, m_interface			(m_context.getPlatformInterface())
55 	, m_instance			(makeProtectedMemInstance(m_context, instanceExtensions))
56 	, m_vki					(m_instance.getDriver())
57 	, m_phyDevice			(vk::chooseDevice(m_vki, m_instance, m_context.getTestContext().getCommandLine()))
58 	, m_surface				(vk::wsi::createSurface(m_vki, m_instance, wsiType, display, window))
59 	, m_queueFamilyIndex	(chooseProtectedMemQueueFamilyIndex(m_vki, m_phyDevice, *m_surface))
60 	, m_device				(makeProtectedMemDevice(m_interface, m_instance, m_vki, m_phyDevice, m_queueFamilyIndex, ctx.getUsedApiVersion(), deviceExtensions, m_context.getTestContext().getCommandLine().isValidationEnabled()))
61 	, m_deviceDriver		(m_interface, m_instance, *m_device)
62 	, m_allocator(createAllocator())
63 	, m_queue				(getProtectedQueue(m_deviceDriver, *m_device, m_queueFamilyIndex, 0))
64 {
65 }
66 
67 } // ProtectedMem
68 } // vkt
69