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

Function SetProgramRenderConstant

engine/render/src/render/program_utils.cpp:84–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82 }
83
84 void SetProgramRenderConstant(const dmArray<RenderConstant>& constants, dmhash_t name_hash, const dmVMath::Vector4* values, uint32_t count)
85 {
86 const RenderConstant* rc = GetRenderConstant(constants, name_hash);
87 if (!rc)
88 return;
89
90 uint32_t num_default_values;
91 dmVMath::Vector4* constant_values = dmRender::GetConstantValues(rc->m_Constant, &num_default_values);
92
93 // we cannot set more values than are already registered with the program
94 if (num_default_values < count)
95 {
96 count = num_default_values;
97 }
98
99 // we musn't set less values than are already registered with the program
100 // so we write to the previous buffer
101 memcpy(constant_values, values, count * sizeof(dmVMath::Vector4));
102 }
103
104 void SetProgramConstantType(const dmArray<RenderConstant>& constants, dmhash_t name_hash, dmRenderDDF::MaterialDesc::ConstantType type)
105 {

Callers 2

Calls 2

GetConstantValuesFunction · 0.85
GetRenderConstantFunction · 0.70

Tested by

no test coverage detected