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 
102  struct StereoState {
103  StereoState() {}
104  bool isStereo() const {
105  return _enable && !_contextDisable;
106  }
107  bool _enable{ false };
108  bool _contextDisable { false };
109  bool _skybox{ false };
110  // 0 for left eye, 1 for right eye
111  uint8 _pass{ 0 };
112  Mat4 _eyeViews[2];
113  Mat4 _eyeProjections[2];
114  };
115 
116  class Serializer;
117  class Deserializer;
118 
119  class GPUObject {
120  public:
121  virtual ~GPUObject() = default;
122  };
123 
124  class GPUObjectPointer {
125  private:
126  using GPUObjectUniquePointer = std::unique_ptr<GPUObject>;
127 
128  // This shouldn't be used by anything else than the Backend class with the proper casting.
129  mutable GPUObjectUniquePointer _gpuObject;
130  void setGPUObject(GPUObject* gpuObject) const { _gpuObject.reset(gpuObject); }
131  GPUObject* getGPUObject() const { return _gpuObject.get(); }
132 
133  friend class Backend;
134  friend class vk::VKBackend;
135  friend class Texture;
136  };
137 
138  namespace gl {
139  class GLBackend;
140  class GLBuffer;
141  }
142 
143  namespace gl41 {
144  class GL41Backend;
145  class GL41Buffer;
146  }
147 
148  namespace gl45 {
149  class GL45Backend;
150  class GL45Buffer;
151  }
152 
153  namespace gles {
154  class GLESBackend;
155  class GLESBuffer;
156  }
157 
158 }
159 
160 #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