| 121 | } |
| 122 | |
| 123 | BlendStateDesc HnRenderPassState::GetBlendState() const |
| 124 | { |
| 125 | BlendStateDesc BSState; |
| 126 | BSState.AlphaToCoverageEnable = _alphaToCoverageEnabled; |
| 127 | |
| 128 | auto& RT0 = BSState.RenderTargets[0]; |
| 129 | RT0.BlendEnable = _blendEnabled; |
| 130 | RT0.SrcBlend = HdBlendFactorToBlendFactor(_blendColorSrcFactor); |
| 131 | RT0.DestBlend = HdBlendFactorToBlendFactor(_blendColorDstFactor); |
| 132 | RT0.BlendOp = HdBlendOpToBlendOperation(_blendColorOp); |
| 133 | RT0.SrcBlendAlpha = HdBlendFactorToBlendFactor(_blendAlphaSrcFactor); |
| 134 | RT0.DestBlendAlpha = HdBlendFactorToBlendFactor(_blendAlphaDstFactor); |
| 135 | RT0.BlendOpAlpha = HdBlendOpToBlendOperation(_blendAlphaOp); |
| 136 | |
| 137 | if (!_colorMaskUseDefault) |
| 138 | { |
| 139 | for (size_t i = 0; i < std::min(_colorMasks.size(), _countof(BSState.RenderTargets)); ++i) |
| 140 | { |
| 141 | const auto SrcMask = _colorMasks[i]; |
| 142 | auto& DstMask = BSState.RenderTargets[i].RenderTargetWriteMask; |
| 143 | switch (SrcMask) |
| 144 | { |
| 145 | case ColorMaskNone: DstMask = COLOR_MASK_NONE; break; |
| 146 | case ColorMaskRGB: DstMask = COLOR_MASK_RGB; break; |
| 147 | case ColorMaskRGBA: DstMask = COLOR_MASK_ALL; break; |
| 148 | default: |
| 149 | UNEXPECTED("Unexpected color mask"); |
| 150 | } |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | return BSState; |
| 155 | } |
| 156 | |
| 157 | GraphicsPipelineDesc HnRenderPassState::GetGraphicsPipelineDesc() const |
| 158 | { |
nothing calls this directly
no test coverage detected