MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Blast / getMaterialInstance

Method getMaterialInstance

samples/SampleBase/renderer/RenderMaterial.cpp:171–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169
170
171RenderMaterial::InstancePtr RenderMaterial::getMaterialInstance(const IRenderMesh* mesh)
172{
173 // look in cache
174 auto it = mRenderMeshToInstanceMap.find(mesh);
175 if (it != mRenderMeshToInstanceMap.end())
176 {
177 if (!(*it).second.expired())
178 {
179 return (*it).second.lock();
180 }
181 }
182
183 // create new
184 const std::vector<D3D11_INPUT_ELEMENT_DESC>& descs = mesh->getInputElementDesc();
185 RenderMaterial::InstancePtr instance = getMaterialInstance(&descs[0], (uint32_t)descs.size());
186 mRenderMeshToInstanceMap[mesh] = instance;
187 return instance;
188}
189
190RenderMaterial::InstancePtr RenderMaterial::getMaterialInstance(const D3D11_INPUT_ELEMENT_DESC* elementDescs, uint32_t numElements)
191{

Callers 2

setMaterialMethod · 0.80
onInitializeMethod · 0.80

Calls 4

GetDeviceManagerFunction · 0.85
findMethod · 0.80
GetDeviceMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected