Fixed view id remapping.
This commit is contained in:
parent
7384171900
commit
3533da7225
@ -378,19 +378,19 @@ public:
|
||||
|
||||
m_time += (float)(frameTime*m_speed/freq);
|
||||
|
||||
uint8_t shuffle[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
bgfx::ViewId shuffle[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
bx::shuffle(&m_rng, shuffle, BX_COUNTOF(shuffle) );
|
||||
|
||||
uint8_t hdrSkybox = shuffle[0];
|
||||
uint8_t hdrMesh = shuffle[1];
|
||||
uint8_t hdrLuminance = shuffle[2];
|
||||
uint8_t hdrLumScale0 = shuffle[3];
|
||||
uint8_t hdrLumScale1 = shuffle[4];
|
||||
uint8_t hdrLumScale2 = shuffle[5];
|
||||
uint8_t hdrLumScale3 = shuffle[6];
|
||||
uint8_t hdrBrightness = shuffle[7];
|
||||
uint8_t hdrVBlur = shuffle[8];
|
||||
uint8_t hdrHBlurTonemap = shuffle[9];
|
||||
bgfx::ViewId hdrSkybox = shuffle[0];
|
||||
bgfx::ViewId hdrMesh = shuffle[1];
|
||||
bgfx::ViewId hdrLuminance = shuffle[2];
|
||||
bgfx::ViewId hdrLumScale0 = shuffle[3];
|
||||
bgfx::ViewId hdrLumScale1 = shuffle[4];
|
||||
bgfx::ViewId hdrLumScale2 = shuffle[5];
|
||||
bgfx::ViewId hdrLumScale3 = shuffle[6];
|
||||
bgfx::ViewId hdrBrightness = shuffle[7];
|
||||
bgfx::ViewId hdrVBlur = shuffle[8];
|
||||
bgfx::ViewId hdrHBlurTonemap = shuffle[9];
|
||||
|
||||
// Set views.
|
||||
bgfx::setViewName(hdrSkybox, "Skybox");
|
||||
|
@ -1050,7 +1050,7 @@ namespace bgfx
|
||||
ViewId viewRemap[BGFX_CONFIG_MAX_VIEWS];
|
||||
for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii)
|
||||
{
|
||||
viewRemap[m_viewRemap[ii] ] = uint8_t(ii);
|
||||
viewRemap[m_viewRemap[ii] ] = ViewId(ii);
|
||||
}
|
||||
|
||||
for (uint32_t ii = 0, num = m_numRenderItems; ii < num; ++ii)
|
||||
@ -1418,12 +1418,12 @@ namespace bgfx
|
||||
|
||||
for (uint32_t ii = 0; ii < BX_COUNTOF(m_viewRemap); ++ii)
|
||||
{
|
||||
m_viewRemap[ii] = uint8_t(ii);
|
||||
m_viewRemap[ii] = ViewId(ii);
|
||||
}
|
||||
|
||||
for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii)
|
||||
{
|
||||
resetView(uint8_t(ii) );
|
||||
resetView(ViewId(ii) );
|
||||
}
|
||||
|
||||
for (uint32_t ii = 0; ii < BX_COUNTOF(m_clearColor); ++ii)
|
||||
|
12
src/bgfx_p.h
12
src/bgfx_p.h
@ -1021,15 +1021,15 @@ namespace bgfx
|
||||
return true; // compute
|
||||
}
|
||||
|
||||
static uint8_t decodeView(uint64_t _key)
|
||||
static ViewId decodeView(uint64_t _key)
|
||||
{
|
||||
return uint8_t( (_key & SORT_KEY_VIEW_MASK) >> SORT_KEY_VIEW_SHIFT);
|
||||
return ViewId( (_key & SORT_KEY_VIEW_MASK) >> SORT_KEY_VIEW_SHIFT);
|
||||
}
|
||||
|
||||
static uint64_t remapView(uint64_t _key, ViewId _viewRemap[BGFX_CONFIG_MAX_VIEWS])
|
||||
{
|
||||
const uint8_t oldView = uint8_t( (_key & SORT_KEY_VIEW_MASK) >> SORT_KEY_VIEW_SHIFT);
|
||||
const uint64_t view = uint64_t(_viewRemap[oldView]) << SORT_KEY_VIEW_SHIFT;
|
||||
const ViewId oldView = decodeView(_key);
|
||||
const uint64_t view = uint64_t(_viewRemap[oldView]) << SORT_KEY_VIEW_SHIFT;
|
||||
const uint64_t key = (_key & ~SORT_KEY_VIEW_MASK) | view;
|
||||
return key;
|
||||
}
|
||||
@ -1064,7 +1064,7 @@ namespace bgfx
|
||||
void decode(uint32_t _key)
|
||||
{
|
||||
m_item = uint16_t(_key & UINT16_MAX);
|
||||
m_view = uint8_t(_key >> 24);
|
||||
m_view = ViewId(_key >> 24);
|
||||
}
|
||||
|
||||
static uint32_t remapView(uint32_t _key, ViewId _viewRemap[BGFX_CONFIG_MAX_VIEWS])
|
||||
@ -4321,7 +4321,7 @@ namespace bgfx
|
||||
}
|
||||
else
|
||||
{
|
||||
bx::memCopy(&m_viewRemap[_id], _order, num);
|
||||
bx::memCopy(&m_viewRemap[_id], _order, num*sizeof(ViewId) );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user