This commit is contained in:
2025-11-13 17:40:28 +08:00
parent 962ab49609
commit 10156da245
5503 changed files with 805282 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fc537102897a4da4db2842884a09e2ab
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4d6ecac749eff4e4a8359a8f1b4b3cd6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMRArithmeticComposeOperatorConfig : PXR_SecureMROperatorConfig
{
public string configText;
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 068f21b303dd98e4686a7197f926f431
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,13 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMRColorConvertOperatorConfig : PXR_SecureMROperatorConfig
{
public int covert;
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a41812be983efc14d9783193107e1416
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,13 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMRComparisonOperatorConfig : PXR_SecureMROperatorConfig
{
public SecureMRComparison comparison = SecureMRComparison.LargerThan;
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2e9b5734c8174814aaf835e120663b24
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,77 @@
#if !PICO_OPENXR_SDK
using System.Collections.Generic;
using UnityEngine;
using Unity.XR.PXR.SecureMR;
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMRModelOperatorConfiguration : PXR_SecureMROperatorConfig
{
[Header("Model Settings")]
[Tooltip("The ML model asset to use")]
public TextAsset modelAsset;
[Tooltip("The type of model to use")]
public SecureMRModelType modelType = SecureMRModelType.QnnContextBinary;
[Tooltip("Name of the model")]
public string modelName;
[System.Serializable]
public class ModelIOConfig
{
[Tooltip("Node name in the model")]
public string nodeName;
[Tooltip("Operator IO name")]
public string operatorIOName;
[Tooltip("Encoding type for the tensor")]
public SecureMRModelEncoding encodingType = SecureMRModelEncoding.Float32;
}
[Header("Input Configuration")]
[Tooltip("Input tensor configurations")]
public List<ModelIOConfig> inputs = new List<ModelIOConfig>();
[Header("Output Configuration")]
[Tooltip("Output tensor configurations")]
public List<ModelIOConfig> outputs = new List<ModelIOConfig>();
/// <summary>
/// Creates a ModelOperatorConfiguration from this ScriptableObject
/// </summary>
/// <returns>A ModelOperatorConfiguration instance ready to use with CreateOperator</returns>
public ModelOperatorConfiguration CreateModelOperatorConfiguration()
{
if (modelAsset == null)
{
Debug.LogError("Model asset is not assigned in the configuration");
return null;
}
// Create the base configuration
ModelOperatorConfiguration modelConfig = new ModelOperatorConfiguration(
modelAsset.bytes,
modelType,
string.IsNullOrEmpty(modelName) ? modelAsset.name : modelName
);
// Add input mappings
foreach (var input in inputs)
{
modelConfig.AddInputMapping(input.nodeName, input.operatorIOName, input.encodingType);
}
// Add output mappings
foreach (var output in outputs)
{
modelConfig.AddOutputMapping(output.nodeName, output.operatorIOName, output.encodingType);
}
return modelConfig;
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8865e5a9fec79410ba00023a3cb36899
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,13 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMRNmsOperatorConfig : PXR_SecureMROperatorConfig
{
public float threshold;
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8ee3f97fd4a1701409723e715b04d79b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMRNormalizeOperatorConfig : PXR_SecureMROperatorConfig
{
public SecureMRNormalizeType normalizeType = SecureMRNormalizeType.L1;
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0f6ca2f35ba1d7e41b852180d7519f04
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMROperand : MonoBehaviour
{
public string name;
public PXR_SecureMRPipelineTensor tensor;
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3138222ece47c3e45a679c32f02f2d7d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,248 @@
#if !PICO_OPENXR_SDK
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMROperator : MonoBehaviour
{
public SecureMROperatorType operatorType;
public PXR_SecureMROperatorConfig operatorConfig;
public PXR_SecureMROperand[] operands;
public PXR_SecureMRResult[] results;
internal Operator Operator;
public void InitializeOperator(PXR_SecureMRPipeline pipeline)
{
switch (operatorType)
{
case SecureMROperatorType.Unknown:
break;
case SecureMROperatorType.ArithmeticCompose:
{
if (operatorConfig != null && operatorConfig is PXR_SecureMRArithmeticComposeOperatorConfig opConfig)
{
ArithmeticComposeOperatorConfiguration arithmeticComposeOperatorConfig = new ArithmeticComposeOperatorConfiguration(opConfig.configText);
Operator = pipeline.pipeline.CreateOperator<ArithmeticComposeOperator>(arithmeticComposeOperatorConfig);
}
}
break;
case SecureMROperatorType.Nms:
{
if (operatorConfig != null && operatorConfig is PXR_SecureMRNmsOperatorConfig opConfig)
{
NmsOperatorConfiguration nmsOperatorConfig = new NmsOperatorConfiguration(opConfig.threshold);
Operator = pipeline.pipeline.CreateOperator<NmsOperator>(nmsOperatorConfig);
}
}
break;
case SecureMROperatorType.ElementwiseMin:
{
Operator = pipeline.pipeline.CreateOperator<ElementwiseMinOperator>();
}
break;
case SecureMROperatorType.ElementwiseMax:
{
Operator = pipeline.pipeline.CreateOperator<ElementwiseMaxOperator>();
}
break;
case SecureMROperatorType.ElementwiseMultiply:
{
Operator = pipeline.pipeline.CreateOperator<ElementwiseMultiplyOperator>();
}
break;
case SecureMROperatorType.CustomizedCompare:
{
if (operatorConfig != null && operatorConfig is PXR_SecureMRComparisonOperatorConfig opConfig)
{
ComparisonOperatorConfiguration comparisonOperatorConfig = new ComparisonOperatorConfiguration(opConfig.comparison);
Operator = pipeline.pipeline.CreateOperator<CustomizedCompareOperator>(comparisonOperatorConfig);
}
}
break;
case SecureMROperatorType.ElementwiseOr:
{
Operator = pipeline.pipeline.CreateOperator<ElementwiseOrOperator>();
}
break;
case SecureMROperatorType.ElementwiseAnd:
{
Operator = pipeline.pipeline.CreateOperator<ElementwiseAndOperator>();
}
break;
case SecureMROperatorType.All:
{
Operator = pipeline.pipeline.CreateOperator<AllOperator>();
}
break;
case SecureMROperatorType.Any:
{
Operator = pipeline.pipeline.CreateOperator<AnyOperator>();
}
break;
case SecureMROperatorType.SolvePnP:
{
Operator = pipeline.pipeline.CreateOperator<SolvePnPOperator>();
}
break;
case SecureMROperatorType.GetAffine:
{
Operator = pipeline.pipeline.CreateOperator<GetAffineOperator>();
}
break;
case SecureMROperatorType.ApplyAffine:
{
Operator = pipeline.pipeline.CreateOperator<ApplyAffineOperator>();
}
break;
case SecureMROperatorType.ApplyAffinePoint:
{
Operator = pipeline.pipeline.CreateOperator<ApplyAffinePointOperator>();
}
break;
case SecureMROperatorType.UvTo3DInCameraSpace:
{
Operator = pipeline.pipeline.CreateOperator<UvTo3DInCameraSpaceOperator>();
}
break;
case SecureMROperatorType.Assignment:
{
Operator = pipeline.pipeline.CreateOperator<AssignmentOperator>();
}
break;
case SecureMROperatorType.RunModelInference:
{
if (operatorConfig != null && operatorConfig is PXR_SecureMRModelOperatorConfiguration opConfig)
{
var modelOperatorConfiguration = opConfig.CreateModelOperatorConfiguration();
Operator = pipeline.pipeline.CreateOperator<RunModelInferenceOperator>(modelOperatorConfiguration);
}
}
break;
case SecureMROperatorType.Normalize:
{
if (operatorConfig != null && operatorConfig is PXR_SecureMRNormalizeOperatorConfig opConfig)
{
NormalizeOperatorConfiguration normalizeOperatorConfig = new NormalizeOperatorConfiguration(opConfig.normalizeType);
Operator = pipeline.pipeline.CreateOperator<NormalizeOperator>(normalizeOperatorConfig);
}
}
break;
case SecureMROperatorType.CameraSpaceToWorld:
{
Operator = pipeline.pipeline.CreateOperator<CameraSpaceToWorldOperator>();
}
break;
case SecureMROperatorType.RectifiedVstAccess:
{
Operator = pipeline.pipeline.CreateOperator<RectifiedVstAccessOperator>();
}
break;
case SecureMROperatorType.Argmax:
{
Operator = pipeline.pipeline.CreateOperator<ArgmaxOperator>();
}
break;
case SecureMROperatorType.ConvertColor:
{
if (operatorConfig != null && operatorConfig is PXR_SecureMRColorConvertOperatorConfig opConfig)
{
ColorConvertOperatorConfiguration colorConvertOperatorConfig = new ColorConvertOperatorConfiguration(opConfig.covert);
Operator = pipeline.pipeline.CreateOperator<ConvertColorOperator>(colorConvertOperatorConfig);
}
}
break;
case SecureMROperatorType.SortVector:
{
Operator = pipeline.pipeline.CreateOperator<SortVectorOperator>();
}
break;
case SecureMROperatorType.Inversion:
{
Operator = pipeline.pipeline.CreateOperator<InversionOperator>();
}
break;
case SecureMROperatorType.GetTransformMatrix:
{
Operator = pipeline.pipeline.CreateOperator<GetTransformMatrixOperator>();
}
break;
case SecureMROperatorType.SortMatrix:
{
if (operatorConfig != null && operatorConfig is PXR_SecureMRSortMatrixOperatorConfig opConfig)
{
SortMatrixOperatorConfiguration colorConvertOperatorConfig = new SortMatrixOperatorConfiguration(opConfig.sortType);
Operator = pipeline.pipeline.CreateOperator<SortMatrixOperator>(colorConvertOperatorConfig);
}
}
break;
case SecureMROperatorType.SwitchGltfRenderStatus:
{
Operator = pipeline.pipeline.CreateOperator<SwitchGltfRenderStatusOperator>();
}
break;
case SecureMROperatorType.UpdateGltf:
{
if (operatorConfig != null && operatorConfig is PXR_SecureMRUpdateGltfOperatorConfig opConfig)
{
UpdateGltfOperatorConfiguration colorConvertOperatorConfig = new UpdateGltfOperatorConfiguration(opConfig.attribute);
Operator = pipeline.pipeline.CreateOperator<UpdateGltfOperator>(colorConvertOperatorConfig);
}
}
break;
case SecureMROperatorType.RenderText:
{
if (operatorConfig != null && operatorConfig is PXR_SecureMRRenderTextOperatorConfig opConfig)
{
RenderTextOperatorConfiguration colorConvertOperatorConfig = new RenderTextOperatorConfiguration(opConfig.typeface, opConfig.languageAndLocale, opConfig.width, opConfig.height);
Operator = pipeline.pipeline.CreateOperator<UpdateGltfOperator>(colorConvertOperatorConfig);
}
}
break;
case SecureMROperatorType.LoadTexture:
{
Operator = pipeline.pipeline.CreateOperator<LoadTextureOperator>();
}
break;
case SecureMROperatorType.Svd:
{
Operator = pipeline.pipeline.CreateOperator<SvdOperator>();
}
break;
case SecureMROperatorType.Norm:
{
Operator = pipeline.pipeline.CreateOperator<NormOperator>();
}
break;
case SecureMROperatorType.SwapHwcChw:
{
Operator = pipeline.pipeline.CreateOperator<SwapHwcChwOperator>();
}
break;
default:
throw new ArgumentOutOfRangeException();
}
}
public void InitializeParameters()
{
for (int i = 0; i < operands.Length; i++)
{
Operator.SetOperand(operands[i].name, operands[i].tensor.tensor);
}
for (int i = 0; i < results.Length; i++)
{
Operator.SetResult(results[i].name, results[i].tensor.tensor);
}
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f2db4e7e685eab149a3d1a433ef45b3f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,15 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
[DisallowMultipleComponent]
public abstract class PXR_SecureMROperatorConfig : MonoBehaviour
{
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c94d34ae12959d743907b3922ff4283f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,16 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMRRenderTextOperatorConfig : PXR_SecureMROperatorConfig
{
public SecureMRFontTypeface typeface = SecureMRFontTypeface.Default;
public string languageAndLocale;
public int width;
public int height;
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9811c138518011e40a025f9581943617
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMRResult : MonoBehaviour
{
public string name;
public PXR_SecureMRPipelineTensor tensor;
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0e0db5307210d97408562430bda7624c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMRSortMatrixOperatorConfig : PXR_SecureMROperatorConfig
{
public SecureMRMatrixSortType sortType = SecureMRMatrixSortType.Column;
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 96f7b3902fd98364dbd8fb70b40a3fc6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,13 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMRUpdateGltfOperatorConfig : PXR_SecureMROperatorConfig
{
public SecureMRGltfOperatorAttribute attribute = SecureMRGltfOperatorAttribute.Texture;
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 49077d8b5daa704459d6497d74f7fc7f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,35 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
[DefaultExecutionOrder(-100)]
public class PXR_SecureMRProvider : MonoBehaviour
{
internal Provider provider;
public int vstImageWidth = 1024;
public int vstImageHeight = 1024;
public PXR_SecureMRGlobalTensor[] globalTensors;
public PXR_SecureMRPipeline[] pipelines;
void Awake()
{
provider = new Provider(vstImageWidth, vstImageHeight);
foreach (var globalTensor in globalTensors)
{
globalTensor.Initialize(this.provider);
}
foreach (var pxrSecureMrPipeline in pipelines)
{
pxrSecureMrPipeline.Initialize(this);
}
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 620f232b10db8774db3670586443bfa7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 66171051dd24bed429f837f46afa2078
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,41 @@
#if !PICO_OPENXR_SDK
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
[DisallowMultipleComponent]
[DefaultExecutionOrder(-99)]
public class PXR_SecureMRPipeline : MonoBehaviour
{
public PXR_SecureMRPipelineTensor[] tensors;
public PXR_SecureMROperator[] operators;
internal Pipeline pipeline;
public void Initialize(PXR_SecureMRProvider provider)
{
pipeline = provider.provider.CreatePipeline();
foreach (var tensor in tensors)
{
tensor.Initialize(this);
}
foreach (var secureMrOperator in operators)
{
secureMrOperator.InitializeOperator(this);
}
}
private void Start()
{
foreach (var secureMrOperator in operators)
{
secureMrOperator.InitializeParameters();
}
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d13f48655abb74d4abede3bb2115905b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,39 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMRPipelineExecute : MonoBehaviour
{
public PXR_SecureMRPipeline Pipeline;
public double periodInSeconds;
public PXR_SecureMRTensorMapping[] TensorMappings;
private double lastExecuted = 0.0;
public virtual void Execute()
{
var timeNow = Time.realtimeSinceStartupAsDouble;
if (timeNow < lastExecuted + periodInSeconds)
return;
if (TensorMappings !=null && TensorMappings.Length>0)
{
TensorMapping mappings = new TensorMapping();
foreach (var tensorPair in TensorMappings)
{
mappings.Set(tensorPair.localTensorReference.tensor,tensorPair.globalTensor.tensor);
}
Pipeline.pipeline.Execute(mappings);
}
else
{
Pipeline.pipeline.Execute();
}
lastExecuted = timeNow;
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 22202a0b7b3a22e42b35ffa268644a5d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,31 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMrPipelineExecuteAfter : PXR_SecureMRPipelineExecute
{
public PXR_SecureMRPipelineExecute afterPipeline;
public override void Execute()
{
if (TensorMappings != null && TensorMappings.Length > 0)
{
TensorMapping mappings = new TensorMapping();
foreach (var tensorPair in TensorMappings)
{
mappings.Set(tensorPair.localTensorReference.tensor, tensorPair.globalTensor.tensor);
}
Pipeline.pipeline.ExecuteAfter(afterPipeline.Pipeline.pipeline.pipelineHandle, mappings);
}
else
{
Pipeline.pipeline.ExecuteAfter(afterPipeline.Pipeline.pipeline.pipelineHandle);
}
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 400be15763095a94ca67d3f44402560a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,31 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMrPipelineExecuteConditional : PXR_SecureMRPipelineExecute
{
public PXR_SecureMRGlobalTensor globalTensor;
public override void Execute()
{
if (TensorMappings != null && TensorMappings.Length > 0)
{
TensorMapping mappings = new TensorMapping();
foreach (var tensorPair in TensorMappings)
{
mappings.Set(tensorPair.localTensorReference.tensor, tensorPair.globalTensor.tensor);
}
Pipeline.pipeline.ExecuteConditional(globalTensor.tensor.TensorHandle, mappings);
}
else
{
Pipeline.pipeline.ExecuteConditional(globalTensor.tensor.TensorHandle);
}
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bd11982a9f2d50142874c42ed9aace3d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,27 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMRPipelineRunner : MonoBehaviour
{
public PXR_SecureMRPipelineExecute[] runners;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
foreach (var exec in runners)
{
exec.Execute();
}
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c1ff61b0292c0af4eb8dff4148714fca
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fbf915c13079ff64b98f96f935d4ac4b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7e14dfe45f55a2c4ebfeaa996053da8a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
#if !PICO_OPENXR_SDK
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMRByteTensorData : PXR_SecureMRTensorData
{
public byte[] data;
public override byte[] ToByteArray()
{
return data;
}
}
}
#endif

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b4efb5baf0eb4852ba302b21419172a2
timeCreated: 1742250481

View File

@@ -0,0 +1,25 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMRFileTensorData : PXR_SecureMRTensorData
{
public TextAsset fileAsset;
public override byte[] ToByteArray()
{
if (fileAsset != null)
{
return fileAsset.bytes;
}
else
{
return null;
}
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 57d3aabc698e3d14193ef3b3b3514a0d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,19 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMRFloatTensorData : PXR_SecureMRTensorData
{
public float[] data;
public override float[] ToFloatArray()
{
return data;
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 833a9c77186f6d44f910747e2046c202
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,19 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMRIntTensorData : PXR_SecureMRTensorData
{
public int[] data;
public override int[] ToIntArray()
{
return data;
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 63fcdcd56ea9c1342879c35bcdcc5125
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,32 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public abstract class PXR_SecureMRTensorData : MonoBehaviour
{
public virtual byte[] ToByteArray()
{
return null;
}
public virtual float[] ToFloatArray()
{
return null;
}
public virtual int[] ToIntArray()
{
return null;
}
public virtual ushort[] ToUShortArray()
{
return null;
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 44bf4283f84ec944499e0dab7994ddf9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,75 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using Unity.XR.PXR.SecureMR;
using UnityEngine;
public class PXR_SecureMRTextureTensorData : PXR_SecureMRTensorData
{
//The texture that will be converted to color and float array
//Note: you have to mark the texture as Read/Write in the Inspector
[SerializeField]
private Texture2D texture;
private Color32[] _colorData;
private float[] _rgbaFloatData;
private int[] _rgbaIntData;
private byte[] _rgbaByteData;
public Texture2D Texture
{
get { return texture; }
set
{
texture = value;
UpdateArrayData();
}
}
public override float[] ToFloatArray()
{
return _rgbaFloatData;
}
public override byte[] ToByteArray()
{
return _rgbaByteData;
}
public override int[] ToIntArray()
{
return _rgbaIntData;
}
private void UpdateArrayData()
{
if (texture == null)
{
_colorData = null;
_rgbaFloatData = null;
_rgbaByteData = null;
_rgbaIntData = null;
return;
}
// Get raw color data from texture
_colorData = texture.GetPixels32();
_rgbaIntData = texture.GetPixelData<int>(0).ToArray();
// Convert to RGBA float array
_rgbaFloatData = new float[_colorData.Length * 4];
_rgbaByteData = new byte[_colorData.Length * 4];
for (int i = 0; i < _colorData.Length; i++)
{
_rgbaFloatData[i * 4] = _colorData[i].r / 255f; // R
_rgbaFloatData[i * 4 + 1] = _colorData[i].g / 255f; // G
_rgbaFloatData[i * 4 + 2] = _colorData[i].b / 255f; // B
_rgbaFloatData[i * 4 + 3] = _colorData[i].a / 255f; // A
_rgbaByteData[i * 4] = _colorData[i].r; // R
_rgbaByteData[i * 4 + 1] = _colorData[i].g; // G
_rgbaByteData[i * 4 + 2] = _colorData[i].b; // B
_rgbaByteData[i * 4 + 3] = _colorData[i].a; // A
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 36f03292700cd294c9f91534a11624a8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
#if !PICO_OPENXR_SDK
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMRUShortTensorData : PXR_SecureMRTensorData
{
public ushort[] data;
public override ushort[] ToUShortArray()
{
return data;
}
}
}
#endif

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a0d99d67fc7b4174854334e5094f0824
timeCreated: 1742251258

View File

@@ -0,0 +1,130 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMRGlobalTensor : PXR_SecureMRTensor
{
public PXR_SecureMRTensorData tensorData;
public void Initialize(Provider secureMrProvider)
{
if (metadata !=null && metadata is PXR_SecureMRGltfMetadata && tensorData != null && tensorData.ToByteArray() != null)
{
tensor = secureMrProvider.CreateTensor<Gltf>(tensorData.ToByteArray());
}
else if (metadata != null && metadata is PXR_SecureMRTensorMetadata tensorMetadata)
{
switch(tensorMetadata.usage)
{
case SecureMRTensorUsage.Matrix:
CreateMatrixTensor(secureMrProvider, tensorMetadata);
break;
case SecureMRTensorUsage.Point:
CreatePointTensor(secureMrProvider, tensorMetadata);
break;
case SecureMRTensorUsage.Color:
CreateColorTensor(secureMrProvider, tensorMetadata);
break;
case SecureMRTensorUsage.TimeStamp:
CreateTimestampTensor(secureMrProvider, tensorMetadata);
break;
case SecureMRTensorUsage.Slice:
if(tensorMetadata.dataType == SecureMRTensorDataType.Int)
{
tensor = secureMrProvider.CreateTensor<int,Slice>(tensorMetadata.channel, new TensorShape(tensorMetadata.shape), tensorData.ToIntArray());
}
break;
case SecureMRTensorUsage.Scalar:
CreateScalarTensor(secureMrProvider, tensorMetadata);
break;
}
}
}
private void CreateScalarTensor(Provider secureMrProvider, PXR_SecureMRTensorMetadata tensorMetadata)
{
switch(tensorMetadata.dataType)
{
case SecureMRTensorDataType.Float:
tensor = secureMrProvider.CreateTensor<float,Scalar>(tensorMetadata.channel, new TensorShape(tensorMetadata.shape), tensorData.ToFloatArray());
break;
case SecureMRTensorDataType.Int:
tensor = secureMrProvider.CreateTensor<int,Scalar>(tensorMetadata.channel, new TensorShape(tensorMetadata.shape), tensorData.ToIntArray());
break;
case SecureMRTensorDataType.Short:
case SecureMRTensorDataType.Ushort:
tensor = secureMrProvider.CreateTensor<ushort,Scalar>(tensorMetadata.channel, new TensorShape(tensorMetadata.shape), tensorData.ToUShortArray());
break; case SecureMRTensorDataType.Byte:
case SecureMRTensorDataType.Sbyte:
tensor = secureMrProvider.CreateTensor<byte,Scalar>(tensorMetadata.channel, new TensorShape(tensorMetadata.shape), tensorData.ToByteArray());
break;
}
}
private void CreateTimestampTensor(Provider secureMrProvider, PXR_SecureMRTensorMetadata tensorMetadata)
{
if(tensorMetadata.dataType == SecureMRTensorDataType.Int)
{
tensor = secureMrProvider.CreateTensor<int,TimeStamp>(tensorMetadata.channel, new TensorShape(tensorMetadata.shape), tensorData.ToIntArray());
}
}
private void CreateColorTensor(Provider secureMrProvider, PXR_SecureMRTensorMetadata tensorMetadata)
{
switch(tensorMetadata.dataType)
{
case SecureMRTensorDataType.Float:
tensor = secureMrProvider.CreateTensor<float,Color>(tensorMetadata.channel, new TensorShape(tensorMetadata.shape), tensorData.ToFloatArray());
break;
case SecureMRTensorDataType.Int:
tensor = secureMrProvider.CreateTensor<int,Color>(tensorMetadata.channel, new TensorShape(tensorMetadata.shape), tensorData.ToIntArray());
break;
case SecureMRTensorDataType.Short:
case SecureMRTensorDataType.Ushort:
tensor = secureMrProvider.CreateTensor<ushort,Color>(tensorMetadata.channel, new TensorShape(tensorMetadata.shape), tensorData.ToUShortArray());
break;
case SecureMRTensorDataType.Byte:
tensor = secureMrProvider.CreateTensor<byte, Color>(tensorMetadata.channel,
new TensorShape(tensorMetadata.shape), tensorData.ToByteArray());
break;
}
}
private void CreatePointTensor(Provider secureMrProvider, PXR_SecureMRTensorMetadata tensorMetadata)
{
if(tensorMetadata.dataType == SecureMRTensorDataType.Float)
{
tensor = secureMrProvider.CreateTensor<float,Point>(tensorMetadata.channel, new TensorShape(tensorMetadata.shape), tensorData.ToFloatArray());
}
}
void CreateMatrixTensor(Provider secureMrProvider, PXR_SecureMRTensorMetadata tensorMetadata)
{
switch(tensorMetadata.dataType)
{
case SecureMRTensorDataType.Float:
tensor = secureMrProvider.CreateTensor<float,Matrix>(tensorMetadata.channel, new TensorShape(tensorMetadata.shape), tensorData.ToFloatArray());
break;
case SecureMRTensorDataType.Int:
tensor = secureMrProvider.CreateTensor<int,Matrix>(tensorMetadata.channel, new TensorShape(tensorMetadata.shape), tensorData.ToIntArray());
break;
case SecureMRTensorDataType.Short:
case SecureMRTensorDataType.Ushort:
tensor = secureMrProvider.CreateTensor<ushort,Matrix>(tensorMetadata.channel, new TensorShape(tensorMetadata.shape), tensorData.ToUShortArray());
break;
case SecureMRTensorDataType.Byte:
case SecureMRTensorDataType.Sbyte:
tensor = secureMrProvider.CreateTensor<byte,Matrix>(tensorMetadata.channel, new TensorShape(tensorMetadata.shape), tensorData.ToByteArray());
break;
}
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 83d6795c88ea2634c85e930b17943585
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,13 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMRGltfMetadata : PXR_SecureMRMetadata
{
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d8aa832d17484724ca18756039d17a17
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,49 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMRLocalTensor : PXR_SecureMRPipelineTensor
{
public PXR_SecureMRTensorData tensorData;
protected override void Initialize(Pipeline smrPipeline)
{
base.Initialize(smrPipeline);
if (tensor == null || tensorData == null)
{
return;
}
if (metadata !=null && metadata is PXR_SecureMRGltfMetadata )
{
tensor.Reset(tensorData.ToByteArray());
}
else if (metadata != null && metadata is PXR_SecureMRTensorMetadata tensorMetadata )
{
switch(tensorMetadata.dataType)
{
case SecureMRTensorDataType.Float:
tensor.Reset(tensorData.ToFloatArray());
break;
case SecureMRTensorDataType.Int:
tensor.Reset(tensorData.ToIntArray());
break;
case SecureMRTensorDataType.Short:
case SecureMRTensorDataType.Ushort:
tensor.Reset(tensorData.ToUShortArray());
break;
case SecureMRTensorDataType.Byte:
case SecureMRTensorDataType.Sbyte:
tensor.Reset(tensorData.ToByteArray());
break;
}
}
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: be24d60da1183fd488b2ac4f0a765421
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMRLocalTensorReference : PXR_SecureMRPipelineTensor
{
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: faaee5e41e3799a409b5d25cfcf0e682
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public abstract class PXR_SecureMRMetadata : MonoBehaviour
{
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 91707c9ca62e23c4eb223a4cf55cd42c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,128 @@
#if !PICO_OPENXR_SDK
using UnityEditor;
namespace Unity.XR.PXR.SecureMR
{
public abstract class PXR_SecureMRPipelineTensor : PXR_SecureMRTensor
{
public void Initialize(PXR_SecureMRPipeline pxrSecureMrPipeline)
{
Pipeline smrPipeline = pxrSecureMrPipeline.pipeline;
Initialize(smrPipeline);
}
protected virtual void Initialize(Pipeline smrPipeline)
{
if (metadata !=null && metadata is PXR_SecureMRGltfMetadata)
{
tensor = smrPipeline.CreateTensor<Gltf>(null);
}
else if (metadata != null && metadata is PXR_SecureMRTensorMetadata tensorMetadata)
{
switch(tensorMetadata.usage)
{
case SecureMRTensorUsage.Matrix:
CreateMatrixTensor(smrPipeline,tensorMetadata);
break;
case SecureMRTensorUsage.Point:
CreatePointTensor(smrPipeline,tensorMetadata);
break;
case SecureMRTensorUsage.Color:
CreateColorTensor(smrPipeline, tensorMetadata);
break;
case SecureMRTensorUsage.TimeStamp:
CreateTimestampTensor(smrPipeline, tensorMetadata);
break;
case SecureMRTensorUsage.Slice:
if(tensorMetadata.dataType == SecureMRTensorDataType.Int)
{
tensor = smrPipeline.CreateTensor<int,Slice>(tensorMetadata.channel, new TensorShape(tensorMetadata.shape));
}
break;
case SecureMRTensorUsage.Scalar:
CreateScalarTensor(smrPipeline, tensorMetadata);
break;
}
}
}
private void CreateScalarTensor(Pipeline smrPipeline, PXR_SecureMRTensorMetadata tensorMetadata)
{
switch(tensorMetadata.dataType)
{
case SecureMRTensorDataType.Float:
tensor = smrPipeline.CreateTensor<float,Scalar>(tensorMetadata.channel, new TensorShape(tensorMetadata.shape));
break;
case SecureMRTensorDataType.Int:
case SecureMRTensorDataType.Short:
case SecureMRTensorDataType.Ushort:
tensor = smrPipeline.CreateTensor<int,Scalar>(tensorMetadata.channel, new TensorShape(tensorMetadata.shape));
break;
case SecureMRTensorDataType.Byte:
case SecureMRTensorDataType.Sbyte:
tensor = smrPipeline.CreateTensor<byte,Scalar>(tensorMetadata.channel, new TensorShape(tensorMetadata.shape));
break;
}
}
private void CreateTimestampTensor(Pipeline smrPipeline, PXR_SecureMRTensorMetadata tensorMetadata)
{
if(tensorMetadata.dataType == SecureMRTensorDataType.Int)
{
tensor = smrPipeline.CreateTensor<int,TimeStamp>(tensorMetadata.channel, new TensorShape(tensorMetadata.shape));
}
}
private void CreateColorTensor(Pipeline smrPipeline, PXR_SecureMRTensorMetadata tensorMetadata)
{
switch(tensorMetadata.dataType)
{
case SecureMRTensorDataType.Float:
tensor = smrPipeline.CreateTensor<float,Color>(tensorMetadata.channel, new TensorShape(tensorMetadata.shape));
break;
case SecureMRTensorDataType.Short:
case SecureMRTensorDataType.Ushort:
case SecureMRTensorDataType.Int:
tensor = smrPipeline.CreateTensor<int,Color>(tensorMetadata.channel, new TensorShape(tensorMetadata.shape));
break;
case SecureMRTensorDataType.Byte:
tensor = smrPipeline.CreateTensor<byte, Color>(tensorMetadata.channel,
new TensorShape(tensorMetadata.shape));
break;
}
}
private void CreatePointTensor(Pipeline smrPipeline, PXR_SecureMRTensorMetadata tensorMetadata)
{
if(tensorMetadata.dataType == SecureMRTensorDataType.Float)
{
tensor = smrPipeline.CreateTensor<float,Point>(tensorMetadata.channel, new TensorShape(tensorMetadata.shape));
}
}
void CreateMatrixTensor(Pipeline smrPipeline, PXR_SecureMRTensorMetadata tensorMetadata)
{
switch(tensorMetadata.dataType)
{
case SecureMRTensorDataType.Float:
tensor = smrPipeline.CreateTensor<float,Matrix>(tensorMetadata.channel, new TensorShape(tensorMetadata.shape));
break;
case SecureMRTensorDataType.Int:
case SecureMRTensorDataType.Short:
case SecureMRTensorDataType.Ushort:
tensor = smrPipeline.CreateTensor<int,Matrix>(tensorMetadata.channel, new TensorShape(tensorMetadata.shape));
break;
case SecureMRTensorDataType.Byte:
case SecureMRTensorDataType.Sbyte:
tensor = smrPipeline.CreateTensor<byte,Matrix>(tensorMetadata.channel, new TensorShape(tensorMetadata.shape));
break;
}
}
}
}
#endif

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f19678aa08d847ac924c1a54c75725e5
timeCreated: 1741222282

View File

@@ -0,0 +1,14 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public abstract class PXR_SecureMRTensor : MonoBehaviour
{
internal Tensor tensor;
public PXR_SecureMRMetadata metadata;
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 72628110969172a4fbf8a56411d53dd0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,26 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMRTensorMapping : MonoBehaviour
{
public PXR_SecureMRLocalTensorReference localTensorReference;
public PXR_SecureMRGlobalTensor globalTensor;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 960aef176675a2b4ea75b571a5bd5071
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,18 @@
#if !PICO_OPENXR_SDK
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMRTensorMetadata : PXR_SecureMRMetadata
{
public int[] shape;
public int channel;
public SecureMRTensorDataType dataType = SecureMRTensorDataType.Float;
public SecureMRTensorUsage usage = SecureMRTensorUsage.Matrix;
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 61736555113e6a2499f829bcf9fae1ff
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: df4d1868a61403e46ae35a4ddc7b4d37
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,591 @@
#if !PICO_OPENXR_SDK
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public abstract class OperatorConfiguration
{
}
public class ArithmeticComposeOperatorConfiguration : OperatorConfiguration
{
public string configText { get; set; }
public ArithmeticComposeOperatorConfiguration(string configText)
{
this.configText = configText;
}
}
public class ComparisonOperatorConfiguration : OperatorConfiguration
{
public SecureMRComparison comparison { get; set; }
public ComparisonOperatorConfiguration(SecureMRComparison comparison)
{
this.comparison = comparison;
}
}
public class NmsOperatorConfiguration : OperatorConfiguration
{
public float threshold { get; set; }
public NmsOperatorConfiguration(float threshold)
{
this.threshold = threshold;
}
}
public class NormalizeOperatorConfiguration : OperatorConfiguration
{
public SecureMRNormalizeType normalizeType { get; set; }
public NormalizeOperatorConfiguration(SecureMRNormalizeType normalizeType)
{
this.normalizeType = normalizeType;
}
}
public class ColorConvertOperatorConfiguration : OperatorConfiguration
{
public int convert { get; set; }
public ColorConvertOperatorConfiguration(int convert)
{
this.convert = convert;
}
}
public class SortMatrixOperatorConfiguration : OperatorConfiguration
{
public SecureMRMatrixSortType sortType { get; set; }
public SortMatrixOperatorConfiguration(SecureMRMatrixSortType sortType)
{
this.sortType = sortType;
}
}
public class UpdateGltfOperatorConfiguration : OperatorConfiguration
{
public SecureMRGltfOperatorAttribute attribute { get; set; }
public UpdateGltfOperatorConfiguration(SecureMRGltfOperatorAttribute attribute)
{
this.attribute = attribute;
}
}
public class RenderTextOperatorConfiguration : OperatorConfiguration
{
public SecureMRFontTypeface typeface { get; set; }
public string languageAndLocale { get; set; }
public int width { get; set; }
public int height { get; set; }
public RenderTextOperatorConfiguration(SecureMRFontTypeface typeface, string languageAndLocale, int width, int height)
{
this.typeface = typeface;
this.languageAndLocale = languageAndLocale;
this.width = width;
this.height = height;
}
}
public class ModelOperatorConfiguration : OperatorConfiguration
{
public List<SecureMROperatorModelConfig> inputConfigs { get; set; }
public List<SecureMROperatorModelConfig> outputConfigs { get; set; }
public byte[] modelData { get; set; }
public SecureMRModelType modelType { get; set; }
public string modelName { get; set; }
public ModelOperatorConfiguration(List<SecureMROperatorModelConfig> inputConfigs, List<SecureMROperatorModelConfig> outputConfigs, byte[] modelData, SecureMRModelType modelType, string modelName)
{
this.inputConfigs = inputConfigs;
this.outputConfigs = outputConfigs;
this.modelData = modelData;
this.modelType = modelType;
this.modelName = modelName;
}
public ModelOperatorConfiguration(byte[] modelData, SecureMRModelType modelType, string modelName)
{
this.inputConfigs = new List<SecureMROperatorModelConfig>();
this.outputConfigs = new List<SecureMROperatorModelConfig>();
this.modelData = modelData;
this.modelType = modelType;
this.modelName = modelName;
}
public void AddInputMapping(string nodeName, string operatorIOName, SecureMRModelEncoding encodingType)
{
var config = new SecureMROperatorModelConfig
{ encodingType = encodingType, nodeName = nodeName, operatorIOName = operatorIOName };
inputConfigs.Add(config);
}
public void AddOutputMapping(string nodeName, string operatorIOName, SecureMRModelEncoding encodingType)
{
var config = new SecureMROperatorModelConfig
{ encodingType = encodingType, nodeName = nodeName, operatorIOName = operatorIOName };
outputConfigs.Add(config);
}
}
public abstract class Operator
{
public SecureMROperatorType OperatorType { get; private set; }
public ulong OperatorHandle { get; internal set; }
public ulong PipelineHandle { get; private set; }
public PxrResult SetOperand(string name, Tensor tensor)
{
return PXR_Plugin.SecureMR.UPxr_SetSecureMROperatorOperandByName(PipelineHandle, OperatorHandle, tensor.TensorHandle, name);
}
public PxrResult SetResult(string name, Tensor tensor)
{
return PXR_Plugin.SecureMR.UPxr_SetSecureMROperatorResultByName(PipelineHandle, OperatorHandle, tensor.TensorHandle, name);
}
public Operator(ulong pipelineHandle, SecureMROperatorType operatorType)
{
PipelineHandle = pipelineHandle;
OperatorType = operatorType;
}
}
public class ArithmeticComposeOperator : Operator
{
public ArithmeticComposeOperator(ulong pipelineHandle, SecureMROperatorType operatorType, ArithmeticComposeOperatorConfiguration config) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperatorArithmeticCompose(base.PipelineHandle, config.configText, out var operatorHandle);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class ElementwiseMinOperator : Operator
{
public ElementwiseMinOperator(ulong pipelineHandle, SecureMROperatorType operatorType) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperator(pipelineHandle, operatorType, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class ElementwiseMaxOperator : Operator
{
public ElementwiseMaxOperator(ulong pipelineHandle, SecureMROperatorType operatorType) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperator(pipelineHandle, operatorType, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class ElementwiseMultiplyOperator : Operator
{
public ElementwiseMultiplyOperator(ulong pipelineHandle, SecureMROperatorType operatorType) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperator(pipelineHandle, operatorType, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class CustomizedCompareOperator : Operator
{
public CustomizedCompareOperator(ulong pipelineHandle, SecureMROperatorType operatorType, ComparisonOperatorConfiguration configuration) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperatorComparison(base.PipelineHandle, configuration.comparison, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class ElementwiseOrOperator : Operator
{
public ElementwiseOrOperator(ulong pipelineHandle, SecureMROperatorType operatorType) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperator(pipelineHandle, operatorType, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class ElementwiseAndOperator : Operator
{
public ElementwiseAndOperator(ulong pipelineHandle, SecureMROperatorType operatorType) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperator(pipelineHandle, operatorType, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class AllOperator : Operator
{
public AllOperator(ulong pipelineHandle, SecureMROperatorType operatorType) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperator(pipelineHandle, operatorType, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class AnyOperator : Operator
{
public AnyOperator(ulong pipelineHandle, SecureMROperatorType operatorType) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperator(pipelineHandle, operatorType, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class NmsOperator : Operator
{
public NmsOperator(ulong pipelineHandle, SecureMROperatorType operatorType, NmsOperatorConfiguration configuration) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperatorNonMaximumSuppression(base.PipelineHandle, configuration.threshold, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class SolvePnPOperator : Operator
{
public SolvePnPOperator(ulong pipelineHandle, SecureMROperatorType operatorType) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperator(pipelineHandle, operatorType, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class GetAffineOperator : Operator
{
public GetAffineOperator(ulong pipelineHandle, SecureMROperatorType operatorType) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperator(pipelineHandle, operatorType, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class ApplyAffineOperator : Operator
{
public ApplyAffineOperator(ulong pipelineHandle, SecureMROperatorType operatorType) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperator(pipelineHandle, operatorType, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class ApplyAffinePointOperator : Operator
{
public ApplyAffinePointOperator(ulong pipelineHandle, SecureMROperatorType operatorType) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperator(pipelineHandle, operatorType, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class UvTo3DInCameraSpaceOperator : Operator
{
public UvTo3DInCameraSpaceOperator(ulong pipelineHandle, SecureMROperatorType operatorType) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperatorUVTo3D(pipelineHandle, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class AssignmentOperator : Operator
{
public AssignmentOperator(ulong pipelineHandle, SecureMROperatorType operatorType) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperator(pipelineHandle, operatorType, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class RunModelInferenceOperator : Operator
{
public RunModelInferenceOperator(ulong pipelineHandle, SecureMROperatorType operatorType, ModelOperatorConfiguration configuration) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMrOperatorModel(pipelineHandle, configuration.inputConfigs, configuration.outputConfigs, configuration.modelData, configuration.modelType, configuration.modelName, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class NormalizeOperator : Operator
{
public NormalizeOperator(ulong pipelineHandle, SecureMROperatorType operatorType, NormalizeOperatorConfiguration configuration) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperatorNormalize(pipelineHandle, configuration.normalizeType, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class CameraSpaceToWorldOperator : Operator
{
public CameraSpaceToWorldOperator(ulong pipelineHandle, SecureMROperatorType operatorType) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperator(pipelineHandle, operatorType, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class RectifiedVstAccessOperator : Operator
{
public RectifiedVstAccessOperator(ulong pipelineHandle, SecureMROperatorType operatorType) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperator(pipelineHandle, operatorType, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class ArgmaxOperator : Operator
{
public ArgmaxOperator(ulong pipelineHandle, SecureMROperatorType operatorType) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperator(pipelineHandle, operatorType, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class ConvertColorOperator : Operator
{
public ConvertColorOperator(ulong pipelineHandle, SecureMROperatorType operatorType, ColorConvertOperatorConfiguration convertConfiguration) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperatorColorConvert(pipelineHandle, convertConfiguration.convert, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class SortVectorOperator : Operator
{
public SortVectorOperator(ulong pipelineHandle, SecureMROperatorType operatorType) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperator(pipelineHandle, operatorType, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class InversionOperator : Operator
{
public InversionOperator(ulong pipelineHandle, SecureMROperatorType operatorType) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperator(pipelineHandle, operatorType, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class GetTransformMatrixOperator : Operator
{
public GetTransformMatrixOperator(ulong pipelineHandle, SecureMROperatorType operatorType) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperator(pipelineHandle, operatorType, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class SortMatrixOperator : Operator
{
public SortMatrixOperator(ulong pipelineHandle, SecureMROperatorType operatorType, SortMatrixOperatorConfiguration configuration) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperatorSortMatrix(pipelineHandle, configuration.sortType, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class SwitchGltfRenderStatusOperator : Operator
{
public SwitchGltfRenderStatusOperator(ulong pipelineHandle, SecureMROperatorType operatorType) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperator(pipelineHandle, operatorType, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class UpdateGltfOperator : Operator
{
public UpdateGltfOperator(ulong pipelineHandle, SecureMROperatorType operatorType, UpdateGltfOperatorConfiguration configuration) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperatorUpdateGltf(pipelineHandle, configuration.attribute, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class RenderTextOperator : Operator
{
public RenderTextOperator(ulong pipelineHandle, SecureMROperatorType operatorType, RenderTextOperatorConfiguration configuration) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperatorRenderText(pipelineHandle, configuration.typeface, configuration.languageAndLocale, configuration.width, configuration.height, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class LoadTextureOperator : Operator
{
public LoadTextureOperator(ulong pipelineHandle, SecureMROperatorType operatorType) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperator(pipelineHandle, operatorType, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class SvdOperator : Operator
{
public SvdOperator(ulong pipelineHandle, SecureMROperatorType operatorType) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperator(pipelineHandle, operatorType, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class NormOperator : Operator
{
public NormOperator(ulong pipelineHandle, SecureMROperatorType operatorType) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperator(pipelineHandle, operatorType, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
public class SwapHwcChwOperator : Operator
{
public SwapHwcChwOperator(ulong pipelineHandle, SecureMROperatorType operatorType) : base(pipelineHandle, operatorType)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMROperator(pipelineHandle, operatorType, out var operatorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, $"Create {operatorType} operator" + result, false);
if (result == PxrResult.SUCCESS)
{
base.OperatorHandle = operatorHandle;
}
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d416ffe3ba818044cbdb36ff404b68ee
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,201 @@
#if !PICO_OPENXR_SDK
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class Pipeline
{
public ulong pipelineHandle;
internal Pipeline(ulong frameworkHandle)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMRPipeline(frameworkHandle, out pipelineHandle);
if (result != PxrResult.SUCCESS)
{
throw new InvalidOperationException("Failed to create SecureMR pipeline" + result);
}
else
{
PLog.i(PXR_Plugin.SecureMR.TAG, "Create SecureMR pipeline success", false);
}
}
public T CreateOperator<T>() where T : Operator
{
PXR_Plugin.SecureMR.OperatorClassToEnum.TryGetValue(typeof(T), out var enumValue);
return (T)Activator.CreateInstance(typeof(T), pipelineHandle,enumValue);
}
public T CreateOperator<T>(OperatorConfiguration configuration) where T : Operator
{
PXR_Plugin.SecureMR.OperatorClassToEnum.TryGetValue(typeof(T), out var enumValue);
return (T)Activator.CreateInstance(typeof(T), pipelineHandle, enumValue, configuration);
}
public Tensor CreateTensor<T, TType>(int channels, TensorShape shape, T[] data = null)
where T : struct
where TType : TensorBase, new()
{
PXR_Plugin.SecureMR.TensorDataTypeToEnum.TryGetValue(typeof(T), out var dataType);
PXR_Plugin.SecureMR.TensorClassToEnum.TryGetValue(typeof(TType), out var enumValue);
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMRPipelineTensorByShape(pipelineHandle, false, dataType, shape.Dimensions, (sbyte)channels, enumValue, out var tensorHandle);
if (result == PxrResult.SUCCESS)
{
if (data != null)
{
result = PXR_Plugin.SecureMR.UPxr_ResetSecureMRPipelineTensor(pipelineHandle, tensorHandle, data);
if (result != PxrResult.SUCCESS)
{
throw new InvalidOperationException("Failed to set tensor data:" + result);
}
}
return new Tensor(tensorHandle, pipelineHandle, false, false);
}
else
{
throw new InvalidOperationException("Failed to create local tensor:" + result);
}
}
public Tensor CreateTensor<TType>(byte[] data)
where TType : Gltf, new()
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMRPipelineTensorByGltf(pipelineHandle, false, data, out var tensorHandle);
if (result == PxrResult.SUCCESS)
{
if (data != null)
{
result = PXR_Plugin.SecureMR.UPxr_ResetSecureMRPipelineTensor(pipelineHandle, tensorHandle, data);
if (result != PxrResult.SUCCESS)
{
throw new InvalidOperationException("Failed to set tensor data:" + result);
}
}
return new Tensor(tensorHandle, pipelineHandle, false, false);
}
else
{
throw new InvalidOperationException("Failed to create local gltf tensor:" + result);
}
}
public Tensor CreateTensorReference<T, TType>(int channels, TensorShape shape)
where T : struct
where TType : TensorBase, new()
{
PXR_Plugin.SecureMR.TensorDataTypeToEnum.TryGetValue(typeof(T), out var dataType);
PXR_Plugin.SecureMR.TensorClassToEnum.TryGetValue(typeof(TType), out var enumValue);
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMRPipelineTensorByShape(pipelineHandle, true, dataType, shape.Dimensions, (sbyte)channels, enumValue, out var tensorHandle);
if (result == PxrResult.SUCCESS)
{
return new Tensor(tensorHandle, pipelineHandle, true, false);
}
else
{
throw new InvalidOperationException("Failed to create local tensor reference:" + result);
}
}
public Tensor CreateTensorReference<TType>()
where TType : Gltf, new()
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMRPipelineTensorByGltf(pipelineHandle, true, null, out var tensorHandle);
if (result == PxrResult.SUCCESS)
{
return new Tensor(tensorHandle, pipelineHandle, true, false);
}
else
{
throw new InvalidOperationException("Failed to create local tensor reference:" + result);
}
}
public TensorMapping CreateTensorMapping()
{
return new TensorMapping();
}
public void Destroy()
{
var result = PXR_Plugin.SecureMR.UPxr_DestroySecureMRPipeline(pipelineHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, "Destroy SecureMR pipeline:" + result, false);
}
public ulong Execute(TensorMapping tensorMappings = null)
{
PxrResult result;
ulong pipelineRunHandle;
if (tensorMappings != null)
{
result = PXR_Plugin.SecureMR.UPxr_ExecuteSecureMRPipeline(pipelineHandle, tensorMappings.TensorMappings, out pipelineRunHandle);
}
else
{
result = PXR_Plugin.SecureMR.UPxr_ExecuteSecureMRPipeline(pipelineHandle, null, out pipelineRunHandle);
}
if (result == PxrResult.SUCCESS)
{
return pipelineRunHandle;
}
else
{
throw new InvalidOperationException("Failed to execute pipeline:" + result);
}
}
public ulong ExecuteAfter(ulong runId, TensorMapping tensorMappings = null)
{
PxrResult result;
ulong pipelineRunHandle;
if (tensorMappings != null)
{
result = PXR_Plugin.SecureMR.UPxr_ExecuteSecureMRPipelineAfter(pipelineHandle, runId, tensorMappings.TensorMappings, out pipelineRunHandle);
}
else
{
result = PXR_Plugin.SecureMR.UPxr_ExecuteSecureMRPipelineAfter(pipelineHandle, runId, null, out pipelineRunHandle);
}
if (result == PxrResult.SUCCESS)
{
return pipelineRunHandle;
}
else
{
throw new InvalidOperationException("Failed to execute after pipeline:" + result);
}
}
public ulong ExecuteConditional(ulong conditionTensorHandle, TensorMapping tensorMappings = null)
{
PxrResult result;
ulong pipelineRunHandle;
if (tensorMappings != null)
{
result = PXR_Plugin.SecureMR.UPxr_ExecuteSecureMRPipelineConditional(pipelineHandle, conditionTensorHandle, tensorMappings.TensorMappings, out pipelineRunHandle);
}
else
{
result = PXR_Plugin.SecureMR.UPxr_ExecuteSecureMRPipelineConditional(pipelineHandle, conditionTensorHandle, null, out pipelineRunHandle);
}
if (result == PxrResult.SUCCESS)
{
return pipelineRunHandle;
}
else
{
throw new InvalidOperationException("Failed to execute conditional pipeline:" + result);
}
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b502f489e4f24894fa0f2507435afba3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,91 @@
#if !PICO_OPENXR_SDK
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class Provider
{
private ulong providerHandle;
public Provider(int width,int height)
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMRProvider(width, height, out providerHandle);
if (result != PxrResult.SUCCESS)
{
throw new InvalidOperationException("Failed to create SecureMRProvider" + result);
}
else
{
PLog.i(PXR_Plugin.SecureMR.TAG,"Create SecureMR provider success",false);
}
}
public Pipeline CreatePipeline()
{
return new Pipeline(providerHandle);
}
public Tensor CreateTensor<T, TType>(int channels, TensorShape shape, T[] data = null)
where T : struct
where TType : TensorBase, new()
{
PXR_Plugin.SecureMR.TensorDataTypeToEnum.TryGetValue(typeof(T), out var dataType);
PXR_Plugin.SecureMR.TensorClassToEnum.TryGetValue(typeof(TType), out var enumValue);
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMRTensorByShape(providerHandle, dataType, shape.Dimensions, (sbyte)channels, enumValue, out var tensorHandle);
if (result == PxrResult.SUCCESS)
{
if (data != null)
{
result = PXR_Plugin.SecureMR.UPxr_ResetSecureMRTensor(tensorHandle, data);
if (result != PxrResult.SUCCESS)
{
throw new InvalidOperationException("Failed to set tensor data" + result);
}
}
return new Tensor(tensorHandle, 0, false, true);
}
else
{
throw new InvalidOperationException("Failed to create global tensor" + result);
}
}
public Tensor CreateTensor<TType>(byte[] data)
where TType : Gltf, new()
{
var result = PXR_Plugin.SecureMR.UPxr_CreateSecureMRTensorByGltf(providerHandle, data, out var tensorHandle);
if (result == PxrResult.SUCCESS)
{
return new Tensor(tensorHandle, 0, false, true);
}
else
{
throw new InvalidOperationException("Failed to create global gltf tensor" + result);
}
}
public void Destroy()
{
var result = PXR_Plugin.SecureMR.UPxr_DestroySecureMRProvider(providerHandle);
if (result == PxrResult.SUCCESS)
{
providerHandle = 0;
}
else
{
PLog.i(PXR_Plugin.SecureMR.TAG, "Destroy SecureMR provider failed" + result, false);
}
}
~Provider()
{
Destroy();
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cf5175349b375c2498481b2a6f6af304
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,90 @@
#if !PICO_OPENXR_SDK
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class Tensor
{
public ulong TensorHandle { get; private set; }
public ulong PipelineHandle { get; private set; }
public bool PlaceHolder { get; private set; }
public bool IsGlobalTensor { get; private set; }
public Tensor(ulong tensorHandle,ulong pipelineHandle,bool placeHolder,bool isGlobalTensor)
{
this.TensorHandle = tensorHandle;
this.PipelineHandle = pipelineHandle;
this.PlaceHolder = placeHolder;
this.IsGlobalTensor = isGlobalTensor;
}
public void Reset<T>(T[] tensorData)
{
if (IsGlobalTensor)
{
var result = PXR_Plugin.SecureMR.UPxr_ResetSecureMRTensor(TensorHandle, tensorData);
PLog.i(PXR_Plugin.SecureMR.TAG, "Reset global tensor data" + result, false);
}
else
{
var result = PXR_Plugin.SecureMR.UPxr_ResetSecureMRPipelineTensor(PipelineHandle, TensorHandle, tensorData);
PLog.i(PXR_Plugin.SecureMR.TAG, "Reset local tensor data" + result, false);
}
}
public void Destroy()
{
if (IsGlobalTensor)
{
var result = PXR_Plugin.SecureMR.UPxr_DestroySecureMRTensor(TensorHandle);
PLog.i(PXR_Plugin.SecureMR.TAG, "Destroy global tensor" + result, false);
}
}
}
public abstract class TensorBase{}
public class Color : TensorBase{}
public class Gltf { }
public class Matrix : TensorBase{}
public class Point : TensorBase{}
public class Scalar : TensorBase{}
public class Slice : TensorBase{}
public class TimeStamp : TensorBase { }
public class TensorShape
{
public int[] Dimensions { get; }
public TensorShape(params int[] dimensions)
{
if (dimensions == null || dimensions.Length == 0)
{
throw new ArgumentException("Dimensions array cannot be null or empty.");
}
Dimensions = dimensions;
}
}
public class TensorMapping
{
public Dictionary<ulong, ulong> TensorMappings { get; private set; }
public TensorMapping()
{
TensorMappings = new Dictionary<ulong, ulong>();
}
public void Set(Tensor localTensorReference, Tensor globalTensor)
{
TensorMappings.TryAdd(localTensorReference.TensorHandle, globalTensor.TensorHandle);
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0b1ab1b5f011d5b44a58551399e4bba4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: