[Vulkan] Basic Vulkan backend
[platform/core/uifw/dali-core.git] / dali / graphics / vulkan / gpu-memory / vulkan-gpu-memory-handle.cpp
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #include <dali/graphics/vulkan/gpu-memory/vulkan-gpu-memory-handle.h>
19 #include <dali/graphics/vulkan/gpu-memory/vulkan-gpu-memory-allocator.h>
20
21 namespace Dali
22 {
23 namespace Graphics
24 {
25 namespace Vulkan
26 {
27
28 void GpuMemoryBlock::OnRelease( uint32_t refcount )
29 {
30   mAllocator.Release( *this );
31 }
32
33 void GpuMemoryBlock::OnRetain( uint32_t refcount )
34 {
35   mAllocator.Retain( *this );
36 }
37
38 bool GpuMemoryBlock::OnDestroy()
39 {
40   // don't use default delete
41   return true;
42 }
43
44 GpuMemoryBlock::operator vk::DeviceMemory()
45 {
46   return mAllocator.GetVkDeviceMemory( *this );
47 }
48
49 void* GpuMemoryBlock::Map()
50 {
51   return mAllocator.Map( *this, 0, 0 );
52 }
53
54 void* GpuMemoryBlock::Map( uint32_t offset, uint32_t size )
55 {
56   return mAllocator.Map( *this, offset, size );
57 }
58
59 void GpuMemoryBlock::Unmap()
60 {
61   mAllocator.Unmap( *this );
62 }
63
64 void GpuMemoryBlock::Flush()
65 {
66   NotImplemented();
67 }
68
69 }
70
71 }
72
73 }