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,
41 #ifdef CTS_USES_VULKANSC
42 ctx.getResourceInterface(),
43 #endif // CTS_USES_VULKANSC
44 ctx.getTestContext().getCommandLine()))
45 , m_deviceDriver (m_context.getPlatformInterface(), m_instance, *m_device)
46 , m_allocator (createAllocator())
47 , m_queue (getProtectedQueue(m_deviceDriver, *m_device, m_queueFamilyIndex, 0))
48 {
49 }
50
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)51 ProtectedContext::ProtectedContext (Context& ctx,
52 vk::wsi::Type wsiType,
53 vk::wsi::Display& display,
54 vk::wsi::Window& window,
55 const std::vector<std::string> instanceExtensions,
56 const std::vector<std::string> deviceExtensions)
57 : m_context (ctx)
58 , m_interface (m_context.getPlatformInterface())
59 , m_instance (makeProtectedMemInstance(m_context, instanceExtensions))
60 , m_vki (m_instance.getDriver())
61 , m_phyDevice (vk::chooseDevice(m_vki, m_instance, m_context.getTestContext().getCommandLine()))
62 , m_surface (vk::wsi::createSurface(m_vki, m_instance, wsiType, display, window, m_context.getTestContext().getCommandLine()))
63 , m_queueFamilyIndex (chooseProtectedMemQueueFamilyIndex(m_vki, m_phyDevice, *m_surface))
64 , m_device (makeProtectedMemDevice(m_interface, m_instance, m_vki, m_phyDevice, m_queueFamilyIndex, ctx.getUsedApiVersion(), deviceExtensions,
65 #ifdef CTS_USES_VULKANSC
66 ctx.getResourceInterface(),
67 #endif // CTS_USES_VULKANSC
68 ctx.getTestContext().getCommandLine()))
69 , m_deviceDriver (m_interface, m_instance, *m_device)
70 , m_allocator(createAllocator())
71 , m_queue (getProtectedQueue(m_deviceDriver, *m_device, m_queueFamilyIndex, 0))
72 {
73 }
74
75 } // ProtectedMem
76 } // vkt
77