bool CNodeCustom::CreateSolvers(GenericShaderData *ShaderData) { if ( GetNumJacks_In_Connected() < GetNumJacks_In() ) return false; Assert( m_pCode_Function && Q_strlen( m_pCode_Function ) ); Assert( m_bInline || Q_strlen(m_szFilePath) ); SetAllocating( true ); char *pszFuncString = CKVPacker::ConvertKVSafeString( m_pCode_Function, false ); char *pszGlobalString = CKVPacker::ConvertKVSafeString( m_pCode_Global, false ); int iHierachyType = GetHierachyTypeIterateFullyRecursive(); int envflags = m_iEnvFlags; if ( iHierachyType & HLSLHIERACHY_PS ) envflags &= ~NODECUSTOM_ADDENV_LIGHTING_VS; if ( iHierachyType & HLSLHIERACHY_VS ) envflags &= ~NODECUSTOM_ADDENV_LIGHTING_PS; CHLSL_Solver_Custom *solver = new CHLSL_Solver_Custom( GetUniqueIndex() ); solver->SetResourceType( RESOURCETYPE_VARIABLE ); solver->Init( pszGlobalString, pszFuncString, envflags, m_szFunctionName, m_szFilePath, m_hszVarNames_In, m_hszVarNames_Out, this ); delete [] pszFuncString; delete [] pszGlobalString; for ( int i = 0; i < GetNumJacks_In(); i++ ) solver->AddSourceVar( GetJack_In( i )->GetTemporaryVarTarget_End() ); for ( int i = 0; i < GetNumJacks_Out(); i++ ) { CJack *pJ = GetJack_Out( i ); CHLSL_Var *pTg = pJ->AllocateVarFromSmartType(); solver->AddTargetVar( pTg ); } AddSolver( solver ); return true; }
bool CNodeVSInput::CreateSolvers(GenericShaderData *ShaderData) { for ( int i = 0; i < GetNumJacks_Out(); i++ ) { CJack *pJ = GetJack_Out( i ); if ( !pJ->GetNumBridgesConnected() ) continue; const int res = pJ->GetResourceType(); CHLSL_Var *var = pJ->AllocateVarFromSmartType(); var->MakeConstantOnly(); CHLSL_Solver_ReadSemantics *solver = new CHLSL_Solver_ReadSemantics( GetUniqueIndex() ); solver->SendVSSetup( curSetup ); solver->SetResourceType( res ); solver->AddTargetVar( var ); AddSolver( solver ); } SmartCreateDummySolver(); return true; }
bool CNodeBumpBasis::CreateSolvers(GenericShaderData *ShaderData) { for ( int i = 0; i < GetNumJacks_Out(); i++ ) { CJack *pJCur = GetJack_Out(i); if ( !pJCur->GetNumBridgesConnected() && i != 0 ) continue; const int res = pJCur->GetResourceType(); CHLSL_Var *tg = pJCur->AllocateVarFromSmartType(); tg->MakeConstantOnly(); CHLSL_Solver_BumpBasis *solver = new CHLSL_Solver_BumpBasis( GetUniqueIndex() ); solver->SetResourceType( res ); solver->AddTargetVar( tg ); solver->SetState( i ); AddSolver( solver ); } return !!GetNumSolvers(); }
void CNodeMultiply::UpdateOutputs() { if ( !GetNumJacks_Out() || !GetNumJacks_In() ) return; if ( GetErrorLevel() != ERRORLEVEL_NONE ) return SetOutputsUndefined(); CJack *pJO = GetJack_Out( 0 ); int vartype_jack_0 = GetJack_In( 0 )->GetSmartType(); int vartype_jack_1 = GetJack_In( 1 )->GetSmartType(); int iGoalSmarttype = HLSLVAR_FLOAT4; // matrices out if ( vartype_jack_0 == HLSLVAR_MATRIX3X3 && vartype_jack_1 == HLSLVAR_MATRIX3X3 ) iGoalSmarttype = HLSLVAR_MATRIX3X3; else if ( vartype_jack_0 == HLSLVAR_MATRIX4X4 && vartype_jack_1 == HLSLVAR_MATRIX4X4 ) iGoalSmarttype = HLSLVAR_MATRIX4X4; else if ( vartype_jack_0 == HLSLVAR_MATRIX4X3 && vartype_jack_1 == HLSLVAR_MATRIX4X4 ) iGoalSmarttype = HLSLVAR_MATRIX4X4; // vector out else if ( vartype_jack_0 == HLSLVAR_FLOAT1 || vartype_jack_1 == HLSLVAR_FLOAT1 ) iGoalSmarttype = max( vartype_jack_0, vartype_jack_1 ); else if ( vartype_jack_0 == vartype_jack_1 ) iGoalSmarttype = vartype_jack_0; // vector transform out else if ( vartype_jack_1 == HLSLVAR_MATRIX3X3 || vartype_jack_0 == HLSLVAR_MATRIX3X3 || vartype_jack_1 == HLSLVAR_MATRIX4X3 || ( vartype_jack_1 == HLSLVAR_MATRIX4X4 && m_bMatrixRotation ) ) iGoalSmarttype = HLSLVAR_FLOAT3; return pJO->SetSmartType( iGoalSmarttype ); //GetJack_Out( 0 )->SetSmartType( max( GetJack_In(0)->GetSmartType(), GetJack_In(1)->GetSmartType() ) ); }
bool CNodePSOutput::CreateSolvers(GenericShaderData *ShaderData) { for ( int i = 0; i < GetNumJacks_In(); i++ ) { CJack *pJ = GetJack_In( i ); if ( !pJ->GetNumBridgesConnected() ) continue; CJack *sourceJack = pJ->GetBridge( 0 )->GetInputJack(); CHLSL_Var *src = sourceJack->GetTemporaryVarTarget(); const int res = pJ->GetResourceType(); CHLSL_Solver_WriteSemantics *solver = new CHLSL_Solver_WriteSemantics( GetUniqueIndex() ); solver->SetResourceType( res ); solver->AddSourceVar( src ); AddSolver( solver ); } SmartCreateDummySolver(); return true; }