MCPcopy Create free account
hub / github.com/DiligentGraphics/DiligentFX / EnvMapRenderer

Method EnvMapRenderer

Components/src/EnvMapRenderer.cpp:57–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55};
56
57EnvMapRenderer::EnvMapRenderer(const CreateInfo& CI) :
58 m_pDevice{CI.pDevice},
59 m_pStateCache{CI.pStateCache},
60 m_pCameraAttribsCB{CI.pCameraAttribsCB},
61 m_RTVFormats{CI.RTVFormats, CI.RTVFormats + CI.NumRenderTargets},
62 m_DSVFormat{CI.DSVFormat},
63 m_PSMainSource{CI.PSMainSource != nullptr ? CI.PSMainSource : ""},
64 m_PackMatrixRowMajor{CI.PackMatrixRowMajor}
65{
66 DEV_CHECK_ERR(m_pDevice != nullptr, "Device must not be null");
67 DEV_CHECK_ERR(m_pCameraAttribsCB != nullptr, "Camera Attribs CB must not be null");
68
69 const RenderDeviceInfo& DeviceInfo = m_pDevice->GetDeviceInfo();
70
71 USAGE Usage = (DeviceInfo.IsGLDevice() || DeviceInfo.Type == RENDER_DEVICE_TYPE_D3D11) ?
72 USAGE_DEFAULT :
73 USAGE_DYNAMIC;
74 if (Usage == USAGE_DEFAULT)
75 {
76 m_ShaderAttribs = std::make_unique<EnvMapShaderAttribs>();
77 }
78
79 CreateUniformBuffer(m_pDevice, sizeof(EnvMapShaderAttribs), "EnvMap Render Attribs CB",
80 &m_RenderAttribsCB, Usage, BIND_UNIFORM_BUFFER,
81 Usage == USAGE_DEFAULT ? CPU_ACCESS_NONE : CPU_ACCESS_WRITE,
82 Usage == USAGE_DEFAULT ? m_ShaderAttribs.get() : nullptr);
83 VERIFY_EXPR(m_RenderAttribsCB != nullptr);
84}
85
86EnvMapRenderer::~EnvMapRenderer()
87{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected