Diligent Engine  v.2.4.g
AsyncWritableResource.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2019-2021 Diligent Graphics LLC
3  * Copyright 2015-2019 Egor Yusov
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * In no event and under no legal theory, whether in tort (including negligence),
18  * contract, or otherwise, unless required by applicable law (such as deliberate
19  * and grossly negligent acts) or agreed to in writing, shall any Contributor be
20  * liable for any damages, including any direct, indirect, special, incidental,
21  * or consequential damages of any character arising as a result of this License or
22  * out of the use or inability to use the software (including but not limited to damages
23  * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
24  * all other commercial damages or losses), even if such Contributor has been advised
25  * of the possibility of such damages.
26  */
27 
28 #pragma once
29 
30 namespace Diligent
31 {
32 
34 {
37 
38  // Buffer barriers.
39  // Driver does not handle buffer write access in shader and write/read access to a persistent mapped memory.
43  MEMORY_BARRIER_BUFFER_UPDATE = GL_BUFFER_UPDATE_BARRIER_BIT, // map/storage -> host read/write/map or copy
44  MEMORY_BARRIER_CLIENT_MAPPED_BUFFER = GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT, // map/storage -> map, only for persistent mapped memory without GL_MAP_COHERENT_BIT
47  MEMORY_BARRIER_TEXEL_BUFFER = GL_TEXTURE_FETCH_BARRIER_BIT, // map/storage -> texel buffer fetch
48  MEMORY_BARRIER_PIXEL_BUFFER = GL_PIXEL_BUFFER_BARRIER_BIT, // map/storage -> copy to/from texture
60 
61 
62  // Texture barriers
65  MEMORY_BARRIER_TEXTURE_UPDATE = GL_TEXTURE_UPDATE_BARRIER_BIT, // storage -> host read/write or copy
72 };
74 
75 
77 {
78 public:
79  AsyncWritableResource() noexcept {}
80 
81  void SetPendingMemoryBarriers(MEMORY_BARRIER Barriers) { m_PendingMemoryBarriers |= Barriers; }
82  MEMORY_BARRIER GetPendingMemortBarriers() { return m_PendingMemoryBarriers; }
83 
84 private:
85  friend class GLContextState;
86  void ResetPendingMemoryBarriers(MEMORY_BARRIER Barriers) { m_PendingMemoryBarriers = Barriers; }
87  void ClearPendingMemoryBarriers(MEMORY_BARRIER Barriers) { m_PendingMemoryBarriers &= ~Barriers; }
88 
89  MEMORY_BARRIER m_PendingMemoryBarriers = MEMORY_BARRIER_NONE;
90 };
91 
92 } // namespace Diligent
Diligent::MEMORY_BARRIER_TEXTURE_UPDATE
@ MEMORY_BARRIER_TEXTURE_UPDATE
Definition: AsyncWritableResource.hpp:65
Diligent::MEMORY_BARRIER_INDIRECT_BUFFER
@ MEMORY_BARRIER_INDIRECT_BUFFER
Definition: AsyncWritableResource.hpp:46
Diligent::MEMORY_BARRIER_ALL_BUFFER_BARRIERS
@ MEMORY_BARRIER_ALL_BUFFER_BARRIERS
Definition: AsyncWritableResource.hpp:50
GL_SHADER_STORAGE_BARRIER_BIT
#define GL_SHADER_STORAGE_BARRIER_BIT
Definition: GLStubsAndroid.h:568
Diligent::MEMORY_BARRIER_TEXTURE_FETCH
@ MEMORY_BARRIER_TEXTURE_FETCH
Definition: AsyncWritableResource.hpp:63
Diligent::MEMORY_BARRIER_TEXEL_BUFFER
@ MEMORY_BARRIER_TEXEL_BUFFER
Definition: AsyncWritableResource.hpp:47
Diligent::MEMORY_BARRIER_STORAGE_IMAGE
@ MEMORY_BARRIER_STORAGE_IMAGE
Definition: AsyncWritableResource.hpp:64
GL_UNIFORM_BARRIER_BIT
#define GL_UNIFORM_BARRIER_BIT
Definition: GLStubsAndroid.h:538
Diligent::AsyncWritableResource
Definition: AsyncWritableResource.hpp:76
Diligent::AsyncWritableResource::SetPendingMemoryBarriers
void SetPendingMemoryBarriers(MEMORY_BARRIER Barriers)
Definition: AsyncWritableResource.hpp:81
GL_ALL_BARRIER_BITS
#define GL_ALL_BARRIER_BITS
Definition: GLStubsAndroid.h:577
Diligent::MEMORY_BARRIER_CLIENT_MAPPED_BUFFER
@ MEMORY_BARRIER_CLIENT_MAPPED_BUFFER
Definition: AsyncWritableResource.hpp:44
Diligent::MEMORY_BARRIER_PIXEL_BUFFER
@ MEMORY_BARRIER_PIXEL_BUFFER
Definition: AsyncWritableResource.hpp:48
GL_PIXEL_BUFFER_BARRIER_BIT
#define GL_PIXEL_BUFFER_BARRIER_BIT
Definition: GLStubsAndroid.h:550
Diligent::MEMORY_BARRIER_STORAGE_BUFFER
@ MEMORY_BARRIER_STORAGE_BUFFER
Definition: AsyncWritableResource.hpp:45
GL_SHADER_IMAGE_ACCESS_BARRIER_BIT
#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT
Definition: GLStubsAndroid.h:544
Diligent::MEMORY_BARRIER_IMAGE_BUFFER
@ MEMORY_BARRIER_IMAGE_BUFFER
Definition: AsyncWritableResource.hpp:49
Diligent::MEMORY_BARRIER_FRAMEBUFFER
@ MEMORY_BARRIER_FRAMEBUFFER
Definition: AsyncWritableResource.hpp:66
Diligent::DEFINE_FLAG_ENUM_OPERATORS
DEFINE_FLAG_ENUM_OPERATORS(FRUSTUM_PLANE_FLAGS)
GL_BUFFER_UPDATE_BARRIER_BIT
#define GL_BUFFER_UPDATE_BARRIER_BIT
Definition: GLStubsAndroid.h:556
GL_ELEMENT_ARRAY_BARRIER_BIT
#define GL_ELEMENT_ARRAY_BARRIER_BIT
Definition: GLStubsAndroid.h:535
GL_FRAMEBUFFER_BARRIER_BIT
#define GL_FRAMEBUFFER_BARRIER_BIT
Definition: GLStubsAndroid.h:559
Diligent::MEMORY_BARRIER_INDEX_BUFFER
@ MEMORY_BARRIER_INDEX_BUFFER
Definition: AsyncWritableResource.hpp:41
Diligent::MEMORY_BARRIER_UNIFORM_BUFFER
@ MEMORY_BARRIER_UNIFORM_BUFFER
Definition: AsyncWritableResource.hpp:42
Diligent::Uint32
uint32_t Uint32
32-bit unsigned integer
Definition: BasicTypes.h:51
Diligent::MEMORY_BARRIER_VERTEX_BUFFER
@ MEMORY_BARRIER_VERTEX_BUFFER
Definition: AsyncWritableResource.hpp:40
Diligent::MEMORY_BARRIER
MEMORY_BARRIER
Definition: AsyncWritableResource.hpp:33
GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT
#define GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT
Definition: GLStubsAndroid.h:571
Diligent::AsyncWritableResource::AsyncWritableResource
AsyncWritableResource() noexcept
Definition: AsyncWritableResource.hpp:79
Diligent::MEMORY_BARRIER_ALL_TEXTURE_BARRIERS
@ MEMORY_BARRIER_ALL_TEXTURE_BARRIERS
Definition: AsyncWritableResource.hpp:67
Diligent::MEMORY_BARRIER_ALL
@ MEMORY_BARRIER_ALL
Definition: AsyncWritableResource.hpp:36
Diligent::AsyncWritableResource::GetPendingMemortBarriers
MEMORY_BARRIER GetPendingMemortBarriers()
Definition: AsyncWritableResource.hpp:82
GL_TEXTURE_UPDATE_BARRIER_BIT
#define GL_TEXTURE_UPDATE_BARRIER_BIT
Definition: GLStubsAndroid.h:553
GL_COMMAND_BARRIER_BIT
#define GL_COMMAND_BARRIER_BIT
Definition: GLStubsAndroid.h:547
Diligent::GLContextState
Definition: GLContextState.hpp:39
GL_TEXTURE_FETCH_BARRIER_BIT
#define GL_TEXTURE_FETCH_BARRIER_BIT
Definition: GLStubsAndroid.h:541
Diligent::MEMORY_BARRIER_BUFFER_UPDATE
@ MEMORY_BARRIER_BUFFER_UPDATE
Definition: AsyncWritableResource.hpp:43
Diligent::MEMORY_BARRIER_NONE
@ MEMORY_BARRIER_NONE
Definition: AsyncWritableResource.hpp:35
GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT
#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT
Definition: GLStubsAndroid.h:532
Diligent
The library uses Direct3D-style math:
Definition: AdvancedMath.hpp:37