Merge branch 'dev'

This commit is contained in:
Branimir Karadžić 2015-01-21 20:41:48 -08:00
commit 6fda797b23
5 changed files with 46 additions and 21 deletions

View file

@ -66,6 +66,7 @@ namespace entry
if (_argc > 1)
{
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)

View file

@ -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)

View file

@ -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)
@ -1246,7 +1247,11 @@ 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;
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<<msaa
, m_ovr.isInitialized() ? hmd : ", no-HMD "
, !!(m_resolution.m_flags&BGFX_RESET_MAXANISOTROPY) ? '\xfe' : ' '
);
double elapsedCpuMs = double(elapsed)*toMs;

View file

@ -275,6 +275,7 @@ namespace bgfx
, m_captureSurface(NULL)
, m_captureResolve(NULL)
, m_flags(BGFX_RESET_NONE)
, m_maxAnisotropy(1)
, m_initialized(false)
, m_amd(false)
, m_nvidia(false)
@ -966,11 +967,17 @@ namespace bgfx
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
|| 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.clear();
@ -1249,7 +1256,7 @@ namespace bgfx
DX_CHECK(device->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<<msaa
, !!(m_resolution.m_flags&BGFX_RESET_MAXANISOTROPY) ? '\xfe' : ' '
);
double elapsedCpuMs = double(elapsed)*toMs;

View file

@ -855,6 +855,7 @@ namespace bgfx
, m_capture(NULL)
, m_captureSize(0)
, m_maxAnisotropy(0.0f)
, m_maxAnisotropyDefault(0.0f)
, m_maxMsaa(0)
, m_vao(0)
, m_vaoSupport(false)
@ -1287,7 +1288,7 @@ namespace bgfx
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
@ -1725,7 +1726,11 @@ 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;
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
|| m_resolution.m_height != _resolution.m_height
@ -2464,6 +2469,7 @@ namespace bgfx
void* m_capture;
uint32_t m_captureSize;
float m_maxAnisotropy;
float m_maxAnisotropyDefault;
int32_t m_maxMsaa;
GLuint m_vao;
bool m_vaoSupport;
@ -5060,11 +5066,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<<msaa
, m_ovr.isInitialized() ? hmd : ", no-HMD "
, !!(m_resolution.m_flags&BGFX_RESET_MAXANISOTROPY) ? '\xfe' : ' '
);
double elapsedCpuMs = double(elapsed)*toMs;