MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / addTextureSampler

Method addTextureSampler

Source/Falcor/Scene/Material/MaterialSystem.cpp:146–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144 }
145
146 uint32_t MaterialSystem::addTextureSampler(const ref<Sampler>& pSampler)
147 {
148 FALCOR_ASSERT(pSampler);
149 auto isEqual = [&pSampler](const ref<Sampler>& pOther) {
150 return pSampler->getDesc() == pOther->getDesc();
151 };
152
153 // Reuse previously added samplers. We compare by sampler desc.
154 if (auto it = std::find_if(mTextureSamplers.begin(), mTextureSamplers.end(), isEqual); it != mTextureSamplers.end())
155 {
156 return (uint32_t)std::distance(mTextureSamplers.begin(), it);
157 }
158
159 // Add sampler.
160 if (mTextureSamplers.size() >= kMaxSamplerCount)
161 {
162 FALCOR_THROW("Too many samplers");
163 }
164 const uint32_t samplerID = static_cast<uint32_t>(mTextureSamplers.size());
165
166 mTextureSamplers.push_back(pSampler);
167 mSamplersChanged = true;
168
169 return samplerID;
170 }
171
172 uint32_t MaterialSystem::addBuffer(const ref<Buffer>& pBuffer)
173 {

Callers 4

updateMethod · 0.80
updateMethod · 0.80
updateMethod · 0.80

Calls 4

beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected