MCPcopy Create free account
hub / github.com/carbonengine/trinity / ReadInput

Function ReadInput

trinity/Shader/Tr2EffectDescription.cpp:369–472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

367}
368
369void ReadInput( Tr2EffectStageInput& input, EffectStream& stream, unsigned version, Tr2RenderContextEnum::ShaderType stage, Tr2RenderContext& renderContext )
370{
371 uint32_t constantCount = stream.Read<uint32_t>();
372 input.constants.resize( constantCount );
373 for( unsigned constantIx = 0; constantIx < constantCount; ++constantIx )
374 {
375 input.constants[constantIx] = ReadConstant( stream, version );
376 }
377
378 unsigned constantValueSize = stream.Read<uint32_t>();
379
380 input.m_constantValueSize = constantValueSize;
381 if( constantValueSize > SHADER_CONSTANTS_MAX )
382 {
383 input.m_constantValueSize = SHADER_CONSTANTS_MAX;
384 }
385 if( version < 5 )
386 {
387 if( constantValueSize )
388 {
389 memcpy( input.constantValues, stream.ReadRaw( constantValueSize ), input.m_constantValueSize );
390 }
391 }
392 else
393 {
394 memcpy( input.constantValues, stream.ReadStringOptional( constantValueSize ), input.m_constantValueSize );
395 }
396
397 uint8_t textureCount = SanityCheck( stream.Read<uint8_t>(), 64u );
398 for( int textureIx = 0; textureIx < textureCount; ++textureIx )
399 {
400 uint8_t registerIndex = stream.Read<uint8_t>();
401 input.resources[registerIndex] = ReadResource( stream, version );
402 }
403
404 uint8_t samplerCount = SanityCheck( stream.Read<uint8_t>(), 64 );
405 for( int samplerIx = 0; samplerIx < samplerCount; ++samplerIx )
406 {
407 uint8_t registerIndex = stream.Read<uint8_t>();
408
409 Tr2SamplerSetup samplerSetup;
410
411 if( version >= 4 )
412 {
413 samplerSetup.name = stream.ReadString();
414 }
415 else
416 {
417 samplerSetup.name = nullptr;
418 }
419
420 Tr2SamplerDescription sampler = ReadSampler( stream );
421
422 if( version < 4 )
423 {
424 stream.Read<bool>(); // isSRGBTexture
425 }
426 if( version > 12 )

Callers 1

ReadMethod · 0.85

Calls 11

ReadConstantFunction · 0.85
SanityCheckFunction · 0.85
ReadResourceFunction · 0.85
ReadSamplerFunction · 0.85
ReadAnnotationsFunction · 0.85
ReadRawMethod · 0.80
ReadStringOptionalMethod · 0.80
ReadStringMethod · 0.80
TypeEnum · 0.70
CreateMethod · 0.45
ReadMethod · 0.45

Tested by

no test coverage detected