diff --git a/renderdoc/driver/vulkan/vk_shaderdebug.cpp b/renderdoc/driver/vulkan/vk_shaderdebug.cpp index 5d933af30..71511dca2 100644 --- a/renderdoc/driver/vulkan/vk_shaderdebug.cpp +++ b/renderdoc/driver/vulkan/vk_shaderdebug.cpp @@ -3480,12 +3480,42 @@ ShaderDebugTrace *VulkanReplay::DebugVertex(uint32_t eventId, uint32_t vertid, u } else { - FloatVector decoded = ConvertComponents(MakeResourceFormat(attr.format), data.data()); + ResourceFormat fmt = MakeResourceFormat(attr.format); - val.f.x = decoded.x; - val.f.y = decoded.y; - val.f.z = decoded.z; - val.f.w = decoded.w; + // integer formats need to be read as-is, rather than converted to floats + if(fmt.compType == CompType::UInt || fmt.compType == CompType::SInt) + { + if(fmt.type == ResourceFormatType::R10G10B10A2) + { + // this is the only packed UINT format + Vec4u decoded = ConvertFromR10G10B10A2UInt(*(uint32_t *)data.data()); + + val.u.x = decoded.x; + val.u.y = decoded.y; + val.u.z = decoded.z; + val.u.w = decoded.w; + } + else + { + for(uint32_t i = 0; i < fmt.compCount; i++) + { + const byte *src = data.data() + i * fmt.compByteWidth; + if(fmt.compByteWidth == 8) + memcpy(&val.u64v[i], src, fmt.compByteWidth); + else + memcpy(&val.uv[i], src, fmt.compByteWidth); + } + } + } + else + { + FloatVector decoded = ConvertComponents(fmt, data.data()); + + val.f.x = decoded.x; + val.f.y = decoded.y; + val.f.z = decoded.z; + val.f.w = decoded.w; + } } } diff --git a/renderdoc/maths/formatpacking.h b/renderdoc/maths/formatpacking.h index 058e003ce..fd344ec8c 100644 --- a/renderdoc/maths/formatpacking.h +++ b/renderdoc/maths/formatpacking.h @@ -36,6 +36,11 @@ inline Vec4f ConvertFromR10G10B10A2(uint32_t data) float((data >> 20) & 0x3ff) / 1023.0f, float((data >> 30) & 0x003) / 3.0f); } +inline Vec4u ConvertFromR10G10B10A2UInt(uint32_t data) +{ + return Vec4u((data >> 0) & 0x3ff, (data >> 10) & 0x3ff, (data >> 20) & 0x3ff, (data >> 30) & 0x003); +} + inline Vec4f ConvertFromR10G10B10A2SNorm(uint32_t data) { int r = int(data >> 0) & 0x3ff;