Previous 199869 Revisions Next

r36821 Tuesday 31st March, 2015 at 05:54:41 UTC by Curt Coder
(MESS) abc80: Added cassette sound. [Curt Coder]
[3rdparty/bgfx].editorconfig
[3rdparty/bgfx/3rdparty/stb]stb_image.c
[3rdparty/bgfx/examples/08-update]update.cpp
[3rdparty/bgfx/examples/12-lod]lod.cpp
[3rdparty/bgfx/examples/13-stencil]stencil.cpp
[3rdparty/bgfx/examples/20-nanovg]blendish.h nanovg.cpp
[3rdparty/bgfx/examples/24-nbody]nbody.cpp
[3rdparty/bgfx/src]renderer_gl.cpp
[3rdparty/bx/scripts]toolchain.lua
[3rdparty/bx/tools/bin/darwin]genie
[3rdparty/bx/tools/bin/linux]genie
[3rdparty/bx/tools/bin/windows]genie.exe
[3rdparty/genie]README.md
[3rdparty/genie/src/base]api.lua
[3rdparty/genie/src/host]scripts.c
[3rdparty/genie/src/tools]gcc.lua
[scripts]genie.lua
[src/mess/drivers]abc80.c
[src/mess/includes]abc80.h

trunk/3rdparty/bgfx/.editorconfig
r245332r245333
88insert_final_newline     = true
99trim_trailing_whitespace = true
1010
11[*.c99.h]
12indent_style = space
13
1411[*.md]
1512trim_trailing_whitespace = false
1613max_line_length = 80
trunk/3rdparty/bgfx/3rdparty/stb/stb_image.c
r245332r245333
187187
188188#ifndef STBI_NO_STDIO
189189
190#if defined(_MSC_VER) && _MSC_VER >= 1400
191#   if !defined(_CRT_SECURE_NO_WARNINGS)
192#      define _CRT_SECURE_NO_WARNINGS // suppress warnings about fopen()
193#   endif
194#   pragma warning(push)
195#   pragma warning(disable:4996)   // suppress even more warnings about fopen()
196#   pragma warning(disable:4312)   // warning C4312: 'type cast': conversion from 'int' to 'unsigned char *' of greater size
197#   pragma warning(disable:4456)   // warning C4456: declaration of 'k' hides previous local declaration
198#   pragma warning(disable:4457)   // warning C4457: declaration of 'y' hides function parameter
190#if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(_CRT_SECURE_NO_WARNINGS)
191#define _CRT_SECURE_NO_WARNINGS // suppress warnings about fopen()
192#pragma warning(push)
193#pragma warning(disable:4996)   // suppress even more warnings about fopen()
199194#endif
200195#include <stdio.h>
201196#endif // STBI_NO_STDIO
trunk/3rdparty/bgfx/examples/08-update/update.cpp
r245332r245333
292292
293293            for (uint32_t ii = 0, num = bx::uint32_min(10, (uint32_t)quads.size() ); ii < num; ++ii)
294294            {
295               cube.clear(quads.front() );
295               const PackCube& face = quads.front();
296               cube.clear(face);
296297               quads.pop_front();
297298            }
298299         }
trunk/3rdparty/bgfx/examples/12-lod/lod.cpp
r245332r245333
2020   {0,0}, {1,2}, {3,3}, {4,1}, {5,3}, {7,2}, {6,0}, {5,2},
2121   {7,3}, {6,1}, {4,0}, {3,2}, {2,0}, {0,1}, {1,3}, {2,1},
2222   {0,2}, {1,0}, {2,2}, {0,3}, {1,1}, {3,0}, {4,2}, {5,0},
23   {7,1}, {6,3}, {5,1}, {7,0}, {6,2}, {4,3}, {3,1}, {2,3},
23   {7,1}, {6,3}, {5,1}, {7,0}, {6,2}, {4,3}, {3,1}, {2,3}
2424};
2525
2626int _main_(int /*_argc*/, char** /*_argv*/)
r245332r245333
5555
5656   bgfx::TextureHandle textureStipple;
5757
58   const bgfx::Memory* stippleTex = bgfx::alloc(8*4);
59   memset(stippleTex->data, 0, stippleTex->size);
58   const bgfx::Memory* stipple = bgfx::alloc(8*4);
59   memset(stipple->data, 0, stipple->size);
6060
6161   for (uint32_t ii = 0; ii < 32; ++ii)
6262   {
63      stippleTex->data[knightTour[ii].m_y * 8 + knightTour[ii].m_x] = ii*4;
63      stipple->data[knightTour[ii].m_y * 8 + knightTour[ii].m_x] = ii*4;
6464   }
6565
66   textureStipple = bgfx::createTexture2D(8, 4, 1
67         , bgfx::TextureFormat::R8
68         , BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIN_POINT
69         , stippleTex
70         );
66   textureStipple = bgfx::createTexture2D(8, 4, 1, bgfx::TextureFormat::R8, BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIN_POINT, stipple);
7167
7268   Mesh* meshTop[3] =
7369   {
trunk/3rdparty/bgfx/examples/13-stencil/stencil.cpp
r245332r245333
13191319                  );
13201320
13211321               // Cubes.
1322               for (uint8_t jj = 0; jj < numCubes; ++jj)
1322               for (uint8_t ii = 0; ii < numCubes; ++ii)
13231323               {
13241324                  cubeMesh.submit(viewId
1325                     , cubeMtx[jj]
1325                     , cubeMtx[ii]
13261326                     , programTextureLightning
13271327                     , s_renderStates[RenderState::ProjectionShadows_DrawDiffuse]
13281328                     , figureTex
trunk/3rdparty/bgfx/examples/20-nanovg/blendish.h
r245332r245333
11091109    #pragma warning (disable: 4100) // Switch off unreferenced formal parameter warnings
11101110    #pragma warning (disable: 4244)
11111111    #pragma warning (disable: 4305)
1112    #pragma warning (disable: 4838) // warning C4838: conversion from 'double' to 'float' requires a narrowing conversion
11131112    #ifdef __cplusplus
11141113    #define BND_INLINE inline
11151114    #else
trunk/3rdparty/bgfx/examples/20-nanovg/nanovg.cpp
r245332r245333
10421042            for (j = 0; j < nglyphs; j++) {
10431043               float x0 = glyphs[j].x;
10441044               float x1 = (j+1 < nglyphs) ? glyphs[j+1].x : x+row->width;
1045               float tgx = x0 * 0.3f + x1 * 0.7f;
1046               if (mx >= px && mx < tgx)
1045               float gx = x0 * 0.3f + x1 * 0.7f;
1046               if (mx >= px && mx < gx)
10471047                  caretx = glyphs[j].x;
1048               px = tgx;
1048               px = gx;
10491049            }
10501050            nvgBeginPath(vg);
10511051            nvgFillColor(vg, nvgRGBA(255,192,0,255));
trunk/3rdparty/bgfx/examples/24-nbody/nbody.cpp
r245332r245333
117117      , 0
118118      );
119119
120   const bgfx::Caps* caps = bgfx::getCaps();
121   const bool computeSupported = !!(caps->supported & BGFX_CAPS_COMPUTE);
120   // Imgui.
121   imguiCreate();
122122
123   if (computeSupported)
124   {
125      // Imgui.
126      imguiCreate();
123   bgfx::VertexDecl quadVertexDecl;
124   quadVertexDecl.begin()
125      .add(bgfx::Attrib::Position, 2, bgfx::AttribType::Float)
126      .end();
127127
128      bgfx::VertexDecl quadVertexDecl;
129      quadVertexDecl.begin()
130         .add(bgfx::Attrib::Position, 2, bgfx::AttribType::Float)
131         .end();
128   // Create static vertex buffer.
129   bgfx::VertexBufferHandle vbh = bgfx::createVertexBuffer(
130        // Static data can be passed with bgfx::makeRef
131        bgfx::makeRef(s_quadVertices, sizeof(s_quadVertices) )
132      , quadVertexDecl
133      );
132134
133      // Create static vertex buffer.
134      bgfx::VertexBufferHandle vbh = bgfx::createVertexBuffer(
135            // Static data can be passed with bgfx::makeRef
136            bgfx::makeRef(s_quadVertices, sizeof(s_quadVertices) )
137            , quadVertexDecl
138            );
135   // Create static index buffer.
136   bgfx::IndexBufferHandle ibh = bgfx::createIndexBuffer(
137      // Static data can be passed with bgfx::makeRef
138      bgfx::makeRef(s_quadIndices, sizeof(s_quadIndices) )
139      );
139140
140      // Create static index buffer.
141      bgfx::IndexBufferHandle ibh = bgfx::createIndexBuffer(
142            // Static data can be passed with bgfx::makeRef
143            bgfx::makeRef(s_quadIndices, sizeof(s_quadIndices) )
144            );
141   // Create particle program from shaders.
142   bgfx::ProgramHandle particleProgram = loadProgram("vs_particle", "fs_particle");
145143
146      // Create particle program from shaders.
147      bgfx::ProgramHandle particleProgram = loadProgram("vs_particle", "fs_particle");
144   // Setup compute buffers
145   bgfx::VertexDecl computeVertexDecl;
146   computeVertexDecl.begin()
147      .add(bgfx::Attrib::TexCoord0, 4, bgfx::AttribType::Float)
148      .end();
148149
149      // Setup compute buffers
150      bgfx::VertexDecl computeVertexDecl;
151      computeVertexDecl.begin()
152         .add(bgfx::Attrib::TexCoord0, 4, bgfx::AttribType::Float)
153         .end();
150   const uint32_t threadGroupUpdateSize = 512;
151   const uint32_t maxParticleCount = 32 * 1024;
154152
155      const uint32_t threadGroupUpdateSize = 512;
156      const uint32_t maxParticleCount = 32 * 1024;
153   bgfx::DynamicVertexBufferHandle currPositionBuffer0 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ_WRITE);
154   bgfx::DynamicVertexBufferHandle currPositionBuffer1 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ_WRITE);
155   bgfx::DynamicVertexBufferHandle prevPositionBuffer0 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ_WRITE);
156   bgfx::DynamicVertexBufferHandle prevPositionBuffer1 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ_WRITE);
157157
158      bgfx::DynamicVertexBufferHandle currPositionBuffer0 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ_WRITE);
159      bgfx::DynamicVertexBufferHandle currPositionBuffer1 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ_WRITE);
160      bgfx::DynamicVertexBufferHandle prevPositionBuffer0 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ_WRITE);
161      bgfx::DynamicVertexBufferHandle prevPositionBuffer1 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ_WRITE);
158   bgfx::UniformHandle u_params = bgfx::createUniform("u_params", bgfx::UniformType::Uniform4fv, 3);
162159
163      bgfx::UniformHandle u_params = bgfx::createUniform("u_params", bgfx::UniformType::Uniform4fv, 3);
160   bgfx::ShaderHandle  initInstancesShader    = loadShader("cs_init_instances");
161   bgfx::ProgramHandle initInstancesProgram   = bgfx::createProgram(initInstancesShader, true);
162   bgfx::ShaderHandle  updateInstancesShader  = loadShader("cs_update_instances");
163   bgfx::ProgramHandle updateInstancesProgram = bgfx::createProgram(updateInstancesShader, true);
164164
165      bgfx::ShaderHandle  initInstancesShader    = loadShader("cs_init_instances");
166      bgfx::ProgramHandle initInstancesProgram   = bgfx::createProgram(initInstancesShader, true);
167      bgfx::ShaderHandle  updateInstancesShader  = loadShader("cs_update_instances");
168      bgfx::ProgramHandle updateInstancesProgram = bgfx::createProgram(updateInstancesShader, true);
165   u_paramsDataStruct u_paramsData;
166   InitializeParams(0, &u_paramsData);
169167
170      u_paramsDataStruct u_paramsData;
171      InitializeParams(0, &u_paramsData);
168   bgfx::setUniform(u_params, &u_paramsData, 3);
169   bgfx::setBuffer(0, prevPositionBuffer0, bgfx::Access::Write);
170   bgfx::setBuffer(1, currPositionBuffer0, bgfx::Access::Write);
171   bgfx::dispatch(0, initInstancesProgram, maxParticleCount / threadGroupUpdateSize, 1, 1);
172172
173      bgfx::setUniform(u_params, &u_paramsData, 3);
174      bgfx::setBuffer(0, prevPositionBuffer0, bgfx::Access::Write);
175      bgfx::setBuffer(1, currPositionBuffer0, bgfx::Access::Write);
176      bgfx::dispatch(0, initInstancesProgram, maxParticleCount / threadGroupUpdateSize, 1, 1);
173   float view[16];
174   float initialPos[3] = { 0.0f, 0.0f, -45.0f };
175   cameraCreate();
176   cameraSetPosition(initialPos);
177   cameraSetVerticalAngle(0.0f);
178   cameraGetViewMtx(view);
177179
178      float view[16];
179      float initialPos[3] = { 0.0f, 0.0f, -45.0f };
180      cameraCreate();
181      cameraSetPosition(initialPos);
182      cameraSetVerticalAngle(0.0f);
183      cameraGetViewMtx(view);
180   int32_t scrollArea = 0;
184181
185      int32_t scrollArea = 0;
182   entry::MouseState mouseState;
183   while (!entry::processEvents(width, height, debug, reset, &mouseState) )
184   {
185      int64_t now = bx::getHPCounter();
186      static int64_t last = now;
187      const int64_t frameTime = now - last;
188      last = now;
189      const double freq = double(bx::getHPFrequency() );
190      const float deltaTime = float(frameTime/freq);
186191
187      entry::MouseState mouseState;
188      while (!entry::processEvents(width, height, debug, reset, &mouseState) )
189      {
190         int64_t now = bx::getHPCounter();
191         static int64_t last = now;
192         const int64_t frameTime = now - last;
193         last = now;
194         const double freq = double(bx::getHPFrequency() );
195         const float deltaTime = float(frameTime/freq);
192      // Set view 0 default viewport.
193      bgfx::setViewRect(0, 0, 0, width, height);
196194
197         // Set view 0 default viewport.
198         bgfx::setViewRect(0, 0, 0, width, height);
195      // Use debug font to print information about this example.
196      bgfx::dbgTextClear();
197      bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/24-nbody");
198      bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: N-body simulation with compute shaders using buffers.");
199199
200         // Use debug font to print information about this example.
201         bgfx::dbgTextClear();
202         bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/24-nbody");
203         bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: N-body simulation with compute shaders using buffers.");
200      imguiBeginFrame(mouseState.m_mx
201         , mouseState.m_my
202         , (mouseState.m_buttons[entry::MouseButton::Left  ] ? IMGUI_MBUT_LEFT  : 0)
203         | (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
204         , 0
205         , width
206         , height
207         );
208      imguiBeginScrollArea("Settings", width - width / 4 - 10, 10, width / 4, 500, &scrollArea);
209      imguiSlider("Random seed", u_paramsData.baseSeed, 0, 100);
210      int32_t shape = imguiChoose(u_paramsData.initialShape, "Point", "Sphere", "Box", "Donut");
211      imguiSlider("Initial speed", u_paramsData.initialSpeed, 0.0f, 300.0f, 0.1f);
212      bool reset = imguiButton("Reset");
213      imguiSeparatorLine();
214      imguiSlider("Particle count (x512)", u_paramsData.dispatchSize, 1, 64);
215      imguiSlider("Gravity", u_paramsData.gravity, 0.0f, 0.3f, 0.001f);
216      imguiSlider("Damping", u_paramsData.damping, 0.0f, 1.0f, 0.01f);
217      imguiSlider("Max acceleration", u_paramsData.maxAccel, 0.0f, 100.0f, 0.01f);
218      imguiSlider("Time step", u_paramsData.timeStep, 0.0f, 0.02f, 0.0001f);
219      imguiSeparatorLine();
220      imguiSlider("Particle intensity", u_paramsData.particleIntensity, 0.0f, 1.0f, 0.001f);
221      imguiSlider("Particle size", u_paramsData.particleSize, 0.0f, 1.0f, 0.001f);
222      imguiSlider("Particle power", u_paramsData.particlePower, 0.001f, 16.0f, 0.01f);
223      imguiEndScrollArea();
224      imguiEndFrame();
204225
205         imguiBeginFrame(mouseState.m_mx
206               , mouseState.m_my
207               , (mouseState.m_buttons[entry::MouseButton::Left  ] ? IMGUI_MBUT_LEFT  : 0)
208               | (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
209               , 0
210               , width
211               , height
212               );
213         imguiBeginScrollArea("Settings", width - width / 4 - 10, 10, width / 4, 500, &scrollArea);
214         imguiSlider("Random seed", u_paramsData.baseSeed, 0, 100);
215         int32_t shape = imguiChoose(u_paramsData.initialShape, "Point", "Sphere", "Box", "Donut");
216         imguiSlider("Initial speed", u_paramsData.initialSpeed, 0.0f, 300.0f, 0.1f);
217         bool defaults = imguiButton("Reset");
218         imguiSeparatorLine();
219         imguiSlider("Particle count (x512)", u_paramsData.dispatchSize, 1, 64);
220         imguiSlider("Gravity", u_paramsData.gravity, 0.0f, 0.3f, 0.001f);
221         imguiSlider("Damping", u_paramsData.damping, 0.0f, 1.0f, 0.01f);
222         imguiSlider("Max acceleration", u_paramsData.maxAccel, 0.0f, 100.0f, 0.01f);
223         imguiSlider("Time step", u_paramsData.timeStep, 0.0f, 0.02f, 0.0001f);
224         imguiSeparatorLine();
225         imguiSlider("Particle intensity", u_paramsData.particleIntensity, 0.0f, 1.0f, 0.001f);
226         imguiSlider("Particle size", u_paramsData.particleSize, 0.0f, 1.0f, 0.001f);
227         imguiSlider("Particle power", u_paramsData.particlePower, 0.001f, 16.0f, 0.01f);
228         imguiEndScrollArea();
229         imguiEndFrame();
226      // Modify parameters and reset if shape is changed
227      if (shape != u_paramsData.initialShape)
228      {
229         reset = true;
230         InitializeParams(shape, &u_paramsData);
231      }
230232
231         // Modify parameters and reset if shape is changed
232         if (shape != u_paramsData.initialShape)
233         {
234            defaults = true;
235            InitializeParams(shape, &u_paramsData);
236         }
237
238         if (defaults)
239         {
240            bgfx::setBuffer(0, prevPositionBuffer0, bgfx::Access::Write);
241            bgfx::setBuffer(1, currPositionBuffer0, bgfx::Access::Write);
242            bgfx::setUniform(u_params, &u_paramsData, 3);
243            bgfx::dispatch(0, initInstancesProgram, maxParticleCount / threadGroupUpdateSize, 1, 1);
244         }
245
246         bgfx::setBuffer(0, prevPositionBuffer0, bgfx::Access::Read);
247         bgfx::setBuffer(1, currPositionBuffer0, bgfx::Access::Read);
248         bgfx::setBuffer(2, prevPositionBuffer1, bgfx::Access::Write);
249         bgfx::setBuffer(3, currPositionBuffer1, bgfx::Access::Write);
233      if (reset)
234      {
235         bgfx::setBuffer(0, prevPositionBuffer0, bgfx::Access::Write);
236         bgfx::setBuffer(1, currPositionBuffer0, bgfx::Access::Write);
250237         bgfx::setUniform(u_params, &u_paramsData, 3);
251         bgfx::dispatch(0, updateInstancesProgram, u_paramsData.dispatchSize, 1, 1);
238         bgfx::dispatch(0, initInstancesProgram, maxParticleCount / threadGroupUpdateSize, 1, 1);
239      }
252240
253         bx::xchg(currPositionBuffer0, currPositionBuffer1);
254         bx::xchg(prevPositionBuffer0, prevPositionBuffer1);
241      bgfx::setBuffer(0, prevPositionBuffer0, bgfx::Access::Read);
242      bgfx::setBuffer(1, currPositionBuffer0, bgfx::Access::Read);
243      bgfx::setBuffer(2, prevPositionBuffer1, bgfx::Access::Write);
244      bgfx::setBuffer(3, currPositionBuffer1, bgfx::Access::Write);
245      bgfx::setUniform(u_params, &u_paramsData, 3);
246      bgfx::dispatch(0, updateInstancesProgram, u_paramsData.dispatchSize, 1, 1);
255247
256         // Update camera.
257         cameraUpdate(deltaTime, mouseState);
258         cameraGetViewMtx(view);
248      bx::xchg(currPositionBuffer0, currPositionBuffer1);
249      bx::xchg(prevPositionBuffer0, prevPositionBuffer1);
259250
260         // Set view and projection matrix for view 0.
261         const bgfx::HMD* hmd = bgfx::getHMD();
262         if (NULL != hmd)
263         {
264            float viewHead[16];
265            float eye[3] = {};
266            bx::mtxQuatTranslationHMD(viewHead, hmd->eye[0].rotation, eye);
251      float view[16];
267252
268            float tmp[16];
269            bx::mtxMul(tmp, view, viewHead);
253      // Update camera.
254      cameraUpdate(deltaTime, mouseState);
255      cameraGetViewMtx(view);
270256
271            float proj[16];
272            bx::mtxProj(proj, hmd->eye[0].fov, 0.1f, 10000.0f);
257      // Set view and projection matrix for view 0.
258      const bgfx::HMD* hmd = bgfx::getHMD();
259      if (NULL != hmd)
260      {
261         float viewHead[16];
262         float eye[3] = {};
263         bx::mtxQuatTranslationHMD(viewHead, hmd->eye[0].rotation, eye);
273264
274            bgfx::setViewTransform(0, tmp, proj);
265         float tmp[16];
266         bx::mtxMul(tmp, view, viewHead);
275267
276            // Set view 0 default viewport.
277            //
278            // Use HMD's width/height since HMD's internal frame buffer size
279            // might be much larger than window size.
280            bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height);
281         }
282         else
283         {
284            float proj[16];
285            bx::mtxProj(proj, 90.0f, float(width)/float(height), 0.1f, 10000.0f);
286            bgfx::setViewTransform(0, view, proj);
268         float proj[16];
269         bx::mtxProj(proj, hmd->eye[0].fov, 0.1f, 10000.0f);
287270
288            // Set view 0 default viewport.
289            bgfx::setViewRect(0, 0, 0, width, height);
290         }
271         bgfx::setViewTransform(0, tmp, proj);
291272
292         // Set vertex and fragment shaders.
293         bgfx::setProgram(particleProgram);
294
295         // Set vertex and index buffer.
296         bgfx::setVertexBuffer(vbh);
297         bgfx::setIndexBuffer(ibh);
298         bgfx::setInstanceDataBuffer(currPositionBuffer0, 0, u_paramsData.dispatchSize * threadGroupUpdateSize);
299
300         // Set render states.
301         bgfx::setState(0
302               | BGFX_STATE_RGB_WRITE
303               | BGFX_STATE_BLEND_ADD
304               | BGFX_STATE_DEPTH_TEST_ALWAYS
305               );
306
307         // Submit primitive for rendering to view 0.
308         bgfx::submit(0);
309
310         // Advance to next frame. Rendering thread will be kicked to
311         // process submitted rendering primitives.
312         bgfx::frame();
273         // Set view 0 default viewport.
274         //
275         // Use HMD's width/height since HMD's internal frame buffer size
276         // might be much larger than window size.
277         bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height);
313278      }
314
315      // Cleanup.
316      cameraDestroy();
317      imguiDestroy();
318      bgfx::destroyUniform(u_params);
319      bgfx::destroyDynamicVertexBuffer(currPositionBuffer0);
320      bgfx::destroyDynamicVertexBuffer(currPositionBuffer1);
321      bgfx::destroyDynamicVertexBuffer(prevPositionBuffer0);
322      bgfx::destroyDynamicVertexBuffer(prevPositionBuffer1);
323      bgfx::destroyProgram(updateInstancesProgram);
324      bgfx::destroyProgram(initInstancesProgram);
325      bgfx::destroyIndexBuffer(ibh);
326      bgfx::destroyVertexBuffer(vbh);
327      bgfx::destroyProgram(particleProgram);
328   }
329   else
330   {
331      int64_t timeOffset = bx::getHPCounter();
332
333      entry::MouseState mouseState;
334      while (!entry::processEvents(width, height, debug, reset, &mouseState) )
279      else
335280      {
336         int64_t now = bx::getHPCounter();
337         float time = (float)( (now - timeOffset)/double(bx::getHPFrequency() ) );
281         float proj[16];
282         bx::mtxProj(proj, 90.0f, float(width)/float(height), 0.1f, 10000.0f);
283         bgfx::setViewTransform(0, view, proj);
338284
285         // Set view 0 default viewport.
339286         bgfx::setViewRect(0, 0, 0, width, height);
287      }
340288
341         bgfx::dbgTextClear();
342         bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/24-nbody");
343         bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: N-body simulation with compute shaders using buffers.");
289      // Set vertex and fragment shaders.
290      bgfx::setProgram(particleProgram);
344291
345         bool blink = uint32_t(time*3.0f)&1;
346         bgfx::dbgTextPrintf(0, 5, blink ? 0x1f : 0x01, " Compute is not supported by GPU. ");
292      // Set vertex and index buffer.
293      bgfx::setVertexBuffer(vbh);
294      bgfx::setIndexBuffer(ibh);
295      bgfx::setInstanceDataBuffer(currPositionBuffer0, 0, u_paramsData.dispatchSize * threadGroupUpdateSize);
347296
348         bgfx::submit(0);
349         bgfx::frame();
350      }
297      // Set render states.
298      bgfx::setState(0
299         | BGFX_STATE_RGB_WRITE
300         | BGFX_STATE_BLEND_ADD
301         | BGFX_STATE_DEPTH_TEST_ALWAYS
302         );
303
304      // Submit primitive for rendering to view 0.
305      bgfx::submit(0);
306
307      // Advance to next frame. Rendering thread will be kicked to
308      // process submitted rendering primitives.
309      bgfx::frame();
351310   }
352311
312   // Cleanup.
313   cameraDestroy();
314   imguiDestroy();
315   bgfx::destroyUniform(u_params);
316   bgfx::destroyDynamicVertexBuffer(currPositionBuffer0);
317   bgfx::destroyDynamicVertexBuffer(currPositionBuffer1);
318   bgfx::destroyDynamicVertexBuffer(prevPositionBuffer0);
319   bgfx::destroyDynamicVertexBuffer(prevPositionBuffer1);
320   bgfx::destroyProgram(updateInstancesProgram);
321   bgfx::destroyProgram(initInstancesProgram);
322   bgfx::destroyIndexBuffer(ibh);
323   bgfx::destroyVertexBuffer(vbh);
324   bgfx::destroyProgram(particleProgram);
325
353326   // Shutdown bgfx.
354327   bgfx::shutdown();
355328
trunk/3rdparty/bgfx/src/renderer_gl.cpp
r245332r245333
13521352
13531353         if (BX_ENABLED(BX_PLATFORM_NACL) )
13541354         {
1355            m_vaoSupport &= true
1356               && NULL != glGenVertexArrays
1355            m_vaoSupport &= NULL != glGenVertexArrays
13571356               && NULL != glDeleteVertexArrays
13581357               && NULL != glBindVertexArray
13591358               ;
r245332r245333
14001399            || s_extension[Extension::EXT_timer_query         ].m_supported
14011400            ;
14021401
1403         m_timerQuerySupport &= NULL != glGetQueryObjectui64v;
1404
14051402         g_caps.supported |= m_depthTextureSupport
14061403            ? BGFX_CAPS_TEXTURE_COMPARE_LEQUAL
14071404            : 0
trunk/3rdparty/bx/scripts/toolchain.lua
r245332r245333
4040      allowed = {
4141         { "vs2012-clang",  "Clang 3.6"         },
4242         { "vs2013-clang",  "Clang 3.6"         },
43         { "vs2012-xp",     "Visual Studio 2012 targeting XP" },
44         { "vs2013-xp",     "Visual Studio 2013 targeting XP" },
45         { "vs2015-xp",     "Visual Studio 2015 targeting XP" },
43         { "vs2012-xp",       "Visual Studio 2012 targeting XP" },
44         { "vs2013-xp",       "Visual Studio 2013 targeting XP" },
4645         { "winphone8",     "Windows Phone 8.0" },
4746         { "winphone81",    "Windows Phone 8.1" },
4847      },
r245332r245333
111110         premake.gcc.cxx = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-g++"
112111         premake.gcc.ar  = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-ar"
113112         location (path.join(_buildDir, "projects", _ACTION .. "-android-arm"))
113      end
114114
115      elseif "android-mips" == _OPTIONS["gcc"] then
115      if "android-mips" == _OPTIONS["gcc"] then
116116
117117         if not os.getenv("ANDROID_NDK_MIPS") or not os.getenv("ANDROID_NDK_ROOT") then
118118            print("Set ANDROID_NDK_MIPS and ANDROID_NDK_ROOT envrionment variables.")
r245332r245333
122122         premake.gcc.cxx = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-g++"
123123         premake.gcc.ar  = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-ar"
124124         location (path.join(_buildDir, "projects", _ACTION .. "-android-mips"))
125      end
125126
126      elseif "android-x86" == _OPTIONS["gcc"] then
127      if "android-x86" == _OPTIONS["gcc"] then
127128
128129         if not os.getenv("ANDROID_NDK_X86") or not os.getenv("ANDROID_NDK_ROOT") then
129130            print("Set ANDROID_NDK_X86 and ANDROID_NDK_ROOT envrionment variables.")
r245332r245333
133134         premake.gcc.cxx = "$(ANDROID_NDK_X86)/bin/i686-linux-android-g++"
134135         premake.gcc.ar  = "$(ANDROID_NDK_X86)/bin/i686-linux-android-ar"
135136         location (path.join(_buildDir, "projects", _ACTION .. "-android-x86"))
137      end
136138
137      elseif "asmjs" == _OPTIONS["gcc"] then
139      if "asmjs" == _OPTIONS["gcc"] then
138140
139141         if not os.getenv("EMSCRIPTEN") then
140142            print("Set EMSCRIPTEN enviroment variables.")
r245332r245333
145147         premake.gcc.ar   = "$(EMSCRIPTEN)/emar"
146148         premake.gcc.llvm = true
147149         location (path.join(_buildDir, "projects", _ACTION .. "-asmjs"))
150      end
148151
149      elseif "freebsd" == _OPTIONS["gcc"] then
152      if "freebsd" == _OPTIONS["gcc"] then
150153         location (path.join(_buildDir, "projects", _ACTION .. "-freebsd"))
154      end
151155
152      elseif "ios-arm" == _OPTIONS["gcc"] then
156      if "ios-arm" == _OPTIONS["gcc"] then
153157         premake.gcc.cc  = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
154158         premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
155159         premake.gcc.ar  = "ar"
156160         location (path.join(_buildDir, "projects", _ACTION .. "-ios-arm"))
161      end
157162
158      elseif "ios-simulator" == _OPTIONS["gcc"] then
163      if "ios-simulator" == _OPTIONS["gcc"] then
159164         premake.gcc.cc  = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
160165         premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
161166         premake.gcc.ar  = "ar"
162167         location (path.join(_buildDir, "projects", _ACTION .. "-ios-simulator"))
168      end
163169
164      elseif "linux-gcc" == _OPTIONS["gcc"] then
170      if "linux-gcc" == _OPTIONS["gcc"] then
165171         location (path.join(_buildDir, "projects", _ACTION .. "-linux"))
172      end
166173
167      elseif "linux-clang" == _OPTIONS["gcc"] then
174      if "linux-clang" == _OPTIONS["gcc"] then
168175         premake.gcc.cc  = "clang"
169176         premake.gcc.cxx = "clang++"
170177         premake.gcc.ar  = "ar"
171178         location (path.join(_buildDir, "projects", _ACTION .. "-linux-clang"))
179      end
172180
173      elseif "mingw-gcc" == _OPTIONS["gcc"] then
181      if "mingw-gcc" == _OPTIONS["gcc"] then
174182         premake.gcc.cc  = "$(MINGW)/bin/x86_64-w64-mingw32-gcc"
175183         premake.gcc.cxx = "$(MINGW)/bin/x86_64-w64-mingw32-g++"
176184         premake.gcc.ar  = "$(MINGW)/bin/ar"
177185         location (path.join(_buildDir, "projects", _ACTION .. "-mingw-gcc"))
186      end
178187
179      elseif "mingw-clang" == _OPTIONS["gcc"] then
188      if "mingw-clang" == _OPTIONS["gcc"] then
180189         premake.gcc.cc   = "$(CLANG)/bin/clang"
181190         premake.gcc.cxx  = "$(CLANG)/bin/clang++"
182191         premake.gcc.ar   = "$(MINGW)/bin/ar"
183192--         premake.gcc.ar   = "$(CLANG)/bin/llvm-ar"
184193--         premake.gcc.llvm = true
185194         location (path.join(_buildDir, "projects", _ACTION .. "-mingw-clang"))
195      end
186196
187      elseif "nacl" == _OPTIONS["gcc"] then
197      if "nacl" == _OPTIONS["gcc"] then
188198
189199         if not os.getenv("NACL_SDK_ROOT") then
190200            print("Set NACL_SDK_ROOT enviroment variables.")
r245332r245333
201211         premake.gcc.cxx = naclToolchain .. "g++"
202212         premake.gcc.ar  = naclToolchain .. "ar"
203213         location (path.join(_buildDir, "projects", _ACTION .. "-nacl"))
214      end
204215
205      elseif "nacl-arm" == _OPTIONS["gcc"] then
216      if "nacl-arm" == _OPTIONS["gcc"] then
206217
207218         if not os.getenv("NACL_SDK_ROOT") then
208219            print("Set NACL_SDK_ROOT enviroment variables.")
r245332r245333
219230         premake.gcc.cxx = naclToolchain .. "g++"
220231         premake.gcc.ar  = naclToolchain .. "ar"
221232         location (path.join(_buildDir, "projects", _ACTION .. "-nacl-arm"))
233      end
222234
223      elseif "osx" == _OPTIONS["gcc"] then
224
235      if "osx" == _OPTIONS["gcc"] then
225236         if os.is("linux") then
226237            local osxToolchain = "x86_64-apple-darwin13-"
227238            premake.gcc.cc  = osxToolchain .. "clang"
r245332r245333
229240            premake.gcc.ar  = osxToolchain .. "ar"
230241         end
231242         location (path.join(_buildDir, "projects", _ACTION .. "-osx"))
243      end
232244
233      elseif "pnacl" == _OPTIONS["gcc"] then
245      if "pnacl" == _OPTIONS["gcc"] then
234246
235247         if not os.getenv("NACL_SDK_ROOT") then
236248            print("Set NACL_SDK_ROOT enviroment variables.")
r245332r245333
247259         premake.gcc.cxx = naclToolchain .. "clang++"
248260         premake.gcc.ar  = naclToolchain .. "ar"
249261         location (path.join(_buildDir, "projects", _ACTION .. "-pnacl"))
262      end
250263
251      elseif "qnx-arm" == _OPTIONS["gcc"] then
264      if "qnx-arm" == _OPTIONS["gcc"] then
252265
253266         if not os.getenv("QNX_HOST") then
254267            print("Set QNX_HOST enviroment variables.")
r245332r245333
258271         premake.gcc.cxx = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-g++"
259272         premake.gcc.ar  = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-ar"
260273         location (path.join(_buildDir, "projects", _ACTION .. "-qnx-arm"))
274      end
261275
262      elseif "rpi" == _OPTIONS["gcc"] then
276      if "rpi" == _OPTIONS["gcc"] then
263277         location (path.join(_buildDir, "projects", _ACTION .. "-rpi"))
264278      end
265279   elseif _ACTION == "vs2012" or _ACTION == "vs2013" or _ACTION == "vs2015" then
r245332r245333
267281      if (_ACTION .. "-clang") == _OPTIONS["vs"] then
268282         premake.vstudio.toolset = ("LLVM-" .. _ACTION)
269283         location (path.join(_buildDir, "projects", _ACTION .. "-clang"))
284      end
270285
271      elseif "winphone8" == _OPTIONS["vs"] then
286      if "winphone8" == _OPTIONS["vs"] then
272287         premake.vstudio.toolset = "v110_wp80"
273288         location (path.join(_buildDir, "projects", _ACTION .. "-winphone8"))
289      end
274290
275      elseif "winphone81" == _OPTIONS["vs"] then
291      if "winphone81" == _OPTIONS["vs"] then
276292         premake.vstudio.toolset = "v120_wp81"
277293         platforms { "ARM" }
278294         location (path.join(_buildDir, "projects", _ACTION .. "-winphone81"))
295      end
279296
280      elseif ("vs2012-xp") == _OPTIONS["vs"] then
297      if ("vs2012-xp") == _OPTIONS["vs"] then
281298         premake.vstudio.toolset = ("v110_xp")
282299         location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
300      end
283301
284      elseif ("vs2013-xp") == _OPTIONS["vs"] then
302      if ("vs2013-xp") == _OPTIONS["vs"] then
285303         premake.vstudio.toolset = ("v120_xp")
286304         location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
287
288      elseif ("vs2015-xp") == _OPTIONS["vs"] then
289         premake.vstudio.toolset = ("v140_xp")
290         location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
291305      end
292306
293307   elseif _ACTION == "xcode4" then
r245332r245333
295309      if "osx" == _OPTIONS["xcode"] then
296310         premake.xcode.toolset = "macosx"
297311         location (path.join(_buildDir, "projects", _ACTION .. "-osx"))
298
299      elseif "ios" == _OPTIONS["xcode"] then
312      end
313      if "ios" == _OPTIONS["xcode"] then
300314         premake.xcode.toolset = "iphoneos"
301315         location (path.join(_buildDir, "projects", _ACTION .. "-ios"))
302316      end
r245332r245333
746760   configuration { "osx", "x32" }
747761      targetdir (path.join(_buildDir, "osx32_clang/bin"))
748762      objdir (path.join(_buildDir, "osx32_clang/obj"))
749      --libdirs { path.join(_libDir, "lib/osx32_clang") }
763      libdirs { path.join(_libDir, "lib/osx32_clang") }
750764      buildoptions {
751765         "-m32",
752766      }
r245332r245333
754768   configuration { "osx", "x64" }
755769      targetdir (path.join(_buildDir, "osx64_clang/bin"))
756770      objdir (path.join(_buildDir, "osx64_clang/obj"))
757      --libdirs { path.join(_libDir, "lib/osx64_clang") }
771      libdirs { path.join(_libDir, "lib/osx64_clang") }
758772      buildoptions {
759773         "-m64",
760774      }
trunk/3rdparty/bx/tools/bin/darwin/genie
r245332r245333
Previous 199869 Revisions Next


© 1997-2024 The MAME Team