Moved internal view state into single struct.

This commit is contained in:
Branimir Karadžić 2017-10-30 08:39:25 -07:00
parent 8eced7c113
commit 85322904a9
8 changed files with 182 additions and 131 deletions

View File

@ -900,7 +900,7 @@ namespace bgfx
m_key.m_view = _id;
SortKey::Enum type = SortKey::SortProgram;
switch (s_ctx->m_viewMode[_id])
switch (s_ctx->m_view[_id].m_mode)
{
case ViewMode::Sequential: m_key.m_seq = s_ctx->getSeqIncr(_id); type = SortKey::SortSequence; break;
case ViewMode::DepthAscending: m_key.m_depth = (uint32_t)_depth; type = SortKey::SortDepth; break;
@ -1698,13 +1698,8 @@ namespace bgfx
m_submit->m_perfStats.numViews = 0;
bx::memCopy(m_submit->m_viewRemap, m_viewRemap, sizeof(m_viewRemap) );
bx::memCopy(m_submit->m_fb, m_fb, sizeof(m_fb) );
bx::memCopy(m_submit->m_clear, m_clear, sizeof(m_clear) );
bx::memCopy(m_submit->m_rect, m_rect, sizeof(m_rect) );
bx::memCopy(m_submit->m_scissor, m_scissor, sizeof(m_scissor) );
bx::memCopy(m_submit->m_view, m_view, sizeof(m_view) );
bx::memCopy(m_submit->m_proj, m_proj, sizeof(m_proj) );
bx::memCopy(m_submit->m_viewFlags, m_viewFlags, sizeof(m_viewFlags) );
if (m_colorPaletteDirty > 0)
{
--m_colorPaletteDirty;

View File

@ -275,6 +275,34 @@ namespace bgfx
struct Clear
{
void set(uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil)
{
m_flags = _flags;
m_index[0] = uint8_t(_rgba>>24);
m_index[1] = uint8_t(_rgba>>16);
m_index[2] = uint8_t(_rgba>> 8);
m_index[3] = uint8_t(_rgba>> 0);
m_depth = _depth;
m_stencil = _stencil;
}
void set(uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7)
{
m_flags = (_flags & ~BGFX_CLEAR_COLOR)
| (0xff != (_0&_1&_2&_3&_4&_5&_6&_7) ? BGFX_CLEAR_COLOR|BGFX_CLEAR_COLOR_USE_PALETTE : 0)
;
m_index[0] = _0;
m_index[1] = _1;
m_index[2] = _2;
m_index[3] = _3;
m_index[4] = _4;
m_index[5] = _5;
m_index[6] = _6;
m_index[7] = _7;
m_depth = _depth;
m_stencil = _stencil;
}
uint8_t m_index[8];
float m_depth;
uint8_t m_stencil;
@ -1557,6 +1585,96 @@ namespace bgfx
uint16_t m_flags;
};
BX_ALIGN_DECL_CACHE_LINE(struct) View
{
void reset()
{
setRect(0, 0, 1, 1);
setScissor(0, 0, 0, 0);
setClear(BGFX_CLEAR_NONE, 0, 0.0f, 0);
setMode(ViewMode::Default);
setFrameBuffer(BGFX_INVALID_HANDLE);
setTransform(NULL, NULL, BGFX_VIEW_NONE, NULL);
}
void setRect(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
{
m_rect.m_x = (uint16_t)bx::uint32_imax(int16_t(_x), 0);
m_rect.m_y = (uint16_t)bx::uint32_imax(int16_t(_y), 0);
m_rect.m_width = bx::uint16_max(_width, 1);
m_rect.m_height = bx::uint16_max(_height, 1);
}
void setScissor(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
{
m_scissor.m_x = _x;
m_scissor.m_y = _y;
m_scissor.m_width = _width;
m_scissor.m_height = _height;
}
void setClear(uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil)
{
m_clear.set(_flags, _rgba, _depth, _stencil);
}
void setClear(uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7)
{
m_clear.set(_flags, _depth, _stencil, _0, _1, _2, _3, _4, _5, _6, _7);
}
void setMode(ViewMode::Enum _mode)
{
m_mode = uint8_t(_mode);
}
void setFrameBuffer(FrameBufferHandle _handle)
{
m_fbh = _handle;
}
void setTransform(const void* _view, const void* _proj, uint8_t _flags, const void* _proj1)
{
m_flags = _flags;
if (NULL != _view)
{
bx::memCopy(m_view.un.val, _view, sizeof(Matrix4) );
}
else
{
m_view.setIdentity();
}
if (NULL != _proj)
{
bx::memCopy(m_proj[0].un.val, _proj, sizeof(Matrix4) );
}
else
{
m_proj[0].setIdentity();
}
if (NULL != _proj1)
{
bx::memCopy(m_proj[1].un.val, _proj1, sizeof(Matrix4) );
}
else
{
bx::memCopy(m_proj[1].un.val, m_proj[0].un.val, sizeof(Matrix4) );
}
}
Clear m_clear;
Rect m_rect;
Rect m_scissor;
Matrix4 m_view;
Matrix4 m_proj[2];
FrameBufferHandle m_fbh;
uint8_t m_mode;
uint8_t m_flags;
};
struct FrameCache
{
void reset()
@ -1738,14 +1856,10 @@ namespace bgfx
}
uint8_t m_viewRemap[BGFX_CONFIG_MAX_VIEWS];
FrameBufferHandle m_fb[BGFX_CONFIG_MAX_VIEWS];
Clear m_clear[BGFX_CONFIG_MAX_VIEWS];
float m_colorPalette[BGFX_CONFIG_MAX_COLOR_PALETTE][4];
Rect m_rect[BGFX_CONFIG_MAX_VIEWS];
Rect m_scissor[BGFX_CONFIG_MAX_VIEWS];
Matrix4 m_view[BGFX_CONFIG_MAX_VIEWS];
Matrix4 m_proj[2][BGFX_CONFIG_MAX_VIEWS];
uint8_t m_viewFlags[BGFX_CONFIG_MAX_VIEWS];
View m_view[BGFX_CONFIG_MAX_VIEWS];
int32_t m_occlusion[BGFX_CONFIG_MAX_OCCLUSION_QUERIES];
uint64_t m_sortKeys[BGFX_CONFIG_MAX_DRAW_CALLS+1];
@ -2488,7 +2602,10 @@ namespace bgfx
m_flipAfterRender = !!(_flags & BGFX_RESET_FLIP_AFTER_RENDER);
bx::memSet(m_fb, 0xff, sizeof(m_fb) );
for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii)
{
m_view[ii].setFrameBuffer(BGFX_INVALID_HANDLE);
}
for (uint16_t ii = 0, num = m_textureHandle.getNumHandles(); ii < num; ++ii)
{
@ -3982,20 +4099,12 @@ namespace bgfx
BGFX_API_FUNC(void setViewRect(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) )
{
Rect& rect = m_rect[_id];
rect.m_x = (uint16_t)bx::uint32_imax(int16_t(_x), 0);
rect.m_y = (uint16_t)bx::uint32_imax(int16_t(_y), 0);
rect.m_width = bx::uint16_max(_width, 1);
rect.m_height = bx::uint16_max(_height, 1);
m_view[_id].setRect(_x, _y, _width, _height);
}
BGFX_API_FUNC(void setViewScissor(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) )
{
Rect& scissor = m_scissor[_id];
scissor.m_x = _x;
scissor.m_y = _y;
scissor.m_width = _width;
scissor.m_height = _height;
m_view[_id].setScissor(_x, _y, _width, _height);
}
BGFX_API_FUNC(void setViewClear(uint8_t _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil) )
@ -4005,14 +4114,7 @@ namespace bgfx
, _depth
);
Clear& clear = m_clear[_id];
clear.m_flags = _flags;
clear.m_index[0] = uint8_t(_rgba>>24);
clear.m_index[1] = uint8_t(_rgba>>16);
clear.m_index[2] = uint8_t(_rgba>> 8);
clear.m_index[3] = uint8_t(_rgba>> 0);
clear.m_depth = _depth;
clear.m_stencil = _stencil;
m_view[_id].setClear(_flags, _rgba, _depth, _stencil);
}
BGFX_API_FUNC(void setViewClear(uint8_t _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7) )
@ -4022,74 +4124,28 @@ namespace bgfx
, _depth
);
Clear& clear = m_clear[_id];
clear.m_flags = (_flags & ~BGFX_CLEAR_COLOR)
| (0xff != (_0&_1&_2&_3&_4&_5&_6&_7) ? BGFX_CLEAR_COLOR|BGFX_CLEAR_COLOR_USE_PALETTE : 0)
;
clear.m_index[0] = _0;
clear.m_index[1] = _1;
clear.m_index[2] = _2;
clear.m_index[3] = _3;
clear.m_index[4] = _4;
clear.m_index[5] = _5;
clear.m_index[6] = _6;
clear.m_index[7] = _7;
clear.m_depth = _depth;
clear.m_stencil = _stencil;
m_view[_id].setClear(_flags, _depth, _stencil, _0, _1, _2, _3, _4, _5, _6, _7);
}
BGFX_API_FUNC(void setViewMode(uint8_t _id, ViewMode::Enum _mode) )
{
m_viewMode[_id] = uint8_t(_mode);
m_view[_id].setMode(_mode);
}
BGFX_API_FUNC(void setViewFrameBuffer(uint8_t _id, FrameBufferHandle _handle) )
{
BGFX_CHECK_HANDLE_INVALID_OK("setViewFrameBuffer", m_frameBufferHandle, _handle);
m_fb[_id] = _handle;
m_view[_id].setFrameBuffer(_handle);
}
BGFX_API_FUNC(void setViewTransform(uint8_t _id, const void* _view, const void* _proj, uint8_t _flags, const void* _proj1) )
{
m_viewFlags[_id] = _flags;
if (NULL != _view)
{
bx::memCopy(m_view[_id].un.val, _view, sizeof(Matrix4) );
}
else
{
m_view[_id].setIdentity();
}
if (NULL != _proj)
{
bx::memCopy(m_proj[0][_id].un.val, _proj, sizeof(Matrix4) );
}
else
{
m_proj[0][_id].setIdentity();
}
if (NULL != _proj1)
{
bx::memCopy(m_proj[1][_id].un.val, _proj1, sizeof(Matrix4) );
}
else
{
bx::memCopy(m_proj[1][_id].un.val, m_proj[0][_id].un.val, sizeof(Matrix4) );
}
m_view[_id].setTransform(_view, _proj, _flags, _proj1);
}
BGFX_API_FUNC(void resetView(uint8_t _id) )
{
setViewRect(_id, 0, 0, 1, 1);
setViewScissor(_id, 0, 0, 0, 0);
setViewClear(_id, BGFX_CLEAR_NONE, 0, 0.0f, 0);
setViewMode(_id, ViewMode::Default);
FrameBufferHandle invalid = BGFX_INVALID_HANDLE;
setViewFrameBuffer(_id, invalid);
setViewTransform(_id, NULL, NULL, BGFX_VIEW_NONE, NULL);
m_view[_id].reset();
}
BGFX_API_FUNC(void setViewOrder(uint8_t _id, uint8_t _num, const uint8_t* _order) )
@ -4510,17 +4566,10 @@ namespace bgfx
VertexDeclRef m_declRef;
uint8_t m_viewRemap[BGFX_CONFIG_MAX_VIEWS];
FrameBufferHandle m_fb[BGFX_CONFIG_MAX_VIEWS];
Clear m_clear[BGFX_CONFIG_MAX_VIEWS];
uint16_t m_seq[BGFX_CONFIG_MAX_VIEWS];
View m_view[BGFX_CONFIG_MAX_VIEWS];
float m_clearColor[BGFX_CONFIG_MAX_COLOR_PALETTE][4];
Rect m_rect[BGFX_CONFIG_MAX_VIEWS];
Rect m_scissor[BGFX_CONFIG_MAX_VIEWS];
Matrix4 m_view[BGFX_CONFIG_MAX_VIEWS];
Matrix4 m_proj[2][BGFX_CONFIG_MAX_VIEWS];
uint8_t m_viewFlags[BGFX_CONFIG_MAX_VIEWS];
uint16_t m_seq[BGFX_CONFIG_MAX_VIEWS];
uint8_t m_viewMode[BGFX_CONFIG_MAX_VIEWS];
uint8_t m_colorPaletteDirty;

