08-update: Added blit test.

This commit is contained in:
Бранимир Караџић 2021-11-01 08:43:22 -07:00
parent 5bc3b18227
commit 2df0a41918

View File

@ -424,6 +424,10 @@ public:
m_texture2dData = (uint8_t*)malloc(kTexture2dSize*kTexture2dSize*4);
m_blitTestA = bgfx::createTexture2D(16, 16, false, 1, bgfx::TextureFormat::Enum::RGBA8, BGFX_TEXTURE_BLIT_DST);
m_blitTestB = bgfx::createTexture2D(16, 16, false, 1, bgfx::TextureFormat::Enum::RGBA8, BGFX_TEXTURE_BLIT_DST);
m_blitTestC = bgfx::createTexture2D(16, 16, false, 1, bgfx::TextureFormat::Enum::RGBA8, BGFX_TEXTURE_BLIT_DST);
m_rr = m_rng.gen()%255;
m_gg = m_rng.gen()%255;
m_bb = m_rng.gen()%255;
@ -449,6 +453,10 @@ public:
// Cleanup.
free(m_texture2dData);
bgfx::destroy(m_blitTestA);
bgfx::destroy(m_blitTestB);
bgfx::destroy(m_blitTestC);
for (uint32_t ii = 0; ii < BX_COUNTOF(m_textures); ++ii)
{
bgfx::destroy(m_textures[ii]);
@ -461,7 +469,7 @@ public:
bgfx::destroy(m_texture2d);
for (uint32_t ii = 0; ii<BX_COUNTOF(m_textureCube); ++ii)
for (uint32_t ii = 0; ii < BX_COUNTOF(m_textureCube); ++ii)
{
if (bgfx::isValid(m_textureCube[ii]))
{
@ -469,7 +477,7 @@ public:
}
}
for (uint32_t ii = 0; ii<BX_COUNTOF(m_textureCubeFaceFb); ++ii)
for (uint32_t ii = 0; ii < BX_COUNTOF(m_textureCubeFaceFb); ++ii)
{
if (bgfx::isValid(m_textureCubeFaceFb[ii]))
{
@ -479,15 +487,19 @@ public:
bgfx::destroy(m_ibh);
bgfx::destroy(m_vbh);
if (bgfx::isValid(m_program3d) )
{
bgfx::destroy(m_program3d);
}
bgfx::destroy(m_programCmp);
if (bgfx::isValid(m_programCompute) )
{
bgfx::destroy(m_programCompute);
}
bgfx::destroy(m_program);
bgfx::destroy(u_time);
bgfx::destroy(s_texColor);
@ -909,6 +921,18 @@ public:
ImGuiDescription(mtx[12], mtx[13], mtx[14], worldToScreen, descSampler[ii]);
}
bgfx::blit(1, m_blitTestA, 0, 0, m_blitTestB, 0, 0);
bgfx::blit(1, m_blitTestC, 0, 0, m_blitTestA, 0, 0);
bgfx::blit(1, m_blitTestA, 0, 0, m_blitTestB, 0, 0);
bgfx::blit(1, m_blitTestB, 0, 0, m_blitTestC, 0, 0);
bgfx::blit(1, m_blitTestA, 0, 0, m_blitTestB, 0, 0);
bgfx::blit(1, m_blitTestB, 0, 0, m_blitTestA, 0, 0);
bgfx::blit(1, m_blitTestB, 0, 0, m_blitTestA, 0, 0);
bgfx::blit(1, m_blitTestC, 0, 0, m_blitTestB, 0, 0);
imguiEndFrame();
// Advance to next frame. Rendering thread will be kicked to
@ -952,6 +976,9 @@ public:
bgfx::TextureHandle m_textures3d[3];
bgfx::TextureHandle m_texture2d;
bgfx::TextureHandle m_textureCube[4];
bgfx::TextureHandle m_blitTestA;
bgfx::TextureHandle m_blitTestB;
bgfx::TextureHandle m_blitTestC;
bgfx::FrameBufferHandle m_textureCubeFaceFb[6];
bgfx::IndexBufferHandle m_ibh;
bgfx::VertexBufferHandle m_vbh;