Overte C++ Documentation
Renderpass.h
1 //
2 // Created by Bradley Austin Davis on 2018/10/21
3 // Copyright 2013-2018 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_Renderpass_h
10 #define hifi_gpu_Renderpass_h
11 
12 #include <assert.h>
13 #include <memory>
14 #include <functional>
15 #include <vector>
16 #include <string>
17 
18 #include "Format.h"
19 
20 namespace gpu {
21 
22 enum class LoadOp
23 {
24  Load = 0,
25  Clear = 1,
26  DontCare = 2,
27 };
28 
29 enum class StoreOp
30 {
31  Store = 0,
32  DontCare = 1,
33 };
34 
35 struct Attachment {
36  Attachment();
37  Attachment(const Element& element, LoadOp loadOp, StoreOp storeOp, LoadOp stencilLoadOp = LoadOp::DontCare, StoreOp stencilStoreOp = StoreOp::DontCare);
38  Element element;
39  LoadOp loadOp{ LoadOp::DontCare };
40  StoreOp storeOp{ StoreOp::DontCare };
41  LoadOp stencilLoadOp{ LoadOp::DontCare };
42  StoreOp stencilStoreOp{ StoreOp::DontCare };
43 
44  uint32_t getRaw() const;
45  void setRaw(uint32_t raw);
46 };
47 
48 class Renderpass {
49 public:
50  using Attachments = std::vector<Attachment>;
51 
52  Renderpass();
53  virtual ~Renderpass();
54 
55  void addColorAttachment(const Element& element, LoadOp load, StoreOp store);
56  void setDepthStencilAttachment(const Element& element, LoadOp load, StoreOp store, LoadOp stencilLoadOp = LoadOp::DontCare, StoreOp stencilStoreOp = StoreOp::DontCare);
57 
58 protected:
59  Attachments _colorAttachments;
60  Attachment _depthStencilAttachment;
61  // TODO if we want to start working with input attachments and multisampling resolve attachments, we'll need to extend this class
62 };
63 
64 } // namespace gpu
65 
66 #endif