| 254 | } |
| 255 | |
| 256 | void Tr2Material::ApplyMaterialDataForPassWithOverride( uint32_t techniqueIndex, unsigned int passIndex, uint32_t overrideProgram, Tr2RenderContext& renderContext ) const |
| 257 | { |
| 258 | if( !m_shader ) |
| 259 | { |
| 260 | return; |
| 261 | } |
| 262 | auto sp = renderContext.m_esm.GetShaderProgram( overrideProgram ); |
| 263 | if( !sp ) |
| 264 | { |
| 265 | return; |
| 266 | } |
| 267 | |
| 268 | unsigned mask = m_shader->GetShaderTypeMask( techniqueIndex ); |
| 269 | auto& pp = *m_parametersForPasses[techniqueIndex].passes[passIndex]; |
| 270 | auto resourceSetDesc = Tr2ResourceSetDescriptionAL( *sp ); |
| 271 | for( unsigned i = 0; i != Tr2RenderContextEnum::SHADER_TYPE_COUNT && mask; ++i ) |
| 272 | { |
| 273 | if( mask & ( 1 << i ) ) |
| 274 | { |
| 275 | auto& input = pp.m_stageInput[i]; |
| 276 | ApplyConstants( Tr2RenderContextEnum::ShaderType( i ), input, !pp.m_reroutedParameters.empty(), renderContext ); |
| 277 | UpdateResourceSetDesc( Tr2RenderContextEnum::ShaderType( i ), input, resourceSetDesc ); |
| 278 | mask &= ~( 1 << i ); |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | CCP_STATS_INC( effectResourceSetCreated ); |
| 283 | |
| 284 | Tr2ResourceSetAL resourceSet; |
| 285 | resourceSet.Create( resourceSetDesc, *sp, renderContext.GetPrimaryRenderContext() ); |
| 286 | renderContext.SetResourceSet( resourceSet ); |
| 287 | |
| 288 | pp.m_resourceSetDirty = true; |
| 289 | } |
| 290 | |
| 291 | bool Tr2Material::ApplyShaderInputs( uint32_t techniqueIndex, unsigned int passIndex, Tr2RenderContextEnum::ShaderType shaderType, Tr2RenderContext& renderContext ) const |
| 292 | { |
no test coverage detected