| 278 | } |
| 279 | |
| 280 | void CreateConstants(dmGraphics::HContext graphics_context, HMaterial material) |
| 281 | { |
| 282 | uint32_t total_constants_count = dmGraphics::GetUniformCount(material->m_Program); |
| 283 | |
| 284 | uint32_t constants_count = 0; |
| 285 | uint32_t samplers_count = 0; |
| 286 | GetProgramUniformCount(material->m_Program, total_constants_count, &constants_count, &samplers_count); |
| 287 | |
| 288 | if ((constants_count + samplers_count) > 0) |
| 289 | { |
| 290 | material->m_NameHashToLocation.SetCapacity((constants_count + samplers_count), (constants_count + samplers_count) * 2); |
| 291 | material->m_Constants.SetCapacity(constants_count); |
| 292 | } |
| 293 | |
| 294 | if (samplers_count > 0) |
| 295 | { |
| 296 | material->m_Samplers.SetCapacity(samplers_count); |
| 297 | for (uint32_t i = 0; i < samplers_count; ++i) |
| 298 | { |
| 299 | material->m_Samplers.Push(Sampler()); |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | SetProgramConstantValues(graphics_context, material->m_Program, total_constants_count, material->m_NameHashToLocation, material->m_Constants, material->m_Samplers); |
| 304 | |
| 305 | material->m_HasSkinnedMatrixCache = material->m_NameHashToLocation.Get(SAMPLER_POSE_MATRIX_CACHE) != 0x0; |
| 306 | material->m_HasMorphTargetsSampler = material->m_NameHashToLocation.Get(SAMPLER_MORPH_TARGETS) != 0x0; |
| 307 | } |
| 308 | |
| 309 | HMaterial NewMaterial(dmRender::HRenderContext render_context, dmGraphics::HProgram program) |
| 310 | { |
no test coverage detected