From 237b24e88e329a90d417ce294239f5f895b17ea0 Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 13 Oct 2016 12:21:23 +0200 Subject: [PATCH] Remove printing of buffers as floats. Refs #395 * There's no guarantee that the buffer is actually float data at all, so printing it as such can cause float exceptions if the data includes NaNs. * This is not really useful anymore anyway, and if really needed the float values can be manually converted from the hex data. --- renderdoc/serialise/serialiser.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/renderdoc/serialise/serialiser.cpp b/renderdoc/serialise/serialiser.cpp index 0a5adea99..bad0259f0 100644 --- a/renderdoc/serialise/serialiser.cpp +++ b/renderdoc/serialise/serialiser.cpp @@ -1893,24 +1893,17 @@ void Serialiser::SerialiseBuffer(const char *name, byte *&buf, size_t &len) { const char *ellipsis = "..."; - float *fbuf = new float[4]; - fbuf[0] = fbuf[1] = fbuf[2] = fbuf[3] = 0.0f; - uint32_t *lbuf = (uint32_t *)fbuf; + uint32_t lbuf[4]; - memcpy(fbuf, buf, RDCMIN(len, 4 * sizeof(float))); + memcpy(lbuf, buf, RDCMIN(len, 4 * sizeof(uint32_t))); if(bufLen <= 16) { ellipsis = " "; } - DebugPrint( - "%s: RawBuffer % 5d:< 0x%08x 0x%08x 0x%08x 0x%08x %s % 8.4ff % 8.4ff % 8.4ff % 8.4ff " - "%s >\n", - name, bufLen, lbuf[0], lbuf[1], lbuf[2], lbuf[3], ellipsis, fbuf[0], fbuf[1], fbuf[2], - fbuf[3], ellipsis); - - SAFE_DELETE_ARRAY(fbuf); + DebugPrint("%s: RawBuffer % 5d:< 0x%08x 0x%08x 0x%08x 0x%08x %s>\n", name, bufLen, lbuf[0], + lbuf[1], lbuf[2], lbuf[3], ellipsis); } }