| 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 | { |
no test coverage detected