void CHLSL_Solver_VCompression::OnWriteFXC( bool bIsPixelShader, WriteContext_FXC &context ) { char tmp[MAXTARGC]; for ( int i = 0; i < this->GetNumTargetVars(); i++ ) GetTargetVar(i)->DeclareMe( context, true ); const bool bUseTangent = m_iType == CNodeVCompression::COMPRESSION_MODE_NORMAL_TANGENT; CHLSL_Var *pVar_Normal = GetSourceVar( 0 ); CHLSL_Var *pVar_Tangent = bUseTangent ? GetSourceVar( 1 ) : NULL; switch ( m_iType ) { default: AssertMsg( 0, "unimplemented compression type in solver" ); case CNodeVCompression::COMPRESSION_MODE_NORMAL: Q_snprintf( tmp, MAXTARGC, "DecompressVertex_Normal( %s, %s );\n", pVar_Normal->GetName(), GetTargetVar(0)->GetName() ); break; case CNodeVCompression::COMPRESSION_MODE_NORMAL_TANGENT: Q_snprintf( tmp, MAXTARGC, "DecompressVertex_NormalTangent( %s, %s, %s, %s );\n", pVar_Normal->GetName(), pVar_Tangent->GetName(), GetTargetVar(0)->GetName(), GetTargetVar(1)->GetName() ); break; } context.buf_code.PutString( tmp ); }
void CHLSL_Solver_ReadSemantics::OnVarInit( const WriteContext_FXC &context ) { const ResourceType_t &type = GetResourceType(); const char *varname = GetResourceTypeName( type ); CHLSL_Var *target = GetTargetVar( 0 ); char tmp[MAXTARGC]; Q_snprintf( tmp, MAXTARGC, "In.%s", varname ); target->SetName( tmp, true ); }
void CHLSL_Solver_Callback::OnVarInit( const WriteContext_FXC &context ) { CHLSL_Var *target = GetTargetVar( 0 ); char tmp[MAXTARGC]; Q_snprintf( tmp, MAXTARGC, "g_cData_%s", szName ); target->SetName( tmp, true ); }
void CHLSL_Solver_Invert::OnWriteFXC( bool bIsPixelShader, WriteContext_FXC &context ) { CHLSL_Var *tg = GetTargetVar( 0 ); tg->DeclareMe(context); CHLSL_Var *src1 = GetSourceVar( 0 ); char tmp[MAXTARGC]; Q_snprintf( tmp, MAXTARGC, "%s = 1.0f - %s;\n", tg->GetName(),src1->GetName() ); context.buf_code.PutString( tmp ); }
void CHLSL_Solver_VectorRefract::OnWriteFXC( bool bIsPixelShader, WriteContext_FXC &context ) { CHLSL_Var *tg = GetTargetVar( 0 ); tg->DeclareMe(context); CHLSL_Var *src1 = GetSourceVar( 0 ); CHLSL_Var *src2 = GetSourceVar( 1 ); CHLSL_Var *src3 = GetSourceVar( 2 ); char tmp[MAXTARGC]; Q_snprintf( tmp, MAXTARGC, "%s = refract( %s, %s, %s );\n", tg->GetName(),src1->GetName(),src2->GetName(),src3->GetName() ); context.buf_code.PutString( tmp ); }
void CHLSL_Solver_PP_RT::OnExecuteCode( const RunCodeContext &context ) { CHLSL_Var *pT = GetTargetVar(0); if ( IsErrorTexture( pT->GetTexture() ) ) pT->SetTexture( materials->FindTexture( m_szRTName, TEXTURE_GROUP_OTHER ) ); if ( context.IsUsingPreview() ) { context.pRenderContext->PushRenderTargetAndViewport( pT->GetTexture() ); BlitRTRect( context ); context.pRenderContext->PopRenderTargetAndViewport(); } }
void CHLSL_Solver_Array::OnVarInit_PostStep() { CHLSL_Var *src_0 = GetSourceVar( 0 ); CHLSL_Var *src_1 = (m_iSize_y > 1) ? GetSourceVar( 1 ) : NULL; CHLSL_Var *target = GetTargetVar( 0 ); char tmp[MAXTARGC]; Q_snprintf( tmp, sizeof( tmp ), "g_cArray_%i[%s]", GetData().iNodeIndex, src_0->GetName() ); if ( src_1 != NULL ) { char szAppend[MAX_PATH]; Q_snprintf( szAppend, sizeof( szAppend ), "[%s]", src_1->GetName() ); Q_strcat( tmp, szAppend, sizeof( tmp ) ); } //Q_strcat( tmp, "", sizeof( tmp ) ); target->SetName( tmp, true ); }
void CHLSL_Solver_Array::OnVarInit( const WriteContext_FXC &context ) { CHLSL_Var *target = GetTargetVar( 0 ); target->SetName( "NOT_VALIDATED_YET", true ); }