// %BANNER_BEGIN%
// ---------------------------------------------------------------------
// %COPYRIGHT_BEGIN%
// Copyright (c) (2018-2022) Magic Leap, Inc. All Rights Reserved.
// Use of this file is governed by the Software License Agreement, located here: https://www.magicleap.com/software-license-agreement-ml2
// Terms and conditions applicable to third-party materials accompanying this distribution may also be found in the top-level NOTICE file appearing herein.
// %COPYRIGHT_END%
// ---------------------------------------------------------------------
// %BANNER_END%
using System;
using System.Runtime.InteropServices;
namespace UnityEngine.XR.MagicLeap
{
public partial class YcbcrRenderer
{
public interface IYcbcrConversionSamplerProvider
{
///
/// Invoked by the YcbcrRenderer plugin on Unity's render thread.
/// Apps wanting to override the VkSamplerYcbcrConversionCreateInfo
/// for the hardware buffer rendering should implement this interface.
///
/// VkAndroidHardwareBufferFormatPropertiesANDROID of the currently acquired AHardwareBuffer
/// VkSamplerYcbcrConversionCreateInfo of the previous frame
/// true if the input sampler values were changed
public abstract bool OverrideYcbcrConversionSampler(ref VkAndroidHardwareBufferFormatPropertiesANDROID hwBufferFormatProperties, ref VkSamplerYcbcrConversionCreateInfo sampler);
}
[StructLayout(LayoutKind.Sequential)]
public struct VkComponentMapping
{
///
/// VkComponentSwizzle
///
public uint r;
///
/// VkComponentSwizzle
///
public uint g;
///
/// VkComponentSwizzle
///
public uint b;
///
/// VkComponentSwizzle
///
public uint a;
public override bool Equals(object obj)
{
VkComponentMapping other = (VkComponentMapping)obj;
return (r == other.r)
&& (g == other.g)
&& (b == other.b)
&& (a == other.a);
}
// satisfies the compiler since we override Equals
public override int GetHashCode() => base.GetHashCode();
}
[StructLayout(LayoutKind.Sequential)]
public struct VkAndroidHardwareBufferFormatPropertiesANDROID
{
///
/// VkStructureType
///
public uint sType;
///
/// void*
///
public IntPtr pNext;
///
/// VkFormat
///
public uint format;
///
/// uint64
///
public ulong externalFormat;
///
/// VkFormatFeatureFlags
///
public uint formatFeatures;
///
/// VkComponentMapping
///
public VkComponentMapping samplerYcbcrConversionComponents;
///
/// VkSamplerYcbcrModelConversion
///
public uint suggestedYcbcrModel;
///
/// VkSamplerYcbcrRange
///
public uint suggestedYcbcrRange;
///
/// VkChromaLocation
///
public uint suggestedXChromaOffset;
///
/// VkChromaLocation
///
public uint suggestedYChromaOffset;
}
[StructLayout(LayoutKind.Sequential)]
public struct VkSamplerYcbcrConversionCreateInfo
{
///
/// VkStructureType
///
public uint sType;
///
/// void*
///
public IntPtr pNext;
///
/// VkFormat
///
public uint format;
///
/// VkSamplerYcbcrModelConversion
///
public uint ycbcrModel;
///
/// VkSamplerYcbcrRange
///
public uint ycbcrRange;
///
/// VkComponentMapping
///
public VkComponentMapping components;
///
/// VkChromaLocation
///
public uint xChromaOffset;
///
/// VkChromaLocation
///
public uint yChromaOffset;
///
/// VkFilter
///
public uint chromaFilter;
///
/// VkBool32
///
public uint forceExplicitReconstruction;
}
}
}