Until proper support is added, prevent crashes by decaying VB formats

* Unfortunately some formats are *only* supported through VB fixed-func
  inputs, and not through any other access (like texel buffer access).
* As a result, it's invalid for us to just create buffer views using
  these formats to read from, so we will need to read-back the data to
  the CPU, decode and unpack to another format that is supported, and
  then re-upload. In some cases this might be extremely complex (e.g.
  64-bit wide formats that have no easily supported fallback).
* In the meantime, we just re-write the format to R8G8B8A8_UNORM. It
  will return the wrong data, but will at least not crash.
This commit is contained in:
baldurk
2018-04-03 16:56:11 +01:00
parent 378c5d928e
commit 4b4ce8dc01
+10
View File
@@ -1375,6 +1375,16 @@ void VulkanReplay::InitPostVSBuffers(uint32_t eventId)
VK_WHOLE_SIZE,
};
if((m_pDriver->GetFormatProperties(attrDesc.format).bufferFeatures &
VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT) == 0)
{
RDCERR(
"Format %s doesn't support texel buffers! Replacing with safe but broken format, for "
"now. This will require a CPU readback and unpack to properly fix.",
ToStr(attrDesc.format).c_str());
info.format = VK_FORMAT_R8G8B8A8_UNORM;
}
m_pDriver->vkCreateBufferView(dev, &info, NULL, &vbuffers[attr].view);
attrIsInstanced.resize(RDCMAX(attrIsInstanced.size(), size_t(attr + 1)));