mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 18:45:54 -05:00
Fixed automatic framebuffer resize.
This commit is contained in:
parent
8f28fdd970
commit
49b4d32f15
8 changed files with 52 additions and 34 deletions
|
@ -363,7 +363,7 @@ class HDR : public entry::AppI
|
||||||
// Set views.
|
// Set views.
|
||||||
for (uint32_t ii = 0; ii < 6; ++ii)
|
for (uint32_t ii = 0; ii < 6; ++ii)
|
||||||
{
|
{
|
||||||
bgfx::setViewRect(ii, 0, 0, m_width, m_height);
|
bgfx::setViewRect(ii, 0, 0, bgfx::BackbufferRatio::Equal);
|
||||||
}
|
}
|
||||||
bgfx::setViewFrameBuffer(0, m_fbh);
|
bgfx::setViewFrameBuffer(0, m_fbh);
|
||||||
bgfx::setViewFrameBuffer(1, m_fbh);
|
bgfx::setViewFrameBuffer(1, m_fbh);
|
||||||
|
@ -384,13 +384,13 @@ class HDR : public entry::AppI
|
||||||
bgfx::setViewRect(6, 0, 0, 1, 1);
|
bgfx::setViewRect(6, 0, 0, 1, 1);
|
||||||
bgfx::setViewFrameBuffer(6, m_lum[4]);
|
bgfx::setViewFrameBuffer(6, m_lum[4]);
|
||||||
|
|
||||||
bgfx::setViewRect(7, 0, 0, m_width/2, m_height/2);
|
bgfx::setViewRect(7, 0, 0, bgfx::BackbufferRatio::Half);
|
||||||
bgfx::setViewFrameBuffer(7, m_bright);
|
bgfx::setViewFrameBuffer(7, m_bright);
|
||||||
|
|
||||||
bgfx::setViewRect(8, 0, 0, m_width/8, m_height/8);
|
bgfx::setViewRect(8, 0, 0, bgfx::BackbufferRatio::Eighth);
|
||||||
bgfx::setViewFrameBuffer(8, m_blur);
|
bgfx::setViewFrameBuffer(8, m_blur);
|
||||||
|
|
||||||
bgfx::setViewRect(9, 0, 0, m_width, m_height);
|
bgfx::setViewRect(9, 0, 0, bgfx::BackbufferRatio::Equal);
|
||||||
|
|
||||||
float view[16];
|
float view[16];
|
||||||
float proj[16];
|
float proj[16];
|
||||||
|
|
|
@ -1569,6 +1569,9 @@ namespace bgfx
|
||||||
///
|
///
|
||||||
void setViewRect(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
|
void setViewRect(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
|
||||||
|
|
||||||
|
///
|
||||||
|
void setViewRect(uint8_t _id, uint16_t _x, uint16_t _y, BackbufferRatio::Enum _ratio);
|
||||||
|
|
||||||
/// Set view scissor. Draw primitive outside view will be clipped. When
|
/// Set view scissor. Draw primitive outside view will be clipped. When
|
||||||
/// _x, _y, _width and _height are set to 0, scissor will be disabled.
|
/// _x, _y, _width and _height are set to 0, scissor will be disabled.
|
||||||
///
|
///
|
||||||
|
|
12
src/bgfx.cpp
12
src/bgfx.cpp
|
@ -1320,6 +1320,7 @@ namespace bgfx
|
||||||
{
|
{
|
||||||
freeDynamicBuffers();
|
freeDynamicBuffers();
|
||||||
m_submit->m_resolution = m_resolution;
|
m_submit->m_resolution = m_resolution;
|
||||||
|
m_resolution.m_flags &= ~BGFX_RESET_FORCE;
|
||||||
m_submit->m_debug = m_debug;
|
m_submit->m_debug = m_debug;
|
||||||
|
|
||||||
memcpy(m_submit->m_viewRemap, m_viewRemap, sizeof(m_viewRemap) );
|
memcpy(m_submit->m_viewRemap, m_viewRemap, sizeof(m_viewRemap) );
|
||||||
|
@ -3034,6 +3035,17 @@ again:
|
||||||
s_ctx->setViewRect(_id, _x, _y, _width, _height);
|
s_ctx->setViewRect(_id, _x, _y, _width, _height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setViewRect(uint8_t _id, uint16_t _x, uint16_t _y, BackbufferRatio::Enum _ratio)
|
||||||
|
{
|
||||||
|
BGFX_CHECK_MAIN_THREAD();
|
||||||
|
BX_CHECK(checkView(_id), "Invalid view id: %d", _id);
|
||||||
|
|
||||||
|
uint16_t width = uint16_t(s_ctx->m_resolution.m_width);
|
||||||
|
uint16_t height = uint16_t(s_ctx->m_resolution.m_height);
|
||||||
|
getTextureSizeFromRatio(_ratio, width, height);
|
||||||
|
setViewRect(_id, _x, _y, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
void setViewScissor(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
|
void setViewScissor(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
|
||||||
{
|
{
|
||||||
BGFX_CHECK_MAIN_THREAD();
|
BGFX_CHECK_MAIN_THREAD();
|
||||||
|
|
|
@ -174,6 +174,7 @@ namespace stl
|
||||||
#define BGFX_MAX_COMPUTE_BINDINGS 8
|
#define BGFX_MAX_COMPUTE_BINDINGS 8
|
||||||
|
|
||||||
#define BGFX_SAMPLER_DEFAULT_FLAGS UINT32_C(0x10000000)
|
#define BGFX_SAMPLER_DEFAULT_FLAGS UINT32_C(0x10000000)
|
||||||
|
#define BGFX_RESET_FORCE UINT32_C(0x80000000)
|
||||||
|
|
||||||
#define BGFX_RENDERER_DIRECT3D9_NAME "Direct3D 9"
|
#define BGFX_RENDERER_DIRECT3D9_NAME "Direct3D 9"
|
||||||
#define BGFX_RENDERER_DIRECT3D11_NAME "Direct3D 11"
|
#define BGFX_RENDERER_DIRECT3D11_NAME "Direct3D 11"
|
||||||
|
@ -2036,6 +2037,7 @@ namespace bgfx
|
||||||
, uint16_t(m_resolution.m_width)
|
, uint16_t(m_resolution.m_width)
|
||||||
, uint16_t(m_resolution.m_height)
|
, uint16_t(m_resolution.m_height)
|
||||||
);
|
);
|
||||||
|
m_resolution.m_flags |= BGFX_RESET_FORCE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,7 @@ namespace bgfx { namespace d3d11
|
||||||
ID3D11UnorderedAccessView* m_uav[D3D11_PS_CS_UAV_REGISTER_COUNT];
|
ID3D11UnorderedAccessView* m_uav[D3D11_PS_CS_UAV_REGISTER_COUNT];
|
||||||
ID3D11ShaderResourceView* m_srv[D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT];
|
ID3D11ShaderResourceView* m_srv[D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT];
|
||||||
ID3D11SamplerState* m_sampler[D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT];
|
ID3D11SamplerState* m_sampler[D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT];
|
||||||
|
ID3D11RenderTargetView* m_rtv[BGFX_CONFIG_MAX_FRAME_BUFFERS];
|
||||||
uint32_t m_zero[D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
|
uint32_t m_zero[D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
|
||||||
float m_zerof[D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
|
float m_zerof[D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
|
||||||
};
|
};
|
||||||
|
@ -569,7 +570,6 @@ namespace bgfx { namespace d3d11
|
||||||
, m_captureTexture(NULL)
|
, m_captureTexture(NULL)
|
||||||
, m_captureResolve(NULL)
|
, m_captureResolve(NULL)
|
||||||
, m_wireframe(false)
|
, m_wireframe(false)
|
||||||
, m_flags(BGFX_RESET_NONE)
|
|
||||||
, m_maxAnisotropy(1)
|
, m_maxAnisotropy(1)
|
||||||
, m_currentProgram(NULL)
|
, m_currentProgram(NULL)
|
||||||
, m_vsChanges(0)
|
, m_vsChanges(0)
|
||||||
|
@ -1967,12 +1967,12 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||||
DX_CHECK(m_swapChain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&color) );
|
DX_CHECK(m_swapChain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&color) );
|
||||||
|
|
||||||
D3D11_RENDER_TARGET_VIEW_DESC desc;
|
D3D11_RENDER_TARGET_VIEW_DESC desc;
|
||||||
desc.ViewDimension = (m_flags & BGFX_RESET_MSAA_MASK)
|
desc.ViewDimension = (m_resolution.m_flags & BGFX_RESET_MSAA_MASK)
|
||||||
? D3D11_RTV_DIMENSION_TEXTURE2DMS
|
? D3D11_RTV_DIMENSION_TEXTURE2DMS
|
||||||
: D3D11_RTV_DIMENSION_TEXTURE2D
|
: D3D11_RTV_DIMENSION_TEXTURE2D
|
||||||
;
|
;
|
||||||
desc.Texture2D.MipSlice = 0;
|
desc.Texture2D.MipSlice = 0;
|
||||||
desc.Format = (m_flags & BGFX_RESET_SRGB_BACKBUFFER)
|
desc.Format = (m_resolution.m_flags & BGFX_RESET_SRGB_BACKBUFFER)
|
||||||
? DXGI_FORMAT_R8G8B8A8_UNORM_SRGB
|
? DXGI_FORMAT_R8G8B8A8_UNORM_SRGB
|
||||||
: DXGI_FORMAT_R8G8B8A8_UNORM
|
: DXGI_FORMAT_R8G8B8A8_UNORM
|
||||||
;
|
;
|
||||||
|
@ -2036,7 +2036,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
uint32_t syncInterval = BX_ENABLED(BX_PLATFORM_WINRT)
|
uint32_t syncInterval = BX_ENABLED(BX_PLATFORM_WINRT)
|
||||||
? 1 // sync interval of 0 is not supported on WinRT
|
? 1 // sync interval of 0 is not supported on WinRT
|
||||||
: !!(m_flags & BGFX_RESET_VSYNC)
|
: !!(m_resolution.m_flags & BGFX_RESET_VSYNC)
|
||||||
;
|
;
|
||||||
|
|
||||||
for (uint32_t ii = 1, num = m_numWindows; ii < num && SUCCEEDED(hr); ++ii)
|
for (uint32_t ii = 1, num = m_numWindows; ii < num && SUCCEEDED(hr); ++ii)
|
||||||
|
@ -2129,15 +2129,16 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||||
|
|
||||||
uint32_t flags = _resolution.m_flags & ~(BGFX_RESET_HMD_RECENTER | BGFX_RESET_MAXANISOTROPY);
|
uint32_t flags = _resolution.m_flags & ~(BGFX_RESET_HMD_RECENTER | BGFX_RESET_MAXANISOTROPY);
|
||||||
|
|
||||||
if ( getBufferWidth() != _resolution.m_width
|
if ( getBufferWidth() != _resolution.m_width
|
||||||
|| getBufferHeight() != _resolution.m_height
|
|| getBufferHeight() != _resolution.m_height
|
||||||
|| m_flags != flags)
|
|| m_resolution.m_flags != flags)
|
||||||
{
|
{
|
||||||
|
flags &= ~BGFX_RESET_FORCE;
|
||||||
|
|
||||||
bool resize = true
|
bool resize = true
|
||||||
&& !BX_ENABLED(BX_PLATFORM_WINRT) // can't use ResizeBuffers on Windows Phone
|
&& !BX_ENABLED(BX_PLATFORM_WINRT) // can't use ResizeBuffers on Windows Phone
|
||||||
&& (m_flags&BGFX_RESET_MSAA_MASK) == (flags&BGFX_RESET_MSAA_MASK)
|
&& (m_resolution.m_flags&BGFX_RESET_MSAA_MASK) == (flags&BGFX_RESET_MSAA_MASK)
|
||||||
;
|
;
|
||||||
m_flags = flags;
|
|
||||||
|
|
||||||
m_textVideoMem.resize(false, _resolution.m_width, _resolution.m_height);
|
m_textVideoMem.resize(false, _resolution.m_width, _resolution.m_height);
|
||||||
m_textVideoMem.clear();
|
m_textVideoMem.clear();
|
||||||
|
@ -2159,6 +2160,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||||
{
|
{
|
||||||
if (resize)
|
if (resize)
|
||||||
{
|
{
|
||||||
|
m_deviceCtx->OMSetRenderTargets(1, s_zero.m_rtv, NULL);
|
||||||
DX_CHECK(m_swapChain->ResizeBuffers(2
|
DX_CHECK(m_swapChain->ResizeBuffers(2
|
||||||
, getBufferWidth()
|
, getBufferWidth()
|
||||||
, getBufferHeight()
|
, getBufferHeight()
|
||||||
|
@ -2169,13 +2171,13 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
updateMsaa();
|
updateMsaa();
|
||||||
m_scd.SampleDesc = s_msaa[(m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT];
|
m_scd.SampleDesc = s_msaa[(m_resolution.m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT];
|
||||||
|
|
||||||
DX_RELEASE(m_swapChain, 0);
|
DX_RELEASE(m_swapChain, 0);
|
||||||
|
|
||||||
SwapChainDesc* scd = &m_scd;
|
SwapChainDesc* scd = &m_scd;
|
||||||
SwapChainDesc swapChainScd;
|
SwapChainDesc swapChainScd;
|
||||||
if (0 != (m_flags & BGFX_RESET_HMD)
|
if (0 != (m_resolution.m_flags & BGFX_RESET_HMD)
|
||||||
&& m_ovr.isInitialized() )
|
&& m_ovr.isInitialized() )
|
||||||
{
|
{
|
||||||
swapChainScd = m_scd;
|
swapChainScd = m_scd;
|
||||||
|
@ -2948,7 +2950,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||||
|
|
||||||
void capturePostReset()
|
void capturePostReset()
|
||||||
{
|
{
|
||||||
if (m_flags&BGFX_RESET_CAPTURE)
|
if (m_resolution.m_flags&BGFX_RESET_CAPTURE)
|
||||||
{
|
{
|
||||||
ID3D11Texture2D* backBuffer;
|
ID3D11Texture2D* backBuffer;
|
||||||
DX_CHECK(m_swapChain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&backBuffer) );
|
DX_CHECK(m_swapChain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&backBuffer) );
|
||||||
|
@ -3287,7 +3289,6 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||||
#endif // BX_PLATFORM_WINRT
|
#endif // BX_PLATFORM_WINRT
|
||||||
|
|
||||||
SwapChainDesc m_scd;
|
SwapChainDesc m_scd;
|
||||||
uint32_t m_flags;
|
|
||||||
uint32_t m_maxAnisotropy;
|
uint32_t m_maxAnisotropy;
|
||||||
|
|
||||||
IndexBufferD3D11 m_indexBuffers[BGFX_CONFIG_MAX_INDEX_BUFFERS];
|
IndexBufferD3D11 m_indexBuffers[BGFX_CONFIG_MAX_INDEX_BUFFERS];
|
||||||
|
|
|
@ -457,7 +457,6 @@ namespace bgfx { namespace d3d12
|
||||||
{
|
{
|
||||||
RendererContextD3D12()
|
RendererContextD3D12()
|
||||||
: m_wireframe(false)
|
: m_wireframe(false)
|
||||||
, m_flags(BGFX_RESET_NONE)
|
|
||||||
, m_maxAnisotropy(1)
|
, m_maxAnisotropy(1)
|
||||||
, m_fsChanges(0)
|
, m_fsChanges(0)
|
||||||
, m_vsChanges(0)
|
, m_vsChanges(0)
|
||||||
|
@ -1121,7 +1120,7 @@ namespace bgfx { namespace d3d12
|
||||||
int64_t start = bx::getHPCounter();
|
int64_t start = bx::getHPCounter();
|
||||||
|
|
||||||
HRESULT hr = 0;
|
HRESULT hr = 0;
|
||||||
uint32_t syncInterval = !!(m_flags & BGFX_RESET_VSYNC);
|
uint32_t syncInterval = !!(m_resolution.m_flags & BGFX_RESET_VSYNC);
|
||||||
uint32_t flags = 0 == syncInterval ? DXGI_PRESENT_RESTART : 0;
|
uint32_t flags = 0 == syncInterval ? DXGI_PRESENT_RESTART : 0;
|
||||||
for (uint32_t ii = 1, num = m_numWindows; ii < num && SUCCEEDED(hr); ++ii)
|
for (uint32_t ii = 1, num = m_numWindows; ii < num && SUCCEEDED(hr); ++ii)
|
||||||
{
|
{
|
||||||
|
@ -1643,17 +1642,17 @@ data.NumQualityLevels = 0;
|
||||||
m_maxAnisotropy = 1;
|
m_maxAnisotropy = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (uint32_t)m_scd.BufferDesc.Width != _resolution.m_width
|
if ( (uint32_t)m_scd.BufferDesc.Width != _resolution.m_width
|
||||||
|| (uint32_t)m_scd.BufferDesc.Height != _resolution.m_height
|
|| (uint32_t)m_scd.BufferDesc.Height != _resolution.m_height
|
||||||
|| m_flags != _resolution.m_flags)
|
|| m_resolution.m_flags != _resolution.m_flags)
|
||||||
{
|
{
|
||||||
bool resize = (m_flags&BGFX_RESET_MSAA_MASK) == (_resolution.m_flags&BGFX_RESET_MSAA_MASK);
|
bool resize = (m_resolution.m_flags&BGFX_RESET_MSAA_MASK) == (_resolution.m_flags&BGFX_RESET_MSAA_MASK);
|
||||||
m_flags = _resolution.m_flags;
|
|
||||||
|
|
||||||
m_textVideoMem.resize(false, _resolution.m_width, _resolution.m_height);
|
m_textVideoMem.resize(false, _resolution.m_width, _resolution.m_height);
|
||||||
m_textVideoMem.clear();
|
m_textVideoMem.clear();
|
||||||
|
|
||||||
m_resolution = _resolution;
|
m_resolution = _resolution;
|
||||||
|
m_resolution.m_flags &= ~BGFX_RESET_FORCE;
|
||||||
m_scd.BufferDesc.Width = _resolution.m_width;
|
m_scd.BufferDesc.Width = _resolution.m_width;
|
||||||
m_scd.BufferDesc.Height = _resolution.m_height;
|
m_scd.BufferDesc.Height = _resolution.m_height;
|
||||||
|
|
||||||
|
@ -1678,7 +1677,7 @@ data.NumQualityLevels = 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
updateMsaa();
|
updateMsaa();
|
||||||
m_scd.SampleDesc = s_msaa[(m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT];
|
m_scd.SampleDesc = s_msaa[(m_resolution.m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT];
|
||||||
|
|
||||||
DX_RELEASE(m_swapChain, 0);
|
DX_RELEASE(m_swapChain, 0);
|
||||||
|
|
||||||
|
@ -2537,7 +2536,6 @@ data.NumQualityLevels = 0;
|
||||||
bool m_wireframe;
|
bool m_wireframe;
|
||||||
|
|
||||||
DXGI_SWAP_CHAIN_DESC m_scd;
|
DXGI_SWAP_CHAIN_DESC m_scd;
|
||||||
uint32_t m_flags;
|
|
||||||
uint32_t m_maxAnisotropy;
|
uint32_t m_maxAnisotropy;
|
||||||
|
|
||||||
BufferD3D12 m_indexBuffers[BGFX_CONFIG_MAX_INDEX_BUFFERS];
|
BufferD3D12 m_indexBuffers[BGFX_CONFIG_MAX_INDEX_BUFFERS];
|
||||||
|
|
|
@ -281,7 +281,6 @@ namespace bgfx { namespace d3d9
|
||||||
, m_captureTexture(NULL)
|
, m_captureTexture(NULL)
|
||||||
, m_captureSurface(NULL)
|
, m_captureSurface(NULL)
|
||||||
, m_captureResolve(NULL)
|
, m_captureResolve(NULL)
|
||||||
, m_flags(BGFX_RESET_NONE)
|
|
||||||
, m_maxAnisotropy(1)
|
, m_maxAnisotropy(1)
|
||||||
, m_initialized(false)
|
, m_initialized(false)
|
||||||
, m_amd(false)
|
, m_amd(false)
|
||||||
|
@ -1176,9 +1175,11 @@ namespace bgfx { namespace d3d9
|
||||||
|
|
||||||
if (m_params.BackBufferWidth != _resolution.m_width
|
if (m_params.BackBufferWidth != _resolution.m_width
|
||||||
|| m_params.BackBufferHeight != _resolution.m_height
|
|| m_params.BackBufferHeight != _resolution.m_height
|
||||||
|| m_flags != flags)
|
|| m_resolution.m_flags != flags)
|
||||||
{
|
{
|
||||||
m_flags = flags;
|
flags &= ~BGFX_RESET_FORCE;
|
||||||
|
|
||||||
|
m_resolution.m_flags = flags;
|
||||||
|
|
||||||
m_textVideoMem.resize(false, _resolution.m_width, _resolution.m_height);
|
m_textVideoMem.resize(false, _resolution.m_width, _resolution.m_height);
|
||||||
m_textVideoMem.clear();
|
m_textVideoMem.clear();
|
||||||
|
@ -1195,12 +1196,12 @@ namespace bgfx { namespace d3d9
|
||||||
|
|
||||||
m_params.BackBufferWidth = _resolution.m_width;
|
m_params.BackBufferWidth = _resolution.m_width;
|
||||||
m_params.BackBufferHeight = _resolution.m_height;
|
m_params.BackBufferHeight = _resolution.m_height;
|
||||||
m_params.FullScreen_RefreshRateInHz = BGFX_RESET_FULLSCREEN == (m_flags&BGFX_RESET_FULLSCREEN_MASK) ? 60 : 0;
|
m_params.FullScreen_RefreshRateInHz = BGFX_RESET_FULLSCREEN == (m_resolution.m_flags&BGFX_RESET_FULLSCREEN_MASK) ? 60 : 0;
|
||||||
m_params.PresentationInterval = !!(m_flags&BGFX_RESET_VSYNC) ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
|
m_params.PresentationInterval = !!(m_resolution.m_flags&BGFX_RESET_VSYNC) ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
|
||||||
|
|
||||||
updateMsaa();
|
updateMsaa();
|
||||||
|
|
||||||
Msaa& msaa = s_msaa[(m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT];
|
Msaa& msaa = s_msaa[(m_resolution.m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT];
|
||||||
m_params.MultiSampleType = msaa.m_type;
|
m_params.MultiSampleType = msaa.m_type;
|
||||||
m_params.MultiSampleQuality = msaa.m_quality;
|
m_params.MultiSampleQuality = msaa.m_quality;
|
||||||
|
|
||||||
|
@ -1231,7 +1232,7 @@ namespace bgfx { namespace d3d9
|
||||||
}
|
}
|
||||||
DX_CHECK(m_device->SetDepthStencilSurface(m_backBufferDepthStencil) );
|
DX_CHECK(m_device->SetDepthStencilSurface(m_backBufferDepthStencil) );
|
||||||
|
|
||||||
DX_CHECK(m_device->SetRenderState(D3DRS_SRGBWRITEENABLE, 0 != (m_flags & BGFX_RESET_SRGB_BACKBUFFER) ) );
|
DX_CHECK(m_device->SetRenderState(D3DRS_SRGBWRITEENABLE, 0 != (m_resolution.m_flags & BGFX_RESET_SRGB_BACKBUFFER) ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1514,7 +1515,7 @@ namespace bgfx { namespace d3d9
|
||||||
|
|
||||||
void capturePostReset()
|
void capturePostReset()
|
||||||
{
|
{
|
||||||
if (m_flags&BGFX_RESET_CAPTURE)
|
if (m_resolution.m_flags&BGFX_RESET_CAPTURE)
|
||||||
{
|
{
|
||||||
uint32_t width = m_params.BackBufferWidth;
|
uint32_t width = m_params.BackBufferWidth;
|
||||||
uint32_t height = m_params.BackBufferHeight;
|
uint32_t height = m_params.BackBufferHeight;
|
||||||
|
@ -1918,7 +1919,6 @@ namespace bgfx { namespace d3d9
|
||||||
uint32_t m_adapter;
|
uint32_t m_adapter;
|
||||||
D3DDEVTYPE m_deviceType;
|
D3DDEVTYPE m_deviceType;
|
||||||
D3DPRESENT_PARAMETERS m_params;
|
D3DPRESENT_PARAMETERS m_params;
|
||||||
uint32_t m_flags;
|
|
||||||
uint32_t m_maxAnisotropy;
|
uint32_t m_maxAnisotropy;
|
||||||
D3DADAPTER_IDENTIFIER9 m_identifier;
|
D3DADAPTER_IDENTIFIER9 m_identifier;
|
||||||
Resolution m_resolution;
|
Resolution m_resolution;
|
||||||
|
|
|
@ -2346,6 +2346,8 @@ namespace bgfx { namespace gl
|
||||||
|| m_resolution.m_height != _resolution.m_height
|
|| m_resolution.m_height != _resolution.m_height
|
||||||
|| m_resolution.m_flags != flags)
|
|| m_resolution.m_flags != flags)
|
||||||
{
|
{
|
||||||
|
flags &= ~BGFX_RESET_FORCE;
|
||||||
|
|
||||||
m_textVideoMem.resize(false, _resolution.m_width, _resolution.m_height);
|
m_textVideoMem.resize(false, _resolution.m_width, _resolution.m_height);
|
||||||
m_textVideoMem.clear();
|
m_textVideoMem.clear();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue