From 6533baff7b736b96464a8802edcf829655d5abba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Sun, 8 Sep 2019 22:10:42 -0700 Subject: [PATCH] Cleanup. --- examples/02-metaballs/metaballs.cpp | 15 +++++-- examples/14-shadowvolumes/shadowvolumes.cpp | 45 +++++++++++---------- examples/16-shadowmaps/shadowmaps.cpp | 17 ++++---- src/topology.cpp | 10 ++--- 4 files changed, 50 insertions(+), 37 deletions(-) diff --git a/examples/02-metaballs/metaballs.cpp b/examples/02-metaballs/metaballs.cpp index 8438bfd48..2f678e64e 100644 --- a/examples/02-metaballs/metaballs.cpp +++ b/examples/02-metaballs/metaballs.cpp @@ -371,10 +371,10 @@ static const float s_cube[8][3] = { 0.0f, 0.0f, 0.0f }, // 7 }; -float vertLerp(float* __restrict _result, float _iso, uint32_t _idx0, float _v0, uint32_t _idx1, float _v1) +float vertLerp(float* _result, float _iso, uint32_t _idx0, float _v0, uint32_t _idx1, float _v1) { - const float* __restrict edge0 = s_cube[_idx0]; - const float* __restrict edge1 = s_cube[_idx1]; + const float* edge0 = s_cube[_idx0]; + const float* edge1 = s_cube[_idx1]; if (bx::abs(_iso-_v1) < 0.00001f) { @@ -401,7 +401,14 @@ float vertLerp(float* __restrict _result, float _iso, uint32_t _idx0, float _v0, return lerp; } -uint32_t triangulate(uint8_t* _result, uint32_t _stride, const float* __restrict _rgb, const float* __restrict _xyz, const Grid* _val[8], float _iso) +uint32_t triangulate( + uint8_t* _result + , uint32_t _stride + , const float* _rgb + , const float* _xyz + , const Grid* _val[8] + , float _iso + ) { uint8_t cubeindex = 0; cubeindex |= (_val[0]->m_val < _iso) ? 0x01 : 0; diff --git a/examples/14-shadowvolumes/shadowvolumes.cpp b/examples/14-shadowvolumes/shadowvolumes.cpp index e47b59a16..07ed5abf4 100644 --- a/examples/14-shadowvolumes/shadowvolumes.cpp +++ b/examples/14-shadowvolumes/shadowvolumes.cpp @@ -133,11 +133,12 @@ void setViewRectMask(uint32_t _viewMask, uint16_t _x, uint16_t _y, uint16_t _wid } } -void mtxBillboard(float* __restrict _result - , const float* __restrict _view - , const float* __restrict _pos - , const float* __restrict _scale - ) +void mtxBillboard( + float* _result + , const float* _view + , const float* _pos + , const float* _scale + ) { _result[ 0] = _view[0] * _scale[0]; _result[ 1] = _view[4] * _scale[0]; @@ -157,10 +158,11 @@ void mtxBillboard(float* __restrict _result _result[15] = 1.0f; } -void planeNormal(float* __restrict _result - , const float* __restrict _v0 - , const float* __restrict _v1 - , const float* __restrict _v2 +void planeNormal( + float* _result + , const float* _v0 + , const float* _v1 + , const float* _v2 ) { const bx::Vec3 v0 = bx::load(_v0); @@ -1189,11 +1191,11 @@ struct ShadowVolume }; void shadowVolumeLightTransform( - float* __restrict _outLightPos - , const float* __restrict _scale - , const float* __restrict _rotate - , const float* __restrict _translate - , const float* __restrict _lightPos // world pos + float* _outLightPos + , const float* _scale + , const float* _rotate + , const float* _translate + , const float* _lightPos // world pos ) { /** @@ -1593,13 +1595,14 @@ void shadowVolumeCreate( } } -void createNearClipVolume(float* __restrict _outPlanes24f - , float* __restrict _lightPos - , float* __restrict _view - , float _fovy - , float _aspect - , float _near - ) +void createNearClipVolume( + float* _outPlanes24f + , float* _lightPos + , float* _view + , float _fovy + , float _aspect + , float _near + ) { float (*volumePlanes)[4] = (float(*)[4])_outPlanes24f; diff --git a/examples/16-shadowmaps/shadowmaps.cpp b/examples/16-shadowmaps/shadowmaps.cpp index bd3592a22..8f16c4325 100644 --- a/examples/16-shadowmaps/shadowmaps.cpp +++ b/examples/16-shadowmaps/shadowmaps.cpp @@ -184,10 +184,12 @@ static bgfx::UniformHandle s_shadowMap[ShadowMapRenderTargets::Count]; static bgfx::FrameBufferHandle s_rtShadowMap[ShadowMapRenderTargets::Count]; static bgfx::FrameBufferHandle s_rtBlur; -void mtxBillboard(float* __restrict _result - , const float* __restrict _view - , const float* __restrict _pos - , const float* __restrict _scale) +void mtxBillboard( + float* _result + , const float* _view + , const float* _pos + , const float* _scale + ) { _result[ 0] = _view[0] * _scale[0]; _result[ 1] = _view[4] * _scale[0]; @@ -207,7 +209,7 @@ void mtxBillboard(float* __restrict _result _result[15] = 1.0f; } -void mtxYawPitchRoll(float* __restrict _result +void mtxYawPitchRoll(float* _result , float _yaw , float _pitch , float _roll @@ -1061,12 +1063,13 @@ void screenSpaceQuad(float _textureWidth, float _textureHeight, bool _originBott } } -void worldSpaceFrustumCorners(float* _corners24f +void worldSpaceFrustumCorners( + float* _corners24f , float _near , float _far , float _projWidth , float _projHeight - , const float* __restrict _invViewMtx + , const float* _invViewMtx ) { // Define frustum corners in view space. diff --git a/src/topology.cpp b/src/topology.cpp index fe1292867..cf2b417cf 100644 --- a/src/topology.cpp +++ b/src/topology.cpp @@ -283,12 +283,12 @@ namespace bgfx return bx::load(&vertices[_index*_stride]); } - inline float distanceDir(const float* __restrict _dir, const void* __restrict _vertices, uint32_t _stride, uint32_t _index) + inline float distanceDir(const float* _dir, const void* _vertices, uint32_t _stride, uint32_t _index) { return bx::dot(vertexPos(_vertices, _stride, _index), bx::load(_dir) ); } - inline float distancePos(const float* __restrict _pos, const void* __restrict _vertices, uint32_t _stride, uint32_t _index) + inline float distancePos(const float* _pos, const void* _vertices, uint32_t _stride, uint32_t _index) { const bx::Vec3 tmp = bx::sub(bx::load(_pos), vertexPos(_vertices, _stride, _index) ); return bx::sqrt(bx::dot(tmp, tmp) ); @@ -299,10 +299,10 @@ namespace bgfx template inline void calcSortKeys( - uint32_t* __restrict _keys - , uint32_t* __restrict _values + uint32_t* _keys + , uint32_t* _values , const float _dirOrPos[3] - , const void* __restrict _vertices + , const void* _vertices , uint32_t _stride , const IndexT* _indices , uint32_t _num