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 
90  HDST_API
91  void Bind();
92  HDST_API
93  void Unbind();
94 
99  HD_API
100  void SetResolveAovMultiSample(bool state);
101  HD_API
102  bool GetResolveAovMultiSample() const;
103 
105  HDST_API
106  void SetLightingShader(HdStLightingShaderSharedPtr const &lightingShader);
107  HdStLightingShaderSharedPtr const & GetLightingShader() const {
108  return _lightingShader;
109  }
110 
112  HDST_API
113  void SetRenderPassShader(HdStRenderPassShaderSharedPtr const &renderPassShader);
114  HdStRenderPassShaderSharedPtr const &GetRenderPassShader() const {
115  return _renderPassShader;
116  }
117 
119  HDST_API
120  void SetUseSceneMaterials(bool state);
121  bool GetUseSceneMaterials() const {
122  return _useSceneMaterials;
123  }
124 
126  HDST_API
127  HdStShaderCodeSharedPtrVector GetShaders() const;
128 
129  HDST_API
130  size_t GetShaderHash() const;
131 
135  HD_API
136  void SetCameraFramingState(GfMatrix4d const &worldToViewMatrix,
137  GfMatrix4d const &projectionMatrix,
138  GfVec4d const &viewport,
139  ClipPlanesVector const & clipPlanes);
140 
141  // Helper to get graphics cmds descriptor describing textures
142  // we render into and the blend state, constructed from
143  // AOV bindings.
144  //
145  HDST_API
146  HgiGraphicsCmdsDesc MakeGraphicsCmdsDesc(const HdRenderIndex *) const;
147 
148 private:
149  bool _UseAlphaMask() const;
150 
151  // ---------------------------------------------------------------------- //
152  // Shader Objects
153  // ---------------------------------------------------------------------- //
154  HdStRenderPassShaderSharedPtr _renderPassShader;
155  HdSt_FallbackLightingShaderSharedPtr _fallbackLightingShader;
156  HdStLightingShaderSharedPtr _lightingShader;
157 
158  HdBufferArrayRangeSharedPtr _renderPassStateBar;
159  size_t _clipPlanesBufferSize;
160  float _alphaThresholdCurrent;
161  bool _resolveMultiSampleAov;
162  bool _useSceneMaterials;
163 };
164 
165 PXR_NAMESPACE_CLOSE_SCOPE
166 
167 #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:116
HDST_API HdStShaderCodeSharedPtrVector GetShaders() const
returns shaders (lighting/renderpass)
A set of rendering parameters used among render passes.
Basic type for a vector of 4 double components.
Definition: vec4d.h:63
HDST_API void Prepare(HdResourceRegistrySharedPtr const &resourceRegistry) override
Schedule to update renderPassState parameters.
A set of rendering parameters used among render passes.
HD_API void SetResolveAovMultiSample(bool state)
If set to true (default) and the render pass is rendering into a multi-sampled aovs, the aovs will be resolved at the end of the render pass.
HD_API void SetCameraFramingState(GfMatrix4d const &worldToViewMatrix, GfMatrix4d const &projectionMatrix, GfVec4d const &viewport, ClipPlanesVector const &clipPlanes)
Camera setter API Option 1: Specify matrices, viewport and clipping planes (defined in camera space) ...
Stores a 4x4 matrix of double elements.
Definition: matrix4d.h:88
HDST_API void SetUseSceneMaterials(bool state)
scene materials
Describes the properties to begin a HgiGraphicsCmds.
HDST_API void Bind()
XXX: Bind and Unbind set.
HDST_API void SetRenderPassShader(HdStRenderPassShaderSharedPtr const &renderPassShader)
renderpass shader
HDST_API void SetLightingShader(HdStLightingShaderSharedPtr const &lightingShader)
Set lighting shader.