This commit is contained in:
Branimir Karadžić 2015-10-23 20:52:22 -07:00
parent 6ffdb3e247
commit 1c51d81006
22 changed files with 97 additions and 54 deletions

View file

@ -57,14 +57,16 @@ static const uint16_t s_cubeIndices[36] =
class Cubes : public entry::AppI
{
void init(int /*_argc*/, char** /*_argv*/) BX_OVERRIDE
void init(int _argc, char** _argv) BX_OVERRIDE
{
Args args(_argc, _argv);
m_width = 1280;
m_height = 720;
m_debug = BGFX_DEBUG_TEXT;
m_reset = BGFX_RESET_VSYNC;
bgfx::init();
bgfx::init(args.m_type, args.m_pciId);
bgfx::reset(m_width, m_height, m_reset);
// Enable debug text.

View file

@ -4,7 +4,7 @@
*/
#include "common.h"
#include <bgfx/bgfx.h>
#include "bgfx_utils.h"
// embedded shaders
#include "vs_metaballs.bin.h"
@ -464,14 +464,16 @@ uint32_t triangulate(uint8_t* _result, uint32_t _stride, const float* __restrict
class Metaballs : public entry::AppI
{
void init(int /*_argc*/, char** /*_argv*/) BX_OVERRIDE
void init(int _argc, char** _argv) BX_OVERRIDE
{
Args args(_argc, _argv);
m_width = 1280;
m_height = 720;
m_debug = BGFX_DEBUG_TEXT;
m_reset = BGFX_RESET_VSYNC;
bgfx::init();
bgfx::init(args.m_type, args.m_pciId);
bgfx::reset(m_width, m_height, m_reset);
// Enable debug text.

View file

@ -102,14 +102,16 @@ void renderScreenSpaceQuad(uint32_t _view, bgfx::ProgramHandle _program, float _
}
}
int _main_(int /*_argc*/, char** /*_argv*/)
int _main_(int _argc, char** _argv)
{
Args args(_argc, _argv);
uint32_t width = 1280;
uint32_t height = 720;
uint32_t debug = BGFX_DEBUG_TEXT;
uint32_t reset = BGFX_RESET_VSYNC;
bgfx::init();
bgfx::init(args.m_type, args.m_pciId);
bgfx::reset(width, height, reset);
// Enable debug text.

View file

@ -6,14 +6,16 @@
#include "common.h"
#include "bgfx_utils.h"
int _main_(int /*_argc*/, char** /*_argv*/)
int _main_(int _argc, char** _argv)
{
Args args(_argc, _argv);
uint32_t width = 1280;
uint32_t height = 720;
uint32_t debug = BGFX_DEBUG_TEXT;
uint32_t reset = BGFX_RESET_VSYNC;
bgfx::init();
bgfx::init(args.m_type, args.m_pciId);
bgfx::reset(width, height, reset);
// Enable debug text.

View file

@ -55,14 +55,16 @@ static const uint16_t s_cubeIndices[36] =
6, 3, 7,
};
int _main_(int /*_argc*/, char** /*_argv*/)
int _main_(int _argc, char** _argv)
{
Args args(_argc, _argv);
uint32_t width = 1280;
uint32_t height = 720;
uint32_t debug = BGFX_DEBUG_TEXT;
uint32_t reset = BGFX_RESET_VSYNC;
bgfx::init();
bgfx::init(args.m_type, args.m_pciId);
bgfx::reset(width, height, reset);
// Enable debug text.

View file

@ -105,14 +105,16 @@ static const uint16_t s_cubeIndices[36] =
class Bump : public entry::AppI
{
void init(int /*_argc*/, char** /*_argv*/) BX_OVERRIDE
void init(int _argc, char** _argv) BX_OVERRIDE
{
Args args(_argc, _argv);
m_width = 1280;
m_height = 720;
m_debug = BGFX_DEBUG_TEXT;
m_reset = BGFX_RESET_VSYNC;
bgfx::init();
bgfx::init(args.m_type, args.m_pciId);
bgfx::reset(m_width, m_height, m_reset);
// Enable debug text.

View file

@ -364,8 +364,10 @@ private:
uint32_t m_maxBlocks;
};
int _main_(int /*_argc*/, char** /*_argv*/)
int _main_(int _argc, char** _argv)
{
Args args(_argc, _argv);
BgfxCallback callback;
BgfxAllocator allocator;
@ -376,9 +378,10 @@ int _main_(int /*_argc*/, char** /*_argv*/)
bgfx::RendererType::Enum renderers[bgfx::RendererType::Count];
uint8_t numRenderers = bgfx::getSupportedRenderers(renderers);
bgfx::init(
renderers[bx::getHPCounter() % numRenderers] /* randomize renderer */
, BGFX_PCI_ID_NONE
bgfx::init(bgfx::RendererType::Count == args.m_type
? renderers[bx::getHPCounter() % numRenderers] /* randomize renderer */
: args.m_type
, args.m_pciId
, 0
, &callback // custom callback handler
, &allocator // custom allocator

View file

@ -4,8 +4,8 @@
*/
#include "common.h"
#include "bgfx_utils.h"
#include <bgfx/bgfx.h>
#include <bx/timer.h>
#include <bx/string.h>
#include <bx/fpumath.h>
@ -46,15 +46,16 @@ TrueTypeHandle loadTtf(FontManager* _fm, const char* _filePath)
return invalid;
}
int _main_(int /*_argc*/, char** /*_argv*/)
int _main_(int _argc, char** _argv)
{
Args args(_argc, _argv);
uint32_t width = 1280;
uint32_t height = 720;
uint32_t debug = BGFX_DEBUG_TEXT;
uint32_t reset = BGFX_RESET_VSYNC;
bgfx::init();
bgfx::init(args.m_type, args.m_pciId);
bgfx::reset(width, height, reset);
// Enable debug text.

View file

@ -64,15 +64,16 @@ TrueTypeHandle loadTtf(FontManager* _fm, const char* _filePath)
return invalid;
}
int _main_(int /*_argc*/, char** /*_argv*/)
int _main_(int _argc, char** _argv)
{
Args args(_argc, _argv);
uint32_t width = 1280;
uint32_t height = 720;
uint32_t debug = BGFX_DEBUG_TEXT;
uint32_t reset = BGFX_RESET_VSYNC;
bgfx::init();
bgfx::init(args.m_type, args.m_pciId);
bgfx::reset(width, height, reset);
// Enable debug text.

View file

@ -23,14 +23,16 @@ KnightPos knightTour[8*4] =
{7,1}, {6,3}, {5,1}, {7,0}, {6,2}, {4,3}, {3,1}, {2,3},
};
int _main_(int /*_argc*/, char** /*_argv*/)
int _main_(int _argc, char** _argv)
{
Args args(_argc, _argv);
uint32_t width = 1280;
uint32_t height = 720;
uint32_t debug = BGFX_DEBUG_TEXT;
uint32_t reset = BGFX_RESET_VSYNC;
bgfx::init();
bgfx::init(args.m_type, args.m_pciId);
bgfx::reset(width, height, reset);
// Enable debug text.

View file

@ -828,15 +828,17 @@ struct Mesh
GroupArray m_groups;
};
int _main_(int /*_argc*/, char** /*_argv*/)
int _main_(int _argc, char** _argv)
{
Args args(_argc, _argv);
ViewState viewState(1280, 720);
ClearValues clearValues(0x30303000, 1.0f, 0);
uint32_t debug = BGFX_DEBUG_TEXT;
uint32_t reset = BGFX_RESET_VSYNC;
bgfx::init();
bgfx::init(args.m_type, args.m_pciId);
bgfx::reset(viewState.m_width, viewState.m_height, reset);
// Enable debug text.

View file

@ -1850,15 +1850,17 @@ bool clipTest(const float* _planes, uint8_t _planeNum, const Mesh& _mesh, const
return false;
}
int _main_(int /*_argc*/, char** /*_argv*/)
int _main_(int _argc, char** _argv)
{
Args args(_argc, _argv);
ViewState viewState(1280, 720);
ClearValues clearValues = {0x00000000, 1.0f, 0};
uint32_t debug = BGFX_DEBUG_TEXT;
uint32_t reset = BGFX_RESET_VSYNC;
bgfx::init();
bgfx::init(args.m_type, args.m_pciId);
bgfx::reset(viewState.m_width, viewState.m_height, reset);
// Enable debug text.

View file

@ -66,14 +66,16 @@ static const uint16_t s_planeIndices[] =
1, 3, 2,
};
int _main_(int /*_argc*/, char** /*_argv*/)
int _main_(int _argc, char** _argv)
{
Args args(_argc, _argv);
uint32_t width = 1280;
uint32_t height = 720;
uint32_t debug = BGFX_DEBUG_TEXT;
uint32_t reset = BGFX_RESET_VSYNC;
bgfx::init();
bgfx::init(args.m_type, args.m_pciId);
bgfx::reset(width, height, reset);
bgfx::RendererType::Enum renderer = bgfx::getRendererType();

View file

@ -1313,15 +1313,17 @@ struct ShadowMapSettings
#undef IMGUI_FLOAT_PARAM
};
int _main_(int /*_argc*/, char** /*_argv*/)
int _main_(int _argc, char** _argv)
{
Args args(_argc, _argv);
uint32_t debug = BGFX_DEBUG_TEXT;
uint32_t reset = BGFX_RESET_VSYNC;
ViewState viewState(1280, 720);
ClearValues clearValues(0x00000000, 1.0f, 0);
bgfx::init();
bgfx::init(args.m_type, args.m_pciId);
bgfx::reset(viewState.m_width, viewState.m_height, reset);
// Enable debug text.

View file

@ -3,10 +3,10 @@
* License: http://www.opensource.org/licenses/BSD-2-Clause
*/
#include <bgfx/bgfx.h>
#include <bx/uint32_t.h>
#include "common.h"
#include "bgfx_utils.h"
#include <bx/uint32_t.h>
#include "imgui/imgui.h"
// embedded shaders
@ -72,8 +72,10 @@ static const int64_t lowwm = 1000000/57;
class DrawStress : public entry::AppI
{
void init(int /*_argc*/, char** /*_argv*/) BX_OVERRIDE
void init(int _argc, char** _argv) BX_OVERRIDE
{
Args args(_argc, _argv);
m_width = 1280;
m_height = 720;
m_debug = BGFX_DEBUG_TEXT;
@ -91,7 +93,7 @@ class DrawStress : public entry::AppI
m_deltaTimeAvgNs = 0;
m_numFrames = 0;
bgfx::init();
bgfx::init(args.m_type, args.m_pciId);
bgfx::reset(m_width, m_height, m_reset);
const bgfx::Caps* caps = bgfx::getCaps();

View file

@ -213,14 +213,16 @@ struct LightProbe
bgfx::TextureHandle m_texIrr;
};
int _main_(int /*_argc*/, char** /*_argv*/)
int _main_(int _argc, char** _argv)
{
Args args(_argc, _argv);
uint32_t width = 1280;
uint32_t height = 720;
uint32_t debug = BGFX_DEBUG_TEXT;
uint32_t reset = BGFX_RESET_VSYNC;
bgfx::init();
bgfx::init(args.m_type, args.m_pciId);
bgfx::reset(width, height, reset);
// Enable debug text.

View file

@ -146,14 +146,16 @@ void screenSpaceQuad(float _textureWidth, float _textureHeight, bool _originBott
}
}
int _main_(int /*_argc*/, char** /*_argv*/)
int _main_(int _argc, char** _argv)
{
Args args(_argc, _argv);
uint32_t width = 1280;
uint32_t height = 720;
uint32_t debug = BGFX_DEBUG_TEXT;
uint32_t reset = BGFX_RESET_VSYNC;
bgfx::init();
bgfx::init(args.m_type, args.m_pciId);
bgfx::reset(width, height, reset);
// Create vertex stream declaration.

View file

@ -22,11 +22,11 @@
//
#include "common.h"
#include "bgfx_utils.h"
#include <stdio.h>
#include <math.h>
#include <bgfx/bgfx.h>
#include <bx/string.h>
#include <bx/timer.h>
#include "entry/entry.h"
@ -1201,14 +1201,16 @@ void renderDemo(struct NVGcontext* vg, float mx, float my, float width, float he
nvgRestore(vg);
}
int _main_(int /*_argc*/, char** /*_argv*/)
int _main_(int _argc, char** _argv)
{
Args args(_argc, _argv);
uint32_t width = 1280;
uint32_t height = 720;
uint32_t debug = BGFX_DEBUG_TEXT;
uint32_t reset = BGFX_RESET_VSYNC;
bgfx::init();
bgfx::init(args.m_type, args.m_pciId);
bgfx::reset(width, height, reset);
// Enable debug text.

View file

@ -215,14 +215,16 @@ void screenSpaceQuad(float _textureWidth, float _textureHeight, float _texelHalf
class Deferred : public entry::AppI
{
void init(int /*_argc*/, char** /*_argv*/) BX_OVERRIDE
void init(int _argc, char** _argv) BX_OVERRIDE
{
Args args(_argc, _argv);
m_width = 1280;
m_height = 720;
m_debug = BGFX_DEBUG_TEXT;
m_reset = BGFX_RESET_VSYNC;
bgfx::init();
bgfx::init(args.m_type, args.m_pciId);
bgfx::reset(m_width, m_height, m_reset);
// Enable m_debug text.

View file

@ -92,14 +92,16 @@ static const InputBinding s_bindings[] =
INPUT_BINDING_END
};
int _main_(int /*_argc*/, char** /*_argv*/)
int _main_(int _argc, char** _argv)
{
Args args(_argc, _argv);
uint32_t width = 1280;
uint32_t height = 720;
uint32_t debug = BGFX_DEBUG_TEXT;
uint32_t reset = BGFX_RESET_VSYNC;
bgfx::init();
bgfx::init(args.m_type, args.m_pciId);
bgfx::reset(width, height, reset);
const bgfx::Caps* caps = bgfx::getCaps();

View file

@ -30,14 +30,16 @@ struct PosColorVertex
bgfx::VertexDecl PosColorVertex::ms_decl;
int _main_(int /*_argc*/, char** /*_argv*/)
int _main_(int _argc, char** _argv)
{
Args args(_argc, _argv);
uint32_t width = 1280;
uint32_t height = 720;
uint32_t debug = BGFX_DEBUG_TEXT;
uint32_t reset = BGFX_RESET_VSYNC;
bgfx::init();
bgfx::init(args.m_type, args.m_pciId);
bgfx::reset(width, height, reset);
const bgfx::RendererType::Enum renderer = bgfx::getRendererType();

View file

@ -96,14 +96,16 @@ static const float s_quadVertices[] =
static const uint16_t s_quadIndices[] = { 0, 1, 2, 2, 3, 0, };
int _main_(int /*_argc*/, char** /*_argv*/)
int _main_(int _argc, char** _argv)
{
Args args(_argc, _argv);
uint32_t width = 1280;
uint32_t height = 720;
uint32_t debug = BGFX_DEBUG_TEXT;
uint32_t reset = BGFX_RESET_VSYNC;
bgfx::init();
bgfx::init(args.m_type, args.m_pciId);
bgfx::reset(width, height, reset);
// Enable debug text.