MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / GetTextureGroupSampler

Method GetTextureGroupSampler

Source/Engine/Streaming/Streaming.cpp:294–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292}
293
294GPUSampler* Streaming::GetTextureGroupSampler(int32 index)
295{
296 GPUSampler* sampler = nullptr;
297 if (index >= 0 && index < TextureGroupSamplers.Count())
298 {
299 // Sampler from texture group options
300 auto& group = TextureGroups[index];
301 auto desc = GPUSamplerDescription::New(group.SamplerFilter);
302 desc.MaxAnisotropy = group.MaxAnisotropy;
303 sampler = TextureGroupSamplers[index];
304 if (!sampler)
305 {
306 sampler = GPUSampler::New();
307#if GPU_ENABLE_RESOURCE_NAMING
308 sampler->SetName(group.Name);
309#endif
310 sampler->Init(desc);
311 TextureGroupSamplers[index] = sampler;
312 }
313 if (sampler->GetDescription().Filter != desc.Filter || sampler->GetDescription().MaxAnisotropy != desc.MaxAnisotropy)
314 sampler->Init(desc);
315 }
316 if (!sampler)
317 {
318 // Default sampler to prevent issue
319 if (!FallbackSampler)
320 {
321 FallbackSampler = GPUSampler::New();
322#if GPU_ENABLE_RESOURCE_NAMING
323 FallbackSampler->SetName(TEXT("FallbackSampler"));
324#endif
325 FallbackSampler->Init(GPUSamplerDescription::New(GPUSamplerFilter::Trilinear));
326 }
327 sampler = FallbackSampler;
328 }
329 return sampler;
330}

Callers

nothing calls this directly

Calls 5

NewFunction · 0.50
CountMethod · 0.45
SetNameMethod · 0.45
InitMethod · 0.45
GetDescriptionMethod · 0.45

Tested by

no test coverage detected