virtual bool Process()override { FNiagaraCompiler_VectorVM* VMCompiler = (FNiagaraCompiler_VectorVM*)Compiler; check(ResultLocation == ENiagaraExpressionResultLocation::SharedData); FNiagaraDataSetProperties* DataSetProps = VMCompiler->GetSharedDataIndex(Event, false, ResultIndex); int32 VarIndex = VMCompiler->GetSharedDataVariableIndex(DataSetProps, Result); FNiagaraExpression* IndexExpr = GetSourceExpression(0).Get(); FNiagaraExpression* DataExpr = GetSourceExpression(1).Get(); check(SourceExpressions.Num() == 2); uint8 IndexIndex = VMCompiler->GetResultVMIndex(IndexExpr); uint8 DataIndex = VMCompiler->GetResultVMIndex(DataExpr); //TODO - Make this better, either ensure this is in a register by now or allow the VM to handle from constants? //Though, why you'd have the conditional come from a constant, IDK. if (!(DataExpr->ResultLocation == ENiagaraExpressionResultLocation::Temporaries || DataExpr->ResultLocation == ENiagaraExpressionResultLocation::InputData)) { VMCompiler->Error(LOCTEXT("CompileFaliure_CannotWriteConstantToSharedData", "Writing of constants to shared data is not currently supported"), NULL, NULL); return false; } check(IndexExpr->ResultLocation == ENiagaraExpressionResultLocation::Temporaries); VMCompiler->WriteCode((uint8)EVectorVMOp::shareddatawrite); VMCompiler->WriteCode(ResultIndex);//Set idx VMCompiler->WriteCode(VarIndex);//Index of variable buffer in the set. VMCompiler->WriteCode(IndexIndex);//Index of the temporary buffer that contains the data index. VMCompiler->WriteCode(DataIndex);//Temp buffer index for the data to write. return true; }
virtual bool Process()override { FNiagaraCompiler_VectorVM* VMCompiler = (FNiagaraCompiler_VectorVM*)Compiler; ResultIndex = VMCompiler->AquireTemporary(); if (ResultIndex == INDEX_NONE) { return false; } ResultLocation = ENiagaraExpressionResultLocation::Temporaries; check(ResultIndex < VectorVM::NumTempRegisters); uint8 DestIndex = VMCompiler->GetResultVMIndex(this); int32 SetIndex; FNiagaraDataSetProperties* SetProps = VMCompiler->GetSharedDataIndex(Event, true, SetIndex); check(SetIndex <= 255); uint8 VarIndex = VMCompiler->GetSharedDataVariableIndex(SetProps, Result); check(SourceExpressions.Num() == 1); FNiagaraExpression* IndexExpr = GetSourceExpression(0).Get(); uint8 IndexIndex = VMCompiler->GetResultVMIndex(IndexExpr); VMCompiler->WriteCode((uint8)EVectorVMOp::shareddataread); VMCompiler->WriteCode(DestIndex);//Result location VMCompiler->WriteCode((int8)SetIndex);//Index of data set VMCompiler->WriteCode(VarIndex);//Index of variable within data set view VMCompiler->WriteCode(IndexIndex);//Index of data in variable buffer return true; }