示例#1
0
        public GPUEndianFormat ReadEndianFormat()
        {
            if (_Current >= _Params.Length)
            {
                return(0);
            }

            GPUEndianFormat ret = 0;
            var             str = ReadString();

            System.Enum.TryParse <GPUEndianFormat>(str, out ret);
            return(ret);
        }
示例#2
0
        public bool Setup(RawMemoryBlock _block, ResourceViewParamReader paramReader)
        {
            // load source data
            _Data = _block.LoadAllData();
            if (_Data == null)
            {
                return(false);
            }

            // source memory block
            _MemoryBlock = _block;

            // stride of data
            _MemoryStride = paramReader.ReadUInt32();

            // endianess
            _MemoryEndianess = paramReader.ReadEndianFormat();

            // convert endianess
            if (_MemoryEndianess == GPUEndianFormat.FormatUnspecified)
            {
                _DataEndian = _Data;
            }
            else if (_MemoryEndianess == GPUEndianFormat.Format8in32)
            {
                _DataEndian = new Byte[_Data.Length];
                for (UInt32 i = 0; i < _Data.Length; i += 4)
                {
                    _DataEndian[i + 0] = _Data[i + 3];
                    _DataEndian[i + 1] = _Data[i + 2];
                    _DataEndian[i + 2] = _Data[i + 1];
                    _DataEndian[i + 3] = _Data[i + 0];
                }
            }
            else if (_MemoryEndianess == GPUEndianFormat.Format8in16)
            {
                _DataEndian = new Byte[_Data.Length];
                for (UInt32 i = 0; i < _Data.Length; i += 2)
                {
                    _DataEndian[i + 0] = _Data[i + 1];
                    _DataEndian[i + 1] = _Data[i + 0];
                }
            }
            else if (_MemoryEndianess == GPUEndianFormat.Format16in32)
            {
                _DataEndian = new Byte[_Data.Length];
                for (UInt32 i = 0; i < _Data.Length; i += 4)
                {
                    _DataEndian[i + 0] = _Data[i + 1];
                    _DataEndian[i + 1] = _Data[i + 0];
                    _DataEndian[i + 2] = _Data[i + 3];
                    _DataEndian[i + 3] = _Data[i + 2];
                }
            }

            // number of format elements
            UInt32 numElems = paramReader.ReadUInt32();

            _MemoryElements = new ViewMemoryBufferElement[numElems];

            // load elements
            for (UInt32 i = 0; i < numElems; ++i)
            {
                ViewMemoryBufferElement elem = new ViewMemoryBufferElement();
                elem._Offset       = paramReader.ReadUInt32();
                elem._Format       = paramReader.ReadFetchFormat();
                elem._DataType     = paramReader.ReadFetchDataType();
                _MemoryElements[i] = elem;
            }

            // rebuild view
            RebuildLayout();
            RefreshRawView();
            RefreshProperties();
            return(true);
        }
示例#3
0
        private static String MakeMemoryAddr(RawPacket packet, UInt32 address, UInt32 stride, GPUEndianFormat endianess, GPUIndexFormat format)
        {
            var block = packet.FindMemoryReadBlock(address);

            if (block != null)
            {
                var endianStr = Enum.GetName(typeof(GPUEndianFormat), endianess);
                var formatStr = (format == GPUIndexFormat.Index16) ? "FMT_16,UINT" : "FMT_32,UINT";
                return(String.Format("<a href=\"buffer,{0},{1},{3},1,0,{4}\">0x{2:X}</a>", block.LocalIndex, stride, block.Adress, endianStr, formatStr));
            }
            else
            {
                return(String.Format("0x{0:X6}", address));
            }
        }