lib/HLSL/HLSignatureLower.cpp
// Decompose semantic name (eg FOO1=>FOO,1), change interp mode for SV_Position.
// Return semantic index.
Decompose semantic name , change interp mode for SV_Position.
Return semantic index.
Decompose semantic name change interp mode for SV_Position . Return semantic index .
unsigned UpateSemanticAndInterpMode(StringRef &semName,
                                    DXIL::InterpolationMode &mode,
                                    DXIL::SigPointKind kind,
                                    LLVMContext &Context) {
  llvm::StringRef baseSemName; 
  uint32_t semIndex;           
  Semantic::DecomposeNameAndIndex(semName, &baseSemName, &semIndex);
  semName = baseSemName;
  const Semantic *semantic = Semantic::GetByName(semName, kind);
  if (semantic && semantic->GetKind() == Semantic::Kind::Position) {
    switch (mode) {
    case InterpolationMode::Kind::LinearCentroid:
      mode = InterpolationMode::Kind::LinearNoperspectiveCentroid;
      break;
    case InterpolationMode::Kind::LinearSample:
      mode = InterpolationMode::Kind::LinearNoperspectiveSample;
      break;
    case InterpolationMode::Kind::Linear:
      mode = InterpolationMode::Kind::LinearNoperspective;
      break;
    case InterpolationMode::Kind::Constant: {
      Context.emitError("invalid interpolation mode for SV_Position");
    } break;
    }
  }
  return semIndex;
}
unsigned UpateSemanticAndInterpMode ( StringRef & semName , DXIL :: InterpolationMode & mode , DXIL :: SigPointKind kind , LLVMContext & Context ) { llvm :: StringRef baseSemName ; uint32_t semIndex ; Semantic :: DecomposeNameAndIndex ( semName , & baseSemName , & semIndex ) ; semName = baseSemName ; const Semantic * semantic = Semantic :: GetByName ( semName , kind ) ; if ( semantic && semantic -> GetKind ( ) == Semantic :: Kind :: Position ) { switch ( mode ) { case InterpolationMode :: Kind :: LinearCentroid : mode = InterpolationMode :: Kind :: LinearNoperspectiveCentroid ; break ; case InterpolationMode :: Kind :: LinearSample : mode = InterpolationMode :: Kind :: LinearNoperspectiveSample ; break ; case InterpolationMode :: Kind :: Linear : mode = InterpolationMode :: Kind :: LinearNoperspective ; break ; case InterpolationMode :: Kind :: Constant : { Context . emitError ( " " ) ; } break ; } } return semIndex ; }
Decompose semantic name (eg FOO1=>FOO,1), change interp mode for SV_Position.
Decompose semantic name ( eg FOO1 = > FOO 1 ) change interp mode for SV_Position .
// The 'FOO' in 'FOO1'. // The '1' in 'FOO1' // Split semName and index. // Update interp mode to no_perspective version for SV_Position.