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

Function MatchShaderInputOutput

shadercompiler/EffectCompilerDX11.cpp:476–530  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

474}
475
476bool MatchShaderInputOutput( ID3D11ShaderReflection* output, ID3D11ShaderReflection* input )
477{
478 D3D11_SHADER_DESC vsReflDesc;
479 if( FAILED( output->GetDesc( &vsReflDesc ) ) )
480 {
481 g_messages.AddMessage( "\\memory(0): error X0000: Could not get shader reflection description" );
482 return false;
483 }
484 D3D11_SHADER_DESC psReflDesc;
485 if( FAILED( input->GetDesc( &psReflDesc ) ) )
486 {
487 g_messages.AddMessage( "\\memory(0): error X0000: Could not get shader reflection description" );
488 return false;
489 }
490
491 for( unsigned k = 0; k < psReflDesc.InputParameters; ++k )
492 {
493 D3D11_SIGNATURE_PARAMETER_DESC psDesc;
494 if( FAILED( input->GetInputParameterDesc( k, &psDesc ) ) )
495 {
496 g_messages.AddMessage( "\\memory(0): error X0000: Could not get shader input parameter description" );
497 return false;
498 }
499 if( psDesc.SystemValueType != D3D10_NAME_UNDEFINED )
500 {
501 continue;
502 }
503 bool found = false;
504 for( unsigned n = 0; n < vsReflDesc.OutputParameters; ++n )
505 {
506 D3D11_SIGNATURE_PARAMETER_DESC vsDesc;
507 if( FAILED( output->GetOutputParameterDesc( n, &vsDesc ) ) )
508 {
509 g_messages.AddMessage( "\\memory(0): error X0000: Could not get shader output parameter description" );
510 return false;
511 }
512 if( vsDesc.Register == psDesc.Register && ( ( ~vsDesc.Mask & psDesc.Mask ) == 0 ) )
513 {
514 if( _stricmp( vsDesc.SemanticName, psDesc.SemanticName ) || vsDesc.SemanticIndex != psDesc.SemanticIndex )
515 {
516 g_messages.AddMessage( "\\memory(0): error X0000: Vertex/pixel shader signature mismatch" );
517 return false;
518 }
519 found = true;
520 break;
521 }
522 }
523 if( !found )
524 {
525 g_messages.AddMessage( "\\memory(0): error X0000: Vertex/pixel shader signature mismatch" );
526 return false;
527 }
528 }
529 return true;
530}
531
532std::string PrintPrettyCode( const char* code, const char* indent )
533{

Callers 1

CompileEffectMethod · 0.85

Calls 1

AddMessageMethod · 0.80

Tested by

no test coverage detected