public bool Setup(RawMemoryBlock _block, ResourceViewParamReader paramReader) { // load source data var words = _block.LoadAllDataAs32BE(); if (words == null) { return(false); } // source memory block _MemoryBlock = _block; // shader type var isPixelShader = (paramReader.Param(0) == "pixelshader"); // decompile shader _Shader = GPUShader.Decompile(isPixelShader, words); if (_Shader == null) { return(false); } // valid shader ShowCode(); return(true); }
public bool Setup(RawMemoryBlock _block, ResourceViewParamReader paramReader) { // source memory block _MemoryBlock = _block; // valid shader ShowCode(); return(true); }
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); }