Fixing crash on WP8 ARM

The ViewState struct is so big that it blows out the stack on ARM devices. This change promotes it to a member variable.
This commit is contained in:
Mike Popoloski 2015-04-17 22:06:09 -04:00
parent 62c3d18ff8
commit 117571231a
2 changed files with 14 additions and 5 deletions

View file

@ -12,12 +12,19 @@ namespace bgfx
{
struct ViewState
{
ViewState() { }
ViewState(Frame* _render, bool _hmdEnabled)
: m_alphaRef(0.0f)
, m_invViewCached(UINT16_MAX)
, m_invProjCached(UINT16_MAX)
, m_invViewProjCached(UINT16_MAX)
{
reset(_render, _hmdEnabled);
}
void reset(Frame* _render, bool _hmdEnabled)
{
m_alphaRef = 0.0f;
m_invViewCached = UINT16_MAX;
m_invProjCached = UINT16_MAX;
m_invViewProjCached = UINT16_MAX;
m_view[0] = _render->m_view;
m_view[1] = m_viewTmp[1];

View file

@ -2459,6 +2459,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
void* m_uniforms[BGFX_CONFIG_MAX_UNIFORMS];
Matrix4 m_predefinedUniforms[PredefinedUniform::Count];
UniformRegistry m_uniformReg;
ViewState m_viewState;
StateCacheT<ID3D11BlendState> m_blendStateCache;
StateCacheT<ID3D11DepthStencilState> m_depthStencilStateCache;
@ -3305,7 +3306,8 @@ BX_PRAGMA_DIAGNOSTIC_POP();
const bool hmdEnabled = m_ovr.isEnabled() || m_ovr.isDebug();
_render->m_hmdEnabled = hmdEnabled;
ViewState viewState(_render, hmdEnabled);
ViewState& viewState = m_viewState;
viewState.reset(_render, hmdEnabled);
bool wireframe = !!(_render->m_debug&BGFX_DEBUG_WIREFRAME);
bool scissorEnabled = false;