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

Function ApplyMaterialConstants

engine/render/src/render/material.cpp:356–371  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

354 }
355
356 void ApplyMaterialConstants(dmRender::HRenderContext render_context, HMaterial material, const RenderObject* render_object)
357 {
358 dmGraphics::HContext graphics_context = dmRender::GetGraphicsContext(render_context);
359 const dmArray<RenderConstant>& constants = material->m_Constants;
360 dmGraphics::HProgram program = material->m_Program;
361
362 uint32_t n = constants.Size();
363 for (uint32_t i = 0; i < n; ++i)
364 {
365 const RenderConstant& material_constant = constants[i];
366 const HConstant constant = material_constant.m_Constant;
367 dmGraphics::HUniformLocation location = GetConstantLocation(constant);
368 dmRenderDDF::MaterialDesc::ConstantType type = GetConstantType(constant);
369 SetProgramConstant(render_context, graphics_context, render_object->m_WorldTransform, render_object->m_TextureTransform, type, location, constant);
370 }
371 }
372
373 dmhash_t GetMaterialSamplerNameHash(HMaterial material, uint32_t unit)
374 {

Callers 1

DrawFunction · 0.85

Calls 5

GetGraphicsContextFunction · 0.85
GetConstantLocationFunction · 0.85
GetConstantTypeFunction · 0.85
SetProgramConstantFunction · 0.85
SizeMethod · 0.45

Tested by

no test coverage detected