View File

@ -59,7 +59,7 @@ namespace bgfx
m_invProjCached = UINT16_MAX;
m_invViewProjCached = UINT16_MAX;
m_view[0] = _frame->m_view;
m_view[0] = m_viewTmp[0];
m_view[1] = m_viewTmp[1];
if (_hmdEnabled)
@ -79,20 +79,27 @@ namespace bgfx
for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii)
{
if (BGFX_VIEW_STEREO == (_frame->m_viewFlags[ii] & BGFX_VIEW_STEREO) )
if (BGFX_VIEW_STEREO == (_frame->m_view[ii].m_flags & BGFX_VIEW_STEREO) )
{
bx::float4x4_mul(&m_view[eye][ii].un.f4x4
, &_frame->m_view[ii].un.f4x4
, &_frame->m_view[ii].m_view.un.f4x4
, &viewAdjust.un.f4x4
);
}
else
{
bx::memCopy(&m_view[0][ii].un.f4x4, &_frame->m_view[ii].un.f4x4, sizeof(Matrix4) );
bx::memCopy(&m_view[0][ii].un.f4x4, &_frame->m_view[ii].m_view.un.f4x4, sizeof(Matrix4) );
}
}
}
}
else
{
for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii)
{
bx::memCopy(&m_view[0][ii].un.f4x4, &_frame->m_view[ii].m_view.un.f4x4, sizeof(Matrix4) );
}
}
for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii)
{
@ -100,7 +107,7 @@ namespace bgfx
{
bx::float4x4_mul(&m_viewProj[eye][ii].un.f4x4
, &m_view[eye][ii].un.f4x4
, &_frame->m_proj[eye][ii].un.f4x4
, &_frame->m_view[ii].m_proj[eye].un.f4x4
);
}
}
@ -180,7 +187,7 @@ namespace bgfx
{
_renderer->setShaderUniform4x4f(flags
, predefined.m_loc
, _frame->m_proj[_eye][_view].un.val
, _frame->m_view[_view].m_proj[_eye].un.val
, bx::uint32_min(mtxRegs, predefined.m_count)
);
}
@ -193,7 +200,7 @@ namespace bgfx
{
m_invProjCached = viewEye;
bx::float4x4_inverse(&m_invProj.un.f4x4
, &_frame->m_proj[_eye][_view].un.f4x4
, &_frame->m_view[_view].m_proj[_eye].un.f4x4
);
}

