mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 10:35:43 -05:00
Added max anisotropy reset flag.
This commit is contained in:
parent
be8c9576f5
commit
0516b5603b
5 changed files with 46 additions and 21 deletions
|
@ -65,11 +65,12 @@ namespace entry
|
||||||
{
|
{
|
||||||
if (_argc > 1)
|
if (_argc > 1)
|
||||||
{
|
{
|
||||||
if (setOrToggle(s_reset, "vsync", BGFX_RESET_VSYNC, 1, _argc, _argv)
|
if (setOrToggle(s_reset, "vsync", BGFX_RESET_VSYNC, 1, _argc, _argv)
|
||||||
|| setOrToggle(s_reset, "hmd", BGFX_RESET_HMD, 1, _argc, _argv)
|
|| setOrToggle(s_reset, "maxaniso", BGFX_RESET_MAXANISOTROPY, 1, _argc, _argv)
|
||||||
|| setOrToggle(s_reset, "hmddbg", BGFX_RESET_HMD_DEBUG, 1, _argc, _argv)
|
|| setOrToggle(s_reset, "hmd", BGFX_RESET_HMD, 1, _argc, _argv)
|
||||||
|| setOrToggle(s_reset, "hmdrecenter", BGFX_RESET_HMD_RECENTER, 1, _argc, _argv)
|
|| setOrToggle(s_reset, "hmddbg", BGFX_RESET_HMD_DEBUG, 1, _argc, _argv)
|
||||||
|| setOrToggle(s_reset, "msaa", BGFX_RESET_MSAA_X16, 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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -296,10 +296,11 @@
|
||||||
#define BGFX_RESET_MSAA_SHIFT 4
|
#define BGFX_RESET_MSAA_SHIFT 4
|
||||||
#define BGFX_RESET_MSAA_MASK UINT32_C(0x00000070)
|
#define BGFX_RESET_MSAA_MASK UINT32_C(0x00000070)
|
||||||
#define BGFX_RESET_VSYNC UINT32_C(0x00000080)
|
#define BGFX_RESET_VSYNC UINT32_C(0x00000080)
|
||||||
#define BGFX_RESET_CAPTURE UINT32_C(0x00000100)
|
#define BGFX_RESET_MAXANISOTROPY UINT32_C(0x00000100)
|
||||||
#define BGFX_RESET_HMD UINT32_C(0x00000200)
|
#define BGFX_RESET_CAPTURE UINT32_C(0x00000200)
|
||||||
#define BGFX_RESET_HMD_DEBUG UINT32_C(0x00000400)
|
#define BGFX_RESET_HMD UINT32_C(0x00000400)
|
||||||
#define BGFX_RESET_HMD_RECENTER UINT32_C(0x00000800)
|
#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)
|
#define BGFX_CAPS_TEXTURE_COMPARE_LEQUAL UINT64_C(0x0000000000000001)
|
||||||
|
|
|
@ -436,6 +436,7 @@ namespace bgfx
|
||||||
, m_captureResolve(NULL)
|
, m_captureResolve(NULL)
|
||||||
, m_wireframe(false)
|
, m_wireframe(false)
|
||||||
, m_flags(BGFX_RESET_NONE)
|
, m_flags(BGFX_RESET_NONE)
|
||||||
|
, m_maxAnisotropy(1)
|
||||||
, m_vsChanges(0)
|
, m_vsChanges(0)
|
||||||
, m_fsChanges(0)
|
, m_fsChanges(0)
|
||||||
, m_rtMsaa(false)
|
, m_rtMsaa(false)
|
||||||
|
@ -1245,8 +1246,12 @@ namespace bgfx
|
||||||
|
|
||||||
void updateResolution(const Resolution& _resolution)
|
void updateResolution(const Resolution& _resolution)
|
||||||
{
|
{
|
||||||
bool recenter = !!(_resolution.m_flags & BGFX_RESET_HMD_RECENTER);
|
bool recenter = !!(_resolution.m_flags & BGFX_RESET_HMD_RECENTER);
|
||||||
uint32_t flags = _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
|
if ( getBufferWidth() != _resolution.m_width
|
||||||
|| getBufferHeight() != _resolution.m_height
|
|| getBufferHeight() != _resolution.m_height
|
||||||
|
@ -1714,7 +1719,7 @@ namespace bgfx
|
||||||
sd.AddressV = s_textureAddress[(_flags&BGFX_TEXTURE_V_MASK)>>BGFX_TEXTURE_V_SHIFT];
|
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.AddressW = s_textureAddress[(_flags&BGFX_TEXTURE_W_MASK)>>BGFX_TEXTURE_W_SHIFT];
|
||||||
sd.MipLODBias = 0.0f;
|
sd.MipLODBias = 0.0f;
|
||||||
sd.MaxAnisotropy = D3D11_REQ_MAXANISOTROPY;
|
sd.MaxAnisotropy = m_maxAnisotropy;
|
||||||
sd.ComparisonFunc = 0 == cmpFunc ? D3D11_COMPARISON_NEVER : s_cmpFunc[cmpFunc];
|
sd.ComparisonFunc = 0 == cmpFunc ? D3D11_COMPARISON_NEVER : s_cmpFunc[cmpFunc];
|
||||||
sd.BorderColor[0] = 0.0f;
|
sd.BorderColor[0] = 0.0f;
|
||||||
sd.BorderColor[1] = 0.0f;
|
sd.BorderColor[1] = 0.0f;
|
||||||
|
@ -2206,6 +2211,7 @@ namespace bgfx
|
||||||
DXGI_SWAP_CHAIN_DESC m_scd;
|
DXGI_SWAP_CHAIN_DESC m_scd;
|
||||||
#endif
|
#endif
|
||||||
uint32_t m_flags;
|
uint32_t m_flags;
|
||||||
|
uint32_t m_maxAnisotropy;
|
||||||
|
|
||||||
IndexBufferD3D11 m_indexBuffers[BGFX_CONFIG_MAX_INDEX_BUFFERS];
|
IndexBufferD3D11 m_indexBuffers[BGFX_CONFIG_MAX_INDEX_BUFFERS];
|
||||||
VertexBufferD3D11 m_vertexBuffers[BGFX_CONFIG_MAX_VERTEX_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' : ' ');
|
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;
|
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' : ' '
|
, !!(m_resolution.m_flags&BGFX_RESET_VSYNC) ? '\xfe' : ' '
|
||||||
, 0 != msaa ? '\xfe' : ' '
|
, 0 != msaa ? '\xfe' : ' '
|
||||||
, 1<<msaa
|
, 1<<msaa
|
||||||
, m_ovr.isInitialized() ? hmd : ", no-HMD "
|
, m_ovr.isInitialized() ? hmd : ", no-HMD "
|
||||||
|
, !!(m_resolution.m_flags&BGFX_RESET_MAXANISOTROPY) ? '\xfe' : ' '
|
||||||
);
|
);
|
||||||
|
|
||||||
double elapsedCpuMs = double(elapsed)*toMs;
|
double elapsedCpuMs = double(elapsed)*toMs;
|
||||||
|
|
|
@ -275,6 +275,7 @@ namespace bgfx
|
||||||
, m_captureSurface(NULL)
|
, m_captureSurface(NULL)
|
||||||
, m_captureResolve(NULL)
|
, m_captureResolve(NULL)
|
||||||
, m_flags(BGFX_RESET_NONE)
|
, m_flags(BGFX_RESET_NONE)
|
||||||
|
, m_maxAnisotropy(1)
|
||||||
, m_initialized(false)
|
, m_initialized(false)
|
||||||
, m_amd(false)
|
, m_amd(false)
|
||||||
, m_nvidia(false)
|
, m_nvidia(false)
|
||||||
|
@ -966,11 +967,17 @@ namespace bgfx
|
||||||
|
|
||||||
void updateResolution(const Resolution& _resolution)
|
void updateResolution(const Resolution& _resolution)
|
||||||
{
|
{
|
||||||
|
m_maxAnisotropy = !!(_resolution.m_flags & BGFX_RESET_MAXANISOTROPY)
|
||||||
|
? m_caps.MaxAnisotropy
|
||||||
|
: 1
|
||||||
|
;
|
||||||
|
uint32_t flags = _resolution.m_flags & ~(BGFX_RESET_HMD_RECENTER | BGFX_RESET_MAXANISOTROPY);
|
||||||
|
|
||||||
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 != _resolution.m_flags)
|
|| m_flags != flags)
|
||||||
{
|
{
|
||||||
m_flags = _resolution.m_flags;
|
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();
|
||||||
|
@ -1249,7 +1256,7 @@ namespace bgfx
|
||||||
DX_CHECK(device->SetSamplerState(_stage, D3DSAMP_MINFILTER, minFilter) );
|
DX_CHECK(device->SetSamplerState(_stage, D3DSAMP_MINFILTER, minFilter) );
|
||||||
DX_CHECK(device->SetSamplerState(_stage, D3DSAMP_MAGFILTER, magFilter) );
|
DX_CHECK(device->SetSamplerState(_stage, D3DSAMP_MAGFILTER, magFilter) );
|
||||||
DX_CHECK(device->SetSamplerState(_stage, D3DSAMP_MIPFILTER, mipFilter) );
|
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;
|
D3DDEVTYPE m_deviceType;
|
||||||
D3DPRESENT_PARAMETERS m_params;
|
D3DPRESENT_PARAMETERS m_params;
|
||||||
uint32_t m_flags;
|
uint32_t m_flags;
|
||||||
|
uint32_t m_maxAnisotropy;
|
||||||
D3DADAPTER_IDENTIFIER9 m_identifier;
|
D3DADAPTER_IDENTIFIER9 m_identifier;
|
||||||
Resolution m_resolution;
|
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;
|
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' : ' '
|
, !!(m_resolution.m_flags&BGFX_RESET_VSYNC) ? '\xfe' : ' '
|
||||||
, 0 != msaa ? '\xfe' : ' '
|
, 0 != msaa ? '\xfe' : ' '
|
||||||
, 1<<msaa
|
, 1<<msaa
|
||||||
|
, !!(m_resolution.m_flags&BGFX_RESET_MAXANISOTROPY) ? '\xfe' : ' '
|
||||||
);
|
);
|
||||||
|
|
||||||
double elapsedCpuMs = double(elapsed)*toMs;
|
double elapsedCpuMs = double(elapsed)*toMs;
|
||||||
|
|
|
@ -855,6 +855,7 @@ namespace bgfx
|
||||||
, m_capture(NULL)
|
, m_capture(NULL)
|
||||||
, m_captureSize(0)
|
, m_captureSize(0)
|
||||||
, m_maxAnisotropy(0.0f)
|
, m_maxAnisotropy(0.0f)
|
||||||
|
, m_maxAnisotropyDefault(0.0f)
|
||||||
, m_maxMsaa(0)
|
, m_maxMsaa(0)
|
||||||
, m_vao(0)
|
, m_vao(0)
|
||||||
, m_vaoSupport(false)
|
, m_vaoSupport(false)
|
||||||
|
@ -1287,7 +1288,7 @@ namespace bgfx
|
||||||
|
|
||||||
if (s_extension[Extension::EXT_texture_filter_anisotropic].m_supported)
|
if (s_extension[Extension::EXT_texture_filter_anisotropic].m_supported)
|
||||||
{
|
{
|
||||||
GL_CHECK(glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &m_maxAnisotropy) );
|
GL_CHECK(glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &m_maxAnisotropyDefault) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s_extension[Extension::ARB_texture_multisample].m_supported
|
if (s_extension[Extension::ARB_texture_multisample].m_supported
|
||||||
|
@ -1724,8 +1725,12 @@ namespace bgfx
|
||||||
|
|
||||||
void updateResolution(const Resolution& _resolution)
|
void updateResolution(const Resolution& _resolution)
|
||||||
{
|
{
|
||||||
bool recenter = !!(_resolution.m_flags & BGFX_RESET_HMD_RECENTER);
|
bool recenter = !!(_resolution.m_flags & BGFX_RESET_HMD_RECENTER);
|
||||||
uint32_t flags = _resolution.m_flags & ~BGFX_RESET_HMD_RECENTER;
|
m_maxAnisotropy = !!(_resolution.m_flags & BGFX_RESET_MAXANISOTROPY)
|
||||||
|
? m_maxAnisotropyDefault
|
||||||
|
: 0.0f
|
||||||
|
;
|
||||||
|
uint32_t flags = _resolution.m_flags & ~(BGFX_RESET_HMD_RECENTER | BGFX_RESET_MAXANISOTROPY);
|
||||||
|
|
||||||
if (m_resolution.m_width != _resolution.m_width
|
if (m_resolution.m_width != _resolution.m_width
|
||||||
|| m_resolution.m_height != _resolution.m_height
|
|| m_resolution.m_height != _resolution.m_height
|
||||||
|
@ -2464,6 +2469,7 @@ namespace bgfx
|
||||||
void* m_capture;
|
void* m_capture;
|
||||||
uint32_t m_captureSize;
|
uint32_t m_captureSize;
|
||||||
float m_maxAnisotropy;
|
float m_maxAnisotropy;
|
||||||
|
float m_maxAnisotropyDefault;
|
||||||
int32_t m_maxMsaa;
|
int32_t m_maxMsaa;
|
||||||
GLuint m_vao;
|
GLuint m_vao;
|
||||||
bool m_vaoSupport;
|
bool m_vaoSupport;
|
||||||
|
@ -5060,11 +5066,12 @@ namespace bgfx
|
||||||
bx::snprintf(hmd, BX_COUNTOF(hmd), ", [%c] HMD ", hmdEnabled ? '\xfe' : ' ');
|
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;
|
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' : ' '
|
, !!(m_resolution.m_flags&BGFX_RESET_VSYNC) ? '\xfe' : ' '
|
||||||
, 0 != msaa ? '\xfe' : ' '
|
, 0 != msaa ? '\xfe' : ' '
|
||||||
, 1<<msaa
|
, 1<<msaa
|
||||||
, m_ovr.isInitialized() ? hmd : ", no-HMD "
|
, m_ovr.isInitialized() ? hmd : ", no-HMD "
|
||||||
|
, !!(m_resolution.m_flags&BGFX_RESET_MAXANISOTROPY) ? '\xfe' : ' '
|
||||||
);
|
);
|
||||||
|
|
||||||
double elapsedCpuMs = double(elapsed)*toMs;
|
double elapsedCpuMs = double(elapsed)*toMs;
|
||||||
|
|
Loading…
Reference in a new issue