|
|
@@ -1009,10 +1009,18 @@ namespace bgfx { namespace d3d11
|
|
|
bx::memSet(&m_scd, 0, sizeof(m_scd) );
|
|
|
m_scd.width = _init.resolution.width;
|
|
|
m_scd.height = _init.resolution.height;
|
|
|
- m_scd.format = (_init.resolution.reset & BGFX_RESET_SRGB_BACKBUFFER)
|
|
|
- ? s_textureFormat[_init.resolution.format].m_fmtSrgb
|
|
|
- : s_textureFormat[_init.resolution.format].m_fmt
|
|
|
- ;
|
|
|
+
|
|
|
+ /*
|
|
|
+ * According to https://docs.microsoft.com/en-us/windows/win32/direct3ddxgi/converting-data-color-space ,
|
|
|
+ * it is OK to create the backbuffer with m_fmt (a non- _SRGB format), and then create the render target view into it
|
|
|
+ * with m_fmtSrgb (the _SRGB format of same), and it will work identically as if you had created the swapchain with
|
|
|
+ * m_fmtSrgb as the backbuffer format.
|
|
|
+ *
|
|
|
+ * Moreover, it is actually not desirable to create the backbuffer with an _SRGB format, because that
|
|
|
+ * is incompatible with the flip presentation model, which is desirable for various reasons including
|
|
|
+ * player embedding.
|
|
|
+ */
|
|
|
+ m_scd.format = s_textureFormat[_init.resolution.format].m_fmt;
|
|
|
|
|
|
updateMsaa(m_scd.format);
|
|
|
m_scd.sampleDesc = s_msaa[(_init.resolution.reset&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT];
|
|
|
@@ -1025,7 +1033,7 @@ namespace bgfx { namespace d3d11
|
|
|
;
|
|
|
m_scd.swapEffect = m_swapEffect;
|
|
|
m_scd.alphaMode = DXGI_ALPHA_MODE_IGNORE;
|
|
|
- m_scd.flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
|
|
|
+ m_scd.flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
|
|
|
|
|
|
m_scd.maxFrameLatency = bx::min<uint8_t>(_init.resolution.maxFrameLatency, 3);
|
|
|
m_scd.nwh = g_platformData.nwh;
|
|
|
@@ -2192,10 +2200,12 @@ namespace bgfx { namespace d3d11
|
|
|
: D3D11_RTV_DIMENSION_TEXTURE2D
|
|
|
;
|
|
|
desc.Texture2D.MipSlice = 0;
|
|
|
- desc.Format = (m_resolution.reset & BGFX_RESET_SRGB_BACKBUFFER)
|
|
|
- ? m_scd.format == DXGI_FORMAT_R8G8B8A8_UNORM ? DXGI_FORMAT_R8G8B8A8_UNORM_SRGB : m_scd.format
|
|
|
- : m_scd.format
|
|
|
- ;
|
|
|
+
|
|
|
+ /* go find the srgb version of this format to make a render target view
|
|
|
+ * with the srgb version. this is OK because of this:
|
|
|
+ * https://docs.microsoft.com/en-us/windows/win32/direct3ddxgi/converting-data-color-space
|
|
|
+ */
|
|
|
+ desc.Format = (m_resolution.reset & BGFX_RESET_SRGB_BACKBUFFER) ? s_textureFormat[m_resolution.format].m_fmtSrgb : s_textureFormat[m_resolution.format].m_fmt;
|
|
|
|
|
|
DX_CHECK(m_device->CreateRenderTargetView(NULL == m_msaaRt ? backBufferColor : m_msaaRt, &desc, &m_backBufferColor) );
|
|
|
DX_RELEASE(backBufferColor, 0);
|
|
|
@@ -2405,9 +2415,8 @@ namespace bgfx { namespace d3d11
|
|
|
|
|
|
m_scd.width = _resolution.width;
|
|
|
m_scd.height = _resolution.height;
|
|
|
- m_scd.format = (_resolution.reset & BGFX_RESET_SRGB_BACKBUFFER)
|
|
|
- ? s_textureFormat[_resolution.format].m_fmtSrgb
|
|
|
- : s_textureFormat[_resolution.format].m_fmt
|
|
|
+ // see comment in init() about why we don't worry about BGFX_RESET_SRGB_BACKBUFFER here
|
|
|
+ m_scd.format = s_textureFormat[_resolution.format].m_fmt
|
|
|
;
|
|
|
|
|
|
preReset();
|