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 PXR_IMAGING_HD_ST_RENDER_PASS_STATE_H
25 #define PXR_IMAGING_HD_ST_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/graphicsCmdsDesc.h"
31 
32 #include <memory>
33 
34 PXR_NAMESPACE_OPEN_SCOPE
35 
36 using HdResourceRegistrySharedPtr = std::shared_ptr<class HdResourceRegistry>;
37 using HdStRenderPassStateSharedPtr = std::shared_ptr<class HdStRenderPassState>;
38 
39 using HdBufferArrayRangeSharedPtr = std::shared_ptr<class HdBufferArrayRange>;
40 
41 using HdStShaderCodeSharedPtr = std::shared_ptr<class HdStShaderCode>;
42 using HdStLightingShaderSharedPtr = std::shared_ptr<class HdStLightingShader>;
43 using HdStRenderPassShaderSharedPtr =
44  std::shared_ptr<class HdStRenderPassShader>;
45 using HdSt_FallbackLightingShaderSharedPtr =
46  std::shared_ptr<class HdSt_FallbackLightingShader>;
47 using HdStShaderCodeSharedPtrVector = std::vector<HdStShaderCodeSharedPtr>;
48 class HdRenderIndex;
49 
57 {
58 public:
59  HDST_API
61  HDST_API
62  HdStRenderPassState(HdStRenderPassShaderSharedPtr const &shader);
63  HDST_API
64  ~HdStRenderPassState() override;
65 
66  HDST_API
67  void
68  Prepare(HdResourceRegistrySharedPtr const &resourceRegistry) override;
69 
82  HDST_API
83  void Bind() override;
84 
85  HDST_API
86  void Unbind() override;
87 
89  HDST_API
90  void SetLightingShader(HdStLightingShaderSharedPtr const &lightingShader);
91  HdStLightingShaderSharedPtr const & GetLightingShader() const {
92  return _lightingShader;
93  }
94 
96  HDST_API
97  void SetRenderPassShader(HdStRenderPassShaderSharedPtr const &renderPassShader);
98  HdStRenderPassShaderSharedPtr const &GetRenderPassShader() const {
99  return _renderPassShader;
100  }
101 
103  HDST_API
104  void SetOverrideShader(HdStShaderCodeSharedPtr const &overrideShader);
105  HdStShaderCodeSharedPtr const &GetOverrideShader() const {
106  return _overrideShader;
107  }
108 
110  HDST_API
111  HdStShaderCodeSharedPtrVector GetShaders() const;
112 
113  HDST_API
114  size_t GetShaderHash() const;
115 
116  // Helper to get graphics cmds descriptor describing textures
117  // we render into and the blend state, constructed from
118  // AOV bindings.
119  //
120  HDST_API
121  HgiGraphicsCmdsDesc MakeGraphicsCmdsDesc(const HdRenderIndex *) const;
122 
123 private:
124  bool _UseAlphaMask() const;
125 
126  // ---------------------------------------------------------------------- //
127  // Shader Objects
128  // ---------------------------------------------------------------------- //
129  HdStRenderPassShaderSharedPtr _renderPassShader;
130  HdSt_FallbackLightingShaderSharedPtr _fallbackLightingShader;
131  HdStLightingShaderSharedPtr _lightingShader;
132  HdStShaderCodeSharedPtr _overrideShader;
133 
134  HdBufferArrayRangeSharedPtr _renderPassStateBar;
135  size_t _clipPlanesBufferSize;
136  float _alphaThresholdCurrent;
137 };
138 
139 PXR_NAMESPACE_CLOSE_SCOPE
140 
141 #endif // PXR_IMAGING_HD_ST_RENDER_PASS_STATE_H
The Hydra render index is a flattened representation of the client scene graph, which may be composed...
Definition: renderIndex.h:117
HDST_API void Bind() override
Apply the GL states.
HDST_API HdStShaderCodeSharedPtrVector GetShaders() const
returns shaders (lighting/renderpass)
HDST_API void SetOverrideShader(HdStShaderCodeSharedPtr const &overrideShader)
override shader
A set of rendering parameters used among render passes.
HDST_API void Prepare(HdResourceRegistrySharedPtr const &resourceRegistry) override
Schedule to update renderPassState parameters.
A set of rendering parameters used among render passes.
Describes the properties to begin a HgiGraphicsCmds.
HDST_API void SetRenderPassShader(HdStRenderPassShaderSharedPtr const &renderPassShader)
renderpass shader
HDST_API void SetLightingShader(HdStLightingShaderSharedPtr const &lightingShader)
Set lighting shader.