View File

@ -5652,7 +5652,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
bool viewRestart = false;
uint8_t eye = 0;
uint8_t restartState = 0;
viewState.m_rect = _render->m_rect[0];
viewState.m_rect = _render->m_view[0].m_rect;
int32_t numItems = _render->m_numRenderItems;
for (int32_t item = 0, restartItem = numItems; item < numItems || restartItem < numItems;)
@ -5685,13 +5685,13 @@ BX_PRAGMA_DIAGNOSTIC_POP();
view = key.m_view;
programIdx = kInvalidHandle;
if (_render->m_fb[view].idx != fbh.idx)
if (_render->m_view[view].m_fbh.idx != fbh.idx)
{
fbh = _render->m_fb[view];
fbh = _render->m_view[view].m_fbh;
setFrameBuffer(fbh);
}
viewRestart = ( (BGFX_VIEW_STEREO == (_render->m_viewFlags[view] & BGFX_VIEW_STEREO) ) );
viewRestart = ( (BGFX_VIEW_STEREO == (_render->m_view[view].m_flags & BGFX_VIEW_STEREO) ) );
viewRestart &= hmdEnabled;
if (viewRestart)
{
@ -5717,7 +5717,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
profiler.begin(view);
viewState.m_rect = _render->m_rect[view];
viewState.m_rect = _render->m_view[view].m_rect;
if (viewRestart)
{
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) )
@ -5753,7 +5753,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
}
}
const Rect& scissorRect = _render->m_scissor[view];
const Rect& scissorRect = _render->m_view[view].m_scissor;
viewHasScissor = !scissorRect.isZero();
viewScissorRect = viewHasScissor ? scissorRect : viewState.m_rect;
@ -5765,7 +5765,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
vp.MinDepth = 0.0f;
vp.MaxDepth = 1.0f;
deviceCtx->RSSetViewports(1, &vp);
Clear& clr = _render->m_clear[view];
Clear& clr = _render->m_view[view].m_clear;
if (BGFX_CLEAR_NONE != (clr.m_flags & BGFX_CLEAR_MASK) )
{

View File

@ -5125,7 +5125,7 @@ data.NumQualityLevels = 0;
// uint8_t eye = 0;
// uint8_t restartState = 0;
viewState.m_rect = _render->m_rect[0];
viewState.m_rect = _render->m_view[0].m_rect;
int32_t numItems = _render->m_numRenderItems;
for (int32_t item = 0, restartItem = numItems; item < numItems || restartItem < numItems;)
@ -5155,7 +5155,7 @@ data.NumQualityLevels = 0;
currentProgramIdx = kInvalidHandle;
hasPredefined = false;
fbh = _render->m_fb[view];
fbh = _render->m_view[view].m_fbh;
setFrameBuffer(fbh);
if (item > 1)
@ -5165,9 +5165,9 @@ data.NumQualityLevels = 0;
profiler.begin(view);
viewState.m_rect = _render->m_rect[view];
const Rect& rect = _render->m_rect[view];
const Rect& scissorRect = _render->m_scissor[view];
viewState.m_rect = _render->m_view[view].m_rect;
const Rect& rect = _render->m_view[view].m_rect;
const Rect& scissorRect = _render->m_view[view].m_scissor;
viewHasScissor = !scissorRect.isZero();
viewScissorRect = viewHasScissor ? scissorRect : rect;
@ -5188,7 +5188,7 @@ data.NumQualityLevels = 0;
m_commandList->RSSetScissorRects(1, &rc);
restoreScissor = false;
Clear& clr = _render->m_clear[view];
Clear& clr = _render->m_view[view].m_clear;
if (BGFX_CLEAR_NONE != clr.m_flags)
{
Rect clearRect = rect;

View File

@ -3811,9 +3811,9 @@ namespace bgfx { namespace d3d9
view = key.m_view;
programIdx = kInvalidHandle;
if (_render->m_fb[view].idx != fbh.idx)
if (_render->m_view[view].m_fbh.idx != fbh.idx)
{
fbh = _render->m_fb[view];
fbh = _render->m_view[view].m_fbh;
setFrameBuffer(fbh);
}
@ -3826,8 +3826,8 @@ namespace bgfx { namespace d3d9
profiler.begin(view);
PIX_BEGINEVENT(D3DCOLOR_VIEW, s_viewNameW[view]);
viewState.m_rect = _render->m_rect[view];
const Rect& scissorRect = _render->m_scissor[view];
viewState.m_rect = _render->m_view[view].m_rect;
const Rect& scissorRect = _render->m_view[view].m_scissor;
viewHasScissor = !scissorRect.isZero();
viewScissorRect = viewHasScissor ? scissorRect : viewState.m_rect;
@ -3840,7 +3840,7 @@ namespace bgfx { namespace d3d9
vp.MaxZ = 1.0f;
DX_CHECK(device->SetViewport(&vp) );
Clear& clear = _render->m_clear[view];
Clear& clear = _render->m_view[view].m_clear;
if (BGFX_CLEAR_NONE != (clear.m_flags & BGFX_CLEAR_MASK) )
{

View File

@ -6627,7 +6627,7 @@ namespace bgfx { namespace gl
bool viewRestart = false;
uint8_t restartState = 0;
viewState.m_rect = _render->m_rect[0];
viewState.m_rect = _render->m_view[0].m_rect;
int32_t numItems = _render->m_numRenderItems;
for (int32_t item = 0, restartItem = numItems; item < numItems || restartItem < numItems;)
@ -6660,9 +6660,9 @@ namespace bgfx { namespace gl
view = key.m_view;
programIdx = kInvalidHandle;
if (_render->m_fb[view].idx != fbh.idx)
if (_render->m_view[view].m_fbh.idx != fbh.idx)
{
fbh = _render->m_fb[view];
fbh = _render->m_view[view].m_fbh;
resolutionHeight = hmdEnabled
? _render->m_hmd.height
: _render->m_resolution.m_height
@ -6670,7 +6670,7 @@ namespace bgfx { namespace gl
resolutionHeight = setFrameBuffer(fbh, resolutionHeight, discardFlags);
}
viewRestart = ( (BGFX_VIEW_STEREO == (_render->m_viewFlags[view] & BGFX_VIEW_STEREO) ) );
viewRestart = ( (BGFX_VIEW_STEREO == (_render->m_view[view].m_flags & BGFX_VIEW_STEREO) ) );
viewRestart &= hmdEnabled;
if (viewRestart)
{
@ -6695,7 +6695,7 @@ namespace bgfx { namespace gl
profiler.begin(view);
viewState.m_rect = _render->m_rect[view];
viewState.m_rect = _render->m_view[view].m_rect;
if (viewRestart)
{
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) )
@ -6727,7 +6727,7 @@ namespace bgfx { namespace gl
}
}
const Rect& scissorRect = _render->m_scissor[view];
const Rect& scissorRect = _render->m_view[view].m_scissor;
viewHasScissor = !scissorRect.isZero();
viewScissorRect = viewHasScissor ? scissorRect : viewState.m_rect;
@ -6737,7 +6737,7 @@ namespace bgfx { namespace gl
, viewState.m_rect.m_height
) );
Clear& clear = _render->m_clear[view];
Clear& clear = _render->m_view[view].m_clear;
discardFlags = clear.m_flags & BGFX_CLEAR_DISCARD_MASK;
if (BGFX_CLEAR_NONE != (clear.m_flags & BGFX_CLEAR_MASK) )

View File

@ -3756,7 +3756,7 @@ VK_DESTROY
// uint8_t eye = 0;
// uint8_t restartState = 0;
viewState.m_rect = _render->m_rect[0];
viewState.m_rect = _render->m_view[0].m_rect;
int32_t numItems = _render->m_numRenderItems;
for (int32_t item = 0, restartItem = numItems; item < numItems || restartItem < numItems;)
@ -3797,12 +3797,12 @@ BX_UNUSED(currentSamplerStateIdx);
currentProgramIdx = kInvalidHandle;
hasPredefined = false;
fbh = _render->m_fb[view];
fbh = _render->m_view[view].m_fbh;
setFrameBuffer(fbh);
viewState.m_rect = _render->m_rect[view];
const Rect& rect = _render->m_rect[view];
const Rect& scissorRect = _render->m_scissor[view];
viewState.m_rect = _render->m_view[view].m_rect;
const Rect& rect = _render->m_view[view].m_rect;
const Rect& scissorRect = _render->m_view[view].m_scissor;
viewHasScissor = !scissorRect.isZero();
viewScissorRect = viewHasScissor ? scissorRect : rect;
@ -3832,7 +3832,7 @@ BX_UNUSED(currentSamplerStateIdx);
restoreScissor = false;
Clear& clr = _render->m_clear[view];
Clear& clr = _render->m_view[view].m_clear;
if (BGFX_CLEAR_NONE != clr.m_flags)
{
Rect clearRect = rect;