Add a few last things that need extension checks

This commit is contained in:
baldurk
2017-01-17 19:11:24 +00:00
parent 86200f1a10
commit 4f8d6d5c70
3 changed files with 91 additions and 29 deletions
+2 -1
View File
@@ -227,7 +227,8 @@ extern bool GLIsCore;
EXT_TO_CHECK(ARB_gpu_shader5) \
EXT_TO_CHECK(ARB_texture_view) \
EXT_TO_CHECK(ARB_seamless_cubemap_per_texture) \
EXT_TO_CHECK(ARB_stencil_texturing)
EXT_TO_CHECK(ARB_stencil_texturing) \
EXT_TO_CHECK(ARB_base_instance)
// extensions we know we want to check for are precached, indexd by this enum
enum ExtensionCheckEnum
+65 -14
View File
@@ -2275,8 +2275,12 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, FormatComponentType typeHin
gl.glDisablei(eGL_SCISSOR_TEST, 0);
gl.glViewportIndexedf(0, rs.Viewports[0].x, rs.Viewports[0].y, rs.Viewports[0].width,
rs.Viewports[0].height);
if(HasExt[ARB_viewport_array])
gl.glViewportIndexedf(0, rs.Viewports[0].x, rs.Viewports[0].y, rs.Viewports[0].width,
rs.Viewports[0].height);
else
gl.glViewport((GLint)rs.Viewports[0].x, (GLint)rs.Viewports[0].y,
(GLsizei)rs.Viewports[0].width, (GLsizei)rs.Viewports[0].height);
gl.glBindBufferBase(eGL_UNIFORM_BUFFER, 0, DebugData.UBOs[0]);
OutlineUBOData *cdata =
@@ -2298,7 +2302,11 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, FormatComponentType typeHin
Vec4f scissor((float)rs.Scissors[0].x, (float)rs.Scissors[0].y, (float)rs.Scissors[0].width,
(float)rs.Scissors[0].height);
gl.glViewportIndexedf(0, scissor.x, scissor.y, scissor.z, scissor.w);
if(HasExt[ARB_viewport_array])
gl.glViewportIndexedf(0, scissor.x, scissor.y, scissor.z, scissor.w);
else
gl.glViewport(rs.Scissors[0].x, rs.Scissors[0].y, rs.Scissors[0].width,
rs.Scissors[0].height);
cdata = (OutlineUBOData *)gl.glMapBufferRange(eGL_UNIFORM_BUFFER, 0, sizeof(OutlineUBOData),
GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
@@ -3467,10 +3475,22 @@ void GLReplay::InitPostVSBuffers(uint32_t eventID)
if((drawcall->flags & eDraw_UseIBuffer) == 0)
{
if(drawcall->flags & eDraw_Instanced)
gl.glDrawArraysInstancedBaseInstance(eGL_POINTS, drawcall->vertexOffset, drawcall->numIndices,
drawcall->numInstances, drawcall->instanceOffset);
{
if(HasExt[ARB_base_instance])
{
gl.glDrawArraysInstancedBaseInstance(eGL_POINTS, drawcall->vertexOffset, drawcall->numIndices,
drawcall->numInstances, drawcall->instanceOffset);
}
else
{
gl.glDrawArraysInstanced(eGL_POINTS, drawcall->vertexOffset, drawcall->numIndices,
drawcall->numInstances);
}
}
else
{
gl.glDrawArrays(eGL_POINTS, drawcall->vertexOffset, drawcall->numIndices);
}
}
else // drawcall is indexed
{
@@ -3544,9 +3564,17 @@ void GLReplay::InitPostVSBuffers(uint32_t eventID)
if(drawcall->flags & eDraw_Instanced)
{
gl.glDrawElementsInstancedBaseVertexBaseInstance(
eGL_POINTS, (GLsizei)indices.size(), eGL_UNSIGNED_INT, NULL, drawcall->numInstances,
drawcall->baseVertex, drawcall->instanceOffset);
if(HasExt[ARB_base_instance])
{
gl.glDrawElementsInstancedBaseVertexBaseInstance(
eGL_POINTS, (GLsizei)indices.size(), eGL_UNSIGNED_INT, NULL, drawcall->numInstances,
drawcall->baseVertex, drawcall->instanceOffset);
}
else
{
gl.glDrawElementsInstancedBaseVertex(eGL_POINTS, (GLsizei)indices.size(), eGL_UNSIGNED_INT,
NULL, drawcall->numInstances, drawcall->baseVertex);
}
}
else
{
@@ -3952,10 +3980,23 @@ void GLReplay::InitPostVSBuffers(uint32_t eventID)
if((drawcall->flags & eDraw_UseIBuffer) == 0)
{
if(drawcall->flags & eDraw_Instanced)
gl.glDrawArraysInstancedBaseInstance(drawtopo, drawcall->vertexOffset, drawcall->numIndices,
drawcall->numInstances, drawcall->instanceOffset);
{
if(HasExt[ARB_base_instance])
{
gl.glDrawArraysInstancedBaseInstance(drawtopo, drawcall->vertexOffset,
drawcall->numIndices, drawcall->numInstances,
drawcall->instanceOffset);
}
else
{
gl.glDrawArraysInstanced(drawtopo, drawcall->vertexOffset, drawcall->numIndices,
drawcall->numInstances);
}
}
else
{
gl.glDrawArrays(drawtopo, drawcall->vertexOffset, drawcall->numIndices);
}
}
else // drawcall is indexed
{
@@ -3967,10 +4008,20 @@ void GLReplay::InitPostVSBuffers(uint32_t eventID)
if(drawcall->flags & eDraw_Instanced)
{
gl.glDrawElementsInstancedBaseVertexBaseInstance(
drawtopo, drawcall->numIndices, idxType,
(const void *)uintptr_t(drawcall->indexOffset * drawcall->indexByteWidth),
drawcall->numInstances, drawcall->baseVertex, drawcall->instanceOffset);
if(HasExt[ARB_base_instance])
{
gl.glDrawElementsInstancedBaseVertexBaseInstance(
drawtopo, drawcall->numIndices, idxType,
(const void *)uintptr_t(drawcall->indexOffset * drawcall->indexByteWidth),
drawcall->numInstances, drawcall->baseVertex, drawcall->instanceOffset);
}
else
{
gl.glDrawElementsInstancedBaseVertex(
drawtopo, drawcall->numIndices, idxType,
(const void *)uintptr_t(drawcall->indexOffset * drawcall->indexByteWidth),
drawcall->numInstances, drawcall->baseVertex);
}
}
else
{
+24 -14
View File
@@ -493,10 +493,14 @@ void GLReplay::CacheTexture(ResourceId id)
tex.byteSize = (tex.width * tex.height) * (tex.format.compByteWidth * tex.format.compCount);
string str = "";
char name[128] = {0};
gl.glGetObjectLabel(eGL_RENDERBUFFER, res.resource.name, 127, NULL, name);
str = name;
tex.customName = true;
if(HasExt[KHR_debug])
{
char name[128] = {0};
gl.glGetObjectLabel(eGL_RENDERBUFFER, res.resource.name, 127, NULL, name);
str = name;
tex.customName = true;
}
if(str == "")
{
@@ -646,10 +650,13 @@ void GLReplay::CacheTexture(ResourceId id)
tex.creationFlags |= eTextureCreate_DSV;
string str = "";
char name[128] = {0};
gl.glGetObjectLabel(eGL_TEXTURE, res.resource.name, 127, NULL, name);
str = name;
tex.customName = true;
if(HasExt[KHR_debug])
{
char name[128] = {0};
gl.glGetObjectLabel(eGL_TEXTURE, res.resource.name, 127, NULL, name);
str = name;
tex.customName = true;
}
if(str == "")
{
@@ -810,10 +817,13 @@ FetchBuffer GLReplay::GetBuffer(ResourceId id)
}
string str = "";
char name[128] = {0};
gl.glGetObjectLabel(eGL_BUFFER, res.resource.name, 127, NULL, name);
str = name;
ret.customName = true;
if(HasExt[KHR_debug])
{
char name[128] = {0};
gl.glGetObjectLabel(eGL_BUFFER, res.resource.name, 127, NULL, name);
str = name;
ret.customName = true;
}
if(str == "")
{
@@ -3025,7 +3035,7 @@ ResourceId GLReplay::CreateProxyTexture(const FetchTexture &templateTex)
}
}
if(templateTex.customName)
if(templateTex.customName && HasExt[KHR_debug])
gl.glObjectLabel(eGL_TEXTURE, tex, -1, templateTex.name.elems);
return m_pDriver->GetResourceManager()->GetID(TextureRes(m_pDriver->GetCtx(), tex));
@@ -3187,7 +3197,7 @@ ResourceId GLReplay::CreateProxyBuffer(const FetchBuffer &templateBuf)
gl.glBindBuffer(target, buf);
gl.glNamedBufferDataEXT(buf, (GLsizeiptr)templateBuf.length, NULL, eGL_DYNAMIC_DRAW);
if(templateBuf.customName)
if(templateBuf.customName && HasExt[KHR_debug])
gl.glObjectLabel(eGL_BUFFER, buf, -1, templateBuf.name.elems);
return m_pDriver->GetResourceManager()->GetID(BufferRes(m_pDriver->GetCtx(), buf));