void CHLSL_Solver_ReadSemantics::OnWriteFXC( bool bIsPixelShader, WriteContext_FXC &context )
{
	const ResourceType_t &type = GetResourceType();
	const char *varname = GetResourceTypeName( type );
	const char *semanticsname = GetSemanticTypeName( type );
	const char *semanticdatatype = GetSemanticType( type );

	const bool bIsTexCoord = ( type >= RESOURCETYPE_TEXCOORD_0 && type <= RESOURCETYPE_TEXCOORD_7 );
	const bool bIsColor = ( type >= RESOURCETYPE_COLOR_0 && type <= RESOURCETYPE_COLOR_3 );

	char tmp[MAXTARGC];
	if ( bIsPixelShader && ( bIsTexCoord || bIsColor ) )
		//semanticdatatype = GetVarCodeNameFromFlag( pInfo->_IntValue_0 );
		semanticdatatype = GetVarCodeNameFromFlag( GetData()._IntValue_0 );
	else if ( !bIsPixelShader )
	{
		if ( bIsTexCoord )
		{
			int typenum = type - RESOURCETYPE_TEXCOORD_0;
			Assert( typenum >= 0 && typenum < 3 );
			semanticdatatype = GetVarCodeNameFromFlag( vs_setup.iDataTypeFlag_TexCoords[typenum] );
		}
		else if ( bIsColor )
		{
			int typenum = type - RESOURCETYPE_COLOR_0;
			Assert( typenum >= 0 && typenum < 3 );
			semanticdatatype = GetVarCodeNameFromFlag( vs_setup.iDataTypeFlag_Color[typenum] );
		}
	}

	Q_snprintf( tmp, MAXTARGC, "%s %s", semanticdatatype, varname );
	int tabsWorth = StringTabsWorth( tmp );
	Q_snprintf( tmp, MAXTARGC, "\n%s %s", semanticdatatype, varname );
	context.buf_semantics_In.PutString( tmp );

	for ( int i = 6 - tabsWorth; i >= 0; i-- )
		context.buf_semantics_In.PutString( "\t" );

	Q_snprintf( tmp, MAXTARGC, ":\t%s;", semanticsname  );
	context.buf_semantics_In.PutString( tmp );
}
void CHLSL_Var::DeclareMe( WriteContext_FXC &context, bool init )
{
	if ( WasDeclared() )
		return;
	char tmp[MAXTARGC];
	const char *codename = GetVarCodeNameFromFlag(GetType());
	Q_snprintf( tmp, MAXTARGC, "%s ", codename );
	context.buf_code.PutString( tmp );
	if ( init )
	{
		Q_snprintf( tmp, MAXTARGC, "%s = (%s)0;\n", GetName(), codename );
		context.buf_code.PutString( tmp );
	}
	OnDeclare();
}