hdr.cpp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  1. /*
  2. * Copyright 2011-2015 Branimir Karadzic. All rights reserved.
  3. * License: http://www.opensource.org/licenses/BSD-2-Clause
  4. */
  5. #include "common.h"
  6. #include "bgfx_utils.h"
  7. #include "imgui/imgui.h"
  8. static float s_texelHalf = 0.0f;
  9. static bool s_originBottomLeft = false;
  10. struct PosColorTexCoord0Vertex
  11. {
  12. float m_x;
  13. float m_y;
  14. float m_z;
  15. uint32_t m_rgba;
  16. float m_u;
  17. float m_v;
  18. static void init()
  19. {
  20. ms_decl
  21. .begin()
  22. .add(bgfx::Attrib::Position, 3, bgfx::AttribType::Float)
  23. .add(bgfx::Attrib::Color0, 4, bgfx::AttribType::Uint8, true)
  24. .add(bgfx::Attrib::TexCoord0, 2, bgfx::AttribType::Float)
  25. .end();
  26. }
  27. static bgfx::VertexDecl ms_decl;
  28. };
  29. bgfx::VertexDecl PosColorTexCoord0Vertex::ms_decl;
  30. void screenSpaceQuad(float _textureWidth, float _textureHeight, bool _originBottomLeft = false, float _width = 1.0f, float _height = 1.0f)
  31. {
  32. if (bgfx::checkAvailTransientVertexBuffer(3, PosColorTexCoord0Vertex::ms_decl) )
  33. {
  34. bgfx::TransientVertexBuffer vb;
  35. bgfx::allocTransientVertexBuffer(&vb, 3, PosColorTexCoord0Vertex::ms_decl);
  36. PosColorTexCoord0Vertex* vertex = (PosColorTexCoord0Vertex*)vb.data;
  37. const float zz = 0.0f;
  38. const float minx = -_width;
  39. const float maxx = _width;
  40. const float miny = 0.0f;
  41. const float maxy = _height*2.0f;
  42. const float texelHalfW = s_texelHalf/_textureWidth;
  43. const float texelHalfH = s_texelHalf/_textureHeight;
  44. const float minu = -1.0f + texelHalfW;
  45. const float maxu = 1.0f + texelHalfW;
  46. float minv = texelHalfH;
  47. float maxv = 2.0f + texelHalfH;
  48. if (_originBottomLeft)
  49. {
  50. float temp = minv;
  51. minv = maxv;
  52. maxv = temp;
  53. minv -= 1.0f;
  54. maxv -= 1.0f;
  55. }
  56. vertex[0].m_x = minx;
  57. vertex[0].m_y = miny;
  58. vertex[0].m_z = zz;
  59. vertex[0].m_rgba = 0xffffffff;
  60. vertex[0].m_u = minu;
  61. vertex[0].m_v = minv;
  62. vertex[1].m_x = maxx;
  63. vertex[1].m_y = miny;
  64. vertex[1].m_z = zz;
  65. vertex[1].m_rgba = 0xffffffff;
  66. vertex[1].m_u = maxu;
  67. vertex[1].m_v = minv;
  68. vertex[2].m_x = maxx;
  69. vertex[2].m_y = maxy;
  70. vertex[2].m_z = zz;
  71. vertex[2].m_rgba = 0xffffffff;
  72. vertex[2].m_u = maxu;
  73. vertex[2].m_v = maxv;
  74. bgfx::setVertexBuffer(&vb);
  75. }
  76. }
  77. void setOffsets2x2Lum(bgfx::UniformHandle _handle, uint32_t _width, uint32_t _height)
  78. {
  79. float offsets[16][4];
  80. float du = 1.0f/_width;
  81. float dv = 1.0f/_height;
  82. uint32_t num = 0;
  83. for (uint32_t yy = 0; yy < 3; ++yy)
  84. {
  85. for (uint32_t xx = 0; xx < 3; ++xx)
  86. {
  87. offsets[num][0] = (xx - s_texelHalf) * du;
  88. offsets[num][1] = (yy - s_texelHalf) * dv;
  89. ++num;
  90. }
  91. }
  92. bgfx::setUniform(_handle, offsets, num);
  93. }
  94. void setOffsets4x4Lum(bgfx::UniformHandle _handle, uint32_t _width, uint32_t _height)
  95. {
  96. float offsets[16][4];
  97. float du = 1.0f/_width;
  98. float dv = 1.0f/_height;
  99. uint32_t num = 0;
  100. for (uint32_t yy = 0; yy < 4; ++yy)
  101. {
  102. for (uint32_t xx = 0; xx < 4; ++xx)
  103. {
  104. offsets[num][0] = (xx - 1.0f - s_texelHalf) * du;
  105. offsets[num][1] = (yy - 1.0f - s_texelHalf) * dv;
  106. ++num;
  107. }
  108. }
  109. bgfx::setUniform(_handle, offsets, num);
  110. }
  111. inline float square(float _x)
  112. {
  113. return _x*_x;
  114. }
  115. class HDR : public entry::AppI
  116. {
  117. void init(int /*_argc*/, char** /*_argv*/) BX_OVERRIDE
  118. {
  119. m_width = 1280;
  120. m_height = 720;
  121. m_debug = BGFX_DEBUG_TEXT;
  122. m_reset = BGFX_RESET_VSYNC;
  123. bgfx::init();
  124. bgfx::reset(m_width, m_height, m_reset);
  125. // Enable m_debug text.
  126. bgfx::setDebug(m_debug);
  127. // Set view 0 clear state.
  128. bgfx::setViewClear(0
  129. , BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH
  130. , 0x303030ff
  131. , 1.0f
  132. , 0
  133. );
  134. // Create vertex stream declaration.
  135. PosColorTexCoord0Vertex::init();
  136. // Set view m_debug names.
  137. bgfx::setViewName(0, "Skybox");
  138. bgfx::setViewName(1, "Mesh");
  139. bgfx::setViewName(2, "Luminance");
  140. bgfx::setViewName(3, "Downscale luminance 0");
  141. bgfx::setViewName(4, "Downscale luminance 1");
  142. bgfx::setViewName(5, "Downscale luminance 2");
  143. bgfx::setViewName(6, "Downscale luminance 3");
  144. bgfx::setViewName(7, "Brightness");
  145. bgfx::setViewName(8, "Blur vertical");
  146. bgfx::setViewName(9, "Blur horizontal + tonemap");
  147. m_uffizi = loadTexture("uffizi.dds"
  148. , 0
  149. | BGFX_TEXTURE_U_CLAMP
  150. | BGFX_TEXTURE_V_CLAMP
  151. | BGFX_TEXTURE_W_CLAMP
  152. );
  153. m_skyProgram = loadProgram("vs_hdr_skybox", "fs_hdr_skybox");
  154. m_lumProgram = loadProgram("vs_hdr_lum", "fs_hdr_lum");
  155. m_lumAvgProgram = loadProgram("vs_hdr_lumavg", "fs_hdr_lumavg");
  156. m_blurProgram = loadProgram("vs_hdr_blur", "fs_hdr_blur");
  157. m_brightProgram = loadProgram("vs_hdr_bright", "fs_hdr_bright");
  158. m_meshProgram = loadProgram("vs_hdr_mesh", "fs_hdr_mesh");
  159. m_tonemapProgram = loadProgram("vs_hdr_tonemap", "fs_hdr_tonemap");
  160. s_texCube = bgfx::createUniform("s_texCube", bgfx::UniformType::Int1);
  161. s_texColor = bgfx::createUniform("s_texColor", bgfx::UniformType::Int1);
  162. s_texLum = bgfx::createUniform("s_texLum", bgfx::UniformType::Int1);
  163. s_texBlur = bgfx::createUniform("s_texBlur", bgfx::UniformType::Int1);
  164. u_mtx = bgfx::createUniform("u_mtx", bgfx::UniformType::Mat4);
  165. u_tonemap = bgfx::createUniform("u_tonemap", bgfx::UniformType::Vec4);
  166. u_offset = bgfx::createUniform("u_offset", bgfx::UniformType::Vec4, 16);
  167. m_mesh = meshLoad("meshes/bunny.bin");
  168. m_fbtextures[0] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_RT|BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP);
  169. m_fbtextures[1] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_BUFFER_ONLY);
  170. m_fbh = bgfx::createFrameBuffer(BX_COUNTOF(m_fbtextures), m_fbtextures, true);
  171. m_lum[0] = bgfx::createFrameBuffer(128, 128, bgfx::TextureFormat::BGRA8);
  172. m_lum[1] = bgfx::createFrameBuffer( 64, 64, bgfx::TextureFormat::BGRA8);
  173. m_lum[2] = bgfx::createFrameBuffer( 16, 16, bgfx::TextureFormat::BGRA8);
  174. m_lum[3] = bgfx::createFrameBuffer( 4, 4, bgfx::TextureFormat::BGRA8);
  175. m_lum[4] = bgfx::createFrameBuffer( 1, 1, bgfx::TextureFormat::BGRA8);
  176. m_bright = bgfx::createFrameBuffer(bgfx::BackbufferRatio::Half, bgfx::TextureFormat::BGRA8);
  177. m_blur = bgfx::createFrameBuffer(bgfx::BackbufferRatio::Eighth, bgfx::TextureFormat::BGRA8);
  178. // Imgui.
  179. imguiCreate();
  180. const bgfx::RendererType::Enum renderer = bgfx::getRendererType();
  181. s_texelHalf = bgfx::RendererType::Direct3D9 == renderer ? 0.5f : 0.0f;
  182. s_originBottomLeft = bgfx::RendererType::OpenGL == renderer || bgfx::RendererType::OpenGLES == renderer;
  183. m_oldWidth = 0;
  184. m_oldHeight = 0;
  185. m_oldReset = m_reset;
  186. m_speed = 0.37f;
  187. m_middleGray = 0.18f;
  188. m_white = 1.1f;
  189. m_threshold = 1.5f;
  190. m_scrollArea = 0;
  191. m_time = 0.0f;
  192. }
  193. virtual int shutdown() BX_OVERRIDE
  194. {
  195. // Cleanup.
  196. imguiDestroy();
  197. meshUnload(m_mesh);
  198. for (uint32_t ii = 0; ii < BX_COUNTOF(m_lum); ++ii)
  199. {
  200. bgfx::destroyFrameBuffer(m_lum[ii]);
  201. }
  202. bgfx::destroyFrameBuffer(m_bright);
  203. bgfx::destroyFrameBuffer(m_blur);
  204. bgfx::destroyFrameBuffer(m_fbh);
  205. bgfx::destroyProgram(m_meshProgram);
  206. bgfx::destroyProgram(m_skyProgram);
  207. bgfx::destroyProgram(m_tonemapProgram);
  208. bgfx::destroyProgram(m_lumProgram);
  209. bgfx::destroyProgram(m_lumAvgProgram);
  210. bgfx::destroyProgram(m_blurProgram);
  211. bgfx::destroyProgram(m_brightProgram);
  212. bgfx::destroyTexture(m_uffizi);
  213. bgfx::destroyUniform(s_texCube);
  214. bgfx::destroyUniform(s_texColor);
  215. bgfx::destroyUniform(s_texLum);
  216. bgfx::destroyUniform(s_texBlur);
  217. bgfx::destroyUniform(u_mtx);
  218. bgfx::destroyUniform(u_tonemap);
  219. bgfx::destroyUniform(u_offset);
  220. // Shutdown bgfx.
  221. bgfx::shutdown();
  222. return 0;
  223. }
  224. bool update() BX_OVERRIDE
  225. {
  226. if (!entry::processEvents(m_width, m_height, m_debug, m_reset, &m_mouseState) )
  227. {
  228. if (m_oldWidth != m_width
  229. || m_oldHeight != m_height
  230. || m_oldReset != m_reset)
  231. {
  232. // Recreate variable size render targets when resolution changes.
  233. m_oldWidth = m_width;
  234. m_oldHeight = m_height;
  235. m_oldReset = m_reset;
  236. uint32_t msaa = (m_reset&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT;
  237. bgfx::destroyFrameBuffer(m_fbh);
  238. m_fbtextures[0] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::BGRA8, ( (msaa+1)<<BGFX_TEXTURE_RT_MSAA_SHIFT)|BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP);
  239. m_fbtextures[1] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_BUFFER_ONLY|( (msaa+1)<<BGFX_TEXTURE_RT_MSAA_SHIFT) );
  240. m_fbh = bgfx::createFrameBuffer(BX_COUNTOF(m_fbtextures), m_fbtextures, true);
  241. }
  242. imguiBeginFrame(m_mouseState.m_mx
  243. , m_mouseState.m_my
  244. , (m_mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
  245. | (m_mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
  246. | (m_mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0)
  247. , m_mouseState.m_mz
  248. , m_width
  249. , m_height
  250. );
  251. imguiBeginScrollArea("Settings", m_width - m_width / 5 - 10, 10, m_width / 5, m_height / 3, &m_scrollArea);
  252. imguiSeparatorLine();
  253. imguiSlider("Speed", m_speed, 0.0f, 1.0f, 0.01f);
  254. imguiSeparator();
  255. imguiSlider("Middle gray", m_middleGray, 0.1f, 1.0f, 0.01f);
  256. imguiSlider("White point", m_white, 0.1f, 2.0f, 0.01f);
  257. imguiSlider("Threshold", m_threshold, 0.1f, 2.0f, 0.01f);
  258. imguiEndScrollArea();
  259. imguiEndFrame();
  260. // This dummy draw call is here to make sure that view 0 is cleared
  261. // if no other draw calls are submitted to view 0.
  262. bgfx::touch(0);
  263. int64_t now = bx::getHPCounter();
  264. static int64_t last = now;
  265. const int64_t frameTime = now - last;
  266. last = now;
  267. const double freq = double(bx::getHPFrequency() );
  268. const double toMs = 1000.0/freq;
  269. m_time += (float)(frameTime*m_speed/freq);
  270. // Use m_debug font to print information about this example.
  271. bgfx::dbgTextClear();
  272. bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/09-hdr");
  273. bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: Using multiple views and frame buffers.");
  274. bgfx::dbgTextPrintf(0, 3, 0x0f, "Frame: % 7.3f[ms]", double(frameTime)*toMs);
  275. // Set views.
  276. for (uint32_t ii = 0; ii < 6; ++ii)
  277. {
  278. bgfx::setViewRect(ii, 0, 0, m_width, m_height);
  279. }
  280. bgfx::setViewFrameBuffer(0, m_fbh);
  281. bgfx::setViewFrameBuffer(1, m_fbh);
  282. bgfx::setViewClear(1, BGFX_CLEAR_DISCARD_DEPTH|BGFX_CLEAR_DISCARD_STENCIL);
  283. bgfx::setViewRect(2, 0, 0, 128, 128);
  284. bgfx::setViewFrameBuffer(2, m_lum[0]);
  285. bgfx::setViewRect(3, 0, 0, 64, 64);
  286. bgfx::setViewFrameBuffer(3, m_lum[1]);
  287. bgfx::setViewRect(4, 0, 0, 16, 16);
  288. bgfx::setViewFrameBuffer(4, m_lum[2]);
  289. bgfx::setViewRect(5, 0, 0, 4, 4);
  290. bgfx::setViewFrameBuffer(5, m_lum[3]);
  291. bgfx::setViewRect(6, 0, 0, 1, 1);
  292. bgfx::setViewFrameBuffer(6, m_lum[4]);
  293. bgfx::setViewRect(7, 0, 0, m_width/2, m_height/2);
  294. bgfx::setViewFrameBuffer(7, m_bright);
  295. bgfx::setViewRect(8, 0, 0, m_width/8, m_height/8);
  296. bgfx::setViewFrameBuffer(8, m_blur);
  297. bgfx::setViewRect(9, 0, 0, m_width, m_height);
  298. float view[16];
  299. float proj[16];
  300. bx::mtxIdentity(view);
  301. bx::mtxOrtho(proj, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 100.0f);
  302. // Set view and projection matrix for view 0.
  303. for (uint32_t ii = 0; ii < 10; ++ii)
  304. {
  305. bgfx::setViewTransform(ii, view, proj);
  306. }
  307. float at[3] = { 0.0f, 1.0f, 0.0f };
  308. float eye[3] = { 0.0f, 1.0f, -2.5f };
  309. float mtx[16];
  310. bx::mtxRotateXY(mtx
  311. , 0.0f
  312. , m_time
  313. );
  314. float temp[4];
  315. bx::vec3MulMtx(temp, eye, mtx);
  316. bx::mtxLookAt(view, temp, at);
  317. bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f);
  318. // Set view and projection matrix for view 1.
  319. bgfx::setViewTransform(1, view, proj);
  320. bgfx::setUniform(u_mtx, mtx);
  321. // Render skybox into view 0.
  322. bgfx::setTexture(0, s_texCube, m_uffizi);
  323. bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE);
  324. screenSpaceQuad( (float)m_width, (float)m_height, true);
  325. bgfx::submit(0, m_skyProgram);
  326. // Render m_mesh into view 1
  327. bgfx::setTexture(0, s_texCube, m_uffizi);
  328. meshSubmit(m_mesh, 1, m_meshProgram, NULL);
  329. // Calculate luminance.
  330. setOffsets2x2Lum(u_offset, 128, 128);
  331. bgfx::setTexture(0, s_texColor, m_fbtextures[0]);
  332. bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE);
  333. screenSpaceQuad(128.0f, 128.0f, s_originBottomLeft);
  334. bgfx::submit(2, m_lumProgram);
  335. // Downscale luminance 0.
  336. setOffsets4x4Lum(u_offset, 128, 128);
  337. bgfx::setTexture(0, s_texColor, m_lum[0]);
  338. bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE);
  339. screenSpaceQuad(64.0f, 64.0f, s_originBottomLeft);
  340. bgfx::submit(3, m_lumAvgProgram);
  341. // Downscale luminance 1.
  342. setOffsets4x4Lum(u_offset, 64, 64);
  343. bgfx::setTexture(0, s_texColor, m_lum[1]);
  344. bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE);
  345. screenSpaceQuad(16.0f, 16.0f, s_originBottomLeft);
  346. bgfx::submit(4, m_lumAvgProgram);
  347. // Downscale luminance 2.
  348. setOffsets4x4Lum(u_offset, 16, 16);
  349. bgfx::setTexture(0, s_texColor, m_lum[2]);
  350. bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE);
  351. screenSpaceQuad(4.0f, 4.0f, s_originBottomLeft);
  352. bgfx::submit(5, m_lumAvgProgram);
  353. // Downscale luminance 3.
  354. setOffsets4x4Lum(u_offset, 4, 4);
  355. bgfx::setTexture(0, s_texColor, m_lum[3]);
  356. bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE);
  357. screenSpaceQuad(1.0f, 1.0f, s_originBottomLeft);
  358. bgfx::submit(6, m_lumAvgProgram);
  359. float tonemap[4] = { m_middleGray, square(m_white), m_threshold, m_time };
  360. bgfx::setUniform(u_tonemap, tonemap);
  361. // m_bright pass m_threshold is tonemap[3].
  362. setOffsets4x4Lum(u_offset, m_width/2, m_height/2);
  363. bgfx::setTexture(0, s_texColor, m_fbtextures[0]);
  364. bgfx::setTexture(1, s_texLum, m_lum[4]);
  365. bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE);
  366. screenSpaceQuad( (float)m_width/2.0f, (float)m_height/2.0f, s_originBottomLeft);
  367. bgfx::submit(7, m_brightProgram);
  368. // m_blur m_bright pass vertically.
  369. bgfx::setTexture(0, s_texColor, m_bright);
  370. bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE);
  371. screenSpaceQuad( (float)m_width/8.0f, (float)m_height/8.0f, s_originBottomLeft);
  372. bgfx::submit(8, m_blurProgram);
  373. // m_blur m_bright pass horizontally, do tonemaping and combine.
  374. bgfx::setTexture(0, s_texColor, m_fbtextures[0]);
  375. bgfx::setTexture(1, s_texLum, m_lum[4]);
  376. bgfx::setTexture(2, s_texBlur, m_blur);
  377. bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE);
  378. screenSpaceQuad( (float)m_width, (float)m_height, s_originBottomLeft);
  379. bgfx::submit(9, m_tonemapProgram);
  380. // Advance to next frame. Rendering thread will be kicked to
  381. // process submitted rendering primitives.
  382. bgfx::frame();
  383. return true;
  384. }
  385. return false;
  386. }
  387. entry::MouseState m_mouseState;
  388. bgfx::ProgramHandle m_skyProgram;
  389. bgfx::ProgramHandle m_lumProgram;
  390. bgfx::ProgramHandle m_lumAvgProgram;
  391. bgfx::ProgramHandle m_blurProgram;
  392. bgfx::ProgramHandle m_brightProgram;
  393. bgfx::ProgramHandle m_meshProgram;
  394. bgfx::ProgramHandle m_tonemapProgram;
  395. bgfx::TextureHandle m_uffizi;
  396. bgfx::UniformHandle s_texCube;
  397. bgfx::UniformHandle s_texColor;
  398. bgfx::UniformHandle s_texLum;
  399. bgfx::UniformHandle s_texBlur;
  400. bgfx::UniformHandle u_mtx;
  401. bgfx::UniformHandle u_tonemap;
  402. bgfx::UniformHandle u_offset;
  403. Mesh* m_mesh;
  404. bgfx::TextureHandle m_fbtextures[2];
  405. bgfx::FrameBufferHandle m_fbh;
  406. bgfx::FrameBufferHandle m_lum[5];
  407. bgfx::FrameBufferHandle m_bright;
  408. bgfx::FrameBufferHandle m_blur;
  409. uint32_t m_width;
  410. uint32_t m_height;
  411. uint32_t m_debug;
  412. uint32_t m_reset;
  413. uint32_t m_oldWidth;
  414. uint32_t m_oldHeight;
  415. uint32_t m_oldReset;
  416. float m_speed;
  417. float m_middleGray;
  418. float m_white;
  419. float m_threshold;
  420. int32_t m_scrollArea;
  421. float m_time;
  422. };
  423. ENTRY_IMPLEMENT_MAIN(HDR);