Overte C++ Documentation
NullBackend.h
1 //
2 // Created by Bradley Austin Davis on 2016/05/16
3 // Copyright 2014 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 #ifndef hifi_gpu_Null_Backend_h
9 #define hifi_gpu_Null_Backend_h
10 
11 #include <assert.h>
12 #include <functional>
13 #include <bitset>
14 #include <queue>
15 #include <utility>
16 #include <list>
17 #include <array>
18 
19 #include <QtCore/QLoggingCategory>
20 
21 #include "../Context.h"
22 
23 namespace gpu { namespace null {
24 
25 class Backend : public gpu::Backend {
26  using Parent = gpu::Backend;
27  // Context Backend static interface required
28  friend class gpu::Context;
29  static void init() {}
30  static gpu::Backend* createBackend() { return new Backend(); }
31 
32 protected:
33  explicit Backend(bool syncCache) : Parent() { }
34  Backend() : Parent() { }
35 public:
36  ~Backend() { }
37 
38  void render(const Batch& batch) final { }
39 
40  // This call synchronize the Full Backend cache with the current GLState
41  // THis is only intended to be used when mixing raw gl calls with the gpu api usage in order to sync
42  // the gpu::Backend state with the true gl state which has probably been messed up by these ugly naked gl calls
43  // Let's try to avoid to do that as much as possible!
44  void syncCache() final { }
45 
46  void syncProgram(const gpu::ShaderPointer& program) final {}
47 
48  // This is the ugly "download the pixels to sysmem for taking a snapshot"
49  // Just avoid using it, it's ugly and will break performances
50  virtual void downloadFramebuffer(const FramebufferPointer& srcFramebuffer, const Vec4i& region, QImage& destImage) final { }
51 };
52 
53 } }
54 
55 #endif