mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-03 13:21:12 +00:00
Handle failed maps as fatal errors on vulkan. Refs #2460
* We manually check for NULL returned map pointers and treat this as a fatal error, even if the map itself returns VK_SUCCESS
This commit is contained in:
@@ -303,6 +303,12 @@ void *GPUBuffer::Map(uint32_t *bindoffset, VkDeviceSize usedsize)
|
||||
VkResult vkr = m_pDriver->vkMapMemory(device, mem, offset, size, 0, (void **)&ptr);
|
||||
m_pDriver->CheckVkResult(vkr);
|
||||
|
||||
if(!ptr)
|
||||
{
|
||||
RDCERR("Manually reporting failed memory map");
|
||||
m_pDriver->CheckVkResult(VK_ERROR_MEMORY_MAP_FAILED);
|
||||
}
|
||||
|
||||
if(createFlags & eGPUBufferReadback)
|
||||
{
|
||||
VkMappedMemoryRange range = {
|
||||
|
||||
@@ -741,7 +741,10 @@ VulkanDebugManager::VulkanDebugManager(WrappedVulkan *driver)
|
||||
|
||||
m_DiscardCB[i].Create(m_pDriver, m_Device, pattern.size(), 1, 0);
|
||||
|
||||
memcpy(m_DiscardCB[i].Map(), pattern.data(), pattern.size());
|
||||
void *ptr = m_DiscardCB[i].Map();
|
||||
if(!ptr)
|
||||
return;
|
||||
memcpy(ptr, pattern.data(), pattern.size());
|
||||
m_DiscardCB[i].Unmap();
|
||||
|
||||
VkDescriptorBufferInfo bufInfo = {};
|
||||
@@ -1210,6 +1213,8 @@ uint32_t VulkanReplay::PickVertex(uint32_t eventId, int32_t width, int32_t heigh
|
||||
|
||||
uint32_t *outidxs = (uint32_t *)m_VertexPick.IBUpload.Map();
|
||||
uint32_t *mappedPtr = outidxs;
|
||||
if(!mappedPtr)
|
||||
return ~0U;
|
||||
|
||||
memset(outidxs, 0, m_VertexPick.IBSize);
|
||||
|
||||
@@ -1329,6 +1334,8 @@ uint32_t VulkanReplay::PickVertex(uint32_t eventId, int32_t width, int32_t heigh
|
||||
bool valid = true;
|
||||
|
||||
FloatVector *vbData = (FloatVector *)m_VertexPick.VBUpload.Map();
|
||||
if(!vbData)
|
||||
return ~0U;
|
||||
|
||||
// the index buffer may refer to vertices past the start of the vertex buffer, so we can't just
|
||||
// conver the first N vertices we'll need.
|
||||
@@ -1342,6 +1349,8 @@ uint32_t VulkanReplay::PickVertex(uint32_t eventId, int32_t width, int32_t heigh
|
||||
}
|
||||
|
||||
MeshPickUBOData *ubo = (MeshPickUBOData *)m_VertexPick.UBO.Map();
|
||||
if(!ubo)
|
||||
return ~0U;
|
||||
|
||||
ubo->rayPos = rayPos;
|
||||
ubo->rayDir = rayDir;
|
||||
@@ -1543,6 +1552,8 @@ uint32_t VulkanReplay::PickVertex(uint32_t eventId, int32_t width, int32_t heigh
|
||||
|
||||
uint32_t *pickResultData = (uint32_t *)m_VertexPick.ResultReadback.Map();
|
||||
uint32_t numResults = *pickResultData;
|
||||
if(!pickResultData)
|
||||
return ~0U;
|
||||
|
||||
uint32_t ret = ~0U;
|
||||
|
||||
@@ -1821,6 +1832,12 @@ void VulkanDebugManager::GetBufferData(ResourceId buff, uint64_t offset, uint64_
|
||||
CheckVkResult(vkr);
|
||||
if(vkr != VK_SUCCESS)
|
||||
return;
|
||||
if(!pData)
|
||||
{
|
||||
RDCERR("Manually reporting failed memory map");
|
||||
CheckVkResult(VK_ERROR_MEMORY_MAP_FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
VkMappedMemoryRange range = {
|
||||
VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, NULL, Unwrap(m_ReadbackWindow.mem), 0, VK_WHOLE_SIZE,
|
||||
@@ -2306,6 +2323,11 @@ void VulkanDebugManager::InitReadbackBuffer(VkDeviceSize sz)
|
||||
VkResult vkr = ObjDisp(dev)->MapMemory(Unwrap(dev), Unwrap(m_ReadbackWindow.mem), 0,
|
||||
VK_WHOLE_SIZE, 0, (void **)&m_ReadbackPtr);
|
||||
CheckVkResult(vkr);
|
||||
if(!m_ReadbackPtr)
|
||||
{
|
||||
RDCERR("Manually reporting failed memory map");
|
||||
CheckVkResult(VK_ERROR_MEMORY_MAP_FAILED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3657,7 +3679,8 @@ void VulkanReplay::MeshRendering::Init(WrappedVulkan *driver, VkDescriptorPool d
|
||||
|
||||
Vec4f *axisData = (Vec4f *)AxisFrustumVB.Map();
|
||||
|
||||
memcpy(axisData, axisFrustum, sizeof(axisFrustum));
|
||||
if(axisData)
|
||||
memcpy(axisData, axisFrustum, sizeof(axisFrustum));
|
||||
|
||||
AxisFrustumVB.Unmap();
|
||||
|
||||
|
||||
@@ -1509,6 +1509,13 @@ bool WrappedVulkan::Serialise_InitialState(SerialiserType &ser, ResourceId id, V
|
||||
(void **)&Contents);
|
||||
CheckVkResult(vkr);
|
||||
|
||||
if(!Contents)
|
||||
{
|
||||
RDCERR("Manually reporting failed memory map");
|
||||
CheckVkResult(VK_ERROR_MEMORY_MAP_FAILED);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(vkr != VK_SUCCESS)
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -775,6 +775,12 @@ void VulkanReplay::GetOutputWindowData(uint64_t id, bytebuf &retData)
|
||||
m_pDriver->CheckVkResult(vkr);
|
||||
if(vkr != VK_SUCCESS)
|
||||
return;
|
||||
if(!pData)
|
||||
{
|
||||
RDCERR("Manually reporting failed memory map");
|
||||
CheckVkResult(VK_ERROR_MEMORY_MAP_FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
VkMappedMemoryRange range = {
|
||||
VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, NULL, readbackMem, 0, VK_WHOLE_SIZE,
|
||||
|
||||
@@ -431,6 +431,8 @@ void VulkanDebugManager::PatchLineStripIndexBuffer(const ActionDescription *acti
|
||||
GPUBuffer::eGPUBufferIBuffer);
|
||||
|
||||
void *ptr = indexBuffer.Map(0, patchedIndices.size() * sizeof(uint32_t));
|
||||
if(!ptr)
|
||||
return;
|
||||
memcpy(ptr, patchedIndices.data(), patchedIndices.size() * sizeof(uint32_t));
|
||||
indexBuffer.Unmap();
|
||||
|
||||
@@ -1305,6 +1307,8 @@ ResourceId VulkanReplay::RenderOverlay(ResourceId texid, FloatVector clearCol, D
|
||||
uint32_t uboOffs = 0;
|
||||
|
||||
CheckerboardUBOData *ubo = (CheckerboardUBOData *)m_Overlay.m_CheckerUBO.Map(&uboOffs);
|
||||
if(!ubo)
|
||||
return ResourceId();
|
||||
|
||||
ubo->BorderWidth = 3;
|
||||
ubo->CheckerSquareDimension = 16.0f;
|
||||
@@ -1345,6 +1349,8 @@ ResourceId VulkanReplay::RenderOverlay(ResourceId texid, FloatVector clearCol, D
|
||||
(float)state.scissors[0].extent.height);
|
||||
|
||||
ubo = (CheckerboardUBOData *)m_Overlay.m_CheckerUBO.Map(&uboOffs);
|
||||
if(!ubo)
|
||||
return ResourceId();
|
||||
|
||||
ubo->BorderWidth = 3;
|
||||
ubo->CheckerSquareDimension = 16.0f;
|
||||
@@ -2387,6 +2393,8 @@ ResourceId VulkanReplay::RenderOverlay(ResourceId texid, FloatVector clearCol, D
|
||||
|
||||
uint32_t meshOffs = 0;
|
||||
MeshUBOData *data = (MeshUBOData *)m_MeshRender.UBO.Map(&meshOffs);
|
||||
if(!data)
|
||||
return ResourceId();
|
||||
|
||||
data->mvp = Matrix4f::Identity();
|
||||
data->invProj = Matrix4f::Identity();
|
||||
@@ -2401,6 +2409,8 @@ ResourceId VulkanReplay::RenderOverlay(ResourceId texid, FloatVector clearCol, D
|
||||
|
||||
uint32_t viewOffs = 0;
|
||||
Vec4f *ubo = (Vec4f *)m_Overlay.m_TriSizeUBO.Map(&viewOffs);
|
||||
if(!ubo)
|
||||
return ResourceId();
|
||||
*ubo = Vec4f(state.views[0].width, state.views[0].height);
|
||||
m_Overlay.m_TriSizeUBO.Unmap();
|
||||
|
||||
|
||||
@@ -3712,6 +3712,12 @@ rdcarray<PixelModification> VulkanReplay::PixelHistory(rdcarray<EventUsage> even
|
||||
CheckVkResult(vkr);
|
||||
if(vkr != VK_SUCCESS)
|
||||
return history;
|
||||
if(!eventsInfo)
|
||||
{
|
||||
RDCERR("Manually reporting failed memory map");
|
||||
CheckVkResult(VK_ERROR_MEMORY_MAP_FAILED);
|
||||
return history;
|
||||
}
|
||||
|
||||
std::map<uint32_t, uint32_t> eventsWithFrags;
|
||||
std::map<uint32_t, ModificationValue> eventPremods;
|
||||
@@ -3797,6 +3803,12 @@ rdcarray<PixelModification> VulkanReplay::PixelHistory(rdcarray<EventUsage> even
|
||||
CheckVkResult(vkr);
|
||||
if(vkr != VK_SUCCESS)
|
||||
return history;
|
||||
if(!bp)
|
||||
{
|
||||
RDCERR("Manually reporting failed memory map");
|
||||
CheckVkResult(VK_ERROR_MEMORY_MAP_FAILED);
|
||||
return history;
|
||||
}
|
||||
|
||||
// Retrieve primitive ID values where fragment shader discarded some
|
||||
// fragments. For these primitives we are going to perform an occlusion
|
||||
|
||||
@@ -1865,6 +1865,12 @@ void VulkanReplay::FetchVSOut(uint32_t eventId, VulkanRenderState &state)
|
||||
CheckVkResult(vkr);
|
||||
if(vkr != VK_SUCCESS)
|
||||
return;
|
||||
if(!idxData)
|
||||
{
|
||||
RDCERR("Manually reporting failed memory map");
|
||||
CheckVkResult(VK_ERROR_MEMORY_MAP_FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(idxData, &indices[0], indices.size() * sizeof(uint32_t));
|
||||
|
||||
@@ -1937,6 +1943,12 @@ void VulkanReplay::FetchVSOut(uint32_t eventId, VulkanRenderState &state)
|
||||
CheckVkResult(vkr);
|
||||
if(vkr != VK_SUCCESS)
|
||||
return;
|
||||
if(!idxData)
|
||||
{
|
||||
RDCERR("Manually reporting failed memory map");
|
||||
CheckVkResult(VK_ERROR_MEMORY_MAP_FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(idxData, idxdata.data(), idxdata.size());
|
||||
|
||||
@@ -2159,6 +2171,12 @@ void VulkanReplay::FetchVSOut(uint32_t eventId, VulkanRenderState &state)
|
||||
CheckVkResult(vkr);
|
||||
if(vkr != VK_SUCCESS)
|
||||
return;
|
||||
if(!dst)
|
||||
{
|
||||
RDCERR("Manually reporting failed memory map");
|
||||
CheckVkResult(VK_ERROR_MEMORY_MAP_FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
const byte *dstBase = dst;
|
||||
(void)dstBase;
|
||||
@@ -2665,6 +2683,12 @@ void VulkanReplay::FetchVSOut(uint32_t eventId, VulkanRenderState &state)
|
||||
CheckVkResult(vkr);
|
||||
if(vkr != VK_SUCCESS)
|
||||
return;
|
||||
if(!byteData)
|
||||
{
|
||||
RDCERR("Manually reporting failed memory map");
|
||||
CheckVkResult(VK_ERROR_MEMORY_MAP_FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
VkMappedMemoryRange range = {
|
||||
VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, NULL, readbackMem, 0, VK_WHOLE_SIZE,
|
||||
|
||||
@@ -526,6 +526,8 @@ void VulkanReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &seco
|
||||
// TODO should move the color to a push constant so we don't have to map all the time
|
||||
uint32_t uboOffs = 0;
|
||||
MeshUBOData *data = (MeshUBOData *)m_MeshRender.UBO.Map(&uboOffs);
|
||||
if(!data)
|
||||
return;
|
||||
|
||||
data->mvp = ModelViewProj;
|
||||
data->color = Vec4f(fmt.meshColor.x, fmt.meshColor.y, fmt.meshColor.z, fmt.meshColor.w);
|
||||
@@ -695,6 +697,8 @@ void VulkanReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &seco
|
||||
|
||||
uint32_t uboOffs = 0;
|
||||
MeshUBOData *data = (MeshUBOData *)m_MeshRender.UBO.Map(&uboOffs);
|
||||
if(!data)
|
||||
return;
|
||||
|
||||
if(solidShadeMode == SolidShade::Lit)
|
||||
data->invProj = projMat.Inverse();
|
||||
@@ -749,6 +753,8 @@ void VulkanReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &seco
|
||||
|
||||
uint32_t uboOffs = 0;
|
||||
MeshUBOData *data = (MeshUBOData *)m_MeshRender.UBO.Map(&uboOffs);
|
||||
if(!data)
|
||||
return;
|
||||
|
||||
data->mvp = ModelViewProj;
|
||||
data->color = wireCol;
|
||||
@@ -829,6 +835,8 @@ void VulkanReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &seco
|
||||
|
||||
VkDeviceSize vboffs = 0;
|
||||
Vec4f *ptr = (Vec4f *)m_MeshRender.BBoxVB.Map(vboffs);
|
||||
if(!ptr)
|
||||
return;
|
||||
|
||||
memcpy(ptr, bbox, sizeof(bbox));
|
||||
|
||||
@@ -838,6 +846,8 @@ void VulkanReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &seco
|
||||
|
||||
uint32_t uboOffs = 0;
|
||||
MeshUBOData *data = (MeshUBOData *)m_MeshRender.UBO.Map(&uboOffs);
|
||||
if(!data)
|
||||
return;
|
||||
|
||||
data->mvp = ModelViewProj;
|
||||
data->color = Vec4f(0.2f, 0.2f, 1.0f, 1.0f);
|
||||
@@ -866,6 +876,8 @@ void VulkanReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &seco
|
||||
|
||||
uint32_t uboOffs = 0;
|
||||
MeshUBOData *data = (MeshUBOData *)m_MeshRender.UBO.Map(&uboOffs);
|
||||
if(!data)
|
||||
return;
|
||||
|
||||
data->mvp = ModelViewProj;
|
||||
data->color = Vec4f(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
@@ -887,6 +899,8 @@ void VulkanReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &seco
|
||||
|
||||
// poke the color (this would be a good candidate for a push constant)
|
||||
data = (MeshUBOData *)m_MeshRender.UBO.Map(&uboOffs);
|
||||
if(!data)
|
||||
return;
|
||||
|
||||
data->mvp = ModelViewProj;
|
||||
data->color = Vec4f(0.0f, 1.0f, 0.0f, 1.0f);
|
||||
@@ -903,6 +917,8 @@ void VulkanReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &seco
|
||||
vt->CmdDraw(Unwrap(cmd), 2, 1, 2, 0);
|
||||
|
||||
data = (MeshUBOData *)m_MeshRender.UBO.Map(&uboOffs);
|
||||
if(!data)
|
||||
return;
|
||||
|
||||
data->mvp = ModelViewProj;
|
||||
data->color = Vec4f(0.0f, 0.0f, 1.0f, 1.0f);
|
||||
@@ -927,6 +943,8 @@ void VulkanReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &seco
|
||||
|
||||
uint32_t uboOffs = 0;
|
||||
MeshUBOData *data = (MeshUBOData *)m_MeshRender.UBO.Map(&uboOffs);
|
||||
if(!data)
|
||||
return;
|
||||
|
||||
data->mvp = ModelViewProj;
|
||||
data->color = Vec4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
@@ -1038,6 +1056,8 @@ void VulkanReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &seco
|
||||
|
||||
uint32_t uboOffs = 0;
|
||||
MeshUBOData *ubodata = (MeshUBOData *)m_MeshRender.UBO.Map(&uboOffs);
|
||||
if(!ubodata)
|
||||
return;
|
||||
*ubodata = uniforms;
|
||||
m_MeshRender.UBO.Unmap();
|
||||
|
||||
@@ -1055,6 +1075,8 @@ void VulkanReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &seco
|
||||
uniforms.color = Vec4f(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
// poke the color (this would be a good candidate for a push constant)
|
||||
ubodata = (MeshUBOData *)m_MeshRender.UBO.Map(&uboOffs);
|
||||
if(!ubodata)
|
||||
return;
|
||||
*ubodata = uniforms;
|
||||
m_MeshRender.UBO.Unmap();
|
||||
vt->CmdBindDescriptorSets(Unwrap(cmd), VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||
@@ -1065,6 +1087,8 @@ void VulkanReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &seco
|
||||
{
|
||||
VkDeviceSize vboffs = 0;
|
||||
Vec4f *ptr = (Vec4f *)m_MeshRender.BBoxVB.Map(vboffs, sizeof(Vec4f) * primSize);
|
||||
if(!ptr)
|
||||
return;
|
||||
|
||||
memcpy(ptr, &activePrim[0], sizeof(Vec4f) * primSize);
|
||||
|
||||
@@ -1079,6 +1103,8 @@ void VulkanReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &seco
|
||||
uniforms.color = Vec4f(0.0f, 1.0f, 0.0f, 1.0f);
|
||||
// poke the color (this would be a good candidate for a push constant)
|
||||
ubodata = (MeshUBOData *)m_MeshRender.UBO.Map(&uboOffs);
|
||||
if(!ubodata)
|
||||
return;
|
||||
*ubodata = uniforms;
|
||||
m_MeshRender.UBO.Unmap();
|
||||
vt->CmdBindDescriptorSets(Unwrap(cmd), VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||
@@ -1090,6 +1116,8 @@ void VulkanReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &seco
|
||||
VkDeviceSize vboffs = 0;
|
||||
Vec4f *ptr =
|
||||
(Vec4f *)m_MeshRender.BBoxVB.Map(vboffs, sizeof(Vec4f) * adjacentPrimVertices.size());
|
||||
if(!ptr)
|
||||
return;
|
||||
|
||||
memcpy(ptr, &adjacentPrimVertices[0], sizeof(Vec4f) * adjacentPrimVertices.size());
|
||||
|
||||
@@ -1111,6 +1139,8 @@ void VulkanReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &seco
|
||||
uniforms.color = Vec4f(0.0f, 0.0f, 1.0f, 1.0f);
|
||||
// poke the color (this would be a good candidate for a push constant)
|
||||
ubodata = (MeshUBOData *)m_MeshRender.UBO.Map(&uboOffs);
|
||||
if(!ubodata)
|
||||
return;
|
||||
*ubodata = uniforms;
|
||||
m_MeshRender.UBO.Unmap();
|
||||
vt->CmdBindDescriptorSets(Unwrap(cmd), VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||
@@ -1135,6 +1165,8 @@ void VulkanReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &seco
|
||||
{
|
||||
VkDeviceSize vboffs = 0;
|
||||
Vec4f *ptr = (Vec4f *)m_MeshRender.BBoxVB.Map(vboffs, sizeof(vertSprite));
|
||||
if(!ptr)
|
||||
return;
|
||||
|
||||
memcpy(ptr, &vertSprite[0], sizeof(vertSprite));
|
||||
|
||||
@@ -1149,6 +1181,8 @@ void VulkanReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &seco
|
||||
uniforms.color = Vec4f(0.0f, 1.0f, 0.0f, 1.0f);
|
||||
// poke the color (this would be a good candidate for a push constant)
|
||||
ubodata = (MeshUBOData *)m_MeshRender.UBO.Map(&uboOffs);
|
||||
if(!ubodata)
|
||||
return;
|
||||
*ubodata = uniforms;
|
||||
m_MeshRender.UBO.Unmap();
|
||||
vt->CmdBindDescriptorSets(Unwrap(cmd), VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||
@@ -1159,6 +1193,8 @@ void VulkanReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &seco
|
||||
{
|
||||
VkDeviceSize vboffs = 0;
|
||||
FloatVector *ptr = (FloatVector *)m_MeshRender.BBoxVB.Map(vboffs, sizeof(vertSprite));
|
||||
if(!ptr)
|
||||
return;
|
||||
|
||||
for(size_t i = 0; i < inactiveVertices.size(); i++)
|
||||
{
|
||||
|
||||
@@ -227,6 +227,9 @@ bool VulkanReplay::RenderTextureInternal(TextureDisplay cfg, const ImageState &i
|
||||
|
||||
TexDisplayUBOData *data = (TexDisplayUBOData *)m_TexRender.UBO.Map(&uboOffs);
|
||||
|
||||
if(!data)
|
||||
return false;
|
||||
|
||||
data->Padding = 0;
|
||||
|
||||
float x = cfg.xOffset;
|
||||
@@ -422,6 +425,8 @@ bool VulkanReplay::RenderTextureInternal(TextureDisplay cfg, const ImageState &i
|
||||
|
||||
{
|
||||
HeatmapData *ptr = (HeatmapData *)m_TexRender.HeatmapUBO.Map(&heatUboOffs);
|
||||
if(!ptr)
|
||||
return false;
|
||||
memcpy(ptr, &heatmapData, sizeof(HeatmapData));
|
||||
m_TexRender.HeatmapUBO.Unmap();
|
||||
}
|
||||
|
||||
@@ -782,6 +782,8 @@ void VulkanReplay::RenderCheckerboard(FloatVector dark, FloatVector light)
|
||||
if(m_Overlay.m_CheckerPipeline != VK_NULL_HANDLE)
|
||||
{
|
||||
CheckerboardUBOData *data = (CheckerboardUBOData *)m_Overlay.m_CheckerUBO.Map(&uboOffs);
|
||||
if(!data)
|
||||
return;
|
||||
data->BorderWidth = 0.0f;
|
||||
data->RectPosition = Vec2f();
|
||||
data->RectSize = Vec2f();
|
||||
@@ -2401,6 +2403,12 @@ void VulkanReplay::PickPixel(ResourceId texture, uint32_t x, uint32_t y, const S
|
||||
CheckVkResult(vkr);
|
||||
if(vkr != VK_SUCCESS)
|
||||
return;
|
||||
if(!pData)
|
||||
{
|
||||
RDCERR("Manually reporting failed memory map");
|
||||
CheckVkResult(VK_ERROR_MEMORY_MAP_FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
VkMappedMemoryRange range = {
|
||||
VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,
|
||||
@@ -2651,6 +2659,8 @@ bool VulkanReplay::GetMinMax(ResourceId texid, const Subresource &sub, CompType
|
||||
vt->UpdateDescriptorSets(Unwrap(dev), (uint32_t)writeSets.size(), &writeSets[0], 0, NULL);
|
||||
|
||||
HistogramUBOData *data = (HistogramUBOData *)m_Histogram.m_HistogramUBO.Map(NULL);
|
||||
if(!data)
|
||||
return false;
|
||||
|
||||
data->HistogramTextureResolution.x = (float)RDCMAX(uint32_t(iminfo.extent.width) >> sub.mip, 1U);
|
||||
data->HistogramTextureResolution.y = (float)RDCMAX(uint32_t(iminfo.extent.height) >> sub.mip, 1U);
|
||||
@@ -2775,6 +2785,8 @@ bool VulkanReplay::GetMinMax(ResourceId texid, const Subresource &sub, CompType
|
||||
m_pDriver->FlushQ();
|
||||
|
||||
Vec4f *minmax = (Vec4f *)m_Histogram.m_MinMaxReadback.Map(NULL);
|
||||
if(!minmax)
|
||||
return false;
|
||||
|
||||
minval[0] = minmax[0].x;
|
||||
minval[1] = minmax[0].y;
|
||||
@@ -2957,6 +2969,8 @@ bool VulkanReplay::GetHistogram(ResourceId texid, const Subresource &sub, CompTy
|
||||
vt->UpdateDescriptorSets(Unwrap(dev), (uint32_t)writeSets.size(), &writeSets[0], 0, NULL);
|
||||
|
||||
HistogramUBOData *data = (HistogramUBOData *)m_Histogram.m_HistogramUBO.Map(NULL);
|
||||
if(!data)
|
||||
return false;
|
||||
|
||||
data->HistogramTextureResolution.x = (float)RDCMAX(uint32_t(iminfo.extent.width) >> sub.mip, 1U);
|
||||
data->HistogramTextureResolution.y = (float)RDCMAX(uint32_t(iminfo.extent.height) >> sub.mip, 1U);
|
||||
@@ -3088,6 +3102,8 @@ bool VulkanReplay::GetHistogram(ResourceId texid, const Subresource &sub, CompTy
|
||||
m_pDriver->FlushQ();
|
||||
|
||||
uint32_t *buckets = (uint32_t *)m_Histogram.m_HistogramReadback.Map(NULL);
|
||||
if(!buckets)
|
||||
return false;
|
||||
|
||||
histogram.assign(buckets, HGRAM_NUM_BUCKETS);
|
||||
|
||||
@@ -3870,6 +3886,12 @@ void VulkanReplay::GetTextureData(ResourceId tex, const Subresource &sub,
|
||||
CheckVkResult(vkr);
|
||||
if(vkr != VK_SUCCESS)
|
||||
return;
|
||||
if(!pData)
|
||||
{
|
||||
RDCERR("Manually reporting failed memory map");
|
||||
CheckVkResult(VK_ERROR_MEMORY_MAP_FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
VkMappedMemoryRange range = {
|
||||
VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, NULL, readbackMem, 0, VK_WHOLE_SIZE,
|
||||
|
||||
@@ -1363,6 +1363,8 @@ public:
|
||||
NULL);
|
||||
|
||||
void *constants = m_DebugData.ConstantsBuffer.Map(NULL, 0);
|
||||
if(!constants)
|
||||
return false;
|
||||
|
||||
memcpy(constants, &uniformParams, sizeof(uniformParams));
|
||||
|
||||
@@ -1440,6 +1442,8 @@ public:
|
||||
}
|
||||
|
||||
float *ret = (float *)m_DebugData.ReadbackBuffer.Map(NULL, 0);
|
||||
if(!ret)
|
||||
return false;
|
||||
|
||||
// convert float results, we did all sampling at 32-bit precision
|
||||
if(output.type == VarType::Half)
|
||||
@@ -1573,6 +1577,8 @@ public:
|
||||
}
|
||||
|
||||
byte *ret = (byte *)m_DebugData.ReadbackBuffer.Map(NULL, 0);
|
||||
if(!ret)
|
||||
return false;
|
||||
|
||||
// these two operations change the type of the output
|
||||
if(op == rdcspv::GLSLstd450::Length || op == rdcspv::GLSLstd450::Distance)
|
||||
|
||||
@@ -858,6 +858,12 @@ bool WrappedVulkan::Serialise_vkUnmapMemory(SerialiserType &ser, VkDevice device
|
||||
RDCERR("Error mapping memory on replay: %s", ToStr(vkr).c_str());
|
||||
return false;
|
||||
}
|
||||
if(!MapData)
|
||||
{
|
||||
RDCERR("Manually reporting failed memory map");
|
||||
CheckVkResult(VK_ERROR_MEMORY_MAP_FAILED);
|
||||
return false;
|
||||
}
|
||||
|
||||
const Intervals<VulkanCreationInfo::Memory::MemoryBinding> &bindings =
|
||||
m_CreationInfo.m_Memory[GetResID(memory)].bindings;
|
||||
@@ -1059,8 +1065,15 @@ bool WrappedVulkan::Serialise_vkFlushMappedMemoryRanges(SerialiserType &ser, VkD
|
||||
VkResult ret =
|
||||
ObjDisp(device)->MapMemory(Unwrap(device), Unwrap(MemRange.memory), MemRange.offset,
|
||||
MemRange.size, 0, (void **)&MappedData);
|
||||
CheckVkResult(ret);
|
||||
if(ret != VK_SUCCESS)
|
||||
RDCERR("Error mapping memory on replay: %s", ToStr(ret).c_str());
|
||||
if(!MappedData)
|
||||
{
|
||||
RDCERR("Manually reporting failed memory map");
|
||||
CheckVkResult(VK_ERROR_MEMORY_MAP_FAILED);
|
||||
return false;
|
||||
}
|
||||
|
||||
const VulkanCreationInfo::Memory &memInfo = m_CreationInfo.m_Memory[GetResID(MemRange.memory)];
|
||||
const Intervals<VulkanCreationInfo::Memory::MemoryBinding> &bindings = memInfo.bindings;
|
||||
|
||||
Reference in New Issue
Block a user