12 #ifndef hifi_gpu_Backend_h
13 #define hifi_gpu_Backend_h
15 #include <GLMHelpers.h>
20 #include "Framebuffer.h"
29 int _ISNumFormatChanges = 0;
30 int _ISNumInputBufferChanges = 0;
31 int _ISNumIndexBufferChanges = 0;
33 int _RSNumResourceBufferBounded = 0;
34 int _RSNumTextureBounded = 0;
35 int _RSAmountTextureMemoryBounded = 0;
37 int _DSNumAPIDrawcalls = 0;
38 int _DSNumDrawcalls = 0;
39 int _DSNumTriangles = 0;
41 int _PSNumSetPipelines = 0;
44 ContextStats(
const ContextStats& stats) =
default;
46 void evalDelta(
const ContextStats& begin,
const ContextStats& end);
53 virtual void shutdown() {}
54 virtual const std::string& getVersion()
const = 0;
56 void setStereoState(
const StereoState& stereo);
65 virtual void executeFrame(
const FramePointer& frame) = 0;
74 virtual void render(
const Batch& batch) = 0;
80 virtual void syncCache() = 0;
87 virtual void syncProgram(
const gpu::ShaderPointer& program) = 0;
93 virtual void recycle()
const = 0;
102 virtual void downloadFramebuffer(
const FramebufferPointer& srcFramebuffer,
const Vec4i& region, QImage& destImage) = 0;
114 virtual void updatePresentFrame(
const Mat4& correction =
Mat4(),
bool primary =
true) = 0;
122 virtual bool supportedTextureFormat(
const gpu::Element& format)
const = 0;
125 #include "TransformCamera_shared.slh"
167 Vec2 normalizedJitter)
const;
177 template <
typename T,
typename U>
178 static void setGPUObject(
const U&
object, T* gpuObject) {
179 object.gpuObject.setGPUObject(gpuObject);
189 template <
typename T,
typename U>
190 static T* getGPUObject(
const U&
object) {
191 return reinterpret_cast<T*
>(
object.gpuObject.getGPUObject());
198 void resetStats()
const { _stats = ContextStats(); }
204 void getStats(ContextStats& stats)
const { stats = _stats; }
210 virtual bool isTextureManagementSparseEnabled()
const = 0;
214 static ContextMetricSize freeGPUMemSize;
216 static ContextMetricCount bufferCount;
217 static ContextMetricSize bufferGPUMemSize;
219 static ContextMetricCount textureResidentCount;
220 static ContextMetricCount textureFramebufferCount;
221 static ContextMetricCount textureResourceCount;
222 static ContextMetricCount textureExternalCount;
224 static ContextMetricSize textureResidentGPUMemSize;
225 static ContextMetricSize textureFramebufferGPUMemSize;
226 static ContextMetricSize textureResourceGPUMemSize;
227 static ContextMetricSize textureExternalGPUMemSize;
229 static ContextMetricCount texturePendingGPUTransferCount;
230 static ContextMetricSize texturePendingGPUTransferMemSize;
231 static ContextMetricSize textureResourcePopulatedGPUMemSize;
232 static ContextMetricSize textureResourceIdealGPUMemSize;
235 virtual bool isStereo()
const {
236 return _stereo.isStereo();
239 void getStereoProjections(mat4* eyeProjections)
const {
240 for (
int i = 0; i < 2; ++i) {
241 eyeProjections[i] = _stereo._eyeProjections[i];
245 void getStereoViews(mat4* eyeViews)
const {
246 for (
int i = 0; i < 2; ++i) {
247 eyeViews[i] = _stereo._eyeViews[i];
251 friend class Context;
252 mutable ContextStats _stats;
254 StereoState _prevStereo;
Provides the Mat4 scripting interface.
Definition: Mat4.h:44
Definition: gpu/src/gpu/Forward.h:105