adding support for multiview and MSAA in GL replays

This commit is contained in:
Remi Palandri authored and Baldur Karlsson committed 2018-06-21 11:31:48 +01:00
1 parent 67037ed4a1
commit 6085fe66e1
5 files changed
+62 -4

No files matched your search

+4 -1
View File
@@ -794,7 +794,10 @@ bool GLInitParams::IsSupportedVersion(uint64_t ver)
if(ver == CurrentVersion)
return true;
// we can check other older versions we support here.
// 0x1A -> 0x1B - supported MSAA and Multiview framebuffer attachments, which added
// number of samples, number of views, and base view index to the serialized data
if(ver == 0x1A)
return true;
return false;
}
+3 -1
View File
@@ -457,7 +457,9 @@ extern bool IsGLES;
EXT_TO_CHECK(99, 99, NV_read_depth) \
EXT_TO_CHECK(99, 99, NV_read_stencil) \
EXT_TO_CHECK(99, 99, NV_read_depth_stencil) \
EXT_TO_CHECK(99, 99, EXT_disjoint_timer_query)
EXT_TO_CHECK(99, 99, EXT_disjoint_timer_query) \
EXT_TO_CHECK(99, 99, EXT_multisampled_render_to_texture) \
EXT_TO_CHECK(99, 99, OVR_multiview)
// GL extensions equivalents
// Either promoted extensions from EXT to ARB, or
+1 -1
View File
@@ -53,7 +53,7 @@ struct GLInitParams
uint32_t height;
// check if a frame capture section version is supported
static const uint64_t CurrentVersion = 0x1A;
static const uint64_t CurrentVersion = 0x1B;
static bool IsSupportedVersion(uint64_t ver);
};
+50 -1
View File
@@ -77,6 +77,18 @@ void DoSerialise(SerialiserType &ser, FramebufferAttachmentData &el)
SERIALISE_MEMBER(layered);
SERIALISE_MEMBER(layer);
SERIALISE_MEMBER(level);
if(ser.VersionAtLeast(0x1B))
{
SERIALISE_MEMBER(numVirtualSamples);
SERIALISE_MEMBER(numViews);
SERIALISE_MEMBER(startView);
}
else if(ser.IsReading())
{
el.numVirtualSamples = 1;
el.numViews = 1;
el.startView = 0;
}
SERIALISE_MEMBER(obj);
}
@@ -200,6 +212,20 @@ void GLResourceManager::ContextPrepare_InitialState(GLResource res)
if(layered == 0)
gl.glGetNamedFramebufferAttachmentParameterivEXT(
res.name, attachment, eGL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER, &a.layer);
if(HasExt[EXT_multisampled_render_to_texture])
gl.glGetNamedFramebufferAttachmentParameterivEXT(
res.name, attachment, eGL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT,
&a.numVirtualSamples);
if(HasExt[OVR_multiview])
{
gl.glGetNamedFramebufferAttachmentParameterivEXT(
res.name, attachment, eGL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR, &a.numViews);
gl.glGetNamedFramebufferAttachmentParameterivEXT(
res.name, attachment, eGL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR,
&a.startView);
}
}
a.layered = (layered != 0);
@@ -1999,7 +2025,30 @@ void GLResourceManager::Apply_InitialState(GLResource live, GLInitialContents in
details.curType == eGL_TEXTURE_1D_ARRAY ||
details.curType == eGL_TEXTURE_2D_ARRAY)
{
gl.glFramebufferTextureLayer(eGL_DRAW_FRAMEBUFFER, attachment, obj, a.level, a.layer);
if(a.numViews > 1)
{
if(a.numVirtualSamples > 1)
{
gl.glFramebufferTextureMultisampleMultiviewOVR(eGL_DRAW_FRAMEBUFFER, attachment,
obj, a.level, a.numVirtualSamples,
a.startView, a.numViews);
}
else
{
gl.glFramebufferTextureMultiviewOVR(eGL_DRAW_FRAMEBUFFER, attachment, obj,
a.level, a.startView, a.numViews);
}
}
else
{
gl.glFramebufferTextureLayer(eGL_DRAW_FRAMEBUFFER, attachment, obj, a.level, a.layer);
}
}
else if(a.numVirtualSamples > 1)
{
gl.glFramebufferTexture2DMultisampleEXT(eGL_DRAW_FRAMEBUFFER, attachment,
details.curType, obj, a.level,
a.numVirtualSamples);
}
else
{
+4
View File
@@ -78,6 +78,10 @@ struct FramebufferAttachmentData
bool layered;
int32_t layer;
int32_t level;
int32_t numVirtualSamples; // number of samples for mobile MSAA framebuffers, where the tiler
// resolves into non-msaa textures
int32_t numViews; // number of views for multiview framebuffers
int32_t startView; // index of the first view for multiview framebuffers
GLResource obj;
};