diff options
Diffstat (limited to '3rdparty/bgfx/examples')
-rw-r--r-- | 3rdparty/bgfx/examples/common/entry/entry.cpp | 3 | ||||
-rw-r--r-- | 3rdparty/bgfx/examples/common/example-glue.cpp | 10 | ||||
-rw-r--r-- | 3rdparty/bgfx/examples/common/shaderlib.sh | 65 |
3 files changed, 40 insertions, 38 deletions
diff --git a/3rdparty/bgfx/examples/common/entry/entry.cpp b/3rdparty/bgfx/examples/common/entry/entry.cpp index 98b1a40577e..89409f000f2 100644 --- a/3rdparty/bgfx/examples/common/entry/entry.cpp +++ b/3rdparty/bgfx/examples/common/entry/entry.cpp @@ -352,9 +352,6 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { entry::Key::GamepadStart, entry::Modifier::None, 1, NULL, "graphics stats" }, { entry::Key::F1, entry::Modifier::LeftShift, 1, NULL, "graphics stats 0\ngraphics text 0" }, { entry::Key::F3, entry::Modifier::None, 1, NULL, "graphics wireframe" }, - { entry::Key::F4, entry::Modifier::None, 1, NULL, "graphics hmd" }, - { entry::Key::F4, entry::Modifier::LeftShift, 1, NULL, "graphics hmdrecenter" }, - { entry::Key::F4, entry::Modifier::LeftCtrl, 1, NULL, "graphics hmddbg" }, { entry::Key::F6, entry::Modifier::None, 1, NULL, "graphics profiler" }, { entry::Key::F7, entry::Modifier::None, 1, NULL, "graphics vsync" }, { entry::Key::F8, entry::Modifier::None, 1, NULL, "graphics msaa" }, diff --git a/3rdparty/bgfx/examples/common/example-glue.cpp b/3rdparty/bgfx/examples/common/example-glue.cpp index 0c4f84f93c6..ad4507c4f81 100644 --- a/3rdparty/bgfx/examples/common/example-glue.cpp +++ b/3rdparty/bgfx/examples/common/example-glue.cpp @@ -438,8 +438,10 @@ void showExampleDialog(entry::AppI* _app, const char* _errorText) ImGui::Text("%3d %3d %s", pos, viewStats.view, viewStats.name); const float maxWidth = 30.0f*scale; - const float cpuWidth = bx::clamp(float(viewStats.cpuTimeElapsed*toCpuMs)*scale, 1.0f, maxWidth); - const float gpuWidth = bx::clamp(float(viewStats.gpuTimeElapsed*toGpuMs)*scale, 1.0f, maxWidth); + const float cpuTimeElapsed = float((viewStats.cpuTimeEnd - viewStats.cpuTimeBegin) * toCpuMs); + const float gpuTimeElapsed = float((viewStats.gpuTimeEnd - viewStats.gpuTimeBegin) * toGpuMs); + const float cpuWidth = bx::clamp(cpuTimeElapsed*scale, 1.0f, maxWidth); + const float gpuWidth = bx::clamp(gpuTimeElapsed*scale, 1.0f, maxWidth); ImGui::SameLine(64.0f); @@ -448,7 +450,7 @@ void showExampleDialog(entry::AppI* _app, const char* _errorText) ImGui::SetTooltip("View %d \"%s\", CPU: %f [ms]" , pos , viewStats.name - , viewStats.cpuTimeElapsed*toCpuMs + , cpuTimeElapsed ); } @@ -458,7 +460,7 @@ void showExampleDialog(entry::AppI* _app, const char* _errorText) ImGui::SetTooltip("View: %d \"%s\", GPU: %f [ms]" , pos , viewStats.name - , viewStats.gpuTimeElapsed*toGpuMs + , gpuTimeElapsed ); } } diff --git a/3rdparty/bgfx/examples/common/shaderlib.sh b/3rdparty/bgfx/examples/common/shaderlib.sh index f0aee192493..3bd7b12e4c1 100644 --- a/3rdparty/bgfx/examples/common/shaderlib.sh +++ b/3rdparty/bgfx/examples/common/shaderlib.sh @@ -10,10 +10,10 @@ vec4 encodeRE8(float _r) { float exponent = ceil(log2(_r) ); return vec4(_r / exp2(exponent) - , 0.0 - , 0.0 - , (exponent + 128.0) / 255.0 - ); + , 0.0 + , 0.0 + , (exponent + 128.0) / 255.0 + ); } float decodeRE8(vec4 _re8) @@ -62,9 +62,9 @@ vec3 decodeNormalSphereMap(vec2 _encodedNormal) vec2 octahedronWrap(vec2 _val) { - // Reference: - // Octahedron normal vector encoding - // http://kriscg.blogspot.com/2014/04/octahedron-normal-vector-encoding.html + // Reference(s): + // - Octahedron normal vector encoding + // https://web.archive.org/web/20191027010600/https://knarkowicz.wordpress.com/2014/04/16/octahedron-normal-vector-encoding/comment-page-1/ return (1.0 - abs(_val.yx) ) * mix(vec2_splat(-1.0), vec2_splat(1.0), vec2(greaterThanEqual(_val.xy, vec2_splat(0.0) ) ) ); } @@ -89,9 +89,9 @@ vec3 decodeNormalOctahedron(vec2 _encodedNormal) vec3 convertRGB2XYZ(vec3 _rgb) { - // Reference: - // RGB/XYZ Matrices - // http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html + // Reference(s): + // - RGB/XYZ Matrices + // https://web.archive.org/web/20191027010220/http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html vec3 xyz; xyz.x = dot(vec3(0.4124564, 0.3575761, 0.1804375), _rgb); xyz.y = dot(vec3(0.2126729, 0.7151522, 0.0721750), _rgb); @@ -110,16 +110,18 @@ vec3 convertXYZ2RGB(vec3 _xyz) vec3 convertXYZ2Yxy(vec3 _xyz) { - // Reference: - // http://www.brucelindbloom.com/index.html?Eqn_XYZ_to_xyY.html + // Reference(s): + // - XYZ to xyY + // https://web.archive.org/web/20191027010144/http://www.brucelindbloom.com/index.html?Eqn_XYZ_to_xyY.html float inv = 1.0/dot(_xyz, vec3(1.0, 1.0, 1.0) ); return vec3(_xyz.y, _xyz.x*inv, _xyz.y*inv); } vec3 convertYxy2XYZ(vec3 _Yxy) { - // Reference: - // http://www.brucelindbloom.com/index.html?Eqn_xyY_to_XYZ.html + // Reference(s): + // - xyY to XYZ + // https://web.archive.org/web/20191027010036/http://www.brucelindbloom.com/index.html?Eqn_xyY_to_XYZ.html vec3 xyz; xyz.x = _Yxy.x*_Yxy.y/_Yxy.z; xyz.y = _Yxy.x; @@ -248,9 +250,9 @@ vec4 toFilmic(vec4 _rgba) vec3 toAcesFilmic(vec3 _rgb) { - // Reference: - // ACES Filmic Tone Mapping Curve - // https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/ + // Reference(s): + // - ACES Filmic Tone Mapping Curve + // https://web.archive.org/web/20191027010704/https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/ float aa = 2.51f; float bb = 0.03f; float cc = 2.43f; @@ -369,9 +371,9 @@ float random(vec2 _uv) vec3 fixCubeLookup(vec3 _v, float _lod, float _topLevelCubeSize) { - // Reference: - // Seamless cube-map filtering - // http://the-witness.net/news/2012/02/seamless-cube-map-filtering/ + // Reference(s): + // - Seamless cube-map filtering + // https://web.archive.org/web/20190411181934/http://the-witness.net/news/2012/02/seamless-cube-map-filtering/ float ax = abs(_v.x); float ay = abs(_v.y); float az = abs(_v.z); @@ -392,22 +394,23 @@ vec2 texture2DBc5(sampler2D _sampler, vec2 _uv) #endif } -mat3 cofactor( mat4 _m ) +mat3 cofactor(mat4 _m) { // Reference: // Cofactor of matrix. Use to transform normals. The code assumes the last column of _m is [0,0,0,1]. // https://www.shadertoy.com/view/3s33zj // https://github.com/graphitemaster/normals_revisited - return mat3( - _m[1][1]*_m[2][2]-_m[1][2]*_m[2][1], - _m[1][2]*_m[2][0]-_m[1][0]*_m[2][2], - _m[1][0]*_m[2][1]-_m[1][1]*_m[2][0], - _m[0][2]*_m[2][1]-_m[0][1]*_m[2][2], - _m[0][0]*_m[2][2]-_m[0][2]*_m[2][0], - _m[0][1]*_m[2][0]-_m[0][0]*_m[2][1], - _m[0][1]*_m[1][2]-_m[0][2]*_m[1][1], - _m[0][2]*_m[1][0]-_m[0][0]*_m[1][2], - _m[0][0]*_m[1][1]-_m[0][1]*_m[1][0] ); + return mat3( + _m[1][1]*_m[2][2]-_m[1][2]*_m[2][1], + _m[1][2]*_m[2][0]-_m[1][0]*_m[2][2], + _m[1][0]*_m[2][1]-_m[1][1]*_m[2][0], + _m[0][2]*_m[2][1]-_m[0][1]*_m[2][2], + _m[0][0]*_m[2][2]-_m[0][2]*_m[2][0], + _m[0][1]*_m[2][0]-_m[0][0]*_m[2][1], + _m[0][1]*_m[1][2]-_m[0][2]*_m[1][1], + _m[0][2]*_m[1][0]-_m[0][0]*_m[1][2], + _m[0][0]*_m[1][1]-_m[0][1]*_m[1][0] + ); } #endif // __SHADERLIB_SH__ |