Beispiel #1
0
 public static string GetStringFromBlob(D3DCompiler.IDxcBlob blob)
 {
     unsafe
     {
         return(Marshal.PtrToStringAnsi((IntPtr)blob.GetBufferPointer()));
     }
 }
Beispiel #2
0
        public static byte[] GetBytesFromBlob(D3DCompiler.IDxcBlob blob)
        {
            unsafe
            {
                byte * pMem   = (byte *)blob.GetBufferPointer();
                uint   size   = blob.GetBufferSize();
                byte[] result = new byte[size];
                fixed(byte *pTarget = result)
                {
                    for (uint i = 0; i < size; ++i)
                    {
                        pTarget[i] = pMem[i];
                    }
                }

                return(result);
            }
        }