MCPcopy Create free account
hub / github.com/defold/defold / BuildUniforms

Function BuildUniforms

engine/graphics/src/graphics.cpp:1430–1448  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1428 }
1429
1430 void BuildUniforms(Program* program)
1431 {
1432 uint32_t uniform_count = 0;
1433
1434 ProgramResourceBindingIterator it(program);
1435
1436 // Uniform buffers can use nested structs, so we need to count all leaf nodes in all uniforms.
1437 // This is used to pre-allocate the uniform array with entries for each leaf uniforms.
1438 const ProgramResourceBinding* next;
1439 while((next = it.Next()))
1440 {
1441 const dmArray<ShaderResourceTypeInfo>& type_infos = *next->m_TypeInfos;
1442 uniform_count += CountShaderResourceLeafMembers(type_infos, next->m_Res->m_Type);
1443 }
1444
1445 program->m_Uniforms.SetCapacity(uniform_count);
1446
1447 IterateUniforms(program, true, CreateUniformLeafMembersCallback, &program->m_Uniforms);
1448 }
1449
1450 void DestroyProgram(Program* program)
1451 {

Calls 4

IterateUniformsFunction · 0.85
NextMethod · 0.45
SetCapacityMethod · 0.45

Tested by

no test coverage detected