All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
renderPassState.h
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef HDST_RENDER_PASS_STATE_H
25 #define HDST_RENDER_PASS_STATE_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hdSt/api.h"
29 #include "pxr/imaging/hd/renderPassState.h"
30 #include "pxr/imaging/hgi/graphicsEncoderDesc.h"
31 
32 PXR_NAMESPACE_OPEN_SCOPE
33 
34 typedef boost::shared_ptr<class HdResourceRegistry> HdResourceRegistrySharedPtr;
35 typedef boost::shared_ptr<class HdBufferArrayRange> HdBufferArrayRangeSharedPtr;
36 typedef boost::shared_ptr<class HdStRenderPassState> HdStRenderPassStateSharedPtr;
37 typedef boost::shared_ptr<class HdStShaderCode> HdStShaderCodeSharedPtr;
38 typedef boost::shared_ptr<class HdStLightingShader> HdStLightingShaderSharedPtr;
39 typedef boost::shared_ptr<class HdStRenderPassShader>
40  HdStRenderPassShaderSharedPtr;
41 typedef boost::shared_ptr<class HdSt_FallbackLightingShader>
42  HdSt_FallbackLightingShaderSharedPtr;
43 typedef std::vector<HdStShaderCodeSharedPtr> HdStShaderCodeSharedPtrVector;
44 
52 public:
53  HDST_API
55  HDST_API
56  HdStRenderPassState(HdStRenderPassShaderSharedPtr const &shader);
57  HDST_API
58  virtual ~HdStRenderPassState();
59 
60  HDST_API
61  virtual void
62  Prepare(HdResourceRegistrySharedPtr const &resourceRegistry) override;
63 
76  HDST_API
77  virtual void Bind() override;
78 
79  HDST_API
80  virtual void Unbind() override;
81 
83  HDST_API
84  void SetLightingShader(HdStLightingShaderSharedPtr const &lightingShader);
85  HdStLightingShaderSharedPtr const & GetLightingShader() const {
86  return _lightingShader;
87  }
88 
90  HDST_API
91  void SetRenderPassShader(HdStRenderPassShaderSharedPtr const &renderPassShader);
92  HdStRenderPassShaderSharedPtr const &GetRenderPassShader() const {
93  return _renderPassShader;
94  }
95 
97  HDST_API
98  void SetOverrideShader(HdStShaderCodeSharedPtr const &overrideShader);
99  HdStShaderCodeSharedPtr const &GetOverrideShader() const {
100  return _overrideShader;
101  }
102 
104  HDST_API
105  HdStShaderCodeSharedPtrVector GetShaders() const;
106 
107  HDST_API
108  size_t GetShaderHash() const;
109 
110  // Helper to convert AOV bindings to HgiGraphicsEncoder descriptor
111  HgiGraphicsEncoderDesc MakeGraphicsEncoderDesc() const;
112 
113 private:
114  bool _UseAlphaMask() const;
115 
116  // ---------------------------------------------------------------------- //
117  // Shader Objects
118  // ---------------------------------------------------------------------- //
119  HdStRenderPassShaderSharedPtr _renderPassShader;
120  HdSt_FallbackLightingShaderSharedPtr _fallbackLightingShader;
121  HdStLightingShaderSharedPtr _lightingShader;
122  HdStShaderCodeSharedPtr _overrideShader;
123 
124  HdBufferArrayRangeSharedPtr _renderPassStateBar;
125  size_t _clipPlanesBufferSize;
126  float _alphaThresholdCurrent;
127 };
128 
129 PXR_NAMESPACE_CLOSE_SCOPE
130 
131 #endif // HDST_RENDER_PASS_STATE_H
HDST_API HdStShaderCodeSharedPtrVector GetShaders() const
returns shaders (lighting/renderpass)
virtual HDST_API void Bind() override
Apply the GL states.
HDST_API void SetOverrideShader(HdStShaderCodeSharedPtr const &overrideShader)
override shader
virtual HDST_API void Prepare(HdResourceRegistrySharedPtr const &resourceRegistry) override
Schedule to update renderPassState parameters.
A set of rendering parameters used among render passes.
A set of rendering parameters used among render passes.
Describes the properties to begin a HgiGraphicsEncoder.
HDST_API void SetRenderPassShader(HdStRenderPassShaderSharedPtr const &renderPassShader)
renderpass shader
HDST_API void SetLightingShader(HdStLightingShaderSharedPtr const &lightingShader)
Set lighting shader.