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,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: