Calculate bytesize properly for packed formats in mesh viewer

This commit is contained in:
baldurk
2016-07-25 13:31:56 +02:00
parent eaa53adbc3
commit 132bef38af
2 changed files with 16 additions and 2 deletions
+15 -1
View File
@@ -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;
}
}
+1 -1
View File
@@ -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);