Added raw UIX.RenderApi project

This commit is contained in:
Yoshi Askharoun
2021-07-11 22:59:29 -05:00
parent 6c9aacb510
commit 9fec520340
456 changed files with 45596 additions and 20 deletions
@@ -0,0 +1,31 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Render.Protocol.BLOBREF
// Assembly: UIX.RenderApi, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: D47658B8-A8EA-43D6-8837-ECE823BFFFC1
// Assembly location: C:\Program Files\Zune\UIX.RenderApi.dll
using System.Runtime.InteropServices;
namespace Microsoft.Iris.Render.Protocol
{
[ComVisible(false)]
internal struct BLOBREF
{
public static readonly BLOBREF NULL = new BLOBREF();
private uint value;
private BLOBREF(uint value) => this.value = value;
public static bool operator ==(BLOBREF hl, BLOBREF hr) => (int) hl.value == (int) hr.value;
public static bool operator !=(BLOBREF hl, BLOBREF hr) => (int) hl.value != (int) hr.value;
public override bool Equals(object oCompare) => (int) this.value == (int) (uint) oCompare;
public override int GetHashCode() => (int) this.value;
public static BLOBREF FromUInt32(uint value) => new BLOBREF(value);
public static uint ToUInt32(BLOBREF handle) => handle.value;
}
}
@@ -0,0 +1,10 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Render.Protocol.BatchCallback
// Assembly: UIX.RenderApi, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: D47658B8-A8EA-43D6-8837-ECE823BFFFC1
// Assembly location: C:\Program Files\Zune\UIX.RenderApi.dll
namespace Microsoft.Iris.Render.Protocol
{
internal delegate void BatchCallback();
}
@@ -0,0 +1,151 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Render.Protocol.BlobInfo
// Assembly: UIX.RenderApi, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: D47658B8-A8EA-43D6-8837-ECE823BFFFC1
// Assembly location: C:\Program Files\Zune\UIX.RenderApi.dll
using Microsoft.Iris.Render.Common;
using System;
namespace Microsoft.Iris.Render.Protocol
{
internal struct BlobInfo
{
private const int c_SizeOfChar = 2;
private const int c_SizeOfUInt = 4;
private Vector m_data;
private unsafe Message* m_pmsgBlob;
private uint m_totalSize;
private uint m_blobsOffset;
private bool m_foreignByteOrder;
private static object s_msgBlobSentinal = new object();
private static Vector s_cache;
public unsafe BlobInfo(RenderPort port, uint origTotal)
{
this.m_foreignByteOrder = port.ForeignByteOrder;
this.m_data = BlobInfo.s_cache;
BlobInfo.s_cache = (Vector) null;
if (this.m_data == null)
this.m_data = new Vector();
this.m_totalSize = origTotal;
this.m_blobsOffset = origTotal;
this.m_pmsgBlob = (Message*) null;
}
public uint AdjustedTotalSize => this.m_totalSize;
public uint BlobDataSize => this.m_totalSize - this.m_blobsOffset;
public BLOBREF Add(RENDERHANDLE[] param)
{
uint cbData = param == null ? 0U : (uint) (param.Length * 4);
return this.Add((object) param, cbData);
}
public BLOBREF Add(string param)
{
if (param == null)
param = "";
uint cbData = (uint) ((param.Length + 1) * 2);
return this.Add((object) param, cbData);
}
public unsafe BLOBREF Add(Message* pmsg)
{
uint cbData = 0;
if ((IntPtr) pmsg != IntPtr.Zero)
{
this.m_pmsgBlob = pmsg;
cbData = pmsg->cbSize;
}
return this.Add(BlobInfo.s_msgBlobSentinal, cbData);
}
private BLOBREF Add(object param, uint cbData)
{
Debug2.Validate(cbData < (uint) ushort.MaxValue, typeof (ArgumentException), (object) "data blob too large", (object) nameof (param));
BLOBREF blobref = BLOBREF.FromUInt32(this.m_totalSize | cbData << 16);
if (cbData != 0U)
{
if (this.m_totalSize + cbData > (uint) ushort.MaxValue)
throw new InvalidOperationException("insufficient space in message for data blob");
this.m_totalSize += cbData;
this.m_data.Add(param);
}
return blobref;
}
public unsafe void Attach(Message* pMessage)
{
byte* numPtr1 = (byte*) ((IntPtr) pMessage + (int) this.m_blobsOffset);
foreach (object obj in this.m_data)
{
if (obj is string)
{
string str = (string) obj;
fixed (char* chPtr1 = str)
{
if (!this.m_foreignByteOrder)
{
char* chPtr2 = (char*) numPtr1;
char* chPtr3 = chPtr1;
char* chPtr4 = chPtr1 + (str.Length + 1);
while (chPtr3 < chPtr4)
*chPtr2++ = *chPtr3++;
numPtr1 = (byte*) chPtr2;
}
else
{
byte* numPtr2 = (byte*) chPtr1;
for (byte* numPtr3 = numPtr2 + ((IntPtr) (str.Length + 1) * 2).ToInt64(); numPtr2 < numPtr3; numPtr2 += 2)
{
*numPtr1++ = numPtr2[1];
*numPtr1++ = *numPtr2;
}
}
}
}
else if (obj is RENDERHANDLE[])
{
RENDERHANDLE[] renderhandleArray = (RENDERHANDLE[]) obj;
fixed (RENDERHANDLE* renderhandlePtr = renderhandleArray)
{
if (!this.m_foreignByteOrder)
{
uint* numPtr2 = (uint*) numPtr1;
uint* numPtr3 = (uint*) renderhandlePtr;
uint* numPtr4 = numPtr3 + renderhandleArray.Length;
while (numPtr3 < numPtr4)
*numPtr2++ = *numPtr3++;
numPtr1 = (byte*) numPtr2;
}
else
{
byte* numPtr2 = (byte*) renderhandlePtr;
for (byte* numPtr3 = numPtr2 + ((IntPtr) renderhandleArray.Length * 4).ToInt64(); numPtr2 < numPtr3; numPtr2 += 4)
{
*numPtr1++ = numPtr2[3];
*numPtr1++ = numPtr2[2];
*numPtr1++ = numPtr2[1];
*numPtr1++ = *numPtr2;
}
}
}
}
else if (obj == BlobInfo.s_msgBlobSentinal)
{
byte* pmsgBlob = (byte*) this.m_pmsgBlob;
byte* numPtr2 = pmsgBlob + (int) this.m_pmsgBlob->cbSize;
while (pmsgBlob < numPtr2)
*numPtr1++ = *pmsgBlob++;
}
else
Debug2.Throw(false, "Unexpected type.");
}
this.m_data.Clear();
BlobInfo.s_cache = this.m_data;
this.m_data = (Vector) null;
}
}
}
@@ -0,0 +1,19 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Render.Protocol.CallbackMessage
// Assembly: UIX.RenderApi, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: D47658B8-A8EA-43D6-8837-ECE823BFFFC1
// Assembly location: C:\Program Files\Zune\UIX.RenderApi.dll
using System.Runtime.InteropServices;
namespace Microsoft.Iris.Render.Protocol
{
[ComVisible(false)]
internal struct CallbackMessage
{
public uint cbSize;
public uint nMsg;
public RENDERHANDLE idObjectSubject;
public RENDERHANDLE hTarget;
}
}
@@ -0,0 +1,16 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Render.Protocol.ConnectionInfo
// Assembly: UIX.RenderApi, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: D47658B8-A8EA-43D6-8837-ECE823BFFFC1
// Assembly location: C:\Program Files\Zune\UIX.RenderApi.dll
using System;
namespace Microsoft.Iris.Render.Protocol
{
[Serializable]
internal abstract class ConnectionInfo
{
public static readonly ConnectionInfo Default = (ConnectionInfo) new LocalConnectionInfo();
}
}
@@ -0,0 +1,34 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Render.Protocol.ContextID
// Assembly: UIX.RenderApi, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: D47658B8-A8EA-43D6-8837-ECE823BFFFC1
// Assembly location: C:\Program Files\Zune\UIX.RenderApi.dll
using System;
using System.Runtime.InteropServices;
namespace Microsoft.Iris.Render.Protocol
{
[ComVisible(false)]
[Serializable]
internal struct ContextID
{
public static readonly ContextID NULL = new ContextID();
public static readonly ContextID CURRENT = new ContextID(uint.MaxValue);
private uint value;
private ContextID(uint value) => this.value = value;
public static bool operator ==(ContextID hl, ContextID hr) => (int) hl.value == (int) hr.value;
public static bool operator !=(ContextID hl, ContextID hr) => (int) hl.value != (int) hr.value;
public override bool Equals(object oCompare) => oCompare is ContextID contextId && (int) this.value == (int) contextId.value;
public override int GetHashCode() => (int) this.value;
public static ContextID FromUInt32(uint value) => new ContextID(value);
public static uint ToUInt32(ContextID handle) => handle.value;
}
}
@@ -0,0 +1,105 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Render.Protocol.DataBuffer
// Assembly: UIX.RenderApi, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: D47658B8-A8EA-43D6-8837-ECE823BFFFC1
// Assembly location: C:\Program Files\Zune\UIX.RenderApi.dll
using Microsoft.Iris.Render.Protocols.Splash.Messaging;
using System;
namespace Microsoft.Iris.Render.Protocol
{
internal class DataBuffer : IDataBufferCallback, IRenderHandleOwner
{
private RenderPort m_port;
private RemoteDataBuffer m_remoteBuffer;
private unsafe void* m_pvData;
private uint m_cbSize;
public unsafe DataBuffer(RenderPort port, void* pvData, uint cbSize)
{
this.m_port = port;
this.m_remoteBuffer = (RemoteDataBuffer) null;
this.m_pvData = pvData;
this.m_cbSize = cbSize;
}
~DataBuffer() => this.Dispose(false);
public void Dispose()
{
this.m_port.Session.AssertOwningThread();
GC.SuppressFinalize((object) this);
this.Dispose(true);
}
private void Dispose(bool fInDispose)
{
if (fInDispose && this.m_remoteBuffer != null)
this.m_remoteBuffer.Dispose();
this.m_remoteBuffer = (RemoteDataBuffer) null;
}
public RenderPort Port => this.m_port;
public uint DataSize => this.m_cbSize;
public unsafe void* Data => this.m_pvData;
public RemoteDataBuffer RemoteStub => this.m_remoteBuffer;
public unsafe void Commit()
{
RENDERHANDLE renderhandle = this.m_port.AllocHandle((IRenderHandleOwner) this);
try
{
this.m_port.SendDataBuffer(this.m_pvData, this.m_cbSize, renderhandle);
this.m_remoteBuffer = RemoteDataBuffer.CreateFromHandle(this.m_port, renderhandle);
this.m_remoteBuffer.SendRegisterOwner(this.m_port.MessagingProtocol.LocalDataBufferCallbackHandle);
renderhandle = RENDERHANDLE.NULL;
}
finally
{
if (renderhandle != RENDERHANDLE.NULL)
{
if (this.m_remoteBuffer != null)
{
this.m_remoteBuffer.Dispose();
this.m_remoteBuffer = (RemoteDataBuffer) null;
}
else
this.m_port.FreeHandle(renderhandle);
}
}
}
public event EventHandler DataConsumed;
protected virtual void OnDataConsumed(object sender, EventArgs args)
{
this.OnReleaseLocalData();
if (this.DataConsumed == null)
return;
this.DataConsumed(sender, args);
}
protected void OnDataConsumed() => this.OnDataConsumed((object) this, EventArgs.Empty);
public event EventHandler ReleaseLocalData;
protected virtual void OnReleaseLocalData(object sender, EventArgs args)
{
if (this.ReleaseLocalData == null)
return;
this.ReleaseLocalData(sender, args);
}
protected void OnReleaseLocalData() => this.OnReleaseLocalData((object) this, EventArgs.Empty);
RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteBuffer.RenderHandle;
void IRenderHandleOwner.OnDisconnect() => this.m_remoteBuffer = (RemoteDataBuffer) null;
void IDataBufferCallback.OnComplete(RENDERHANDLE target) => this.OnDataConsumed();
}
}
@@ -0,0 +1,151 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Render.Protocol.DataBufferTracker
// Assembly: UIX.RenderApi, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: D47658B8-A8EA-43D6-8837-ECE823BFFFC1
// Assembly location: C:\Program Files\Zune\UIX.RenderApi.dll
using Microsoft.Iris.Render.Internal;
using System;
namespace Microsoft.Iris.Render.Protocol
{
internal class DataBufferTracker
{
private Vector m_alTracking;
internal DataBufferTracker(object objUser) => this.m_alTracking = new Vector();
~DataBufferTracker() => this.Dispose(false);
internal void Dispose()
{
GC.SuppressFinalize((object) this);
this.Dispose(true);
}
private void Dispose(bool fInDispose)
{
if (fInDispose && this.m_alTracking != null && this.m_alTracking.Count > 0)
{
foreach (DataBufferTracker.TrackingInfo trackingInfo in this.m_alTracking)
trackingInfo.DataBuffer.Dispose();
this.m_alTracking.Clear();
}
this.m_alTracking = (Vector) null;
}
internal int Count => this.m_alTracking.Count;
internal string DEBUG_Description => (string) null;
internal object DEBUG_User => (object) null;
internal event EventHandler TrackerEmpty;
protected virtual void OnTrackerEmpty(object sender, EventArgs args)
{
if (this.TrackerEmpty == null)
return;
this.TrackerEmpty(sender, args);
}
internal void Track(DataBuffer dataBuffer) => this.Track(dataBuffer, (DataBufferTracker.CleanupEventHandler) null, (object) null);
internal void Track(
DataBuffer dataBuffer,
DataBufferTracker.CleanupEventHandler handler,
object contextData)
{
DataBufferTracker.TrackingInfo trackingInfo = new DataBufferTracker.TrackingInfo(dataBuffer, DataBufferTracker.Users.Valid, handler, contextData);
dataBuffer.DataConsumed += new EventHandler(this.OnDataConsumed);
dataBuffer.ReleaseLocalData += new EventHandler(this.OnReleaseLocalData);
this.m_alTracking.Add((object) trackingInfo);
}
internal void Release(DataBuffer dataBuffer, DataBufferTracker.Users userFlags)
{
DataBufferTracker.TrackingInfo trackingInfo1 = (DataBufferTracker.TrackingInfo) null;
foreach (DataBufferTracker.TrackingInfo trackingInfo2 in this.m_alTracking)
{
if (trackingInfo2.DataBuffer == dataBuffer)
{
trackingInfo1 = trackingInfo2;
break;
}
}
if (trackingInfo1 == null)
return;
uint userFlags1 = (uint) trackingInfo1.UserFlags;
Bits.ClearFlag(ref userFlags1, (uint) userFlags);
trackingInfo1.UserFlags = (DataBufferTracker.Users) userFlags1;
if (userFlags1 != 0U)
return;
if (trackingInfo1.CleanupHandler != null)
trackingInfo1.CleanupHandler((object) this, new DataBufferTracker.CleanupEventArgs(trackingInfo1.CleanupHandlerData));
this.m_alTracking.Remove((object) trackingInfo1);
trackingInfo1.DataBuffer.DataConsumed -= new EventHandler(this.OnDataConsumed);
trackingInfo1.DataBuffer.ReleaseLocalData -= new EventHandler(this.OnReleaseLocalData);
trackingInfo1.DataBuffer.Dispose();
trackingInfo1.DataBuffer = (DataBuffer) null;
trackingInfo1.CleanupHandler = (DataBufferTracker.CleanupEventHandler) null;
trackingInfo1.CleanupHandlerData = (object) null;
if (this.m_alTracking.Count != 0)
return;
this.OnTrackerEmpty((object) this, EventArgs.Empty);
}
private void OnDataConsumed(object oSender, EventArgs args) => this.Release(oSender as DataBuffer, DataBufferTracker.Users.Consumed);
private void OnReleaseLocalData(object oSender, EventArgs args) => this.Release(oSender as DataBuffer, DataBufferTracker.Users.LocalData);
internal void DEBUG_SetDescription(string stDescription)
{
}
internal void DEBUG_DumpTrackingList()
{
}
[System.Flags]
internal enum Users : uint
{
Consumed = 1,
LocalData = 2,
Valid = LocalData | Consumed, // 0x00000003
}
internal class CleanupEventArgs : EventArgs
{
public object ContextData;
internal CleanupEventArgs(object contextData) => this.ContextData = contextData;
}
internal delegate void CleanupEventHandler(
object sender,
DataBufferTracker.CleanupEventArgs args);
private class TrackingInfo
{
private static uint s_idSeed;
internal DataBuffer DataBuffer;
internal DataBufferTracker.Users UserFlags;
internal uint Id;
internal DataBufferTracker.CleanupEventHandler CleanupHandler;
internal object CleanupHandlerData;
internal TrackingInfo(
DataBuffer dataBuffer,
DataBufferTracker.Users userFlags,
DataBufferTracker.CleanupEventHandler handler,
object contextData)
{
this.DataBuffer = dataBuffer;
this.UserFlags = userFlags;
this.Id = DataBufferTracker.TrackingInfo.s_idSeed++;
this.CleanupHandler = handler;
this.CleanupHandlerData = contextData;
}
}
}
}
@@ -0,0 +1,263 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Render.Protocol.EngineApi
// Assembly: UIX.RenderApi, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: D47658B8-A8EA-43D6-8837-ECE823BFFFC1
// Assembly location: C:\Program Files\Zune\UIX.RenderApi.dll
using Microsoft.Iris.Render.Common;
using Microsoft.Iris.Render.Internal;
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Security;
namespace Microsoft.Iris.Render.Protocol
{
[SuppressUnmanagedCodeSecurity]
internal static class EngineApi
{
private const string s_stEhRenderDll = "UIXRender.dll";
public static void IFC(HRESULT hr)
{
if (hr.Int >= 0)
return;
RenderException.ErrorCode code = (RenderException.ErrorCode) hr.Int;
switch (hr.Int)
{
case -2147221503:
case -2147221502:
throw new OutOfMemoryException();
case -2147221494:
throw new RenderException(code, "Generic failure.");
case -2147221493:
throw new RenderException(code, "The object is in a \"busy\" state and is not available to process the request.");
case -2147221492:
throw new RenderException(code, "The object is not in a usable state to process the request.");
case -2147221484:
throw new RenderException(code, "The Context has not been initialized.");
case -2147221474:
throw new RenderException(code, "The object was used in the incorrect context.");
case -2147221473:
throw new RenderException(code, "The Context has been marked to only allow read-only operations. For example, this may be in the middle of a read-only callback.");
case -2147221472:
throw new RenderException(code, "The threading model has already be determined by a previous call to SpInit() and can no longer be changed.");
case -2147221471:
throw new RenderException(code, "Unable to use the IGMM_STANDARD messaging model because it is either unsupported or cannot be installed.");
case -2147221464:
throw new RenderException(code, "Can not mix an invalid coordinate mapping, for example having a non-relative child of a relative parent.");
case -2147221454:
throw new RenderException(code, "Could not find a MSGID for one of the requested messages. This will be represented by a '0' in the MSGID field for that message.");
case -2147221444:
throw new RenderException(code, "The operation is not legal because the specified Gadget does not have a GS_BUFFERED style.");
case -2147221434:
throw new RenderException(code, "The specific Gadget has started the destruction and can not be be modified in this manner.");
case -2147221433:
throw new RenderException(code, "The specific object is locked and may not be modified.");
case -2147221432:
throw new InvalidOperationException("The operation is not supported.");
case -2147221424:
throw new RenderException(code, "The specified optional component has not yet been initialized with InitGadgetComponent().");
case -2147221414:
throw new RenderException(code, "The specified object was not found.");
case -2147221413:
throw new RenderException(code, "The ObjectID is already in use.");
case -2147221412:
throw new FileNotFoundException("The specified file could not be found");
case -2147221411:
throw new ArgumentOutOfRangeException("", "The argument is out of range");
case -2147221404:
throw new RenderException(code, "The specified parmeters are mismatched for the current object state.");
case -2147221394:
throw new RenderException(code, "GDI+ was unable to be loaded. It may not be installed on the system or may not be properly initialized.");
case -2147221393:
throw new RenderException(code, "Direct3D was unable to be loaded. It may not be installed on the system or may not be properly initialized.");
case -2147221384:
throw new RenderException(code, "The specified class was already registered.");
case -2147221383:
throw new RenderException(code, "The specified message was not found during class registration.");
case -2147221382:
throw new RenderException(code, "The specified message was not implemented during class registration.");
case -2147221381:
throw new RenderException(code, "The implementation of the specific class has not yet been registered.");
case -2147221380:
throw new RenderException(code, "Sending the message failed.");
case -2147221379:
throw new RenderException(code, "The message data is too large.");
case -2147221374:
throw new RenderException(code, "The specified object does not have any content.");
case -2147221373:
throw new RenderException(code, "The specified object is not properly setup to store the data.");
case -2147221364:
throw new RenderException(code, "Generic failure from Win32 that did not SetLastError().");
case -2147221363:
throw new RenderException(code, "Generic failure from GDI+.");
case -2147221362:
throw new RenderException(code, "Generic failure from driver or rendering.");
case -2147221354:
throw new RenderException(code, "Unable to connect to remote renderer.");
default:
Marshal.ThrowExceptionForHR(hr.Int);
break;
}
}
[DllImport("UIXRender.dll")]
public static extern HRESULT SpInit(ref EngineApi.InitArgs args);
[DllImport("UIXRender.dll")]
public static extern HRESULT SpUninit();
[DllImport("UIXRender.dll")]
public static extern unsafe HRESULT SpBufferOpen(
EngineApi.BufferInfo* phdrData,
void* pvData);
[DllImport("UIXRender.dll")]
public static extern unsafe HRESULT SpWrapBufferProc(
EngineApi.MessageBufferEventHandler pfnProcessBufferProc,
IntPtr* ppNativeProc);
[DllImport("UIXRender.dll", CharSet = CharSet.Auto)]
public static extern HRESULT SpPeekMessage(
out Win32Api.MSG msg,
HWND hwnd,
uint nMsgFilterMin,
uint nMsgFilterMax,
uint wRemoveMsg,
out EngineApi.WorkResult nResult);
[DllImport("UIXRender.dll")]
public static extern HRESULT SpWaitMessage(uint nTimeOutMs, IntPtr _unused);
[DllImport("UIXRender.dll")]
public static extern HRESULT SpInvoke(
ContextID idContext,
IntPtr pfnInvoke,
IntPtr pvArgs,
bool synchronous);
[DllImport("UIXRender.dll")]
public static extern HRESULT SpRenderThreadInit(
ref EngineApi.InitArgs argsRender,
out IntPtr pThread);
[DllImport("UIXRender.dll")]
public static extern HRESULT SpRenderThreadUninit(IntPtr pThread);
[DllImport("UIXRender.dll", CharSet = CharSet.Unicode)]
public static extern HRESULT SpRemoteCreateServerStreams(
string stSession,
TransportProtocol nProtocol,
out IntPtr pSendStream,
out IntPtr pReceiveStream);
[DllImport("UIXRender.dll")]
public static extern HRESULT SpRemoteWaitServerStreamsConnected(
TransportProtocol nProtocol,
IntPtr pSendStream,
IntPtr pReceiveStream);
[DllImport("UIXRender.dll")]
public static extern HRESULT SpRemoteServerInit(
IntPtr pSendStream,
IntPtr pReceiveStream,
EngineApi.InitArgs argsSend,
out IntPtr pSession);
[DllImport("UIXRender.dll")]
public static extern HRESULT SpRemoteServerUninit(
IntPtr pSession,
bool fForceShutdown,
out ShutdownReason nShutdownReason);
[DllImport("UIXRender.dll", CharSet = CharSet.Ansi)]
public static extern HRESULT SpDx9CompileEffect(
string stEffect,
string stDefines,
out IntPtr pErrorString,
out IntPtr pErrorBuffer,
out IntPtr pEffectBlob,
out uint EffectBlobSize,
out IntPtr pEffectBlobBuffer);
[DllImport("UIXRender.dll")]
public static extern void SpObjectRelease(IntPtr pUnknown);
[System.Flags]
public enum BufferFlags
{
IsBatch = 1,
CopyData = 2,
Valid = CopyData | IsBatch, // 0x00000003
}
[ComVisible(false)]
public struct BufferInfo
{
public ContextID idContextSrc;
public ContextID idContextDest;
public RENDERHANDLE idBuffer;
public EngineApi.BufferFlags nFlags;
public uint cbSizeBuffer;
}
internal delegate void TimeoutEventHandler(IntPtr pData);
[ComVisible(false)]
internal struct InitArgs
{
public uint cbSize;
public ContextID idContext;
public int cItemsPerGroupBits;
public int cGroupBits;
public IntPtr pfnProcessBuffer;
public IntPtr pvProcessData;
public RENDERHANDLE idObjectBrokerClass;
public EngineApi.TimeoutEventHandler pfnTimeout;
public IntPtr pvTimeoutData;
public uint nTimeOutSec;
public InitArgs(MessageCookieLayout layout, ContextID idContextNew)
{
Debug2.Validate(idContextNew != ContextID.NULL, typeof (ArgumentNullException), nameof (idContextNew));
this.cbSize = (uint) Marshal.SizeOf(typeof (EngineApi.InitArgs));
this.idContext = idContextNew;
this.cItemsPerGroupBits = (int) layout.numberOfObjectBits;
this.cGroupBits = (int) layout.numberOfGroupBits;
this.pfnProcessBuffer = IntPtr.Zero;
this.pvProcessData = IntPtr.Zero;
this.idObjectBrokerClass = RENDERHANDLE.FromUInt32(0U);
this.pfnTimeout = (EngineApi.TimeoutEventHandler) null;
this.pvTimeoutData = IntPtr.Zero;
this.nTimeOutSec = 0U;
}
public unsafe InitArgs(
MessageCookieLayout layout,
ContextID idContextNew,
EngineApi.MessageBufferEventHandler pfnProcessBufferProc)
: this(layout, idContextNew)
{
if (pfnProcessBufferProc == null)
return;
IntPtr num;
EngineApi.IFC(EngineApi.SpWrapBufferProc(pfnProcessBufferProc, &num));
this.pfnProcessBuffer = num;
}
}
internal unsafe delegate int MessageBufferEventHandler(
IntPtr pData,
uint hContext,
EngineApi.BufferInfo* pBufferInfo,
void* pvBufferData);
[System.Flags]
public enum WorkResult : uint
{
ProcessedMessage = 1,
NewUserMessage = 2,
}
}
}
@@ -0,0 +1,367 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Render.Protocol.HandleGroup
// Assembly: UIX.RenderApi, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: D47658B8-A8EA-43D6-8837-ECE823BFFFC1
// Assembly location: C:\Program Files\Zune\UIX.RenderApi.dll
using Microsoft.Iris.Render.Common;
using System;
using System.Collections;
using System.Runtime.InteropServices;
namespace Microsoft.Iris.Render.Protocol
{
internal class HandleGroup : RenderObject, IDisposable, IEnumerable, IRenderHandleOwner
{
private const int USAGE_INDEX_SHIFT = 5;
private const uint USAGE_INDEX_MASK = 31;
private const uint USAGE_SLOT_COUNT = 32;
private const uint USAGE_FULL_MASK = 4294967295;
private const uint LOWEST_BIT = 1;
private const uint INITIAL_BSEARCH_SPLIT = 16;
private const uint INITIAL_BSEARCH_TEST = 65535;
private static GCHandle s_gchEmpty = new GCHandle();
private RenderPort m_portOwner;
private GCHandleType m_ht;
private GCHandle[] m_objects;
private uint[] m_usage;
private byte[] m_uniqueness;
private uint m_alloc;
private uint m_used;
private uint m_hint;
private uint m_maxObjects;
public HandleGroup(GCHandleType ht, RenderPort portOwner)
: this(ht, portOwner, false, uint.MaxValue)
{
}
public HandleGroup(GCHandleType ht, RenderPort portOwner, bool uniquify)
: this(ht, portOwner, uniquify, uint.MaxValue)
{
}
public HandleGroup(GCHandleType ht, RenderPort portOwner, uint maxObjects)
: this(ht, portOwner, false, maxObjects)
{
}
public HandleGroup(GCHandleType ht, RenderPort portOwner, bool uniquify, uint maxObjects)
{
Debug2.Validate(portOwner != null, typeof (ArgumentNullException), (object) nameof (portOwner), (object) "Must specify valid owner");
this.m_ht = ht;
this.m_portOwner = portOwner;
this.m_maxObjects = maxObjects;
if (!uniquify)
return;
this.m_uniqueness = new byte[1];
}
protected override void Dispose(bool inDispose)
{
try
{
this.Clear();
}
finally
{
base.Dispose(inDispose);
}
}
RENDERHANDLE IRenderHandleOwner.RenderHandle => RENDERHANDLE.NULL;
void IRenderHandleOwner.OnDisconnect()
{
}
public IRenderHandleOwner this[uint index]
{
get
{
this.ValidateSlot(index);
GCHandle gcHandle = this.m_objects[(IntPtr) index];
return !gcHandle.IsAllocated ? (IRenderHandleOwner) null : (IRenderHandleOwner) gcHandle.Target;
}
set
{
this.ValidateSlot(index);
this.SetIndex(index, value);
}
}
public uint Count => this.m_alloc;
public IEnumerator GetEnumerator() => new HandleGroup.ObjectCopy(this).GetEnumerator();
public IRenderHandleOwner Get(
uint index,
uint expectedUniqueness,
bool fAllowInvalid)
{
if (!this.ValidateAccess(index, expectedUniqueness, fAllowInvalid))
return (IRenderHandleOwner) null;
GCHandle gcHandle = this.m_objects[(IntPtr) index];
return !gcHandle.IsAllocated ? (IRenderHandleOwner) null : (IRenderHandleOwner) gcHandle.Target;
}
public IRenderHandleOwner Get(uint index, uint expectedUniqueness) => this.Get(index, expectedUniqueness, false);
public void Set(uint index, uint expectedUniqueness, IRenderHandleOwner owner)
{
this.ValidateAccess(index, expectedUniqueness);
this.SetIndex(index, owner);
}
public void Clear()
{
if (this.m_objects == null)
return;
for (uint index = 0; (long) index < (long) this.m_objects.Length; ++index)
this.SetIndex(index, (IRenderHandleOwner) null);
this.m_objects = (GCHandle[]) null;
this.m_usage = (uint[]) null;
if (this.m_uniqueness != null)
this.m_uniqueness = new byte[1];
this.m_alloc = 0U;
this.m_used = 0U;
this.m_hint = 0U;
}
public uint Add(IRenderHandleOwner owner) => this.Add(owner, out uint _);
public uint Add(IRenderHandleOwner owner, out uint unique)
{
if (this.m_used >= this.m_alloc)
this.GrowStorage();
uint index = this.AllocSlot();
this.SetIndex(index, owner);
this.UpdateUniqueness(index, out unique);
return index;
}
public void AddAtIndex(IRenderHandleOwner owner, uint index) => this.AddAtIndex(owner, index, out uint _);
public void AddAtIndex(IRenderHandleOwner owner, uint index, out uint unique)
{
if (index >= this.m_alloc)
this.GrowStorageTo(index + 1U);
this.AllocSlotAt(index);
this.SetIndex(index, owner);
this.UpdateUniqueness(index, out unique);
}
public void AddAtIndexWithKnownUniqueness(
IRenderHandleOwner owner,
uint index,
uint unique,
bool fUpdateExisting)
{
if (index >= this.m_alloc)
this.GrowStorageTo(index + 1U);
if (fUpdateExisting && !this.ValidateSlotFree(index, true))
Debug2.Validate(this.Get(index, unique) == null, typeof (ArgumentException), "Should only be updating a null owner");
else
this.AllocSlotAt(index);
this.SetIndex(index, owner);
this.SetUniqueness(index, unique);
}
public void Remove(uint index)
{
this.ValidateSlot(index);
this.SetIndex(index, (IRenderHandleOwner) null);
this.FreeSlot(index);
}
public void Remove(uint index, uint expectedUniqueness)
{
this.ValidateAccess(index, expectedUniqueness);
this.SetIndex(index, (IRenderHandleOwner) null);
this.FreeSlot(index);
}
private static bool IsEmpty(GCHandle gch) => GCHandle.ToIntPtr(gch) == IntPtr.Zero;
private void SetIndex(uint index, IRenderHandleOwner newOwner)
{
GCHandle gch = this.m_objects[(IntPtr) index];
if (!HandleGroup.IsEmpty(gch))
{
((IRenderHandleOwner) gch.Target)?.OnDisconnect();
gch.Free();
}
if (newOwner != null)
this.m_objects[(IntPtr) index] = GCHandle.Alloc((object) newOwner, this.m_ht);
else
this.m_objects[(IntPtr) index] = HandleGroup.s_gchEmpty;
}
private void UpdateUniqueness(uint index, out uint unique)
{
byte num1 = 0;
if (this.m_uniqueness != null)
{
byte num2 = this.m_uniqueness[(IntPtr) index];
num1 = num2 >= byte.MaxValue ? (byte) 1 : (byte) ((uint) num2 + 1U);
this.m_uniqueness[(IntPtr) index] = num1;
}
unique = (uint) num1;
}
private void SetUniqueness(uint index, uint unique)
{
Debug2.Validate(unique <= (uint) byte.MaxValue, typeof (ArgumentOutOfRangeException), "Uniqueness must be a byte");
if (this.m_uniqueness == null)
return;
this.m_uniqueness[(IntPtr) index] = (byte) (unique & (uint) byte.MaxValue);
}
private void ValidateSlot(uint index) => this.ValidateSlot(index, false);
private bool ValidateSlot(uint index, bool fAllowInvalid)
{
bool flag = false;
if (index < this.m_alloc && ((int) this.m_usage[(IntPtr) (index >> 5)] & 1 << (int) index) != 0)
flag = true;
Debug2.Throw(flag || fAllowInvalid, "Slot is not allocated");
return flag;
}
private void ValidateSlotFree(uint index) => this.ValidateSlotFree(index, false);
private bool ValidateSlotFree(uint index, bool fAllowInvalid)
{
bool flag = false;
if (index < this.m_alloc && ((int) this.m_usage[(IntPtr) (index >> 5)] & 1 << (int) index) == 0)
flag = true;
Debug2.Throw(flag || fAllowInvalid, "Slot is not free");
return flag;
}
private void ValidateAccess(uint index, uint expectedUniqueness) => this.ValidateAccess(index, expectedUniqueness, false);
private bool ValidateAccess(uint index, uint expectedUniqueness, bool fAllowInvalid)
{
if (!this.ValidateSlot(index, fAllowInvalid))
return false;
uint num = 0;
if (this.m_uniqueness != null)
num = (uint) this.m_uniqueness[(IntPtr) index];
bool flag = (int) expectedUniqueness == (int) num;
Debug2.Throw(flag || fAllowInvalid, "Slot uniqueness is stale");
return flag;
}
private uint AllocSlot()
{
uint num1 = 0;
uint hint;
for (hint = this.m_hint; (long) hint < (long) this.m_usage.Length; ++hint)
{
num1 = this.m_usage[(IntPtr) hint];
if (num1 != uint.MaxValue)
break;
}
this.m_hint = hint;
uint num2 = 16;
uint maxValue = (uint) ushort.MaxValue;
uint num3 = 0;
do
{
if (((int) num1 & (int) maxValue) == (int) maxValue)
{
num1 >>= (int) num2;
num3 += num2;
}
num2 >>= 1;
maxValue >>= (int) num2;
}
while (num2 != 0U);
this.m_usage[(IntPtr) hint] |= 1U << (int) num3;
++this.m_used;
return hint << 5 | num3;
}
private void AllocSlotAt(uint index)
{
this.ValidateSlotFree(index);
this.m_usage[(IntPtr) (index >> 5)] |= 1U << (int) index;
++this.m_used;
}
private void FreeSlot(uint index)
{
uint num = index >> 5;
this.m_usage[(IntPtr) num] &= (uint) ~(1 << (int) index);
--this.m_used;
if (this.m_hint <= num)
return;
this.m_hint = num;
}
private void GrowStorage()
{
Debug2.Validate(this.m_alloc < this.m_maxObjects, typeof (InvalidOperationException), "Too many video resources have been allocated");
uint newSize = this.m_alloc * 2U;
if (newSize == 0U)
newSize = 32U;
if (newSize > this.m_maxObjects)
newSize = this.m_maxObjects;
this.GrowStorageTo(newSize);
}
private void GrowStorageTo(uint newSize)
{
Debug2.Validate(newSize > this.m_alloc, typeof (ArgumentException), nameof (newSize));
Debug2.Validate(newSize <= this.m_maxObjects, typeof (InvalidOperationException), "Too many video resources have been allocated");
GCHandle[] gcHandleArray = new GCHandle[(IntPtr) newSize];
uint[] numArray1 = (uint[]) null;
byte[] numArray2 = (byte[]) null;
uint num = (uint) ((int) newSize + 32 - 1) >> 5;
if (this.m_usage == null || (long) this.m_usage.Length < (long) num)
numArray1 = new uint[(IntPtr) num];
if (this.m_uniqueness != null)
{
numArray2 = new byte[(IntPtr) newSize];
Array.Copy((Array) this.m_uniqueness, (Array) numArray2, this.m_uniqueness.Length);
}
if (this.m_objects != null)
{
Array.Copy((Array) this.m_objects, (Array) gcHandleArray, this.m_objects.Length);
if (numArray1 != null)
Array.Copy((Array) this.m_usage, (Array) numArray1, this.m_usage.Length);
this.m_hint = (uint) this.m_usage.Length;
}
this.m_objects = gcHandleArray;
if (numArray1 != null)
this.m_usage = numArray1;
this.m_uniqueness = numArray2;
this.m_alloc = newSize;
}
private class ObjectCopy
{
private IRenderHandleOwner[] m_arObjects;
public ObjectCopy(HandleGroup map)
{
uint used = map.m_used;
this.m_arObjects = new IRenderHandleOwner[(IntPtr) used];
uint num = 0;
for (uint index = 0; index < used; ++index)
{
GCHandle gch = map.m_objects[(IntPtr) index];
if (!HandleGroup.IsEmpty(gch))
{
IRenderHandleOwner target = (IRenderHandleOwner) gch.Target;
if (target != null)
this.m_arObjects[(IntPtr) num++] = target;
}
}
}
public IEnumerator GetEnumerator() => this.m_arObjects.GetEnumerator();
}
}
}
@@ -0,0 +1,179 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Render.Protocol.HandleTable
// Assembly: UIX.RenderApi, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: D47658B8-A8EA-43D6-8837-ECE823BFFFC1
// Assembly location: C:\Program Files\Zune\UIX.RenderApi.dll
using Microsoft.Iris.Render.Common;
using System;
using System.Collections;
using System.Runtime.InteropServices;
namespace Microsoft.Iris.Render.Protocol
{
internal class HandleTable : RenderObject, IComparer
{
private RenderPort m_portOwner;
private HandleGroup m_groups;
private uint m_MaxObjectsPerGroup;
private int m_GroupShift;
private int m_UniqueShift;
private uint m_GroupMask;
private uint m_ObjectMask;
private uint m_UniqueMask;
public HandleTable(RenderPort portOwner, MessageCookieLayout layout)
{
Debug2.Validate(portOwner != null, typeof (ArgumentNullException), nameof (portOwner));
this.m_portOwner = portOwner;
uint maxObjects = 1U << (int) layout.numberOfGroupBits;
this.m_MaxObjectsPerGroup = 1U << (int) layout.numberOfObjectBits;
this.m_GroupShift = (int) layout.numberOfObjectBits;
this.m_UniqueShift = (int) layout.numberOfObjectBits + (int) layout.numberOfGroupBits;
this.m_GroupMask = (uint) ((int) maxObjects - 1 << this.m_GroupShift);
this.m_ObjectMask = this.m_MaxObjectsPerGroup - 1U;
this.m_UniqueMask = (uint) ~((int) this.m_GroupMask | (int) this.m_ObjectMask);
this.m_groups = new HandleGroup(GCHandleType.Normal, this.m_portOwner, maxObjects);
}
protected override void Dispose(bool inDispose)
{
try
{
if (!inDispose)
return;
foreach (HandleGroup group in this.m_groups)
group?.Dispose();
this.m_groups.Clear();
this.m_groups = (HandleGroup) null;
}
finally
{
base.Dispose(inDispose);
}
}
public RENDERHANDLE Alloc(RENDERGROUP groupId, IRenderHandleOwner owner)
{
uint uint32 = RENDERGROUP.ToUInt32(groupId);
HandleGroup group = this.m_groups[uint32] as HandleGroup;
Debug2.Validate(group != null, typeof (ArgumentException), (object) "Group does not exist", (object) nameof (groupId));
uint unique;
uint num = group.Add(owner, out unique);
return RENDERHANDLE.FromUInt32((uint) ((int) unique << this.m_UniqueShift | (int) uint32 << this.m_GroupShift) | num);
}
public void AllocWithId(IRenderHandleOwner owner, RENDERHANDLE handle, bool fUpdateExisting)
{
uint unique;
HandleGroup group;
uint index;
this.MapHandle(handle, true, out unique, out group, out index);
group.AddAtIndexWithKnownUniqueness(owner, index, unique, fUpdateExisting);
}
public void Free(RENDERHANDLE handle)
{
uint unique;
HandleGroup group;
uint index;
this.MapHandle(handle, false, out unique, out group, out index);
group.Remove(index, unique);
}
public IRenderHandleOwner GetOwner(RENDERHANDLE handle) => this.GetOwner(handle, false);
public IRenderHandleOwner GetOwner(RENDERHANDLE handle, bool fAllowInvalid)
{
uint unique;
HandleGroup group;
uint index;
this.MapHandle(handle, false, out unique, out group, out index, fAllowInvalid);
return group.Get(index, unique, fAllowInvalid);
}
public void SetOwner(RENDERHANDLE handle, IRenderHandleOwner owner)
{
uint unique;
HandleGroup group;
uint index;
this.MapHandle(handle, false, out unique, out group, out index);
group.Set(index, unique, owner);
}
public RENDERGROUP GetGroup(RENDERHANDLE handle) => RENDERGROUP.FromUInt32((RENDERHANDLE.ToUInt32(handle) & this.m_GroupMask) >> this.m_GroupShift);
public RENDERGROUP AllocGroup() => RENDERGROUP.FromUInt32(this.m_groups.Add((IRenderHandleOwner) this.CreateNewGroup()));
public void AllocGroupWithId(RENDERGROUP groupId)
{
uint uint32 = RENDERGROUP.ToUInt32(groupId);
this.m_groups.AddAtIndex((IRenderHandleOwner) this.CreateNewGroup(), uint32);
}
public void FreeGroup(RENDERGROUP groupId) => this.m_groups.Remove(RENDERGROUP.ToUInt32(groupId));
public void Validate(RENDERHANDLE handle)
{
uint unique;
HandleGroup group;
uint index;
this.MapHandle(handle, false, out unique, out group, out index);
Debug2.Validate((object) group.Get(index, unique) != null, typeof (ArgumentException), (object) "Must point to valid object", (object) nameof (handle));
}
private HandleGroup CreateNewGroup() => new HandleGroup(GCHandleType.Weak, this.m_portOwner, true, this.m_MaxObjectsPerGroup);
private void MapHandle(
RENDERHANDLE handle,
bool fCreateGroup,
out uint unique,
out HandleGroup group,
out uint index)
{
this.MapHandle(handle, fCreateGroup, out unique, out group, out index, false);
}
private void MapHandle(
RENDERHANDLE handle,
bool fCreateGroup,
out uint unique,
out HandleGroup group,
out uint index,
bool fAllowInvalid)
{
uint uint32 = RENDERHANDLE.ToUInt32(handle);
uint num1 = (uint32 & this.m_UniqueMask) >> this.m_UniqueShift;
uint index1 = (uint32 & this.m_GroupMask) >> this.m_GroupShift;
uint num2 = uint32 & this.m_ObjectMask;
group = (HandleGroup) null;
if (index1 <= this.m_groups.Count)
group = this.m_groups[index1] as HandleGroup;
if (group == null)
{
if (fCreateGroup)
{
group = this.CreateNewGroup();
this.m_groups.AddAtIndex((IRenderHandleOwner) group, index1);
}
else
Debug2.Throw(fAllowInvalid, "Group does not exist");
}
unique = num1;
index = num2;
}
int IComparer.Compare(object a, object b)
{
KeyValueEntry<string, uint> keyValueEntry1 = (KeyValueEntry<string, uint>) a;
KeyValueEntry<string, uint> keyValueEntry2 = (KeyValueEntry<string, uint>) b;
uint num1 = keyValueEntry1.Value;
uint num2 = keyValueEntry2.Value;
if (num1 > num2)
return -1;
return num1 < num2 ? 1 : string.Compare(keyValueEntry1.Key, keyValueEntry2.Key, StringComparison.Ordinal);
}
protected override void Invariant() => Debug2.Validate(this.m_groups != null, typeof (InvalidOperationException), "HandleTable has no HandleGroups");
}
}
@@ -0,0 +1,17 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Render.Protocol.IChannel
// Assembly: UIX.RenderApi, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: D47658B8-A8EA-43D6-8837-ECE823BFFFC1
// Assembly location: C:\Program Files\Zune\UIX.RenderApi.dll
namespace Microsoft.Iris.Render.Protocol
{
internal interface IChannel
{
void Connect(ContextID idRemoteContext, RENDERHANDLE hBrokerClass, MessageCookieLayout layout);
void Dispose();
bool IsConnected { get; }
}
}
@@ -0,0 +1,15 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Render.Protocol.IRenderHandleOwner
// Assembly: UIX.RenderApi, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: D47658B8-A8EA-43D6-8837-ECE823BFFFC1
// Assembly location: C:\Program Files\Zune\UIX.RenderApi.dll
namespace Microsoft.Iris.Render.Protocol
{
internal interface IRenderHandleOwner
{
RENDERHANDLE RenderHandle { get; }
void OnDisconnect();
}
}
@@ -0,0 +1,49 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Render.Protocol.LocalChannel
// Assembly: UIX.RenderApi, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: D47658B8-A8EA-43D6-8837-ECE823BFFFC1
// Assembly location: C:\Program Files\Zune\UIX.RenderApi.dll
using Microsoft.Iris.Render.Common;
using System;
namespace Microsoft.Iris.Render.Protocol
{
internal class LocalChannel : RenderObject, IChannel
{
private IntPtr m_renderThread;
public LocalChannel(LocalConnectionInfo connectionInfo)
{
}
public bool IsConnected => this.m_renderThread != IntPtr.Zero;
public void Connect(
ContextID remoteContextId,
RENDERHANDLE brokerClassHandle,
MessageCookieLayout layout)
{
Debug2.Validate(remoteContextId != ContextID.NULL, typeof (ArgumentNullException), nameof (remoteContextId));
EngineApi.IFC(EngineApi.SpRenderThreadInit(ref new EngineApi.InitArgs(layout, remoteContextId)
{
idObjectBrokerClass = brokerClassHandle
}, out this.m_renderThread));
}
protected override void Dispose(bool inDispose)
{
try
{
if (!(this.m_renderThread != IntPtr.Zero))
return;
EngineApi.IFC(EngineApi.SpRenderThreadUninit(this.m_renderThread));
this.m_renderThread = IntPtr.Zero;
}
finally
{
base.Dispose(inDispose);
}
}
}
}
@@ -0,0 +1,15 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Render.Protocol.LocalConnectionInfo
// Assembly: UIX.RenderApi, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: D47658B8-A8EA-43D6-8837-ECE823BFFFC1
// Assembly location: C:\Program Files\Zune\UIX.RenderApi.dll
using System;
namespace Microsoft.Iris.Render.Protocol
{
[Serializable]
internal sealed class LocalConnectionInfo : ConnectionInfo
{
}
}
@@ -0,0 +1,176 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Render.Protocol.MarshalHelper
// Assembly: UIX.RenderApi, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: D47658B8-A8EA-43D6-8837-ECE823BFFFC1
// Assembly location: C:\Program Files\Zune\UIX.RenderApi.dll
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
namespace Microsoft.Iris.Render.Protocol
{
internal class MarshalHelper
{
private static RENDERHANDLE[] s_EmptyRenderHandleArray = new RENDERHANDLE[0];
public static unsafe void Decode(
RenderPort port,
Message* pmsg,
BLOBREF refParam,
out string param)
{
uint uint32 = BLOBREF.ToUInt32(refParam);
uint num1 = uint32 & (uint) ushort.MaxValue;
uint num2 = (uint32 & 4294901760U) >> 16;
byte* numPtr = (byte*) ((IntPtr) pmsg + (int) num1);
int length = (int) num2 - 2;
byte[] numArray = new byte[length];
Marshal.Copy(new IntPtr((void*) numPtr), numArray, 0, length);
Encoding encoding = Encoding.Unicode;
if (port.AlwaysBigEndian)
encoding = Encoding.BigEndianUnicode;
param = encoding.GetString(numArray);
}
public static unsafe void Decode(
RenderPort port,
Message* pmsgOuter,
BLOBREF refMsgInner,
out Message* pmsgInner)
{
byte* numPtr = (byte*) pmsgOuter;
uint num = (uint) ushort.MaxValue & BLOBREF.ToUInt32(refMsgInner);
pmsgInner = (Message*) (numPtr + (int) num);
}
private static ushort[] ComputeByteOrderMap(Type targetType, bool fCompact)
{
ushort[] fieldMap = new ushort[10];
MarshalHelper.ComputeByteOrderMapWorker(ref fieldMap, targetType, 0);
if (fCompact)
{
int length = (int) fieldMap[0] + 1;
if (fieldMap.Length > length)
{
ushort[] numArray = new ushort[length];
Array.Copy((Array) fieldMap, (Array) numArray, length);
fieldMap = numArray;
}
}
return fieldMap;
}
public static unsafe void SwapByteOrder(
byte* pMem,
ref ushort[] fieldMapByRef,
Type type,
int startOffset,
int stopOffset)
{
if (fieldMapByRef == null)
fieldMapByRef = MarshalHelper.ComputeByteOrderMap(type, true);
ushort[] numArray = fieldMapByRef;
if (stopOffset <= 0)
stopOffset = int.MaxValue;
int num1 = (int) numArray[0] + 1;
for (int index1 = 1; index1 < num1; ++index1)
{
ushort num2 = numArray[index1];
int num3 = (int) num2 >> 2;
if (num3 >= startOffset)
{
if (num3 >= stopOffset)
break;
int num4 = 1 << ((int) num2 & 3);
byte* numPtr = pMem + num3;
int num5 = num4 / 2;
for (int index2 = 0; index2 < num5; ++index2)
{
int index3 = num4 - (index2 + 1);
byte num6 = numPtr[index2];
numPtr[index2] = numPtr[index3];
numPtr[index3] = num6;
}
}
}
}
public static object MakeDumpable(string value) => (object) value;
public static object MakeDumpable(object value) => value;
public static unsafe object MakeDumpable(void* value) => (object) new IntPtr(value);
private static void ComputeByteOrderMapWorker(
ref ushort[] fieldMap,
Type targetType,
int parentOffset)
{
if (targetType.IsPrimitive)
return;
int packingForType = MarshalHelper.GetPackingForType(targetType);
int num1 = 0;
foreach (FieldInfo field in targetType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
{
Type type = field.FieldType;
if (type.IsEnum)
type = Enum.GetUnderlyingType(type);
int size = Marshal.SizeOf(type);
int num2 = size;
if (type.IsPrimitive)
{
if (num2 > packingForType)
num2 = packingForType;
}
else if (num2 > 4)
num2 = 4;
int num3 = num2 - 1;
int num4 = num1 + num3 & ~num3;
int num5 = num4 + parentOffset;
if (type.IsPrimitive)
MarshalHelper.AddByteOrderEntry(ref fieldMap, num5, size);
else
MarshalHelper.ComputeByteOrderMapWorker(ref fieldMap, type, num5);
num1 = num4 + size;
}
}
private static int GetPackingForType(Type t) => 8;
private static void AddByteOrderEntry(ref ushort[] fieldMap, int offset, int size)
{
ushort num;
switch (size)
{
case 1:
return;
case 2:
num = (ushort) 1;
break;
case 3:
return;
case 4:
num = (ushort) 2;
break;
case 8:
num = (ushort) 3;
break;
default:
return;
}
int index = (int) fieldMap[0] + 1;
if (index >= fieldMap.Length)
{
ushort[] numArray = new ushort[2 * fieldMap.Length];
Array.Copy((Array) fieldMap, (Array) numArray, fieldMap.Length);
fieldMap = numArray;
}
fieldMap[0] = (ushort) index;
fieldMap[index] = (ushort) ((uint) (offset << 2) | (uint) num);
}
public static RENDERHANDLE[] CreateRenderHandleArray(int length) => length == 0 ? MarshalHelper.s_EmptyRenderHandleArray : new RENDERHANDLE[length];
}
}
@@ -0,0 +1,99 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Render.Protocol.Memory
// Assembly: UIX.RenderApi, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: D47658B8-A8EA-43D6-8837-ECE823BFFFC1
// Assembly location: C:\Program Files\Zune\UIX.RenderApi.dll
using Microsoft.Iris.Render.Common;
using System;
namespace Microsoft.Iris.Render.Protocol
{
internal static class Memory
{
public static unsafe bool IsOverlap(IntPtr pvA, int cbA, IntPtr pvB, int cbB)
{
byte* pointer1 = (byte*) pvA.ToPointer();
byte* pointer2 = (byte*) pvB.ToPointer();
if (pointer1 >= pointer2 && pointer1 < pointer2 + cbB)
return true;
return pointer2 >= pointer1 && pointer2 < pointer1 + cbA;
}
public static unsafe void Zero(IntPtr pvDest, int cbZero)
{
uint* pointer = (uint*) pvDest.ToPointer();
int num1 = cbZero / 4;
int num2 = num1;
while (num2-- > 0)
*pointer++ = 0U;
byte* numPtr = (byte*) pointer;
int num3 = cbZero - num1 * 4;
while (num3-- > 0)
*numPtr++ = (byte) 0;
}
public static unsafe void Copy(IntPtr pvDest, IntPtr pvSrc, int cbCopy)
{
uint* pointer1 = (uint*) pvDest.ToPointer();
uint* pointer2 = (uint*) pvSrc.ToPointer();
int num1 = cbCopy / 4;
int num2 = num1;
while (num2-- > 0)
*pointer1++ = *pointer2++;
byte* numPtr1 = (byte*) pointer1;
byte* numPtr2 = (byte*) pointer2;
int num3 = cbCopy - num1 * 4;
while (num3-- > 0)
*numPtr1++ = *numPtr2++;
}
public static unsafe void ConvertEndian(
IntPtr pvDest,
IntPtr pvSrc,
int cbConvert,
int cUnitBits)
{
switch (cUnitBits)
{
case 8:
break;
case 16:
uint* pointer1 = (uint*) pvDest.ToPointer();
uint* pointer2 = (uint*) pvSrc.ToPointer();
int num1 = cbConvert / 4;
while (num1-- > 0)
{
uint num2 = *pointer2++;
*pointer1++ = (uint) ((int) ((num2 & 4278190080U) >> 8) | ((int) num2 & 16711680) << 8 | (int) ((num2 & 65280U) >> 8) | ((int) num2 & (int) byte.MaxValue) << 8);
}
if (cbConvert % 4 == 0)
break;
ushort* numPtr1 = (ushort*) pointer1;
ushort* numPtr2 = (ushort*) pointer1;
ushort* numPtr3 = (ushort*) ((IntPtr) numPtr2 + new IntPtr(2));
ushort num3 = *numPtr2;
ushort* numPtr4 = numPtr1;
ushort* numPtr5 = (ushort*) ((IntPtr) numPtr4 + new IntPtr(2));
int num4 = (int) (ushort) (((int) num3 & 65280) >> 8 | ((int) num3 & (int) byte.MaxValue) << 8);
*numPtr4 = (ushort) num4;
break;
case 32:
uint* pointer3 = (uint*) pvDest.ToPointer();
uint* pointer4 = (uint*) pvSrc.ToPointer();
int num5 = cbConvert / 4;
while (num5-- > 0)
{
uint num2 = *pointer4++;
*pointer3++ = (uint) ((int) ((num2 & 4278190080U) >> 24) | (int) ((num2 & 16711680U) >> 8) | ((int) num2 & 65280) << 8 | ((int) num2 & (int) byte.MaxValue) << 24);
}
break;
default:
Debug2.Throw(false, "Unsupported data format");
break;
}
}
public static uint ConvertEndian(uint src) => (uint) ((int) ((src & 4278190080U) >> 24) | (int) ((src & 16711680U) >> 8) | ((int) src & 65280) << 8 | ((int) src & (int) byte.MaxValue) << 24);
}
}
@@ -0,0 +1,18 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Render.Protocol.Message
// Assembly: UIX.RenderApi, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: D47658B8-A8EA-43D6-8837-ECE823BFFFC1
// Assembly location: C:\Program Files\Zune\UIX.RenderApi.dll
using System.Runtime.InteropServices;
namespace Microsoft.Iris.Render.Protocol
{
[ComVisible(false)]
internal struct Message
{
public uint cbSize;
public uint nMsg;
public RENDERHANDLE idObjectSubject;
}
}
@@ -0,0 +1,16 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Render.Protocol.MessageBatchEntry
// Assembly: UIX.RenderApi, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: D47658B8-A8EA-43D6-8837-ECE823BFFFC1
// Assembly location: C:\Program Files\Zune\UIX.RenderApi.dll
using System.Runtime.InteropServices;
namespace Microsoft.Iris.Render.Protocol
{
[ComVisible(false)]
internal struct MessageBatchEntry
{
public uint uOffsetNextEntry;
}
}
@@ -0,0 +1,17 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Render.Protocol.MessageBatchHeader
// Assembly: UIX.RenderApi, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: D47658B8-A8EA-43D6-8837-ECE823BFFFC1
// Assembly location: C:\Program Files\Zune\UIX.RenderApi.dll
using System.Runtime.InteropServices;
namespace Microsoft.Iris.Render.Protocol
{
[ComVisible(false)]
internal struct MessageBatchHeader
{
public RENDERHANDLE idPredicateBuffer;
public uint uOffsetFirstEntry;
}
}

Some files were not shown because too many files have changed in this diff Show More