diff options
author | 2019-10-13 13:50:38 +0200 | |
---|---|---|
committer | 2019-10-13 07:50:38 -0400 | |
commit | 0837e7451a84f95c29dbdb9bd6b8b931fee1635d (patch) | |
tree | 626bcbd250a7fbebdf5958a288d2f438d4f9fb5a /3rdparty/bgfx/examples/24-nbody/nbody.cpp | |
parent | c913ccb59d713ce0b91135520719ac5385e54358 (diff) |
WIP: sync bgfx, bx and bimg with latest upstream (#5723)
* Sync with bgfx upstream revision b91d0b6
* Sync with bx upstream revision d60912b
* Sync with bimg upstream revision bd81f60
* Add astc-codec decoder
* Rename VertexDecl to VertexLayout
* Rename UniformType enum Int1 to Sampler.
* Add NVN stub
* Fix unused-const-variable error on macOS
* Drop redundant explicit language parameters
buildoptions_cpp are only applied to c++ files and buildoptions_objcpp are only
applied to objective c++ files. As such, hardcoding -x offers no benefit while
preventing overrides (such as one needed by 3rdparty/bgfx/src/renderer_vk.cpp on
macOS) from working.
* Re-introduce -x c++ in places where C code is compiled as C++ to prevent clang from throwing a warning
* Build bgfx as Objective-C++ on macOS
It is needed due to included headers
* Enable Direct3D12 and Vulkan bgfx rendering backends
* Enable building of spirv shaders
* Properly escape /c in cmd call
* Comment out dx12 bgfx renderer
* Honor VERBOSE setting during shaders build
* Only invert hlsl shader XYZ_TO_sRGB matrix for opengl
* Add spirv shaders
* OpenGL ES needs transposed matrix too
* Metal needs transposed matrix as well
Diffstat (limited to '3rdparty/bgfx/examples/24-nbody/nbody.cpp')
-rw-r--r-- | 3rdparty/bgfx/examples/24-nbody/nbody.cpp | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/3rdparty/bgfx/examples/24-nbody/nbody.cpp b/3rdparty/bgfx/examples/24-nbody/nbody.cpp index ae675c35512..0fb4565cf51 100644 --- a/3rdparty/bgfx/examples/24-nbody/nbody.cpp +++ b/3rdparty/bgfx/examples/24-nbody/nbody.cpp @@ -113,8 +113,8 @@ const uint32_t kMaxParticleCount = 32 * 1024; class ExampleNbody : public entry::AppI { public: - ExampleNbody(const char* _name, const char* _description) - : entry::AppI(_name, _description) + ExampleNbody(const char* _name, const char* _description, const char* _url) + : entry::AppI(_name, _description, _url) { } @@ -154,8 +154,8 @@ public: if (m_computeSupported) { - bgfx::VertexDecl quadVertexDecl; - quadVertexDecl.begin() + bgfx::VertexLayout quadVertexLayout; + quadVertexLayout.begin() .add(bgfx::Attrib::Position, 2, bgfx::AttribType::Float) .end(); @@ -163,7 +163,7 @@ public: m_vbh = bgfx::createVertexBuffer( // Static data can be passed with bgfx::makeRef bgfx::makeRef(s_quadVertices, sizeof(s_quadVertices) ) - , quadVertexDecl + , quadVertexLayout ); // Create static index buffer. @@ -176,15 +176,15 @@ public: m_particleProgram = loadProgram("vs_particle", "fs_particle"); // Setup compute buffers - bgfx::VertexDecl computeVertexDecl; - computeVertexDecl.begin() + bgfx::VertexLayout computeVertexLayout; + computeVertexLayout.begin() .add(bgfx::Attrib::TexCoord0, 4, bgfx::AttribType::Float) .end(); - m_currPositionBuffer0 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ_WRITE); - m_currPositionBuffer1 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ_WRITE); - m_prevPositionBuffer0 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ_WRITE); - m_prevPositionBuffer1 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ_WRITE); + m_currPositionBuffer0 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexLayout, BGFX_BUFFER_COMPUTE_READ_WRITE); + m_currPositionBuffer1 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexLayout, BGFX_BUFFER_COMPUTE_READ_WRITE); + m_prevPositionBuffer0 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexLayout, BGFX_BUFFER_COMPUTE_READ_WRITE); + m_prevPositionBuffer1 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexLayout, BGFX_BUFFER_COMPUTE_READ_WRITE); u_params = bgfx::createUniform("u_params", bgfx::UniformType::Vec4, 3); @@ -207,9 +207,8 @@ public: bgfx::setBuffer(1, m_currPositionBuffer0, bgfx::Access::Write); bgfx::dispatch(0, m_initInstancesProgram, kMaxParticleCount / kThreadGroupUpdateSize, 1, 1); - float initialPos[3] = { 0.0f, 0.0f, -45.0f }; cameraCreate(); - cameraSetPosition(initialPos); + cameraSetPosition({ 0.0f, 0.0f, -45.0f }); cameraSetVerticalAngle(0.0f); m_useIndirect = false; @@ -459,4 +458,9 @@ public: } // namespace -ENTRY_IMPLEMENT_MAIN(ExampleNbody, "24-nbody", "N-body simulation with compute shaders using buffers."); +ENTRY_IMPLEMENT_MAIN( + ExampleNbody + , "24-nbody" + , "N-body simulation with compute shaders using buffers." + , "https://bkaradzic.github.io/bgfx/examples.html#nbody" + ); |