MCPcopy Create free account
hub / github.com/davideberly/GeometricTools / Bind

Method Bind

GTE/Graphics/DX11/DX11InputLayoutManager.cpp:19–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17}
18
19DX11InputLayout* DX11InputLayoutManager::Bind(ID3D11Device* device,
20 VertexBuffer const* vbuffer, Shader const* vshader)
21{
22 LogAssert(vshader != nullptr, "Invalid input.");
23
24 if (vbuffer)
25 {
26 mMutex.lock();
27 VBSPair vbs(vbuffer, vshader);
28 auto iter = mMap.find(vbs);
29 if (iter == mMap.end())
30 {
31 auto layout = std::make_shared<DX11InputLayout>(device, vbuffer, vshader);
32 iter = mMap.insert(std::make_pair(vbs, layout)).first;
33
34#if defined(GTE_GRAPHICS_USE_NAMED_OBJECTS)
35 std::string vbname = vbuffer->GetName();
36 std::string vsname = vshader->GetName();
37 if (vbname != "" || vsname != "")
38 {
39 layout->SetName(vbname + " | " + vsname);
40 }
41#endif
42 }
43 DX11InputLayout* inputLayout = iter->second.get();
44 mMutex.unlock();
45 return inputLayout;
46 }
47 else
48 {
49 // A null vertex buffer is passed when an effect wants to bypass the
50 // input assembler.
51 return nullptr;
52 }
53}
54
55bool DX11InputLayoutManager::Unbind(VertexBuffer const* vbuffer)
56{

Callers 1

DrawPrimitiveMethod · 0.45

Calls 3

endMethod · 0.80
GetNameMethod · 0.80
SetNameMethod · 0.45

Tested by

no test coverage detected