diff --git a/examples/common/entry/entry.cpp b/examples/common/entry/entry.cpp index eeab9e10..3b4a4941 100644 --- a/examples/common/entry/entry.cpp +++ b/examples/common/entry/entry.cpp @@ -65,11 +65,12 @@ namespace entry { if (_argc > 1) { - if (setOrToggle(s_reset, "vsync", BGFX_RESET_VSYNC, 1, _argc, _argv) - || setOrToggle(s_reset, "hmd", BGFX_RESET_HMD, 1, _argc, _argv) - || setOrToggle(s_reset, "hmddbg", BGFX_RESET_HMD_DEBUG, 1, _argc, _argv) - || setOrToggle(s_reset, "hmdrecenter", BGFX_RESET_HMD_RECENTER, 1, _argc, _argv) - || setOrToggle(s_reset, "msaa", BGFX_RESET_MSAA_X16, 1, _argc, _argv) ) + if (setOrToggle(s_reset, "vsync", BGFX_RESET_VSYNC, 1, _argc, _argv) + || setOrToggle(s_reset, "maxaniso", BGFX_RESET_MAXANISOTROPY, 1, _argc, _argv) + || setOrToggle(s_reset, "hmd", BGFX_RESET_HMD, 1, _argc, _argv) + || setOrToggle(s_reset, "hmddbg", BGFX_RESET_HMD_DEBUG, 1, _argc, _argv) + || setOrToggle(s_reset, "hmdrecenter", BGFX_RESET_HMD_RECENTER, 1, _argc, _argv) + || setOrToggle(s_reset, "msaa", BGFX_RESET_MSAA_X16, 1, _argc, _argv) ) { return 0; } diff --git a/include/bgfxdefines.h b/include/bgfxdefines.h index 881ee721..e4650b9e 100644 --- a/include/bgfxdefines.h +++ b/include/bgfxdefines.h @@ -296,10 +296,11 @@ #define BGFX_RESET_MSAA_SHIFT 4 #define BGFX_RESET_MSAA_MASK UINT32_C(0x00000070) #define BGFX_RESET_VSYNC UINT32_C(0x00000080) -#define BGFX_RESET_CAPTURE UINT32_C(0x00000100) -#define BGFX_RESET_HMD UINT32_C(0x00000200) -#define BGFX_RESET_HMD_DEBUG UINT32_C(0x00000400) -#define BGFX_RESET_HMD_RECENTER UINT32_C(0x00000800) +#define BGFX_RESET_MAXANISOTROPY UINT32_C(0x00000100) +#define BGFX_RESET_CAPTURE UINT32_C(0x00000200) +#define BGFX_RESET_HMD UINT32_C(0x00000400) +#define BGFX_RESET_HMD_DEBUG UINT32_C(0x00000800) +#define BGFX_RESET_HMD_RECENTER UINT32_C(0x00001000) /// #define BGFX_CAPS_TEXTURE_COMPARE_LEQUAL UINT64_C(0x0000000000000001) diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index 6d4c2920..56ed7399 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -436,6 +436,7 @@ namespace bgfx , m_captureResolve(NULL) , m_wireframe(false) , m_flags(BGFX_RESET_NONE) + , m_maxAnisotropy(1) , m_vsChanges(0) , m_fsChanges(0) , m_rtMsaa(false) @@ -1245,8 +1246,12 @@ namespace bgfx void updateResolution(const Resolution& _resolution) { - bool recenter = !!(_resolution.m_flags & BGFX_RESET_HMD_RECENTER); - uint32_t flags = _resolution.m_flags & ~BGFX_RESET_HMD_RECENTER; + bool recenter = !!(_resolution.m_flags & BGFX_RESET_HMD_RECENTER); + m_maxAnisotropy = !!(_resolution.m_flags & BGFX_RESET_MAXANISOTROPY) + ? D3D11_REQ_MAXANISOTROPY + : 1 + ; + uint32_t flags = _resolution.m_flags & ~(BGFX_RESET_HMD_RECENTER | BGFX_RESET_MAXANISOTROPY); if ( getBufferWidth() != _resolution.m_width || getBufferHeight() != _resolution.m_height @@ -1714,7 +1719,7 @@ namespace bgfx sd.AddressV = s_textureAddress[(_flags&BGFX_TEXTURE_V_MASK)>>BGFX_TEXTURE_V_SHIFT]; sd.AddressW = s_textureAddress[(_flags&BGFX_TEXTURE_W_MASK)>>BGFX_TEXTURE_W_SHIFT]; sd.MipLODBias = 0.0f; - sd.MaxAnisotropy = D3D11_REQ_MAXANISOTROPY; + sd.MaxAnisotropy = m_maxAnisotropy; sd.ComparisonFunc = 0 == cmpFunc ? D3D11_COMPARISON_NEVER : s_cmpFunc[cmpFunc]; sd.BorderColor[0] = 0.0f; sd.BorderColor[1] = 0.0f; @@ -2206,6 +2211,7 @@ namespace bgfx DXGI_SWAP_CHAIN_DESC m_scd; #endif uint32_t m_flags; + uint32_t m_maxAnisotropy; IndexBufferD3D11 m_indexBuffers[BGFX_CONFIG_MAX_INDEX_BUFFERS]; VertexBufferD3D11 m_vertexBuffers[BGFX_CONFIG_MAX_VERTEX_BUFFERS]; @@ -3678,11 +3684,12 @@ namespace bgfx bx::snprintf(hmd, BX_COUNTOF(hmd), ", [%c] HMD ", hmdEnabled ? '\xfe' : ' '); const uint32_t msaa = (m_resolution.m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT; - tvm.printf(10, pos++, 0x8e, " Reset flags: [%c] vsync, [%c] MSAAx%d%s" + tvm.printf(10, pos++, 0x8e, " Reset flags: [%c] vsync, [%c] MSAAx%d%s, [%c] MaxAnisotropy " , !!(m_resolution.m_flags&BGFX_RESET_VSYNC) ? '\xfe' : ' ' , 0 != msaa ? '\xfe' : ' ' , 1<SetSamplerState(_stage, D3DSAMP_MINFILTER, minFilter) ); DX_CHECK(device->SetSamplerState(_stage, D3DSAMP_MAGFILTER, magFilter) ); DX_CHECK(device->SetSamplerState(_stage, D3DSAMP_MIPFILTER, mipFilter) ); - DX_CHECK(device->SetSamplerState(_stage, D3DSAMP_MAXANISOTROPY, m_caps.MaxAnisotropy) ); + DX_CHECK(device->SetSamplerState(_stage, D3DSAMP_MAXANISOTROPY, m_maxAnisotropy) ); } } @@ -1668,6 +1675,7 @@ namespace bgfx D3DDEVTYPE m_deviceType; D3DPRESENT_PARAMETERS m_params; uint32_t m_flags; + uint32_t m_maxAnisotropy; D3DADAPTER_IDENTIFIER9 m_identifier; Resolution m_resolution; @@ -3376,10 +3384,11 @@ namespace bgfx ); const uint32_t msaa = (m_resolution.m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT; - tvm.printf(10, pos++, 0x8e, " Reset flags: [%c] vsync, [%c] MSAAx%d " + tvm.printf(10, pos++, 0x8e, " Reset flags: [%c] vsync, [%c] MSAAx%d, [%c] MaxAnisotropy " , !!(m_resolution.m_flags&BGFX_RESET_VSYNC) ? '\xfe' : ' ' , 0 != msaa ? '\xfe' : ' ' , 1<>BGFX_RESET_MSAA_SHIFT; - tvm.printf(10, pos++, 0x8e, " Reset flags: [%c] vsync, [%c] MSAAx%d%s" + tvm.printf(10, pos++, 0x8e, " Reset flags: [%c] vsync, [%c] MSAAx%d%s, [%c] MaxAnisotropy " , !!(m_resolution.m_flags&BGFX_RESET_VSYNC) ? '\xfe' : ' ' , 0 != msaa ? '\xfe' : ' ' , 1<