mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-23 14:15:42 +00:00
Add checks for GL maps failing
This commit is contained in:
@@ -2643,6 +2643,12 @@ uint32_t GLReplay::PickVertex(uint32_t eventId, int32_t width, int32_t height,
|
||||
(MeshPickUBOData *)drv.glMapBufferRange(eGL_UNIFORM_BUFFER, 0, sizeof(MeshPickUBOData),
|
||||
GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
|
||||
if(!cdata)
|
||||
{
|
||||
RDCERR("Map buffer failed %d", drv.glGetError());
|
||||
return ~0U;
|
||||
}
|
||||
|
||||
cdata->rayPos = rayPos;
|
||||
cdata->rayDir = rayDir;
|
||||
cdata->use_indices = cfg.position.indexByteStride ? 1U : 0U;
|
||||
@@ -2842,6 +2848,12 @@ void GLReplay::RenderCheckerboard(FloatVector dark, FloatVector light)
|
||||
(CheckerboardUBOData *)drv.glMapBufferRange(eGL_UNIFORM_BUFFER, 0, sizeof(CheckerboardUBOData),
|
||||
GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
|
||||
if(!ubo)
|
||||
{
|
||||
RDCERR("Map buffer failed %d", drv.glGetError());
|
||||
return;
|
||||
}
|
||||
|
||||
ubo->BorderWidth = 0.0f;
|
||||
ubo->RectPosition = Vec2f();
|
||||
ubo->RectSize = Vec2f();
|
||||
|
||||
@@ -905,6 +905,12 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, FloatVector clearCol, Debug
|
||||
eGL_UNIFORM_BUFFER, 0, sizeof(CheckerboardUBOData),
|
||||
GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
|
||||
if(!cdata)
|
||||
{
|
||||
RDCERR("Map buffer failed %d", drv.glGetError());
|
||||
return ResourceId();
|
||||
}
|
||||
|
||||
cdata->BorderWidth = 3;
|
||||
cdata->CheckerSquareDimension = 16.0f;
|
||||
|
||||
@@ -935,6 +941,12 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, FloatVector clearCol, Debug
|
||||
eGL_UNIFORM_BUFFER, 0, sizeof(CheckerboardUBOData),
|
||||
GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
|
||||
if(!cdata)
|
||||
{
|
||||
RDCERR("Map buffer failed %d", drv.glGetError());
|
||||
return ResourceId();
|
||||
}
|
||||
|
||||
cdata->BorderWidth = 3;
|
||||
cdata->CheckerSquareDimension = 16.0f;
|
||||
|
||||
@@ -1465,12 +1477,26 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, FloatVector clearCol, Debug
|
||||
MeshUBOData *uboptr =
|
||||
(MeshUBOData *)drv.glMapBufferRange(eGL_COPY_WRITE_BUFFER, 0, sizeof(MeshUBOData),
|
||||
GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
|
||||
if(!uboptr)
|
||||
{
|
||||
RDCERR("Map buffer failed %d", drv.glGetError());
|
||||
return ResourceId();
|
||||
}
|
||||
|
||||
*uboptr = uboParams;
|
||||
drv.glUnmapBuffer(eGL_COPY_WRITE_BUFFER);
|
||||
|
||||
drv.glBindBuffer(eGL_COPY_WRITE_BUFFER, DebugData.UBOs[2]);
|
||||
Vec4f *v = (Vec4f *)drv.glMapBufferRange(eGL_COPY_WRITE_BUFFER, 0, sizeof(Vec4f),
|
||||
GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
|
||||
if(!v)
|
||||
{
|
||||
RDCERR("Map buffer failed %d", drv.glGetError());
|
||||
return ResourceId();
|
||||
}
|
||||
|
||||
*v = Vec4f(rs.Viewports[0].width, rs.Viewports[0].height);
|
||||
drv.glUnmapBuffer(eGL_COPY_WRITE_BUFFER);
|
||||
|
||||
|
||||
@@ -139,6 +139,13 @@ void GLReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &secondar
|
||||
|
||||
uboptr = (MeshUBOData *)drv.glMapBufferRange(eGL_UNIFORM_BUFFER, 0, sizeof(MeshUBOData),
|
||||
GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
|
||||
if(!uboptr)
|
||||
{
|
||||
RDCERR("Map buffer failed %d", drv.glGetError());
|
||||
return;
|
||||
}
|
||||
|
||||
*uboptr = uboParams;
|
||||
drv.glUnmapBuffer(eGL_UNIFORM_BUFFER);
|
||||
|
||||
@@ -350,6 +357,12 @@ void GLReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &secondar
|
||||
MeshUBOData *soliddata = (MeshUBOData *)drv.glMapBufferRange(
|
||||
eGL_UNIFORM_BUFFER, 0, sizeof(MeshUBOData), GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
|
||||
if(!soliddata)
|
||||
{
|
||||
RDCERR("Map buffer failed %d", drv.glGetError());
|
||||
return;
|
||||
}
|
||||
|
||||
soliddata->mvp = ModelViewProj;
|
||||
soliddata->pointSpriteSize = Vec2f(0.0f, 0.0f);
|
||||
soliddata->homogenousInput = cfg.position.unproject;
|
||||
@@ -417,6 +430,13 @@ void GLReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &secondar
|
||||
|
||||
uboptr = (MeshUBOData *)drv.glMapBufferRange(eGL_UNIFORM_BUFFER, 0, sizeof(MeshUBOData),
|
||||
GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
|
||||
if(!uboptr)
|
||||
{
|
||||
RDCERR("Map buffer failed %d", drv.glGetError());
|
||||
return;
|
||||
}
|
||||
|
||||
*uboptr = uboParams;
|
||||
drv.glUnmapBuffer(eGL_UNIFORM_BUFFER);
|
||||
|
||||
@@ -488,6 +508,13 @@ void GLReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &secondar
|
||||
|
||||
uboptr = (MeshUBOData *)drv.glMapBufferRange(eGL_UNIFORM_BUFFER, 0, sizeof(MeshUBOData),
|
||||
GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
|
||||
if(!uboptr)
|
||||
{
|
||||
RDCERR("Map buffer failed %d", drv.glGetError());
|
||||
return;
|
||||
}
|
||||
|
||||
*uboptr = uboParams;
|
||||
drv.glUnmapBuffer(eGL_UNIFORM_BUFFER);
|
||||
|
||||
@@ -507,6 +534,13 @@ void GLReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &secondar
|
||||
uboParams.color = Vec4f(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
uboptr = (MeshUBOData *)drv.glMapBufferRange(eGL_UNIFORM_BUFFER, 0, sizeof(MeshUBOData),
|
||||
GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
|
||||
if(!uboptr)
|
||||
{
|
||||
RDCERR("Map buffer failed %d", drv.glGetError());
|
||||
return;
|
||||
}
|
||||
|
||||
*uboptr = uboParams;
|
||||
drv.glUnmapBuffer(eGL_UNIFORM_BUFFER);
|
||||
|
||||
@@ -515,6 +549,13 @@ void GLReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &secondar
|
||||
uboParams.color = Vec4f(0.0f, 1.0f, 0.0f, 1.0f);
|
||||
uboptr = (MeshUBOData *)drv.glMapBufferRange(eGL_UNIFORM_BUFFER, 0, sizeof(MeshUBOData),
|
||||
GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
|
||||
if(!uboptr)
|
||||
{
|
||||
RDCERR("Map buffer failed %d", drv.glGetError());
|
||||
return;
|
||||
}
|
||||
|
||||
*uboptr = uboParams;
|
||||
drv.glUnmapBuffer(eGL_UNIFORM_BUFFER);
|
||||
drv.glDrawArrays(eGL_LINES, 2, 2);
|
||||
@@ -522,6 +563,13 @@ void GLReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &secondar
|
||||
uboParams.color = Vec4f(0.0f, 0.0f, 1.0f, 1.0f);
|
||||
uboptr = (MeshUBOData *)drv.glMapBufferRange(eGL_UNIFORM_BUFFER, 0, sizeof(MeshUBOData),
|
||||
GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
|
||||
if(!uboptr)
|
||||
{
|
||||
RDCERR("Map buffer failed %d", drv.glGetError());
|
||||
return;
|
||||
}
|
||||
|
||||
*uboptr = uboParams;
|
||||
drv.glUnmapBuffer(eGL_UNIFORM_BUFFER);
|
||||
drv.glDrawArrays(eGL_LINES, 4, 2);
|
||||
@@ -537,6 +585,13 @@ void GLReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &secondar
|
||||
|
||||
uboptr = (MeshUBOData *)drv.glMapBufferRange(eGL_UNIFORM_BUFFER, 0, sizeof(MeshUBOData),
|
||||
GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
|
||||
if(!uboptr)
|
||||
{
|
||||
RDCERR("Map buffer failed %d", drv.glGetError());
|
||||
return;
|
||||
}
|
||||
|
||||
*uboptr = uboParams;
|
||||
drv.glUnmapBuffer(eGL_UNIFORM_BUFFER);
|
||||
|
||||
@@ -611,6 +666,13 @@ void GLReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &secondar
|
||||
{
|
||||
uboptr = (MeshUBOData *)drv.glMapBufferRange(eGL_UNIFORM_BUFFER, 0, sizeof(MeshUBOData),
|
||||
GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
|
||||
if(!uboptr)
|
||||
{
|
||||
RDCERR("Map buffer failed %d", drv.glGetError());
|
||||
return;
|
||||
}
|
||||
|
||||
*uboptr = uboParams;
|
||||
drv.glUnmapBuffer(eGL_UNIFORM_BUFFER);
|
||||
|
||||
@@ -627,6 +689,13 @@ void GLReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &secondar
|
||||
{
|
||||
uboptr = (MeshUBOData *)drv.glMapBufferRange(eGL_UNIFORM_BUFFER, 0, sizeof(MeshUBOData),
|
||||
GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
|
||||
if(!uboptr)
|
||||
{
|
||||
RDCERR("Map buffer failed %d", drv.glGetError());
|
||||
return;
|
||||
}
|
||||
|
||||
*uboptr = uboParams;
|
||||
drv.glUnmapBuffer(eGL_UNIFORM_BUFFER);
|
||||
|
||||
@@ -649,6 +718,13 @@ void GLReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &secondar
|
||||
|
||||
uboptr = (MeshUBOData *)drv.glMapBufferRange(eGL_UNIFORM_BUFFER, 0, sizeof(MeshUBOData),
|
||||
GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
|
||||
if(!uboptr)
|
||||
{
|
||||
RDCERR("Map buffer failed %d", drv.glGetError());
|
||||
return;
|
||||
}
|
||||
|
||||
*uboptr = uboParams;
|
||||
drv.glUnmapBuffer(eGL_UNIFORM_BUFFER);
|
||||
|
||||
@@ -669,6 +745,13 @@ void GLReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &secondar
|
||||
|
||||
uboptr = (MeshUBOData *)drv.glMapBufferRange(eGL_UNIFORM_BUFFER, 0, sizeof(MeshUBOData),
|
||||
GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
|
||||
if(!uboptr)
|
||||
{
|
||||
RDCERR("Map buffer failed %d", drv.glGetError());
|
||||
return;
|
||||
}
|
||||
|
||||
*uboptr = uboParams;
|
||||
drv.glUnmapBuffer(eGL_UNIFORM_BUFFER);
|
||||
|
||||
|
||||
@@ -503,6 +503,12 @@ bool GLReplay::RenderTextureInternal(TextureDisplay cfg, TexDisplayFlags flags)
|
||||
(TexDisplayUBOData *)drv.glMapBufferRange(eGL_UNIFORM_BUFFER, 0, sizeof(TexDisplayUBOData),
|
||||
GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
|
||||
if(!ubo)
|
||||
{
|
||||
RDCERR("Map buffer failed %d", drv.glGetError());
|
||||
return false;
|
||||
}
|
||||
|
||||
float x = cfg.xOffset;
|
||||
float y = cfg.yOffset;
|
||||
|
||||
@@ -689,6 +695,12 @@ bool GLReplay::RenderTextureInternal(TextureDisplay cfg, TexDisplayFlags flags)
|
||||
HeatmapData *ptr = (HeatmapData *)drv.glMapBufferRange(
|
||||
eGL_UNIFORM_BUFFER, 0, sizeof(HeatmapData), GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
|
||||
if(!ptr)
|
||||
{
|
||||
RDCERR("Map buffer failed %d", drv.glGetError());
|
||||
return false;
|
||||
}
|
||||
|
||||
memcpy(ptr, &heatmapData, sizeof(heatmapData));
|
||||
|
||||
drv.glUnmapBuffer(eGL_UNIFORM_BUFFER);
|
||||
|
||||
Reference in New Issue
Block a user