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

Function GetMaterialProgramConstantInfo

engine/render/src/render/material.cpp:444–481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

442 }
443
444 bool GetMaterialProgramConstantInfo(HMaterial material, dmhash_t name_hash, dmhash_t* out_constant_id, dmhash_t* out_element_ids[4], uint32_t* out_element_index, uint16_t* out_array_size)
445 {
446 if (name_hash == 0)
447 return false;
448
449 dmArray<RenderConstant>& constants = material->m_Constants;
450 uint32_t n = constants.Size();
451 *out_element_index = ~0u;
452 for (uint32_t i = 0; i < n; ++i)
453 {
454 RenderConstant& c = constants[i];
455 dmhash_t constant_name_hash = GetConstantName(c.m_Constant);
456
457 uint32_t num_values;
458 dmVMath::Vector4* values = GetConstantValues(c.m_Constant, &num_values);
459 (void)values;
460
461 if (constant_name_hash == name_hash)
462 {
463 *out_element_ids = c.m_ElementIdsName;
464 *out_constant_id = constant_name_hash;
465 *out_array_size = num_values;
466 return true;
467 }
468
469 for (uint32_t elem_i = 0; elem_i < 4; ++elem_i)
470 {
471 if (c.m_ElementIdsName[elem_i] == name_hash)
472 {
473 *out_constant_id = constant_name_hash;
474 *out_element_index = elem_i;
475 *out_array_size = num_values;
476 return true;
477 }
478 }
479 }
480 return false;
481 }
482
483 bool GetMaterialProgramAttributeInfo(HMaterial material, dmhash_t name_hash, MaterialProgramAttributeInfo& info)
484 {

Callers 2

GetMaterialConstantFunction · 0.85
SetMaterialConstantFunction · 0.85

Calls 3

GetConstantNameFunction · 0.85
GetConstantValuesFunction · 0.85
SizeMethod · 0.45

Tested by

no test coverage detected