diff --git a/renderdocui/Code/FormatElement.cs b/renderdocui/Code/FormatElement.cs index ab18ed6a0..e7edc5bee 100644 --- a/renderdocui/Code/FormatElement.cs +++ b/renderdocui/Code/FormatElement.cs @@ -101,7 +101,21 @@ namespace renderdocui.Code { get { - return format.compByteWidth * format.compCount * matrixdim; + uint vecSize = format.compByteWidth * format.compCount; + + if (format.special) + { + if (format.specialFormat == SpecialFormat.R5G5B5A1 || + format.specialFormat == SpecialFormat.R5G6B5 || + format.specialFormat == SpecialFormat.R4G4B4A4) + vecSize = 2; + + if (format.specialFormat == SpecialFormat.R10G10B10A2 || + format.specialFormat == SpecialFormat.R11G11B10) + vecSize = 4; + } + + return vecSize * matrixdim; } } diff --git a/renderdocui/Windows/BufferViewer.cs b/renderdocui/Windows/BufferViewer.cs index 4f8834489..22230e12d 100644 --- a/renderdocui/Windows/BufferViewer.cs +++ b/renderdocui/Windows/BufferViewer.cs @@ -1714,7 +1714,7 @@ namespace renderdocui.Windows var fmt = bufferFormats[el].format; int byteWidth = (int)fmt.compByteWidth; - int bytesToRead = (int)(fmt.compByteWidth * fmt.compCount); + int bytesToRead = (int)bufferFormats[el].ByteSize; byte[] bytes = read.ReadBytes(bytesToRead); rawWriter.Write(bytes);