Previous 199869 Revisions Next

r36474 Thursday 19th March, 2015 at 07:40:37 UTC by Miodrag Milanović
update 3rdparty (nw)
[3rdparty/bgfx]README.md
[3rdparty/bgfx/3rdparty/ocornut-imgui]imgui.cpp
[3rdparty/bgfx/examples/25-c99]helloworld.c*
[3rdparty/bgfx/scripts]genie.lua
[3rdparty/bgfx/src]bgfx_shader.sh renderer_d3d11.cpp renderer_gl.cpp vertexdecl.cpp
[3rdparty/bgfx/tools/shaderc]shaderc.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/actions/make]make_cpp.lua
[3rdparty/genie/src/base]bake.lua
[3rdparty/genie/src/host]scripts.c

trunk/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp
r244985r244986
353353#endif
354354#ifdef __GNUC__
355355#pragma GCC diagnostic ignored "-Wunused-function"          // warning: 'xxxx' defined but not used
356#pragma GCC diagnostic ignored "-Wunused-parameter"         // warning: unused parameter ‘xxxx’
357#pragma GCC diagnostic ignored "-Wtype-limits"              // warning: comparison is always true due to limited range of data type
358#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"      // warning: ‘xxxx’ may be used uninitialized in this function
356359#endif
357360
358361//-------------------------------------------------------------------------
trunk/3rdparty/bgfx/README.md
r244985r244986
44What is it?
55-----------
66
7Cross-platform rendering library.
7Cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style
8rendering library.
89
910Supported rendering backends:
1011
trunk/3rdparty/bgfx/examples/25-c99/helloworld.c
r0r244986
1/*
2 * Copyright 2011-2015 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#include <bgfx.c99.h>
7#include "../00-helloworld/logo.h"
8
9extern bool entry_process_events(uint32_t* _width, uint32_t* _height, uint32_t* _debug, uint32_t* _reset);
10
11uint16_t uint16_max(uint16_t _a, uint16_t _b)
12{
13   return _a < _b ? _b : _a;
14}
15
16int _main_(int _argc, char** _argv)
17{
18   (void)_argc;
19   (void)_argv;
20   uint32_t width = 1280;
21   uint32_t height = 720;
22   uint32_t debug = BGFX_DEBUG_TEXT;
23   uint32_t reset = BGFX_RESET_VSYNC;
24
25   bgfx_init(BGFX_RENDERER_TYPE_COUNT, NULL, NULL);
26   bgfx_reset(width, height, reset);
27
28   // Enable debug text.
29   bgfx_set_debug(debug);
30
31   bgfx_set_view_clear(0
32      , BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH
33      , 0x303030ff
34      , 1.0f
35      , 0
36      );
37
38   while (!entry_process_events(&width, &height, &debug, &reset) )
39   {
40      // Set view 0 default viewport.
41      bgfx_set_view_rect(0, 0, 0, width, height);
42
43      // This dummy draw call is here to make sure that view 0 is cleared
44      // if no other draw calls are submitted to view 0.
45      bgfx_submit(0, 0);
46
47      // Use debug font to print information about this example.
48      bgfx_dbg_text_clear(0, false);
49      bgfx_dbg_text_image(uint16_max(width/2/8, 20)-20
50                   , uint16_max(height/2/16, 6)-6
51                   , 40
52                   , 12
53                   , s_logo
54                   , 160
55                   );
56      bgfx_dbg_text_printf(0, 1, 0x4f, "bgfx/examples/25-c99");
57      bgfx_dbg_text_printf(0, 2, 0x6f, "Description: Initialization and debug text with C99 API.");
58
59      // Advance to next frame. Rendering thread will be kicked to
60      // process submitted rendering primitives.
61      bgfx_frame();
62   }
63
64   // Shutdown bgfx.
65   bgfx_shutdown();
66
67   return 0;
68}
trunk/3rdparty/bgfx/scripts/genie.lua
r244985r244986
8484   end
8585
8686   includedirs {
87      path.join(BX_DIR, "include"),
87      path.join(BX_DIR,   "include"),
8888      path.join(BGFX_DIR, "include"),
8989      path.join(BGFX_DIR, "3rdparty"),
9090      path.join(BGFX_DIR, "examples/common"),
9191   }
9292
9393   files {
94      path.join(BGFX_DIR, "examples", _name, "**.c"),
9495      path.join(BGFX_DIR, "examples", _name, "**.cpp"),
9596      path.join(BGFX_DIR, "examples", _name, "**.h"),
9697   }
r244985r244986
308309exampleProject("22-windows")
309310exampleProject("23-vectordisplay")
310311exampleProject("24-nbody")
312exampleProject("25-c99")
311313
312314if _OPTIONS["with-shared-lib"] then
313315   group "libs"
trunk/3rdparty/bgfx/src/bgfx_shader.sh
r244985r244986
7474   Texture3D m_texture;
7575};
7676
77struct BgfxISampler3D
78{
79   Texture3D<ivec4> m_texture;
80};
81
82struct BgfxUSampler3D
83{
84   Texture3D<uvec4> m_texture;
85};
86
7787vec4 bgfxTexture3D(BgfxSampler3D _sampler, vec3 _coord)
7888{
7989   return _sampler.m_texture.Sample(_sampler.m_sampler, _coord);
r244985r244986
8494   return _sampler.m_texture.SampleLevel(_sampler.m_sampler, _coord, _level);
8595}
8696
97ivec4 bgfxTexture3D(BgfxISampler3D _sampler, vec3 _coord)
98{
99   ivec3 size;
100   _sampler.m_texture.GetDimensions(size.x, size.y, size.z);
101   return _sampler.m_texture.Load(ivec4(_coord * size, 0) );
102}
103
104uvec4 bgfxTexture3D(BgfxUSampler3D _sampler, vec3 _coord)
105{
106   uvec3 size;
107   _sampler.m_texture.GetDimensions(size.x, size.y, size.z);
108   return _sampler.m_texture.Load(uvec4(_coord * size, 0) );
109}
110
87111struct BgfxSamplerCube
88112{
89113   SamplerState m_sampler;
r244985r244986
121145         uniform SamplerState _name ## Sampler : register(s[_reg]); \
122146         uniform Texture3D _name ## Texture : register(t[_reg]); \
123147         static BgfxSampler3D _name = { _name ## Sampler, _name ## Texture }
148#      define ISAMPLER3D(_name, _reg) \
149         uniform Texture3D<ivec4> _name ## Texture : register(t[_reg]); \
150         static BgfxISampler3D _name = { _name ## Texture }
151#      define USAMPLER3D(_name, _reg) \
152         uniform Texture3D<uvec4> _name ## Texture : register(t[_reg]); \
153         static BgfxUSampler3D _name = { _name ## Texture }
124154#      define sampler3D BgfxSampler3D
125155#      define texture3D(_sampler, _coord) bgfxTexture3D(_sampler, _coord)
126156#      define texture3DLod(_sampler, _coord, _level) bgfxTexture3DLod(_sampler, _coord, _level)
r244985r244986
247277#   define uvec3_splat(_x) uvec3(_x)
248278#   define uvec4_splat(_x) uvec4(_x)
249279
280#   if BGFX_SHADER_LANGUAGE_GLSL >= 130
281#      define ISAMPLER3D(_name, _reg) uniform isampler3D _name
282#      define USAMPLER3D(_name, _reg) uniform usampler3D _name
283ivec4 texture3D(isampler3D _sampler, vec3 _coord) { return texture(_sampler, _coord); }
284uvec4 texture3D(usampler3D _sampler, vec3 _coord) { return texture(_sampler, _coord); }
285#   endif // BGFX_SHADER_LANGUAGE_GLSL >= 130
286
250287vec3 instMul(vec3 _vec, mat3 _mtx) { return mul(_vec, _mtx); }
251288vec3 instMul(mat3 _mtx, vec3 _vec) { return mul(_mtx, _vec); }
252289vec4 instMul(vec4 _vec, mat4 _mtx) { return mul(_vec, _mtx); }
trunk/3rdparty/bgfx/src/renderer_d3d11.cpp
r244985r244986
203203      { DXGI_FORMAT_UNKNOWN,            DXGI_FORMAT_UNKNOWN,               DXGI_FORMAT_UNKNOWN           }, // Unknown
204204      { DXGI_FORMAT_R1_UNORM,           DXGI_FORMAT_R1_UNORM,              DXGI_FORMAT_UNKNOWN           }, // R1
205205      { DXGI_FORMAT_R8_UNORM,           DXGI_FORMAT_R8_UNORM,              DXGI_FORMAT_UNKNOWN           }, // R8
206      { DXGI_FORMAT_R16_UNORM,          DXGI_FORMAT_R16_UNORM,             DXGI_FORMAT_UNKNOWN           }, // R16
206      { DXGI_FORMAT_R16_UINT,          DXGI_FORMAT_R16_UINT,              DXGI_FORMAT_UNKNOWN           }, // R16
207207      { DXGI_FORMAT_R16_FLOAT,          DXGI_FORMAT_R16_FLOAT,             DXGI_FORMAT_UNKNOWN           }, // R16F
208208      { DXGI_FORMAT_R32_UINT,           DXGI_FORMAT_R32_UINT,              DXGI_FORMAT_UNKNOWN           }, // R32
209209      { DXGI_FORMAT_R32_FLOAT,          DXGI_FORMAT_R32_FLOAT,             DXGI_FORMAT_UNKNOWN           }, // R32F
trunk/3rdparty/bgfx/src/renderer_gl.cpp
r244985r244986
721721      "usampler3D",
722722      "isamplerCube",
723723      "usamplerCube",
724      NULL
724725   };
725726
726727   static void GL_APIENTRY stubVertexAttribDivisor(GLuint /*_index*/, GLuint /*_divisor*/)
trunk/3rdparty/bgfx/src/vertexdecl.cpp
r244985r244986
4141
4242   static const uint8_t (*s_attribTypeSize[])[AttribType::Count][4] =
4343   {
44#if BGFX_CONFIG_RENDERER_DIRECT3D9
45      &s_attribTypeSizeDx9,
46#elif BGFX_CONFIG_RENDERER_DIRECT3D11 || BGFX_CONFIG_RENDERER_DIRECT3D12
47      &s_attribTypeSizeDx1x,
48#elif BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_VULKAN
49      &s_attribTypeSizeGl,
50#else
51      &s_attribTypeSizeDx9,
52#endif // BGFX_CONFIG_RENDERER_
44      &s_attribTypeSizeDx9,  // Null
5345      &s_attribTypeSizeDx9,  // Direct3D9
5446      &s_attribTypeSizeDx1x, // Direct3D11
5547      &s_attribTypeSizeDx1x, // Direct3D12
5648      &s_attribTypeSizeGl,   // OpenGLES
5749      &s_attribTypeSizeGl,   // OpenGL
5850      &s_attribTypeSizeGl,   // Vulkan
51      &s_attribTypeSizeDx9,  // Count
5952   };
60   BX_STATIC_ASSERT(BX_COUNTOF(s_attribTypeSize) == bgfx::RendererType::Count);
53   BX_STATIC_ASSERT(BX_COUNTOF(s_attribTypeSize) == RendererType::Count+1);
6154
6255   void initAttribTypeSizeTable(RendererType::Enum _type)
6356   {
64      s_attribTypeSize[0] = s_attribTypeSize[_type];
57      s_attribTypeSize[0]                   = s_attribTypeSize[_type];
58      s_attribTypeSize[RendererType::Count] = s_attribTypeSize[_type];
6559   }
6660
6761   void dbgPrintfVargs(const char* _format, va_list _argList)
trunk/3rdparty/bgfx/tools/shaderc/shaderc.cpp
r244985r244986
751751
752752   bool raw = cmdLine.hasArg('\0', "raw");
753753
754   uint32_t gles = 0;
754   uint32_t glsl = 0;
755   uint32_t essl = 0;
755756   uint32_t hlsl = 2;
756757   uint32_t d3d  = 11;
757758   const char* profile = cmdLine.findOption('p', "profile");
r244985r244986
774775      {
775776         hlsl = 5;
776777      }
778      else
779      {
780         glsl = atoi(profile);
781      }
777782   }
778783   else
779784   {
780      gles = 2;
785      essl = 2;
781786   }
782787
783788   const char* bin2c = NULL;
r244985r244986
811816   bool preprocessOnly = cmdLine.hasArg("preprocess");
812817   const char* includeDir = cmdLine.findOption('i');
813818
814   Preprocessor preprocessor(filePath, 0 != gles, includeDir);
819   Preprocessor preprocessor(filePath, 0 != essl, includeDir);
815820
816821   std::string dir;
817822   {
r244985r244986
839844   preprocessor.setDefaultDefine("BGFX_SHADER_TYPE_FRAGMENT");
840845   preprocessor.setDefaultDefine("BGFX_SHADER_TYPE_VERTEX");
841846
842   bool glsl = false;
847   char glslDefine[128];
848   bx::snprintf(glslDefine, BX_COUNTOF(glslDefine), "BGFX_SHADER_LANGUAGE_GLSL=%d", glsl);
843849
844850   if (0 == bx::stricmp(platform, "android") )
845851   {
846852      preprocessor.setDefine("BX_PLATFORM_ANDROID=1");
847853      preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1");
848      glsl = true;
849854   }
850855   else if (0 == bx::stricmp(platform, "asm.js") )
851856   {
852857      preprocessor.setDefine("BX_PLATFORM_EMSCRIPTEN=1");
853858      preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1");
854      glsl = true;
855859   }
856860   else if (0 == bx::stricmp(platform, "ios") )
857861   {
858862      preprocessor.setDefine("BX_PLATFORM_IOS=1");
859863      preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1");
860      glsl = true;
861864   }
862865   else if (0 == bx::stricmp(platform, "linux") )
863866   {
864867      preprocessor.setDefine("BX_PLATFORM_LINUX=1");
865      preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1");
866      glsl = true;
868      preprocessor.setDefine(glslDefine);
867869   }
868870   else if (0 == bx::stricmp(platform, "nacl") )
869871   {
870872      preprocessor.setDefine("BX_PLATFORM_NACL=1");
871873      preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1");
872      glsl = true;
873874   }
874875   else if (0 == bx::stricmp(platform, "osx") )
875876   {
876877      preprocessor.setDefine("BX_PLATFORM_OSX=1");
877      preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1");
878      glsl = true;
878      preprocessor.setDefine(glslDefine);
879879   }
880880   else if (0 == bx::stricmp(platform, "windows") )
881881   {
r244985r244986
11201120            bx::write(writer, outputHash);
11211121         }
11221122
1123         if (glsl)
1123         if (0 != glsl)
11241124         {
11251125            bx::write(writer, uint16_t(0) );
11261126
r244985r244986
11551155         }
11561156         else
11571157         {
1158            if (glsl)
1158            if (0 != glsl)
11591159            {
11601160            }
11611161            else
r244985r244986
12691269                  bx::write(writer, BGFX_CHUNK_MAGIC_CSH);
12701270                  bx::write(writer, outputHash);
12711271
1272                  if (glsl)
1272                  if (0 != glsl)
12731273                  {
12741274                     std::string code;
12751275
1276                     if (gles)
1276                     if (essl)
12771277                     {
12781278                        bx::stringPrintf(code, "#version 310 es\n");
12791279                     }
12801280                     else
12811281                     {
1282                        int32_t version = atoi(profile);
1283                        bx::stringPrintf(code, "#version %d\n", version == 0 ? 430 : version);
1282                        bx::stringPrintf(code, "#version %d\n", glsl == 0 ? 430 : glsl);
12841283                     }
12851284
12861285                     code += preprocessor.m_preprocessed;
r244985r244986
12941293
12951294                     compiled = true;
12961295#else
1297                     compiled = compileGLSLShader(cmdLine, gles, code, writer);
1296                     compiled = compileGLSLShader(cmdLine, essl, code, writer);
12981297#endif // 0
12991298                  }
13001299                  else
r244985r244986
13391338         }
13401339         else
13411340         {
1342            if (glsl)
1341            if (0 != glsl)
13431342            {
1344               preprocessor.writef(
1345                  "#define ivec2 vec2\n"
1346                  "#define ivec3 vec3\n"
1347                  "#define ivec4 vec4\n"
1348                  );
1343               if (120 == glsl
1344               ||  essl)
1345               {
1346                  preprocessor.writef(
1347                     "#define ivec2 vec2\n"
1348                     "#define ivec3 vec3\n"
1349                     "#define ivec4 vec4\n"
1350                     );
1351               }
13491352
1350               if (0 == gles)
1353               if (0 == essl)
13511354               {
13521355                  // bgfx shadow2D/Proj behave like EXT_shadow_samplers
13531356                  // not as GLSL language 1.2 specs shadow2D/Proj.
r244985r244986
16451648                     return EXIT_FAILURE;
16461649                  }
16471650
1648                  if (glsl)
1651                  if (0 != glsl)
16491652                  {
16501653                     const char* profile = cmdLine.findOption('p', "profile");
16511654                     if (NULL == profile)
r244985r244986
16971700                     bx::write(writer, outputHash);
16981701                  }
16991702
1700                  if (glsl)
1703                  if (0 != glsl)
17011704                  {
17021705                     std::string code;
17031706
17041707                     bool hasTextureLod = NULL != bx::findIdentifierMatch(input, s_ARB_shader_texture_lod /*EXT_shader_texture_lod*/);
17051708
1706                     if (0 == gles)
1709                     if (0 == essl)
17071710                     {
17081711                        bx::stringPrintf(code, "#version %s\n", profile);
1709                        int32_t version = atoi(profile);
17101712
17111713                        bx::stringPrintf(code
17121714                           , "#define bgfxShadow2D shadow2D\n"
r244985r244986
17141716                           );
17151717
17161718                        if (hasTextureLod
1717                        &&  130 > version)
1719                        &&  130 > glsl)
17181720                        {
17191721                           bx::stringPrintf(code
17201722                              , "#extension GL_ARB_shader_texture_lod : enable\n"
r244985r244986
17671769                     }
17681770
17691771                     code += preprocessor.m_preprocessed;
1770                     compiled = compileGLSLShader(cmdLine, gles, code, writer);
1772                     compiled = compileGLSLShader(cmdLine, essl, code, writer);
17711773                  }
17721774                  else
17731775                  {
trunk/3rdparty/bx/scripts/toolchain.lua
r244985r244986
298298         premake.vstudio.toolset = ("v110_xp")
299299         location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
300300      end
301     
301
302302      if ("vs2013-xp") == _OPTIONS["vs"] then
303303         premake.vstudio.toolset = ("v120_xp")
304304         location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
305305      end
306     
306
307307   elseif _ACTION == "xcode4" then
308308
309309      if "osx" == _OPTIONS["xcode"] then
r244985r244986
414414      defines { "WIN32" }
415415      includedirs { path.join(bxDir, "include/compat/mingw") }
416416      buildoptions {
417         "-std=c++11",
418417         "-Wunused-value",
419418         "-fdata-sections",
420419         "-ffunction-sections",
r244985r244986
422421         "-Wunused-value",
423422         "-Wundef",
424423      }
424      buildoptions_cpp {
425         "-std=c++0x",
426      }
425427      linkoptions {
426428         "-Wl,--gc-sections",
427429         "-static-libgcc",
r244985r244986
486488
487489   configuration { "linux-*" }
488490      buildoptions {
489         "-std=c++0x",
490491         "-msse2",
491492         "-Wunused-value",
492493         "-Wundef",
493494      }
495      buildoptions_cpp {
496         "-std=c++0x",
497      }     
494498      links {
495499         "rt",
496500         "dl",
r244985r244986
845849         "__STDC_VERSION__=199901L",
846850      }
847851      buildoptions {
848         "-std=c++0x",
849852         "-Wunused-value",
850853         "-Wundef",
851854      }
855      buildoptions_cpp {
856         "-std=c++0x",
857      }
852858      includedirs {
853859         "/opt/vc/include",
854860         "/opt/vc/include/interface/vcos/pthreads",
trunk/3rdparty/bx/tools/bin/darwin/genie
r244985r244986
Previous 199869 Revisions Next


© 1997-2024 The MAME Team