Overte C++ Documentation
gpu/src/gpu/Forward.h
1 //
2 // Created by Bradley Austin Davis on 2015/08/15
3 // Copyright 2015 High Fidelity, Inc.
4 //
5 // Distributed under the Apache License, Version 2.0.
6 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
7 //
8 #pragma once
9 #ifndef hifi_gpu_Forward_h
10 #define hifi_gpu_Forward_h
11 
12 #include <stdint.h>
13 #include <memory>
14 #include <mutex>
15 #include <vector>
16 
17 #include <glm/glm.hpp>
18 
19 namespace gpu {
20  using Mutex = std::mutex;
21  using Lock = std::unique_lock<Mutex>;
22 
23  class Batch;
24  using BatchPointer = std::shared_ptr<Batch>;
25  class Backend;
26  using BackendPointer = std::shared_ptr<Backend>;
27  class Context;
28  using ContextPointer = std::shared_ptr<Context>;
29  class GPUObject;
30  class Frame;
31  using FramePointer = std::shared_ptr<Frame>;
32 
33  using Stamp = int;
34  using uint32 = uint32_t;
35  using int32 = int32_t;
36  using uint16 = uint16_t;
37  using int16 = int16_t;
38  using uint8 = uint8_t;
39  using int8 = int8_t;
40 
41  using Byte = uint8;
42  using Size = size_t;
43  static const Size INVALID_SIZE = (Size)-1;
44 
45  using Offset = size_t;
46  using Offsets = std::vector<Offset>;
47 
48  using Mat4 = glm::mat4;
49  using Mat3 = glm::mat3;
50  using Vec4 = glm::vec4;
51  using Vec4i = glm::ivec4;
52  using Vec3 = glm::vec3;
53  using Vec2 = glm::vec2;
54  using Vec2i = glm::ivec2;
55  using Vec2u = glm::uvec2;
56  using Vec3u = glm::uvec3;
57  using Vec3u = glm::uvec3;
58 
59  class Element;
60  using Format = Element;
61  class Swapchain;
62  using SwapchainPointer = std::shared_ptr<Swapchain>;
63  class Framebuffer;
64  using FramebufferPointer = std::shared_ptr<Framebuffer>;
65  class Pipeline;
66  using PipelinePointer = std::shared_ptr<Pipeline>;
67  using Pipelines = std::vector<PipelinePointer>;
68  class Query;
69  using QueryPointer = std::shared_ptr<Query>;
70  using Queries = std::vector<QueryPointer>;
71  class Resource;
72  class Buffer;
73  using BufferPointer = std::shared_ptr<Buffer>;
74  using Buffers = std::vector<BufferPointer>;
75  class BufferView;
76  class Shader;
77  using ShaderPointer = std::shared_ptr<Shader>;
78  using Shaders = std::vector<ShaderPointer>;
79  class State;
80  using StatePointer = std::shared_ptr<State>;
81  using States = std::vector<StatePointer>;
82  class Stream;
83  class BufferStream;
84  using BufferStreamPointer = std::shared_ptr<BufferStream>;
85  class Texture;
86  class SphericalHarmonics;
87  using SHPointer = std::shared_ptr<SphericalHarmonics>;
88  class Texture;
89  using TexturePointer = std::shared_ptr<Texture>;
90  using TextureWeakPointer = std::weak_ptr<Texture>;
91  using Textures = std::vector<TexturePointer>;
92  class TextureView;
93  using TextureViews = std::vector<TextureView>;
94  class TextureTable;
95  using TextureTablePointer = std::shared_ptr<TextureTable>;
96 
97  namespace vk {
98  class VKBackend;
99  class VKBuffer;
100  }
101 
105  struct StereoState {
106  StereoState() {}
107  bool isStereo() const {
108  return _enable && !_contextDisable;
109  }
110  bool _enable{ false };
111  bool _contextDisable { false };
112  bool _skybox{ false };
113  // 0 for left eye, 1 for right eye
114  uint8 _pass{ 0 };
115  Mat4 _eyeViews[2];
116  Mat4 _eyeProjections[2];
117  };
118 
119  class Serializer;
120  class Deserializer;
121 
126  class GPUObject {
127  public:
128  virtual ~GPUObject() = default;
129  };
130 
135  private:
136  using GPUObjectUniquePointer = std::unique_ptr<GPUObject>;
137 
142  mutable GPUObjectUniquePointer _gpuObject;
143 
150  void setGPUObject(GPUObject* gpuObject) const { _gpuObject.reset(gpuObject); }
151 
155  GPUObject* getGPUObject() const { return _gpuObject.get(); }
156 
157  friend class Backend;
158  friend class vk::VKBackend;
159  friend class Texture;
160  };
161 
162  namespace gl {
163  class GLBackend;
164  class GLBuffer;
165  }
166 
167  namespace gl41 {
168  class GL41Backend;
169  class GL41Buffer;
170  }
171 
172  namespace gl45 {
173  class GL45Backend;
174  class GL45Buffer;
175  }
176 
177  namespace gles {
178  class GLESBackend;
179  class GLESBuffer;
180  }
181 
182 }
183 
184 #endif
Provides the Mat4 scripting interface.
Definition: Mat4.h:44
Base class for resources.
Definition: ResourceCache.h:415
A simple object wrapper for an OpenGL texture.
Definition: material-networking/src/material-networking/TextureCache.h:39
Provides the Vec3 scripting interface.
Definition: Vec3.h:80
Definition: gpu/src/gpu/Forward.h:126
Definition: gpu/src/gpu/Forward.h:134
Definition: gpu/src/gpu/Forward.h:105