@@ -1627,20 +1627,54 @@ void GLReplay::PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_t sl
1627
1627
}
1628
1628
}
1629
1629
1630
- void GLReplay::CopyTex2DMSToArray (GLuint destArray, GLuint srcMS, GLint width, GLint height,
1630
+ void GLReplay::CopyTex2DMSToArray (GLuint & destArray, GLuint srcMS, GLint width, GLint height,
1631
1631
GLint arraySize, GLint samples, GLenum intFormat)
1632
1632
{
1633
1633
WrappedOpenGL &gl = *m_pDriver;
1634
1634
1635
- if (!HasExt[ARB_compute_shader])
1636
- return ;
1635
+ // create temporary texture array, which we'll initialise to be the width/height in same format,
1636
+ // with the same number of array slices as multi samples.
1637
+ gl.glGenTextures (1 , &destArray);
1638
+ gl.glBindTexture (eGL_TEXTURE_2D_ARRAY, destArray);
1639
+
1640
+ bool failed = false ;
1641
+
1642
+ if (!failed && !HasExt[ARB_compute_shader])
1643
+ {
1644
+ RDCWARN (
1645
+ " Can't copy multisampled texture to array for serialisation without ARB_compute_shader." );
1646
+ failed = true ;
1647
+ }
1637
1648
1638
- if (!HasExt[ARB_texture_view])
1649
+ if (!failed && ! HasExt[ARB_texture_view])
1639
1650
{
1640
1651
RDCWARN (" Can't copy multisampled texture to array for serialisation without ARB_texture_view." );
1652
+ failed = true ;
1653
+ }
1654
+
1655
+ if (!failed && !HasExt[ARB_texture_storage])
1656
+ {
1657
+ RDCWARN (
1658
+ " Can't copy multisampled texture to array for serialisation without ARB_texture_view, and "
1659
+ " ARB_texture_view requires ARB_texture_storage." );
1660
+ failed = true ;
1661
+ }
1662
+
1663
+ if (failed)
1664
+ {
1665
+ // create using the non-storage API which is always available, so the texture is at least valid
1666
+ // (but with undefined/empty contents).
1667
+ gl.glTextureImage3DEXT (destArray, eGL_TEXTURE_2D_ARRAY, 0 , intFormat, width, height,
1668
+ arraySize * samples, 0 , GetBaseFormat (intFormat), GetDataType (intFormat),
1669
+ NULL );
1670
+ gl.glTexParameteri (eGL_TEXTURE_2D_ARRAY, eGL_TEXTURE_MAX_LEVEL, 0 );
1641
1671
return ;
1642
1672
}
1643
1673
1674
+ // initialise the texture using texture storage, as required for texture views.
1675
+ gl.glTextureStorage3DEXT (destArray, eGL_TEXTURE_2D_ARRAY, 1 , intFormat, width, height,
1676
+ arraySize * samples);
1677
+
1644
1678
GLRenderState rs (&gl.GetHookset (), NULL , READING);
1645
1679
rs.FetchState (m_pDriver->GetCtx (), m_pDriver);
1646
1680
0 commit comments